summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Cox2011-09-09 06:34:54 (EDT)
committercwindatt2011-09-09 12:58:58 (EDT)
commitea44007a37c60f475268c5a5a97c0fa3801ec5e1 (patch)
tree78f923c305182a4234ad17b50917667f4dd92a78
parent5807e2337c719d9ffcf9dffdb5319bc84e3f9f3a (diff)
downloadeclipse.pde.ui-ea44007a37c60f475268c5a5a97c0fa3801ec5e1.zip
eclipse.pde.ui-ea44007a37c60f475268c5a5a97c0fa3801ec5e1.tar.gz
eclipse.pde.ui-ea44007a37c60f475268c5a5a97c0fa3801ec5e1.tar.bz2
"Open Manifest" key binding.
-rw-r--r--ui/org.eclipse.pde.ui/plugin.properties4
-rw-r--r--ui/org.eclipse.pde.ui/plugin.xml53
-rw-r--r--ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/OpenManifestHandler.java (renamed from ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/OpenManifestAction.java)64
3 files changed, 82 insertions, 39 deletions
diff --git a/ui/org.eclipse.pde.ui/plugin.properties b/ui/org.eclipse.pde.ui/plugin.properties
index 70f38c4..0dbd231 100644
--- a/ui/org.eclipse.pde.ui/plugin.properties
+++ b/ui/org.eclipse.pde.ui/plugin.properties
@@ -260,4 +260,6 @@ contentMergeViewers.plugin.label=Plug-in Source Compare
structureMergeViewers.manifest.label=Manifest Structure Compare
structureMergeViewers.plugin.label=Plug-in Structure Compare
commandParameter.name = The initial search pattern for the artifact search dialog
-consoleFactory.label = Host OSGi Console \ No newline at end of file
+consoleFactory.label = Host OSGi Console
+open.manifest.description = Open the plug-in manifest
+open.manifest.name = Open Manifest \ No newline at end of file
diff --git a/ui/org.eclipse.pde.ui/plugin.xml b/ui/org.eclipse.pde.ui/plugin.xml
index e3c2e18..578d3bf 100644
--- a/ui/org.eclipse.pde.ui/plugin.xml
+++ b/ui/org.eclipse.pde.ui/plugin.xml
@@ -571,6 +571,12 @@
optional="true">
</commandParameter>
</command>
+ <command
+ categoryId="org.eclipse.ui.category.navigate"
+ description="%open.manifest.description"
+ id="org.eclipse.pde.ui.openManifest"
+ name="%open.manifest.name">
+ </command>
</extension>
<extension
point="org.eclipse.ui.popupMenus">
@@ -916,14 +922,6 @@
enablesFor="+"
id="org.eclipse.pde.ui.OrganizeManifest">
</action>
- <action
- label="%OpenManifest.label"
- helpContextId="org.eclipse.pde.doc.user.open_manifest"
- class="org.eclipse.pde.internal.ui.editor.OpenManifestAction"
- menubarPath="org.eclipse.pde.ui.project.tools/group0"
- enablesFor="+"
- id="org.eclipse.pde.ui.OpenManifestAction">
- </action>
</objectContribution>
</extension>
<extension
@@ -1408,6 +1406,12 @@
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M1+M2+M3+A">
</key>
+ <key
+ commandId="org.eclipse.pde.ui.openManifest"
+ contextId="org.eclipse.ui.contexts.window"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+M2+M3+M">
+ </key>
</extension>
<extension
point="org.eclipse.ltk.core.refactoring.renameParticipants">
@@ -1909,6 +1913,10 @@
class="org.eclipse.pde.internal.ui.views.plugins.AddAllPluginsToJavaSearchHandler"
commandId="org.eclipse.pde.ui.addAllPluginsToJavaSearch">
</handler>
+ <handler
+ class="org.eclipse.pde.internal.ui.editor.OpenManifestHandler"
+ commandId="org.eclipse.pde.ui.openManifest">
+ </handler>
</extension>
<extension
point="org.eclipse.ui.menus">
@@ -1956,6 +1964,35 @@
style="push">
</command>
</menuContribution>
+ <menuContribution
+ locationURI="popup:org.eclipse.ui.popup.any">
+ <menu
+ id="org.eclipse.pde.ui.project.tools"
+ label="%org.eclipse.pde.ui.tools">
+ <visibleWhen
+ checkEnabled="false">
+ <iterate
+ ifEmpty="false">
+ <adapt
+ type="org.eclipse.core.resources.IResource">
+ <test
+ property="org.eclipse.core.resources.projectNature"
+ value="org.eclipse.pde.PluginNature">
+ </test>
+ </adapt>
+ </iterate>
+ </visibleWhen>
+ </menu>
+ </menuContribution>
+ <menuContribution
+ locationURI="popup:org.eclipse.pde.ui.project.tools">
+ <command
+ commandId="org.eclipse.pde.ui.openManifest"
+ helpContextId="org.eclipse.pde.doc.user.open_manifest"
+ label="%OpenManifest.label"
+ style="push">
+ </command>
+ </menuContribution>
<!--
<menuContribution
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/OpenManifestAction.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/OpenManifestHandler.java
index c40dde8..b6d7875 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/OpenManifestAction.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/OpenManifestHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 IBM Corporation and others.
+ * Copyright (c) 2006, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,12 +13,11 @@
*******************************************************************************/
package org.eclipse.pde.internal.ui.editor;
-import java.util.ArrayList;
+import java.util.HashSet;
import java.util.Iterator;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
+import org.eclipse.core.commands.*;
+import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -27,37 +26,45 @@ import org.eclipse.pde.internal.core.WorkspaceModelManager;
import org.eclipse.pde.internal.core.project.PDEProject;
import org.eclipse.pde.internal.ui.*;
import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.ui.*;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.model.IWorkbenchAdapter;
-public class OpenManifestAction implements IWorkbenchWindowActionDelegate {
+public class OpenManifestHandler extends AbstractHandler {
- private ISelection fSelection;
-
- public OpenManifestAction() {
- super();
- }
-
- public void dispose() {
- }
-
- public void init(IWorkbenchWindow window) {
- }
-
- public void run(IAction action) {
- if (fSelection instanceof IStructuredSelection) {
- IStructuredSelection ssel = (IStructuredSelection) fSelection;
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ssel = (IStructuredSelection) selection;
Iterator it = ssel.iterator();
- final ArrayList projects = new ArrayList();
+ final HashSet projects = new HashSet();
while (it.hasNext()) {
Object element = it.next();
IProject proj = null;
if (element instanceof IFile)
proj = ((IFile) element).getProject();
- else if (element instanceof IProject)
+ if ((proj == null) && (element instanceof IProject))
proj = (IProject) element;
- else if (element instanceof IAdaptable)
- proj = (IProject) ((IAdaptable) element).getAdapter(IProject.class);
+ if ((proj == null) && (element instanceof IAdaptable)) {
+ IResource resource = (IResource) ((IAdaptable) element).getAdapter(IResource.class);
+ if (resource != null) {
+ proj = resource.getProject();
+ }
+ if (proj == null) {
+ IWorkbenchAdapter workbenchAdapter = (IWorkbenchAdapter) ((IAdaptable) element).getAdapter(IWorkbenchAdapter.class);
+ if (workbenchAdapter != null) {
+ Object o = workbenchAdapter.getParent(element);
+ if (o instanceof IAdaptable) {
+ resource = (IResource) ((IAdaptable) o).getAdapter(IResource.class);
+ if (resource != null) {
+ proj = resource.getProject();
+ }
+ }
+ }
+ }
+ }
+
if (proj != null && WorkspaceModelManager.isPluginProject(proj))
projects.add(proj);
}
@@ -86,9 +93,6 @@ public class OpenManifestAction implements IWorkbenchWindowActionDelegate {
} else
MessageDialog.openInformation(PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.OpenManifestsAction_title, PDEUIMessages.OpenManifestAction_noManifest);
}
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- fSelection = selection;
+ return null;
}
}