Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [iam-dev] New Pom modification utility

Hi Mike,

This was what fixed the Bug 258893 right? =)

We'll have to implement something similar to this for all the data in the POM Editor that use Tables for display.

Would you want to do it?

thanks,
Korina

Michael Poindexter wrote:
I've added a simple utility class to perform formatting preserving modifications to POM files. This code lives in org.eclipse.iam.pom.util.PomModifier. An example of usage is below:

final Collection<Dependency> dependencies = getDependencies();
                        IFile pomFile = getPomFile();
PomModifier.modifyPom( pomFile, new PomModificationAction() { public boolean modify( Model model, IProgressMonitor progressMonitor )
                             {
                                 model.getDependencies().clear();
                                 for( Dependency d : dependencies )
                                 {
org.eclipse.iam.pom.Dependency dep = PomFactory.eINSTANCE.createDependency(); dep.setArtifactId( d.getArtifactId() ); dep.setClassifier( d.getClassifier() );
                                     dep.setGroupId( d.getGroupId() );
                                     dep.setOptional( d.isOptional() );
                                     dep.setScope( d.getScope() );
dep.setSystemPath( d.getSystemPath() );
                                     dep.setType( d.getType() );
                                     dep.setVersion( d.getVersion() );
                                     model.getDependencies().add( dep );
                                 }
                                 return true;
                             }
                        }, new NullProgressMonitor() );

This example would rewrite the <dependencies> section of the pom with a new set of dependencies while leaving the rest of the XML untouched. Any thoughts on this?

Mike
------------------------------------------------------------------------

_______________________________________________
iam-dev mailing list
iam-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/iam-dev



Back to the top