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 95401 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]
Patch
140650patch1.1.txt (text/plain), 121.58 KB, created by
Ritwik Lodhiya
on 2008-04-09 14:09:46 EDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Ritwik Lodhiya
Created:
2008-04-09 14:09:46 EDT
Size:
121.58 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.hyades.trace.ui >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 9 Apr 2008 18:06:44 -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,24 +33,20 @@ > */ > 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; >+ protected IControlItem attachItem; > > /** The detach control item */ >- private IControlItem detachItem; >+ protected IControlItem detachItem; > > /** The resume control item */ >- private IControlItem resumeItem; >+ protected IControlItem resumeItem; > > /** The pause control item */ >- private IControlItem pauseItem; >+ protected 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 ControlItemHandler(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 ControlItemHandler(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 = AbstractAgentToolbarProvider.startMonitoring.getHandler(); >+ resumeItem.setHandler(handler); > return resumeItem; > } > >@@ -207,42 +114,13 @@ > 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 = AbstractAgentToolbarProvider.pauseMonitoring.getHandler(); >+ pauseItem.setHandler(handler); > return pauseItem; > } > >- >- private static class AgentControlItem extends ControlItem >+ protected static class AgentControlItem extends ControlItem > { > private IAgentStateModifier stateModifier; > >@@ -272,5 +150,4 @@ > } > > } >- > } >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 9 Apr 2008 18:06:44 -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 9 Apr 2008 18:06:44 -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: 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 9 Apr 2008 18:06:44 -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 ControlItemHandler(refresh); >+ refresh.setHandler(handler); > return refresh; > } > >@@ -143,30 +116,11 @@ > 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(); >+ handler = new ControlItemHandler(refreshOption); >+ refreshOption.setHandler(handler); > 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 9 Apr 2008 18:06:44 -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 ControlItemHandler(terminateItem); >+ terminateItem.setHandler(handler); > return terminateItem; > } > } >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 9 Apr 2008 18:06:44 -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; >@@ -24,17 +25,17 @@ > public abstract class AbstractAgentToolbarProvider extends AbstractAgentControlProvider > { > /** The id of the contributed items */ >- public static final String START_TOOLBAR_ITEM = "org.eclipse.hyades.trace.ui.internal.monitorsview.toolbar.startMonitoring"; >- public static final String PAUSE_TOOLBAR_ITEM = "org.eclipse.hyades.trace.ui.internal.monitorsview.toolbar.stopMonitoring"; >+ public static final String START_TOOLBAR_ITEM = "org.eclipse.tptp.trace.ui.provisional.control.provider.ResumeControlItem"; >+ public static final String PAUSE_TOOLBAR_ITEM = "org.eclipse.tptp.trace.ui.provisional.control.provider.PauseControlItem"; > public static final String TERMINATE_TOOLBAR_ITEM = "org.eclipse.hyades.trace.ui.internal.monitorsview.toolbar.terminate"; > public static final String REFRESH_VIEW_TOOLBAR_ITEM = "org.eclipse.hyades.trace.ui.internal.monitorsview.toolbar.refreshViews"; > public static final String REFRESH_OPTIONS = "org.eclipse.hyades.trace.ui.internal.monitorsview.toolbar.refreshOptions"; > > /** The start monitoring toolbar item */ >- private IControlItem startMonitoring; >+ protected static IControlItem startMonitoring; > > /** The pause monitoring toolbar item */ >- private IControlItem pauseMonitoring; >+ protected static IControlItem pauseMonitoring; > > /** The terminate toolbar item */ > private IControlItem terminate; >@@ -45,6 +46,9 @@ > /** The automatic refresh control item. Used */ > private IControlItem automaticRefresh; > >+ /** hander for the action items */ >+ private IHandler handler; >+ > /** > * @see AbstractControlProvider#initializeControlItems() > */ >@@ -69,7 +73,9 @@ > if (startMonitoring != null) > return startMonitoring; > >- startMonitoring = makeToolbarReady(super.createStartMonitoringControlItem(), START_TOOLBAR_ITEM, CommonUITraceConstants.PROFILE_MONITOR_GROUP, TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_RESUME)); >+ startMonitoring = makeToolbarReady(new ResumeControlItem(getAgentStateModifier()), START_TOOLBAR_ITEM, CommonUITraceConstants.PROFILE_MONITOR_GROUP, TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_RESUME)); >+ handler = new ControlItemHandler(startMonitoring); >+ startMonitoring.setHandler(handler); > return startMonitoring; > } > >@@ -84,8 +90,9 @@ > { > if (pauseMonitoring != null) > return pauseMonitoring; >- pauseMonitoring = makeToolbarReady(super.createPauseMonitoringControlItem(), PAUSE_TOOLBAR_ITEM, CommonUITraceConstants.PROFILE_MONITOR_GROUP, TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_PAUSE)); >- >+ pauseMonitoring = makeToolbarReady(new PauseControlItem(getAgentStateModifier()), PAUSE_TOOLBAR_ITEM, CommonUITraceConstants.PROFILE_MONITOR_GROUP, TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_PAUSE)); >+ handler = new ControlItemHandler(pauseMonitoring); >+ 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: 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 9 Apr 2008 18:06:44 -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/application/PIAgentToolbarProvider.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/tptp/trace/ui/internal/control/provider/application/PIAgentToolbarProvider.java,v >retrieving revision 1.2 >diff -u -r1.2 PIAgentToolbarProvider.java >--- src/org/eclipse/tptp/trace/ui/internal/control/provider/application/PIAgentToolbarProvider.java 23 Aug 2006 16:25:25 -0000 1.2 >+++ src/org/eclipse/tptp/trace/ui/internal/control/provider/application/PIAgentToolbarProvider.java 9 Apr 2008 18:06:44 -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,11 +10,11 @@ > **********************************************************************/ > package org.eclipse.tptp.trace.ui.internal.control.provider.application; > >+import org.eclipse.core.commands.IHandler; > 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.PIAgentControlProvider.GCControlItem; >-import org.eclipse.tptp.trace.ui.internal.control.provider.application.PIAgentControlProvider.HeapDumpControlItem; > import org.eclipse.tptp.trace.ui.provisional.control.provider.AbstractAgentToolbarProvider; >+import org.eclipse.tptp.trace.ui.provisional.control.provider.ControlItemHandler; > 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.StandardAgentStateModifier; >@@ -33,10 +33,12 @@ > private IAgentStateModifier agentStateModifier; > > /** The collect object reference control item */ >- private IControlItem dumpHeapControlItem; >+ protected static IControlItem dumpHeapControlItem; > > /** The garbage collection control item */ >- private IControlItem garbageCollectionControlItem; >+ protected static IControlItem garbageCollectionControlItem; >+ >+ private IHandler handler; > > > public PIAgentToolbarProvider() >@@ -63,6 +65,8 @@ > return garbageCollectionControlItem; > > garbageCollectionControlItem = makeToolbarReady(new GCControlItem(), GC_TOOLBAR_ITEM, CommonUITraceConstants.PROFILE_GC_GROUP, TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_GC)); >+ handler = new ControlItemHandler(garbageCollectionControlItem); >+ garbageCollectionControlItem.setHandler(handler); > return garbageCollectionControlItem; > } > >@@ -72,6 +76,8 @@ > return dumpHeapControlItem; > > dumpHeapControlItem = makeToolbarReady(new HeapDumpControlItem(), HEAP_DUMP_TOOLBAR_ITEM, CommonUITraceConstants.PROFILE_GC_GROUP, TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_DUMP)); >+ handler = new ControlItemHandler(dumpHeapControlItem); >+ dumpHeapControlItem.setHandler(handler); > return dumpHeapControlItem; > } > >Index: src/org/eclipse/tptp/trace/ui/internal/control/provider/application/PIAgentControlProvider.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/tptp/trace/ui/internal/control/provider/application/PIAgentControlProvider.java,v >retrieving revision 1.5 >diff -u -r1.5 PIAgentControlProvider.java >--- src/org/eclipse/tptp/trace/ui/internal/control/provider/application/PIAgentControlProvider.java 23 Aug 2006 16:25:25 -0000 1.5 >+++ src/org/eclipse/tptp/trace/ui/internal/control/provider/application/PIAgentControlProvider.java 9 Apr 2008 18:06:44 -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 >@@ -13,11 +13,9 @@ > > import java.util.Iterator; > >+import org.eclipse.core.commands.IHandler; > import org.eclipse.core.runtime.IStatus; >-import org.eclipse.hyades.trace.ui.internal.actions.CollectObjRefAction; > import org.eclipse.hyades.trace.ui.internal.actions.NewSnapshotAction; >-import org.eclipse.hyades.trace.ui.internal.actions.RunGCAction; >-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.launcher.core.LauncherUtility; > import org.eclipse.tptp.trace.ui.provisional.control.provider.AbstractAgentControlProvider; >@@ -26,7 +24,6 @@ > import org.eclipse.tptp.trace.ui.provisional.control.provider.IControlItem; > import org.eclipse.tptp.trace.ui.provisional.control.provider.StandardAgentStateModifier; > >- > /** > * The control provider for the PI agent > * @author Ali Mehregani >@@ -35,20 +32,20 @@ > { > /** The id of the contributed items */ > private static final String RESET_ITEM = "org.eclipse.hyades.trace.ui.internal.popupMenu.NewSnapshot"; >- private static final String HEAP_DUMP_ITEM = "org.eclipse.hyades.trace.ui.monitorsview.popupMenu.ObjRef"; >- private static final String GC_ITEM = "org.eclipse.hyades.trace.ui.monitorsview.popupMenu.GC"; > > /** The agent state modifier */ > private IAgentStateModifier agentStateModifier; > > /** The collect object reference control item */ >- private IControlItem dumpHeapControlItem; >+ protected static IControlItem _dumpHeapControlItem; > > /** The garbage collection control item */ >- private IControlItem garbageCollectionControlItem; >+ protected static IControlItem _garbageCollectionControlItem; > > /** The restart control item */ > private IControlItem restartControlItem; >+ >+ private IHandler handler; > > > public PIAgentControlProvider() >@@ -78,11 +75,13 @@ > */ > protected IControlItem createHeapDumpControlItem() > { >- if (dumpHeapControlItem != null) >- return dumpHeapControlItem; >+ if (_dumpHeapControlItem != null) >+ return _dumpHeapControlItem; > >- dumpHeapControlItem = new HeapDumpControlItem(); >- return dumpHeapControlItem; >+ _dumpHeapControlItem = new HeapDumpControlItem(); >+ handler = PIAgentToolbarProvider.dumpHeapControlItem.getHandler(); >+ _dumpHeapControlItem.setHandler(handler); >+ return _dumpHeapControlItem; > } > > >@@ -93,11 +92,13 @@ > */ > protected IControlItem createGCControlItem() > { >- if (garbageCollectionControlItem != null) >- return garbageCollectionControlItem; >+ if (_garbageCollectionControlItem != null) >+ return _garbageCollectionControlItem; > >- garbageCollectionControlItem = new GCControlItem(); >- return garbageCollectionControlItem; >+ _garbageCollectionControlItem = new GCControlItem(); >+ handler = PIAgentToolbarProvider.garbageCollectionControlItem.getHandler(); >+ _garbageCollectionControlItem.setHandler(handler); >+ return _garbageCollectionControlItem; > } > > >@@ -148,79 +149,4 @@ > return restartControlItem; > } > >- >- public static class HeapDumpControlItem extends ControlItem >- { >- CollectObjRefAction collectObjRef; >- public HeapDumpControlItem() >- { >- super(HEAP_DUMP_ITEM, CommonUITraceConstants.PROFILE_GC_GROUP, ControlMessages.CONTROL_ITEM_DUMP, TraceUIImages.INSTANCE.getImageDescriptor("c", TraceUIImages.IMG_DUMP)); >- setDisabledImageDescriptor(TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_DUMP)); >- collectObjRef = new CollectObjRefAction(); >- } >- >- public void run() >- { >- try >- { >- for (Iterator agents = input.iterator(); agents.hasNext();) >- collectObjRef.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 && collectObjRef.isEnabledFor(agents.next()); >- return isEnable; >- } >- >- } >- >- >- public static class GCControlItem extends ControlItem >- { >- private RunGCAction gcAction; >- public GCControlItem() >- { >- super(GC_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 RunGCAction(); >- } >- >- 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/trace/ui/internal/control/provider/application/messages.properties >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/tptp/trace/ui/internal/control/provider/application/messages.properties,v >retrieving revision 1.4 >diff -u -r1.4 messages.properties >--- src/org/eclipse/tptp/trace/ui/internal/control/provider/application/messages.properties 22 Mar 2008 18:20:20 -0000 1.4 >+++ src/org/eclipse/tptp/trace/ui/internal/control/provider/application/messages.properties 9 Apr 2008 18:06:44 -0000 >@@ -14,15 +14,15 @@ > # NLS_ENCODING=UTF-8 > > CONTROL_ITEM_TERMINATE = Terminate >-CONTROL_ITEM_REFRESH_VIEWS = Refresh &Views >-CONTROL_ITEM_REFRESH_OPTION = Change Refresh &Options >-CONTROL_ITEM_ATTACH = A&ttach to Agent >-CONTROL_ITEM_DETACH = Detach &from Agent >+CONTROL_ITEM_REFRESH_VIEWS = Refresh Views >+CONTROL_ITEM_REFRESH_OPTION = Change Refresh Options >+CONTROL_ITEM_ATTACH = Attach to Agent >+CONTROL_ITEM_DETACH = Detach from Agent > CONTROL_ITEM_RESUME = Start Monitoring > CONTROL_ITEM_PAUSE = Pause Monitoring >-CONTROL_ITEM_DUMP = &Collect Object References >-CONTROL_ITEM_GC_ACTION = &Run Garbage Collection >-CONTROL_ITEM_NEW_SNAPSHOT = Reset &Data >+CONTROL_ITEM_DUMP = Collect Object References >+CONTROL_ITEM_GC_ACTION = Run Garbage Collection >+CONTROL_ITEM_NEW_SNAPSHOT = Reset Data > > ERROR_PROCESS_TERMINATE = An error occurred while attempting to terminate process: {0} > >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 9 Apr 2008 18:06:44 -0000 >@@ -1035,6 +1035,162 @@ > > <entity type = "toolbar" > class = "org.eclipse.tptp.trace.ui.internal.control.provider.application.AgentDiscovererToolbarProvider"/> >- </control> >+ </control> > </extension> >+ >+ <!-- Defines the TPTP Profiling View as its own context --> >+ <extension >+ point="org.eclipse.ui.contexts"> >+ <context >+ id="org.eclipse.ui.TPTPMonitorContext" >+ name="%_ProfileContext"> >+ </context> >+ </extension> >+ >+ <!-- Defines the action items in the profiling view as commands --> >+ <extension >+ point="org.eclipse.ui.commands"> >+ <category >+ description="%_D1" >+ id="org.eclipse.hyades.trace.ui.ProfileActions" >+ name="%TRC_ITEMS"> >+ </category> >+ <command >+ categoryId="org.eclipse.hyades.trace.ui.ProfileActions" >+ defaultHandler="org.eclipse.tptp.trace.ui.provisional.control.provider.ControlItemHandler" >+ description="%_PauseD" >+ id="org.eclipse.tptp.trace.ui.provisional.control.provider.PauseControlItem" >+ name="%_PAUSE"> >+ </command> >+ <command >+ categoryId="org.eclipse.hyades.trace.ui.ProfileActions" >+ defaultHandler="org.eclipse.tptp.trace.ui.provisional.control.provider.ControlItemHandler" >+ description="%_RESUME" >+ id="org.eclipse.tptp.trace.ui.provisional.control.provider.ResumeControlItem" >+ name="%_RESUME"> >+ </command> >+ <command >+ categoryId="org.eclipse.hyades.trace.ui.ProfileActions" >+ defaultHandler="org.eclipse.tptp.trace.ui.provisional.control.provider.ControlItemHandler" >+ description="%_AttachD" >+ id="org.eclipse.tptp.trace.ui.provisional.control.provider.AttachControlItem" >+ name="%_ATTACH"> >+ </command> >+ <command >+ categoryId="org.eclipse.hyades.trace.ui.ProfileActions" >+ defaultHandler="org.eclipse.tptp.trace.ui.provisional.control.provider.ControlItemHandler" >+ description="%_DetachD" >+ id="org.eclipse.tptp.trace.ui.provisional.control.provider.DetachControlItem" >+ name="%_DETACH"> >+ </command> >+ <command >+ categoryId="org.eclipse.hyades.trace.ui.ProfileActions" >+ defaultHandler="org.eclipse.tptp.trace.ui.provisional.control.provider.ControlItemHandler" >+ description="%_TerminateD" >+ id="org.eclipse.tptp.trace.ui.provisional.control.provider.TerminateAction" >+ name="%_TERMINATE"> >+ </command> >+ <command >+ categoryId="org.eclipse.hyades.trace.ui.ProfileActions" >+ defaultHandler="org.eclipse.tptp.trace.ui.provisional.control.provider.ControlItemHandler" >+ description="%_RefreshOpD" >+ id="org.eclipse.tptp.platform.instrumentation.ui.internal.control.provider.application.RefreshOption" >+ name="%_RefreshOpD"> >+ </command> >+ <command >+ categoryId="org.eclipse.hyades.trace.ui.ProfileActions" >+ defaultHandler="org.eclipse.tptp.trace.ui.provisional.control.provider.ControlItemHandler" >+ description="%_REFRESH" >+ id="org.eclipse.tptp.trace.ui.provisional.control.provider.RefreshView" >+ name="%_REFRESH"> >+ </command> >+ <command >+ categoryId="org.eclipse.hyades.trace.ui.ProfileActions" >+ defaultHandler="org.eclipse.tptp.trace.ui.provisional.control.provider.ControlItemHandler" >+ description="%_RunGC_C" >+ id="org.eclipse.tptp.trace.ui.GarbageCollection" >+ name="%_RunGC_C"> >+ </command> >+ <command >+ categoryId="org.eclipse.hyades.trace.ui.ProfileActions" >+ defaultHandler="org.eclipse.tptp.trace.ui.provisional.control.provider.ControlItemHandler" >+ description="%_HeapD" >+ id="org.eclipse.tptp.trace.ui.internal.control.provider.application.HeapDumpControlItem" >+ name="%_HeapD"> >+ </command> >+ </extension> >+ >+ <!-- Creates key bindings for the associated commads above --> >+ <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+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+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+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+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+T"> >+ </key> >+ <key >+ commandId="org.eclipse.tptp.platform.instrumentation.ui.internal.control.provider.application.RefreshOption" >+ contextId="org.eclipse.ui.TPTPMonitorContext" >+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" >+ sequence="M1+M3+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+R"> >+ </key> >+ <key >+ commandId="org.eclipse.tptp.trace.ui.GarbageCollection" >+ contextId="org.eclipse.ui.TPTPMonitorContext" >+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" >+ sequence="M1+M3+M2+G"> >+ </key> >+ <key >+ commandId="org.eclipse.tptp.trace.ui.internal.control.provider.application.HeapDumpControlItem" >+ contextId="org.eclipse.ui.TPTPMonitorContext" >+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" >+ sequence="M1+M3+M2+O"> >+ </key> >+ </extension> >+ <!-- Defines an action for the PI Agent Run Garbage Control --> >+ <extension >+ point="org.eclipse.ui.actionSets"> >+ <actionSet >+ id="org.eclipse.hyades.trace.ui.RunGC" >+ label="%_RunGC" >+ visible="true"> >+ <action >+ class="org.eclipse.hyades.trace.ui.internal.actions.RunGCActionDelegate" >+ definitionId="org.eclipse.tptp.trace.ui.GarbageCollection" >+ id="org.eclipse.hyades.trace.ui.RunGCPI" >+ label="%_RunGC" >+ style="push"> >+ </action> >+ </actionSet> >+ </extension> > </plugin> >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/plugin.properties,v >retrieving revision 1.81 >diff -u -r1.81 plugin.properties >--- plugin.properties 19 May 2007 00:42:35 -0000 1.81 >+++ plugin.properties 9 Apr 2008 18:06:44 -0000 >@@ -120,4 +120,21 @@ > ANALYSIS_TYPE_METHOD_COVERAGE = Analyze the application Method Coverage. See what methods were executed. > > EDIT_PROF_OPT = Edit Profiling Options >-EDIT_AGENT_DIS_TITLE = Edit Agent Discoverer Options >\ No newline at end of file >+EDIT_AGENT_DIS_TITLE = Edit Agent Discoverer Options >+_ProfileContext = TPTP Profiling View Context >+TRC_ITEMS = Trace Action Items >+_PAUSE = Pause Monitoring >+_RESUME = Start Monitoring >+_ATTACH = Attach to Agent >+_DETACH = Detach from Agent >+_TERMINATE = Terminate Monitoring Process >+_REFRESH = Refresh Views >+_D1 = Action Items available in Profiling View >+_PauseD = Stop Monitoring without detaching from Agent >+_AttachD = Attach running process to Agent >+_DetachD = Detach process from Agent >+_TerminateD = Terminate process >+_RefreshOpD = Refresh Option >+_RunGC_C = Run Garbage Collection >+_RunGC = Run Garbage Collection (PI Agent) >+_HeapD = Heap Dump >\ No newline at end of file >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 9 Apr 2008 18:06:44 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2005, 2007 IBM Corporation and others. >+ * Copyright (c) 2005, 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 >@@ -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,19 @@ > UIPlugin.getDefault().addSelectionProvider(getViewer(), this); > UIPlugin.getDefault().addProfileEventListener(this); > >+ activateContext(); >+ > (new RefreshUI()).start(); > } >+ >+ /** >+ * Defines the context of the profiling view as "org.eclipse.ui.TPTPMonitorContext". >+ * Is used for key binding. >+ */ >+ private void activateContext() { >+ IContextService contextService = (IContextService) getSite().getService(IContextService.class); >+ contextService.activateContext("org.eclipse.ui.TPTPMonitorContext"); >+ } > > /** > * Updates the action bar actions. >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 9 Apr 2008 18:06:44 -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 >@@ -17,6 +17,7 @@ > 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; >@@ -26,7 +27,9 @@ > 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 +50,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 +91,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)); >+ >+ /* Activates the handlers for all the action items */ >+ if (controlItems[i] instanceof ControlItem && >+ ((ControlItem)controlItems[i]).getCommandID()!=null && >+ ((ControlItem)controlItems[i]).getHandler()!=null ) { >+ IHandlerService handlerService = (IHandlerService) (((PDProjectExplorer)navigator).getSite().getService(IHandlerService.class)); >+ handlerService.activateHandler(((ControlItem)controlItems[i]).getCommandID(),((ControlItem)controlItems[i]).getHandler()); >+ } >+ } > } > > return controlItems; >Index: src/org/eclipse/tptp/trace/ui/internal/control/provider/application/HeapDumpControlItem.java >=================================================================== >RCS file: src/org/eclipse/tptp/trace/ui/internal/control/provider/application/HeapDumpControlItem.java >diff -N src/org/eclipse/tptp/trace/ui/internal/control/provider/application/HeapDumpControlItem.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/trace/ui/internal/control/provider/application/HeapDumpControlItem.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,64 @@ >+/********************************************************************** >+ * 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.internal.control.provider.application; >+ >+import java.util.Iterator; >+ >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.hyades.trace.ui.internal.actions.CollectObjRefAction; >+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.launcher.core.LauncherUtility; >+import org.eclipse.tptp.trace.ui.provisional.control.provider.ControlItem; >+ >+/** >+ * The Action class that creates the Heap Dump (or Collect Object References) >+ * Item for the PI Agent. >+ * >+ */ >+public class HeapDumpControlItem extends ControlItem >+{ >+ CollectObjRefAction collectObjRef; >+ private static final String HEAP_DUMP_ITEM = "org.eclipse.tptp.trace.ui.internal.control.provider.application.HeapDumpControlItem"; >+ >+ public HeapDumpControlItem() >+ { >+ super(HEAP_DUMP_ITEM, CommonUITraceConstants.PROFILE_GC_GROUP, ControlMessages.CONTROL_ITEM_DUMP, TraceUIImages.INSTANCE.getImageDescriptor("c", TraceUIImages.IMG_DUMP)); >+ setDisabledImageDescriptor(TraceUIImages.INSTANCE.getImageDescriptor("d", TraceUIImages.IMG_DUMP)); >+ collectObjRef = new CollectObjRefAction(); >+ } >+ >+ public void run() >+ { >+ try >+ { >+ for (Iterator agents = input.iterator(); agents.hasNext();) >+ collectObjRef.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 && collectObjRef.isEnabledFor(agents.next()); >+ return isEnable; >+ } >+ >+} >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,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 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; >+ >+/** >+ * An Action class that is referenced when the user requests to view or >+ * modify Refresh Options. This class opens a new window and provides the >+ * user with the ability to modify refresh options and set refresh defaults >+ * for the profiling session. >+ * >+ */ >+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/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,59 @@ >+/********************************************************************** >+ * 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; >+ >+/** >+ * An Action class that is referenced when a Pause Control Item needs >+ * to be created. Pause Control Item stops monitoring a running process >+ * without detaching it from the agent in the profiling view. >+ */ >+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/ControlItemHandler.java >=================================================================== >RCS file: src/org/eclipse/tptp/trace/ui/provisional/control/provider/ControlItemHandler.java >diff -N src/org/eclipse/tptp/trace/ui/provisional/control/provider/ControlItemHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/trace/ui/provisional/control/provider/ControlItemHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,50 @@ >+/********************************************************************** >+ * 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; >+ >+/** >+ * A Handler class that is referenced when a Handler needs to be set for >+ * any Action item of type IControl Item. >+ * >+ * This creates handlers for the >+ * actions in the current profiling view, and it is recommended that new >+ * handler classes be created if some of the handler properties or the >+ * method's functions need to be changed. >+ */ >+public class ControlItemHandler extends AbstractHandler { >+ >+ private IAction action; >+ >+ public ControlItemHandler(IAction actionItem) { >+ super(); >+ this.action = actionItem; >+ >+ } >+ >+ 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,58 @@ >+/********************************************************************** >+ * 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; >+ >+/** >+ * An Action class that is referenced when an Start Control Item needs >+ * to be created. Start Control Item starts or resumes monitoring of a >+ * running process that is attached to the agent in the profiling view. >+ */ >+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,46 @@ >+/********************************************************************** >+ * 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; >+ >+/** >+ * An Action class that is referenced when an Refresh View Item needs >+ * to be created. Refresh View regenerates open profiling views with >+ * updated data displayed. >+ */ >+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/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,57 @@ >+/********************************************************************** >+ * 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; >+ >+/** >+ * An Action class that is referenced when an Attach Control Item needs >+ * to be created. Attach Control Item attaches a running process to the >+ * agent in the profiling view. >+ */ >+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/internal/control/provider/application/GCControlItem.java >=================================================================== >RCS file: src/org/eclipse/tptp/trace/ui/internal/control/provider/application/GCControlItem.java >diff -N src/org/eclipse/tptp/trace/ui/internal/control/provider/application/GCControlItem.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/trace/ui/internal/control/provider/application/GCControlItem.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,63 @@ >+/********************************************************************** >+ * 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.internal.control.provider.application; >+ >+import java.util.Iterator; >+ >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.hyades.trace.ui.internal.actions.RunGCAction; >+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.launcher.core.LauncherUtility; >+import org.eclipse.tptp.trace.ui.provisional.control.provider.ControlItem; >+ >+/** >+ * The Action class that creates the Run garbage Collection Item for the PI >+ * Agent. >+ * >+ */ >+public class GCControlItem extends ControlItem { >+ >+ private RunGCAction gcAction; >+ public static final String GC_ITEM = "org.eclipse.tptp.trace.ui.GarbageCollection"; >+ >+ public GCControlItem() >+ { >+ super(GC_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 RunGCAction(); >+ } >+ >+ 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/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,59 @@ >+/********************************************************************** >+ * 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; >+ >+/** >+ * An Action class that is referenced when an Detach Control Item needs >+ * to be created. Detach Control Item detaches a running process from the >+ * agent in the profiling view. >+ */ >+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 */ >+ if (isEnabled()) >+ 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/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,76 @@ >+/********************************************************************** >+ * 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; >+ >+/** >+ * An Action class that is referenced when an Terminate Control Item needs >+ * to be created. Terminate Control Item stops monitoring and detaches a >+ * running process from the agent in the profiling view. >+ */ >+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); >+ } >+ >+ >+} >#P org.eclipse.tptp.platform.instrumentation.ui >Index: src/org/eclipse/tptp/platform/instrumentation/ui/internal/control/provider/application/AgentControlProvider.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.instrumentation.ui/src/org/eclipse/tptp/platform/instrumentation/ui/internal/control/provider/application/AgentControlProvider.java,v >retrieving revision 1.1 >diff -u -r1.1 AgentControlProvider.java >--- src/org/eclipse/tptp/platform/instrumentation/ui/internal/control/provider/application/AgentControlProvider.java 26 Apr 2007 14:59:24 -0000 1.1 >+++ src/org/eclipse/tptp/platform/instrumentation/ui/internal/control/provider/application/AgentControlProvider.java 9 Apr 2008 18:06:44 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2007 IBM Corporation and others. >+ * Copyright (c) 2007, 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,26 +11,21 @@ > ***********************************************************************/ > package org.eclipse.tptp.platform.instrumentation.ui.internal.control.provider.application; > >-import java.util.Iterator; >- >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.hyades.trace.ui.ProfileEvent; >-import org.eclipse.hyades.trace.ui.UIPlugin; >+import org.eclipse.core.commands.IHandler; > import org.eclipse.hyades.trace.ui.internal.actions.DeleteAction; > import org.eclipse.hyades.trace.ui.internal.actions.SaveAction; >-import org.eclipse.hyades.trace.ui.internal.core.TraceUIImages; > import org.eclipse.hyades.ui.extension.INavigatorContribution; >-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.TraceControlItemManager; >-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.AbstractControlProvider; >-import org.eclipse.tptp.trace.ui.provisional.control.provider.ControlItem; >+import org.eclipse.tptp.trace.ui.provisional.control.provider.ControlItemHandler; > 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.PauseControlItem; >+import org.eclipse.tptp.trace.ui.provisional.control.provider.RefreshOption; >+import org.eclipse.tptp.trace.ui.provisional.control.provider.RefreshView; >+import org.eclipse.tptp.trace.ui.provisional.control.provider.ResumeControlItem; >+import org.eclipse.tptp.trace.ui.provisional.control.provider.TerminateAction; > import org.eclipse.tptp.trace.ui.provisional.control.provider.ProcessControlProvider.ProcessStateModifier; > > /** >@@ -40,14 +35,6 @@ > */ > public class AgentControlProvider extends AbstractControlProvider { > >- /* The id of the contributed items */ >- private static final String REFRESH_ITEM = "org.eclipse.tptp.platform.instrumentation.ui.internal.control.provider.refreshViews"; >- private static final String REFRESH_OPTION = "org.eclipse.tptp.platform.instrumentation.ui.internal.control.provider.refreshOption"; >- private static final String TERMINATE_ITEM = "org.eclipse.tptp.platform.instrumentation.ui.internal.control.provider.terminateAction"; >- public static final String START_MONITORING = "org.eclipse.tptp.platform.instrumentation.ui.internal.control.provider.startMonitoring"; >- public static final String PAUSE_MONITORING = "org.eclipse.tptp.platform.instrumentation.ui.internal.control.provider.stopMonitoring"; >- >- > /* The delete item */ > private IControlItem delete; > >@@ -74,7 +61,9 @@ > > /* The agent state modifier */ > private IAgentStateModifier agentStateModifier; >- >+ >+ /* The handler for the actions */ >+ private IHandler handler; > /** > * Default constructor. > */ >@@ -136,27 +125,10 @@ > protected IControlItem createRefreshViewsControlItem() { > 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 ControlItemHandler(refresh); >+ refresh.setHandler(handler); > return refresh; > } > >@@ -168,29 +140,10 @@ > 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); >- } >- } >- } >+ > refreshOption = new RefreshOption(); >+ handler = new ControlItemHandler(refreshOption); >+ refreshOption.setHandler(handler); > return refreshOption; > } > >@@ -199,75 +152,19 @@ > 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 ControlItemHandler(resumeItem); >+ resumeItem.setHandler(handler); > return resumeItem; > } > > protected IControlItem createPauseMonitoringControlItem() { > 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(); >- } >- } >+ return pauseItem; > >- >- pauseItem = new PauseControlItem(); >+ pauseItem = new PauseControlItem(getAgentStateModifier()); >+ handler = new ControlItemHandler(pauseItem); >+ pauseItem.setHandler(handler); > return pauseItem; > } > >@@ -281,88 +178,12 @@ > 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 ControlItemHandler(terminateItem); >+ terminateItem.setHandler(handler); > return terminateItem; > } >- >- private static class AgentControlItem extends ControlItem { >- private IAgentStateModifier stateModifier; >- >- public AgentControlItem (IAgentStateModifier stateModifier, String itemId, String groupName, String text, ImageDescriptor imageDescriptor) >- { >- super(itemId, groupName, text, imageDescriptor); >- this.stateModifier = stateModifier; >- } >- >- public void setInput(StructuredSelection input) >- { >- stateModifier.setInput(input); >- } >- >- >- public IAgentStateModifier getStateModifier() >- { >- return stateModifier; >- } >- >- public boolean equals (Object o) >- { >- if (!(o instanceof AgentControlItem)) >- return false; >- >- return stateModifier == ((AgentControlItem)o).getStateModifier() && super.equals(o); >- } >- >- } >+ > > } >#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 9 Apr 2008 18:06:45 -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; >@@ -21,31 +22,25 @@ > import org.eclipse.hyades.models.hierarchy.TRCAgentProxy; > import org.eclipse.hyades.models.hierarchy.TRCNode; > import org.eclipse.hyades.trace.ui.ProfileEvent; >-import org.eclipse.hyades.trace.ui.internal.core.TraceUIImages; > import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.viewers.StructuredSelection; > import org.eclipse.osgi.util.NLS; >-import org.eclipse.tptp.platform.common.ui.trace.internal.CommonUITraceConstants; > import org.eclipse.tptp.platform.execution.client.agent.ICollector; > import org.eclipse.tptp.platform.execution.client.core.IAgentController; > import org.eclipse.tptp.platform.execution.exceptions.InactiveAgentException; > import org.eclipse.tptp.platform.jvmti.client.internal.TIMessages; > import org.eclipse.tptp.platform.jvmti.client.internal.TIPlugin; > import org.eclipse.tptp.platform.jvmti.client.internal.TIUtility; >-import org.eclipse.tptp.platform.jvmti.client.internal.actions.RunGCActionDelegate; > import org.eclipse.tptp.platform.jvmti.client.internal.controlproviders.TIProcessControlProvider.TIProcessStateModifier; > import org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper; > import org.eclipse.tptp.platform.jvmti.client.internal.launcher.util.AgentControllerDelegate; >-import org.eclipse.tptp.trace.ui.internal.control.provider.application.ControlMessages; > import org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherMessages; > import org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherUtility; > import org.eclipse.tptp.trace.ui.provisional.control.provider.AbstractAgentControlProvider; >-import org.eclipse.tptp.trace.ui.provisional.control.provider.ControlItem; > 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; > >- > /** > * This is the TI agent control provider. Its purpose is to modify the states that the TI agent > * can be in (e.g. Pause/Resume/Detach/Attach). >@@ -54,12 +49,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; >+ protected static IControlItem runGCControlItem; >+ private IHandler handler; > > > protected void initializeControlItems() { >@@ -80,45 +72,10 @@ > return runGCControlItem; > > runGCControlItem = new RunGCControlItem(); >+ handler = TIAgentToolbarControlProvider.garbageCollectionControlItem.getHandler(); >+ 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() > { >@@ -131,252 +88,250 @@ > return TIProcessStateModifier.getInstance(); > } > >- >- /** >- * The actual state modifier for the TI agent. This is a singleton class >- * that should be accessed via the <code>getInstance</code> method. All public >- * methods of this class are synchornized. >- * >- * @author Ali Mehregani >- */ >- public static class TIAgentStateModifier implements IAgentStateModifier >- { >- /** Used for the enable action operations */ >- private static final byte CAN_ATTACH = 0x01; >- private static final byte CAN_DETACH = 0x02; >- private static final byte CAN_RESUME = 0x03; >- private static final byte CAN_PAUSE = 0x04; >- >- /** Used for each action */ >- private static final byte ATTACH = 0x05; >- private static final byte DETACH = 0x06; >- private static final byte RESUME = 0x07; >- private static final byte PAUSE = 0x08; >- >- /** The instance of this singleton class */ >- private static TIAgentStateModifier agentStateModifier = new TIAgentStateModifier(); >- >- /** The input of this state modifier */ >- private StructuredSelection input; >- >- /** The iterator representing the input */ >- private Iterator inputIterator; >- >- /** >- * Limit the visibility of the constructor >- */ >- private TIAgentStateModifier() >- { >- } >- >- >- /** >- * Return the only instance of this class >- * >- * @return The instance of this singleton class >- */ >- public static TIAgentStateModifier getInstance() >- { >- return agentStateModifier; >- } >- >- >- >- private TRCAgentProxy getNextAgent() >- { >- if (inputIterator == null) >- return null; >- >- Object object; >- while (inputIterator.hasNext()) >- { >- object = inputIterator.next(); >- if (object instanceof TRCAgentProxy) >- return (TRCAgentProxy)object; >- } >- >- return null; >- } >- >- >- public synchronized boolean canAttach() >- { >- return performCollectiveAction(CAN_ATTACH); >- } >- >- public synchronized boolean canDetach() >- { >- return performCollectiveAction(CAN_DETACH); >- } >- >- public synchronized boolean canPause() >- { >- return performCollectiveAction(CAN_PAUSE); >- } >- >- public synchronized boolean canResume() >- { >- return performCollectiveAction(CAN_RESUME); >- } >- >- public synchronized void attach() throws CoreException >- { >- performCollectiveAction(ATTACH); >- } >- >- public synchronized void detach() throws CoreException >- { >- performCollectiveAction(DETACH); >- } >- >- public synchronized void pauseMonitoring() throws CoreException >- { >- performCollectiveAction(PAUSE); >- } >- >- public synchronized void startMonitoring() throws CoreException >- { >- performCollectiveAction(RESUME); >- } >- >- public synchronized void setInput(StructuredSelection input) >- { >- this.input = input; >- } >- >- private boolean performCollectiveAction(byte operation) >- { >- inputIterator = (input == null ? null : input.iterator()); >- boolean status = true; >- TRCAgentProxy currentAgentProxy; >- boolean agentSelected = false; >- >- while ((currentAgentProxy = getNextAgent()) != null) >- { >- agentSelected = true; >- status = status && currentAgentProxy.isActive(); >- switch(operation) >- { >- case CAN_ATTACH: >- status = status && !currentAgentProxy.isAttached() && !currentAgentProxy.isMonitored(); >- break; >- case CAN_DETACH: >- status = status && currentAgentProxy.isAttached(); >- break; >- case CAN_RESUME: >- status = status && currentAgentProxy.isAttached() && !currentAgentProxy.isMonitored(); >- break; >- case CAN_PAUSE: >- status = status && currentAgentProxy.isAttached() && currentAgentProxy.isMonitored(); >- break; >- >- default: >- doAction(currentAgentProxy, operation); >- break; >- } >- } >- >- return status && agentSelected; >- } >- >- >- private void doAction(TRCAgentProxy agentProxy, byte operation) >- { >- agentProxy.setMonitored(operation == RESUME); >- agentProxy.setAttached(!(operation == DETACH)); >- agentProxy.setActive(true); >- >- /* Get the TI execution agent that corresponds to the agent proxy */ >- TRCNode trcNode = agentProxy.getProcessProxy().getNode(); >- IAgentController agentController = null; >- try >- { >- agentController = AgentControllerDelegate.getInstance().getConnection(trcNode.getName(), trcNode.getPort()); >- } >- catch (Exception e) >- { >- LauncherUtility.openErrorWithDetail(LauncherMessages.LAUNCHER_COMMON_ERROR_TITLE, NLS.bind(TIMessages.ERROR_TI_AC_UNAVAILABLE, String.valueOf(trcNode.getPort())), e); >- } >- ICollector tiAgent = null; >- if (agentController != null) >- tiAgent = TIDelegateHelper.locateTIAgent(agentController, agentProxy.getProcessProxy().getPid()); >- >- /* If in case the agent was not found, then terminate it and show a message */ >- if (tiAgent == null) >- { >- TIUtility.terminateAgentProxy(agentProxy, true); >- >- MessageDialog.openWarning( >- TIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(), >- LauncherMessages.LAUNCHER_COMMON_WARNING_TITLE, >- TIMessages.ERROR_TI_AGENT_INACTIVE); >- } >- /* Otherwise perform the requested operation */ >- else >- { >- switch(operation) >- { >- case ATTACH: >- if (tiAgent != null) >- { >- final ICollector ctiAgent = tiAgent; >- final TRCAgentProxy cagentProxy = agentProxy; >- final IAgentController cagentController = agentController; >- /* We need to terminate the current agent proxy and create a new one for the attach */ >- TIUtility.terminateAgentProxy(agentProxy, false); >- new Job(TIMessages.TASK_CONNECTING_TO_AGENT) { >- protected IStatus run(IProgressMonitor monitor) { >- TIDelegateHelper.getInstance().attachToAgent( >- cagentController, cagentProxy, >- ctiAgent.getProcess(), >- new NullProgressMonitor()); >- TIDelegateHelper.getInstance().startPolling( >- ctiAgent); >- return Status.OK_STATUS; >- } >- }.schedule(); >- } >- >- break; >- case DETACH: >- TIUtility.closeFileStream(agentProxy); >- LauncherUtility.sendProfileEvent(ProfileEvent.DETACH, agentProxy); >- if (tiAgent != null) >- { >- tiAgent.stop(); >- tiAgent.cancel(); >- try >- { >- //Wait for a little time before stop monitoring. Some data may still be flushed >- Thread.sleep(500); >- tiAgent.stopMonitoring(); >- } >- catch (InactiveAgentException e) >- { >- } >- catch(Exception e) >- { >- } >- } >- >- break; >- case RESUME: >- LauncherUtility.sendProfileEvent(ProfileEvent.START_MONITOR, agentProxy); >- if (tiAgent != null) >- tiAgent.resume(); >- break; >- case PAUSE: >- LauncherUtility.sendProfileEvent(ProfileEvent.STOP_MONITOR, agentProxy); >- if (tiAgent != null) >- tiAgent.pause(); >- break; >- >- default: >- break; >- } >- >- } >- >- } >- } >+ >+ /** >+ * The actual state modifier for the TI agent. This is a singleton class >+ * that should be accessed via the <code>getInstance</code> method. All public >+ * methods of this class are synchornized. >+ * >+ * @author Ali Mehregani >+ */ >+ public static class TIAgentStateModifier implements IAgentStateModifier >+ { >+ /** Used for the enable action operations */ >+ private static final byte CAN_ATTACH = 0x01; >+ private static final byte CAN_DETACH = 0x02; >+ private static final byte CAN_RESUME = 0x03; >+ private static final byte CAN_PAUSE = 0x04; >+ >+ /** Used for each action */ >+ private static final byte ATTACH = 0x05; >+ private static final byte DETACH = 0x06; >+ private static final byte RESUME = 0x07; >+ private static final byte PAUSE = 0x08; >+ >+ /** The instance of this singleton class */ >+ private static TIAgentStateModifier agentStateModifier = new TIAgentStateModifier(); >+ >+ /** The input of this state modifier */ >+ private StructuredSelection input; >+ >+ /** The iterator representing the input */ >+ private Iterator inputIterator; >+ >+ /** >+ * Limit the visibility of the constructor >+ */ >+ private TIAgentStateModifier() >+ { >+ } >+ >+ >+ /** >+ * Return the only instance of this class >+ * >+ * @return The instance of this singleton class >+ */ >+ public static TIAgentStateModifier getInstance() >+ { >+ return agentStateModifier; >+ } >+ >+ >+ >+ private TRCAgentProxy getNextAgent() >+ { >+ if (inputIterator == null) >+ return null; >+ >+ Object object; >+ while (inputIterator.hasNext()) >+ { >+ object = inputIterator.next(); >+ if (object instanceof TRCAgentProxy) >+ return (TRCAgentProxy)object; >+ } >+ >+ return null; >+ } >+ >+ >+ public synchronized boolean canAttach() >+ { >+ return performCollectiveAction(CAN_ATTACH); >+ } >+ >+ public synchronized boolean canDetach() >+ { >+ return performCollectiveAction(CAN_DETACH); >+ } >+ >+ public synchronized boolean canPause() >+ { >+ return performCollectiveAction(CAN_PAUSE); >+ } >+ >+ public synchronized boolean canResume() >+ { >+ return performCollectiveAction(CAN_RESUME); >+ } >+ >+ public synchronized void attach() throws CoreException >+ { >+ performCollectiveAction(ATTACH); >+ } >+ >+ public synchronized void detach() throws CoreException >+ { >+ performCollectiveAction(DETACH); >+ } >+ >+ public synchronized void pauseMonitoring() throws CoreException >+ { >+ performCollectiveAction(PAUSE); >+ } >+ >+ public synchronized void startMonitoring() throws CoreException >+ { >+ performCollectiveAction(RESUME); >+ } >+ >+ public synchronized void setInput(StructuredSelection input) >+ { >+ this.input = input; >+ } >+ >+ private boolean performCollectiveAction(byte operation) >+ { >+ inputIterator = (input == null ? null : input.iterator()); >+ boolean status = true; >+ TRCAgentProxy currentAgentProxy; >+ boolean agentSelected = false; >+ >+ while ((currentAgentProxy = getNextAgent()) != null) >+ { >+ agentSelected = true; >+ status = status && currentAgentProxy.isActive(); >+ switch(operation) >+ { >+ case CAN_ATTACH: >+ status = status && !currentAgentProxy.isAttached() && !currentAgentProxy.isMonitored(); >+ break; >+ case CAN_DETACH: >+ status = status && currentAgentProxy.isAttached(); >+ break; >+ case CAN_RESUME: >+ status = status && currentAgentProxy.isAttached() && !currentAgentProxy.isMonitored(); >+ break; >+ case CAN_PAUSE: >+ status = status && currentAgentProxy.isAttached() && currentAgentProxy.isMonitored(); >+ break; >+ >+ default: >+ doAction(currentAgentProxy, operation); >+ break; >+ } >+ } >+ >+ return status && agentSelected; >+ } >+ >+ >+ private void doAction(TRCAgentProxy agentProxy, byte operation) >+ { >+ agentProxy.setMonitored(operation == RESUME); >+ agentProxy.setAttached(!(operation == DETACH)); >+ agentProxy.setActive(true); >+ >+ /* Get the TI execution agent that corresponds to the agent proxy */ >+ TRCNode trcNode = agentProxy.getProcessProxy().getNode(); >+ IAgentController agentController = null; >+ try >+ { >+ agentController = AgentControllerDelegate.getInstance().getConnection(trcNode.getName(), trcNode.getPort()); >+ } >+ catch (Exception e) >+ { >+ LauncherUtility.openErrorWithDetail(LauncherMessages.LAUNCHER_COMMON_ERROR_TITLE, NLS.bind(TIMessages.ERROR_TI_AC_UNAVAILABLE, String.valueOf(trcNode.getPort())), e); >+ } >+ ICollector tiAgent = null; >+ if (agentController != null) >+ tiAgent = TIDelegateHelper.locateTIAgent(agentController, agentProxy.getProcessProxy().getPid()); >+ >+ /* If in case the agent was not found, then terminate it and show a message */ >+ if (tiAgent == null) >+ { >+ TIUtility.terminateAgentProxy(agentProxy, true); >+ >+ MessageDialog.openWarning( >+ TIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(), >+ LauncherMessages.LAUNCHER_COMMON_WARNING_TITLE, >+ TIMessages.ERROR_TI_AGENT_INACTIVE); >+ } >+ /* Otherwise perform the requested operation */ >+ else >+ { >+ switch(operation) >+ { >+ case ATTACH: >+ if (tiAgent != null) >+ { >+ final ICollector ctiAgent = tiAgent; >+ final TRCAgentProxy cagentProxy = agentProxy; >+ final IAgentController cagentController = agentController; >+ /* We need to terminate the current agent proxy and create a new one for the attach */ >+ TIUtility.terminateAgentProxy(agentProxy, false); >+ new Job(TIMessages.TASK_CONNECTING_TO_AGENT) { >+ protected IStatus run(IProgressMonitor monitor) { >+ TIDelegateHelper.getInstance().attachToAgent( >+ cagentController, cagentProxy, >+ ctiAgent.getProcess(), >+ new NullProgressMonitor()); >+ TIDelegateHelper.getInstance().startPolling( >+ ctiAgent); >+ return Status.OK_STATUS; >+ } >+ }.schedule(); >+ } >+ >+ break; >+ case DETACH: >+ TIUtility.closeFileStream(agentProxy); >+ LauncherUtility.sendProfileEvent(ProfileEvent.DETACH, agentProxy); >+ if (tiAgent != null) >+ { >+ tiAgent.stop(); >+ tiAgent.cancel(); >+ try >+ { >+ //Wait for a little time before stop monitoring. Some data may still be flushed >+ Thread.sleep(500); >+ tiAgent.stopMonitoring(); >+ } >+ catch (InactiveAgentException e) >+ { >+ } >+ catch(Exception e) >+ { >+ } >+ } >+ >+ break; >+ case RESUME: >+ LauncherUtility.sendProfileEvent(ProfileEvent.START_MONITOR, agentProxy); >+ if (tiAgent != null) >+ tiAgent.resume(); >+ break; >+ case PAUSE: >+ LauncherUtility.sendProfileEvent(ProfileEvent.STOP_MONITOR, agentProxy); >+ if (tiAgent != null) >+ tiAgent.pause(); >+ break; >+ >+ default: >+ break; >+ } >+ } >+ } >+ } > } >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 9 Apr 2008 18:06:45 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2006,2007 IBM Corporation, Intel Corporation. >+ * Copyright (c) 2006, 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 >@@ -10,12 +10,13 @@ > **********************************************************************/ > package org.eclipse.tptp.platform.jvmti.client.internal.controlproviders; > >+import org.eclipse.core.commands.IHandler; > 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.ControlItemHandler; > 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; >@@ -30,8 +31,9 @@ > { > public static final String GC_TOOLBAR_ITEM = "org.eclipse.tptp.trace.jvmti.client.internal.monitorsview.toolbar.runGC"; > >- private IControlItem garbageCollectionControlItem; >+ protected static IControlItem garbageCollectionControlItem; > >+ private IHandler handler; > > public IProcessStateModifier getProcessStateModifier() > { >@@ -56,6 +58,8 @@ > GC_TOOLBAR_ITEM, CommonUITraceConstants.PROFILE_GC_GROUP, > TraceUIImages.INSTANCE.getImageDescriptor("d", > TraceUIImages.IMG_GC)); >+ handler = new ControlItemHandler(garbageCollectionControlItem); >+ garbageCollectionControlItem.setHandler(handler); > return garbageCollectionControlItem; > } > } >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.client/plugin.properties,v >retrieving revision 1.10 >diff -u -r1.10 plugin.properties >--- plugin.properties 19 Apr 2007 18:10:57 -0000 1.10 >+++ plugin.properties 9 Apr 2008 18:06:44 -0000 >@@ -32,4 +32,6 @@ > JVMTI_ANALYSIS_TYPE_THRD_DESC = Analyze the execution of your application threads > > JVMTI_ANALYSIS_TYPE_PROBE_NAME = Probe Insertion >-JVMTI_ANALYSIS_TYPE_PROBE_DESC = Insert user-defined or imported probes into your class at runtime >\ No newline at end of file >+JVMTI_ANALYSIS_TYPE_PROBE_DESC = Insert user-defined or imported probes into your class at runtime >+ >+_RunGC = Run Garbage Collection (TI Agent) >\ No newline at end of file >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 9 Apr 2008 18:06:45 -0000 >@@ -311,4 +311,20 @@ > </entity> > </control> > </extension> >+ <!-- Defines an action for the TI Agent Run Garbage Control --> >+ <extension >+ point="org.eclipse.ui.actionSets"> >+ <actionSet >+ id="org.eclipse.tptp.platform.jvmti.client.RunGC" >+ label="%_RunGC" >+ visible="true"> >+ <action >+ class="org.eclipse.tptp.platform.jvmti.client.internal.actions.RunGCActionDelegate" >+ definitionId="org.eclipse.tptp.trace.ui.GarbageCollection" >+ id="org.eclipse.hyades.trace.ui.RunGCTI" >+ label="%_RunGC" >+ style="push"> >+ </action> >+ </actionSet> >+ </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,65 @@ >+/********************************************************************** >+ * 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; >+ >+/** >+ * The Action class that creates the Run garbage Collection Item for the TI >+ * Agent. >+ * >+ */ >+public class RunGCControlItem extends ControlItem { >+ >+ private static String RUNGC_ITEM = "org.eclipse.tptp.trace.ui.GarbageCollection"; >+ >+ 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; >+ } >+}
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