[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [iam-dev] New Pom modification utility
|
As an idea, I think that the PomModifier.modifyPom() can be called
from anywhere it is needed and the specific PomModificationAction
implementations can probably be reused.
The goal would be to have the calls to modifyPom() as one liners to
simplify reading.
Does it make any sense?
El 06/01/2009, a las 8:18, Korina Cordero escribió:
I found another similar bug, this time to the data we show in a
TreeViewer (already filed in Bugzilla)
A fix similar to that of Bug 258892 and Bug 258893 would probably
fix this issue. But I was wondering, since it seems that the code
snippet that calls PomModifier.modifyPom() will be heavily used by
the POM Editor, where would the best place to put those codes
calling PomModifier.modifyPom()?
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
_______________________________________________
iam-dev mailing list
iam-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/iam-dev