Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2015-01-14 17:53:07 +0000
committerJeff Johnston2015-01-14 20:44:14 +0000
commit578f579dfe9e442ba939b0c1b2340237f7ad01a8 (patch)
treebddcf2c7fa6dc0411ad51bc405d4aa113694cfa2
parent41bf7cb28a57e09bc0b9e412af850f892f7ffef3 (diff)
downloadorg.eclipse.linuxtools-578f579dfe9e442ba939b0c1b2340237f7ad01a8.tar.gz
org.eclipse.linuxtools-578f579dfe9e442ba939b0c1b2340237f7ad01a8.tar.xz
org.eclipse.linuxtools-578f579dfe9e442ba939b0c1b2340237f7ad01a8.zip
Fix profiling tools when no profiling provider exists
- if a profiling category has no participants (e.g. coverage) then disable it so it does not appear in the Profiling Tools shortcut menu - in the Profiling Tools Configuration view, don't add a page with empty combo box; instead, add a label with a message that no plug-ins supply a tool for the given category - bump up profiling.launch and subsequently, profiling-feature Change-Id: I5fe2b6157555b2269a21692a340fcf304eab0563 Reviewed-on: https://git.eclipse.org/r/39614 Reviewed-by: Roland Grunberg <rgrunber@redhat.com> Tested-by: Hudson CI Reviewed-by: Jeff Johnston <jjohnstn@redhat.com> Tested-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--profiling/org.eclipse.linuxtools.profiling-feature/feature.xml4
-rw-r--r--profiling/org.eclipse.linuxtools.profiling-feature/pom.xml2
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.launch/META-INF/MANIFEST.MF5
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.launch/plugin.xml178
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.launch/pom.xml2
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/AbstractProfilingOptionsTab.java32
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/Messages.java3
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/messages.properties1
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileCategoryEnablementTester.java41
9 files changed, 174 insertions, 94 deletions
diff --git a/profiling/org.eclipse.linuxtools.profiling-feature/feature.xml b/profiling/org.eclipse.linuxtools.profiling-feature/feature.xml
index 8dfc1ce0f3..3e9675843d 100644
--- a/profiling/org.eclipse.linuxtools.profiling-feature/feature.xml
+++ b/profiling/org.eclipse.linuxtools.profiling-feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.linuxtools.profiling"
label="%featureName"
- version="2.0.0.qualifier"
+ version="3.2.0.qualifier"
provider-name="%featureProvider"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">
@@ -73,7 +73,7 @@
install-size="0"
version="0.0.0"/>
- <plugin
+ <plugin
id="org.eclipse.linuxtools.tools.launch.ui"
download-size="0"
install-size="0"
diff --git a/profiling/org.eclipse.linuxtools.profiling-feature/pom.xml b/profiling/org.eclipse.linuxtools.profiling-feature/pom.xml
index e5d92886da..d9578ccf1d 100644
--- a/profiling/org.eclipse.linuxtools.profiling-feature/pom.xml
+++ b/profiling/org.eclipse.linuxtools.profiling-feature/pom.xml
@@ -18,7 +18,7 @@
</parent>
<artifactId>org.eclipse.linuxtools.profiling</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>3.2.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
<name>Linux Tools Profiling Framework Feature</name>
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/META-INF/MANIFEST.MF b/profiling/org.eclipse.linuxtools.profiling.launch/META-INF/MANIFEST.MF
index fefc7227de..ed7ac674e4 100644
--- a/profiling/org.eclipse.linuxtools.profiling.launch/META-INF/MANIFEST.MF
+++ b/profiling/org.eclipse.linuxtools.profiling.launch/META-INF/MANIFEST.MF
@@ -2,14 +2,15 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.eclipse.linuxtools.profiling.launch;singleton:=true
-Bundle-Version: 3.1.0.qualifier
+Bundle-Version: 3.2.0.qualifier
Bundle-Activator: org.eclipse.linuxtools.internal.profiling.launch.ProfileLaunchPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.cdt.core,
org.eclipse.cdt.launch;bundle-version="7.0.0",
org.eclipse.core.filesystem;bundle-version="1.3.100",
- org.eclipse.cdt.debug.ui
+ org.eclipse.cdt.debug.ui,
+ org.eclipse.core.expressions
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: org.eclipse.cdt.core.model,
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/plugin.xml b/profiling/org.eclipse.linuxtools.profiling.launch/plugin.xml
index d67e348a6c..974de45553 100644
--- a/profiling/org.eclipse.linuxtools.profiling.launch/plugin.xml
+++ b/profiling/org.eclipse.linuxtools.profiling.launch/plugin.xml
@@ -41,39 +41,45 @@
</class>
<contextualLaunch>
<enablement>
- <with
+ <and>
+ <test
+ args="timing"
+ property="org.eclipse.linuxtools.profiling.launch.categoryEnabled">
+ </test>
+ <with
variable="selection">
- <count
+ <count
value="1">
- </count>
- <iterate>
- <or>
- <instanceof
+ </count>
+ <iterate>
+ <or>
+ <instanceof
value="org.eclipse.cdt.core.model.IBinary">
- </instanceof>
- <instanceof
+ </instanceof>
+ <instanceof
value="org.eclipse.cdt.core.model.ICProject">
- </instanceof>
- <test
+ </instanceof>
+ <test
property="org.eclipse.cdt.launch.isExecutable">
- </test>
- <test
+ </test>
+ <test
property="org.eclipse.cdt.launch.isCProject">
- </test>
- <and>
- <instanceof
+ </test>
+ <and>
+ <instanceof
value="org.eclipse.ui.IFileEditorInput">
- </instanceof>
- <adapt
+ </instanceof>
+ <adapt
type="org.eclipse.core.resources.IResource">
- <adapt
- type="org.eclipse.cdt.core.model.ICElement">
- </adapt>
- </adapt>
- </and>
- </or>
- </iterate>
- </with>
+ <adapt
+ type="org.eclipse.cdt.core.model.ICElement">
+ </adapt>
+ </adapt>
+ </and>
+ </or>
+ </iterate>
+ </with>
+ </and>
</enablement>
</contextualLaunch>
</shortcut>
@@ -138,39 +144,45 @@
</class>
<contextualLaunch>
<enablement>
- <with
+ <and>
+ <test
+ args="memory"
+ property="org.eclipse.linuxtools.profiling.launch.categoryEnabled">
+ </test>
+ <with
variable="selection">
- <count
+ <count
value="1">
- </count>
- <iterate>
- <or>
- <instanceof
+ </count>
+ <iterate>
+ <or>
+ <instanceof
value="org.eclipse.cdt.core.model.IBinary">
- </instanceof>
- <instanceof
+ </instanceof>
+ <instanceof
value="org.eclipse.cdt.core.model.ICProject">
- </instanceof>
- <test
+ </instanceof>
+ <test
property="org.eclipse.cdt.launch.isExecutable">
- </test>
- <test
+ </test>
+ <test
property="org.eclipse.cdt.launch.isCProject">
- </test>
- <and>
- <instanceof
+ </test>
+ <and>
+ <instanceof
value="org.eclipse.ui.IFileEditorInput">
- </instanceof>
- <adapt
+ </instanceof>
+ <adapt
type="org.eclipse.core.resources.IResource">
- <adapt
- type="org.eclipse.cdt.core.model.ICElement">
- </adapt>
- </adapt>
- </and>
- </or>
- </iterate>
- </with>
+ <adapt
+ type="org.eclipse.cdt.core.model.ICElement">
+ </adapt>
+ </adapt>
+ </and>
+ </or>
+ </iterate>
+ </with>
+ </and>
</enablement>
</contextualLaunch>
</shortcut>
@@ -235,39 +247,45 @@
</class>
<contextualLaunch>
<enablement>
- <with
+ <and>
+ <test
+ args="coverage"
+ property="org.eclipse.linuxtools.profiling.launch.categoryEnabled">
+ </test>
+ <with
variable="selection">
- <count
+ <count
value="1">
- </count>
- <iterate>
- <or>
- <instanceof
+ </count>
+ <iterate>
+ <or>
+ <instanceof
value="org.eclipse.cdt.core.model.IBinary">
- </instanceof>
- <instanceof
+ </instanceof>
+ <instanceof
value="org.eclipse.cdt.core.model.ICProject">
- </instanceof>
- <test
+ </instanceof>
+ <test
property="org.eclipse.cdt.launch.isExecutable">
- </test>
- <test
+ </test>
+ <test
property="org.eclipse.cdt.launch.isCProject">
- </test>
- <and>
- <instanceof
+ </test>
+ <and>
+ <instanceof
value="org.eclipse.ui.IFileEditorInput">
- </instanceof>
- <adapt
+ </instanceof>
+ <adapt
type="org.eclipse.core.resources.IResource">
- <adapt
- type="org.eclipse.cdt.core.model.ICElement">
- </adapt>
- </adapt>
- </and>
- </or>
- </iterate>
- </with>
+ <adapt
+ type="org.eclipse.cdt.core.model.ICElement">
+ </adapt>
+ </adapt>
+ </and>
+ </or>
+ </iterate>
+ </with>
+ </and>
</enablement>
</contextualLaunch>
</shortcut>
@@ -524,4 +542,14 @@
</configurationType>
</shortcut>
</extension>
+ <extension
+ point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.eclipse.linuxtools.profiling.launch.ProfileCategoryEnablementTester"
+ id="org.eclipse.linuxtools.profiling.launch.CodeCoverageEnablementTester"
+ namespace="org.eclipse.linuxtools.profiling.launch"
+ properties="categoryEnabled"
+ type="java.lang.Object">
+ </propertyTester>
+ </extension>
</plugin>
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/pom.xml b/profiling/org.eclipse.linuxtools.profiling.launch/pom.xml
index ab12d9cc5d..9d2296fce1 100644
--- a/profiling/org.eclipse.linuxtools.profiling.launch/pom.xml
+++ b/profiling/org.eclipse.linuxtools.profiling.launch/pom.xml
@@ -18,7 +18,7 @@
</parent>
<artifactId>org.eclipse.linuxtools.profiling.launch</artifactId>
- <version>3.1.0-SNAPSHOT</version>
+ <version>3.2.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<name>Linux Tools Profiling Launch Plug-in</name>
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/AbstractProfilingOptionsTab.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/AbstractProfilingOptionsTab.java
index 83ec85698a..a8c393b479 100644
--- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/AbstractProfilingOptionsTab.java
+++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/AbstractProfilingOptionsTab.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Red Hat, Inc.
+ * Copyright (c) 2013, 2015 Red Hat, Inc.
* 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
@@ -36,6 +36,7 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
/**
* Shared class for displaying profiling options in a single tab.
@@ -67,18 +68,25 @@ public abstract class AbstractProfilingOptionsTab extends AbstractLaunchConfigur
@Override
public void createControl(Composite parent) {
- top = new Composite(parent, SWT.NONE);
- setControl(top);
- top.setLayout(new GridLayout(1, true));
-
- providerCombo = new Combo(top, SWT.READ_ONLY);
- comboItems = getProviders();
- Set<String> providerNames = comboItems.keySet();
- providerCombo.setItems(providerNames.toArray(new String[0]));
-
- tabgroup = new CTabFolder(top, SWT.NONE);
+ top = new Composite(parent, SWT.NONE);
+ setControl(top);
+ top.setLayout(new GridLayout(1, true));
+
+ comboItems = getProviders();
+ Set<String> providerNames = comboItems.keySet();
+
+ providerCombo = new Combo(top, SWT.READ_ONLY);
+ providerCombo.setItems(providerNames.toArray(new String[0]));
+ if (providerNames.size() == 0) {
+ providerCombo.setVisible(false);
+ providerCombo.setEnabled(false);
+ Label label = new Label(top, SWT.NULL);
+ label.setText(Messages.ProfilingTab_no_category_profilers_installed);
+ }
+
+ tabgroup = new CTabFolder(top, SWT.NONE);
tabgroup.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true,
- true));
+ true));
providerCombo.addSelectionListener(new SelectionAdapter() {
@Override
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/Messages.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/Messages.java
index c447203996..52d9790818 100644
--- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/Messages.java
+++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/Messages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2013 Red Hat, Inc.
+ * Copyright (c) 2008, 2013, 2015 Red Hat, Inc.
* 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
@@ -19,6 +19,7 @@ public class Messages extends NLS {
public static String ProfilingTab_no_profilers_installed;
public static String ProfilingTab_specified_providerid_not_installed;
public static String ProfilingTab_specified_profiler_not_installed;
+ public static String ProfilingTab_no_category_profilers_installed;
public static String ProfilingTab_providerid_not_found;
public static String ProfileLaunchShortcut_Binaries;
public static String ProfileLaunchShortcut_Binary_not_found;
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/messages.properties b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/messages.properties
index 08109dc936..f81a89cf8f 100644
--- a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/messages.properties
+++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/internal/profiling/launch/messages.properties
@@ -10,6 +10,7 @@ ProfileLaunchShortcut_Qualifier=Qualifer:
ProfileLaunchShortcut_Launcher=Profiling Launcher
ProfilingTabName=Profiler
ProfilingTab_no_profilers_installed=No profiling plug-ins are currently installed
+ProfilingTab_no_category_profilers_installed=No profiling plug-ins supporting this category are installed
ProfilingTab_specified_providerid_not_installed=The profiling tool for this configuration with provider id: {0} is no longer installed
ProfilingTab_specified_profiler_not_installed=The profiling tool: {0} specified for this configuration is no longer installed
ProfilingTab_providerid_not_found=No profiling tool has been set up for this configuration
diff --git a/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileCategoryEnablementTester.java b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileCategoryEnablementTester.java
new file mode 100644
index 0000000000..a1c3010c75
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.profiling.launch/src/org/eclipse/linuxtools/profiling/launch/ProfileCategoryEnablementTester.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Red Hat Inc..
+ * 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:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.linuxtools.profiling.launch;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.linuxtools.internal.profiling.launch.provider.launch.ProviderFramework;
+
+
+/**
+ * @since 3.2
+ */
+public class ProfileCategoryEnablementTester extends PropertyTester {
+
+ public ProfileCategoryEnablementTester() {
+ }
+
+ @Override
+ public boolean test(Object receiver, String property, Object[] args,
+ Object expectedValue) {
+ ProfileLaunchShortcut x = null;
+
+ if (args.length == 0)
+ return true;
+
+ // See if there is a profile provider for the given category
+ x = ProviderFramework.getProfilingProvider((String)args[0]);
+
+ if (x == null)
+ return false;
+ return true;
+ }
+
+}

Back to the top