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 64202 Details for
Bug 141540
Use JVMTI instead of JVMPI to get event notification
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 for HEAD April 17, 2007
141540_UI_2patch.txt (text/plain), 76.01 KB, created by
Liz Dancy
on 2007-04-18 11:32:01 EDT
(
hide
)
Description:
Patch for HEAD April 17, 2007
Filename:
MIME Type:
Creator:
Liz Dancy
Created:
2007-04-18 11:32:01 EDT
Size:
76.01 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.tptp.platform.jvmti.client >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.client/plugin.properties,v >retrieving revision 1.8 >diff -u -r1.8 plugin.properties >--- plugin.properties 8 Mar 2007 17:48:59 -0000 1.8 >+++ plugin.properties 18 Apr 2007 15:32:33 -0000 >@@ -31,3 +31,5 @@ > JVMTI_ANALYSIS_TYPE_THRD_NAME = Thread Analysis > 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 >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.client/plugin.xml,v >retrieving revision 1.6 >diff -u -r1.6 plugin.xml >--- plugin.xml 27 Feb 2007 23:17:06 -0000 1.6 >+++ plugin.xml 18 Apr 2007 15:32:33 -0000 >@@ -14,6 +14,7 @@ > <applicableType id = "org.eclipse.tptp.analysisType.jvmti.execution"/> > <applicableType id="org.eclipse.tptp.analysisType.jvmti.heap"/> > <applicableType id="org.eclipse.tptp.analysisType.jvmti.thread"/> >+ <applicableType id="org.eclipse.tptp.analysisType.jvmti.probe"/> > </analysis> > > <!-- This data collector can't co-exist with the jvmpi data collector --> >@@ -42,6 +43,9 @@ > <coexistanceViolation> > <rule analysisTypeId="org.eclipse.tptp.analysisType.jvmti.thread"/> > </coexistanceViolation> >+ <coexistanceViolation> >+ <rule analysisTypeId="org.eclipse.tptp.analysisType.jvmti.probeInsertion"/> >+ </coexistanceViolation> > </analysisType> > <analysisType > configurationId="org.eclipse.tptp.trace.jvmti.heapConfiguration" >@@ -55,6 +59,9 @@ > <coexistanceViolation> > <rule analysisTypeId="org.eclipse.tptp.analysisType.jvmti.execution"/> > </coexistanceViolation> >+ <coexistanceViolation> >+ <rule analysisTypeId="org.eclipse.tptp.analysisType.jvmti.probeInsertion"/> >+ </coexistanceViolation> > </analysisType> > <analysisType > configurationId="org.eclipse.tptp.trace.jvmti.threadConfiguration" >@@ -68,6 +75,28 @@ > <coexistanceViolation> > <rule analysisTypeId="org.eclipse.tptp.analysisType.jvmti.execution"/> > </coexistanceViolation> >+ <coexistanceViolation> >+ <rule analysisTypeId="org.eclipse.tptp.analysisType.jvmti.probeInsertion"/> >+ </coexistanceViolation> >+ </analysisType> >+ <!-- The analysis type for Probe Insertion in JVMTI --> >+ <!-- added for enhancement 141450--> >+ <analysisType >+ configurationId="org.eclipse.tptp.trace.jvmti.probeInsertion" >+ validator ="org.eclipse.tptp.platform.jvmti.client.internal.analysistypes.TIProbekitLaunchValidator" >+ description="%JVMTI_ANALYSIS_TYPE_PROBE_DESC" >+ icon="icons/full/obj16/probekitinst.gif" >+ id="org.eclipse.tptp.analysisType.jvmti.probe" >+ name="%JVMTI_ANALYSIS_TYPE_PROBE_NAME"> >+ <coexistanceViolation> >+ <rule analysisTypeId="org.eclipse.tptp.analysisType.jvmti.heap"/> >+ </coexistanceViolation> >+ <coexistanceViolation> >+ <rule analysisTypeId="org.eclipse.tptp.analysisType.jvmti.thread"/> >+ </coexistanceViolation> >+ <coexistanceViolation> >+ <rule analysisTypeId="org.eclipse.tptp.analysisType.jvmti.execution"/> >+ </coexistanceViolation> > </analysisType> > </extension> > >@@ -97,10 +126,18 @@ > class = "org.eclipse.tptp.platform.jvmti.client.internal.analysistypes.TITimeAnalysisConfig" > dialogTitle = "%JVMTI_DATA_COLLECTOR_CONF_TITILE"> > </configuration> >+ <!--Commented out to disable the Edit Options page until the remainder of the code is committed --> >+ <!--Liz Dancy--> >+ <configuration >+ id = "org.eclipse.tptp.trace.jvmti.probeInsertion" >+ class = "org.eclipse.tptp.platform.jvmti.client.internal.analysistypes.TIProbeInsertionAnalysisConfig" >+ dialogTitle = "%JVMTI_DATA_COLLECTOR_CONF_TITILE"> >+ </configuration> > <configuration > class="org.eclipse.tptp.platform.jvmti.client.internal.analysistypes.TIHeapAnalysisConfig" > dialogTitle="%JVMTI_DATA_COLLECTOR_CONF_TITILE" > id="org.eclipse.tptp.trace.jvmti.heapConfiguration"/> >+ > </extension> > > <!-- Declare the agent for the JVMTI agent --> >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.client/META-INF/MANIFEST.MF,v >retrieving revision 1.7 >diff -u -r1.7 MANIFEST.MF >--- META-INF/MANIFEST.MF 23 Mar 2007 20:39:11 -0000 1.7 >+++ META-INF/MANIFEST.MF 18 Apr 2007 15:32:33 -0000 >@@ -14,7 +14,9 @@ > org.eclipse.tptp.platform.models;bundle-version="[4.2.0,5.0.0)", > org.eclipse.ui.console, > org.eclipse.debug.ui, >- org.eclipse.jface.text >+ org.eclipse.jface.text, >+ org.eclipse.tptp.platform.probekit.launch, >+ org.eclipse.hyades.probekit > Eclipse-LazyStart: true > Bundle-Vendor: %providerName > Bundle-RequiredExecutionEnvironment: J2SE-1.4 >Index: src/org/eclipse/tptp/platform/jvmti/client/internal/analysistypes/TIProbeInsertionAnalysisConfig.java >=================================================================== >RCS file: src/org/eclipse/tptp/platform/jvmti/client/internal/analysistypes/TIProbeInsertionAnalysisConfig.java >diff -N src/org/eclipse/tptp/platform/jvmti/client/internal/analysistypes/TIProbeInsertionAnalysisConfig.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/platform/jvmti/client/internal/analysistypes/TIProbeInsertionAnalysisConfig.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,62 @@ >+/********************************************************************** >+ * Copyright (c) 2007 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 >+ * @author ldancy >+ **********************************************************************/ >+ >+package org.eclipse.tptp.platform.jvmti.client.internal.analysistypes; >+ >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.tptp.platform.jvmti.client.internal.analysistypes.TIProbeInsertionConfPage.ProbeInsertionConfigurationPage; >+import org.eclipse.tptp.trace.ui.internal.launcher.application.AbstractConfiguration; >+public class TIProbeInsertionAnalysisConfig extends AbstractConfiguration >+{ >+ >+ public TIProbeInsertionAnalysisConfig() >+ { >+ super(new Class[] { TIProbeInsertionAnalysisOpt.class }); >+ } >+ >+ public static class TIProbeInsertionAnalysisOpt extends ProbeInsertionConfigurationPage >+ { >+ private TIProbeInsertionAnalysisUI probeUI ; >+ private ILaunchConfiguration launchConfiguration; >+ >+ >+ public TIProbeInsertionAnalysisOpt() >+ { >+ probeUI = new TIProbeInsertionAnalysisUI(); >+ } >+ public void reset(ILaunchConfiguration launchConfiguration) >+ { >+ this.launchConfiguration = launchConfiguration; >+ >+ } >+ >+ public void createControl(Composite parent) >+ { >+ try{ >+ probeUI.createControl(parent); >+ >+ } >+ catch(Exception e) >+ { >+ //TODO:Handle Exception >+ } >+ } >+ >+ >+ >+ } >+ >+} >+ >+ >Index: src/org/eclipse/tptp/platform/jvmti/client/internal/analysistypes/TIProbeInsertionAnalysisUI.java >=================================================================== >RCS file: src/org/eclipse/tptp/platform/jvmti/client/internal/analysistypes/TIProbeInsertionAnalysisUI.java >diff -N src/org/eclipse/tptp/platform/jvmti/client/internal/analysistypes/TIProbeInsertionAnalysisUI.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/platform/jvmti/client/internal/analysistypes/TIProbeInsertionAnalysisUI.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,164 @@ >+/********************************************************************** >+ * Copyright (c) 2007 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 >+ * @author ldancy >+ **********************************************************************/ >+ >+ >+package org.eclipse.tptp.platform.jvmti.client.internal.analysistypes; >+ >+import java.util.ArrayList; >+import java.util.List; >+import java.util.Vector; >+ >+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >+import org.eclipse.hyades.trace.ui.internal.util.FilterSetElement; >+import org.eclipse.hyades.trace.ui.internal.util.FilterTableElement; >+import org.eclipse.hyades.trace.ui.launcher.ProfilingAttribute; >+import org.eclipse.hyades.trace.ui.launcher.ProfilingSetsManagerCopy; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.TableItem; >+import org.eclipse.tptp.platform.probekit.launch.internal.ProbekitLaunchUI; >+import org.eclipse.tptp.platform.probekit.registry.ProbeRegistryEntry; >+import org.eclipse.tptp.platform.probekit.util.ProbeLaunchConfigString; >+import org.eclipse.tptp.trace.ui.provisional.launcher.DataCollectionEngineAttribute; >+ >+ public class TIProbeInsertionAnalysisUI >+ { >+ private static ProbekitLaunchUI probeUI = new ProbekitLaunchUI(); >+ >+ >+ public Composite createControl (Composite parent) >+ { >+ return probeUI.CreateControl(parent, null, false); >+ } >+ >+ /** >+ * Returns the launch configuration attrributes associated with this >+ * Probe or set of probes >+ * @return >+ */ >+ public Vector getAttributes() >+ { >+ Vector attributes = new Vector(); >+ int iCheckedCount = 0; >+ if (probeUI.getProbeSets()!=null &&! probeUI.getProbeSets().isDisposed()){ >+ int iNumProbeSets = probeUI.getProbeSets().getItemCount(); >+ if (iNumProbeSets > 0) { >+ TableItem[] items = probeUI.getProbeSets().getItems(); >+ for (int i = 0; i < iNumProbeSets; i++) { >+ ProbeRegistryEntry entry = (ProbeRegistryEntry) items[i] >+ .getData(); >+ if (entry != null) { >+ String strValueID = entry.getId(); >+ >+ ProbeLaunchConfigString probe = new ProbeLaunchConfigString(); >+ probe.addProbeID(strValueID); >+ if (items[i].getChecked()) { >+ // ProbeLaunchConfigString probe = new >+ // ProbeLaunchConfigString(); >+ // probe.addProbeID(strValueID); >+ // >+ // /RATLC00379812 - Probekit launch UI needs to be >+ // updated to support 2-tier filtering. >+ // /if (!entry.hasTargets()) >+ // /{ >+ boolean bMatchingSetFound = false; >+ FilterSetElement set = probeUI.getManager() >+ .getDefaultFilterSet(); >+ >+ // build filter string >+ ArrayList attrs = null; >+ StringBuffer filterStr = new StringBuffer(); >+ if (set != null) { >+ attrs = set.getChildren(); >+ for (int idx = 0; idx < attrs.size(); idx++) { >+ FilterTableElement elem = (FilterTableElement) attrs >+ .get(idx); >+ filterStr.append(elem.getText()); >+ if (elem.getMethod().length() > 0) >+ filterStr >+ .append(":").append(elem.getMethod()); //$NON-NLS-1$ >+ filterStr >+ .append(":").append(elem.getVisibility()); //$NON-NLS-1$ >+ filterStr.append("&"); //$NON-NLS-1$ >+ } >+ } >+ >+ if (bMatchingSetFound) { >+ probe.addFilters(filterStr.toString()); >+ } else { >+ // Filter set was deleted or renamed or set to null >+ // to use profiling filters >+ probe.useDefaultFilters(); >+ } >+ // /} >+ >+ String strName = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX >+ + probeUI.PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX >+ + iCheckedCount; >+ String strValueProbeLaunch = probe.toString(); >+ >+ DataCollectionEngineAttribute attributeProbe = new DataCollectionEngineAttribute( >+ strName, strValueProbeLaunch); >+ >+ attributes.add(attributeProbe); >+ >+ iCheckedCount++; >+ >+ >+ } >+ } >+ >+ >+ } >+ }} >+ >+ return attributes; >+ >+ >+ } >+ >+ public boolean storeAttributes (ILaunchConfigurationWorkingCopy configurationWC){ >+ boolean probesSelected = false; >+ int iSelectedProbes = 0; >+ int iAvailableProbes = probeUI.getProbeSets().getItemCount(); >+ List namesOfSelected = null ; >+ if (iAvailableProbes > 0) { >+ TableItem[] items = probeUI.getProbeSets().getItems(); >+ for (int i = 0; i < iAvailableProbes; i++) { >+ if (items[i].getChecked()) { >+ //namesOfSelected.add(items[i].getText()); >+ iSelectedProbes++; >+ } >+ } >+ } >+ if (iAvailableProbes == 0 || iSelectedProbes == 0) { >+ // create a new attribute to keep track of whether any probes have >+ //been selected for insertion or not >+ configurationWC.setAttribute("anyProbesSelected",false); >+ >+ } else { >+ // this will be retrieved by validateConfiguration >+ // if there are no probes selected the Profile button will be disabled >+ // and an approprite error message will be displayed >+ configurationWC.setAttribute("anyProbesSelected", true); >+ configurationWC.setAttribute("saved", true); >+ configurationWC.setAttribute("selectedItems",namesOfSelected ); >+ probesSelected = true; >+ } >+ probeUI.saveSelections(); >+ return probesSelected; >+ } >+ >+ >+ >+ } >+ >+ >Index: src/org/eclipse/tptp/platform/jvmti/client/internal/analysistypes/TIProbekitLaunchValidator.java >=================================================================== >RCS file: src/org/eclipse/tptp/platform/jvmti/client/internal/analysistypes/TIProbekitLaunchValidator.java >diff -N src/org/eclipse/tptp/platform/jvmti/client/internal/analysistypes/TIProbekitLaunchValidator.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/platform/jvmti/client/internal/analysistypes/TIProbekitLaunchValidator.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,42 @@ >+/********************************************************************** >+ * Copyright (c) 2007 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 >+ * @author ldancy >+ **********************************************************************/ >+package org.eclipse.tptp.platform.jvmti.client.internal.analysistypes; >+ >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.hyades.trace.ui.UIPlugin; >+import org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherMessages; >+import org.eclipse.tptp.trace.ui.provisional.launcher.ILaunchValidator; >+ >+public class TIProbekitLaunchValidator implements ILaunchValidator { >+ >+ public IStatus validateConfiguration(ILaunchConfiguration configuration){ >+ Status noProbesSelected = null; >+ try{ >+ boolean probesSelected = configuration.getAttribute("anyProbesSelected", false); >+ if (!probesSelected) >+ { >+ // then we want to display an error message indicating that no probes have been selected for insertion >+ // and we want the Profile button to be disabled >+ noProbesSelected = new Status(Status.ERROR, UIPlugin.getPluginId(),LauncherMessages.ERROR_NO_PROBES_SELECTED); >+ } >+ } >+ catch(Exception e){ >+ >+ } >+ return noProbesSelected; >+ } >+ public IStatus launchNotification(ILaunchConfiguration config){ >+ return null; >+ } >+} >Index: src/org/eclipse/tptp/platform/jvmti/client/internal/analysistypes/TIProbeInsertionConfPage.java >=================================================================== >RCS file: src/org/eclipse/tptp/platform/jvmti/client/internal/analysistypes/TIProbeInsertionConfPage.java >diff -N src/org/eclipse/tptp/platform/jvmti/client/internal/analysistypes/TIProbeInsertionConfPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/platform/jvmti/client/internal/analysistypes/TIProbeInsertionConfPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,114 @@ >+/********************************************************************** >+ * Copyright (c) 2007 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 >+ * @author ldancy >+ **********************************************************************/ >+ >+package org.eclipse.tptp.platform.jvmti.client.internal.analysistypes; >+ >+import java.util.Vector; >+ >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >+import org.eclipse.hyades.trace.ui.internal.core.TraceUIImages; >+import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.tptp.platform.jvmti.client.internal.TIPlugin; >+import org.eclipse.tptp.trace.ui.internal.launcher.application.AbstractConfiguration; >+import org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherMessages; >+import org.eclipse.tptp.trace.ui.provisional.launcher.IStatusListener; >+ >+public class TIProbeInsertionConfPage extends AbstractConfiguration >+{ >+ /** >+ * Constructor - Add the execution time configuration page >+ */ >+ public TIProbeInsertionConfPage() >+ { >+ super(new Class[] {ProbeInsertionConfigurationPage.class}); >+ } >+ >+ >+ /** >+ * The probe insertion configuration page. >+ * >+ * @author Liz Dancy >+ */ >+ public static class ProbeInsertionConfigurationPage extends ExtendedConfigurationPage >+ { >+ private ILaunchConfiguration launchConfiguration; >+ public TIProbeInsertionAnalysisUI pr; >+ public ProbeInsertionConfigurationPage() >+ { >+ pr = new TIProbeInsertionAnalysisUI(); >+ } >+ >+ public ImageDescriptor getWizardBanner() >+ { >+ return TraceUIImages.INSTANCE.getImageDescriptor(TraceUIImages.IMG_PROF_SET_WIZ_BAN); >+ } >+ >+ public void addErrorListener(final IStatusListener statusListener) >+ { >+ >+ } >+ /* >+ * Returns the title of the page >+ * @see org.eclipse.tptp.trace.ui.provisional.launcher.IConfigurationPage#getTitle() >+ */ >+ public String getTitle() >+ { >+ String title = TIPlugin >+ .getResourceString("JVMTI_ANALYSIS_TYPE_PROBE_NAME"); >+ return title; >+ } >+ public void reset(ILaunchConfiguration launchConfiguration) >+ { >+ this.launchConfiguration = launchConfiguration; >+ >+ } >+ /** >+ * Returns the name of this configuration page >+ */ >+ public String getPageName() >+ { >+ return this.getClass().getName(); >+ } >+ /** >+ * Return the description associated with this configuration page. >+ * This may eventually move out to the ProbekitLaunchUI >+ * getDescription(). >+ */ >+ public String getDescription() >+ { >+ // to keep the same LAF as the JVMPI probe analysis description >+ return LauncherMessages.CONFIGURATION_PROFILING_TYPE_DESC; >+ } >+ >+ public boolean storeAttributes(ILaunchConfigurationWorkingCopy configurationWC) >+ { >+ >+ return pr.storeAttributes(configurationWC); >+ >+ } >+ /** >+ * Calls the JVMTI-specific getAttributes()method >+ */ >+ public Vector getAttributes() >+ { >+ return pr.getAttributes(); >+ } >+ >+ public void createControl(Composite parent) >+ { >+ pr.createControl(parent); >+ } >+ >+ } >+} >#P org.eclipse.tptp.platform.probekit.launch >Index: src/org/eclipse/tptp/platform/probekit/launch/internal/ProbekitLaunchImages.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.probekit.launch/src/org/eclipse/tptp/platform/probekit/launch/internal/ProbekitLaunchImages.java,v >retrieving revision 1.2 >diff -u -r1.2 ProbekitLaunchImages.java >--- src/org/eclipse/tptp/platform/probekit/launch/internal/ProbekitLaunchImages.java 10 Feb 2006 17:39:28 -0000 1.2 >+++ src/org/eclipse/tptp/platform/probekit/launch/internal/ProbekitLaunchImages.java 18 Apr 2007 15:32:34 -0000 >@@ -13,6 +13,7 @@ > > import org.eclipse.hyades.ui.internal.util.ImageManager; > >+ > /** > * Image manager for the Probekit Launch plugin. > */ >Index: src/org/eclipse/tptp/platform/probekit/launch/internal/config/ProbekitProfilingType.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.probekit.launch/src/org/eclipse/tptp/platform/probekit/launch/internal/config/ProbekitProfilingType.java,v >retrieving revision 1.14 >diff -u -r1.14 ProbekitProfilingType.java >--- src/org/eclipse/tptp/platform/probekit/launch/internal/config/ProbekitProfilingType.java 20 Mar 2007 13:54:27 -0000 1.14 >+++ src/org/eclipse/tptp/platform/probekit/launch/internal/config/ProbekitProfilingType.java 18 Apr 2007 15:32:34 -0000 >@@ -78,6 +78,7 @@ > import org.eclipse.tptp.platform.probekit.builder.ProbeNature; > import org.eclipse.tptp.platform.probekit.launch.internal.ProbekitLaunchImages; > import org.eclipse.tptp.platform.probekit.launch.internal.ProbekitLaunchPlugin; >+import org.eclipse.tptp.platform.probekit.launch.internal.ProbekitLaunchUI; > import org.eclipse.tptp.platform.probekit.registry.ProbeRegistry; > import org.eclipse.tptp.platform.probekit.registry.ProbeRegistryEntry; > import org.eclipse.tptp.platform.probekit.util.InvalidProbeBundleException; >@@ -88,54 +89,36 @@ > > /** > * @author gweidner >- * >+ * @modified by ldancy > * See also org.eclipse.hyades.trace.ui.internal.core.TraceProfileOverviewUI. > */ >-public class ProbekitProfilingType implements IExtendedProfilingType, >- SelectionListener { >+public class ProbekitProfilingType implements IExtendedProfilingType { >+ >+ /** >+ * Class variables necessary for keeping the IProfilingType >+ * interfcaes happy as well as for those IProfilingType >+ * methods we which to keep separate from the >+ * JVMTI implementation. The remainder of the old class variables have >+ * been moved to org.eclipse.tptp.platform.probekit.launch.ProbekitLaunchUI >+ * Liz Dancy; Enhancement 141540 >+ */ >+ > private Composite _form; > >- private Table _tblProbeSets; >- >- private Button _refreshData; >- >- private ProbePropertiesUI _propertiesUI; >- >- private Text _lblTitle; >- >- private TabFolder _folder; >- >- private ProfilingSetsManagerCopy _managerCopy; >- >- private ProbeRegistry _registry; >+ private ProbePropertiesUI _propertiesUI; > > private IDialogSettings _settings; > >- private String _description; >- >- private String _warning; >- >- protected HashMap _mapProbeFilters; >- >- protected Map _filterSetsCopy; >- >- private final static int PROBE_NAME_INDEX = 0; >- >- private final static int PROBE_PREFILTERED_INDEX = 1; >- >- private final static int PROBE_IMPORTED_INDEX = 2; >- >- private final static int PROBE_ID_INDEX = 3; >- >- public final static String PROBE_LAUNCH_SELECTION_ATTRIBUTE_STRING = "org.eclipse.tptp.platform.probekit.launch.internal.PROBEUI"; //$NON-NLS-1$ >- >- public final static String PROBE_LAUNCH_SETOPTION_ATTRIBUTE_PREFIX = "SETOPTION_"; //$NON-NLS-1$ >- >- public final static String PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX = "PROBEUI"; //$NON-NLS-1$ >- >+ private ProbekitLaunchUI probeUI; >+ >+ >+ >+ >+ > /* Navid Mehregani; Enhancement: 143251 */ > /* @see org.eclipse.hyades.trace.ui.internal.launcher.IExtendedProfilingType */ >- public String getVMArguments(ILaunchConfiguration conf) { >+ public String getVMArguments(ILaunchConfiguration conf) >+ { > > /* Will hold the final VM argument */ > String vmArgument = ""; >@@ -170,7 +153,7 @@ > String strProbeSpec = (String) activeProbes.get(key); > ProbeLaunchConfigString probeConfigDeploy = ProbeLaunchConfigString.fromString(strProbeSpec); > String strProbeID = probeConfigDeploy.getRegistryId(); >- ProbeRegistryEntry registryEntry = (ProbeRegistryEntry) _registry.lookupById(strProbeID); >+ ProbeRegistryEntry registryEntry = (ProbeRegistryEntry) probeUI.getRegistry().lookupById(strProbeID); > IResource probeSource = null; > > /* Extract the probe source file */ >@@ -386,10 +369,11 @@ > /** > * > */ >- public ProbekitProfilingType() { >+ public ProbekitProfilingType() >+ { > super(); >- >- _registry = ProbeRegistry.getRegistry(); >+ >+ //_registry = ProbeRegistry.getRegistry(); > > AbstractUIPlugin plugin = (AbstractUIPlugin) ProbekitLaunchPlugin > .getDefault(); >@@ -400,13 +384,8 @@ > section = workbenchSettings.addNewSection("ProbeLaunchDialog");//$NON-NLS-1$ > } > _settings = section; >- >- _description = ""; //$NON-NLS-1$ >- >- _mapProbeFilters = new HashMap(); >- _filterSetsCopy = new HashMap(); >- >- _warning = new String(ProbekitLaunchMessages._18); //$NON-NLS-1$ >+ >+ probeUI = new ProbekitLaunchUI(); > } > > /* >@@ -415,147 +394,9 @@ > * @see org.eclipse.hyades.trace.ui.launcher.IProfilingType#createControl(org.eclipse.swt.widgets.Composite, > * org.eclipse.hyades.trace.ui.launcher.ProfilingSetsManagerCopy) > */ >- public Control createControl(Composite parent, >- ProfilingSetsManagerCopy config) { >- _form = new Composite(parent, SWT.NULL); >- PlatformUI.getWorkbench().getHelpSystem().setHelp(_form, >- ProbekitLaunchPlugin.getPluginId() + "pb_launch1"); >- >- GridData data = GridUtil.createFill(); >- _form.setLayoutData(data); >- >- GridLayout layout = new GridLayout(); >- layout.numColumns = 2; >- _form.setLayout(layout); >- >- _lblTitle = new Text(_form, SWT.LEFT /* | SWT.BORDER */| SWT.READ_ONLY); >- GridData gd = new GridData(GridData.FILL_HORIZONTAL); >- gd.grabExcessHorizontalSpace = true; >- gd.horizontalSpan = 2; >- _lblTitle.setLayoutData(gd); >- >- Composite childTop = new Composite(_form, SWT.NONE); >- data = GridUtil.createVerticalFill(); >- data.widthHint = 200; >- childTop.setLayoutData(data); >- >- layout = new GridLayout(); >- layout.numColumns = 1; >- childTop.setLayout(layout); >- >- // _lblTitle.setFont(JFaceResources.getBannerFont()); >- Font font = _lblTitle.getFont(); >- if (font != null) { >- FontData[] fonts = font.getFontData(); >- if (fonts != null && fonts.length >= 1) { >- // Maintain consistency with built-in Hyades profiling type UIs >- // while still inheriting system font >- _lblTitle.setFont(new Font(Display.getDefault(), fonts[0] >- .getName(), fonts[0].getHeight() + 3, SWT.BOLD)); >- } >- } >- _lblTitle.setText(ProbekitLaunchMessages._25); //$NON-NLS-1$ >- >- _tblProbeSets = new Table(childTop, SWT.CHECK | SWT.SINGLE >- | SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); >- data = GridUtil.createFill(); >- _tblProbeSets.setLayoutData(data); >- >- _refreshData = new Button(childTop, SWT.PUSH); >- _refreshData.setText(ProbekitLaunchMessages._1); >- _refreshData.addSelectionListener(this); >- >- // new Label(childTop, SWT.NULL); >- >- TableLayout layoutTable = new TableLayout(); >- layoutTable.addColumnData(new ColumnPixelData(170, true)); >- _tblProbeSets.setLayout(layoutTable); >- _tblProbeSets.setHeaderVisible(true); >- >- // begin adding columns >- TableColumn tc1 = new TableColumn(_tblProbeSets, SWT.LEFT); >- tc1.setText(ProbekitLaunchMessages._21); //$NON-NLS-1$ >- // end adding columns >- >- this.populateTableFromRegistry(); >- >- _tblProbeSets.addListener(SWT.Selection, new Listener() { >- public void handleEvent(Event event) { >- if (event.item instanceof TableItem) { >- ProbeRegistryEntry entry = (ProbeRegistryEntry) event.item >- .getData(); >- if (entry != null) { >- _propertiesUI.updateWidgetValues(entry); >- // commented out for bugzilla_145401 >- // _filtersUI.updateWidgetValues(entry); >- >- int index = _tblProbeSets >- .indexOf((TableItem) event.item); >- _tblProbeSets.setSelection(index); >- } >- } >- } >- }); >- >- Composite childBottom = new Composite(_form, SWT.NONE); >- data = GridUtil.createFill(); >- >- childBottom.setLayoutData(data); >- >- layout = new GridLayout(); >- layout.numColumns = 1; >- layout.marginHeight = 0; >- childBottom.setLayout(layout); >- >- // _folder = new CTabFolder(childBottom, SWT.BORDER); >- _folder = new TabFolder(childBottom, SWT.TOP); >- data = GridUtil.createFill(); >- // bugzilla_145401 required the uncommenting of this code >- data.heightHint = 320; >- data.grabExcessHorizontalSpace = true; >- _folder.setLayoutData(data); >- >- TabItem item = new TabItem(_folder, SWT.NONE); >- item.setText(ProbekitLaunchMessages._20); //$NON-NLS-1$ >- _propertiesUI = new ProbePropertiesUI(); >- item.setControl(_propertiesUI.createControl(_folder)); >- if (_tblProbeSets.getItemCount() == 0) { >- // Display text pointing user to import >- _propertiesUI.showHint(true); >- } >- >- item.setImage(ProbekitLaunchImages.INSTANCE >- .getImage(ProbekitLaunchImages.IMG_PROP)); >- >- _folder.setSelection(0); >- >- // commented out for bugzilla_145401 >- // TabItem item2 = new TabItem(_folder, SWT.NONE); >- // item2.setText(ProbekitLaunchMessages._19); //$NON-NLS-1$ >- // _filtersUI = new ProbeFiltersUI(); >- // item2.setControl(_propertiesUI.createControl(_folder)); >- // item2.setImage(ProbekitLaunchImages.INSTANCE.getImage(ProbekitLaunchImages.IMG_FILTER)); >- >- if (config != null) { >- _managerCopy = config; >- } else { >- _managerCopy = new ProfilingSetsManagerCopy(); >- } >- >- initializeValues(config); >- >- int sel = _tblProbeSets.getSelectionIndex(); >- if (sel != -1) { >- ProbeRegistryEntry entry = (ProbeRegistryEntry) _tblProbeSets >- .getItem(sel).getData(); >- if (entry != null) { >- _propertiesUI.updateWidgetValues(entry); >- } >- } >- >- _tblProbeSets.setFocus(); >- >- return _form; >+ public Control createControl(Composite parent, ProfilingSetsManagerCopy config) >+ { >+ return probeUI.CreateControl(parent, config, true); > } > > /* >@@ -564,6 +405,7 @@ > * @see org.eclipse.hyades.trace.ui.launcher.IProfilingType#getControl(java.lang.String) > */ > public Control getControl(String profilingSetName) { >+ Table _tblProbeSets = probeUI.getProbeSets(); > if (_tblProbeSets.getItemCount() > 0) { > int indexSelection = _tblProbeSets.getSelectionIndex(); > if (indexSelection < 0) { >@@ -585,6 +427,7 @@ > } > > protected void restoreSelections() { >+ Table _tblProbeSets = probeUI.getProbeSets(); > String strSelection = ""; //$NON-NLS-1$ > String strTab = ""; //$NON-NLS-1$ > >@@ -628,51 +471,18 @@ > // else defaults to "Properties" in createControl() > } > >- protected void saveSelections() { >- int indexSelection = _tblProbeSets.getSelectionIndex(); >- >- if (indexSelection >= 0) { >- TableItem tableItem = _tblProbeSets.getItem(indexSelection); >- if (tableItem != null) { >- ProbeRegistryEntry entry = (ProbeRegistryEntry) tableItem >- .getData(); >- if (entry != null) { >- String strID = entry.getId(); >- if (_settings != null) { >- // Store table selection >- _settings.put("ProbeTableSelection", strID); //$NON-NLS-1$ >- } >- } >- } >- } else { >- if (_settings != null) { >- _settings.put("ProbeTableSelection", ""); //$NON-NLS-1$ //$NON-NLS-2$ >- } >- } >- >- // CTabItem item = _folder.getSelection(); >- TabItem[] item = _folder.getSelection(); >- if (item[0] != null) { >- String strName = item[0].getText(); >- if (_settings != null) { >- // Store folder selection >- _settings.put("ProbeFolderSelection", strName); //$NON-NLS-1$ >- } >- } else { >- _settings.put("ProbeFolderSelection", ""); //$NON-NLS-1$ //$NON-NLS-2$ >- } >- } >+ > > protected void initializeValues(ProfilingSetsManagerCopy config) { >- int iNumProbeSets = _tblProbeSets.getItemCount(); >- TableItem[] items = _tblProbeSets.getItems(); >+ int iNumProbeSets = probeUI.getProbeSets().getItemCount(); >+ TableItem[] items = probeUI.getProbeSets().getItems(); > > Map configAttributes = config.getDefaultSet().getAttributes(); > // ProfilingAttribute attribute = (ProfilingAttribute) > // configAttributes.get("com.ibm.rational.pd.probekit.PROBEKIT_COUNT"); > int index = 0; > String strName = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX >- + PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX + index; >+ + probeUI.PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX + index; > ProfilingAttribute attribute = (ProfilingAttribute) configAttributes > .get(strName); > // if (attribute != null) >@@ -708,7 +518,7 @@ > index++; > > strName = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX >- + PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX + index; >+ + probeUI.PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX + index; > attribute = (ProfilingAttribute) configAttributes.get(strName); > // } > } >@@ -721,7 +531,7 @@ > */ > protected Map getActiveProbes(ILaunchConfiguration launchConfig) { > String strProbeDeployPrefix = ProbeLaunchConfigString.AGENT_CONFIG_NAME_PREFIX >- + PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX; >+ + probeUI.PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX; > Map map = getOptions(launchConfig, strProbeDeployPrefix); > return map; > } >@@ -766,10 +576,10 @@ > public ProfilingAttribute[] getAttributes() { > List config = new ArrayList(); > int iCheckedCount = 0; >- >- int iNumProbeSets = _tblProbeSets.getItemCount(); >+ >+ int iNumProbeSets = probeUI.getProbeSets().getItemCount(); > if (iNumProbeSets > 0) { >- TableItem[] items = _tblProbeSets.getItems(); >+ TableItem[] items = probeUI.getProbeSets().getItems(); > for (int i = 0; i < iNumProbeSets; i++) { > ProbeRegistryEntry entry = (ProbeRegistryEntry) items[i] > .getData(); >@@ -788,7 +598,7 @@ > // /if (!entry.hasTargets()) > // /{ > boolean bMatchingSetFound = false; >- FilterSetElement set = _managerCopy >+ FilterSetElement set = probeUI.getManager() > .getDefaultFilterSet(); > > // build filter string >@@ -819,7 +629,7 @@ > // /} > > String strName = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX >- + PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX >+ + probeUI.PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX > + iCheckedCount; > String strValueProbeLaunch = probe.toString(); > >@@ -841,7 +651,7 @@ > ProfilingAttribute[] pOptions = new ProfilingAttribute[config.size()]; > config.toArray(pOptions); > >- saveSelections(); >+ probeUI.saveSelections(); > > return pOptions; > } >@@ -851,25 +661,9 @@ > * > * @see org.eclipse.hyades.trace.ui.launcher.IProfilingType#validateConfiguration(org.eclipse.hyades.trace.ui.launcher.ProfilingSetsManagerCopy) > */ >- public String validateConfiguration(ProfilingSetsManagerCopy managerCopy) { >- // RATLC00379729 - we should warn, if Probe insertion has no probe >- // selected or has no probe import. >- int iSelectedProbes = 0; >- int iAvailableProbes = _tblProbeSets.getItemCount(); >- if (iAvailableProbes > 0) { >- TableItem[] items = _tblProbeSets.getItems(); >- for (int i = 0; i < iAvailableProbes; i++) { >- if (items[i].getChecked()) { >- iSelectedProbes++; >- } >- } >- } >- >- if (iAvailableProbes == 0 || iSelectedProbes == 0) { >- return _warning; >- } else { >- return null; >- } >+ public String validateConfiguration(ProfilingSetsManagerCopy managerCopy) >+ { >+ return probeUI.validateConfiguration(managerCopy); > } > > /* >@@ -895,7 +689,7 @@ > ProbeLaunchConfigString probeConfigDeploy = ProbeLaunchConfigString > .fromString(strProbeSpec); > String strProbeID = probeConfigDeploy.getRegistryId(); >- ProbeRegistryEntry entry = (ProbeRegistryEntry) _registry >+ ProbeRegistryEntry entry = (ProbeRegistryEntry) probeUI.getRegistry() > .lookupById(strProbeID); > if (entry == null) { > strMissingOrInvalidProbes = strMissingOrInvalidProbes >@@ -911,7 +705,7 @@ > > // Silently remove from registry so it will not show up > // in subsequent lists, etc. >- _registry.remove(entry); >+ probeUI.getRegistry().remove(entry); > } > } > } >@@ -940,7 +734,7 @@ > .getProfilingSets().get(setID); > if (set != null) { > String strProbeOptionPrefix = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX >- + PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX; >+ + probeUI.PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX; > boolean bRemovedProbes = false; > Map attributes = set.getAttributes(); > Iterator iterKeys = attributes.keySet() >@@ -987,83 +781,9 @@ > return null; > } > >- private void populateTableFromRegistry() { >- _tblProbeSets.removeAll(); >- _mapProbeFilters.clear(); >- _registry = null; >- >- if (_registry == null) { >- _registry = ProbeRegistry.getRegistry(); >- } >- >- if (_registry != null) { >- // Enumeration iter = _registry.contents(); >- ProbeRegistryEntry[] probes = getProbesSortedByName(); >- // while (iter.hasMoreElements()) >- for (int i = 0; i < probes.length; i++) { >- // ProbeRegistryEntry probeEntry = (ProbeRegistryEntry) >- // iter.nextElement(); >- ProbeRegistryEntry probeEntry = probes[i]; >- TableItem item = new TableItem(_tblProbeSets, SWT.NONE); >- >- // Name >- item.setText(PROBE_NAME_INDEX, probeEntry.getName()); >- >- // Pre-filtered >- if (probeEntry.hasTargets()) { >- item.setText(PROBE_PREFILTERED_INDEX, >- ProbekitLaunchMessages._7); //$NON-NLS-1$ >- } else { >- item.setText(PROBE_PREFILTERED_INDEX, >- ProbekitLaunchMessages._8); //$NON-NLS-1$ >- } >- >- // /RATLC00379812 - Probekit launch UI needs to be updated to >- // support 2-tier filtering. >- // Build map for tracking filter selection with initial default >- // values >- // (later updated with any saved settings) >- _mapProbeFilters.put(probeEntry.getId(), null);// "D", "" >- >- // Imported >- if (probeEntry.isAuthored()) { >- item.setText(PROBE_IMPORTED_INDEX, >- ProbekitLaunchMessages._8); //$NON-NLS-1$ >- } else { >- item.setText(PROBE_IMPORTED_INDEX, >- ProbekitLaunchMessages._7); //$NON-NLS-1$ >- } >- >- // ID >- item.setText(PROBE_ID_INDEX, probeEntry.getId()); >- >- // Data >- item.setData(probeEntry); >- } >- } >- } >- >- public ProbeRegistryEntry[] getProbesSortedByName() { >- Collection probes = new ArrayList(); >- Iterator iter = _registry.iterator(); >- while (iter.hasNext()) { >- ProbeRegistryEntry entry = (ProbeRegistryEntry) iter.next(); >- probes.add(entry); >- } >+ > >- ProbeRegistryEntry[] sortedProbes = new ProbeRegistryEntry[probes >- .size()]; >- probes.toArray(sortedProbes); >- Arrays.sort(sortedProbes, new Comparator() { >- public int compare(Object obj1, Object obj2) { >- ProbeRegistryEntry probe1 = (ProbeRegistryEntry) obj1; >- ProbeRegistryEntry probe2 = (ProbeRegistryEntry) obj2; >- return probe1.getName().compareTo(probe2.getName()); >- } >- }); >- >- return sortedProbes; >- } >+ > > /* > * (non-Javadoc) >@@ -1071,172 +791,8 @@ > * @see org.eclipse.hyades.trace.ui.launcher.IProfilingType#getDescription() > */ > public String getDescription(ProfilingSetsManagerCopy config) { >- // System.out.println("ProbekitProfilingType.getDescription called"); >- String strDelim = "\n"; //$NON-NLS-1$ >- String strIndent = " "; //$NON-NLS-1$ >- >- // Empty previous description >- _description = ""; //$NON-NLS-1$ >- >- if (_registry == null) { >- _registry = ProbeRegistry.getRegistry(); >- } >- >- if (config != null && config.getDefaultSet() != null) { >- int index = 0; >- String strName = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX >- + PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX + index; >- >- Map configAttributes = config.getDefaultSet().getAttributes(); >- ProfilingAttribute attribute = (ProfilingAttribute) configAttributes >- .get(strName); >- >- while (attribute != null) { >- String strValue = attribute.getValue(); >- ProbeLaunchConfigString probeString = ProbeLaunchConfigString >- .fromString(strValue); >- >- String strProbeID = probeString.getRegistryId(); >- >- if (strProbeID != null && strProbeID.length() > 0) { >- if (_registry != null) { >- ProbeRegistryEntry probeEntry = _registry >- .lookupById(strProbeID); >- >- if (probeEntry != null) { >- String strProbeName = probeEntry.getName(); >- >- if (strProbeName != null) { >- _description = _description + strIndent >- + strProbeName + strDelim; >- } >- } >- } >- } >- >- index++; >- strName = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX >- + PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX + index; >- attribute = (ProfilingAttribute) configAttributes.get(strName); >- } >- } >- >- if (_description != null && _description.length() > 0) { >- // Remove extra new-line at end of string >- int iLastNewLineIndex = _description.lastIndexOf(strDelim); >- if (iLastNewLineIndex >= 0) { >- _description = _description.substring(0, iLastNewLineIndex); >- } >- } else { >- // Return null instead of zero-length string to prevent blank line >- // _description = null; >- _description = strIndent + ProbekitLaunchMessages._28; //$NON-NLS-1$ >- } >- >- return _description; >- } >- >- public void widgetSelected(SelectionEvent e) { >- final ArrayList list = new ArrayList(); >- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot() >- .getProjects(); >- for (int idx = 0; idx < projects.length; idx++) { >- try { >- IProject project = projects[idx]; >- if (project.isOpen() && project.hasNature(JavaCore.NATURE_ID) >- && !project.hasNature(ProbeNature.NATURE_NAME)) { >- IJavaProject jProject = JavaCore.create(project); >- Object[] resources = jProject.getNonJavaResources(); >- >- boolean hasProbe = false; >- int i = 0; >- while (i < resources.length && !hasProbe) { >- String extension = ((IResource) resources[i]) >- .getFileExtension(); >- if (extension != null && (extension.equals("probe"))) { >- hasProbe = true; >- } >- i++; >- >- } >- >- if (hasProbe) { >- list.add(project); >- continue; >- } >- >- List sources = JavaUtil.getSourceContainerEntries(jProject); >- i = 0; >- while (i < sources.size() && !hasProbe) { >- IPath path = ((IClasspathEntry) sources.get(i)) >- .getPath(); >- IFolder folder = ResourcesPlugin.getWorkspace() >- .getRoot().getFolder(path); >- resources = folder.members(); >- int j = 0; >- while (!hasProbe && j < resources.length) { >- >- String extension = ((IResource) resources[j]) >- .getFileExtension(); >- if (extension != null >- && (extension.equals("probe") || extension >- .equals("probescript"))) { >- hasProbe = true; >- } >- j++; >- } >- >- i++; >- } >- >- if (hasProbe) >- list.add(project); >- } >- } catch (Exception exc) { >- } >- >- } >- >- /* >- * N.M. Need to populate the list before checking for list.size(). >- * bugzilla_140821 >- */ >- populateTableFromRegistry(); >- >- if (list.size() == 0) >- return; >- >- IRunnableWithProgress operation = new WorkspaceModifyOperation() { >- public void execute(IProgressMonitor monitor) { >- try { >- AddProbeNatureOperation addProbeNature = new AddProbeNatureOperation( >- list); >- addProbeNature.run(monitor); >- >- } catch (CoreException ex) { >- // TODO Auto-generated catch block >- ex.printStackTrace(); >- } finally { >- monitor.done(); >- } >- } >- }; >- >- try { >- new ProgressMonitorDialog(Display.getCurrent().getActiveShell()) >- .run(true, true, operation); >- } catch (InvocationTargetException exec) { >- // TODO Auto-generated catch block >- exec.printStackTrace(); >- } catch (InterruptedException exec) { >- // TODO Auto-generated catch block >- exec.printStackTrace(); >- } >- >- } >- >- public void widgetDefaultSelected(SelectionEvent e) { >- >+ return probeUI.getDescription(config); > } > >+ > } >Index: src/org/eclipse/tptp/platform/probekit/launch/internal/ProbekitLaunchUI.java >=================================================================== >RCS file: src/org/eclipse/tptp/platform/probekit/launch/internal/ProbekitLaunchUI.java >diff -N src/org/eclipse/tptp/platform/probekit/launch/internal/ProbekitLaunchUI.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/tptp/platform/probekit/launch/internal/ProbekitLaunchUI.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,673 @@ >+/********************************************************************** >+ * Copyright (c) 2007 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 >+ * @author ldancy >+ **********************************************************************/ >+ >+package org.eclipse.tptp.platform.probekit.launch.internal; >+ >+import java.util.ArrayList; >+import java.util.Arrays; >+import java.util.Collection; >+import java.util.Comparator; >+import java.util.HashMap; >+import java.util.Iterator; >+import java.util.List; >+import java.util.Map; >+ >+import org.eclipse.core.resources.IFolder; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.resources.ResourcesPlugin; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.hyades.probekit.editor.internal.core.util.JavaUtil; >+import org.eclipse.hyades.trace.ui.launcher.ProfilingAttribute; >+import org.eclipse.hyades.trace.ui.launcher.ProfilingSetsManagerCopy; >+import org.eclipse.hyades.ui.util.GridUtil; >+import org.eclipse.jdt.core.IClasspathEntry; >+import org.eclipse.jdt.core.IJavaProject; >+import org.eclipse.jdt.core.JavaCore; >+import org.eclipse.jface.dialogs.IDialogSettings; >+import org.eclipse.jface.viewers.ColumnPixelData; >+import org.eclipse.jface.viewers.TableLayout; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.events.SelectionListener; >+import org.eclipse.swt.graphics.Font; >+import org.eclipse.swt.graphics.FontData; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Event; >+import org.eclipse.swt.widgets.Listener; >+import org.eclipse.swt.widgets.TabFolder; >+import org.eclipse.swt.widgets.TabItem; >+import org.eclipse.swt.widgets.Table; >+import org.eclipse.swt.widgets.TableColumn; >+import org.eclipse.swt.widgets.TableItem; >+import org.eclipse.swt.widgets.Text; >+import org.eclipse.tptp.platform.probekit.builder.ProbeNature; >+import org.eclipse.tptp.platform.probekit.launch.internal.config.ProbePropertiesUI; >+import org.eclipse.tptp.platform.probekit.launch.internal.config.ProbekitLaunchMessages; >+import org.eclipse.tptp.platform.probekit.registry.ProbeRegistry; >+import org.eclipse.tptp.platform.probekit.registry.ProbeRegistryEntry; >+import org.eclipse.tptp.platform.probekit.util.ProbeLaunchConfigString; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.plugin.AbstractUIPlugin; >+/** >+ * A class to isolate the shared UI code for both the JVMPI and JVMTI >+ * dynamic probekit profiling launch configurations. This was created in TPTP >+ * 4.4 in order to support the JVMTI launch configuration without duplicating >+ * the UI code. >+ * >+ * @author ldancy >+ * >+ */ >+public class ProbekitLaunchUI implements SelectionListener >+{ >+ private Composite _form; >+ >+ private Table _tblProbeSets; >+ >+ private Button _refreshData; >+ >+ private ProbePropertiesUI _propertiesUI; >+ >+ private Text _lblTitle; >+ >+ private TabFolder _folder; >+ >+ private ProfilingSetsManagerCopy _managerCopy; >+ >+ private ProbeRegistry _registry ; >+ >+ private IDialogSettings _settings; >+ >+ private String _warning; >+ >+ private String _description = ""; // Non-NLS >+ >+ protected HashMap _mapProbeFilters; >+ >+ protected Map _filterSetsCopy; >+ >+ private final static int PROBE_NAME_INDEX = 0; >+ >+ private final static int PROBE_PREFILTERED_INDEX = 1; >+ >+ private final static int PROBE_IMPORTED_INDEX = 2; >+ >+ private final static int PROBE_ID_INDEX = 3; >+ >+ public final static String PROBE_LAUNCH_SELECTION_ATTRIBUTE_STRING = "org.eclipse.tptp.platform.probekit.launch.internal.PROBEUI"; //$NON-NLS-1$ >+ >+ public final static String PROBE_LAUNCH_SETOPTION_ATTRIBUTE_PREFIX = "SETOPTION_"; //$NON-NLS-1$ >+ >+ public final String PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX = "PROBEUI"; >+ //$NON-NLS-1$ >+ >+ /** >+ * Constructor to create a ProbekitLaunchUI for a JVMTI or JVMPI launch >+ * configuration. Added for enahncement 141540 >+ * Liz Dancy >+ */ >+ public ProbekitLaunchUI() >+ { >+ _registry = ProbeRegistry.getRegistry(); >+ >+ AbstractUIPlugin plugin = (AbstractUIPlugin) ProbekitLaunchPlugin >+ .getDefault(); >+ IDialogSettings workbenchSettings = plugin.getDialogSettings(); >+ IDialogSettings section = workbenchSettings >+ .getSection("ProbeLaunchDialog");//$NON-NLS-1$ >+ if (section == null) { >+ section = workbenchSettings.addNewSection("ProbeLaunchDialog");//$NON-NLS-1$ >+ } >+ _settings = section; >+ >+ >+ _mapProbeFilters = new HashMap(); >+ _filterSetsCopy = new HashMap(); >+ >+ _warning = new String(ProbekitLaunchMessages._18); //$NON-NLS-1$ >+ } >+ >+ >+ >+ public Composite CreateControl(Composite parent, ProfilingSetsManagerCopy config, boolean enabled) >+ { >+ >+ _form = new Composite(parent, SWT.NULL); >+ GridData data = GridUtil.createFill(); >+ _form.setLayoutData(data); >+ >+ GridLayout layout = new GridLayout(); >+ layout.numColumns = 2; >+ _form.setLayout(layout); >+ >+ _lblTitle = new Text(_form, SWT.LEFT /* | SWT.BORDER */| SWT.READ_ONLY); >+ GridData gd = new GridData(GridData.FILL_HORIZONTAL); >+ gd.grabExcessHorizontalSpace = true; >+ gd.horizontalSpan = 2; >+ _lblTitle.setLayoutData(gd); >+ >+ Composite childTop = new Composite(_form, SWT.NONE); >+ data = GridUtil.createVerticalFill(); >+ data.widthHint = 200; >+ childTop.setLayoutData(data); >+ >+ layout = new GridLayout(); >+ layout.numColumns = 1; >+ childTop.setLayout(layout); >+ >+ // _lblTitle.setFont(JFaceResources.getBannerFont()); >+ Font font = _lblTitle.getFont(); >+ if (font != null) >+ { >+ FontData[] fonts = font.getFontData(); >+ if (fonts != null && fonts.length >= 1) >+ { >+ // Maintain consistency with built-in Hyades profiling type UIs >+ // while still inheriting system font >+ _lblTitle.setFont(new Font(Display.getDefault(), fonts[0] >+ .getName(), fonts[0].getHeight() + 3, SWT.BOLD)); >+ } >+ } >+ _lblTitle.setText(ProbekitLaunchMessages._25); //$NON-NLS-1$ >+ >+ _tblProbeSets = new Table(childTop, SWT.CHECK | SWT.SINGLE >+ | SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); >+ data = GridUtil.createFill(); >+ _tblProbeSets.setLayoutData(data); >+ >+ _refreshData = new Button(childTop, SWT.PUSH); >+ _refreshData.setText(ProbekitLaunchMessages._1); >+ _refreshData.addSelectionListener(this); >+ >+ // new Label(childTop, SWT.NULL); >+ >+ TableLayout layoutTable = new TableLayout(); >+ layoutTable.addColumnData(new ColumnPixelData(170, true)); >+ _tblProbeSets.setLayout(layoutTable); >+ _tblProbeSets.setHeaderVisible(true); >+ >+ // begin adding columns >+ TableColumn tc1 = new TableColumn(_tblProbeSets, SWT.LEFT); >+ tc1.setText(ProbekitLaunchMessages._21); //$NON-NLS-1$ >+ // end adding columns >+ >+ populateTableFromRegistry(); >+ >+ _tblProbeSets.addListener(SWT.Selection, new Listener() >+ { >+ >+ public void handleEvent(Event event) >+ { >+ if (event.item instanceof TableItem) >+ { >+ ProbeRegistryEntry entry = (ProbeRegistryEntry) event.item >+ .getData(); >+ if (entry != null) >+ { >+ _propertiesUI.updateWidgetValues(entry); >+ // commented out for bugzilla_145401 >+ // _filtersUI.updateWidgetValues(entry); >+ >+ int index = _tblProbeSets >+ .indexOf((TableItem) event.item); >+ _tblProbeSets.setSelection(index); >+ } >+ } >+ } >+ }); >+ >+ Composite childBottom = new Composite(_form, SWT.NONE); >+ data = GridUtil.createFill(); >+ >+ childBottom.setLayoutData(data); >+ >+ layout = new GridLayout(); >+ layout.numColumns = 1; >+ layout.marginHeight = 0; >+ childBottom.setLayout(layout); >+ >+ // _folder = new CTabFolder(childBottom, SWT.BORDER); >+ _folder = new TabFolder(childBottom, SWT.TOP); >+ data = GridUtil.createFill(); >+ // bugzilla_145401 required the uncommenting of this code >+ data.heightHint = 320; >+ data.grabExcessHorizontalSpace = true; >+ _folder.setLayoutData(data); >+ >+ TabItem item = new TabItem(_folder, SWT.NONE); >+ item.setText(ProbekitLaunchMessages._20); //$NON-NLS-1$ >+ _propertiesUI = new ProbePropertiesUI(); >+ item.setControl(_propertiesUI.createControl(_folder)); >+ if (_tblProbeSets.getItemCount() == 0) >+ { >+ // Display text pointing user to import >+ _propertiesUI.showHint(true); >+ } >+ >+ item.setImage(ProbekitLaunchImages.INSTANCE >+ .getImage(ProbekitLaunchImages.IMG_PROP)); >+ >+ _folder.setSelection(0); >+ >+ // commented out for bugzilla_145401 >+ // TabItem item2 = new TabItem(_folder, SWT.NONE); >+ // item2.setText(ProbekitLaunchMessages._19); //$NON-NLS-1$ >+ // _filtersUI = new ProbeFiltersUI(); >+ // item2.setControl(_propertiesUI.createControl(_folder)); >+ // item2.setImage(ProbekitLaunchImages.INSTANCE.getImage(ProbekitLaunchImages.IMG_FILTER)); >+ >+ if (config != null) >+ { >+ _managerCopy = config; >+ } >+ else >+ { >+ _managerCopy = new ProfilingSetsManagerCopy(); >+ } >+ initializeValues(config); >+ >+ >+ int sel = _tblProbeSets.getSelectionIndex(); >+ if (sel != -1) >+ { >+ ProbeRegistryEntry entry = (ProbeRegistryEntry) _tblProbeSets >+ .getItem(sel).getData(); >+ if (entry != null) >+ { >+ _propertiesUI.updateWidgetValues(entry); >+ } >+ } >+ >+ _tblProbeSets.setFocus(); >+ >+ return _form; >+ } >+ >+ protected void initializeValues(ProfilingSetsManagerCopy config) >+ { >+ int iNumProbeSets = _tblProbeSets.getItemCount(); >+ TableItem[] items = _tblProbeSets.getItems(); >+ >+ Map configAttributes = config.getDefaultSet().getAttributes(); >+ int index = 0; >+ String strName = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX >+ + PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX + index; >+ ProfilingAttribute attribute = (ProfilingAttribute) configAttributes >+ .get(strName); >+ while (attribute != null) >+ { >+ // String strCheckedCount = attribute.getValue(); >+ // int iCheckedCount = Integer.parseInt(strCheckedCount); >+ // for (int i = 0; i < iCheckedCount; i++) >+ // { >+ // attribute = (ProfilingAttribute) >+ // configAttributes.get("com.ibm.rational.pd.probekit.PROBEKIT_ID" + >+ // i); >+ String strValue = attribute.getValue(); >+ ProbeLaunchConfigString probeConfig = ProbeLaunchConfigString >+ .fromString(strValue); >+ // if (attribute != null) >+ if (probeConfig != null) >+ { >+ // String strProbeKitID = attribute.getValue(); >+ String strProbeKitID = probeConfig.getRegistryId(); >+ for (int j = 0; j < iNumProbeSets; j++) >+ { >+ ProbeRegistryEntry entry = (ProbeRegistryEntry) items[j] >+ .getData(); >+ if (entry != null) >+ { >+ String strEntryID = entry.getId(); >+ if (strEntryID.equals(strProbeKitID)) >+ { >+ items[j].setChecked(true); >+ >+ break; >+ } >+ } >+ } >+ } >+ >+ index++; >+ >+ strName = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX >+ + PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX + index; >+ attribute = (ProfilingAttribute) configAttributes.get(strName); >+ // } >+ } >+ } >+ >+ public void widgetSelected(SelectionEvent e) >+ { >+ final ArrayList list = new ArrayList(); >+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot() >+ .getProjects(); >+ for (int idx = 0; idx < projects.length; idx++) >+ { >+ try { >+ IProject project = projects[idx]; >+ if (project.isOpen() && project.hasNature(JavaCore.NATURE_ID) >+ && !project.hasNature(ProbeNature.NATURE_NAME)) { >+ IJavaProject jProject = JavaCore.create(project); >+ Object[] resources = jProject.getNonJavaResources(); >+ >+ boolean hasProbe = false; >+ int i = 0; >+ while (i < resources.length && !hasProbe) >+ { >+ String extension = ((IResource) resources[i]) >+ .getFileExtension(); >+ if (extension != null && (extension.equals("probe"))) >+ { >+ hasProbe = true; >+ } >+ i++; >+ >+ } >+ >+ if (hasProbe) >+ { >+ list.add(project); >+ continue; >+ } >+ >+ List sources = JavaUtil.getSourceContainerEntries(jProject); >+ i = 0; >+ while (i < sources.size() && !hasProbe) >+ { >+ IPath path = ((IClasspathEntry) sources.get(i)) >+ .getPath(); >+ IFolder folder = ResourcesPlugin.getWorkspace() >+ .getRoot().getFolder(path); >+ resources = folder.members(); >+ int j = 0; >+ while (!hasProbe && j < resources.length) { >+ >+ String extension = ((IResource) resources[j]) >+ .getFileExtension(); >+ if (extension != null >+ && (extension.equals("probe") || extension >+ .equals("probescript"))) >+ { >+ hasProbe = true; >+ } >+ j++; >+ } >+ >+ i++; >+ } >+ >+ if (hasProbe) >+ list.add(project); >+ } >+ } >+ catch (Exception exc) >+ { >+ >+ } >+ >+ } >+ } >+ >+ public void widgetDefaultSelected(SelectionEvent e) >+ { >+ //Does not need to be implemented >+ } >+ >+ public void populateTableFromRegistry() >+ { >+ _tblProbeSets.removeAll(); >+ _mapProbeFilters.clear(); >+ _registry = null; >+ >+ if (_registry == null) >+ { >+ _registry = ProbeRegistry.getRegistry(); >+ } >+ >+ if (_registry != null) >+ { >+ // Enumeration iter = _registry.contents(); >+ ProbeRegistryEntry[] probes = getProbesSortedByName(); >+ // while (iter.hasMoreElements()) >+ for (int i = 0; i < probes.length; i++) >+ { >+ ProbeRegistryEntry probeEntry = probes[i]; >+ TableItem item = new TableItem(_tblProbeSets, SWT.NONE); >+ >+ // Name >+ item.setText(PROBE_NAME_INDEX, probeEntry.getName()); >+ >+ // Pre-filtered >+ if (probeEntry.hasTargets()) >+ { >+ item.setText(PROBE_PREFILTERED_INDEX, >+ ProbekitLaunchMessages._7); //$NON-NLS-1$ >+ } >+ else >+ { >+ item.setText(PROBE_PREFILTERED_INDEX, >+ ProbekitLaunchMessages._8); //$NON-NLS-1$ >+ } >+ >+ // /RATLC00379812 - Probekit launch UI needs to be updated to >+ // support 2-tier filtering. >+ // Build map for tracking filter selection with initial default >+ // values >+ // (later updated with any saved settings) >+ _mapProbeFilters.put(probeEntry.getId(), null);// "D", "" >+ >+ // Imported >+ if (probeEntry.isAuthored()) >+ { >+ item.setText(PROBE_IMPORTED_INDEX, >+ ProbekitLaunchMessages._8); //$NON-NLS-1$ >+ } else >+ { >+ item.setText(PROBE_IMPORTED_INDEX, >+ ProbekitLaunchMessages._7); //$NON-NLS-1$ >+ } >+ // ID >+ item.setText(PROBE_ID_INDEX, probeEntry.getId()); >+ >+ // Data >+ item.setData(probeEntry); >+ } >+ } >+ } >+ /** >+ * Returns the set of Probes sorted alphabetically by name >+ * These values are taken from the ProbeRegistry >+ * @return >+ */ >+ public ProbeRegistryEntry[] getProbesSortedByName() >+ { >+ Collection probes = new ArrayList(); >+ Iterator iter = _registry.iterator(); >+ while (iter.hasNext()) >+ { >+ ProbeRegistryEntry entry = (ProbeRegistryEntry) iter.next(); >+ probes.add(entry); >+ } >+ >+ ProbeRegistryEntry[] sortedProbes = new ProbeRegistryEntry[probes >+ .size()]; >+ probes.toArray(sortedProbes); >+ Arrays.sort(sortedProbes, new Comparator() >+ { >+ public int compare(Object obj1, Object obj2) >+ { >+ ProbeRegistryEntry probe1 = (ProbeRegistryEntry) obj1; >+ ProbeRegistryEntry probe2 = (ProbeRegistryEntry) obj2; >+ return probe1.getName().compareTo(probe2.getName()); >+ } >+ }); >+ >+ return sortedProbes; >+ } >+ >+ public String validateConfiguration(ProfilingSetsManagerCopy managerCopy) >+ { >+ // RATLC00379729 - we should warn, if Probe insertion has no probe >+ // selected or has no probe import. >+ int iSelectedProbes = 0; >+ int iAvailableProbes = _tblProbeSets.getItemCount(); >+ if (iAvailableProbes > 0) { >+ TableItem[] items = _tblProbeSets.getItems(); >+ for (int i = 0; i < iAvailableProbes; i++) { >+ if (items[i].getChecked()) { >+ iSelectedProbes++; >+ } >+ } >+ } >+ >+ if (iAvailableProbes == 0 || iSelectedProbes == 0) { >+ return _warning; >+ } else { >+ return null; >+ } >+ } >+ >+ >+ >+ public void saveSelections() { >+ >+ int indexSelection =_tblProbeSets.getSelectionIndex(); >+ >+ if (indexSelection >= 0) { >+ TableItem tableItem = _tblProbeSets.getItem(indexSelection); >+ if (tableItem != null) { >+ ProbeRegistryEntry entry = (ProbeRegistryEntry) tableItem >+ .getData(); >+ if (entry != null) { >+ String strID = entry.getId(); >+ if (_settings != null) { >+ // Store table selection >+ _settings.put("ProbeTableSelection", strID); //$NON-NLS-1$ >+ } >+ } >+ } >+ } else { >+ if (_settings != null) { >+ _settings.put("ProbeTableSelection", ""); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ } >+ >+ >+ TabItem[] item = _folder.getSelection(); >+ if (item[0] != null) { >+ String strName = item[0].getText(); >+ if (_settings != null) { >+ // Store folder selection >+ _settings.put("ProbeFolderSelection", strName); //$NON-NLS-1$ >+ } >+ } else { >+ _settings.put("ProbeFolderSelection", ""); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ >+ } >+ >+ public String getDescription(ProfilingSetsManagerCopy config) { >+ >+ String strDelim = "\n"; //$NON-NLS-1$ >+ String strIndent = " "; //$NON-NLS-1$ >+ >+ // Empty previous description >+ _description = ""; //$NON-NLS-1$ >+ >+ if (_registry == null) { >+ _registry = ProbeRegistry.getRegistry(); >+ } >+ >+ if (config != null && config.getDefaultSet() != null) { >+ int index = 0; >+ String strName = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX >+ + PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX + index; >+ >+ Map configAttributes = config.getDefaultSet().getAttributes(); >+ ProfilingAttribute attribute = (ProfilingAttribute) configAttributes >+ .get(strName); >+ >+ while (attribute != null) { >+ String strValue = attribute.getValue(); >+ ProbeLaunchConfigString probeString = ProbeLaunchConfigString >+ .fromString(strValue); >+ >+ String strProbeID = probeString.getRegistryId(); >+ >+ if (strProbeID != null && strProbeID.length() > 0) { >+ if (_registry != null) { >+ ProbeRegistryEntry probeEntry = _registry >+ .lookupById(strProbeID); >+ >+ if (probeEntry != null) { >+ String strProbeName = probeEntry.getName(); >+ >+ if (strProbeName != null) { >+ _description = _description + strIndent >+ + strProbeName + strDelim; >+ } >+ } >+ } >+ } >+ >+ index++; >+ strName = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX >+ + PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX + index; >+ attribute = (ProfilingAttribute) configAttributes.get(strName); >+ } >+ } >+ >+ if (_description != null && _description.length() > 0) { >+ // Remove extra new-line at end of string >+ int iLastNewLineIndex = _description.lastIndexOf(strDelim); >+ if (iLastNewLineIndex >= 0) { >+ _description = _description.substring(0, iLastNewLineIndex); >+ } >+ } else { >+ // Return null instead of zero-length string to prevent blank line >+ // _description = null; >+ _description = strIndent + ProbekitLaunchMessages._28; //$NON-NLS-1$ >+ } >+ >+ return _description; >+ } >+ >+ >+ /** >+ * Accessor and mutator methods for fields in the UI >+ * Necssary so that the PI and TI-specific methods can access these fields >+ * @return >+ */ >+ public Table getProbeSets(){ >+ return _tblProbeSets; >+ } >+ public ProfilingSetsManagerCopy getManager(){ >+ return _managerCopy; >+ } >+ public ProbeRegistry getRegistry(){ >+ return _registry; >+ } >+ >+ public IDialogSettings getSettings(){ >+ return _settings; >+ } >+ >+ public void setSettings(IDialogSettings givenSettings){ >+ _settings = givenSettings; >+ } >+ >+} >#P org.eclipse.hyades.trace.ui >Index: src/org/eclipse/tptp/trace/ui/internal/launcher/core/messages.properties >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/tptp/trace/ui/internal/launcher/core/messages.properties,v >retrieving revision 1.5 >diff -u -r1.5 messages.properties >--- src/org/eclipse/tptp/trace/ui/internal/launcher/core/messages.properties 23 Mar 2007 16:43:40 -0000 1.5 >+++ src/org/eclipse/tptp/trace/ui/internal/launcher/core/messages.properties 18 Apr 2007 15:32:35 -0000 >@@ -44,6 +44,8 @@ > ERROR_LOG_DISCOVER_FILTER = The filter set is invalid. Make sure that the agent name and visibility columns have valid values and don't contain characters ; or , > ERROR_LOG_DISCOVER_NO_FILTER = There must at least be one filter entry > >+ERROR_NO_PROBES_SELECTED =No probes are selected for probe insertion >+ > WARNING_DCM_UNRESOLVED_DELEGATE = Could not resolve the launch delegate of the data collector {0}. > WARNING_DCM_FAILED_DELEGATE = One of the selected launch delegates has failed. > >Index: src/org/eclipse/tptp/trace/ui/internal/launcher/core/DataCollector.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/tptp/trace/ui/internal/launcher/core/DataCollector.java,v >retrieving revision 1.3 >diff -u -r1.3 DataCollector.java >--- src/org/eclipse/tptp/trace/ui/internal/launcher/core/DataCollector.java 25 Mar 2006 08:36:58 -0000 1.3 >+++ src/org/eclipse/tptp/trace/ui/internal/launcher/core/DataCollector.java 18 Apr 2007 15:32:35 -0000 >@@ -128,6 +128,7 @@ > dataCollector.setDefaultAnalysisTypes(defaultAnalysisTypes); > dataCollector.setIcon(icon); > >+ > return dataCollector; > } > >Index: src/org/eclipse/tptp/trace/ui/internal/launcher/core/LauncherMessages.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/tptp/trace/ui/internal/launcher/core/LauncherMessages.java,v >retrieving revision 1.5 >diff -u -r1.5 LauncherMessages.java >--- src/org/eclipse/tptp/trace/ui/internal/launcher/core/LauncherMessages.java 23 Mar 2007 22:46:36 -0000 1.5 >+++ src/org/eclipse/tptp/trace/ui/internal/launcher/core/LauncherMessages.java 18 Apr 2007 15:32:35 -0000 >@@ -51,6 +51,7 @@ > public static String ERROR_LOG_DISCOVER_FILTER; > public static String ERROR_LOG_DISCOVER_NO_FILTER; > >+ public static String ERROR_NO_PROBES_SELECTED; > public static String WARNING_DCM_UNRESOLVED_DELEGATE; > public static String WARNING_DCM_FAILED_DELEGATE; > >Index: src/org/eclipse/tptp/trace/ui/internal/launcher/core/EditOptionDelegate.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/tptp/trace/ui/internal/launcher/core/EditOptionDelegate.java,v >retrieving revision 1.2 >diff -u -r1.2 EditOptionDelegate.java >--- src/org/eclipse/tptp/trace/ui/internal/launcher/core/EditOptionDelegate.java 8 Sep 2006 18:34:11 -0000 1.2 >+++ src/org/eclipse/tptp/trace/ui/internal/launcher/core/EditOptionDelegate.java 18 Apr 2007 15:32:35 -0000 >@@ -241,6 +241,7 @@ > * <code>isInputProfilingType</code> must be set for this to have any meaning */ > private ConfigurationPageWrapper dummyConfigurationPage; > >+ private ConfigurationPageWrapper confPageWrapperLastPage; > /** > * Constructs this wizard based on the input. > * >@@ -320,12 +321,14 @@ > if (confPages == null) > return; > >- for (int i = 0; i < confPages.length; i++) >+ for (int i = 0; i < confPages.length -1; i++) > { > confPages[i].reset (launchConfigurationWC); > ConfigurationPageWrapper confPageWrapper = new ConfigurationPageWrapper(confPages[i]); > super.addPage (confPageWrapper); >- } >+ } >+ confPageWrapperLastPage = new ConfigurationPageWrapper(confPages[confPages.length -1]); >+ super.addPage (confPageWrapperLastPage); > } > } > >@@ -410,7 +413,15 @@ > else > { > status = ((IConfiguration)configurationLoader.getConfigurationClass()).finishConfiguration(launchConfigurationWC); >- >+ >+ if (status == false) >+ { >+ >+ confPageWrapperLastPage.setErrorMessage(LauncherMessages.ERROR_NO_PROBES_SELECTED); >+ >+ } >+ IConfigurationPage currentPage = ((IConfiguration)configurationLoader.getConfigurationClass()).getConfigurationPages()[0]; >+ > /* We have to save our changes if we manually constructed the working copy */ > if (isWorkingCopyConstructed && status) > launchConfigurationWC.doSave(); >Index: src/org/eclipse/tptp/trace/ui/internal/launcher/application/AbstractConfiguration.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/tptp/trace/ui/internal/launcher/application/AbstractConfiguration.java,v >retrieving revision 1.2 >diff -u -r1.2 AbstractConfiguration.java >--- src/org/eclipse/tptp/trace/ui/internal/launcher/application/AbstractConfiguration.java 28 Mar 2006 22:24:54 -0000 1.2 >+++ src/org/eclipse/tptp/trace/ui/internal/launcher/application/AbstractConfiguration.java 18 Apr 2007 15:32:35 -0000 >@@ -66,7 +66,7 @@ > confPage = null; > } > >- if (confPage != null && confPage instanceof IExtendedConfigurationPage) >+ if (confPage != null && confPage instanceof IExtendedConfigurationPage ) > confPageVec.add(confPage); > } > confPageContainer = new IExtendedConfigurationPage[confPageVec.size()]; >@@ -99,10 +99,13 @@ > */ > public boolean finishConfiguration(ILaunchConfigurationWorkingCopy workingCopy) > { >+ > /* Give all pages the chance of storing their own attributes */ > boolean status = true; > for (int i = 0; i < confPageContainer.length; i++) >+ { > status = status && confPageContainer[i].storeAttributes(workingCopy); >+ } > > return status; > } >Index: src/org/eclipse/hyades/trace/ui/internal/core/TraceProfileUI.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.trace.ui/src/org/eclipse/hyades/trace/ui/internal/core/TraceProfileUI.java,v >retrieving revision 1.15 >diff -u -r1.15 TraceProfileUI.java >--- src/org/eclipse/hyades/trace/ui/internal/core/TraceProfileUI.java 18 Aug 2006 19:50:13 -0000 1.15 >+++ src/org/eclipse/hyades/trace/ui/internal/core/TraceProfileUI.java 18 Apr 2007 15:32:35 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2005, 2006 IBM Corporation and others. >+ * Copyright (c) 2005, 2007 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 >@@ -65,6 +65,8 @@ > import org.eclipse.swt.widgets.TabFolder; > import org.eclipse.swt.widgets.TabItem; > import org.eclipse.swt.widgets.Text; >+import org.eclipse.swt.widgets.Tree; >+import org.eclipse.swt.widgets.TreeItem; > import org.eclipse.tptp.trace.ui.internal.launcher.core.AnalysisType; > import org.eclipse.tptp.trace.ui.internal.launcher.core.AvailabilityTesterDelegate; > import org.eclipse.tptp.trace.ui.internal.launcher.core.DataCollector; >@@ -266,6 +268,7 @@ > checkBoxTreeViewer.getTree().addKeyListener(this); > checkBoxTreeViewer.addDoubleClickListener(this); > >+ > /* Create the control buttons */ > Composite controlButtonComposite = new Composite(treeComposite, SWT.NONE); > controlButtonComposite.setLayout(new GridLayout()); >@@ -289,6 +292,7 @@ > > public void checkStateChanged(CheckStateChangedEvent event) > { >+ > Object checkedElement = event.getElement(); > if (checkedElement instanceof DataCollector) > { >@@ -299,6 +303,7 @@ > if (event.getChecked()) > { > selectedDatacollector = (DataCollector)checkedElement; >+ > deselectTreeItems(checkedElement, selectedDatacollector.getCoexistanceViolators(), 0); > deselectIndirectViolators(checkedElement, 0); > } >@@ -332,6 +337,7 @@ > Object childNode; > if (event.getChecked() && (childNode = ((ParentChildNode)checkedElement).child) instanceof AnalysisType) > { >+ > deselectTreeItems(checkedElement, ((AnalysisType)childNode).getCoexistanceViolators(), 1); > deselectIndirectViolators(checkedElement, 1); > } >@@ -538,14 +544,19 @@ > checkBoxTreeViewer.setInput(conf); > getProfilingSetWC().initializeFrom(conf); > >+ >+ >+ > /* Try to restore the previous selection for the configuration */ > boolean isConfigurationNew = false; > > checkBoxTreeViewer.setAllChecked(false); >+ >+ > Hashtable entitySelection = LauncherUtility.unserializeSelection(conf); >- if (entitySelection == null) >+ if (entitySelection == null){ > isConfigurationNew = true; >- >+ } > else > { > /* Walk through each data collector and select its children */ >@@ -566,8 +577,25 @@ > for (int i = 0; i < chilrenCount; changeItemCheckedState (new ParentChildNode(currentDataCollector, selectedChildren.get(i++)), true)); > } > } >+ // added for enhancement 141540 preliminary commit of code. Need to grey out this option until the remainder of the code >+ // is checked in >+ // Liz Dancy >+ try >+ { >+ DataCollectorAssociation dataCollectorAssociatorGrey = DataCollectorManager.getInstance().getDataCollectorAssociator(conf.getType().getIdentifier()); >+ DataCollector[] dataCollectorsGrey = dataCollectorAssociatorGrey.getDataCollectors(); > >+ AnalysisType[] defaultAnalysisTypesGrey = dataCollectorsGrey[1].getApplicableAnalysisTypes(); >+ if (defaultAnalysisTypesGrey != null) >+ { >+ ParentChildNode JVMTIProbe = new ParentChildNode(dataCollectorsGrey[1], defaultAnalysisTypesGrey[3]); >+ checkBoxTreeViewer.setGrayed(JVMTIProbe, true); >+ } >+ } > >+ catch (Exception e){ >+ >+ } > /* If the configuration is new then make default selections if the configuration doesn't have an associated > * profiling set. If the configuration happens to have a profiling set, then we'll need to support backward compatibility > * and select the profiling types under the profiling set. */ >@@ -621,6 +649,9 @@ > if (conf instanceof ILaunchConfigurationWorkingCopy) > performApply((ILaunchConfigurationWorkingCopy)conf); > >+ >+ >+ > } > catch (Exception e) > { >@@ -891,9 +922,13 @@ > else if (selection[i] instanceof ParentChildNode) > { > Object child = ((ParentChildNode)selection[i]).child; >- if (child instanceof AnalysisType) >+ if (child instanceof AnalysisType ){ >+ if (((AnalysisType)child).getId().equals("org.eclipse.tptp.analysisType.jvmti.probe")) >+ { >+ isValid=false; >+ } > launchValidator = ((AnalysisType)child).getValidator(); >- >+ } > /* For backward compatibility */ > else if (child instanceof ProfilingSetType) > {
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 141540
:
64054
|
64200
| 64202 |
64210
|
64938
|
65067
|
65068
|
65838
|
65909
|
65934