diff options
author | Milos Kleint | 2011-01-20 08:12:55 +0000 |
---|---|---|
committer | Milos Kleint | 2011-01-20 08:12:55 +0000 |
commit | d66ea518b50e96e6e2783feb3cb9a93cdb662410 (patch) | |
tree | 10cf002e3deb71b7714310de7bacc40c406bee5a /org.eclipse.m2e.editor.xml | |
parent | 46bdd577fa081165bdd4ecd6717ece0e67eca237 (diff) | |
download | m2e-core-d66ea518b50e96e6e2783feb3cb9a93cdb662410.tar.gz m2e-core-d66ea518b50e96e6e2783feb3cb9a93cdb662410.tar.xz m2e-core-d66ea518b50e96e6e2783feb3cb9a93cdb662410.zip |
MNGECLIPSE-2658 better texts and i18n
Diffstat (limited to 'org.eclipse.m2e.editor.xml')
3 files changed, 27 insertions, 31 deletions
diff --git a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/Messages.java b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/Messages.java index cc6f4b8c..2833bfb1 100644 --- a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/Messages.java +++ b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/Messages.java @@ -40,6 +40,14 @@ public class Messages extends NLS { public static String InsertExpressionProposal_hint2; + public static String LifecycleMappingProposal_execute_desc; + + public static String LifecycleMappingProposal_execute_label; + + public static String LifecycleMappingProposal_ignore_desc; + + public static String LifecycleMappingProposal_ignore_label; + public static String MavenMarkerResolution_error; public static String MavenMarkerResolution_error_title; 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 4b50df2c..4cb40ba4 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 @@ -2,8 +2,6 @@ package org.eclipse.m2e.editor.xml.internal.lifecycle; import java.io.IOException; -import org.w3c.dom.Element; - import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; import org.eclipse.core.runtime.CoreException; @@ -13,23 +11,23 @@ import org.eclipse.jface.text.contentassist.ICompletionProposal; import org.eclipse.jface.text.contentassist.ICompletionProposalExtension5; import org.eclipse.jface.text.contentassist.IContextInformation; import org.eclipse.jface.text.quickassist.IQuickAssistInvocationContext; +import org.eclipse.osgi.util.NLS; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; import org.eclipse.ui.IMarkerResolution; import org.eclipse.ui.internal.WorkbenchPlugin; import org.eclipse.ui.texteditor.MarkerAnnotation; -import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; import org.eclipse.m2e.core.core.IMavenConstants; +import org.eclipse.m2e.core.core.MavenLogger; import org.eclipse.m2e.editor.xml.internal.Messages; import org.eclipse.m2e.editor.xml.internal.PomEdits; -import org.eclipse.m2e.editor.xml.internal.XmlUtils; public class LifecycleMappingProposal implements ICompletionProposal, ICompletionProposalExtension5, IMarkerResolution { - public static final String EXECUTE = "execute"; + public static final String EXECUTE = "execute"; //$NON-NLS-1$ - public static final String IGNORE = "ignore"; + public static final String IGNORE = "ignore"; //$NON-NLS-1$ private IQuickAssistInvocationContext context; private final IMarker marker; @@ -59,10 +57,10 @@ public class LifecycleMappingProposal implements ICompletionProposal, ICompletio } private LifecycleMappingOperation createOperation() { - String pluginGroupId = marker.getAttribute(IMavenConstants.MARKER_ATTR_GROUP_ID, ""); - String pluginArtifactId = marker.getAttribute(IMavenConstants.MARKER_ATTR_ARTIFACT_ID, ""); - String pluginVersion = marker.getAttribute(IMavenConstants.MARKER_ATTR_VERSION, ""); - String[] goals = new String[] { marker.getAttribute(IMavenConstants.MARKER_ATTR_GOAL, "")}; + String pluginGroupId = marker.getAttribute(IMavenConstants.MARKER_ATTR_GROUP_ID, ""); //$NON-NLS-1$ + String pluginArtifactId = marker.getAttribute(IMavenConstants.MARKER_ATTR_ARTIFACT_ID, ""); //$NON-NLS-1$ + String pluginVersion = marker.getAttribute(IMavenConstants.MARKER_ATTR_VERSION, ""); //$NON-NLS-1$ + String[] goals = new String[] { marker.getAttribute(IMavenConstants.MARKER_ATTR_GOAL, "")}; //$NON-NLS-1$ return new LifecycleMappingOperation(pluginGroupId, pluginArtifactId, pluginVersion, action, goals); } @@ -76,7 +74,8 @@ public class LifecycleMappingProposal implements ICompletionProposal, ICompletio } public String getDisplayString() { - return IGNORE.equals(action) ? "Ignore TODO" : "Execute TODO"; + String goal = marker.getAttribute(IMavenConstants.MARKER_ATTR_GOAL, ""); //$NON-NLS-1$ + return IGNORE.equals(action) ? NLS.bind(Messages.LifecycleMappingProposal_ignore_label, goal) : NLS.bind(Messages.LifecycleMappingProposal_execute_label, goal); } public Image getImage() { @@ -93,22 +92,9 @@ public class LifecycleMappingProposal implements ICompletionProposal, ICompletio //no context in markerresolution, just to be sure.. return null; } - final IDocument doc = context.getSourceViewer().getDocument(); - //oh, how do I miss scala here.. - final String[] toRet = new String[1]; -// XmlUtils.performOnRootElement(doc, new NodeOperation<Element>() { -// public void process(Element root) { -// //now check parent version and groupid against the current project's ones.. -// if (root.getNodeName().equals(PomQuickAssistProcessor.PROJECT_NODE)) { //$NON-NLS-1$ -// Element value = XmlUtils.findChildElement(root, isVersion ? VERSION_NODE : GROUP_ID_NODE); //$NON-NLS-1$ //$NON-NLS-2$ -// toRet[0] = previewForRemovedElement(doc, value); -// } -// }}); - if (toRet[0] != null) { - return toRet[0]; - } - - return "TODO"; + return IGNORE.equals(action) + ? Messages.LifecycleMappingProposal_ignore_desc + : Messages.LifecycleMappingProposal_execute_desc; } public String getLabel() { @@ -119,11 +105,9 @@ public class LifecycleMappingProposal implements ICompletionProposal, ICompletio try { PomEdits.performOnDOMDocument(new PomEdits.OperationTuple((IFile) marker.getResource(), createOperation())); } catch(IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + MavenLogger.log("Error generating code in pom.xml", e); //$NON-NLS-1$ } catch(CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + MavenLogger.log(e); } } diff --git a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/messages.properties b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/messages.properties index c48c0d3f..57079482 100644 --- a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/messages.properties +++ b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/messages.properties @@ -9,6 +9,10 @@ InsertArtifactProposal_insert_plugin_title=Select Plugin InsertArtifactProposal_searchDialog_title=Select Parent InsertExpressionProposal_hint1=The expression evaluates to <b>{0}</b> in the current effective pom. InsertExpressionProposal_hint2=<br>It is based on property defined in <b>{0}</b> +LifecycleMappingProposal_execute_desc=This quickfix generates a plugin configuration snippet recognized by the m2e integration during project configuration. It marks the given goal to be executed during the Eclipse build. +LifecycleMappingProposal_execute_label=Execute goal {0} as part of Eclipse build. +LifecycleMappingProposal_ignore_desc=This quickfix generates a plugin configuration snippet recognized by the m2e integration during project configuration. It marks the given goal as ignored for the purposes of the Eclipse build. +LifecycleMappingProposal_ignore_label=Ignore goal {0} in Eclipse build. MavenMarkerResolution_error=Unable to apply the quick fix. The file may have unsaved changes that invalidate the current quick fix. MavenMarkerResolution_error_title=Error MavenMarkerResolution_schema_label=Add Schema information to the specified pom.xml |