diff options
author | Milos Kleint | 2011-06-27 07:13:54 +0000 |
---|---|---|
committer | Milos Kleint | 2011-06-27 07:13:54 +0000 |
commit | 20333002e8e521f399d661449f4d05ba82447e2a (patch) | |
tree | 6f2f06c13a99786b4ea34da2ce70e013147df2e9 | |
parent | 67fc25243fb55f75b55526623723354d2c73a045 (diff) | |
download | m2e-core-20333002e8e521f399d661449f4d05ba82447e2a.tar.gz m2e-core-20333002e8e521f399d661449f4d05ba82447e2a.tar.xz m2e-core-20333002e8e521f399d661449f4d05ba82447e2a.zip |
350136 the current selection processing needs to come first. Both addDependency and addPlugin actions that use this method are declared on popup menus where current selection is paramount. The active editor processing is a relict from time we had actions defined in main menu as well.
-rw-r--r-- | org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/MavenActionSupport.java | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/MavenActionSupport.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/MavenActionSupport.java index 377f2d37..10c4c385 100644 --- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/MavenActionSupport.java +++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/actions/MavenActionSupport.java @@ -100,7 +100,21 @@ public abstract class MavenActionSupport implements IObjectActionDelegate { } protected IFile getPomFileFromPomEditorOrViewSelection() { - IFile file = null; + IFile file = null; + + //350136 we need to process the selection first! that's what is relevant for any popup menu action we have. + //the processing of active editor first might have been only relevant when we had the actions in main menu, but even + // then the popups were wrong.. + Object o = selection.iterator().next(); + + if(o instanceof IProject) { + file = ((IProject) o).getFile(IMavenConstants.POM_FILE_NAME); + } else if(o instanceof IFile) { + file = (IFile) o; + } + if (file != null) { + return file; + } // // If I am in the POM editor I want to get hold of the IFile that is currently in the buffer // @@ -121,22 +135,8 @@ public abstract class MavenActionSupport implements IObjectActionDelegate { } } } - } - - // - // Otherwise we will assume a pom.xml file or IProject is being selected in the - // package explorer and we'll get the IFile from that. Otherwise we'll bail. - // - Object o = selection.iterator().next(); - - if(o instanceof IProject) { - file = ((IProject) o).getFile(IMavenConstants.POM_FILE_NAME); - } else if(o instanceof IFile) { - file = (IFile) o; - } else { - file = null; } - - return file; + return null; } + } |