Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2013-02-14 19:33:33 -0500
committerPawel Piech2013-02-14 19:33:33 -0500
commit63c1614833ad2e2e5c27b1e6bb6c0538868478f5 (patch)
tree960acd7d3557488cfd64a1976a2452cc5bf308b1
parent204b578d57302e1501ee39f789d664f626c8209b (diff)
downloadeclipse.platform.debug-63c1614833ad2e2e5c27b1e6bb6c0538868478f5.tar.gz
eclipse.platform.debug-63c1614833ad2e2e5c27b1e6bb6c0538868478f5.tar.xz
eclipse.platform.debug-63c1614833ad2e2e5c27b1e6bb6c0538868478f5.zip
Bug 145635 - Support for debug view pin & clone
- Cleanup: removed redundant pin actions.
-rw-r--r--org.eclipse.debug.ui/plugin.xml3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties4
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java12
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/PinToContextAction.java54
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/AbstractPinnableDebugView.java24
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/AbstractPinnableView.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/IDebugContextManager.java11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/NewPinnedViewAction.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/NewPinnedViewDropDownAction.java150
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/NewViewInstanceAction.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/PinViewToContextDropDownAction.java131
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/PinViewToContextDynamicContribution.java136
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/PinViewToContextHandler.java75
13 files changed, 9 insertions, 605 deletions
diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml
index ca2ae6ba1..f505ffe84 100644
--- a/org.eclipse.debug.ui/plugin.xml
+++ b/org.eclipse.debug.ui/plugin.xml
@@ -875,11 +875,12 @@
<action
class="org.eclipse.debug.internal.ui.views.memory.PinMemoryBlockAction"
helpContextId="PinMemoryBlockAction_context"
+ icon="$nl$/icons/full/elcl16/pin.gif"
id="org.eclipse.debug.ui.PinMemoryBlockAction"
label="%PinMemoryBlockAction.label"
state="false"
style="toggle"
- menubarPath="additions"
+ toolbarPath="additions"
tooltip="%PinMemoryBlockAction.tooltip"/>
<action
class="org.eclipse.debug.internal.ui.views.memory.NewMemoryViewAction"
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties
index f4c59b0e1..01cb0c418 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties
@@ -83,8 +83,8 @@ PinViewToContextAction_tooltip=Pin View to Debug Context
ClearPinAction_label=Clear Pin
NewViewAction_label=Open New View Instance
-NewPinnedViewAction_label=Open View Pinned To Context
-NewPinnedViewAction_tooltip=Open View Pinned To Context
+NewPinnedViewAction_label=Open New View Pinned To Context
+NewPinnedViewAction_tooltip=Open New View Pinned To Context
##
# @see Bug 105733 TVT 3.1 - TCT 531 - Poor grammar in "Run Eclipse Application" and "Profile Eclipse Application"
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java
index 86474d38f..e03de77e3 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextManager.java
@@ -14,7 +14,6 @@ package org.eclipse.debug.internal.ui.contexts;
import java.util.Collection;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -32,7 +31,6 @@ import org.eclipse.debug.ui.contexts.IPinnedContextFactory;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IWindowListener;
-import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.services.IEvaluationService;
@@ -235,16 +233,6 @@ public class DebugContextManager implements IDebugContextManager {
return (IPinnedContextFactory)fPinnedContextFactories.get(factoryId);
}
- public IPinnedContextFactory[] getEnabledContextViewerFactories(IWorkbenchPart part, ISelection selection) {
- // TODO: use enablement expression to evaluate enabled context factories.
- IPinnedContextFactory[] factories = new IPinnedContextFactory[fPinnedContextFactories.size()];
- int i = 0;
- for(Iterator itr = fPinnedContextFactories.values().iterator(); itr.hasNext();) {
- factories[i++] = (IPinnedContextFactory)itr.next();
- }
- return factories;
- }
-
public String getPinnedContextViewerFactoryName(String factoryId) {
PinnedContextFactory factory = (PinnedContextFactory)fPinnedContextFactories.get(factoryId);
if (factory != null) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/PinToContextAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/PinToContextAction.java
deleted file mode 100644
index 1aebd15a0..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/PinToContextAction.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Wind River Systems 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.debug.internal.ui.contexts;
-
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.contexts.IDebugContextManager;
-import org.eclipse.debug.ui.contexts.IPinnablePart;
-import org.eclipse.debug.ui.contexts.IPinnedContextFactory;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Pins a workbench part using the given pinned context factory.
- *
- * @since 3.9
- */
-public class PinToContextAction extends Action {
-
- private final IPinnablePart fView;
- private final IPinnedContextFactory fFactory;
-
- /**
- * Creates the pin action for the given pinnable part.
- * @param view
- */
- public PinToContextAction(IPinnablePart view, IPinnedContextFactory factory) {
- super(null, IAction.AS_RADIO_BUTTON);
- fView = view;
- fFactory = factory;
- IDebugContextManager manager = DebugUITools.getDebugContextManager();
- setText(manager.getPinnedContextViewerFactoryName(fFactory.getId()));
- setImageDescriptor(manager.getPinnedContextViewerFactoryImage(fFactory.getId()));
- setToolTipText(manager.getPinnedContextViewerFactoryDescription(fFactory.getId()));
- setId(DebugUIPlugin.getUniqueIdentifier() + ".PinToContextAction"); //$NON-NLS-1$
- setChecked( fFactory.getId().equals(fView.getPinnedFactoryId()) );
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.PIN_TO_CONTEXT_ACTION);
- }
-
- public void run() {
- fView.pin(fFactory);
- }
-} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/AbstractPinnableDebugView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/AbstractPinnableDebugView.java
index e373e4482..d00ffaf37 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/AbstractPinnableDebugView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/AbstractPinnableDebugView.java
@@ -10,18 +10,14 @@
*******************************************************************************/
package org.eclipse.debug.ui.contexts;
-import org.eclipse.debug.internal.ui.DebugPluginImages;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.SWTFactory;
-import org.eclipse.debug.internal.ui.contexts.OverlayIcon;
import org.eclipse.debug.ui.AbstractDebugView;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -42,8 +38,6 @@ abstract public class AbstractPinnableDebugView extends AbstractDebugView implem
private Composite fComposite;
private IPinnedContextViewer fPinnedContextViewer;
- private Image fOriginalIcon;
- private Image fPinnedIcon;
public void pin(IPinnedContextFactory factory) {
if (isPinned()) clearPin();
@@ -52,20 +46,8 @@ abstract public class AbstractPinnableDebugView extends AbstractDebugView implem
control.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
control.moveAbove(null);
fComposite.layout(true, true);
- setTitleImage(getPinnedIcon());
}
- private Image getPinnedIcon() {
- if (fPinnedIcon == null) {
- fOriginalIcon = getTitleImage();
- ImageDescriptor pinnedIconDesc = new OverlayIcon(
- ImageDescriptor.createFromImage(fOriginalIcon),
- DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_OVR_PIN));
- fPinnedIcon = pinnedIconDesc.createImage();
- }
- return fPinnedIcon;
- }
-
public void clearPin() {
if (fPinnedContextViewer != null) {
fPinnedContextViewer.dispose();
@@ -74,9 +56,6 @@ abstract public class AbstractPinnableDebugView extends AbstractDebugView implem
if (fComposite != null && !fComposite.isDisposed()) {
fComposite.layout(true, true);
}
- if (fOriginalIcon != null) {
- setTitleImage(fOriginalIcon);
- }
}
public boolean isPinned() {
@@ -104,7 +83,6 @@ abstract public class AbstractPinnableDebugView extends AbstractDebugView implem
public void dispose() {
clearPin();
- if (fPinnedIcon != null) fPinnedIcon.dispose();
super.dispose();
}
@@ -138,7 +116,7 @@ abstract public class AbstractPinnableDebugView extends AbstractDebugView implem
}
protected void createActions() {
- setAction("NewPinnedView", new NewPinnedViewDropDownAction(this)); //$NON-NLS-1$
+ setAction("NewPinnedView", new NewPinnedViewAction(this)); //$NON-NLS-1$
}
protected void configureToolBar(IToolBarManager tbm) {
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/AbstractPinnableView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/AbstractPinnableView.java
index c88486f04..71b5e1722 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/AbstractPinnableView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/AbstractPinnableView.java
@@ -138,7 +138,7 @@ abstract public class AbstractPinnableView extends ViewPart implements IPinnable
protected void configureToolBar(IToolBarManager tbm) {
tbm.add(new Separator(this.getClass().getName()));
tbm.add(new Separator(IDebugUIConstants.NAVIGATION_GROUP));
- tbm.add(new NewPinnedViewDropDownAction(this));
+ tbm.add(new NewPinnedViewAction(this));
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/IDebugContextManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/IDebugContextManager.java
index 052fb28c1..54ae2ac2e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/IDebugContextManager.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/IDebugContextManager.java
@@ -11,8 +11,6 @@
package org.eclipse.debug.ui.contexts;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
/**
@@ -68,15 +66,6 @@ public interface IDebugContextManager {
public IPinnedContextFactory getPinnedContextViewerFactory(String factoryId);
/**
- * Returns the pinned context viewer factories that are enabled for the
- * given part and selection.
- *
- * @since 3.9
- * @return Array of enabled factories.
- */
- public IPinnedContextFactory[] getEnabledContextViewerFactories(IWorkbenchPart part, ISelection selection);
-
- /**
* Returns the name of the given context factory.
*
* @since 3.9
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/NewPinnedViewAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/NewPinnedViewAction.java
index 17e472d4d..aba7b7339 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/NewPinnedViewAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/NewPinnedViewAction.java
@@ -19,7 +19,6 @@ import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchWindow;
@@ -30,7 +29,6 @@ import org.eclipse.ui.IWorkbenchWindow;
*/
class NewPinnedViewAction extends Action {
private IPinnablePart fView;
- private Menu fMenu;
public NewPinnedViewAction(IPinnablePart view) {
this(view, AS_PUSH_BUTTON);
@@ -39,8 +37,8 @@ class NewPinnedViewAction extends Action {
public NewPinnedViewAction(IPinnablePart view, int style) {
super(null, style);
fView= view;
- setText(ActionMessages.PinViewToContextAction_label);
- setToolTipText(ActionMessages.PinViewToContextAction_tooltip);
+ setText(ActionMessages.NewPinnedViewAction_label);
+ setToolTipText(ActionMessages.NewPinnedViewAction_tooltip);
Image viewImage = fView.getSite().getPart().getTitleImage();
ImageDescriptor plusOverlayImage = new OverlayIcon(
ImageDescriptor.createFromImage(viewImage),
@@ -52,10 +50,6 @@ class NewPinnedViewAction extends Action {
* @see org.eclipse.jface.action.IMenuCreator#dispose()
*/
public void dispose() {
- if (fMenu != null) {
- fMenu.dispose();
- }
-
fView = null;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/NewPinnedViewDropDownAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/NewPinnedViewDropDownAction.java
deleted file mode 100644
index f690cf938..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/NewPinnedViewDropDownAction.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 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.debug.ui.contexts;
-
-
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Drop down action to select the debug context to pin a view to.
- *
- * @since 3.9
- */
-class NewPinnedViewDropDownAction extends NewPinnedViewAction implements IMenuCreator {
-
- /**
- * Pins a workbench part using the given pinned context factory.
- */
- class NewPinnedViewActionForFactory extends Action {
- private final IPinnedContextFactory fFactory;
-
- /**
- * Creates the pin action for the given pinnable part.
- * @param view
- */
- public NewPinnedViewActionForFactory(IPinnedContextFactory factory) {
- super(null, IAction.AS_RADIO_BUTTON);
- fFactory = factory;
- IDebugContextManager manager = DebugUITools.getDebugContextManager();
- setText(manager.getPinnedContextViewerFactoryName(fFactory.getId()));
- setImageDescriptor(manager.getPinnedContextViewerFactoryImage(fFactory.getId()));
- setToolTipText(manager.getPinnedContextViewerFactoryDescription(fFactory.getId()));
- setId(DebugUIPlugin.getUniqueIdentifier() + ".PinToContextAction"); //$NON-NLS-1$
- setChecked( fFactory.getId().equals(getView().getPinnedFactoryId()) );
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.PIN_TO_CONTEXT_ACTION);
- }
-
- public void run() {
- IViewPart part = NewViewInstanceAction.createNewPart((IViewPart)getView());
- ((IPinnablePart)part).pin(fFactory);
- }
- }
-
- private Menu fMenu;
-
- public NewPinnedViewDropDownAction(IPinnablePart view) {
- super(view, AS_DROP_DOWN_MENU);
- setMenuCreator(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#dispose()
- */
- public void dispose() {
- if (fMenu != null) {
- fMenu.dispose();
- }
- super.dispose();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
- */
- public Menu getMenu(Menu parent) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
- */
- public Menu getMenu(Control parent) {
- if (fMenu != null) {
- fMenu.dispose();
- }
-
- fMenu= new Menu(parent);
- IDebugContextManager manager = DebugUITools.getDebugContextManager();
- IPinnedContextFactory[] factories = manager.getEnabledContextViewerFactories(getView(), StructuredSelection.EMPTY);
-
- String pinnedFactoryId = getView().getPinnedFactoryId();
- for (int i = 0; i < factories.length; i++) {
- Action action = new NewPinnedViewActionForFactory(factories[i]);
- action.setChecked(factories[i].getId().equals(pinnedFactoryId));
- addActionToMenu(fMenu, action, i + 1);
- }
- return fMenu;
- }
-
- private void addActionToMenu(Menu parent, Action action, int accelerator) {
- if (accelerator < 10) {
- StringBuffer label= new StringBuffer();
- //add the numerical accelerator
- label.append('&');
- label.append(accelerator);
- label.append(' ');
- label.append(action.getText());
- action.setText(label.toString());
- }
- ActionContributionItem item= new ActionContributionItem(action);
- item.fill(parent, -1);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- IViewPart newPart = NewViewInstanceAction.createNewPart((IViewPart)getView());
- ((IPinnablePart)newPart).pin(getFactory());
- }
-
- private IPinnableDebugContextProvider getContextProvider() {
- IDebugContextProvider provider = getContextService().getActiveProvider();
- if (provider instanceof IPinnableDebugContextProvider) {
- return (IPinnableDebugContextProvider)provider;
- }
- return null;
- }
-
- private IDebugContextService getContextService() {
- IWorkbenchWindow window = getView().getSite().getWorkbenchWindow();
- return DebugUITools.getDebugContextManager().getContextService(window);
- }
-
- private IPinnedContextFactory getFactory() {
- IPinnableDebugContextProvider provider = getContextProvider();
- if (provider != null) {
- return DebugUITools.getDebugContextManager().getPinnedContextViewerFactory( provider.getFactoryId() );
- }
- return null;
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/NewViewInstanceAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/NewViewInstanceAction.java
index 03a5a250f..7636fe302 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/NewViewInstanceAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/NewViewInstanceAction.java
@@ -71,7 +71,7 @@ public class NewViewInstanceAction extends Action {
if (part instanceof IPinnablePart) {
((IPinnablePart)part).copyViewSettings(secondaryId);
}
- return part.getSite().getPage().showView(viewId, secondaryId, IWorkbenchPage.VIEW_VISIBLE);
+ return part.getSite().getPage().showView(viewId, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
} catch (PartInitException e) {
DebugUIPlugin.log(e);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/PinViewToContextDropDownAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/PinViewToContextDropDownAction.java
deleted file mode 100644
index 33af9b393..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/PinViewToContextDropDownAction.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 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.debug.ui.contexts;
-
-
-import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
-import org.eclipse.debug.internal.ui.actions.ActionMessages;
-import org.eclipse.debug.internal.ui.contexts.ClearPinnedContextAction;
-import org.eclipse.debug.internal.ui.contexts.PinToContextAction;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IWorkbenchWindow;
-
-/**
- * Drop down action to select the debug context to pin a view to.
- *
- * @since 3.9
- */
-class PinViewToContextDropDownAction extends Action implements IMenuCreator {
-
- private IPinnablePart fView;
- private Menu fMenu;
-
- public PinViewToContextDropDownAction(IPinnablePart view) {
- super(null, AS_DROP_DOWN_MENU);
- fView= view;
- setText(ActionMessages.PinViewToContextAction_label);
- setToolTipText(ActionMessages.PinViewToContextAction_tooltip);
- setImageDescriptor(DebugUITools.getImageDescriptor(IInternalDebugUIConstants.IMG_LCL_PIN));
- setMenuCreator(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#dispose()
- */
- public void dispose() {
- if (fMenu != null) {
- fMenu.dispose();
- }
-
- fView = null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
- */
- public Menu getMenu(Menu parent) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
- */
- public Menu getMenu(Control parent) {
- if (fMenu != null) {
- fMenu.dispose();
- }
-
- fMenu= new Menu(parent);
- IDebugContextManager manager = DebugUITools.getDebugContextManager();
- IPinnedContextFactory[] factories = manager.getEnabledContextViewerFactories(fView, StructuredSelection.EMPTY);
-
- String pinnedFactoryId = fView.getPinnedFactoryId();
- addActionToMenu(fMenu, new ClearPinnedContextAction(fView), 1);
- for (int i = 0; i < factories.length; i++) {
- Action action = new PinToContextAction(fView, factories[i]);
- action.setChecked(factories[i].getId().equals(pinnedFactoryId));
- addActionToMenu(fMenu, action, i + 2);
- }
- return fMenu;
- }
-
- private void addActionToMenu(Menu parent, Action action, int accelerator) {
- if (accelerator < 10) {
- StringBuffer label= new StringBuffer();
- //add the numerical accelerator
- label.append('&');
- label.append(accelerator);
- label.append(' ');
- label.append(action.getText());
- action.setText(label.toString());
- }
- ActionContributionItem item= new ActionContributionItem(action);
- item.fill(parent, -1);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- if (!fView.isPinned()) {
- fView.pin(getFactory());
- } else {
- fView.clearPin();
- }
- }
-
- private IPinnableDebugContextProvider getContextProvider() {
- IDebugContextProvider provider = getContextService().getActiveProvider();
- if (provider instanceof IPinnableDebugContextProvider) {
- return (IPinnableDebugContextProvider)provider;
- }
- return null;
- }
-
- private IDebugContextService getContextService() {
- IWorkbenchWindow window = fView.getSite().getWorkbenchWindow();
- return DebugUITools.getDebugContextManager().getContextService(window);
- }
-
- private IPinnedContextFactory getFactory() {
- IPinnableDebugContextProvider provider = getContextProvider();
- if (provider != null) {
- return DebugUITools.getDebugContextManager().getPinnedContextViewerFactory( provider.getFactoryId() );
- }
- return null;
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/PinViewToContextDynamicContribution.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/PinViewToContextDynamicContribution.java
deleted file mode 100644
index 498018f94..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/PinViewToContextDynamicContribution.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Wind River Systems 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.ui.contexts;
-
-import org.eclipse.debug.internal.ui.contexts.ClearPinnedContextAction;
-import org.eclipse.debug.internal.ui.contexts.PinToContextAction;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.IPartService;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.actions.CompoundContributionItem;
-import org.eclipse.ui.menus.IWorkbenchContribution;
-import org.eclipse.ui.services.IServiceLocator;
-
-/**
- * A dynamic menu contribution that adds a list of factories that can be used
- * to pin a debug view to a specific debug context.
- * <p>
- * The following example demonstrates how this contribution can be used to
- * add a drop-down pin action to a view.
- * <pre>
- * &lt;extension
- * point="org.eclipse.ui.menus"&gt;
- * &lt;menuContribution locationURI="toolbar:org.eclipse.debug.ui.VariableView?after=additions"&gt;
- * &lt;command
- * commandId="org.eclipse.debug.ui.pinViewToContextDropDown"
- * icon="icons/full/elcl16/pin.gif"
- * label="%PinViewToContextCommand.label"
- * style="pulldown"
- * tooltip="%PinViewToContextCommand.label"&gt;
- * &lt;/command&gt;
- * &lt;/menuContribution&gt;
- * &lt;menuContribution
- * locationURI="menu:org.eclipse.debug.ui.pinViewToContextDropDown"&gt;
- * &lt;dynamic
- * class="org.eclipse.debug.ui.contexts.PinViewToContextContribution"
- * id="org.eclipse.debug.ui.pinToContextFactories"&gt;
- * &lt;/dynamic&gt;
- * &lt;/menuContribution&gt;
- * &lt;/extension&gt;
- *
- * &lt;extension point="org.eclipse.ui.commands"&gt;
- * &lt;command
- * id="org.eclipse.debug.ui.pinViewToContextDropDown"
- * defaultHandler="org.eclipse.debug.ui.contexts.PinViewToContextDropDownHandler"
- * name="%PinViewToContextCommand.label"
- * description="%PinViewToContextCommand.description"/&gt;
- * &lt;/extension&gt;
- * </pre>
- *
- * @since 3.9
- * @noextend This class is not intended to be sub-classed by clients.
- */
-public class PinViewToContextDynamicContribution extends CompoundContributionItem implements IWorkbenchContribution {
-
- private IServiceLocator fServiceLocator;
-
- private static IContributionItem[] NO_PIN_PROVIDERS_CONTRIBUTION_ITEMS = new IContributionItem[] {
- new ContributionItem() {
- public void fill(Menu menu, int index) {
- MenuItem item = new MenuItem(menu, SWT.NONE);
- item.setEnabled(false);
- item.setText("No pinned context providers available"); //$NON-NLS-1$
- }
-
- public boolean isEnabled() {
- return false;
- }
- }
- };
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
- */
- protected IContributionItem[] getContributionItems() {
- IWorkbenchPart part = null;
- IPartService partService = (IPartService)fServiceLocator.getService(IPartService.class);
- if (partService != null) {
- part = partService.getActivePart();
- }
-
- // If no part or selection, disable all.
- if (!(part instanceof IPinnablePart)) {
- return NO_PIN_PROVIDERS_CONTRIBUTION_ITEMS;
- }
- IPinnablePart pinnable = (IPinnablePart)part;
-
- // Get breakpoint toggle target IDs.
- IDebugContextManager manager = DebugUITools.getDebugContextManager();
- IPinnedContextFactory[] factories = manager.getEnabledContextViewerFactories(pinnable, StructuredSelection.EMPTY);
-
- IContributionItem[] items = new IContributionItem[factories.length + 1];
- items[0] = makeActionContributionItem(new ClearPinnedContextAction(pinnable), 1);
- for (int i = 0; i < factories.length; i++) {
- Action action = new PinToContextAction(pinnable, factories[i]);
- items[i + 1] = makeActionContributionItem(action, i + 2);
- }
-
- return items;
- }
-
- private IContributionItem makeActionContributionItem(Action action, int accelerator) {
- if (accelerator < 10) {
- StringBuffer label= new StringBuffer();
- //add the numerical accelerator
- label.append('&');
- label.append(accelerator);
- label.append(' ');
- label.append(action.getText());
- action.setText(label.toString());
- }
- return new ActionContributionItem(action);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.menus.IWorkbenchContribution#initialize(org.eclipse.ui.services.IServiceLocator)
- */
- public void initialize(IServiceLocator serviceLocator) {
- fServiceLocator = serviceLocator;
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/PinViewToContextHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/PinViewToContextHandler.java
deleted file mode 100644
index ebd95c8f4..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/PinViewToContextHandler.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Wind River Systems 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:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.debug.ui.contexts;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * Command handler that pins a view to a debug context.
- * <p>
- * The handler selects the pin-able context factory based on the active
- * debug context provider and on the available factories. If a view is
- * already pinned to a context, this handler will un-pin the view.
- * </p>
- * <p>
- * This handler can be used in conjunction with a dynamic contribution for
- * a drop-down pin menu. See {@link PinViewToContextDynamicContribution} for
- * details.
- * </p>
- * @noextend This class is not intended to be subclassed by clients.
- * @since 3.9
- */
-public class PinViewToContextHandler extends AbstractHandler {
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchPart part = HandlerUtil.getActivePartChecked(event);
- if (part instanceof IPinnablePart) {
- IPinnablePart pinnable = (IPinnablePart)part;
- if (!pinnable.isPinned()) {
- pinnable.pin(getFactory(event));
- } else {
- pinnable.clearPin();
- }
- }
- return null;
- }
-
- private IPinnableDebugContextProvider getContextProvider(ExecutionEvent event) {
- IDebugContextProvider provider = getContextService(event).getActiveProvider();
- if (provider instanceof IPinnableDebugContextProvider) {
- return (IPinnableDebugContextProvider)provider;
- }
- return null;
- }
-
- private IDebugContextService getContextService(ExecutionEvent event) {
- IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
- if (window != null) {
- return DebugUITools.getDebugContextManager().getContextService(window);
- }
- return null;
- }
-
- private IPinnedContextFactory getFactory(ExecutionEvent event) {
- IPinnableDebugContextProvider provider = getContextProvider(event);
- if (provider != null) {
- return DebugUITools.getDebugContextManager().getPinnedContextViewerFactory( provider.getFactoryId() );
- }
- return null;
- }
-} \ No newline at end of file

Back to the top