Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 203058 Details for
Bug 331262
[patch] Make "Open Manifest" bound to a command
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch of commit 06c4256a87bef2175c2f28f25b00ae58733f176e
clipboard.txt (text/plain), 12.96 KB, created by
Ben Cox
on 2011-09-09 09:41:06 EDT
(
hide
)
Description:
Patch of commit 06c4256a87bef2175c2f28f25b00ae58733f176e
Filename:
MIME Type:
Creator:
Ben Cox
Created:
2011-09-09 09:41:06 EDT
Size:
12.96 KB
patch
obsolete
>diff --git plugin.properties plugin.properties >index 70f38c4..0dbd231 100644 >--- plugin.properties >+++ plugin.properties >@@ -260,4 +260,6 @@ > 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 plugin.xml plugin.xml >index e3c2e18..578d3bf 100644 >--- plugin.xml >+++ 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"> >@@ -915,14 +921,6 @@ > menubarPath="org.eclipse.pde.ui.project.tools/group1" > 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> >@@ -1407,6 +1405,12 @@ > contextId="org.eclipse.ui.contexts.window" > 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 >@@ -1908,6 +1912,10 @@ > <handler > 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 >@@ -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 src/org/eclipse/pde/internal/ui/editor/OpenManifestAction.java src/org/eclipse/pde/internal/ui/editor/OpenManifestAction.java >deleted file mode 100644 >index c40dde8..0000000 100644 >--- src/org/eclipse/pde/internal/ui/editor/OpenManifestAction.java >+++ /dev/null >@@ -1,94 +0,0 @@ >-/******************************************************************************* >- * Copyright (c) 2006, 2010 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 >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- * Alex Blewitt (alex_blewitt@yahoo.com) - contributed a patch for: >- * o Add an 'Open Manifest' to projects to open the manifest editor >- * (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=133692) >- *******************************************************************************/ >-package org.eclipse.pde.internal.ui.editor; >- >-import java.util.ArrayList; >-import java.util.Iterator; >-import org.eclipse.core.resources.IFile; >-import org.eclipse.core.resources.IProject; >-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; >-import org.eclipse.osgi.util.NLS; >-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.ide.IDE; >- >-public class OpenManifestAction implements IWorkbenchWindowActionDelegate { >- >- 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; >- Iterator it = ssel.iterator(); >- final ArrayList projects = new ArrayList(); >- while (it.hasNext()) { >- Object element = it.next(); >- IProject proj = null; >- if (element instanceof IFile) >- proj = ((IFile) element).getProject(); >- else if (element instanceof IProject) >- proj = (IProject) element; >- else if (element instanceof IAdaptable) >- proj = (IProject) ((IAdaptable) element).getAdapter(IProject.class); >- if (proj != null && WorkspaceModelManager.isPluginProject(proj)) >- projects.add(proj); >- } >- if (projects.size() > 0) { >- BusyIndicator.showWhile(PDEPlugin.getActiveWorkbenchShell().getDisplay(), new Runnable() { >- public void run() { >- Iterator it = projects.iterator(); >- while (it.hasNext()) { >- IProject project = (IProject) it.next(); >- IFile file = PDEProject.getManifest(project); >- if (file == null || !file.exists()) >- file = PDEProject.getPluginXml(project); >- if (file == null || !file.exists()) >- file = PDEProject.getFragmentXml(project); >- if (file == null || !file.exists()) >- MessageDialog.openError(PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.OpenManifestsAction_title, NLS.bind(PDEUIMessages.OpenManifestsAction_cannotFind, project.getName())); >- else >- try { >- IDE.openEditor(PDEPlugin.getActivePage(), file, IPDEUIConstants.MANIFEST_EDITOR_ID); >- } catch (PartInitException e) { >- MessageDialog.openError(PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.OpenManifestsAction_title, NLS.bind(PDEUIMessages.OpenManifestsAction_cannotOpen, project.getName())); >- } >- } >- } >- }); >- } else >- MessageDialog.openInformation(PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.OpenManifestsAction_title, PDEUIMessages.OpenManifestAction_noManifest); >- } >- } >- >- public void selectionChanged(IAction action, ISelection selection) { >- fSelection = selection; >- } >-} >diff --git src/org/eclipse/pde/internal/ui/editor/OpenManifestHandler.java src/org/eclipse/pde/internal/ui/editor/OpenManifestHandler.java >new file mode 0 >index 0000000..b6d7875 0 >--- /dev/null >+++ src/org/eclipse/pde/internal/ui/editor/OpenManifestHandler.java >@@ -0,0 +1,98 @@ >+/******************************************************************************* >+ * 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ * Alex Blewitt (alex_blewitt@yahoo.com) - contributed a patch for: >+ * o Add an 'Open Manifest' to projects to open the manifest editor >+ * (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=133692) >+ *******************************************************************************/ >+package org.eclipse.pde.internal.ui.editor; >+ >+import java.util.HashSet; >+import java.util.Iterator; >+import org.eclipse.core.commands.*; >+import org.eclipse.core.resources.*; >+import org.eclipse.core.runtime.IAdaptable; >+import org.eclipse.jface.dialogs.MessageDialog; >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.osgi.util.NLS; >+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.PartInitException; >+import org.eclipse.ui.handlers.HandlerUtil; >+import org.eclipse.ui.ide.IDE; >+import org.eclipse.ui.model.IWorkbenchAdapter; >+ >+public class OpenManifestHandler extends AbstractHandler { >+ >+ 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 HashSet projects = new HashSet(); >+ while (it.hasNext()) { >+ Object element = it.next(); >+ IProject proj = null; >+ if (element instanceof IFile) >+ proj = ((IFile) element).getProject(); >+ if ((proj == null) && (element instanceof IProject)) >+ proj = (IProject) element; >+ 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); >+ } >+ if (projects.size() > 0) { >+ BusyIndicator.showWhile(PDEPlugin.getActiveWorkbenchShell().getDisplay(), new Runnable() { >+ public void run() { >+ Iterator it = projects.iterator(); >+ while (it.hasNext()) { >+ IProject project = (IProject) it.next(); >+ IFile file = PDEProject.getManifest(project); >+ if (file == null || !file.exists()) >+ file = PDEProject.getPluginXml(project); >+ if (file == null || !file.exists()) >+ file = PDEProject.getFragmentXml(project); >+ if (file == null || !file.exists()) >+ MessageDialog.openError(PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.OpenManifestsAction_title, NLS.bind(PDEUIMessages.OpenManifestsAction_cannotFind, project.getName())); >+ else >+ try { >+ IDE.openEditor(PDEPlugin.getActivePage(), file, IPDEUIConstants.MANIFEST_EDITOR_ID); >+ } catch (PartInitException e) { >+ MessageDialog.openError(PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.OpenManifestsAction_title, NLS.bind(PDEUIMessages.OpenManifestsAction_cannotOpen, project.getName())); >+ } >+ } >+ } >+ }); >+ } else >+ MessageDialog.openInformation(PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.OpenManifestsAction_title, PDEUIMessages.OpenManifestAction_noManifest); >+ } >+ return null; >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
john.arthorne
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 331262
: 203058