Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Piggott2011-04-13 11:19:27 -0400
committerMatthew Piggott2011-04-13 11:20:01 -0400
commit047dceaaf5ea76d34eb6ca895e26d3e9806be6b9 (patch)
tree0cb938c2f737fe8e8f0b9610a14452af0829ee4e /org.eclipse.m2e.editor.xml
parent735decefe67c30aa3c9fb2e52ed4a6c9a3ae5592 (diff)
downloadm2e-core-047dceaaf5ea76d34eb6ca895e26d3e9806be6b9.tar.gz
m2e-core-047dceaaf5ea76d34eb6ca895e26d3e9806be6b9.tar.xz
m2e-core-047dceaaf5ea76d34eb6ca895e26d3e9806be6b9.zip
Added title to LifecycleMappingDialog, cleanup to LifecycleMappingProposal
Diffstat (limited to 'org.eclipse.m2e.editor.xml')
-rw-r--r--org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/lifecycle/LifecycleMappingDialog.java14
-rw-r--r--org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/lifecycle/LifecycleMappingProposal.java32
2 files changed, 32 insertions, 14 deletions
diff --git a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/lifecycle/LifecycleMappingDialog.java b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/lifecycle/LifecycleMappingDialog.java
index 729924a7..8543d4fe 100644
--- a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/lifecycle/LifecycleMappingDialog.java
+++ b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/lifecycle/LifecycleMappingDialog.java
@@ -22,6 +22,8 @@ import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.layout.GridData;
@@ -54,15 +56,24 @@ public class LifecycleMappingDialog extends Dialog implements ISelectionChangedL
private String pluginVersion;
+ private String goal;
+
private MavenProject pluginProject;
public LifecycleMappingDialog(Shell parentShell, IFile pom, String pluginGroupId, String pluginArtifactId,
- String pluginVersion) {
+ String pluginVersion, String goal) {
super(parentShell);
facade = MavenPlugin.getMavenProjectRegistry().create(pom, true, new NullProgressMonitor());
this.pluginGroupId = pluginGroupId;
this.pluginArtifactId = pluginArtifactId;
this.pluginVersion = pluginVersion;
+ this.goal = goal;
+ }
+
+ @Override
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ shell.setText(NLS.bind("Ignore {0}", goal));
}
@Override
@@ -84,6 +95,7 @@ public class LifecycleMappingDialog extends Dialog implements ISelectionChangedL
status.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false));
pluginProject = locatePlugin();
+ pomComposite.setSelection(new StructuredSelection(pluginProject));
return container;
}
diff --git a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/lifecycle/LifecycleMappingProposal.java b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/lifecycle/LifecycleMappingProposal.java
index a07c130c..ec84fe42 100644
--- a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/lifecycle/LifecycleMappingProposal.java
+++ b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/lifecycle/LifecycleMappingProposal.java
@@ -34,8 +34,7 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IMarkerResolution;
-import org.eclipse.ui.internal.Workbench;
-import org.eclipse.ui.internal.WorkbenchPlugin;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.texteditor.MarkerAnnotation;
import org.eclipse.m2e.core.core.IMavenConstants;
@@ -65,23 +64,27 @@ public class LifecycleMappingProposal implements ICompletionProposal, ICompletio
public void apply(final IDocument doc) {
try {
- perform();
+ if(PluginExecutionAction.ignore.equals(action)) {
+ performIgnore();
+ } else {
+ performOnDOMDocument(new OperationTuple(doc, createOperation()));
+ }
} catch(IOException e) {
log.error("Error generating code in pom.xml", e); //$NON-NLS-1$
} catch(CoreException e) {
log.error(e.getMessage(), e);
}
}
-
- private void perform() throws IOException, CoreException {
+
+ private void performIgnore() throws IOException, CoreException {
final IFile[] pomFile = new IFile[1];
- Workbench.getInstance().getDisplay().syncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
public void run() {
LifecycleMappingDialog dialog = new LifecycleMappingDialog(Display.getCurrent().getActiveShell(),
(IFile) marker.getResource(), marker.getAttribute(IMavenConstants.MARKER_ATTR_GROUP_ID, ""), marker
.getAttribute(IMavenConstants.MARKER_ATTR_ARTIFACT_ID, ""), marker.getAttribute(
- IMavenConstants.MARKER_ATTR_VERSION, ""));
+ IMavenConstants.MARKER_ATTR_VERSION, ""), marker.getAttribute(IMavenConstants.MARKER_ATTR_GOAL, ""));
dialog.setBlockOnOpen(true);
if(dialog.open() == Window.OK) {
pomFile[0] = dialog.getPomFile();
@@ -117,9 +120,9 @@ public class LifecycleMappingProposal implements ICompletionProposal, ICompletio
}
public Image getImage() {
- return PluginExecutionAction.ignore.equals(action) ? WorkbenchPlugin.getDefault().getImageRegistry()
- .get(org.eclipse.ui.internal.SharedImages.IMG_TOOL_DELETE)
- : WorkbenchPlugin.getDefault().getImageRegistry().get(org.eclipse.ui.internal.SharedImages.IMG_TOOL_FORWARD);
+ return PluginExecutionAction.ignore.equals(action) ? PlatformUI.getWorkbench().getSharedImages()
+ .getImage(org.eclipse.ui.ISharedImages.IMG_TOOL_DELETE) : PlatformUI.getWorkbench().getSharedImages()
+ .getImage(org.eclipse.ui.ISharedImages.IMG_TOOL_FORWARD);
}
public Point getSelection(IDocument arg0) {
@@ -152,12 +155,15 @@ public class LifecycleMappingProposal implements ICompletionProposal, ICompletio
public void run(final IMarker marker) {
try {
- perform();
+ if(PluginExecutionAction.ignore.equals(action)) {
+ performIgnore();
+ } else {
+ performOnDOMDocument(new OperationTuple((IFile) marker.getResource(), createOperation()));
+ }
} catch(IOException e) {
log.error("Error generating code in pom.xml", e); //$NON-NLS-1$
} catch(CoreException e) {
log.error(e.getMessage(), e);
}
-
- }
+ }
} \ No newline at end of file

Back to the top