Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamilo Bernal2012-08-29 18:16:58 +0000
committerRoland Grunberg2012-08-30 19:01:47 +0000
commit9a4d05c6b9e961698d972a40ee9c82e75f5b9560 (patch)
tree40a634d21236f36a834251557c6a436a87a34c2d /profiling/org.eclipse.linuxtools.profiling.snapshot
parent22fc65336632594d6ee4a2bca3014a5ec5c45bed (diff)
downloadorg.eclipse.linuxtools-9a4d05c6b9e961698d972a40ee9c82e75f5b9560.tar.gz
org.eclipse.linuxtools-9a4d05c6b9e961698d972a40ee9c82e75f5b9560.tar.xz
org.eclipse.linuxtools-9a4d05c6b9e961698d972a40ee9c82e75f5b9560.zip
Refactor snapshot launch provider plug-in to use provider plug-in.
Refactor snapshot launch provider to extend needed functionality provided by the org.eclipse.linuxtools.profiling.provider plug-in. Change-Id: Ief597e9946fdd721bc86971f547804bffdd95cfb Reviewed-on: https://git.eclipse.org/r/7497 Tested-by: Hudson CI Reviewed-by: Roland Grunberg <rgrunber@redhat.com> IP-Clean: Roland Grunberg <rgrunber@redhat.com> Tested-by: Roland Grunberg <rgrunber@redhat.com>
Diffstat (limited to 'profiling/org.eclipse.linuxtools.profiling.snapshot')
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.snapshot/META-INF/MANIFEST.MF4
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.snapshot/plugin.xml5
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/SnapshotLaunchConfigurationTabGroup.java8
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/SnapshotOptionsTab.java216
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/SnapshotPreferencesPage.java74
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/SnapshotProviderPlugin.java71
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/Messages.java27
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/SnapshotLaunchConfigurationDelegate.java64
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/SnapshotLaunchShortcut.java26
-rw-r--r--profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/messages.properties4
10 files changed, 122 insertions, 377 deletions
diff --git a/profiling/org.eclipse.linuxtools.profiling.snapshot/META-INF/MANIFEST.MF b/profiling/org.eclipse.linuxtools.profiling.snapshot/META-INF/MANIFEST.MF
index c4d35b56bd..7118b477bd 100644
--- a/profiling/org.eclipse.linuxtools.profiling.snapshot/META-INF/MANIFEST.MF
+++ b/profiling/org.eclipse.linuxtools.profiling.snapshot/META-INF/MANIFEST.MF
@@ -7,10 +7,12 @@ Bundle-Vendor: Eclipse
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.debug.ui,
- org.eclipse.ui.ide
+ org.eclipse.ui.ide,
+ org.eclipse.linuxtools.profiling.provider;bundle-version="1.1.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Import-Package: org.eclipse.cdt.core.model,
org.eclipse.cdt.launch,
org.eclipse.linuxtools.internal.profiling.launch,
org.eclipse.linuxtools.profiling.launch
+Bundle-Activator: org.eclipse.linuxtools.profiling.snapshot.SnapshotProviderPlugin
diff --git a/profiling/org.eclipse.linuxtools.profiling.snapshot/plugin.xml b/profiling/org.eclipse.linuxtools.profiling.snapshot/plugin.xml
index c6ff06f363..5580fe7b5f 100644
--- a/profiling/org.eclipse.linuxtools.profiling.snapshot/plugin.xml
+++ b/profiling/org.eclipse.linuxtools.profiling.snapshot/plugin.xml
@@ -71,9 +71,10 @@
<extension
point="org.eclipse.ui.preferencePages">
<page
+ category="org.eclipse.linuxtools.profiling.provider.MainPreferencePage"
class="org.eclipse.linuxtools.profiling.snapshot.SnapshotPreferencesPage"
- id="org.eclipse.linuxtools.profiling.snapshot.MainPreferencePage"
- name="Profiling">
+ id="org.eclipse.linuxtools.profiling.snapshot.preferences"
+ name="Snapshot">
</page>
</extension>
diff --git a/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/SnapshotLaunchConfigurationTabGroup.java b/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/SnapshotLaunchConfigurationTabGroup.java
index 8e52ff07f5..f775360d7c 100644
--- a/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/SnapshotLaunchConfigurationTabGroup.java
+++ b/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/SnapshotLaunchConfigurationTabGroup.java
@@ -13,10 +13,14 @@ package org.eclipse.linuxtools.profiling.snapshot;
import java.util.ArrayList;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
-import org.eclipse.linuxtools.profiling.launch.ProfileLaunchConfigurationTabGroup;
+import org.eclipse.linuxtools.internal.profiling.provider.ProviderLaunchConfigurationTabGroup;
+/**
+ * The tab group for this plug-in's launch configuration.
+ *
+ */
public class SnapshotLaunchConfigurationTabGroup extends
- ProfileLaunchConfigurationTabGroup {
+ ProviderLaunchConfigurationTabGroup {
@Override
public AbstractLaunchConfigurationTab[] getProfileTabs() {
diff --git a/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/SnapshotOptionsTab.java b/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/SnapshotOptionsTab.java
index ea7fafd9d4..b5b955037f 100644
--- a/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/SnapshotOptionsTab.java
+++ b/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/SnapshotOptionsTab.java
@@ -10,215 +10,21 @@
*******************************************************************************/
package org.eclipse.linuxtools.profiling.snapshot;
-import java.util.HashMap;
-import java.util.Map.Entry;
-import java.util.Set;
+import org.eclipse.linuxtools.internal.profiling.provider.ProviderOptionsTab;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
-import org.eclipse.debug.ui.ILaunchConfigurationTab;
-import org.eclipse.linuxtools.profiling.launch.ProfileLaunchConfigurationTab;
-import org.eclipse.linuxtools.profiling.launch.ProfileLaunchConfigurationTabGroup;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-
-public class SnapshotOptionsTab extends ProfileLaunchConfigurationTab {
-
- Composite top;
- Combo providerCombo;
- AbstractLaunchConfigurationTab[] tabs;
- ILaunchConfiguration initial;
- HashMap<String, String> comboItems;
- CTabFolder tabgroup;
- Boolean initialized;
-
- 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 = ProfileLaunchConfigurationTabGroup
- .getProviderNamesForType("snapshot");
- Set<String> providerNames = comboItems.keySet();
- providerCombo.setItems(providerNames.toArray(new String[0]));
-
- tabgroup = new CTabFolder(top, SWT.NONE);
- tabgroup.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true,
- true));
-
- providerCombo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- String curProviderId = comboItems.get(providerCombo.getText());
- loadTabGroupItems(tabgroup, curProviderId);
- initializeFrom(initial);
- top.layout();
- }
- });
- }
-
- public void loadTabGroupItems(CTabFolder tabgroup, String curProviderId){
- // dispose of old tabs
- for (CTabItem item : tabgroup.getItems()) {
- item.dispose();
- }
-
- ProfileLaunchConfigurationTabGroup tabGroupConfig;
-
- if (curProviderId == null || "".equals(curProviderId)) {
- // get id of highest priority provider
- curProviderId = ProfileLaunchConfigurationTabGroup
- .getHighestProviderId("snapshot");
- }
- tabGroupConfig = ProfileLaunchConfigurationTabGroup
- .getTabGroupProviderFromId(curProviderId);
- if (tabGroupConfig == null) {
- // no provider found
- return;
- }
- tabs = tabGroupConfig.getProfileTabs();
- setProvider(curProviderId);
-
- // Show provider name in combo.
- int itemIndex = getComboItemIndexFromId(curProviderId);
- providerCombo.select(itemIndex);
-
- // create the tab item, and load the specified tab inside
- for (ILaunchConfigurationTab tab : tabs) {
- tab.setLaunchConfigurationDialog(getLaunchConfigurationDialog());
- CTabItem item = new CTabItem(tabgroup, SWT.NONE);
- item.setText(tab.getName());
- item.setImage(tab.getImage());
-
- tab.createControl(tabgroup);
- item.setControl(tab.getControl());
- }
- }
-
- public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
- if (providerCombo != null && !providerCombo.getText().equals("")) {
- for (AbstractLaunchConfigurationTab tab : tabs) {
- tab.setDefaults(configuration);
- }
- }
- }
-
- public void initializeFrom(ILaunchConfiguration configuration) {
- /**
- * First time the configuration is selected.
- *
- * This is a cheap way to get access to the launch configuration.
- * Our tabs are loaded dynamically, so the tab group doesn't "know"
- * about them. We get access to this launch configuration to ensure
- * that we can properly load the widgets the first time.
- */
-
- // starting initialization of this tab's controls
- initialized = false;
-
- // update current configuration (initial) with configuration being
- // passed in
- initial = configuration;
-
- // check if there exists a launch provider id in the configuration
- if (initial != null) {
- try {
- String providerId = initial.getAttribute("provider", "");
- if (providerId != null && !providerId.equals("")) {
- // load provider corresponding to specified id
- loadTabGroupItems(tabgroup, providerId);
- } else {
- // load highest priority provider if none found
- loadTabGroupItems(tabgroup, null);
- }
- } catch (CoreException e) {
- // continue, initialize tabs
- }
- }
- if (tabs != null) {
- for (AbstractLaunchConfigurationTab tab : tabs) {
- tab.initializeFrom(configuration);
- }
- }
- // finished initialization
- initialized = true;
- }
-
- public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- // make sure tabs are not null, and the tab's controls have been initialized.
- if (tabs != null && initialized) {
- for (AbstractLaunchConfigurationTab tab : tabs) {
- tab.performApply(configuration);
- }
- }
- }
+/**
+ * The options tab used for this plug-in's launch configuration tab group.
+ *
+ */
+public class SnapshotOptionsTab extends ProviderOptionsTab {
public String getName() {
- return "Snapshot";
- }
-
- /**
- * Set the provider attribute in the specified configuration.
- * @param configuration a configuration
- */
- public void setProvider(String providerId) {
- try {
- ILaunchConfigurationWorkingCopy wc = initial.getWorkingCopy();
- wc.setAttribute("provider", providerId);
- initial = wc.doSave();
- } catch (CoreException e1) {
- e1.printStackTrace();
- }
+ return SnapshotProviderPlugin.PLUGIN_NAME;
}
- /**
- * Get Combo item name from specified id
- *
- * @param id provider id
- * @return name of item, <code>null</code> if no entry found with given id.
- */
- private String getComboItemNameFromId(String id) {
- for (Entry<String, String> entry : comboItems.entrySet()) {
- if (id.equals(entry.getValue())) {
- return entry.getKey();
- }
- }
- return null;
+ @Override
+ protected String getProfilingType() {
+ return SnapshotProviderPlugin.PROFILING_TYPE;
}
- /**
- * Get index of specific name in the combo items list
- *
- * @param name name of item
- * @return index of given name, -1 if it not found
- */
- private int getItemIndex(String name) {
- int itemCount = providerCombo.getItemCount();
- for (int i = 0; i < itemCount; i++) {
- if (providerCombo.getItem(i).equals(name)) {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * Get index of specific id in the combo items list
- *
- * @param id
- * @return index of given id in combo items list, -1 if it not found.
- */
- private int getComboItemIndexFromId(String id) {
- String providerName = getComboItemNameFromId(id);
- return getItemIndex(providerName);
- }
-}
+} \ No newline at end of file
diff --git a/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/SnapshotPreferencesPage.java b/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/SnapshotPreferencesPage.java
index 459cec78a1..d91262666a 100644
--- a/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/SnapshotPreferencesPage.java
+++ b/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/SnapshotPreferencesPage.java
@@ -11,74 +11,16 @@
package org.eclipse.linuxtools.profiling.snapshot;
-import java.util.HashMap;
-import java.util.Map.Entry;
+import org.eclipse.linuxtools.internal.profiling.provider.AbstractProviderPreferencesPage;
-import org.eclipse.core.runtime.preferences.ConfigurationScope;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.RadioGroupFieldEditor;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.preferences.ScopedPreferenceStore;
-import org.eclipse.linuxtools.profiling.launch.ProfileLaunchConfigurationTabGroup;
-import org.eclipse.linuxtools.profiling.launch.ProfileLaunchShortcut;
-import org.eclipse.linuxtools.profiling.snapshot.launch.Messages;
-
-public class SnapshotPreferencesPage extends FieldEditorPreferencePage
- implements IWorkbenchPreferencePage {
-
- private static final String TYPE = "snapshot"; //$NON-NLS-1$
- public static final String KEY = "provider"; //$NON-NLS-1$
- public static final String QUALIFIER = "org.eclipse.linuxtools.profiling.snapshot"; //$NON-NLS-1$
- private static IScopeContext configScopeInstance = ConfigurationScope.INSTANCE;
-
- public void init(IWorkbench workbench) {
- final IPreferenceStore store = new ScopedPreferenceStore(
- configScopeInstance, QUALIFIER);
- setPreferenceStore(store);
- setDescription(Messages.SnapshotPreferencesPage_0);
- }
+/**
+ * The preferences page for this plug-in.
+ *
+ */
+public class SnapshotPreferencesPage extends AbstractProviderPreferencesPage {
@Override
- protected void createFieldEditors() {
- HashMap<String, String> map = ProfileLaunchConfigurationTabGroup
- .getProviderNamesForType(TYPE);
- // 2d array containing launch provider names on the first column and
- // corresponding id's on the second.
- String[][] providerList = new String[map.size()][2];
- int i = 0;
- for (Entry<String, String> entry : map.entrySet()) {
- providerList[i][0] = entry.getKey();
- providerList[i][1] = entry.getValue();
- i++;
- }
- RadioGroupFieldEditor editor = new RadioGroupFieldEditor(KEY,
- Messages.SnapshotPreferencesPage_1, 1, providerList,
- getFieldEditorParent());
- addField(editor);
- }
-
- public SnapshotPreferencesPage() {
- super(GRID);
- }
-
- public void initializeDefaultPreferences() {
- super.performDefaults();
- String providerId = ProfileLaunchShortcut
- .getDefaultLaunchShortcutProviderId(TYPE);
- configScopeInstance.getNode(QUALIFIER).put(KEY, providerId);
- }
-
- /**
- * Get id of launch provider in the preference store.
- *
- * @return unique launch provider identifier.
- * @since 1.2
- */
- public static String getSelectedProviderId() {
- return configScopeInstance.getNode(QUALIFIER).get(KEY, "");
-
+ public String getProfilingType() {
+ return SnapshotProviderPlugin.PROFILING_TYPE;
}
} \ No newline at end of file
diff --git a/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/SnapshotProviderPlugin.java b/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/SnapshotProviderPlugin.java
new file mode 100644
index 0000000000..861d9713fc
--- /dev/null
+++ b/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/SnapshotProviderPlugin.java
@@ -0,0 +1,71 @@
+package org.eclipse.linuxtools.profiling.snapshot;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class SnapshotProviderPlugin extends AbstractUIPlugin {
+
+ /**
+ * Plug-in name
+ */
+ public static final String PLUGIN_NAME = "Snapshot"; //$NON-NLS-1$
+
+ /**
+ * Plug-in id
+ */
+ public static final String PLUGIN_ID = "org.eclipse.linuxtools.profiling.snapshot"; //$NON-NLS-1$
+
+ /**
+ * Plug-in id of snapshot launch configuration type
+ */
+ public static final String PLUGIN_CONFIG_ID = "org.eclipse.linuxtools.profiling.snapshot.launchConfigurationType"; //$NON-NLS-1$
+
+ /**
+ * Type of profiling this plug-in supports
+ */
+ public static final String PROFILING_TYPE = "snapshot"; //$NON-NLS-1$
+
+ /**
+ * The shared instance
+ */
+ private static SnapshotProviderPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public SnapshotProviderPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static SnapshotProviderPlugin getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/Messages.java b/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/Messages.java
deleted file mode 100644
index eb417493c8..0000000000
--- a/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/Messages.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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 initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.profiling.snapshot.launch;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.linuxtools.profiling.snapshot.launch.messages"; //$NON-NLS-1$
- public static String SnapshotLaunchShortcut_0;
- public static String SnapshotPreferencesPage_0;
- public static String SnapshotPreferencesPage_1;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
diff --git a/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/SnapshotLaunchConfigurationDelegate.java b/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/SnapshotLaunchConfigurationDelegate.java
index 9c16a26f4e..ccbd1442bc 100644
--- a/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/SnapshotLaunchConfigurationDelegate.java
+++ b/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/SnapshotLaunchConfigurationDelegate.java
@@ -10,67 +10,23 @@
*******************************************************************************/
package org.eclipse.linuxtools.profiling.snapshot.launch;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.preferences.ConfigurationScope;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.linuxtools.profiling.launch.ProfileLaunchConfigurationDelegate;
-import org.eclipse.linuxtools.profiling.launch.ProfileLaunchConfigurationTabGroup;
-import org.eclipse.linuxtools.profiling.launch.ProfileLaunchShortcut;
-import org.eclipse.linuxtools.profiling.snapshot.SnapshotPreferencesPage;
+import org.eclipse.linuxtools.internal.profiling.provider.launch.ProviderLaunchConfigurationDelegate;
+import org.eclipse.linuxtools.profiling.snapshot.SnapshotProviderPlugin;
+/**
+ * The launch configuration delegate for this plug-in.
+ *
+ */
public class SnapshotLaunchConfigurationDelegate extends
- ProfileLaunchConfigurationDelegate {
-
- private static final String SNAPSHOT = "snapshot"; //$NON-NLS-1$
+ ProviderLaunchConfigurationDelegate {
@Override
protected String getPluginID() {
- return "org.eclipse.linuxtools.profiling.snapshot";
- }
-
- @Override
- public void launch(ILaunchConfiguration config, String mode,
- ILaunch launch, IProgressMonitor monitor) {
- try {
-
- if (config != null) {
- // get provider id from configuration.
- String providerId = config.getAttribute("provider", "");
- if (providerId.equals("")) {
- providerId = getProviderIdToRun();
- }
- // get configuration delegate associated with provider id.
- ProfileLaunchConfigurationDelegate delegate = getConfigurationDelegateFromId(providerId);
- if (delegate != null) {
- delegate.launch(config, mode, launch, monitor);
- }
- }
- } catch (CoreException e) {
- e.printStackTrace();
- }
- return;
- }
-
- private String getProviderIdToRun() {
- // Get self assigned default
- String providerId = ConfigurationScope.INSTANCE.getNode(SnapshotPreferencesPage.QUALIFIER).get(SnapshotPreferencesPage.KEY, "");
- if (providerId == "") {
- providerId = ProfileLaunchConfigurationTabGroup
- .getHighestProviderId(SNAPSHOT);
- if (providerId == "") {
- // Get highest priority provider
- providerId = ProfileLaunchShortcut
- .getDefaultLaunchShortcutProviderId(SNAPSHOT);
- }
- }
- return providerId;
+ return SnapshotProviderPlugin.PLUGIN_ID;
}
@Override
- public String generateCommand(ILaunchConfiguration config) {
- return null;
+ public String getProfilingType() {
+ return SnapshotProviderPlugin.PROFILING_TYPE;
}
-
}
diff --git a/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/SnapshotLaunchShortcut.java b/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/SnapshotLaunchShortcut.java
index 81bacab24c..718b2be731 100644
--- a/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/SnapshotLaunchShortcut.java
+++ b/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/SnapshotLaunchShortcut.java
@@ -7,28 +7,22 @@
*
* Contributors:
* Red Hat initial API and implementation
- *******************************************************************************/
+ *******************************************************************************/
package org.eclipse.linuxtools.profiling.snapshot.launch;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.linuxtools.profiling.launch.ProfileLaunchShortcut;
+import org.eclipse.linuxtools.internal.profiling.provider.launch.ProviderLaunchShortcut;
+import org.eclipse.linuxtools.profiling.snapshot.SnapshotProviderPlugin;
-public class SnapshotLaunchShortcut extends ProfileLaunchShortcut {
-
- public static final String LAUNCHCONF_ID = "org.eclipse.linuxtools.profiling.snapshot.launchConfigurationType";
+/**
+ * The launch shortcut for this plug-in.
+ *
+ */
+public class SnapshotLaunchShortcut extends ProviderLaunchShortcut {
@Override
- protected ILaunchConfigurationType getLaunchConfigType() {
- return getLaunchManager().getLaunchConfigurationType(LAUNCHCONF_ID);
+ protected String getLaunchConfigID() {
+ return SnapshotProviderPlugin.PLUGIN_CONFIG_ID;
}
- @Override
- protected void setDefaultProfileAttributes(
- ILaunchConfigurationWorkingCopy wc) {
- wc.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, false);
- wc.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true);
- }
}
diff --git a/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/messages.properties b/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/messages.properties
deleted file mode 100644
index 1b431f5096..0000000000
--- a/profiling/org.eclipse.linuxtools.profiling.snapshot/src/org/eclipse/linuxtools/profiling/snapshot/launch/messages.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-SnapshotLaunchShortcut_0=Could not find a provider for profiling type :
-SnapshotPreferencesPage_0=Profiling Preferences
-SnapshotPreferencesPage_1=Choose default snapshot launch provider
-

Back to the top