Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilos Kleint2010-12-29 07:56:03 -0500
committerMilos Kleint2010-12-29 07:56:03 -0500
commit5f1c2f7446f03acffb66b0da5bce158bf4ad7998 (patch)
tree3b67a04077731e98e8c7b2dc0ca4d510846f04e5
parent551bef3ded1a02d31100db157e10651255561a3f (diff)
downloadm2e-core-5f1c2f7446f03acffb66b0da5bce158bf4ad7998.tar.gz
m2e-core-5f1c2f7446f03acffb66b0da5bce158bf4ad7998.tar.xz
m2e-core-5f1c2f7446f03acffb66b0da5bce158bf4ad7998.zip
MNGECLIPSE-2690 attempt to unify the way emf models get created.
also added unrelated comments and finalized a few fields
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComposite.java20
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/dialogs/ManageDependenciesDialog.java13
2 files changed, 15 insertions, 18 deletions
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComposite.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComposite.java
index fd280be8..83ba71df 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComposite.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComposite.java
@@ -120,17 +120,17 @@ public class DependenciesComposite extends Composite {
ValueProvider<DependencyManagement> dependencyManagementProvider;
- DependencyLabelProvider dependencyLabelProvider = new DependencyLabelProvider();
+ final DependencyLabelProvider dependencyLabelProvider = new DependencyLabelProvider();
- DependencyLabelProvider dependencyManagementLabelProvider = new DependencyLabelProvider();
+ final DependencyLabelProvider dependencyManagementLabelProvider = new DependencyLabelProvider();
protected boolean showInheritedDependencies = false;
- ListEditorContentProvider<Object> dependenciesContentProvider = new ListEditorContentProvider<Object>();
+ final ListEditorContentProvider<Object> dependenciesContentProvider = new ListEditorContentProvider<Object>();
DependenciesComparator<Object> dependenciesComparator;
- ListEditorContentProvider<Dependency> dependencyManagementContentProvider = new ListEditorContentProvider<Dependency>();
+ final ListEditorContentProvider<Dependency> dependencyManagementContentProvider = new ListEditorContentProvider<Dependency>();
DependenciesComparator<Dependency> dependencyManagementComparator;
@@ -355,14 +355,14 @@ public class DependenciesComposite extends Composite {
Section dependencyManagementSection = toolkit.createSection(verticalSash, ExpandableComposite.TITLE_BAR);
dependencyManagementSection.marginWidth = 3;
dependencyManagementSection.setText(Messages.DependenciesComposite_sectionDependencyManagement);
+ dependencyManagementComparator = new DependenciesComparator<Dependency>();
+ dependencyManagementContentProvider.setComparator(dependencyManagementComparator);
dependencyManagementEditor = new PropertiesListComposite<Dependency>(dependencyManagementSection, SWT.NONE, true);
+ dependencyManagementEditor.setContentProvider(dependencyManagementContentProvider);
+ dependencyManagementEditor.setLabelProvider(dependencyManagementLabelProvider);
dependencyManagementSection.setClient(dependencyManagementEditor);
- dependencyManagementComparator = new DependenciesComparator<Dependency>();
- dependencyManagementContentProvider.setComparator(dependencyManagementComparator);
- dependencyManagementEditor.setLabelProvider(dependencyManagementLabelProvider);
- dependencyManagementEditor.setContentProvider(dependencyManagementContentProvider);
dependencyManagementEditor.setRemoveButtonListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@@ -541,8 +541,8 @@ public class DependenciesComposite extends Composite {
}
if(object instanceof DependencyManagement) {
- if(dependenciesEditor.getInput() == null) {
- dependenciesEditor.setInput((List<Object>)(List<?>)((DependencyManagement) object).getDependencies());
+ if(dependencyManagementEditor.getInput() == null) {
+ dependencyManagementEditor.setInput(((DependencyManagement) object).getDependencies());
}
dependencyManagementEditor.refresh();
}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/dialogs/ManageDependenciesDialog.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/dialogs/ManageDependenciesDialog.java
index 1213bf19..4781492f 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/dialogs/ManageDependenciesDialog.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/dialogs/ManageDependenciesDialog.java
@@ -86,7 +86,7 @@ public class ManageDependenciesDialog extends AbstractMavenDialog {
LinkedList<MavenProject> projectHierarchy;
- protected EditingDomain editingDomain;
+ final protected EditingDomain editingDomain;
private IStatus status;
@@ -287,6 +287,7 @@ public class ManageDependenciesDialog extends AbstractMavenDialog {
* so we don't need to add it.
*/
iter.remove();
+ //TODO: mkleint: what if the existing managed version differs from the version in the child pom?
}
}
}
@@ -309,18 +310,14 @@ public class ManageDependenciesDialog extends AbstractMavenDialog {
}
protected Model loadTargetModel(IMavenProjectFacade facade) {
- Model targetModel;
- PomResourceFactoryImpl factory = new PomResourceFactoryImpl();
- PomResourceImpl resource = (PomResourceImpl) factory.createResource(URI
- .createFileURI(facade.getPomFile().getPath()));
try {
+ PomResourceImpl resource = MavenPlugin.getDefault().getMavenModelManager().loadResource(facade.getPom());
resource.load(Collections.EMPTY_MAP);
- } catch(IOException e) {
+ return resource.getModel();
+ } catch(Exception e) {
MavenLogger.log("Can't load model " + facade.getPomFile().getPath(), e); //$NON-NLS-1$
return null;
}
- targetModel = (Model) resource.getContents().get(0);
- return targetModel;
}
protected LinkedList<Dependency> getDependenciesList() {

Back to the top