Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjszursze2002-01-21 19:42:15 +0000
committerjszursze2002-01-21 19:42:15 +0000
commit2e4bdc807d6b28cafffbf776b2aa1a4f32486314 (patch)
tree5521c645e0385b4e0f92d7f69b426f0c6bbb4a85
parent91654253b5ed321619c3a00cd82f70169f605859 (diff)
downloadeclipse.platform.debug-2e4bdc807d6b28cafffbf776b2aa1a4f32486314.tar.gz
eclipse.platform.debug-2e4bdc807d6b28cafffbf776b2aa1a4f32486314.tar.xz
eclipse.platform.debug-2e4bdc807d6b28cafffbf776b2aa1a4f32486314.zip
more launch config work
-rw-r--r--org.eclipse.debug.ui/plugin.xml11
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchConfigurationTypesPreferencePage.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CommonTab.java (renamed from org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/TeamTab.java)299
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveTab.java401
4 files changed, 302 insertions, 411 deletions
diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml
index e7a62cd5e..089b8e132 100644
--- a/org.eclipse.debug.ui/plugin.xml
+++ b/org.eclipse.debug.ui/plugin.xml
@@ -449,15 +449,10 @@
<extension point = "org.eclipse.debug.ui.launchConfigurationTabs">
<launchConfigurationTab
- id="org.eclipse.debug.ui.launchConfigurationTab.team"
- class="org.eclipse.debug.internal.ui.launchConfigurations.TeamTab"
- name="Team">
+ id="org.eclipse.debug.ui.launchConfigurationTab.common"
+ class="org.eclipse.debug.internal.ui.launchConfigurations.CommonTab"
+ name="Common">
</launchConfigurationTab>
- <launchConfigurationTab
- id="org.eclipse.debug.ui.launchConfigurationTab.perspective"
- class="org.eclipse.debug.internal.ui.launchConfigurations.PerspectiveTab"
- name="Perspective">
- </launchConfigurationTab>
</extension>
</plugin>
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchConfigurationTypesPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchConfigurationTypesPreferencePage.java
index f9e434c71..09beb95d2 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchConfigurationTypesPreferencePage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LaunchConfigurationTypesPreferencePage.java
@@ -268,7 +268,7 @@ public class LaunchConfigurationTypesPreferencePage extends PreferencePage imple
setDefaultButton(new Button(topComp, SWT.PUSH));
getDefaultButton().setText("Set as default");
getDefaultButton().addSelectionListener(new SelectionAdapter() {
- public void widgetSelection(SelectionEvent evt) {
+ public void widgetSelected(SelectionEvent evt) {
handleDefaultButtonSelected();
}
});
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/TeamTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CommonTab.java
index 4ce1380df..44ae386a5 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/TeamTab.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/CommonTab.java
@@ -9,9 +9,11 @@ import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
import org.eclipse.swt.SWT;
@@ -22,12 +24,16 @@ import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IPerspectiveDescriptor;
+import org.eclipse.ui.IPerspectiveRegistry;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.ContainerSelectionDialog;
/**
@@ -35,7 +41,7 @@ import org.eclipse.ui.dialogs.ContainerSelectionDialog;
* types. It collects information that governs where the configuration is stored,
* and whether or not it is shared via standard VCM mechanisms.
*/
-public class TeamTab implements ILaunchConfigurationTab {
+public class CommonTab implements ILaunchConfigurationTab {
// Flag that when true, prevents the owning dialog's status area from getting updated.
// Used when multiple config attributes are getting updated at once.
@@ -51,6 +57,31 @@ public class TeamTab implements ILaunchConfigurationTab {
private Text fSharedLocationText;
private Button fSharedLocationButton;
+ /**
+ * The combo box specifying the run perspective
+ */
+ private Combo fRunPerspectiveCombo;
+
+ /**
+ * The combo box specifying the debug perspective
+ */
+ private Combo fDebugPerspectiveCombo;
+
+ /**
+ * The check box specifying whether to use the run perspective
+ */
+ private Button fRunPerspectiveButton;
+
+ /**
+ * The check box specifying whether to use the debug perspective
+ */
+ private Button fDebugPerspectiveButton;
+
+ /**
+ * The label that acts as header for the 'switch to perspective' widgets
+ */
+ private Label fSwitchToLabel;
+
// The launch configuration dialog that owns this tab
private ILaunchConfigurationDialog fLaunchConfigurationDialog;
@@ -142,6 +173,65 @@ public class TeamTab implements ILaunchConfigurationTab {
getLocalRadioButton().setSelection(true);
setSharedEnabled(false);
+ createVerticalSpacer(comp);
+ createVerticalSpacer(comp);
+
+ setSwitchToLabel(new Label(comp, SWT.HORIZONTAL | SWT.LEFT));
+ getSwitchToLabel().setText("Switch to/Open perspective when launched:");
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.BEGINNING;
+ gd.horizontalSpan = 3;
+ getSwitchToLabel().setLayoutData(gd);
+
+ Composite perspComp = new Composite(comp, SWT.NONE);
+ GridLayout perspLayout = new GridLayout();
+ perspLayout.numColumns = 2;
+ perspComp.setLayout(perspLayout);
+
+ setRunPerspectiveButton(new Button(perspComp, SWT.CHECK));
+ getRunPerspectiveButton().setText("Run Mode:");
+ getRunPerspectiveButton().addSelectionListener(
+ new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ updateConfigFromRunPerspective();
+ }
+ }
+ );
+
+ setRunPerspectiveCombo(new Combo(perspComp, SWT.DROP_DOWN | SWT.READ_ONLY));
+ gd = new GridData(GridData.GRAB_HORIZONTAL);
+ getRunPerspectiveCombo().setLayoutData(gd);
+ getRunPerspectiveCombo().addSelectionListener(
+ new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ updateConfigFromRunPerspective();
+ }
+ }
+ );
+ fillWithPerspectives(getRunPerspectiveCombo());
+
+ setDebugPerspectiveButton(new Button(perspComp, SWT.CHECK));
+ getDebugPerspectiveButton().setText("Debug Mode:");
+ getDebugPerspectiveButton().addSelectionListener(
+ new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ updateConfigFromDebugPerspective();
+ }
+ }
+ );
+
+ setDebugPerspectiveCombo(new Combo(perspComp, SWT.DROP_DOWN |SWT.READ_ONLY));
+ gd = new GridData(GridData.GRAB_HORIZONTAL);
+ getDebugPerspectiveCombo().setLayoutData(gd);
+ getDebugPerspectiveCombo().addSelectionListener(
+ new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ updateConfigFromDebugPerspective();
+ }
+ }
+ );
+ fillWithPerspectives(getDebugPerspectiveCombo());
+
return comp;
}
@@ -208,6 +298,94 @@ public class TeamTab implements ILaunchConfigurationTab {
return fSharedRadioButton;
}
+ /**
+ * Returns the perspective combo assoicated with the
+ * debug perspective button.
+ *
+ * @return a combo box
+ */
+ protected Combo getDebugPerspectiveCombo() {
+ return fDebugPerspectiveCombo;
+ }
+
+ /**
+ * Sets the perspective combo assoicated with the
+ * debug perspective button.
+ *
+ * @param combo a combo box
+ */
+ private void setDebugPerspectiveCombo(Combo combo) {
+ fDebugPerspectiveCombo = combo;
+ }
+
+ /**
+ * Returns the check box indicating whether the perspective should
+ * be changed when the configuration is launched in debug mode.
+ *
+ * @return a check box button
+ */
+ protected Button getDebugPerspectiveButton() {
+ return fDebugPerspectiveButton;
+ }
+
+ /**
+ * Sets the check box indicating whether the perspective should
+ * be changed when the configuration is launched in debug mode.
+ *
+ * @param button a check box button
+ */
+ private void setDebugPerspectiveButton(Button button) {
+ fDebugPerspectiveButton = button;
+ }
+
+ /**
+ * Returns the perspective combo assoicated with the
+ * run perspective button.
+ *
+ * @return a combo box
+ */
+ protected Combo getRunPerspectiveCombo() {
+ return fRunPerspectiveCombo;
+ }
+
+ /**
+ * Sets the perspective combo assoicated with the
+ * run perspective button.
+ *
+ * @param combo a combo box
+ */
+ private void setRunPerspectiveCombo(Combo combo) {
+ fRunPerspectiveCombo = combo;
+ }
+
+ /**
+ * Returns the check box indicating whether the perspective should
+ * be changed when the configuration is launched in run mode.
+ *
+ * @return a check box button
+ */
+ protected Button getRunPerspectiveButton() {
+ return fRunPerspectiveButton;
+ }
+
+ /**
+ * Sets the check box indicating whether the perspective should
+ * be changed when the configuration is launched in run mode.
+ *
+ * @param button a check box button
+ */
+ private void setRunPerspectiveButton(Button button) {
+ fRunPerspectiveButton = button;
+ }
+
+ private void setSwitchToLabel(Label switchToLabel) {
+ fSwitchToLabel = switchToLabel;
+ }
+
+ private Label getSwitchToLabel() {
+ return fSwitchToLabel;
+ }
+
protected void handleSharedRadioButtonSelected() {
setSharedEnabled(isShared());
updateConfigFromLocalShared();
@@ -248,6 +426,42 @@ public class TeamTab implements ILaunchConfigurationTab {
}
/**
+ * Returns the perspective with the given label, or
+ * <code>null</code> if none is found.
+ *
+ * @param label perspective label
+ * @return perspective descriptor
+ */
+ protected IPerspectiveDescriptor getPerspectiveWithLabel(String label) {
+ return PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithLabel(label);
+ }
+
+ /**
+ * Returns the perspective with the given id, or
+ * <code>null</code> if none is found.
+ *
+ * @param id perspective identifier
+ * @return perspective descriptor
+ */
+ protected IPerspectiveDescriptor getPerspectiveWithId(String id) {
+ return PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(id);
+ }
+
+ /**
+ * Fills the given combo box with the labels of all existing
+ * perspectives.
+ *
+ * @param combo combo box
+ */
+ protected void fillWithPerspectives(Combo combo) {
+ IPerspectiveRegistry reg = PlatformUI.getWorkbench().getPerspectiveRegistry();
+ IPerspectiveDescriptor[] persps = reg.getPerspectives();
+ for (int i = 0; i < persps.length; i++) {
+ combo.add(persps[i].getLabel());
+ }
+ }
+
+ /**
* @see ILaunchConfigurationTab#setLaunchConfiguration(ILaunchConfigurationWorkingCopy)
*/
public void setLaunchConfiguration(ILaunchConfigurationWorkingCopy launchConfiguration) {
@@ -269,6 +483,8 @@ public class TeamTab implements ILaunchConfigurationTab {
protected void updateWidgetsFromConfig(ILaunchConfiguration config) {
updateLocalSharedFromConfig(config);
updateSharedLocationFromConfig(config);
+ updateRunPerspectiveFromConfig(config);
+ updateDebugPerspectiveFromConfig(config);
}
protected void updateLocalSharedFromConfig(ILaunchConfiguration config) {
@@ -287,6 +503,52 @@ public class TeamTab implements ILaunchConfigurationTab {
}
}
+ protected void updateRunPerspectiveFromConfig(ILaunchConfiguration config) {
+ String runPerspID = null;
+ try {
+ runPerspID = config.getAttribute(IDebugUIConstants.ATTR_TARGET_RUN_PERSPECTIVE, null);
+ } catch (CoreException ce) {
+ }
+ updateButtonAndCombo(getRunPerspectiveButton(), getRunPerspectiveCombo(), runPerspID);
+ }
+
+ protected void updateDebugPerspectiveFromConfig(ILaunchConfiguration config) {
+ String debugPerspID = null;
+ try {
+ debugPerspID = config.getAttribute(IDebugUIConstants.ATTR_TARGET_DEBUG_PERSPECTIVE, null);
+ } catch (CoreException ce) {
+ }
+ updateButtonAndCombo(getDebugPerspectiveButton(), getDebugPerspectiveCombo(), debugPerspID);
+ }
+
+ /**
+ * Based on the given perspective identifier, update the settings
+ * of the button and associated combo box. The check box is selected
+ * when there is a valid perspective, and the combo box is set to
+ * display the label of the associated perspective. The check box is
+ * deselected, and the combo box is set to the default value (debug
+ * perspective) when the identfier is <code>null</code>.
+ *
+ * @param button check box button
+ * @param combo combo box with perspective labels
+ * @param id perspective identifier or <code>null</code>
+ */
+ protected void updateButtonAndCombo(Button button, Combo combo, String id) {
+ if (id == null) {
+ button.setSelection(false);
+ combo.setText(getPerspectiveWithId(IDebugUIConstants.ID_DEBUG_PERSPECTIVE).getLabel());
+ } else {
+ button.setSelection(true);
+ IPerspectiveDescriptor pd = getPerspectiveWithId(id);
+ if (pd == null) {
+ // perpective does not exist - reset
+ updateButtonAndCombo(button, combo, null);
+ } else {
+ combo.setText(pd.getLabel());
+ }
+ }
+ }
+
protected void updateConfigFromLocalShared() {
if (getWorkingCopy() != null) {
if (isShared()) {
@@ -295,6 +557,41 @@ public class TeamTab implements ILaunchConfigurationTab {
} else {
getWorkingCopy().setContainer(null);
}
+ refreshStatus();
+ }
+ }
+
+ /**
+ * Update the run perspective attribute based on current
+ * UI settings.
+ */
+ protected void updateConfigFromRunPerspective() {
+ if (getRunPerspectiveButton().getSelection()) {
+ getWorkingCopy().setAttribute(IDebugUIConstants.ATTR_TARGET_RUN_PERSPECTIVE,
+ getPerspectiveWithLabel(getRunPerspectiveCombo().getText()).getId());
+ } else {
+ getWorkingCopy().setAttribute(IDebugUIConstants.ATTR_TARGET_RUN_PERSPECTIVE, null);
+ }
+ refreshStatus();
+ }
+
+ /**
+ * Update the debug perspective attribute based on current
+ * UI settings.
+ */
+ protected void updateConfigFromDebugPerspective() {
+ if (getDebugPerspectiveButton().getSelection()) {
+ getWorkingCopy().setAttribute(IDebugUIConstants.ATTR_TARGET_DEBUG_PERSPECTIVE,
+ getPerspectiveWithLabel(getDebugPerspectiveCombo().getText()).getId());
+ } else {
+ getWorkingCopy().setAttribute(IDebugUIConstants.ATTR_TARGET_DEBUG_PERSPECTIVE, null);
+ }
+ refreshStatus();
+ }
+
+ protected void refreshStatus() {
+ if (!isBatchUpdate()) {
+ getLaunchDialog().refreshStatus();
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveTab.java
deleted file mode 100644
index 7e2c57843..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/PerspectiveTab.java
+++ /dev/null
@@ -1,401 +0,0 @@
-package org.eclipse.debug.internal.ui.launchConfigurations;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.debug.ui.ILaunchConfigurationDialog;
-import org.eclipse.debug.ui.ILaunchConfigurationTab;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.TabItem;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IPerspectiveRegistry;
-import org.eclipse.ui.PlatformUI;
-
-public class PerspectiveTab implements ILaunchConfigurationTab {
-
- /**
- * The dialog this tab is being displayed in.
- */
- private ILaunchConfigurationDialog fDialog;
-
- /**
- * The current launch configuration being displayed
- */
- private ILaunchConfigurationWorkingCopy fLaunchConfiguration;
-
- /**
- * The combo box specifying the run perspective
- */
- private Combo fRunCombo;
-
- /**
- * The combo box specifying the debug perspective
- */
- private Combo fDebugCombo;
-
- /**
- * The check box specifying whether to use the run perspective
- */
- private Button fRunPerspectiveButton;
-
- /**
- * The check box specifying whether to use the debug perspective
- */
- private Button fDebugPerspectiveButton;
-
- /**
- * @see ILaunchConfigurationTab#createTabControl(TabItem)
- */
- public Control createTabControl(ILaunchConfigurationDialog dialog, TabItem tabItem) {
- setLaunchDialog(dialog);
-
- Composite comp = new Composite(tabItem.getParent(), SWT.NONE);
- GridLayout topLayout = new GridLayout();
- topLayout.numColumns = 3;
- comp.setLayout(topLayout);
- GridData gd;
-
- createVerticalSpacer(comp, 3);
-
- Label label = new Label(comp, SWT.HORIZONTAL | SWT.LEFT);
- label.setText("Open/switch perspective when launched:");
- gd = new GridData();
- gd.horizontalAlignment = GridData.BEGINNING;
- gd.horizontalSpan = 3;
- label.setLayoutData(gd);
-
- Button button = new Button(comp, SWT.CHECK);
- button.setText("Run Mode:");
- gd = new GridData();
- gd.horizontalAlignment = GridData.BEGINNING;
- gd.horizontalSpan = 1;
- button.setLayoutData(gd);
- setRunPerspectiveButton(button);
-
- Combo combo = new Combo(comp, SWT.DROP_DOWN | SWT.READ_ONLY);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- combo.setLayoutData(gd);
- fillWithPerspectives(combo);
- setRunCombo(combo);
-
- button = new Button(comp, SWT.CHECK);
- button.setText("Debug Mode:");
- gd = new GridData();
- gd.horizontalAlignment = GridData.BEGINNING;
- gd.horizontalSpan = 1;
- button.setLayoutData(gd);
- setDebugPerspectiveButton(button);
-
- combo = new Combo(comp, SWT.DROP_DOWN |SWT.READ_ONLY);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- combo.setLayoutData(gd);
- fillWithPerspectives(combo);
- setDebugCombo(combo);
-
- initializeEventHandling();
-
- return comp;
- }
-
- /**
- * @see ILaunchConfigurationTab#setLaunchConfiguration(ILaunchConfigurationWorkingCopy)
- */
- public void setLaunchConfiguration(ILaunchConfigurationWorkingCopy launchConfiguration) {
- fLaunchConfiguration = launchConfiguration;
-
- try {
- // initialize the run perspective setting
- initializeButtonAndCombo(getRunPerspectiveButton(), getRunCombo(),
- launchConfiguration.getAttribute(IDebugUIConstants.ATTR_TARGET_RUN_PERSPECTIVE, null));
-
- // initialize the debug perspective setting
- initializeButtonAndCombo(getDebugPerspectiveButton(), getDebugCombo(),
- launchConfiguration.getAttribute(IDebugUIConstants.ATTR_TARGET_DEBUG_PERSPECTIVE, null));
- } catch (CoreException e) {
- DebugUIPlugin.errorDialog(getShell(), "Error", "Unable to initialize Perspective tab.", e.getStatus());
- }
- }
-
- /**
- * Based in the given perspective identifier, initialize the settings
- * of the button and associated combo box. The check box is selected
- * when there is a valid perspective, and the combo box is set to
- * display the label of the associated perspective. The check box is
- * deselected, and the combo box is set to the default value (debug
- * perspective) when the identfier is <code>null</code>.
- *
- * @param button check box button
- * @param combo combo box with perspective labels
- * @param id perspective identifier or <code>null</code>
- */
- protected void initializeButtonAndCombo(Button button, Combo combo, String id) {
- if (id == null) {
- button.setSelection(false);
- combo.setText(getPerspectiveWithId(IDebugUIConstants.ID_DEBUG_PERSPECTIVE).getLabel());
- } else {
- button.setSelection(true);
- IPerspectiveDescriptor pd = getPerspectiveWithId(id);
- if (pd == null) {
- // perpective does not exist - reset
- initializeButtonAndCombo(button, combo, null);
- } else {
- combo.setText(pd.getLabel());
- }
- }
- }
-
- /**
- * Returns the launch configuration currently being displayed.
- */
- protected ILaunchConfigurationWorkingCopy getLaunchConfiguration() {
- return fLaunchConfiguration;
- }
-
- /*
- * @see ILaunchConfigurationTab#dispose()
- */
- public void dispose() {
- }
-
- /**
- * Sets the dialog this tab is being displayed in
- *
- * @param dialog launch configuration dialog
- */
- private void setLaunchDialog(ILaunchConfigurationDialog dialog) {
- fDialog = dialog;
- }
-
- /**
- * Returns the dialog this tab is being displayed in
- *
- * @return the dialog this tab is being displayed in
- */
- protected ILaunchConfigurationDialog getLaunchDialog() {
- return fDialog;
- }
-
- /**
- * Fills the given combo box with the labels of all existing
- * perspectives.
- *
- * @param combo combo box
- */
- protected void fillWithPerspectives(Combo combo) {
- IPerspectiveRegistry reg = PlatformUI.getWorkbench().getPerspectiveRegistry();
- IPerspectiveDescriptor[] persps = reg.getPerspectives();
- for (int i = 0; i < persps.length; i++) {
- combo.add(persps[i].getLabel());
- }
- }
-
- /**
- * Returns the perspective with the given label, or
- * <code>null</code> if none is found.
- *
- * @param label perspective label
- * @return perspective descriptor
- */
- protected IPerspectiveDescriptor getPerspectiveWithLabel(String label) {
- return PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithLabel(label);
- }
-
- /**
- * Returns the perspective with the given id, or
- * <code>null</code> if none is found.
- *
- * @param id perspective identifier
- * @return perspective descriptor
- */
- protected IPerspectiveDescriptor getPerspectiveWithId(String id) {
- return PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(id);
- }
- /**
- * Returns the perspective combo assoicated with the
- * debug perspective button.
- *
- * @return a combo box
- */
- protected Combo getDebugCombo() {
- return fDebugCombo;
- }
-
- /**
- * Sets the perspective combo assoicated with the
- * debug perspective button.
- *
- * @param combo a combo box
- */
- private void setDebugCombo(Combo combo) {
- fDebugCombo = combo;
- }
-
- /**
- * Returns the check box indicating whether the perspective should
- * be changed when the configuration is launched in debug mode.
- *
- * @return a check box button
- */
- protected Button getDebugPerspectiveButton() {
- return fDebugPerspectiveButton;
- }
-
- /**
- * Sets the check box indicating whether the perspective should
- * be changed when the configuration is launched in debug mode.
- *
- * @param button a check box button
- */
- private void setDebugPerspectiveButton(Button button) {
- fDebugPerspectiveButton = button;
- }
-
- /**
- * Returns the perspective combo assoicated with the
- * run perspective button.
- *
- * @return a combo box
- */
- protected Combo getRunCombo() {
- return fRunCombo;
- }
-
- /**
- * Sets the perspective combo assoicated with the
- * run perspective button.
- *
- * @param combo a combo box
- */
- private void setRunCombo(Combo combo) {
- fRunCombo = combo;
- }
-
- /**
- * Returns the check box indicating whether the perspective should
- * be changed when the configuration is launched in run mode.
- *
- * @return a check box button
- */
- protected Button getRunPerspectiveButton() {
- return fRunPerspectiveButton;
- }
-
- /**
- * Sets the check box indicating whether the perspective should
- * be changed when the configuration is launched in run mode.
- *
- * @param button a check box button
- */
- private void setRunPerspectiveButton(Button button) {
- fRunPerspectiveButton = button;
- }
-
- /**
- * Returns the shell this tab is contained in
- *
- * @return shell
- */
- protected Shell getShell() {
- return getDebugCombo().getShell();
- }
-
- /**
- * Sets up event handlers for the widgets in this tab.
- */
- protected void initializeEventHandling() {
- getRunPerspectiveButton().addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateRunPerspective();
- }
- }
- );
-
- getRunCombo().addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateRunPerspective();
- }
- }
- );
-
- getDebugPerspectiveButton().addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateDebugPerspective();
- }
- }
- );
-
- getDebugCombo().addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateDebugPerspective();
- }
- }
- );
-
- }
-
- /**
- * Update the run perspective attribute based on current
- * UI settings.
- */
- protected void updateRunPerspective() {
- if (getRunPerspectiveButton().getSelection()) {
- getLaunchConfiguration().setAttribute(IDebugUIConstants.ATTR_TARGET_RUN_PERSPECTIVE,
- getPerspectiveWithLabel(getRunCombo().getText()).getId());
- } else {
- getLaunchConfiguration().setAttribute(IDebugUIConstants.ATTR_TARGET_RUN_PERSPECTIVE, null);
- }
- getLaunchDialog().refreshStatus();
- }
-
- /**
- * Update the debug perspective attribute based on current
- * UI settings.
- */
- protected void updateDebugPerspective() {
- if (getDebugPerspectiveButton().getSelection()) {
- getLaunchConfiguration().setAttribute(IDebugUIConstants.ATTR_TARGET_DEBUG_PERSPECTIVE,
- getPerspectiveWithLabel(getDebugCombo().getText()).getId());
- } else {
- getLaunchConfiguration().setAttribute(IDebugUIConstants.ATTR_TARGET_DEBUG_PERSPECTIVE, null);
- }
- getLaunchDialog().refreshStatus();
-
- }
-
- /**
- * Create some empty space
- */
- protected void createVerticalSpacer(Composite comp, int columnWidth) {
- Label label = new Label(comp, SWT.NONE);
- GridData gd = new GridData();
- gd.horizontalSpan = columnWidth;
- label.setLayoutData(gd);
- }
-
-}
-
-

Back to the top