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 93626 Details for
Bug 140650
[PII] Missing shortcut keys in TPTP profiling context menu
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Proposed Patch
140650patch.txt (text/plain), 78.09 KB, created by
Ritwik Lodhiya
on 2008-03-26 11:56:33 EDT
(
hide
)
Description:
Proposed Patch
Filename:
MIME Type:
Creator:
Ritwik Lodhiya
Created:
2008-03-26 11:56:33 EDT
Size:
78.09 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.tptp.platform.instrumentation.ui >#P org.eclipse.tptp.platform.jvmti.client >Index: src/org/eclipse/tptp/platform/jvmti/client/internal/controlproviders/TIAgentControlProvider.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.client/src/org/eclipse/tptp/platform/jvmti/client/internal/controlproviders/TIAgentControlProvider.java,v >retrieving revision 1.9 >diff -u -r1.9 TIAgentControlProvider.java >--- src/org/eclipse/tptp/platform/jvmti/client/internal/controlproviders/TIAgentControlProvider.java 22 Aug 2007 04:40:19 -0000 1.9 >+++ src/org/eclipse/tptp/platform/jvmti/client/internal/controlproviders/TIAgentControlProvider.java 26 Mar 2008 15:49:31 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2007 IBM Corporation, Intel Corporation. >+ * Copyright (c) 2007 2008 IBM Corporation, Intel Corporation. > * 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 >@@ -12,6 +12,7 @@ > > import java.util.Iterator; > >+import org.eclipse.core.commands.IHandler; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.IStatus; >@@ -44,6 +45,7 @@ > import org.eclipse.tptp.trace.ui.provisional.control.provider.IAgentStateModifier; > import org.eclipse.tptp.trace.ui.provisional.control.provider.IControlItem; > import org.eclipse.tptp.trace.ui.provisional.control.provider.IProcessStateModifier; >+import org.eclipse.tptp.trace.ui.provisional.control.provider.TerminateControlItemHandler; > > > /** >@@ -54,12 +56,9 @@ > */ > public class TIAgentControlProvider extends AbstractAgentControlProvider > { >- >- /** The id of the contributed items */ >- private static final String RUNGC_ITEM = "org.eclipse.tptp.trace.jvmti.client.internal.popupMenu.RunGCAction"; >- > /** The runGC item */ > private IControlItem runGCControlItem; >+ private IHandler handler; > > > protected void initializeControlItems() { >@@ -80,45 +79,10 @@ > return runGCControlItem; > > runGCControlItem = new RunGCControlItem(); >+ handler = new RunGCControlItemHandler(runGCControlItem); >+ runGCControlItem.setHandler(handler); > return runGCControlItem; > } >- >- static class RunGCControlItem extends ControlItem { >- >- private RunGCActionDelegate gcAction; >- >- public RunGCControlItem() { >- super(RUNGC_ITEM, CommonUITraceConstants.PROFILE_GC_GROUP, >- ControlMessages.CONTROL_ITEM_GC_ACTION, >- TraceUIImages.INSTANCE.getImageDescriptor("c", >- TraceUIImages.IMG_GC)); >- setDisabledImageDescriptor(TraceUIImages.INSTANCE >- .getImageDescriptor("d", TraceUIImages.IMG_GC)); >- gcAction = new RunGCActionDelegate(); >- } >- >- public void run() { >- try { >- for (Iterator agents = input.iterator(); agents.hasNext();) >- gcAction.doAction(agents.next()); >- >- } catch (Exception e) { >- LauncherUtility.openMessageWithDetail(IStatus.ERROR, "", e >- .getMessage(), e); >- } >- } >- >- public boolean isEnabled() { >- if (input == null || input.size() == 0) >- return false; >- >- boolean isEnable = true; >- for (Iterator agents = input.iterator(); isEnable >- && agents.hasNext();) >- isEnable = isEnable && gcAction.isEnabledFor(agents.next()); >- return isEnable; >- } >- } > > public IAgentStateModifier getAgentStateModifier() > { >Index: src/org/eclipse/tptp/platform/jvmti/client/internal/controlproviders/TIAgentToolbarControlProvider.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.client/src/org/eclipse/tptp/platform/jvmti/client/internal/controlproviders/TIAgentToolbarControlProvider.java,v >retrieving revision 1.3 >diff -u -r1.3 TIAgentToolbarControlProvider.java >--- src/org/eclipse/tptp/platform/jvmti/client/internal/controlproviders/TIAgentToolbarControlProvider.java 23 Mar 2007 12:49:22 -0000 1.3 >+++ src/org/eclipse/tptp/platform/jvmti/client/internal/controlproviders/TIAgentToolbarControlProvider.java 26 Mar 2008 15:49:31 -0000 >@@ -13,7 +13,6 @@ > import org.eclipse.hyades.trace.ui.internal.core.TraceUIImages; > import org.eclipse.tptp.platform.common.ui.trace.internal.CommonUITraceConstants; > import org.eclipse.tptp.platform.jvmti.client.internal.controlproviders.TIAgentControlProvider.TIAgentStateModifier; >-import org.eclipse.tptp.platform.jvmti.client.internal.controlproviders.TIAgentControlProvider.RunGCControlItem; > import org.eclipse.tptp.platform.jvmti.client.internal.controlproviders.TIProcessControlProvider.TIProcessStateModifier; > import org.eclipse.tptp.trace.ui.provisional.control.provider.AbstractAgentToolbarProvider; > import org.eclipse.tptp.trace.ui.provisional.control.provider.IAgentStateModifier; >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.client/plugin.xml,v >retrieving revision 1.17 >diff -u -r1.17 plugin.xml >--- plugin.xml 28 Feb 2008 23:13:08 -0000 1.17 >+++ plugin.xml 26 Mar 2008 15:49:31 -0000 >@@ -311,4 +311,25 @@ > </entity> > </control> > </extension> >+ <extension >+ point="org.eclipse.ui.commands"> >+ <category >+ id="org.eclipse.hyades.trace.ui.ProfileActions" >+ name="Trace Action Items"> >+ </category> >+ <command >+ categoryId="org.eclipse.hyades.trace.ui.ProfileActions" >+ defaultHandler="org.eclipse.tptp.platform.jvmti.client.internal.controlproviders.RunGCControlItemHandler" >+ id="org.eclipse.tptp.platform.jvmti.client.internal.controlproviders.RunGCControlItem" >+ name="Run Garbage Collection"> >+ </command> >+ </extension> >+ <extension >+ point="org.eclipse.ui.bindings"> >+ <key >+ commandId="org.eclipse.tptp.platform.jvmti.client.internal.controlproviders.RunGCControlItem" >+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" >+ sequence="M1+M3+M2+G"> >+ </key> >+ </extension> > </plugin> >Index: src/org/eclipse/tptp/platform/jvmti/client/internal/controlproviders/RunGCControlItem.java >=================================================================== >RCS file: src/org/eclipse/tptp/platform/jvmti/client/internal/controlproviders/RunGCControlItem.java >diff -N src/org/eclipse/tptp/platform/jvmti/client/internal/controlproviders/RunGCControlItem.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/platform/jvmti/client/internal/controlproviders/RunGCControlItem.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,60 @@ >+/********************************************************************** >+ * Copyright (c) 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 - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.tptp.platform.jvmti.client.internal.controlproviders; >+ >+import java.util.Iterator; >+ >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.hyades.trace.ui.internal.core.TraceUIImages; >+import org.eclipse.tptp.platform.common.ui.trace.internal.CommonUITraceConstants; >+import org.eclipse.tptp.platform.jvmti.client.internal.actions.RunGCActionDelegate; >+import org.eclipse.tptp.trace.ui.internal.control.provider.application.ControlMessages; >+import org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherUtility; >+import org.eclipse.tptp.trace.ui.provisional.control.provider.ControlItem; >+ >+public class RunGCControlItem extends ControlItem { >+ >+ private RunGCActionDelegate gcAction; >+ private static final String RUNGC_ITEM = "org.eclipse.tptp.platform.jvmti.client.internal.controlproviders.RunGCControlItem"; >+ >+ >+ public RunGCControlItem() { >+ super(RUNGC_ITEM, CommonUITraceConstants.PROFILE_GC_GROUP, >+ ControlMessages.CONTROL_ITEM_GC_ACTION, >+ TraceUIImages.INSTANCE.getImageDescriptor("c", >+ TraceUIImages.IMG_GC)); >+ setDisabledImageDescriptor(TraceUIImages.INSTANCE >+ .getImageDescriptor("d", TraceUIImages.IMG_GC)); >+ gcAction = new RunGCActionDelegate(); >+ } >+ >+ public void run() { >+ try { >+ for (Iterator agents = input.iterator(); agents.hasNext();) >+ gcAction.doAction(agents.next()); >+ >+ } catch (Exception e) { >+ LauncherUtility.openMessageWithDetail(IStatus.ERROR, "", e >+ .getMessage(), e); >+ } >+ } >+ >+ public boolean isEnabled() { >+ if (input == null || input.size() == 0) >+ return false; >+ >+ boolean isEnable = true; >+ for (Iterator agents = input.iterator(); isEnable >+ && agents.hasNext();) >+ isEnable = isEnable && gcAction.isEnabledFor(agents.next()); >+ return isEnable; >+ } >+} >Index: src/org/eclipse/tptp/platform/jvmti/client/internal/controlproviders/RunGCControlItemHandler.java >=================================================================== >RCS file: src/org/eclipse/tptp/platform/jvmti/client/internal/controlproviders/RunGCControlItemHandler.java >diff -N src/org/eclipse/tptp/platform/jvmti/client/internal/controlproviders/RunGCControlItemHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/platform/jvmti/client/internal/controlproviders/RunGCControlItemHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,45 @@ >+/********************************************************************** >+ * Copyright (c) 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 - Initial API and implementation >+ **********************************************************************/ >+ >+package org.eclipse.tptp.platform.jvmti.client.internal.controlproviders; >+ >+import org.eclipse.core.commands.AbstractHandler; >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.swt.widgets.Event; >+ >+ >+ >+public class RunGCControlItemHandler extends AbstractHandler { >+ >+ private IAction action; >+ >+ public RunGCControlItemHandler(IAction runGC) { >+ super(); >+ this.action = runGC; >+ >+ } >+ >+ public Object execute(ExecutionEvent arg0) throws ExecutionException { >+ if ((action.getStyle() == IAction.AS_CHECK_BOX) >+ || (action.getStyle() == IAction.AS_RADIO_BUTTON)) { >+ action.setChecked(!action.isChecked()); >+ } >+ try { >+ action.runWithEvent(new Event()); >+ } catch (Exception e) { >+ throw new ExecutionException("", e); //$NON-NLS-1$ >+ } >+ >+ return null; >+ } >+} >#P org.eclipse.hyades.trace.ui >Index: src/org/eclipse/tptp/trace/ui/provisional/control/provider/ResourceItemControlProvider.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/tptp/trace/ui/provisional/control/provider/ResourceItemControlProvider.java,v >retrieving revision 1.4 >diff -u -r1.4 ResourceItemControlProvider.java >--- src/org/eclipse/tptp/trace/ui/provisional/control/provider/ResourceItemControlProvider.java 3 Oct 2006 19:13:55 -0000 1.4 >+++ src/org/eclipse/tptp/trace/ui/provisional/control/provider/ResourceItemControlProvider.java 26 Mar 2008 15:49:32 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2006 IBM Corporation and others. >+ * Copyright (c) 2006, 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 >@@ -10,24 +10,18 @@ > **********************************************************************/ > package org.eclipse.tptp.trace.ui.provisional.control.provider; > >-import java.util.Iterator; >- >+import org.eclipse.core.commands.IHandler; > import org.eclipse.hyades.trace.internal.ui.PDProjectExplorer; >-import org.eclipse.hyades.trace.ui.ProfileEvent; > import org.eclipse.hyades.trace.ui.UIPlugin; > import org.eclipse.hyades.trace.ui.internal.actions.DeleteAction; > import org.eclipse.hyades.trace.ui.internal.actions.OpenWizardAction; > import org.eclipse.hyades.trace.ui.internal.actions.SaveAction; >-import org.eclipse.hyades.trace.ui.internal.core.TraceUIImages; > import org.eclipse.hyades.trace.ui.internal.util.TraceMessages; > import org.eclipse.hyades.trace.ui.internal.wizard.OpenProcessWizard; > import org.eclipse.hyades.trace.ui.internal.wizard.OpenProfAgentWizard; > import org.eclipse.hyades.ui.extension.INavigatorContribution; >-import org.eclipse.tptp.platform.common.ui.trace.internal.CommonUITraceConstants; > import org.eclipse.tptp.trace.ui.internal.control.provider.ControlProviderManager; > import org.eclipse.tptp.trace.ui.internal.control.provider.TraceControlItemManager; >-import org.eclipse.tptp.trace.ui.internal.control.provider.application.ControlMessages; >- > > > /** >@@ -43,10 +37,6 @@ > */ > public class ResourceItemControlProvider extends LogicalItemControlProvider > { >- /** The id of the contributed items */ >- private static final String REFRESH_ITEM = "org.eclipse.hyades.trace.ui.internal.monitorsview.popupMenu.refreshViews"; >- private static final String REFRESH_OPTION = "org.eclipse.hyades.trace.ui.internal.monitorsview.popupMenu.refreshOption"; >- > /** The delete item */ > private IControlItem delete; > >@@ -54,16 +44,18 @@ > private IControlItem save; > > /** The refresh view item */ >- private IControlItem refresh; >+ protected static IControlItem refresh; > > /** The refresh option item */ >- private IControlItem refreshOption; >+ protected static IControlItem refreshOption; > > /** The properties item */ > private IControlItem properties; > > /** The entity that this provider is affiliated to */ > private String entity; >+ >+ private IHandler handler; > > public void initialize (String entity) > { >@@ -88,8 +80,7 @@ > { > if (delete != null && !isContextDifferent) > return delete; >- >- >+ > delete = new ControlItemAdapter(INavigatorContribution.GROUP_DELETE, new DeleteAction(TraceControlItemManager.getNavigator())); > return delete; > } >@@ -100,7 +91,6 @@ > if (save != null && !isContextDifferent) > return save; > >- > save = new ControlItemAdapter(INavigatorContribution.GROUP_SAVE, new SaveAction(TraceControlItemManager.getNavigator())); > return save; > } >@@ -110,27 +100,10 @@ > { > if (refresh != null) > return refresh; >- >- class RefreshView extends ControlItem >- { >- public RefreshView() >- { >- super (REFRESH_ITEM, CommonUITraceConstants.PROFILE_REFRESH_GROUP, ControlMessages.CONTROL_ITEM_REFRESH_VIEWS, TraceUIImages.INSTANCE.getImageDescriptor("c", TraceUIImages.IMG_REFRESH_VIEWS)); >- } >- >- public void run() >- { >- if (input == null) >- return; >- >- for (Iterator sources = input.iterator(); sources.hasNext();) >- { >- ProfileEvent event = UIPlugin.getDefault().getRefreshViewEvent(sources.next()); >- UIPlugin.getDefault().notifyProfileEventListener(event); >- } >- } >- } >+ > refresh = new RefreshView(); >+ handler = new RefreshViewHandler(refresh); >+ refresh.setHandler(handler); > return refresh; > } > >@@ -143,29 +116,8 @@ > protected IControlItem createRefreshOptionControlItem() > { > if (refreshOption != null) >- return refreshOption; >- >- class RefreshOption extends ControlItem >- { >- public RefreshOption() >- { >- super (REFRESH_OPTION, CommonUITraceConstants.PROFILE_REFRESH_GROUP, ControlMessages.CONTROL_ITEM_REFRESH_OPTION, TraceUIImages.INSTANCE.getImageDescriptor("c", TraceUIImages.IMG_REFRESH_OPTIONS)); >- } >- >- /* This method is invoked when ever user clicks the 'Change Refresh Options' button. >- * It simply invokes the 'handleProfileEvent' method of PDProjectExplorer */ >- public void run() >- { >- if (input == null) >- return; >- >- for (Iterator sources = input.iterator(); sources.hasNext();) >- { >- ProfileEvent event = UIPlugin.getDefault().getRefreshOptionEvent(sources.next()); >- UIPlugin.getDefault().notifyProfileEventListener(event); >- } >- } >- } >+ return refreshOption; >+ > refreshOption = new RefreshOption(); > return refreshOption; > } >Index: src/org/eclipse/tptp/trace/ui/provisional/control/provider/AbstractProcessControlProvider.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/tptp/trace/ui/provisional/control/provider/AbstractProcessControlProvider.java,v >retrieving revision 1.3 >diff -u -r1.3 AbstractProcessControlProvider.java >--- src/org/eclipse/tptp/trace/ui/provisional/control/provider/AbstractProcessControlProvider.java 22 Aug 2006 22:27:34 -0000 1.3 >+++ src/org/eclipse/tptp/trace/ui/provisional/control/provider/AbstractProcessControlProvider.java 26 Mar 2008 15:49:32 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2006 IBM Corporation and others. >+ * Copyright (c) 2006, 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 >@@ -10,14 +10,7 @@ > **********************************************************************/ > package org.eclipse.tptp.trace.ui.provisional.control.provider; > >- >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.hyades.trace.ui.internal.core.TraceUIImages; >-import org.eclipse.jface.viewers.StructuredSelection; >-import org.eclipse.tptp.platform.common.ui.trace.internal.CommonUITraceConstants; >-import org.eclipse.tptp.trace.ui.internal.control.provider.application.ControlMessages; >-import org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherUtility; >- >+import org.eclipse.core.commands.IHandler; > > /** > * Provides an abstract control provider for a process. Subclasses are >@@ -28,11 +21,10 @@ > */ > public abstract class AbstractProcessControlProvider extends ResourceItemControlProvider > { >- /** The id of the contributed items */ >- private static final String TERMINATE_ITEM = "org.eclipse.hyades.trace.ui.internal.popupMenu.TerminateAction"; >- > /** The terminate item */ >- private IControlItem terminateItem; >+ protected static IControlItem terminateItem; >+ >+ private IHandler handler; > > /** > * Subclasses are expected to provide a process state modifier that >@@ -61,63 +53,16 @@ > * Overwrite this method to modify the terminate control > * item. > * >- * @return Ther terminate control item >+ * @return The terminate control item > */ > protected IControlItem createTerminateControlItem() > { > if (terminateItem != null) > return terminateItem; >- >- class TerminateAction extends ControlItem >- { >- public TerminateAction() >- { >- super (TERMINATE_ITEM, CommonUITraceConstants.PROFILE_TERMINATE_GROUP, ControlMessages.CONTROL_ITEM_TERMINATE, TraceUIImages.INSTANCE.getImageDescriptor("c", TraceUIImages.IMG_TERMINATE)); >- setDisabledImageDescriptor(TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_TERMINATE)); >- } >- >- public void run() >- { >- IProcessStateModifier processStateModifier = getProcessStateModifier(); >- >- try >- { >- /* Terminate the process */ >- processStateModifier.terminate(); >- } catch (CoreException e) >- { >- /* Display status */ >- LauncherUtility.openMessageWithDetail(e.getStatus().getSeverity(), "", e.getMessage(), e); >- } >- } >- >- public boolean isEnabled() >- { >- return getProcessStateModifier().canTerminate(); >- } >- >- public void setInput(StructuredSelection input) >- { >- getProcessStateModifier().setInput(input); >- } >- >- public IProcessStateModifier getStateModifier() >- { >- return getProcessStateModifier(); >- } >- >- public boolean equals (Object o) >- { >- if (!(o instanceof TerminateAction)) >- return false; >- >- return getProcessStateModifier() == ((TerminateAction)o).getStateModifier() && super.equals(o); >- } >- >- } >- > >- terminateItem = new TerminateAction(); >+ terminateItem = new TerminateAction(getProcessStateModifier()); >+ handler = new TerminateControlItemHandler(terminateItem); >+ terminateItem.setHandler(handler); > return terminateItem; > } > } >Index: src/org/eclipse/tptp/trace/ui/provisional/control/provider/AbstractAgentControlProvider.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/tptp/trace/ui/provisional/control/provider/AbstractAgentControlProvider.java,v >retrieving revision 1.4 >diff -u -r1.4 AbstractAgentControlProvider.java >--- src/org/eclipse/tptp/trace/ui/provisional/control/provider/AbstractAgentControlProvider.java 15 Sep 2006 19:36:28 -0000 1.4 >+++ src/org/eclipse/tptp/trace/ui/provisional/control/provider/AbstractAgentControlProvider.java 26 Mar 2008 15:49:32 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2006 IBM Corporation and others. >+ * Copyright (c) 2006, 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 >@@ -10,14 +10,9 @@ > **********************************************************************/ > package org.eclipse.tptp.trace.ui.provisional.control.provider; > >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.hyades.trace.ui.internal.core.TraceUIImages; >+import org.eclipse.core.commands.IHandler; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.jface.viewers.StructuredSelection; >-import org.eclipse.tptp.platform.common.ui.trace.internal.CommonUITraceConstants; >-import org.eclipse.tptp.trace.ui.internal.control.provider.application.ControlMessages; >-import org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherUtility; >- > > > /** >@@ -38,13 +33,6 @@ > */ > public abstract class AbstractAgentControlProvider extends ProcessControlProvider > { >- /** The id of the control items contributed */ >- public static final String ATTACH_ITEM = "org.eclipse.hyades.trace.ui.internal.popupMenu.AttachAction"; >- public static final String DETACH_ITEM = "org.eclipse.hyades.trace.ui.internal.popupMenu.DetachAction"; >- public static final String START_MONITORING = "org.eclipse.hyades.trace.ui.internal.monitorsview.popupMenu.startMonitoring"; >- public static final String PAUSE_MONITORING = "org.eclipse.hyades.trace.ui.internal.popupMenu.stopMonitoring"; >- >- > /** The attach control item */ > private IControlItem attachItem; > >@@ -52,10 +40,13 @@ > private IControlItem detachItem; > > /** The resume control item */ >- private IControlItem resumeItem; >+ protected static IControlItem resumeItem; > > /** The pause control item */ >- private IControlItem pauseItem; >+ protected static IControlItem pauseItem; >+ >+ /** The handler for action items */ >+ private IHandler handler; > > /** > * @see org.eclipse.tptp.trace.ui.provisional.control.provider.AbstractLogicalItem.initializeControlItems() >@@ -90,37 +81,9 @@ > if (attachItem != null) > return attachItem; > >- class AttachControlItem extends AgentControlItem >- { >- public AttachControlItem() >- { >- super(getAgentStateModifier(), ATTACH_ITEM, CommonUITraceConstants.PROFILE_ATTACH_GROUP, ControlMessages.CONTROL_ITEM_ATTACH, TraceUIImages.INSTANCE.getImageDescriptor("c", TraceUIImages.IMG_DETACH_AGENT)); >- setDisabledImageDescriptor(TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_ATTACH_AGENT)); >- } >- >- public void run() >- { >- IAgentStateModifier agentStateModifier = getAgentStateModifier(); >- >- try >- { >- /* attach to the agent */ >- agentStateModifier.attach(); >- } catch (CoreException e) >- { >- /* Display status */ >- LauncherUtility.openMessageWithDetail(e.getStatus().getSeverity(), "", e.getMessage(), e); >- } >- } >- >- public boolean isEnabled() >- { >- return getAgentStateModifier().canAttach(); >- } >- } >- >- >- attachItem = new AttachControlItem(); >+ attachItem = new AttachControlItem(getAgentStateModifier()); >+ handler = new AttachControlItemHandler(attachItem); >+ attachItem.setHandler(handler); > return attachItem; > } > >@@ -129,37 +92,9 @@ > if (detachItem != null) > return detachItem; > >- class DetachControlItem extends AgentControlItem >- { >- public DetachControlItem() >- { >- super(getAgentStateModifier(), DETACH_ITEM, CommonUITraceConstants.PROFILE_ATTACH_GROUP, ControlMessages.CONTROL_ITEM_DETACH, TraceUIImages.INSTANCE.getImageDescriptor("c", TraceUIImages.IMG_DETACH_AGENT)); >- setDisabledImageDescriptor(TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_DETACH_AGENT)); >- } >- >- public void run() >- { >- IAgentStateModifier agentStateModifier = getAgentStateModifier(); >- >- try >- { >- /* detach the agent */ >- agentStateModifier.detach(); >- } catch (CoreException e) >- { >- /* Display status */ >- LauncherUtility.openMessageWithDetail(e.getStatus().getSeverity(), "", e.getMessage(), e); >- } >- } >- >- public boolean isEnabled() >- { >- return getAgentStateModifier().canDetach(); >- } >- } >- >- >- detachItem = new DetachControlItem(); >+ detachItem = new DetachControlItem(getAgentStateModifier()); >+ handler = new DetachControlItemHandler(detachItem); >+ detachItem.setHandler(handler); > return detachItem; > } > >@@ -168,37 +103,9 @@ > if (resumeItem != null) > return resumeItem; > >- class ResumeControlItem extends AgentControlItem >- { >- public ResumeControlItem() >- { >- super(getAgentStateModifier(), START_MONITORING, CommonUITraceConstants.PROFILE_MONITOR_GROUP, ControlMessages.CONTROL_ITEM_RESUME, TraceUIImages.INSTANCE.getImageDescriptor("c", TraceUIImages.IMG_RESUME)); >- setDisabledImageDescriptor(TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_RESUME)); >- } >- >- public void run() >- { >- IAgentStateModifier agentStateModifier = getAgentStateModifier(); >- >- try >- { >- /* Resume the agent */ >- agentStateModifier.startMonitoring(); >- } catch (CoreException e) >- { >- /* Display status */ >- LauncherUtility.openMessageWithDetail(e.getStatus().getSeverity(), "", e.getMessage(), e); >- } >- } >- >- public boolean isEnabled() >- { >- return getAgentStateModifier().canResume(); >- } >- } >- >- >- resumeItem = new ResumeControlItem(); >+ resumeItem = new ResumeControlItem(getAgentStateModifier()); >+ handler = new ResumeControlItemHandler(resumeItem); >+ resumeItem.setHandler(handler); > return resumeItem; > } > >@@ -207,42 +114,20 @@ > if (pauseItem != null) > return pauseItem; > >- class PauseControlItem extends AgentControlItem >- { >- public PauseControlItem() >- { >- super(getAgentStateModifier(), PAUSE_MONITORING, CommonUITraceConstants.PROFILE_MONITOR_GROUP, ControlMessages.CONTROL_ITEM_PAUSE, TraceUIImages.INSTANCE.getImageDescriptor("c", TraceUIImages.IMG_PAUSE)); >- setDisabledImageDescriptor(TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_PAUSE)); >- } >- >- public void run() >- { >- IAgentStateModifier agentStateModifier = getAgentStateModifier(); >- >- try >- { >- /* Pause the agent */ >- agentStateModifier.pauseMonitoring(); >- } catch (CoreException e) >- { >- /* Display status */ >- LauncherUtility.openMessageWithDetail(e.getStatus().getSeverity(), "", e.getMessage(), e); >- } >- } >- >- public boolean isEnabled() >- { >- return getAgentStateModifier().canPause(); >- } >- } >- >- >- pauseItem = new PauseControlItem(); >+ pauseItem = new PauseControlItem(getAgentStateModifier()); >+ handler = new PauseControlItemHandler(pauseItem); >+ pauseItem.setHandler(handler); > return pauseItem; > } > >+ public IControlItem getCreatedPauseControlItem() >+ { >+ if (pauseItem != null) >+ return pauseItem; >+ return createPauseMonitoringControlItem(); >+ } > >- private static class AgentControlItem extends ControlItem >+ protected static class AgentControlItem extends ControlItem > { > private IAgentStateModifier stateModifier; > >@@ -272,5 +157,4 @@ > } > > } >- > } >Index: src/org/eclipse/tptp/trace/ui/provisional/control/provider/AbstractAgentToolbarProvider.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/tptp/trace/ui/provisional/control/provider/AbstractAgentToolbarProvider.java,v >retrieving revision 1.4 >diff -u -r1.4 AbstractAgentToolbarProvider.java >--- src/org/eclipse/tptp/trace/ui/provisional/control/provider/AbstractAgentToolbarProvider.java 3 Oct 2006 19:13:55 -0000 1.4 >+++ src/org/eclipse/tptp/trace/ui/provisional/control/provider/AbstractAgentToolbarProvider.java 26 Mar 2008 15:49:32 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2006 IBM Corporation and others. >+ * Copyright (c) 2006, 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 >@@ -10,6 +10,7 @@ > **********************************************************************/ > package org.eclipse.tptp.trace.ui.provisional.control.provider; > >+import org.eclipse.core.commands.IHandler; > import org.eclipse.hyades.trace.ui.UIPlugin; > import org.eclipse.hyades.trace.ui.internal.core.TraceUIImages; > import org.eclipse.jface.resource.ImageDescriptor; >@@ -45,6 +46,9 @@ > /** The automatic refresh control item. Used */ > private IControlItem automaticRefresh; > >+ /** hander for the action items */ >+ private IHandler handler; >+ > /** > * @see AbstractControlProvider#initializeControlItems() > */ >@@ -70,6 +74,8 @@ > return startMonitoring; > > startMonitoring = makeToolbarReady(super.createStartMonitoringControlItem(), START_TOOLBAR_ITEM, CommonUITraceConstants.PROFILE_MONITOR_GROUP, TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_RESUME)); >+ handler = resumeItem.getHandler(); >+ startMonitoring.setHandler(handler); > return startMonitoring; > } > >@@ -85,7 +91,8 @@ > if (pauseMonitoring != null) > return pauseMonitoring; > pauseMonitoring = makeToolbarReady(super.createPauseMonitoringControlItem(), PAUSE_TOOLBAR_ITEM, CommonUITraceConstants.PROFILE_MONITOR_GROUP, TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_PAUSE)); >- >+ handler = pauseItem.getHandler(); >+ pauseMonitoring.setHandler(handler); > return pauseMonitoring; > } > >@@ -102,6 +109,8 @@ > return terminate; > > terminate = makeToolbarReady(super.createTerminateControlItem(), TERMINATE_TOOLBAR_ITEM, CommonUITraceConstants.PROFILE_MONITOR_GROUP, TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_TERMINATE)); >+ handler = terminateItem.getHandler(); >+ terminate.setHandler(handler); > return terminate; > } > >@@ -118,6 +127,8 @@ > return refreshView; > > refreshView = makeToolbarReady(super.createRefreshViewsControlItem(), REFRESH_VIEW_TOOLBAR_ITEM, CommonUITraceConstants.PROFILE_REFRESH_GROUP, TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_REFRESH_VIEWS)); >+ handler = refresh.getHandler(); >+ refreshView.setHandler(handler); > return refreshView; > } > >Index: src/org/eclipse/tptp/trace/ui/provisional/control/provider/ControlItem.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/tptp/trace/ui/provisional/control/provider/ControlItem.java,v >retrieving revision 1.2 >diff -u -r1.2 ControlItem.java >--- src/org/eclipse/tptp/trace/ui/provisional/control/provider/ControlItem.java 7 Sep 2006 23:16:57 -0000 1.2 >+++ src/org/eclipse/tptp/trace/ui/provisional/control/provider/ControlItem.java 26 Mar 2008 15:49:32 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2006 IBM Corporation and others. >+ * Copyright (c) 2006, 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 >@@ -11,6 +11,7 @@ > > package org.eclipse.tptp.trace.ui.provisional.control.provider; > >+import org.eclipse.core.commands.IHandler; > import org.eclipse.jface.action.Action; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.jface.viewers.StructuredSelection; >@@ -27,18 +28,32 @@ > > private String groupName, text; > protected StructuredSelection input; >+ protected IHandler handler; > > public ControlItem() > { > > } >- >+ >+ public IHandler getHandler() { >+ return handler; >+ } >+ >+ public void setHandler(IHandler actionHandler){ >+ handler = actionHandler; >+ } >+ >+ public String getCommandID() { >+ return super.getActionDefinitionId(); >+ } >+ > public ControlItem(String itemId, String groupName, String text, ImageDescriptor imageDescriptor) > { > this.groupName = groupName; > this.text = text; > super.setImageDescriptor(imageDescriptor); > super.setId(itemId); >+ super.setActionDefinitionId(itemId); > } > > >Index: src/org/eclipse/tptp/trace/ui/provisional/control/provider/IControlItem.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/tptp/trace/ui/provisional/control/provider/IControlItem.java,v >retrieving revision 1.1 >diff -u -r1.1 IControlItem.java >--- src/org/eclipse/tptp/trace/ui/provisional/control/provider/IControlItem.java 8 Mar 2006 19:03:09 -0000 1.1 >+++ src/org/eclipse/tptp/trace/ui/provisional/control/provider/IControlItem.java 26 Mar 2008 15:49:32 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2006 IBM Corporation and others. >+ * Copyright (c) 2006 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 >@@ -11,6 +11,7 @@ > > package org.eclipse.tptp.trace.ui.provisional.control.provider; > >+import org.eclipse.core.commands.IHandler; > import org.eclipse.jface.action.IAction; > import org.eclipse.jface.viewers.StructuredSelection; > >@@ -47,4 +48,30 @@ > * @param input The input of this control item. > */ > public void setInput (StructuredSelection input); >+ >+ /** >+ * Sets the handler for this control item. The handler should be of the >+ * corresponding type as the action that is declared. (ex. PauseControlItem >+ * has PauseControlItemHandler) >+ * >+ * @param Handler for the IControlItem action. >+ */ >+ public void setHandler(IHandler actionHandler); >+ >+ /** >+ * Returns the handler for this control item. The handler should be declared >+ * ahead of time, or a <code>null</code> will be returned. >+ * >+ * @return Handler for the IControlItem action. >+ */ >+ public IHandler getHandler(); >+ >+ /** >+ * Returns the Action Definition ID (aka Command ID) for this control item. The >+ * default action definition id is null unless set previously using >+ * "setActionDefinitionID(String id)." >+ * >+ * @return actionDefinitionID of type String >+ */ >+ public String getCommandID(); > } >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/plugin.xml,v >retrieving revision 1.57 >diff -u -r1.57 plugin.xml >--- plugin.xml 28 Feb 2008 23:09:57 -0000 1.57 >+++ plugin.xml 26 Mar 2008 15:49:32 -0000 >@@ -1035,6 +1035,106 @@ > > <entity type = "toolbar" > class = "org.eclipse.tptp.trace.ui.internal.control.provider.application.AgentDiscovererToolbarProvider"/> >- </control> >+ </control> > </extension> >+ <extension >+ point="org.eclipse.ui.contexts"> >+ <context >+ id="org.eclipse.ui.TPTPMonitorContext" >+ name="TPTP Profiling View Context"> >+ </context> >+ </extension> >+ >+ <extension >+ point="org.eclipse.ui.commands"> >+ <category >+ name="Trace Action Items" >+ id="org.eclipse.hyades.trace.ui.ProfileActions"> >+ </category> >+ <command >+ categoryId="org.eclipse.hyades.trace.ui.ProfileActions" >+ defaultHandler="org.eclipse.tptp.trace.ui.provisional.control.provider.PauseControlItemHandler" >+ id="org.eclipse.tptp.trace.ui.provisional.control.provider.PauseControlItem" >+ name="Pause Monitoring"> >+ </command> >+ <command >+ categoryId="org.eclipse.hyades.trace.ui.ProfileActions" >+ defaultHandler="org.eclipse.tptp.trace.ui.provisional.control.provider.ResumeControlItemHandler" >+ id="org.eclipse.tptp.trace.ui.provisional.control.provider.ResumeControlItem" >+ name="Start Monitoring"> >+ </command> >+ <command >+ categoryId="org.eclipse.hyades.trace.ui.ProfileActions" >+ defaultHandler="org.eclipse.tptp.trace.ui.provisional.control.provider.AttachControlItemHandler" >+ id="org.eclipse.tptp.trace.ui.provisional.control.provider.AttachControlItem" >+ name="Attach to Agent"> >+ </command> >+ <command >+ categoryId="org.eclipse.hyades.trace.ui.ProfileActions" >+ defaultHandler="org.eclipse.tptp.trace.ui.provisional.control.provider.DetachControlItemHandler" >+ id="org.eclipse.tptp.trace.ui.provisional.control.provider.DetachControlItem" >+ name="Detach from Agent"> >+ </command> >+ <command >+ categoryId="org.eclipse.hyades.trace.ui.ProfileActions" >+ defaultHandler="org.eclipse.tptp.trace.ui.provisional.control.provider.TerminateControlItemHandler" >+ id="org.eclipse.tptp.trace.ui.provisional.control.provider.TerminateAction" >+ name="Terminate Monitoring Process"> >+ </command> >+ <!-- <command >+ categoryId="org.eclipse.hyades.trace.ui.ProfileActions" >+ defaultHandler="org.eclipse.tptp.trace.ui.provisional.control.provider.RefreshOptionHandler" >+ id="org.eclipse.tptp.platform.instrumentation.ui.internal.control.provider.application.RefreshOption" >+ name="Refresh Option"> >+ </command> --> >+ <command >+ categoryId="org.eclipse.hyades.trace.ui.ProfileActions" >+ defaultHandler="org.eclipse.tptp.trace.ui.provisional.control.provider.RefreshViewHandler" >+ id="org.eclipse.tptp.trace.ui.provisional.control.provider.RefreshView" >+ name="Refresh Views"> >+ </command> >+ </extension> >+ <extension point="org.eclipse.ui.bindings"> >+ <key >+ commandId="org.eclipse.tptp.trace.ui.provisional.control.provider.PauseControlItem" >+ contextId="org.eclipse.ui.TPTPMonitorContext" >+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" >+ sequence="M1+M3+M2+P"> >+ </key> >+ <key >+ commandId="org.eclipse.tptp.trace.ui.provisional.control.provider.ResumeControlItem" >+ contextId="org.eclipse.ui.TPTPMonitorContext" >+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" >+ sequence="M1+M3+M2+S"> >+ </key> >+ <key >+ commandId="org.eclipse.tptp.trace.ui.provisional.control.provider.AttachControlItem" >+ contextId="org.eclipse.ui.TPTPMonitorContext" >+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" >+ sequence="M1+M3+M2+A"> >+ </key> >+ <key >+ commandId="org.eclipse.tptp.trace.ui.provisional.control.provider.DetachControlItem" >+ contextId="org.eclipse.ui.TPTPMonitorContext" >+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" >+ sequence="M1+M3+M2+D"> >+ </key> >+ <key >+ commandId="org.eclipse.tptp.trace.ui.provisional.control.provider.TerminateAction" >+ contextId="org.eclipse.ui.TPTPMonitorContext" >+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" >+ sequence="M1+M3+M2+T"> >+ </key> >+ <!-- <key >+ commandId="org.eclipse.tptp.platform.instrumentation.ui.internal.control.provider.application.RefreshOption" >+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" >+ sequence="M1+M3+M2+O"> >+ </key>--> >+ <key >+ commandId="org.eclipse.tptp.trace.ui.provisional.control.provider.RefreshView" >+ contextId="org.eclipse.ui.TPTPMonitorContext" >+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" >+ sequence="M1+M3+M2+R"> >+ </key> >+ </extension> > </plugin> >Index: src/org/eclipse/hyades/trace/internal/ui/PDProjectExplorer.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/hyades/trace/internal/ui/PDProjectExplorer.java,v >retrieving revision 1.27 >diff -u -r1.27 PDProjectExplorer.java >--- src/org/eclipse/hyades/trace/internal/ui/PDProjectExplorer.java 5 Jul 2007 01:35:05 -0000 1.27 >+++ src/org/eclipse/hyades/trace/internal/ui/PDProjectExplorer.java 26 Mar 2008 15:49:32 -0000 >@@ -76,6 +76,7 @@ > import org.eclipse.ui.IViewPart; > import org.eclipse.ui.IWorkbenchPart; > import org.eclipse.ui.actions.ActionContext; >+import org.eclipse.ui.contexts.IContextService; > import org.eclipse.ui.plugin.AbstractUIPlugin; > > public class PDProjectExplorer extends Navigator implements IProfileEventListener >@@ -250,6 +251,7 @@ > super(ID); > > traceControlItemManager = new TraceControlItemManager(this); >+// traceControlItemManager.setSite(getSite()); > > /* set project explorer to resource helper such that it can be notified dirty for save */ > Object ue = HierarchyResourceSetImpl.getInstance().getUnresolvedException(); >@@ -273,8 +275,16 @@ > UIPlugin.getDefault().addSelectionProvider(getViewer(), this); > UIPlugin.getDefault().addProfileEventListener(this); > >+ activateContext(); >+ > (new RefreshUI()).start(); > } >+ >+ >+ private void activateContext() { >+ IContextService contextService = (IContextService) getSite().getService(IContextService.class); >+ contextService.activateContext("org.eclipse.ui.TPTPMonitorContext"); >+ } > > /** > * Updates the action bar actions. >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/META-INF/MANIFEST.MF,v >retrieving revision 1.29 >diff -u -r1.29 MANIFEST.MF >--- META-INF/MANIFEST.MF 30 Nov 2007 02:34:06 -0000 1.29 >+++ META-INF/MANIFEST.MF 26 Mar 2008 15:49:32 -0000 >@@ -53,6 +53,7 @@ > org.eclipse.tptp.platform.common;bundle-version="[4.3.0,5.0.0)";visibility:=reexport, > org.eclipse.tptp.platform.common.ui;bundle-version="[4.3.0,5.0.0)";visibility:=reexport, > org.eclipse.tptp.platform.common.ui.trace;bundle-version="[4.3.0,5.0.0)";visibility:=reexport, >- org.eclipse.tptp.platform.execution;bundle-version="[4.3.0,5.0.0)" >+ org.eclipse.tptp.platform.execution;bundle-version="[4.3.0,5.0.0)", >+ org.eclipse.core.expressions;bundle-version="3.4.0" > Eclipse-LazyStart: true > Bundle-RequiredExecutionEnvironment: J2SE-1.4 >Index: src/org/eclipse/tptp/trace/ui/internal/control/provider/TraceControlItemManager.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/tptp/trace/ui/internal/control/provider/TraceControlItemManager.java,v >retrieving revision 1.3 >diff -u -r1.3 TraceControlItemManager.java >--- src/org/eclipse/tptp/trace/ui/internal/control/provider/TraceControlItemManager.java 26 Apr 2006 00:21:30 -0000 1.3 >+++ src/org/eclipse/tptp/trace/ui/internal/control/provider/TraceControlItemManager.java 26 Mar 2008 15:49:32 -0000 >@@ -17,16 +17,20 @@ > import org.eclipse.emf.common.util.EList; > import org.eclipse.hyades.models.hierarchy.TRCAgentProxy; > import org.eclipse.hyades.models.hierarchy.TRCProcessProxy; >+import org.eclipse.hyades.trace.internal.ui.PDProjectExplorer; > import org.eclipse.hyades.trace.internal.ui.PDProjectViewer; > import org.eclipse.hyades.trace.ui.internal.navigator.ProfileDetailItem; > import org.eclipse.hyades.ui.extension.INavigatorItem; > import org.eclipse.hyades.ui.internal.navigator.INavigator; >+import org.eclipse.jface.commands.ActionHandler; > import org.eclipse.jface.viewers.StructuredSelection; > import org.eclipse.swt.widgets.Tree; > import org.eclipse.swt.widgets.TreeItem; > import org.eclipse.tptp.trace.ui.internal.launcher.core.AgentDeclarationManager; > import org.eclipse.tptp.trace.ui.internal.launcher.core.AnalysisType; >+import org.eclipse.tptp.trace.ui.provisional.control.provider.ControlItem; > import org.eclipse.tptp.trace.ui.provisional.control.provider.IControlItem; >+import org.eclipse.ui.handlers.IHandlerService; > > > /** >@@ -47,10 +51,12 @@ > /** The tree of the profiling monitor view */ > private Tree profilingMonitorTree; > >+ > public TraceControlItemManager (INavigator navigator) > { > TraceControlItemManager.navigator = navigator; > } >+ > > private IControlItem[] getContributedItems(byte containerType) > { >@@ -86,8 +92,17 @@ > if (orderedList != null) > { > controlItems = new IControlItem[orderedList.size()]; >- for (int i = 0; i < controlItems.length; i++) >- controlItems[i] = (IControlItem)controlSubset.get(orderedList.get(i)); >+ for (int i = 0; i < controlItems.length; i++) { >+ controlItems[i] = (IControlItem)controlSubset.get(orderedList.get(i)); >+ >+ if (controlItems[i] instanceof ControlItem && >+ ((ControlItem)controlItems[i]).getCommandID()!=null && >+ ((ControlItem)controlItems[i]).getHandler()!=null ) { >+ IHandlerService handlerService = (IHandlerService) (((PDProjectExplorer)navigator).getSite().getService(IHandlerService.class)); >+// ActionHandler handler = new ActionHandler(controlItems[i]); >+ handlerService.activateHandler(((ControlItem)controlItems[i]).getCommandID(),((ControlItem)controlItems[i]).getHandler()); >+ } >+ } > } > > return controlItems; >Index: src/org/eclipse/tptp/trace/ui/provisional/control/provider/RefreshOption.java >=================================================================== >RCS file: src/org/eclipse/tptp/trace/ui/provisional/control/provider/RefreshOption.java >diff -N src/org/eclipse/tptp/trace/ui/provisional/control/provider/RefreshOption.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/trace/ui/provisional/control/provider/RefreshOption.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,45 @@ >+/********************************************************************** >+ * Copyright (c) 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 - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.tptp.trace.ui.provisional.control.provider; >+ >+import java.util.Iterator; >+ >+import org.eclipse.hyades.trace.ui.ProfileEvent; >+import org.eclipse.hyades.trace.ui.UIPlugin; >+import org.eclipse.hyades.trace.ui.internal.core.TraceUIImages; >+import org.eclipse.tptp.platform.common.ui.trace.internal.CommonUITraceConstants; >+import org.eclipse.tptp.trace.ui.internal.control.provider.application.ControlMessages; >+import org.eclipse.tptp.trace.ui.provisional.control.provider.ControlItem; >+ >+public class RefreshOption extends ControlItem { >+ >+ private static final String REFRESH_OPTION = "org.eclipse.tptp.platform.instrumentation.ui.internal.control.provider.application.RefreshOption"; >+ >+ public RefreshOption() >+ { >+ super (REFRESH_OPTION, CommonUITraceConstants.PROFILE_REFRESH_GROUP, ControlMessages.CONTROL_ITEM_REFRESH_OPTION, TraceUIImages.INSTANCE.getImageDescriptor("c", TraceUIImages.IMG_REFRESH_OPTIONS)); >+ } >+ >+ /* This method is invoked when ever user clicks the 'Change Refresh Options' button. >+ * It simply invokes the 'handleProfileEvent' method of PDProjectExplorer */ >+ public void run() >+ { >+ if (input == null) >+ return; >+ >+ for (Iterator sources = input.iterator(); sources.hasNext();) >+ { >+ ProfileEvent event = UIPlugin.getDefault().getRefreshOptionEvent(sources.next()); >+ UIPlugin.getDefault().notifyProfileEventListener(event); >+ } >+ } >+} >+ >Index: src/org/eclipse/tptp/trace/ui/provisional/control/provider/RefreshViewHandler.java >=================================================================== >RCS file: src/org/eclipse/tptp/trace/ui/provisional/control/provider/RefreshViewHandler.java >diff -N src/org/eclipse/tptp/trace/ui/provisional/control/provider/RefreshViewHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/trace/ui/provisional/control/provider/RefreshViewHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,45 @@ >+/********************************************************************** >+ * Copyright (c) 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 - Initial API and implementation >+ **********************************************************************/ >+ >+package org.eclipse.tptp.trace.ui.provisional.control.provider; >+ >+import org.eclipse.core.commands.AbstractHandler; >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.swt.widgets.Event; >+ >+ >+ >+public class RefreshViewHandler extends AbstractHandler { >+ >+ private IAction action; >+ >+ public RefreshViewHandler(IAction refreshView) { >+ super(); >+ this.action = refreshView; >+ >+ } >+ >+ public Object execute(ExecutionEvent arg0) throws ExecutionException { >+ if ((action.getStyle() == IAction.AS_CHECK_BOX) >+ || (action.getStyle() == IAction.AS_RADIO_BUTTON)) { >+ action.setChecked(!action.isChecked()); >+ } >+ try { >+ action.runWithEvent(new Event()); >+ } catch (Exception e) { >+ throw new ExecutionException("", e); //$NON-NLS-1$ >+ } >+ >+ return null; >+ } >+} >Index: src/org/eclipse/tptp/trace/ui/provisional/control/provider/PauseControlItem.java >=================================================================== >RCS file: src/org/eclipse/tptp/trace/ui/provisional/control/provider/PauseControlItem.java >diff -N src/org/eclipse/tptp/trace/ui/provisional/control/provider/PauseControlItem.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/trace/ui/provisional/control/provider/PauseControlItem.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,54 @@ >+/********************************************************************** >+ * Copyright (c) 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 - Initial API and implementation >+ **********************************************************************/ >+ >+package org.eclipse.tptp.trace.ui.provisional.control.provider; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.hyades.trace.ui.internal.core.TraceUIImages; >+import org.eclipse.tptp.platform.common.ui.trace.internal.CommonUITraceConstants; >+import org.eclipse.tptp.trace.ui.internal.control.provider.application.ControlMessages; >+import org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherUtility; >+import org.eclipse.tptp.trace.ui.provisional.control.provider.AbstractAgentControlProvider.AgentControlItem; >+ >+public class PauseControlItem extends AgentControlItem { >+ >+ private static final String PAUSE_MONITORING = "org.eclipse.tptp.trace.ui.provisional.control.provider.PauseControlItem"; >+ private static IAgentStateModifier _agentStateModifier; >+ >+ public PauseControlItem(IAgentStateModifier agentStateModifier) >+ { >+ super(agentStateModifier, PAUSE_MONITORING, CommonUITraceConstants.PROFILE_MONITOR_GROUP, ControlMessages.CONTROL_ITEM_PAUSE, TraceUIImages.INSTANCE.getImageDescriptor("c", TraceUIImages.IMG_PAUSE)); >+ setDisabledImageDescriptor(TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_PAUSE)); >+ _agentStateModifier = agentStateModifier; >+ } >+ >+ public void run() >+ { >+ IAgentStateModifier agentStateModifier = _agentStateModifier; >+ >+ try >+ { >+ /* Pause the agent */ >+ if(isEnabled()) >+ agentStateModifier.pauseMonitoring(); >+ } catch (CoreException e) >+ { >+ /* Display status */ >+ LauncherUtility.openMessageWithDetail(e.getStatus().getSeverity(), "", e.getMessage(), e); >+ } >+ } >+ >+ public boolean isEnabled() >+ { >+ return _agentStateModifier.canPause(); >+ } >+ >+} >Index: src/org/eclipse/tptp/trace/ui/provisional/control/provider/AttachControlItemHandler.java >=================================================================== >RCS file: src/org/eclipse/tptp/trace/ui/provisional/control/provider/AttachControlItemHandler.java >diff -N src/org/eclipse/tptp/trace/ui/provisional/control/provider/AttachControlItemHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/trace/ui/provisional/control/provider/AttachControlItemHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,45 @@ >+/********************************************************************** >+ * Copyright (c) 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 - Initial API and implementation >+ **********************************************************************/ >+ >+package org.eclipse.tptp.trace.ui.provisional.control.provider; >+ >+import org.eclipse.core.commands.AbstractHandler; >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.swt.widgets.Event; >+ >+ >+ >+public class AttachControlItemHandler extends AbstractHandler { >+ >+ private IAction action; >+ >+ public AttachControlItemHandler(IAction attachAction) { >+ super(); >+ this.action = attachAction; >+ >+ } >+ >+ public Object execute(ExecutionEvent arg0) throws ExecutionException { >+ if ((action.getStyle() == IAction.AS_CHECK_BOX) >+ || (action.getStyle() == IAction.AS_RADIO_BUTTON)) { >+ action.setChecked(!action.isChecked()); >+ } >+ try { >+ action.runWithEvent(new Event()); >+ } catch (Exception e) { >+ throw new ExecutionException("", e); //$NON-NLS-1$ >+ } >+ >+ return null; >+ } >+} >Index: src/org/eclipse/tptp/trace/ui/provisional/control/provider/AttachControlItem.java >=================================================================== >RCS file: src/org/eclipse/tptp/trace/ui/provisional/control/provider/AttachControlItem.java >diff -N src/org/eclipse/tptp/trace/ui/provisional/control/provider/AttachControlItem.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/trace/ui/provisional/control/provider/AttachControlItem.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,52 @@ >+/********************************************************************** >+ * Copyright (c) 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 - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.tptp.trace.ui.provisional.control.provider; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.hyades.trace.ui.internal.core.TraceUIImages; >+import org.eclipse.tptp.platform.common.ui.trace.internal.CommonUITraceConstants; >+import org.eclipse.tptp.trace.ui.internal.control.provider.application.ControlMessages; >+import org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherUtility; >+import org.eclipse.tptp.trace.ui.provisional.control.provider.AbstractAgentControlProvider.AgentControlItem; >+ >+public class AttachControlItem extends AgentControlItem { >+ >+ private static final String ATTACH_ITEM = "org.eclipse.tptp.trace.ui.provisional.control.provider.AttachControlItem"; >+ private IAgentStateModifier _agentStateModifier; >+ >+ public AttachControlItem(IAgentStateModifier agentStateModifier) >+ { >+ super(agentStateModifier, ATTACH_ITEM, CommonUITraceConstants.PROFILE_ATTACH_GROUP, ControlMessages.CONTROL_ITEM_ATTACH, TraceUIImages.INSTANCE.getImageDescriptor("c", TraceUIImages.IMG_DETACH_AGENT)); >+ setDisabledImageDescriptor(TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_ATTACH_AGENT)); >+ _agentStateModifier = agentStateModifier; >+ } >+ >+ public void run() >+ { >+ IAgentStateModifier agentStateModifier = _agentStateModifier; >+ >+ try >+ { >+ /* attach to the agent */ >+ if (isEnabled()) >+ agentStateModifier.attach(); >+ } catch (CoreException e) >+ { >+ /* Display status */ >+ LauncherUtility.openMessageWithDetail(e.getStatus().getSeverity(), "", e.getMessage(), e); >+ } >+ } >+ >+ public boolean isEnabled() >+ { >+ return _agentStateModifier.canAttach(); >+ } >+} >Index: src/org/eclipse/tptp/trace/ui/provisional/control/provider/TerminateAction.java >=================================================================== >RCS file: src/org/eclipse/tptp/trace/ui/provisional/control/provider/TerminateAction.java >diff -N src/org/eclipse/tptp/trace/ui/provisional/control/provider/TerminateAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/trace/ui/provisional/control/provider/TerminateAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,71 @@ >+/********************************************************************** >+ * Copyright (c) 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 - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.tptp.trace.ui.provisional.control.provider; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.hyades.trace.ui.internal.core.TraceUIImages; >+import org.eclipse.jface.viewers.StructuredSelection; >+import org.eclipse.tptp.platform.common.ui.trace.internal.CommonUITraceConstants; >+import org.eclipse.tptp.trace.ui.internal.control.provider.application.ControlMessages; >+import org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherUtility; >+ >+public class TerminateAction extends ControlItem { >+ >+ private IProcessStateModifier _processStateModifier; >+ private static final String TERMINATE_ITEM = "org.eclipse.tptp.trace.ui.provisional.control.provider.TerminateAction"; >+ >+ public TerminateAction(IProcessStateModifier processStateModifier) >+ { >+ super (TERMINATE_ITEM, CommonUITraceConstants.PROFILE_TERMINATE_GROUP, ControlMessages.CONTROL_ITEM_TERMINATE, TraceUIImages.INSTANCE.getImageDescriptor("c", TraceUIImages.IMG_TERMINATE)); >+ setDisabledImageDescriptor(TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_TERMINATE)); >+ _processStateModifier = processStateModifier; >+ } >+ >+ public void run() >+ { >+ >+ try >+ { >+ /* Terminate the process */ >+ if(isEnabled()) >+ _processStateModifier.terminate(); >+ } catch (CoreException e) >+ { >+ /* Display status */ >+ LauncherUtility.openMessageWithDetail(e.getStatus().getSeverity(), "", e.getMessage(), e); >+ } >+ } >+ >+ public boolean isEnabled() >+ { >+ return _processStateModifier.canTerminate(); >+ } >+ >+ public void setInput(StructuredSelection input) >+ { >+ _processStateModifier.setInput(input); >+ } >+ >+ public IProcessStateModifier getStateModifier() >+ { >+ return _processStateModifier; >+ } >+ >+ public boolean equals (Object o) >+ { >+ if (!(o instanceof TerminateAction)) >+ return false; >+ >+ return _processStateModifier == ((TerminateAction)o).getStateModifier() && super.equals(o); >+ } >+ >+ >+} >Index: src/org/eclipse/tptp/trace/ui/provisional/control/provider/DetachControlItemHandler.java >=================================================================== >RCS file: src/org/eclipse/tptp/trace/ui/provisional/control/provider/DetachControlItemHandler.java >diff -N src/org/eclipse/tptp/trace/ui/provisional/control/provider/DetachControlItemHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/trace/ui/provisional/control/provider/DetachControlItemHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,45 @@ >+/********************************************************************** >+ * Copyright (c) 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 - Initial API and implementation >+ **********************************************************************/ >+ >+package org.eclipse.tptp.trace.ui.provisional.control.provider; >+ >+import org.eclipse.core.commands.AbstractHandler; >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.swt.widgets.Event; >+ >+ >+ >+public class DetachControlItemHandler extends AbstractHandler { >+ >+ private IAction action; >+ >+ public DetachControlItemHandler(IAction detachAction) { >+ super(); >+ this.action = detachAction; >+ >+ } >+ >+ public Object execute(ExecutionEvent arg0) throws ExecutionException { >+ if ((action.getStyle() == IAction.AS_CHECK_BOX) >+ || (action.getStyle() == IAction.AS_RADIO_BUTTON)) { >+ action.setChecked(!action.isChecked()); >+ } >+ try { >+ action.runWithEvent(new Event()); >+ } catch (Exception e) { >+ throw new ExecutionException("", e); //$NON-NLS-1$ >+ } >+ >+ return null; >+ } >+} >Index: src/org/eclipse/tptp/trace/ui/provisional/control/provider/TerminateControlItemHandler.java >=================================================================== >RCS file: src/org/eclipse/tptp/trace/ui/provisional/control/provider/TerminateControlItemHandler.java >diff -N src/org/eclipse/tptp/trace/ui/provisional/control/provider/TerminateControlItemHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/trace/ui/provisional/control/provider/TerminateControlItemHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,45 @@ >+/********************************************************************** >+ * Copyright (c) 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 - Initial API and implementation >+ **********************************************************************/ >+ >+package org.eclipse.tptp.trace.ui.provisional.control.provider; >+ >+import org.eclipse.core.commands.AbstractHandler; >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.swt.widgets.Event; >+ >+ >+ >+public class TerminateControlItemHandler extends AbstractHandler { >+ >+ private IAction action; >+ >+ public TerminateControlItemHandler(IAction terminateAction) { >+ super(); >+ this.action = terminateAction; >+ >+ } >+ >+ public Object execute(ExecutionEvent arg0) throws ExecutionException { >+ if ((action.getStyle() == IAction.AS_CHECK_BOX) >+ || (action.getStyle() == IAction.AS_RADIO_BUTTON)) { >+ action.setChecked(!action.isChecked()); >+ } >+ try { >+ action.runWithEvent(new Event()); >+ } catch (Exception e) { >+ throw new ExecutionException("", e); //$NON-NLS-1$ >+ } >+ >+ return null; >+ } >+} >Index: src/org/eclipse/tptp/trace/ui/provisional/control/provider/ResumeControlItemHandler.java >=================================================================== >RCS file: src/org/eclipse/tptp/trace/ui/provisional/control/provider/ResumeControlItemHandler.java >diff -N src/org/eclipse/tptp/trace/ui/provisional/control/provider/ResumeControlItemHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/trace/ui/provisional/control/provider/ResumeControlItemHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,45 @@ >+/********************************************************************** >+ * Copyright (c) 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 - Initial API and implementation >+ **********************************************************************/ >+ >+package org.eclipse.tptp.trace.ui.provisional.control.provider; >+ >+import org.eclipse.core.commands.AbstractHandler; >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.swt.widgets.Event; >+ >+ >+ >+public class ResumeControlItemHandler extends AbstractHandler { >+ >+ private IAction action; >+ >+ public ResumeControlItemHandler(IAction resumeAction) { >+ super(); >+ this.action = resumeAction; >+ >+ } >+ >+ public Object execute(ExecutionEvent arg0) throws ExecutionException { >+ if ((action.getStyle() == IAction.AS_CHECK_BOX) >+ || (action.getStyle() == IAction.AS_RADIO_BUTTON)) { >+ action.setChecked(!action.isChecked()); >+ } >+ try { >+ action.runWithEvent(new Event()); >+ } catch (Exception e) { >+ throw new ExecutionException("", e); //$NON-NLS-1$ >+ } >+ >+ return null; >+ } >+} >Index: src/org/eclipse/tptp/trace/ui/provisional/control/provider/ResumeControlItem.java >=================================================================== >RCS file: src/org/eclipse/tptp/trace/ui/provisional/control/provider/ResumeControlItem.java >diff -N src/org/eclipse/tptp/trace/ui/provisional/control/provider/ResumeControlItem.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/trace/ui/provisional/control/provider/ResumeControlItem.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,53 @@ >+/********************************************************************** >+ * Copyright (c) 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 - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.tptp.trace.ui.provisional.control.provider; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.hyades.trace.ui.internal.core.TraceUIImages; >+import org.eclipse.tptp.platform.common.ui.trace.internal.CommonUITraceConstants; >+import org.eclipse.tptp.trace.ui.internal.control.provider.application.ControlMessages; >+import org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherUtility; >+import org.eclipse.tptp.trace.ui.provisional.control.provider.AbstractAgentControlProvider.AgentControlItem; >+ >+public class ResumeControlItem extends AgentControlItem { >+ >+ private static String START_MONITORING = "org.eclipse.tptp.trace.ui.provisional.control.provider.ResumeControlItem"; >+ private IAgentStateModifier _agentStateModifier; >+ >+ public ResumeControlItem(IAgentStateModifier agentStateModifier) >+ { >+ super(agentStateModifier, START_MONITORING, CommonUITraceConstants.PROFILE_MONITOR_GROUP, ControlMessages.CONTROL_ITEM_RESUME, TraceUIImages.INSTANCE.getImageDescriptor("c", TraceUIImages.IMG_RESUME)); >+ setDisabledImageDescriptor(TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_RESUME)); >+ _agentStateModifier = agentStateModifier; >+ } >+ >+ public void run() >+ { >+ IAgentStateModifier agentStateModifier = _agentStateModifier; >+ >+ try >+ { >+ /* Resume the agent */ >+ if(isEnabled()) >+ agentStateModifier.startMonitoring(); >+ } catch (CoreException e) >+ { >+ /* Display status */ >+ LauncherUtility.openMessageWithDetail(e.getStatus().getSeverity(), "", e.getMessage(), e); >+ } >+ } >+ >+ public boolean isEnabled() >+ { >+ return _agentStateModifier.canResume(); >+ } >+ >+} >Index: src/org/eclipse/tptp/trace/ui/provisional/control/provider/RefreshView.java >=================================================================== >RCS file: src/org/eclipse/tptp/trace/ui/provisional/control/provider/RefreshView.java >diff -N src/org/eclipse/tptp/trace/ui/provisional/control/provider/RefreshView.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/trace/ui/provisional/control/provider/RefreshView.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,41 @@ >+/********************************************************************** >+ * Copyright (c) 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 - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.tptp.trace.ui.provisional.control.provider; >+ >+import java.util.Iterator; >+ >+import org.eclipse.hyades.trace.ui.ProfileEvent; >+import org.eclipse.hyades.trace.ui.UIPlugin; >+import org.eclipse.hyades.trace.ui.internal.core.TraceUIImages; >+import org.eclipse.tptp.platform.common.ui.trace.internal.CommonUITraceConstants; >+import org.eclipse.tptp.trace.ui.internal.control.provider.application.ControlMessages; >+ >+public class RefreshView extends ControlItem { >+ >+ private static final String REFRESH_ITEM = "org.eclipse.tptp.trace.ui.provisional.control.provider.RefreshView"; >+ >+ public RefreshView() >+ { >+ super (REFRESH_ITEM, CommonUITraceConstants.PROFILE_REFRESH_GROUP, ControlMessages.CONTROL_ITEM_REFRESH_VIEWS, TraceUIImages.INSTANCE.getImageDescriptor("c", TraceUIImages.IMG_REFRESH_VIEWS)); >+ } >+ >+ public void run() >+ { >+ if (input == null) >+ return; >+ >+ for (Iterator sources = input.iterator(); sources.hasNext();) >+ { >+ ProfileEvent event = UIPlugin.getDefault().getRefreshViewEvent(sources.next()); >+ UIPlugin.getDefault().notifyProfileEventListener(event); >+ } >+ } >+} >Index: src/org/eclipse/tptp/trace/ui/provisional/control/provider/DetachControlItem.java >=================================================================== >RCS file: src/org/eclipse/tptp/trace/ui/provisional/control/provider/DetachControlItem.java >diff -N src/org/eclipse/tptp/trace/ui/provisional/control/provider/DetachControlItem.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/trace/ui/provisional/control/provider/DetachControlItem.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,53 @@ >+/********************************************************************** >+ * Copyright (c) 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 - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.tptp.trace.ui.provisional.control.provider; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.hyades.trace.ui.internal.core.TraceUIImages; >+import org.eclipse.tptp.platform.common.ui.trace.internal.CommonUITraceConstants; >+import org.eclipse.tptp.trace.ui.internal.control.provider.application.ControlMessages; >+import org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherUtility; >+import org.eclipse.tptp.trace.ui.provisional.control.provider.AbstractAgentControlProvider.AgentControlItem; >+ >+public class DetachControlItem extends AgentControlItem { >+ >+ public static final String DETACH_ITEM = "org.eclipse.tptp.trace.ui.provisional.control.provider.DetachControlItem"; >+ private IAgentStateModifier _agentStateModifier; >+ >+ public DetachControlItem(IAgentStateModifier agentStateModifier) >+ { >+ super(agentStateModifier, DETACH_ITEM, CommonUITraceConstants.PROFILE_ATTACH_GROUP, ControlMessages.CONTROL_ITEM_DETACH, TraceUIImages.INSTANCE.getImageDescriptor("c", TraceUIImages.IMG_DETACH_AGENT)); >+ setDisabledImageDescriptor(TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_DETACH_AGENT)); >+ _agentStateModifier = agentStateModifier; >+ } >+ >+ public void run() >+ { >+ IAgentStateModifier agentStateModifier = _agentStateModifier; >+ >+ try >+ { >+ /* detach the agent */ >+ agentStateModifier.detach(); >+ } catch (CoreException e) >+ { >+ /* Display status */ >+ LauncherUtility.openMessageWithDetail(e.getStatus().getSeverity(), "", e.getMessage(), e); >+ } >+ } >+ >+ public boolean isEnabled() >+ { >+ return _agentStateModifier.canDetach(); >+ } >+ >+ >+} >Index: src/org/eclipse/tptp/trace/ui/provisional/control/provider/PauseControlItemHandler.java >=================================================================== >RCS file: src/org/eclipse/tptp/trace/ui/provisional/control/provider/PauseControlItemHandler.java >diff -N src/org/eclipse/tptp/trace/ui/provisional/control/provider/PauseControlItemHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/trace/ui/provisional/control/provider/PauseControlItemHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,45 @@ >+/********************************************************************** >+ * Copyright (c) 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 - Initial API and implementation >+ **********************************************************************/ >+ >+package org.eclipse.tptp.trace.ui.provisional.control.provider; >+ >+import org.eclipse.core.commands.AbstractHandler; >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.swt.widgets.Event; >+ >+ >+ >+public class PauseControlItemHandler extends AbstractHandler { >+ >+ private IAction action; >+ >+ public PauseControlItemHandler(IAction pauseAction) { >+ super(); >+ this.action = pauseAction; >+ >+ } >+ >+ public Object execute(ExecutionEvent arg0) throws ExecutionException { >+ if ((action.getStyle() == IAction.AS_CHECK_BOX) >+ || (action.getStyle() == IAction.AS_RADIO_BUTTON)) { >+ action.setChecked(!action.isChecked()); >+ } >+ try { >+ action.runWithEvent(new Event()); >+ } catch (Exception e) { >+ throw new ExecutionException("", e); //$NON-NLS-1$ >+ } >+ >+ 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
Actions:
View
|
Diff
Attachments on
bug 140650
:
93626
|
93897
|
93999
|
94264
|
95401