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 54198 Details for
Bug 162006
[QuickAccess] Make Ctrl-3 extensible
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
extension patch
CtrlEAction_20061120.txt (text/plain), 49.26 KB, created by
Aaron Ferguson
on 2006-11-20 14:41:28 EST
(
hide
)
Description:
extension patch
Filename:
MIME Type:
Creator:
Aaron Ferguson
Created:
2006-11-20 14:41:28 EST
Size:
49.26 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/incubator/CtrlEAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/incubator/CtrlEAction.java,v >retrieving revision 1.10 >diff -u -r1.10 CtrlEAction.java >--- Eclipse UI/org/eclipse/ui/internal/incubator/CtrlEAction.java 24 Oct 2006 18:21:40 -0000 1.10 >+++ Eclipse UI/org/eclipse/ui/internal/incubator/CtrlEAction.java 20 Nov 2006 19:33:58 -0000 >@@ -1,37 +1,14 @@ > package org.eclipse.ui.internal.incubator; > >-import java.util.ArrayList; >-import java.util.Arrays; > import java.util.HashMap; >-import java.util.HashSet; >-import java.util.LinkedHashSet; > import java.util.LinkedList; >-import java.util.List; > import java.util.Map; >-import java.util.Set; > import java.util.SortedSet; > import java.util.TreeSet; > > import org.eclipse.core.commands.AbstractHandler; >-import org.eclipse.core.commands.Command; > import org.eclipse.core.commands.ExecutionEvent; >-import org.eclipse.core.commands.ExecutionException; >-import org.eclipse.core.commands.NotEnabledException; >-import org.eclipse.core.commands.NotHandledException; >-import org.eclipse.core.commands.ParameterizedCommand; >-import org.eclipse.core.commands.common.NotDefinedException; >-import org.eclipse.jface.action.ActionContributionItem; >-import org.eclipse.jface.action.IAction; >-import org.eclipse.jface.action.IContributionItem; >-import org.eclipse.jface.action.LegacyActionTools; >-import org.eclipse.jface.action.MenuManager; >-import org.eclipse.jface.action.SubContributionItem; >-import org.eclipse.jface.bindings.Binding; > import org.eclipse.jface.dialogs.IDialogSettings; >-import org.eclipse.jface.preference.IPreferenceNode; >-import org.eclipse.jface.preference.IPreferencePage; >-import org.eclipse.jface.preference.PreferenceManager; >-import org.eclipse.jface.preference.PreferenceNode; > import org.eclipse.jface.resource.DeviceResourceException; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.jface.resource.JFaceResources; >@@ -52,26 +29,13 @@ > import org.eclipse.swt.widgets.Shell; > import org.eclipse.swt.widgets.Tree; > import org.eclipse.swt.widgets.TreeItem; >-import org.eclipse.ui.IEditorReference; >-import org.eclipse.ui.IPerspectiveDescriptor; > import org.eclipse.ui.IWorkbenchPage; >-import org.eclipse.ui.IWorkbenchPart; > import org.eclipse.ui.IWorkbenchWindow; >-import org.eclipse.ui.PartInitException; > import org.eclipse.ui.PlatformUI; >-import org.eclipse.ui.handlers.IHandlerService; > import org.eclipse.ui.internal.IWorkbenchGraphicConstants; > import org.eclipse.ui.internal.WorkbenchImages; > import org.eclipse.ui.internal.WorkbenchPlugin; >-import org.eclipse.ui.internal.WorkbenchWindow; >-import org.eclipse.ui.internal.actions.NewWizardShortcutAction; >-import org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog; >-import org.eclipse.ui.internal.keys.BindingService; > import org.eclipse.ui.internal.progress.ProgressManagerUtil; >-import org.eclipse.ui.keys.IBindingService; >-import org.eclipse.ui.views.IViewDescriptor; >-import org.eclipse.ui.wizards.IWizardCategory; >-import org.eclipse.ui.wizards.IWizardDescriptor; > > /** > * Experimental Action for search-based navigation to UI elements such as >@@ -99,18 +63,14 @@ > public Object execute(ExecutionEvent executionEvent) { > // need to get commands here because opening the popup changes which > // commands are "handled" >- BindingService bindingService = (BindingService) PlatformUI >- .getWorkbench().getService(IBindingService.class); >- Binding[] bindings = bindingService.getBindings(); >+ >+ CommandProvider commandProvider = new CommandProvider(); >+ AbstractElement[] commandElements = commandProvider.getElements(); > SortedSet commands = new TreeSet(); >- for (int i = 0; i < bindings.length; i++) { >- Binding binding = bindings[i]; >- ParameterizedCommand command = binding.getParameterizedCommand(); >- if (command != null && command.getCommand().isHandled()) { >- commands.add(command); >- } >+ for(int i = 0; i < commandElements.length; i++) { >+ commands.add(commandElements[i]); > } >- >+ > window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); > if (window == null) { > return null; >@@ -237,62 +197,9 @@ > addPreviousPick(selectedElement); > IWorkbenchPage activePage = window.getActivePage(); > if (activePage != null) { >- if (selectedElement instanceof IViewDescriptor) { >- IViewDescriptor viewDescriptor = (IViewDescriptor) selectedElement; >- try { >- activePage.showView(viewDescriptor.getId()); >- return; >- } catch (PartInitException e) { >- } >- } >- if (selectedElement instanceof IPerspectiveDescriptor) { >- IPerspectiveDescriptor perspectiveDescriptor = (IPerspectiveDescriptor) selectedElement; >- activePage.setPerspective(perspectiveDescriptor); >- } >- if (selectedElement instanceof IEditorReference) { >- IEditorReference editorReference = (IEditorReference) selectedElement; >- IWorkbenchPart part = editorReference.getPart(true); >- if (part != null) { >- activePage.activate(part); >- } >- return; >- } >- if (selectedElement instanceof PreferenceNode) { >- PreferenceNode preferenceNode = (PreferenceNode) selectedElement; >- WorkbenchPreferenceDialog dialog = WorkbenchPreferenceDialog >- .createDialogOn(window.getShell(), preferenceNode >- .getId()); >- dialog.open(); >- return; >- } >- if (selectedElement instanceof IWizardDescriptor) { >- IWizardDescriptor wizardDescriptor = (IWizardDescriptor) selectedElement; >- NewWizardShortcutAction wizardAction = new NewWizardShortcutAction( >- window, wizardDescriptor); >- wizardAction.run(); >- return; >- } >- if (selectedElement instanceof ParameterizedCommand) { >- IHandlerService handlerService = (IHandlerService) window >- .getWorkbench().getService(IHandlerService.class); >- ParameterizedCommand command = (ParameterizedCommand) selectedElement; >- try { >- handlerService.executeCommand(command, null); >- } catch (ExecutionException e) { >- e.printStackTrace(); >- } catch (NotDefinedException e) { >- e.printStackTrace(); >- } catch (NotEnabledException e) { >- e.printStackTrace(); >- } catch (NotHandledException e) { >- e.printStackTrace(); >- } >- return; >- } >- if (selectedElement instanceof ActionContributionItem) { >- ActionContributionItem item = (ActionContributionItem) selectedElement; >- item.getAction().run(); >- return; >+ if(selectedElement instanceof AbstractElement) { >+ AbstractElement element = (AbstractElement) selectedElement; >+ element.execute(); > } > } > } >@@ -352,49 +259,40 @@ > private Node preferencesNode = new Node( > IncubatorMessages.CtrlEAction_Preferences, IWorkbenchGraphicConstants.IMG_OBJ_NODE); > >- private SortedSet commands; >+ //private SortedSet commands; > > /** > * @param commands > */ > public MyContentProvider(SortedSet commands) { >- MyContentProvider.this.commands = commands; >+ //MyContentProvider.this.commands = commands; > } > > public Object[] getChildren(Object parentElement) { > if (parentElement instanceof Node) { > if (previousNode.equals(parentElement)) { > return getPreviousPicks(); >- } else if (editorNode.equals(parentElement)) { >- if(window.getActivePage() != null) { >- return window.getActivePage().getEditorReferences(); >- } >- } else if (viewNode.equals(parentElement)) { >- return PlatformUI.getWorkbench().getViewRegistry() >- .getViews(); >- } else if (perspectiveNode.equals(parentElement)) { >- return PlatformUI.getWorkbench().getPerspectiveRegistry() >- .getPerspectives(); >- } else if (commandNode.equals(parentElement)) { >- return commands.toArray(); >- } else if (preferencesNode.equals(parentElement)) { >- List elements = PlatformUI.getWorkbench() >- .getPreferenceManager().getElements( >- PreferenceManager.PRE_ORDER); >- Set uniqueElements = new LinkedHashSet(elements); >- return uniqueElements.toArray(); >- } else if (menusNode.equals(parentElement)) { >- MenuManager menu = ((WorkbenchWindow) window) >- .getMenuBarManager(); >- Set result = new HashSet(); >- collectContributions(menu, result); >- return result.toArray(); >- } else if (newNode.equals(parentElement)) { >- IWizardCategory rootCategory = WorkbenchPlugin.getDefault() >- .getNewWizardRegistry().getRootCategory(); >- List result = new ArrayList(); >- collectWizards(rootCategory, result); >- return result.toArray(); >+ } else if(editorNode.equals(parentElement)) { >+ EditorProvider editorProvider = new EditorProvider(); >+ return editorProvider.getElements(); >+ } else if(viewNode.equals(parentElement)) { >+ ViewProvider viewProvider = new ViewProvider(); >+ return viewProvider.getElements(); >+ } else if(perspectiveNode.equals(parentElement)) { >+ PerspectiveProvider perspectiveProvider = new PerspectiveProvider(); >+ return perspectiveProvider.getElements(); >+ } else if(commandNode.equals(parentElement)) { >+ CommandProvider commandProvider = new CommandProvider(); >+ return commandProvider.getElements(); >+ } else if(preferencesNode.equals(parentElement)) { >+ PreferenceProvider preferenceProvider = new PreferenceProvider(); >+ return preferenceProvider.getElements(); >+ } else if(menusNode.equals(parentElement)) { >+ ActionProvider actionProvider = new ActionProvider(); >+ return actionProvider.getElements(); >+ } else if(newNode.equals(parentElement)) { >+ WizardProvider wizardProvider = new WizardProvider(); >+ return wizardProvider.getElements(); > } > } > if (parentElement == input) { >@@ -405,29 +303,6 @@ > return new Object[0]; > } > >- private void collectContributions(MenuManager menu, Set result) { >- IContributionItem[] items = menu.getItems(); >- for (int i = 0; i < items.length; i++) { >- IContributionItem item = items[i]; >- if (item instanceof SubContributionItem) { >- item = ((SubContributionItem) item).getInnerItem(); >- } >- if (item instanceof MenuManager) { >- collectContributions((MenuManager) item, result); >- } else if (item instanceof ActionContributionItem) { >- result.add(item); >- } >- } >- } >- >- private void collectWizards(IWizardCategory category, List result) { >- result.addAll(Arrays.asList(category.getWizards())); >- IWizardCategory[] childCategories = category.getCategories(); >- for (int i = 0; i < childCategories.length; i++) { >- collectWizards(childCategories[i], result); >- } >- } >- > public Object getParent(Object element) { > return null; > } >@@ -459,26 +334,8 @@ > image = findOrCreateImage(WorkbenchImages > .getImageDescriptor(node.getImageId())); > } >- else if (element instanceof IEditorReference) { >- IEditorReference editorReference = (IEditorReference) element; >- image = editorReference.getTitleImage(); >- } >- else if (element instanceof IViewDescriptor) { >- IViewDescriptor viewDescriptor = (IViewDescriptor) element; >- image = findOrCreateImage(viewDescriptor.getImageDescriptor()); >- } >- else if (element instanceof IPerspectiveDescriptor) { >- IPerspectiveDescriptor perspectiveDescriptor = (IPerspectiveDescriptor) element; >- image = findOrCreateImage(perspectiveDescriptor >- .getImageDescriptor()); >- } >- else if (element instanceof IPreferenceNode) { >- IPreferenceNode preferenceNode = (IPreferenceNode) element; >- image = preferenceNode.getLabelImage(); >- } >- else if (element instanceof IWizardDescriptor) { >- IWizardDescriptor wizardDescriptor = (IWizardDescriptor) element; >- image = findOrCreateImage(wizardDescriptor.getDescriptionImage()); >+ else if (element instanceof AbstractElement) { >+ image = findOrCreateImage(((AbstractElement) element).getImageDescriptor()); > } > if (image == null) { > image = WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_OBJ_ELEMENT); >@@ -513,65 +370,9 @@ > } > > public String getText(Object element) { >- String separator = " - "; //$NON-NLS-1$ >- if (element instanceof IEditorReference) { >- IEditorReference editorReference = (IEditorReference) element; >- StringBuffer result = new StringBuffer(); >- if (editorReference.isDirty()) { >- result.append(DIRTY_MARK); >- } >- result.append(editorReference.getName()); >- result.append(separator); >- result.append(editorReference.getTitleToolTip()); >- return result.toString(); >- } >- if (element instanceof IViewDescriptor) { >- IViewDescriptor viewDescriptor = (IViewDescriptor) element; >- return viewDescriptor.getLabel(); >- } >- if (element instanceof IPerspectiveDescriptor) { >- IPerspectiveDescriptor perspectiveDescriptor = (IPerspectiveDescriptor) element; >- return perspectiveDescriptor.getLabel(); >- } >- if (element instanceof IPreferenceNode) { >- IPreferenceNode preferenceNode = (IPreferenceNode) element; >- IPreferencePage page = preferenceNode.getPage(); >- if (page != null && page.getDescription() != null >- && page.getDescription().length() != 0) { >- return preferenceNode.getLabelText() + separator >- + page.getDescription(); >- } >- return preferenceNode.getLabelText(); >- } >- if (element instanceof IWizardDescriptor) { >- IWizardDescriptor wizardDescriptor = (IWizardDescriptor) element; >- return wizardDescriptor.getLabel() + separator >- + wizardDescriptor.getDescription(); >- } >- if (element instanceof ActionContributionItem) { >- ActionContributionItem item = (ActionContributionItem) element; >- IAction action = item.getAction(); >- if (action.getToolTipText() != null >- && action.getToolTipText().length() != 0) { >- return LegacyActionTools.removeMnemonics(action.getText()) >- + separator + action.getToolTipText(); >- } >- return LegacyActionTools.removeMnemonics(action.getText()); >- } >- if (element instanceof ParameterizedCommand) { >- ParameterizedCommand command = (ParameterizedCommand) element; >- try { >- Command nestedCommand = command.getCommand(); >- if (nestedCommand != null >- && nestedCommand.getDescription() != null >- && nestedCommand.getDescription().length() != 0) { >- return command.getName() + separator >- + nestedCommand.getDescription(); >- } >- return command.getName(); >- } catch (NotDefinedException e) { >- return command.toString(); >- } >+ if(element instanceof AbstractElement) { >+ AbstractElement abstractElement = (AbstractElement) element; >+ return abstractElement.getLabel(); > } > return super.getText(element); > } >Index: Eclipse UI/org/eclipse/ui/internal/incubator/ActionProvider.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/incubator/ActionProvider.java >diff -N Eclipse UI/org/eclipse/ui/internal/incubator/ActionProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/incubator/ActionProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,77 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 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 >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal.incubator; >+ >+import java.util.HashMap; >+import java.util.HashSet; >+import java.util.Map; >+import java.util.Set; >+ >+import org.eclipse.jface.action.ActionContributionItem; >+import org.eclipse.jface.action.IContributionItem; >+import org.eclipse.jface.action.MenuManager; >+import org.eclipse.jface.action.SubContributionItem; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.internal.WorkbenchWindow; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class ActionProvider extends AbstractProvider { >+ >+ private AbstractElement[] cachedElements; >+ private Map idToElement = new HashMap(); >+ >+ public String getId() { >+ return "org.eclipse.ui.actions"; //$NON-NLS-1$ >+ } >+ >+ public AbstractElement getElementForId(String id) { >+ getElements(); >+ return (ActionElement) idToElement.get(id); >+ } >+ >+ public AbstractElement[] getElements() { >+ if(cachedElements == null) { >+ WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow(); >+ if(window != null) { >+ MenuManager menu = window.getMenuManager(); >+ Set result = new HashSet(); >+ collectContributions(menu, result); >+ ActionContributionItem[] actions = (ActionContributionItem[]) result.toArray(new ActionContributionItem[result.size()]); >+ cachedElements = new AbstractElement[actions.length]; >+ for(int i = 0; i < actions.length; i++) { >+ ActionElement actionElement = new ActionElement(actions[i]); >+ cachedElements[i] = actionElement; >+ idToElement.put(actionElement.getId(), actionElement); >+ } >+ } >+ } >+ return cachedElements; >+ } >+ >+ private void collectContributions(MenuManager menu, Set result) { >+ IContributionItem[] items = menu.getItems(); >+ for (int i = 0; i < items.length; i++) { >+ IContributionItem item = items[i]; >+ if (item instanceof SubContributionItem) { >+ item = ((SubContributionItem) item).getInnerItem(); >+ } >+ if (item instanceof MenuManager) { >+ collectContributions((MenuManager) item, result); >+ } else if (item instanceof ActionContributionItem) { >+ result.add(item); >+ } >+ } >+ } >+} >Index: Eclipse UI/org/eclipse/ui/internal/incubator/WizardProvider.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/incubator/WizardProvider.java >diff -N Eclipse UI/org/eclipse/ui/internal/incubator/WizardProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/incubator/WizardProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,62 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 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 >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal.incubator; >+ >+import java.util.ArrayList; >+import java.util.Arrays; >+import java.util.HashMap; >+import java.util.List; >+import java.util.Map; >+ >+import org.eclipse.ui.internal.WorkbenchPlugin; >+import org.eclipse.ui.wizards.IWizardCategory; >+import org.eclipse.ui.wizards.IWizardDescriptor; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class WizardProvider extends AbstractProvider { >+ >+ private AbstractElement[] cachedElements; >+ private Map idToElement = new HashMap(); >+ >+ public AbstractElement getElementForId(String id) { >+ getElements(); >+ return (WizardElement) idToElement.get(id); >+ } >+ >+ public AbstractElement[] getElements() { >+ if (cachedElements == null) { >+ IWizardCategory rootCategory = WorkbenchPlugin.getDefault() >+ .getNewWizardRegistry().getRootCategory(); >+ List result = new ArrayList(); >+ collectWizards(rootCategory, result); >+ IWizardDescriptor[] wizards = (IWizardDescriptor[]) result.toArray(new IWizardDescriptor[result.size()]); >+ cachedElements = new AbstractElement[wizards.length]; >+ for(int i = 0; i < wizards.length; i++) { >+ WizardElement wizardElement = new WizardElement(wizards[i]); >+ cachedElements[i] = wizardElement; >+ idToElement.put(wizardElement.getId(), wizardElement); >+ } >+ } >+ return cachedElements; >+ } >+ >+ private void collectWizards(IWizardCategory category, List result) { >+ result.addAll(Arrays.asList(category.getWizards())); >+ IWizardCategory[] childCategories = category.getCategories(); >+ for (int i = 0; i < childCategories.length; i++) { >+ collectWizards(childCategories[i], result); >+ } >+ } >+} >Index: Eclipse UI/org/eclipse/ui/internal/incubator/PerspectiveProvider.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/incubator/PerspectiveProvider.java >diff -N Eclipse UI/org/eclipse/ui/internal/incubator/PerspectiveProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/incubator/PerspectiveProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,50 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 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 >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal.incubator; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.ui.IPerspectiveDescriptor; >+import org.eclipse.ui.PlatformUI; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class PerspectiveProvider extends AbstractProvider { >+ >+ private AbstractElement[] cachedElements; >+ private Map idToElement = new HashMap(); >+ >+ public String getId() { >+ return "org.eclipse.ui.perspectives"; //$NON-NLS-1$ >+ } >+ >+ public AbstractElement getElementForId(String id) { >+ getElements(); >+ return (PerspectiveElement) idToElement.get(id); >+ } >+ >+ public AbstractElement[] getElements() { >+ if(cachedElements == null) { >+ IPerspectiveDescriptor[] perspectives = PlatformUI.getWorkbench().getPerspectiveRegistry().getPerspectives(); >+ cachedElements = new AbstractElement[perspectives.length]; >+ for(int i = 0; i < perspectives.length; i++) { >+ PerspectiveElement perspectiveElement = new PerspectiveElement(perspectives[i]); >+ cachedElements[i] = perspectiveElement; >+ idToElement.put(perspectiveElement.getId(), perspectiveElement); >+ } >+ } >+ return cachedElements; >+ } >+} >Index: Eclipse UI/org/eclipse/ui/internal/incubator/AbstractProvider.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/incubator/AbstractProvider.java >diff -N Eclipse UI/org/eclipse/ui/internal/incubator/AbstractProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/incubator/AbstractProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,23 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 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 >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal.incubator; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public abstract class AbstractProvider { >+ >+ public abstract AbstractElement[] getElements(); >+ >+ public abstract AbstractElement getElementForId(String id); >+} >Index: Eclipse UI/org/eclipse/ui/internal/incubator/WizardElement.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/incubator/WizardElement.java >diff -N Eclipse UI/org/eclipse/ui/internal/incubator/WizardElement.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/incubator/WizardElement.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,51 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 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 >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal.incubator; >+ >+import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.ui.IWorkbenchWindow; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.internal.actions.NewWizardShortcutAction; >+import org.eclipse.ui.wizards.IWizardDescriptor; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class WizardElement extends AbstractElement { >+ >+ private IWizardDescriptor wizardDescriptor; >+ >+ public WizardElement(IWizardDescriptor wizardDescriptor) { >+ this.wizardDescriptor = wizardDescriptor; >+ } >+ >+ public void execute() { >+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); >+ if(window != null) { >+ NewWizardShortcutAction wizardAction = new NewWizardShortcutAction(window, wizardDescriptor); >+ wizardAction.run(); >+ } >+ } >+ >+ public String getId() { >+ return wizardDescriptor.getId(); >+ } >+ >+ public ImageDescriptor getImageDescriptor() { >+ return wizardDescriptor.getImageDescriptor(); >+ } >+ >+ public String getLabel() { >+ return wizardDescriptor.getLabel(); >+ } >+} >Index: Eclipse UI/org/eclipse/ui/internal/incubator/CommandElement.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/incubator/CommandElement.java >diff -N Eclipse UI/org/eclipse/ui/internal/incubator/CommandElement.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/incubator/CommandElement.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,78 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 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 >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal.incubator; >+ >+import org.eclipse.core.commands.Command; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.core.commands.NotEnabledException; >+import org.eclipse.core.commands.NotHandledException; >+import org.eclipse.core.commands.ParameterizedCommand; >+import org.eclipse.core.commands.common.NotDefinedException; >+import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.ui.IWorkbenchWindow; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.handlers.IHandlerService; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class CommandElement extends AbstractElement { >+ >+ private ParameterizedCommand command; >+ >+ public CommandElement(ParameterizedCommand command) { >+ this.command = command; >+ } >+ >+ public void execute() { >+ IWorkbenchWindow window = PlatformUI.getWorkbench() >+ .getActiveWorkbenchWindow(); >+ if (window != null) { >+ IHandlerService handlerService = (IHandlerService) window >+ .getWorkbench().getService(IHandlerService.class); >+ try { >+ handlerService.executeCommand(command, null); >+ } catch (ExecutionException e) { >+ e.printStackTrace(); >+ } catch (NotDefinedException e) { >+ e.printStackTrace(); >+ } catch (NotEnabledException e) { >+ e.printStackTrace(); >+ } catch (NotHandledException e) { >+ e.printStackTrace(); >+ } >+ } >+ } >+ >+ public String getId() { >+ return command.getId(); >+ } >+ >+ public ImageDescriptor getImageDescriptor() { >+ return null; >+ } >+ >+ public String getLabel() { >+ try { >+ Command nestedCommand = command.getCommand(); >+ if (nestedCommand != null >+ && nestedCommand.getDescription() != null >+ && nestedCommand.getDescription().length() != 0) { >+ return command.getName() + "-" + nestedCommand.getDescription(); //$NON-NLS-1$ >+ } >+ return command.getName(); >+ } catch (NotDefinedException e) { >+ return command.toString(); >+ } >+ } >+} >Index: Eclipse UI/org/eclipse/ui/internal/incubator/EditorElement.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/incubator/EditorElement.java >diff -N Eclipse UI/org/eclipse/ui/internal/incubator/EditorElement.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/incubator/EditorElement.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,53 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 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 >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal.incubator; >+ >+import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.ui.IEditorReference; >+import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.IWorkbenchPart; >+import org.eclipse.ui.PlatformUI; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class EditorElement extends AbstractElement { >+ >+ private IEditorReference editorReference; >+ >+ public EditorElement(IEditorReference editorReference) { >+ this.editorReference = editorReference; >+ } >+ >+ public void execute() { >+ IWorkbenchPart part = editorReference.getPart(true); >+ if (part != null) { >+ IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); >+ if(activePage != null) { >+ activePage.activate(part); >+ } >+ } >+ } >+ >+ public String getId() { >+ return editorReference.getId(); >+ } >+ >+ public ImageDescriptor getImageDescriptor() { >+ return ImageDescriptor.createFromImage(editorReference.getTitleImage()); >+ } >+ >+ public String getLabel() { >+ return editorReference.getTitle(); >+ } >+} >Index: Eclipse UI/org/eclipse/ui/internal/incubator/PreferenceProvider.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/incubator/PreferenceProvider.java >diff -N Eclipse UI/org/eclipse/ui/internal/incubator/PreferenceProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/incubator/PreferenceProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,50 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 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 >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal.incubator; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.jface.preference.IPreferenceNode; >+import org.eclipse.ui.PlatformUI; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class PreferenceProvider extends AbstractProvider { >+ >+ private AbstractElement[] cachedElements; >+ private Map idToElement = new HashMap(); >+ >+ public String getId() { >+ return "org.eclipse.ui.preferences"; //$NON-NLS-1$ >+ } >+ >+ public AbstractElement getElementForId(String id) { >+ getElements(); >+ return (PreferenceElement) idToElement.get(id); >+ } >+ >+ public AbstractElement[] getElements() { >+ if(cachedElements == null) { >+ IPreferenceNode[] preferences = PlatformUI.getWorkbench().getPreferenceManager().getRootSubNodes(); >+ cachedElements = new AbstractElement[preferences.length]; >+ for(int i = 0; i < preferences.length; i++) { >+ PreferenceElement preferenceElement = new PreferenceElement(preferences[i]); >+ cachedElements[i] = preferenceElement; >+ idToElement.put(preferenceElement.getId(), preferenceElement); >+ } >+ } >+ return cachedElements; >+ } >+} >Index: Eclipse UI/org/eclipse/ui/internal/incubator/PreferenceElement.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/incubator/PreferenceElement.java >diff -N Eclipse UI/org/eclipse/ui/internal/incubator/PreferenceElement.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/incubator/PreferenceElement.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,59 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 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 >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal.incubator; >+ >+import org.eclipse.jface.preference.IPreferenceNode; >+import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.ui.IWorkbenchWindow; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class PreferenceElement extends AbstractElement { >+ >+ private IPreferenceNode preferenceNode; >+ >+ public PreferenceElement(IPreferenceNode preferenceNode) { >+ this.preferenceNode = preferenceNode; >+ } >+ >+ public void execute() { >+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); >+ if(window != null) { >+ WorkbenchPreferenceDialog dialog = WorkbenchPreferenceDialog >+ .createDialogOn(window.getShell(), preferenceNode >+ .getId()); >+ dialog.open(); >+ } >+ } >+ >+ public String getId() { >+ return preferenceNode.getId(); >+ } >+ >+ public ImageDescriptor getImageDescriptor() { >+ Image image = preferenceNode.getLabelImage(); >+ if(image != null) { >+ ImageDescriptor descriptor = ImageDescriptor.createFromImage(image); >+ return descriptor; >+ } >+ return null; >+ } >+ >+ public String getLabel() { >+ return preferenceNode.getLabelText(); >+ } >+} >Index: Eclipse UI/org/eclipse/ui/internal/incubator/CommandProvider.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/incubator/CommandProvider.java >diff -N Eclipse UI/org/eclipse/ui/internal/incubator/CommandProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/incubator/CommandProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,66 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 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 >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal.incubator; >+ >+import java.util.HashMap; >+import java.util.Map; >+import java.util.SortedSet; >+import java.util.TreeSet; >+ >+import org.eclipse.core.commands.ParameterizedCommand; >+import org.eclipse.jface.bindings.Binding; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.internal.keys.BindingService; >+import org.eclipse.ui.keys.IBindingService; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class CommandProvider extends AbstractProvider { >+ >+ private AbstractElement[] cachedElements; >+ private Map idToElement = new HashMap(); >+ >+ public String getId() { >+ return "org.eclipse.ui.commands"; //$NON-NLS-1$ >+ } >+ >+ public AbstractElement getElementForId(String id) { >+ getElements(); >+ return (CommandElement) idToElement.get(id); >+ } >+ >+ public AbstractElement[] getElements() { >+ if(cachedElements == null) { >+ BindingService bindingService = (BindingService) PlatformUI >+ .getWorkbench().getService(IBindingService.class); >+ Binding[] bindings = bindingService.getBindings(); >+ SortedSet commandSet = new TreeSet(); >+ for(int i = 0; i < bindings.length; i++) { >+ Binding binding = bindings[i]; >+ ParameterizedCommand command = binding.getParameterizedCommand(); >+ if(command != null && command.getCommand().isHandled()) { >+ commandSet.add(command); >+ } >+ } >+ ParameterizedCommand[] commands = (ParameterizedCommand[]) commandSet.toArray(new ParameterizedCommand[commandSet.size()]); >+ cachedElements = new AbstractElement[commands.length]; >+ for(int i = 0; i < commands.length; i++) { >+ CommandElement commandElement = new CommandElement(commands[i]); >+ cachedElements[i] = commandElement; >+ idToElement.put(commandElement.getId(), commandElement); >+ } >+ } >+ return cachedElements; >+ } >+} >Index: Eclipse UI/org/eclipse/ui/internal/incubator/PerspectiveElement.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/incubator/PerspectiveElement.java >diff -N Eclipse UI/org/eclipse/ui/internal/incubator/PerspectiveElement.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/incubator/PerspectiveElement.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,49 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 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 >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal.incubator; >+ >+import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.ui.IPerspectiveDescriptor; >+import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.PlatformUI; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class PerspectiveElement extends AbstractElement { >+ >+ private final IPerspectiveDescriptor descriptor; >+ >+ public PerspectiveElement(IPerspectiveDescriptor descriptor) { >+ this.descriptor = descriptor; >+ } >+ >+ public void execute() { >+ IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); >+ if(activePage != null) { >+ activePage.setPerspective(descriptor); >+ } >+ } >+ >+ public String getId() { >+ return descriptor.getId(); >+ } >+ >+ public ImageDescriptor getImageDescriptor() { >+ return descriptor.getImageDescriptor(); >+ } >+ >+ public String getLabel() { >+ return descriptor.getLabel(); >+ } >+} >Index: Eclipse UI/org/eclipse/ui/internal/incubator/AbstractElement.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/incubator/AbstractElement.java >diff -N Eclipse UI/org/eclipse/ui/internal/incubator/AbstractElement.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/incubator/AbstractElement.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,37 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 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 >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal.incubator; >+ >+import org.eclipse.jface.resource.ImageDescriptor; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public abstract class AbstractElement implements Comparable{ >+ >+ public int compareTo(Object o) { >+ return toString().compareTo(o.toString()); >+ } >+ >+ public String toString() { >+ return getLabel(); >+ } >+ >+ public abstract String getLabel(); >+ >+ public abstract ImageDescriptor getImageDescriptor(); >+ >+ public abstract String getId(); >+ >+ public abstract void execute(); >+} >Index: Eclipse UI/org/eclipse/ui/internal/incubator/EditorProvider.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/incubator/EditorProvider.java >diff -N Eclipse UI/org/eclipse/ui/internal/incubator/EditorProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/incubator/EditorProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,48 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 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 >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal.incubator; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.ui.IEditorReference; >+import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.PlatformUI; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class EditorProvider extends AbstractProvider { >+ >+ private AbstractElement[] cachedElements; >+ private Map idToElement = new HashMap(); >+ >+ public AbstractElement getElementForId(String id) { >+ getElements(); >+ return (EditorElement) idToElement.get(id); >+ } >+ >+ public AbstractElement[] getElements() { >+ if(cachedElements == null) { >+ IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); >+ IEditorReference[] editors = activePage.getEditorReferences(); >+ cachedElements = new AbstractElement[editors.length]; >+ for(int i = 0; i < editors.length; i++) { >+ EditorElement editorElement = new EditorElement(editors[i]); >+ cachedElements[i] = editorElement; >+ idToElement.put(editorElement.getId(), editorElement); >+ } >+ } >+ return cachedElements; >+ } >+} >Index: Eclipse UI/org/eclipse/ui/internal/incubator/ViewProvider.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/incubator/ViewProvider.java >diff -N Eclipse UI/org/eclipse/ui/internal/incubator/ViewProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/incubator/ViewProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,50 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 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 >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal.incubator; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.views.IViewDescriptor; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class ViewProvider extends AbstractProvider { >+ >+ private AbstractElement[] cachedElements; >+ private Map idToElement = new HashMap(); >+ >+ public String getId() { >+ return "org.eclipse.ui.views"; //$NON-NLS-1$ >+ } >+ >+ public AbstractElement getElementForId(String id) { >+ getElements(); >+ return (ViewElement) idToElement.get(id); >+ } >+ >+ public AbstractElement[] getElements() { >+ if(cachedElements == null) { >+ IViewDescriptor[] views = PlatformUI.getWorkbench().getViewRegistry().getViews(); >+ cachedElements = new AbstractElement[views.length]; >+ for(int i = 0; i < views.length; i++) { >+ ViewElement viewElement = new ViewElement(views[i]); >+ cachedElements[i] = viewElement; >+ idToElement.put(viewElement.getId(), viewElement); >+ } >+ } >+ return cachedElements; >+ } >+} >Index: Eclipse UI/org/eclipse/ui/internal/incubator/ActionElement.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/incubator/ActionElement.java >diff -N Eclipse UI/org/eclipse/ui/internal/incubator/ActionElement.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/incubator/ActionElement.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,44 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 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 >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal.incubator; >+ >+import org.eclipse.jface.action.ActionContributionItem; >+import org.eclipse.jface.resource.ImageDescriptor; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class ActionElement extends AbstractElement { >+ >+ private ActionContributionItem item; >+ >+ public ActionElement(ActionContributionItem item) { >+ this.item = item; >+ } >+ >+ public void execute() { >+ item.getAction().run(); >+ } >+ >+ public String getId() { >+ return item.getId(); >+ } >+ >+ public ImageDescriptor getImageDescriptor() { >+ return item.getAction().getImageDescriptor(); >+ } >+ >+ public String getLabel() { >+ return item.getAction().getText(); >+ } >+} >Index: Eclipse UI/org/eclipse/ui/internal/incubator/ViewElement.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/internal/incubator/ViewElement.java >diff -N Eclipse UI/org/eclipse/ui/internal/incubator/ViewElement.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/internal/incubator/ViewElement.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,53 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 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 >+ ******************************************************************************/ >+ >+package org.eclipse.ui.internal.incubator; >+ >+import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.PartInitException; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.views.IViewDescriptor; >+ >+/** >+ * @since 3.3 >+ * >+ */ >+public class ViewElement extends AbstractElement { >+ >+ private final IViewDescriptor viewDescriptor; >+ >+ public ViewElement(IViewDescriptor viewDescriptor) { >+ this.viewDescriptor = viewDescriptor; >+ } >+ >+ public void execute() { >+ IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); >+ if(activePage != null) { >+ try { >+ activePage.showView(viewDescriptor.getId()); >+ } catch (PartInitException e) { >+ } >+ } >+ } >+ >+ public String getId() { >+ return viewDescriptor.getId(); >+ } >+ >+ public ImageDescriptor getImageDescriptor() { >+ return viewDescriptor.getImageDescriptor(); >+ } >+ >+ public String getLabel() { >+ return viewDescriptor.getLabel(); >+ } >+}
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
Actions:
View
|
Diff
Attachments on
bug 162006
:
54110
|
54198
|
54203
|
54208
|
54365
|
54438
|
250041
|
262379