Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilos Kleint2011-02-08 11:56:09 +0000
committerMilos Kleint2011-02-08 11:56:09 +0000
commitd9cd54af7994f2b93dfaa39ce31c3d8648c8862d (patch)
treeee9a0a02dfb5b258c6477a5427f144c64032217d /org.eclipse.m2e.editor
parent76461d6c96fdbe3c3ce1ff1abdfbaf52a0914523 (diff)
downloadm2e-core-d9cd54af7994f2b93dfaa39ce31c3d8648c8862d.tar.gz
m2e-core-d9cd54af7994f2b93dfaa39ce31c3d8648c8862d.tar.xz
m2e-core-d9cd54af7994f2b93dfaa39ce31c3d8648c8862d.zip
335725 remove the AddDependencyDialog class, use the same dialog everywhere, additionally improve completion in the version field to propose ${XXXVersion} values as well.
Diffstat (limited to 'org.eclipse.m2e.editor')
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComposite.java55
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependencyDetailComposite.java2
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/PluginsComposite.java2
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/ReportingComposite.java2
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/BuildPage.java2
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/OverviewPage.java3
6 files changed, 34 insertions, 32 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 1c504a1e..534e1690 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
@@ -47,10 +47,11 @@ import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.window.Window;
import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.core.MavenLogger;
+import org.eclipse.m2e.core.index.IndexedArtifactFile;
import org.eclipse.m2e.core.project.IMavenProjectFacade;
import org.eclipse.m2e.core.project.MavenProjectManager;
-import org.eclipse.m2e.core.ui.dialogs.AddDependencyDialog;
import org.eclipse.m2e.core.ui.dialogs.EditDependencyDialog;
+import org.eclipse.m2e.core.ui.dialogs.MavenRepositorySearchDialog;
import org.eclipse.m2e.editor.MavenEditorImages;
import org.eclipse.m2e.editor.MavenEditorPlugin;
import org.eclipse.m2e.editor.dialogs.ManageDependenciesDialog;
@@ -208,7 +209,7 @@ public class DependenciesComposite extends Composite {
if (selection instanceof Dependency) {
Dependency dependency = (Dependency) selection;
EditDependencyDialog d = new EditDependencyDialog(getShell(), false, editorPage.getEditingDomain(), editorPage
- .getProject());
+ .getProject(), editorPage.getPomEditor().getMavenProject());
d.setDependency(dependency);
if(d.open() == Window.OK) {
setDependenciesInput();
@@ -241,19 +242,19 @@ public class DependenciesComposite extends Composite {
dependenciesEditor.setAddButtonListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- final AddDependencyDialog addDepDialog = new AddDependencyDialog(getShell(), false, editorPage.getProject(), editorPage.getPomEditor().getMavenProject());
+ final MavenRepositorySearchDialog addDepDialog = MavenRepositorySearchDialog.createSearchDependencyDialog(
+ getShell(), Messages.DependenciesComposite_action_selectDependency, editorPage.getPomEditor().getMavenProject(), editorPage.getProject(), false);
+
if(addDepDialog.open() == Window.OK) {
- List<Dependency> deps = addDepDialog.getDependencies();
- for(Dependency dep : deps) {
- setupDependency(new ValueProvider<Model>() {
- @Override
- public Model getValue() {
- return model;
- }
- }, POM_PACKAGE.getModel_Dependencies(), dep);
- }
+ IndexedArtifactFile dep = (IndexedArtifactFile) addDepDialog.getFirstResult();
+ Dependency d = setupDependency(new ValueProvider<Model>() {
+ @Override
+ public Model getValue() {
+ return model;
+ }
+ }, POM_PACKAGE.getModel_Dependencies(), dep, addDepDialog.getSelectedScope());
setDependenciesInput();
- dependenciesEditor.setSelection(Collections.singletonList((Object) deps.get(0)));
+ dependenciesEditor.setSelection(Collections.<Object>singletonList(d));
}
}
@@ -388,7 +389,7 @@ public class DependenciesComposite extends Composite {
public void widgetSelected(SelectionEvent e) {
Dependency dependency = dependencyManagementEditor.getSelection().get(0);
EditDependencyDialog d = new EditDependencyDialog(getShell(), true, editorPage.getEditingDomain(), editorPage
- .getProject());
+ .getProject(), editorPage.getPomEditor().getMavenProject());
d.setDependency(dependency);
if(d.open() == Window.OK) {
dependencyManagementEditor.setInput(dependencyManagementProvider.getValue().getDependencies());
@@ -414,15 +415,14 @@ public class DependenciesComposite extends Composite {
dependencyManagementEditor.setAddButtonListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- final AddDependencyDialog addDepDialog = new AddDependencyDialog(getShell(), true, editorPage.getProject(), editorPage.getPomEditor().getMavenProject());
+ final MavenRepositorySearchDialog addDepDialog = MavenRepositorySearchDialog.createSearchDependencyDialog(
+ getShell(), Messages.DependenciesComposite_action_selectDependency, editorPage.getPomEditor().getMavenProject(), editorPage.getProject(), true);
if(addDepDialog.open() == Window.OK) {
- List<Dependency> deps = addDepDialog.getDependencies();
- for(Dependency dep : deps) {
- setupDependency(dependencyManagementProvider, POM_PACKAGE.getDependencyManagement_Dependencies(), dep);
- }
+ IndexedArtifactFile dep = (IndexedArtifactFile) addDepDialog.getFirstResult();
+ Dependency d = setupDependency(dependencyManagementProvider, POM_PACKAGE.getDependencyManagement_Dependencies(), dep, addDepDialog.getSelectedScope());
setDependenciesInput();
dependencyManagementEditor.setInput(dependencyManagementProvider.getValue().getDependencies());
- dependencyManagementEditor.setSelection(Collections.singletonList(deps.get(0)));
+ dependencyManagementEditor.setSelection(Collections.singletonList(d));
//refresh this one to update decorations..
dependenciesEditor.refresh();
}
@@ -565,7 +565,7 @@ public class DependenciesComposite extends Composite {
});
}
- void setupDependency(ValueProvider<? extends EObject> parentProvider, EReference feature, Dependency dependency) {
+ Dependency setupDependency(ValueProvider<? extends EObject> parentProvider, EReference feature, IndexedArtifactFile dependency, String scope) {
CompoundCommand compoundCommand = new CompoundCommand();
EditingDomain editingDomain = editorPage.getEditingDomain();
@@ -579,14 +579,15 @@ public class DependenciesComposite extends Composite {
Command addDependencyCommand = AddCommand.create(editingDomain, parent, feature, clone);
compoundCommand.append(addDependencyCommand);
//only the props as defined in AddDependencyDialog.createDependency()
- compoundCommand.append(ManageDependenciesDialog.createCommand(editingDomain, clone, dependency.getGroupId(), PomPackage.eINSTANCE.getDependency_GroupId(), ""));
- compoundCommand.append(ManageDependenciesDialog.createCommand(editingDomain, clone, dependency.getArtifactId(), PomPackage.eINSTANCE.getDependency_ArtifactId(), ""));
- compoundCommand.append(ManageDependenciesDialog.createCommand(editingDomain, clone, dependency.getVersion(), PomPackage.eINSTANCE.getDependency_Version(), ""));
- compoundCommand.append(ManageDependenciesDialog.createCommand(editingDomain, clone, dependency.getClassifier(), PomPackage.eINSTANCE.getDependency_Classifier(), ""));
- compoundCommand.append(ManageDependenciesDialog.createCommand(editingDomain, clone, dependency.getScope(), PomPackage.eINSTANCE.getDependency_Scope(), ""));
- compoundCommand.append(ManageDependenciesDialog.createCommand(editingDomain, clone, dependency.getType(), PomPackage.eINSTANCE.getDependency_Type(), ""));
+ compoundCommand.append(ManageDependenciesDialog.createCommand(editingDomain, clone, dependency.group, PomPackage.eINSTANCE.getDependency_GroupId(), ""));
+ compoundCommand.append(ManageDependenciesDialog.createCommand(editingDomain, clone, dependency.artifact, PomPackage.eINSTANCE.getDependency_ArtifactId(), ""));
+ compoundCommand.append(ManageDependenciesDialog.createCommand(editingDomain, clone, dependency.version, PomPackage.eINSTANCE.getDependency_Version(), ""));
+ compoundCommand.append(ManageDependenciesDialog.createCommand(editingDomain, clone, dependency.classifier, PomPackage.eINSTANCE.getDependency_Classifier(), ""));
+ compoundCommand.append(ManageDependenciesDialog.createCommand(editingDomain, clone, scope, PomPackage.eINSTANCE.getDependency_Scope(), ""));
+ compoundCommand.append(ManageDependenciesDialog.createCommand(editingDomain, clone, dependency.type, PomPackage.eINSTANCE.getDependency_Type(), ""));
editingDomain.getCommandStack().execute(compoundCommand);
+ return clone;
}
// Dependency createDependency(ValueProvider<? extends EObject> parentProvider, EReference feature, String groupId,
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependencyDetailComposite.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependencyDetailComposite.java
index 28712236..8fd27f55 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependencyDetailComposite.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependencyDetailComposite.java
@@ -156,7 +156,7 @@ public class DependencyDetailComposite extends Composite {
versionTextData.horizontalIndent = 4;
versionTextData.widthHint = 200;
versionText.setLayoutData(versionTextData);
- ProposalUtil.addVersionProposal(editorPage.getProject(), groupIdText, artifactIdText, versionText, Packaging.ALL);
+ ProposalUtil.addVersionProposal(editorPage.getProject(), editorPage.getPomEditor().getMavenProject(), groupIdText, artifactIdText, versionText, Packaging.ALL);
Label classifierLabel = toolkit.createLabel(this, Messages.DependenciesComposite_lblClassifier, SWT.NONE);
classifierLabel.setLayoutData(new GridData());
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/PluginsComposite.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/PluginsComposite.java
index 1cf28ee9..9a47ae0e 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/PluginsComposite.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/PluginsComposite.java
@@ -517,7 +517,7 @@ public class PluginsComposite extends Composite{
versionTextData.widthHint = 200;
versionText.setLayoutData(versionTextData);
versionText.setData("name", "versionText"); //$NON-NLS-1$ //$NON-NLS-2$
- ProposalUtil.addVersionProposal(parentEditorPage.getProject(), groupIdText, artifactIdText, versionText, Packaging.PLUGIN);
+ ProposalUtil.addVersionProposal(parentEditorPage.getProject(), parentEditorPage.getPomEditor().getMavenProject(), groupIdText, artifactIdText, versionText, Packaging.PLUGIN);
parentEditorPage.createEvaluatorInfo(versionText);
// pluginSelectButton = toolkit.createButton(pluginDetailsComposite, "Select...", SWT.NONE);
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/ReportingComposite.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/ReportingComposite.java
index 2f158219..b2f27c03 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/ReportingComposite.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/ReportingComposite.java
@@ -368,7 +368,7 @@ public class ReportingComposite extends Composite {
gd_versionText.horizontalIndent = 4;
versionText.setLayoutData(gd_versionText);
versionText.setData("name", "versionText"); //$NON-NLS-1$ //$NON-NLS-2$
- ProposalUtil.addVersionProposal(editorPage.getProject(), groupIdText, artifactIdText, versionText, Packaging.ALL);
+ ProposalUtil.addVersionProposal(editorPage.getProject(), editorPage.getPomEditor().getMavenProject(), groupIdText, artifactIdText, versionText, Packaging.ALL);
Composite pluginConfigureComposite = toolkit.createComposite(pluginDetailsComposite, SWT.NONE);
GridData pluginConfigureCompositeData = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 2, 1);
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/BuildPage.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/BuildPage.java
index 6ad8ed34..8bb4790f 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/BuildPage.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/BuildPage.java
@@ -352,7 +352,7 @@ public class BuildPage extends MavenPomEditorPage {
extensionVersionText = toolkit.createText(extensionDetialsComposite, null, SWT.FLAT);
extensionVersionText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
extensionVersionText.setData("name", "extensionVersionText"); //$NON-NLS-1$ //$NON-NLS-2$
- ProposalUtil.addVersionProposal(getProject(), extensionGroupIdText, extensionArtifactIdText, extensionVersionText, Packaging.ALL);
+ ProposalUtil.addVersionProposal(getProject(), getPomEditor().getMavenProject(), extensionGroupIdText, extensionArtifactIdText, extensionVersionText, Packaging.ALL);
extensionDetialsComposite.setTabList(new Control[] {extensionGroupIdText, extensionArtifactIdText, extensionVersionText});
// extensionSelectButton = toolkit.createButton(extensionDetialsComposite, "Select...", SWT.FLAT);
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/OverviewPage.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/OverviewPage.java
index 43cb1b93..b6d02b72 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/OverviewPage.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/OverviewPage.java
@@ -443,7 +443,8 @@ public class OverviewPage extends MavenPomEditorPage {
parentVersionTextData.widthHint = 200;
parentVersionText.setLayoutData(parentVersionTextData);
parentVersionText.setData("name", "parentVersion"); //$NON-NLS-1$ //$NON-NLS-2$
- ProposalUtil.addVersionProposal(getProject(), parentGroupIdText, parentArtifactIdText, parentVersionText,
+ ProposalUtil.addVersionProposal(getProject(), null/** null because we don't want expressions from parent pom here */,
+ parentGroupIdText, parentArtifactIdText, parentVersionText,
Packaging.POM);
M2EUtils.addRequiredDecoration(parentVersionText);
createEvaluatorInfo(parentVersionText);

Back to the top