Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilos Kleint2011-02-09 04:22:12 -0500
committerMilos Kleint2011-02-09 04:24:51 -0500
commit669341e14247b627a0d39628723f3b6a1123ee71 (patch)
tree91a2432012e4c9c6891e86752ac34b216b8df282 /org.eclipse.m2e.editor.xml
parent681d24add5d563c8e8bdf99748177af91e2f4ba2 (diff)
downloadm2e-core-669341e14247b627a0d39628723f3b6a1123ee71.tar.gz
m2e-core-669341e14247b627a0d39628723f3b6a1123ee71.tar.xz
m2e-core-669341e14247b627a0d39628723f3b6a1123ee71.zip
335299, 335490 have a more prominent place for the discover quick fix proposal, show only once on one line in editor and when invoked, take all markers in the same file into consideration
Diffstat (limited to 'org.eclipse.m2e.editor.xml')
-rw-r--r--org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomQuickAssistProcessor.java47
1 files changed, 44 insertions, 3 deletions
diff --git a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomQuickAssistProcessor.java b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomQuickAssistProcessor.java
index 52490df2..07bf0ac3 100644
--- a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomQuickAssistProcessor.java
+++ b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/PomQuickAssistProcessor.java
@@ -115,9 +115,9 @@ public class PomQuickAssistProcessor implements IQuickAssistProcessor {
proposals.add(new SchemaCompletionProposal(context, mark));
}
else if (hint.equals(IMavenConstants.EDITOR_HINT_NOT_COVERED_MOJO_EXECUTION)) {
+ extractedFromMarkers(proposals, mark); //having this first sort of helps for 335490
proposals.add(new LifecycleMappingProposal(context, mark, PluginExecutionAction.ignore));
proposals.add(new LifecycleMappingProposal(context, mark, PluginExecutionAction.execute));
- extractedFromMarkers(proposals, mark);
} else if (hint.equals(IMavenConstants.EDITOR_HINT_UNKNOWN_PACKAGING)){
extractedFromMarkers(proposals, mark);
}
@@ -146,7 +146,15 @@ public class PomQuickAssistProcessor implements IQuickAssistProcessor {
for (IMarkerResolution res : resolutions) {
//sort of weak condition, but can't think of anything else that would filter our explicitly declared ones..
if (!res.getClass().getName().contains("org.eclipse.m2e.editor.xml")) {
- proposals.add(new MarkerResolutionProposal(res, mark.getMarker()));
+ MarkerResolutionProposal prop = new MarkerResolutionProposal(res, mark.getMarker());
+ //335299 for discoveryWizardProposal have only one item returned per invokation.
+ if (res.getClass().getName().contains("DiscoveryWizardProposal")) {
+ if (!proposals.contains(prop)) {
+ proposals.add(prop);
+ }
+ } else {
+ proposals.add(prop);
+ }
}
}
}
@@ -699,11 +707,44 @@ static class IgnoreWarningProposal implements ICompletionProposal, ICompletionPr
/**
* a wrapper around IMarkerResolution that acts as ICompletionProposal
- *
+ * for 335299 introduced equals() and hashcode() methods that are based on the MarkerResolution passed in.
* @author mkleint
*/
public class MarkerResolutionProposal implements ICompletionProposal {
+ /**
+ *
+ * for 335299 introduced equals() and hashcode() methods that are based on the MarkerResolution passed in.
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((resolution == null) ? 0 : resolution.hashCode());
+ return result;
+ }
+
+ /*
+ * for 335299 introduced equals() and hashcode() methods that are based on the MarkerResolution passed in.
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if(this == obj)
+ return true;
+ if(obj == null)
+ return false;
+ if(!(obj instanceof MarkerResolutionProposal))
+ return false;
+ MarkerResolutionProposal other = (MarkerResolutionProposal) obj;
+ if(resolution == null) {
+ if(other.resolution != null)
+ return false;
+ } else if(!resolution.equals(other.resolution))
+ return false;
+ return true;
+ }
+
private final IMarkerResolution resolution;
private final IMarker marker;

Back to the top