Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJared Burns2004-05-06 23:00:11 +0000
committerJared Burns2004-05-06 23:00:11 +0000
commit17c08bebe3dd6e829ecd6e03b27a91771f34bc97 (patch)
treea949ca9223a5288cc48100834fb7579dd203c2e0 /org.eclipse.debug.ui
parent6a2ec28111c3cdca89a9c9c73b596c169259f642 (diff)
downloadeclipse.platform.debug-17c08bebe3dd6e829ecd6e03b27a91771f34bc97.tar.gz
eclipse.platform.debug-17c08bebe3dd6e829ecd6e03b27a91771f34bc97.tar.xz
eclipse.platform.debug-17c08bebe3dd6e829ecd6e03b27a91771f34bc97.zip
Bug 61105 - Configure view management per perspective
Diffstat (limited to 'org.eclipse.debug.ui')
-rw-r--r--org.eclipse.debug.ui/plugin.properties3
-rw-r--r--org.eclipse.debug.ui/plugin.xml17
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AutoManageViewsAction.java50
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ViewManagementAction.java42
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/PreferencePageContainerDialog.java399
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ViewManagementPreferencePage.java181
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java77
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java9
11 files changed, 707 insertions, 79 deletions
diff --git a/org.eclipse.debug.ui/plugin.properties b/org.eclipse.debug.ui/plugin.properties
index 5a4e38126..2f408573c 100644
--- a/org.eclipse.debug.ui/plugin.properties
+++ b/org.eclipse.debug.ui/plugin.properties
@@ -19,6 +19,7 @@ ConsoleFontDefinition.description= The debug console text font is used by the de
ConsoleFontDefinition.label= Debug Console Text Font
ConsoleLineTrackersExtensionName= Console Line Trackers
LaunchingPreferencePage.name=Launching
+ViewManagementPreferencePage.name=View Management
ConsolePreferencePage.name=Console
DebugModelContextBindingsName=Debug Model Context Bindings
DebugModelActivityBindingsName=Debug Model Activity Bindings
@@ -249,3 +250,5 @@ rawHexMemoryRendering.name= Raw Hex Memory Rendering
MemoryViewUnbufferredLines = Memory View Unbufferred Lines
memoryViewUnbufferedLines.description= Text color for lines that are not yet buffered in the Memory View.
+
+ViewManagementAction.label=View Management...
diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml
index 4f8a35c15..476eb66db 100644
--- a/org.eclipse.debug.ui/plugin.xml
+++ b/org.eclipse.debug.ui/plugin.xml
@@ -127,6 +127,12 @@
id="org.eclipse.debug.ui.LaunchingPreferencePage">
</page>
<page
+ name="%ViewManagementPreferencePage.name"
+ category="org.eclipse.debug.ui.DebugPreferencePage"
+ class="org.eclipse.debug.internal.ui.preferences.ViewManagementPreferencePage"
+ id="org.eclipse.debug.ui.ViewManagementPreferencePage">
+ </page>
+ <page
name="%ConsolePreferencePage.name"
category="org.eclipse.debug.ui.DebugPreferencePage"
class="org.eclipse.debug.internal.ui.preferences.ConsolePreferencePage"
@@ -502,6 +508,17 @@
</extension>
<extension
point="org.eclipse.ui.viewActions">
+ <viewContribution
+ targetID="org.eclipse.debug.ui.DebugView"
+ id="org.eclipse.debug.ui.PulldownActions">
+ <action
+ id="org.eclipse.debug.ui.debugview.pulldown.ViewManagementAction"
+ class="org.eclipse.debug.internal.ui.actions.ViewManagementAction"
+ helpContextId="view_management_action_context"
+ label="%ViewManagementAction.label"
+ menubarPath="additions">
+ </action>
+ </viewContribution>
<!-- Contributions to Debug View Toolbar -->
<viewContribution
targetID="org.eclipse.debug.ui.DebugView"
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
index b2bc8aaf0..e16211b3f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java
@@ -368,6 +368,9 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener {
prefs.setDefault(IInternalDebugUIConstants.PREF_CONTINUE_WITH_COMPILE_ERROR, MessageDialogWithToggle.PROMPT);
prefs.setDefault(IInternalDebugUIConstants.PREF_CONSOLE_SCROLL_LOCK, false);
+ //View Management preference page
+ prefs.setDefault(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES, IDebugUIConstants.ID_DEBUG_PERSPECTIVE);
+
//ConsolePreferencePage
prefs.setDefault(IDebugPreferenceConstants.CONSOLE_WRAP, false);
prefs.setDefault(IDebugPreferenceConstants.CONSOLE_WIDTH, 80);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties
index cf20f91b2..b11315f76 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties
@@ -142,7 +142,4 @@ RunToLineActionDelegate.4=Run to &Line
RetargetAction.2=Error
RetargetAction.3=Operation failed
-AutoManageViewsAction.0=Automatically &Manage Views
-AutoManageViewsAction.1=Automatically Manage Views
-AutoManageViewsAction.2=Automatically open and close views based on selection
LaunchAsAction.0={0} As
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AutoManageViewsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AutoManageViewsAction.java
deleted file mode 100644
index eda8c9a5e..000000000
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/AutoManageViewsAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.ui.actions;
-
-import org.eclipse.debug.internal.ui.DebugPluginImages;
-import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
-import org.eclipse.debug.internal.ui.views.launch.LaunchView;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.texteditor.IUpdate;
-
-/**
- * An action which toggles whether or not a launch view automatically manages views.
- */
-public class AutoManageViewsAction extends Action implements IUpdate {
- private LaunchView launchView= null;
-
- public AutoManageViewsAction(LaunchView view) {
- super(ActionMessages.getString("AutoManageViewsAction.0")); //$NON-NLS-1$
- setToolTipText(ActionMessages.getString("AutoManageViewsAction.1")); //$NON-NLS-1$
- setDescription(ActionMessages.getString("AutoManageViewsAction.2")); //$NON-NLS-1$
- setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_ACT_SYNCED));
- WorkbenchHelp.setHelp(this, IDebugHelpContextIds.AUTO_MANAGE_VIEWS_ACTION);
- launchView= view;
- setChecked(launchView.isAutoManageViews());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.IAction#run()
- */
- public void run() {
- launchView.setAutoManageViews(isChecked());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- setChecked(launchView.isAutoManageViews());
- }
-}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ViewManagementAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ViewManagementAction.java
new file mode 100644
index 000000000..68df0658e
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ViewManagementAction.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.actions;
+
+import org.eclipse.debug.internal.ui.preferences.PreferencePageContainerDialog;
+import org.eclipse.debug.internal.ui.preferences.ViewManagementPreferencePage;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.actions.ActionDelegate;
+
+/**
+ * An action which opens the view management preference page.
+ */
+public class ViewManagementAction extends ActionDelegate implements IViewActionDelegate {
+
+ public ViewManagementAction() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ PreferencePageContainerDialog dialog= new PreferencePageContainerDialog(Display.getDefault().getActiveShell(), new ViewManagementPreferencePage());
+ dialog.open();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
+ */
+ public void init(IViewPart view) {
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
index d5b9ed481..6ad870cea 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
@@ -77,3 +77,5 @@ SimpleLaunchVariablePreferencePage.22=The following variables were contributed b
SimpleLaunchVariablePreferencePage.23=\ (contributed)
StringVariablePreferencePage.24=Error
StringVariablePreferencePage.25=Unable to save changes
+ViewManagementPreferencePage.0=The Debug View can automatically open and close views based on selection. Choose in which perspectives this feature should be enabled:
+ViewManagementPreferencePage.1=View Management
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/PreferencePageContainerDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/PreferencePageContainerDialog.java
new file mode 100644
index 000000000..4c671125c
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/PreferencePageContainerDialog.java
@@ -0,0 +1,399 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.preferences;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.preference.*;
+import org.eclipse.jface.resource.*;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Dialog for opening a single preference page.
+ *
+ * Copied from org.eclipse.team.internal.ui.dialogs.PreferencePageContainerDialog
+ */
+public class PreferencePageContainerDialog extends Dialog implements IPreferencePageContainer {
+
+ PreferencePage page;
+
+ private class PageLayout extends Layout {
+ public void layout(Composite composite, boolean force) {
+ Rectangle rect = composite.getClientArea();
+ Control [] children = composite.getChildren();
+ for (int i= 0; i < children.length; i++) {
+ children[i].setSize(rect.width, rect.height);
+ }
+ }
+ public Point computeSize(Composite composite, int wHint, int hHint, boolean force) {
+ if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
+ return new Point(wHint, hHint);
+ int x= fMinimumPageSize.x;
+ int y= fMinimumPageSize.y;
+
+ Control[] children= composite.getChildren();
+ for (int i= 0; i < children.length; i++) {
+ Point size= children[i].computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
+ x= Math.max(x, size.x);
+ y= Math.max(y, size.y);
+ }
+ if (wHint != SWT.DEFAULT) x = wHint;
+ if (hHint != SWT.DEFAULT) y = hHint;
+ return new Point(x, y);
+ }
+ }
+
+ private Composite fTitleArea;
+ private Label fTitleImage;
+ private CLabel fMessageLabel;
+
+ private String fMessage;
+ private Color fNormalMsgAreaBackground;
+ private Image fErrorMsgImage;
+
+ private Button fOkButton;
+
+ /**
+ * Must declare our own images as the JFaceResource images will not be created unless
+ * a property/preference dialog has been shown
+ */
+ protected static final String PREF_DLG_TITLE_IMG = "preference_page_container_image";//$NON-NLS-1$
+ protected static final String PREF_DLG_IMG_TITLE_ERROR = "preference_page_container_title_error_image";//$NON-NLS-1$
+ static {
+ ImageRegistry reg = DebugUIPlugin.getDefault().getImageRegistry();
+ reg.put(PREF_DLG_TITLE_IMG, ImageDescriptor.createFromFile(PreferenceDialog.class, "images/pref_dialog_title.gif"));//$NON-NLS-1$
+ reg.put(PREF_DLG_IMG_TITLE_ERROR, ImageDescriptor.createFromFile(Dialog.class, "images/message_error.gif"));//$NON-NLS-1$
+ }
+
+ /**
+ * The Composite in which a page is shown.
+ */
+ private Composite fPageContainer;
+
+ /**
+ * The minimum page size; 200 by 200 by default.
+ *
+ * @see #setMinimumPageSize(Point)
+ */
+ private Point fMinimumPageSize = new Point(200,200);
+
+ public PreferencePageContainerDialog(Shell shell, PreferencePage page) {
+ super(shell);
+ this.page = page;
+ }
+
+ /**
+ * @see Dialog#okPressed()
+ */
+ protected void okPressed() {
+ final List changedProperties = new ArrayList(5);
+ getPreferenceStore().addPropertyChangeListener( new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ changedProperties.add(event.getProperty());
+ }
+ });
+
+ page.performOk();
+
+ handleSave();
+
+ super.okPressed();
+ }
+
+ /**
+ * Sets the title for this dialog.
+ * @param title the title.
+ */
+ public void setTitle(String title) {
+ Shell shell= getShell();
+ if ((shell != null) && !shell.isDisposed()) {
+ shell.setText(title);
+ }
+ }
+
+ /**
+ * @see Dialog#createDialogArea(Composite)
+ */
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite)super.createDialogArea(parent);
+ ((GridLayout) composite.getLayout()).numColumns = 1;
+
+ // Build the title area and separator line
+ Composite titleComposite = new Composite(composite, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.verticalSpacing = 0;
+ layout.horizontalSpacing = 0;
+ titleComposite.setLayout(layout);
+ titleComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ createTitleArea(titleComposite);
+
+ Label titleBarSeparator = new Label(titleComposite, SWT.HORIZONTAL | SWT.SEPARATOR);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ titleBarSeparator.setLayoutData(gd);
+
+ // Build the Page container
+ fPageContainer = createPageContainer(composite);
+ fPageContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ page.setContainer(this);
+ page.createControl(fPageContainer);
+ setTitle(page.getTitle());
+
+ // Build the separator line
+ Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ separator.setLayoutData(gd);
+
+ applyDialogFont(parent);
+ return composite;
+ }
+
+ /**
+ * Creates the dialog's title area.
+ *
+ * @param parent the SWT parent for the title area composite
+ * @return the created title area composite
+ */
+ private Composite createTitleArea(Composite parent) {
+ Font font = parent.getFont();
+
+ // Create the title area which will contain
+ // a title, message, and image.
+ fTitleArea = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.verticalSpacing = 0;
+ layout.horizontalSpacing = 0;
+ layout.numColumns = 2;
+
+ // Get the colors for the title area
+ Display display = parent.getDisplay();
+ Color bg = JFaceColors.getBannerBackground(display);
+ Color fg = JFaceColors.getBannerForeground(display);
+
+ GridData layoutData = new GridData(GridData.FILL_BOTH);
+ fTitleArea.setLayout(layout);
+ fTitleArea.setLayoutData(layoutData);
+ fTitleArea.setBackground(bg);
+
+ // Message label
+ fMessageLabel = new CLabel(fTitleArea, SWT.LEFT);
+ fMessageLabel.setBackground(bg);
+ fMessageLabel.setForeground(fg);
+ fMessageLabel.setText(" ");//$NON-NLS-1$
+ fMessageLabel.setFont(JFaceResources.getBannerFont());
+
+ final IPropertyChangeListener fontListener = new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ if(JFaceResources.BANNER_FONT.equals(event.getProperty()) ||
+ JFaceResources.DIALOG_FONT.equals(event.getProperty())) {
+ updateMessage();
+ }
+ }
+ };
+
+ fMessageLabel.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent event) {
+ JFaceResources.getFontRegistry().removeListener(fontListener);
+ }
+ });
+
+ JFaceResources.getFontRegistry().addListener(fontListener);
+
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ fMessageLabel.setLayoutData(gd);
+
+ // Title image
+ fTitleImage = new Label(fTitleArea, SWT.LEFT);
+ fTitleImage.setBackground(bg);
+ fTitleImage.setImage(DebugUIPlugin.getDefault().getImageRegistry().get(PREF_DLG_TITLE_IMG));
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.END;
+ fTitleImage.setLayoutData(gd);
+ updateMessage();
+ return fTitleArea;
+ }
+
+ /**
+ * Creates the inner page container.
+ */
+ private Composite createPageContainer(Composite parent) {
+ Composite result = new Composite(parent, SWT.NULL);
+ result.setLayout(new PageLayout());
+ return result;
+ }
+
+ /**
+ * Sets the minimum page size.
+ *
+ * @param size the page size encoded as
+ * <code>new Point(width,height)</code>
+ * @see #setMinimumPageSize(int,int)
+ */
+ public void setMinimumPageSize(Point size) {
+ fMinimumPageSize.x = size.x;
+ fMinimumPageSize.y = size.y;
+ }
+
+ /**
+ * Display the given error message. The currently displayed message
+ * is saved and will be redisplayed when the error message is set
+ * to <code>null</code>.
+ *
+ * @param errorMessage the errorMessage to display or <code>null</code>
+ */
+ public void setErrorMessage(String errorMessage) {
+ if (errorMessage == null) {
+ if (fMessageLabel.getImage() != null) {
+ // we were previously showing an error
+ fMessageLabel.setBackground(fNormalMsgAreaBackground);
+ fMessageLabel.setImage(null);
+ fTitleImage.setImage(DebugUIPlugin.getDefault().getImageRegistry().get(PREF_DLG_TITLE_IMG));
+ fTitleArea.layout(true);
+ }
+
+ // show the message
+ setMessage(fMessage);
+
+ } else {
+ fMessageLabel.setText(errorMessage);
+ if (fMessageLabel.getImage() == null) {
+ // we were not previously showing an error
+
+ // lazy initialize the error background color and image
+ if (fErrorMsgImage == null) {
+ fErrorMsgImage = DebugUIPlugin.getDefault().getImageRegistry().get(PREF_DLG_IMG_TITLE_ERROR);
+ }
+
+ // show the error
+ fNormalMsgAreaBackground = fMessageLabel.getBackground();
+ fMessageLabel.setBackground(JFaceColors.getErrorBackground(fMessageLabel.getDisplay()));
+ fMessageLabel.setImage(fErrorMsgImage);
+ fTitleImage.setImage(null);
+ fTitleArea.layout(true);
+ }
+ }
+ }
+ /**
+ * Set the message text. If the message line currently displays an error,
+ * the message is stored and will be shown after a call to clearErrorMessage
+ */
+ public void setMessage(String newMessage) {
+ fMessage = newMessage;
+ if (fMessage == null) {
+ fMessage = "";//$NON-NLS-1$
+ }
+ if (fMessageLabel.getImage() == null) {
+ // we are not showing an error
+ fMessageLabel.setText(fMessage);
+ }
+ }
+
+ /**
+ * @see IPreferencePageContainer#updateMessage()
+ */
+ public void updateMessage() {
+ String pageMessage = page.getMessage();
+ String pageErrorMessage = page.getErrorMessage();
+
+ // Adjust the font
+ if (pageMessage == null && pageErrorMessage == null)
+ fMessageLabel.setFont(JFaceResources.getBannerFont());
+ else
+ fMessageLabel.setFont(JFaceResources.getDialogFont());
+
+ // Set the message and error message
+ if (pageMessage == null) {
+ setMessage(page.getTitle());
+ } else {
+ setMessage(pageMessage);
+ }
+ setErrorMessage(pageErrorMessage);
+ }
+
+ /**
+ * @see IPreferencePageContainer#getPreferenceStore()
+ */
+ public IPreferenceStore getPreferenceStore() {
+ return page.getPreferenceStore();
+ }
+
+ /**
+ * @see IPreferencePageContainer#updateButtons()
+ */
+ public void updateButtons() {
+ if (fOkButton != null) {
+ fOkButton.setEnabled(page.isValid());
+ }
+ }
+
+ /**
+ * @see IPreferencePageContainer#updateTitle()
+ */
+ public void updateTitle() {
+ setTitle(page.getTitle());
+ }
+
+ /**
+ * @see Dialog#createButtonsForButtonBar(Composite)
+ */
+ protected void createButtonsForButtonBar(Composite parent) {
+ fOkButton= createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ }
+
+ /**
+ * Save the values specified in the pages.
+ * <p>
+ * The default implementation of this framework method saves all
+ * pages of type <code>PreferencePage</code> (if their store needs saving
+ * and is a <code>PreferenceStore</code>).
+ * </p>
+ * <p>
+ * Subclasses may override.
+ * </p>
+ */
+ protected void handleSave() {
+ if (page instanceof PreferencePage) {
+ // Save now in case tbe workbench does not shutdown cleanly
+ IPreferenceStore store =
+ ((PreferencePage) page).getPreferenceStore();
+ if (store != null
+ && store.needsSaving()
+ && store instanceof IPersistentPreferenceStore) {
+ try {
+ ((IPersistentPreferenceStore) store).save();
+ } catch (IOException e) {
+ DebugUIPlugin.log(e);
+ }
+ }
+ }
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ViewManagementPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ViewManagementPreferencePage.java
new file mode 100644
index 000000000..edc65f9c1
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ViewManagementPreferencePage.java
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.preferences;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.debug.internal.ui.views.launch.LaunchView;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.ui.IPerspectiveDescriptor;
+import org.eclipse.ui.IPerspectiveRegistry;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Preference page for configuring the debugger's automatic
+ * view management.
+ */
+public class ViewManagementPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+
+ private CheckboxTableViewer fPerspectiveViewer;
+
+ public ViewManagementPreferencePage() {
+ super();
+ setTitle(DebugPreferencesMessages.getString("ViewManagementPreferencePage.1")); //$NON-NLS-1$
+ setPreferenceStore(DebugUITools.getPreferenceStore());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createContents(Composite parent) {
+ Composite composite= new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ createPerspectiveViewer(composite);
+
+ Dialog.applyDialogFont(composite);
+
+ return composite;
+ }
+
+ /**
+ * @param parent
+ */
+ private void createPerspectiveViewer(Composite parent) {
+ Label label= new Label(parent, SWT.WRAP);
+ label.setText(DebugPreferencesMessages.getString("ViewManagementPreferencePage.0")); //$NON-NLS-1$
+ label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Table table= new Table(parent, SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
+ table.setLayout(new GridLayout());
+ table.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ fPerspectiveViewer= new CheckboxTableViewer(table);
+ PerspectiveProvider provider= new PerspectiveProvider();
+ fPerspectiveViewer.setContentProvider(provider);
+ fPerspectiveViewer.setLabelProvider(provider);
+ fPerspectiveViewer.setInput(this);
+
+ checkPerspectives(getPreferenceStore().getString(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES));
+ }
+
+ private void checkPerspectives(String perspectiveList) {
+ fPerspectiveViewer.setAllChecked(false);
+ IPerspectiveRegistry registry= PlatformUI.getWorkbench().getPerspectiveRegistry();
+ Iterator perspectiveIds= LaunchView.parseList(perspectiveList).iterator();
+ while (perspectiveIds.hasNext()) {
+ IPerspectiveDescriptor descriptor = registry.findPerspectiveWithId((String) perspectiveIds.next());
+ fPerspectiveViewer.setChecked(descriptor, true);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferencePage#performOk()
+ */
+ public boolean performOk() {
+ StringBuffer buffer= new StringBuffer();
+ Object[] descriptors = fPerspectiveViewer.getCheckedElements();
+ for (int i = 0; i < descriptors.length; i++) {
+ buffer.append(((IPerspectiveDescriptor) descriptors[i]).getId()).append(',');
+ }
+
+ getPreferenceStore().setValue(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES, buffer.toString());
+ return super.performOk();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+ */
+ protected void performDefaults() {
+ checkPerspectives(getPreferenceStore().getDefaultString(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES));
+ super.performDefaults();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ }
+
+ private class PerspectiveProvider implements IStructuredContentProvider, ILabelProvider {
+
+ private List fImages= new ArrayList();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ public Object[] getElements(Object inputElement) {
+ return PlatformUI.getWorkbench().getPerspectiveRegistry().getPerspectives();
+ }
+
+ public void dispose() {
+ Iterator images= fImages.iterator();
+ while (images.hasNext()) {
+ ((Image) images.next()).dispose();
+ }
+ }
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+ */
+ public Image getImage(Object element) {
+ Image image= null;
+ if (element instanceof IPerspectiveDescriptor) {
+ image= ((IPerspectiveDescriptor) element).getImageDescriptor().createImage();
+ fImages.add(image);
+ }
+ return image;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ */
+ public String getText(Object element) {
+ String text= null;
+ if (element instanceof IPerspectiveDescriptor) {
+ IPerspectiveDescriptor descriptor = (IPerspectiveDescriptor) element;
+ text= descriptor.getLabel();
+ }
+ return text;
+ }
+ public void addListener(ILabelProviderListener listener) {
+ }
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ }
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java
index 64c7b23ad..5db1181cd 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/LaunchView.java
@@ -11,7 +11,11 @@
package org.eclipse.debug.internal.ui.views.launch;
+import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
@@ -42,7 +46,6 @@ import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
import org.eclipse.debug.internal.ui.InstructionPointerManager;
import org.eclipse.debug.internal.ui.actions.AddToFavoritesAction;
import org.eclipse.debug.internal.ui.actions.EditLaunchConfigurationAction;
-import org.eclipse.debug.internal.ui.actions.AutoManageViewsAction;
import org.eclipse.debug.internal.ui.sourcelookup.CommonSourceNotFoundEditorInput;
import org.eclipse.debug.internal.ui.sourcelookup.EditSourceLookupPathAction;
import org.eclipse.debug.internal.ui.sourcelookup.LookupSourceAction;
@@ -167,15 +170,10 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect
private LookupSourceAction fLookupAction = null;
/**
- * Whether or not this view automatically opens and closes views
- * based on debug contexts.
+ * Collection of perspectives in which views should be
+ * automatically opened and closed.
*/
- private boolean fAutoManage= true;
- /**
- * Memento key used to store the views setting for automatically
- * managing views.
- */
- private static String ATTR_AUTO_MANAGE_VIEWS= "autoManageViews"; //$NON-NLS-1$
+ private List fAutoManagePerspectives= new ArrayList();
/**
* Context manager which automatically opens and closes views
* based on debug contexts.
@@ -203,7 +201,6 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect
*/
protected void createActions() {
setAction("Properties", new PropertyDialogAction(getSite().getWorkbenchWindow().getShell(), getSite().getSelectionProvider())); //$NON-NLS-1$
- setAction("AutoManageViews", new AutoManageViewsAction(this)); //$NON-NLS-1$
fEditConfigAction = new EditLaunchConfigurationAction();
fAddToFavoritesAction = new AddToFavoritesAction();
fEditSourceAction = new EditSourceLookupPathAction(this);
@@ -248,6 +245,8 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect
// determine if active
setActive(getSite().getPage().findView(getSite().getId()) != null);
+ loadAutoManagePerspectives();
+
return lv;
}
@@ -418,10 +417,6 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect
}
}
}
- String autoManage = memento.getString(ATTR_AUTO_MANAGE_VIEWS);
- if (autoManage != null) {
- fAutoManage= Boolean.valueOf(autoManage).booleanValue();
- }
contextListener.init(memento);
}
@@ -436,7 +431,6 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect
tbm.add(new GroupMarker(IDebugUIConstants.STEP_RETURN_GROUP));
tbm.add(new GroupMarker(IDebugUIConstants.EMPTY_STEP_GROUP));
tbm.add(new Separator(IDebugUIConstants.RENDER_GROUP));
- tbm.add(getAction("AutoManageViews")); //$NON-NLS-1$
}
/* (non-Javadoc)
@@ -501,6 +495,7 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect
contextListener.updateForSelection(((IStructuredSelection) getViewer().getSelection()).getFirstElement());
}
}
+
/**
* Returns whether this view automatically opens and closes
@@ -509,17 +504,46 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect
* views based on contexts
*/
public boolean isAutoManageViews() {
- return fAutoManage;
+ IWorkbenchPage page = getViewSite().getWorkbenchWindow().getActivePage();
+ if (page != null) {
+ IPerspectiveDescriptor descriptor = page.getPerspective();
+ if (descriptor != null) {
+ return fAutoManagePerspectives.contains(descriptor.getId());
+ }
+ }
+ return false;
+ }
+
+ private void loadAutoManagePerspectives() {
+ String prefString = DebugUIPlugin.getDefault().getPreferenceStore().getString(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES);
+ fAutoManagePerspectives= parseList(prefString);
}
/**
- * Sets whether or not this view will automatically
- * open and close views based on contexts.
- * @param autoManage whether or not this view should
- * automatically manage views based on contexts
- */
- public void setAutoManageViews(boolean autoManage) {
- fAutoManage= autoManage;
+ * Parses the comma separated string into a list of strings
+ *
+ * @return list
+ */
+ public static List parseList(String listString) {
+ List list = new ArrayList(10);
+ StringTokenizer tokenizer = new StringTokenizer(listString, ","); //$NON-NLS-1$
+ while (tokenizer.hasMoreTokens()) {
+ String token = tokenizer.nextToken();
+ list.add(token);
+ }
+ return list;
+ }
+
+ /**
+ * Sets the collection of perspectives in which this
+ * view will automatically open and close views based
+ * on contexts.
+ * @param perspectiveIds the collection of perspectives
+ * in which this view should automatically manage views
+ * based on contexts
+ */
+ public void setAutoManagePerspectives(List perspectiveIds) {
+ fAutoManagePerspectives= perspectiveIds;
updateContextListener();
}
@@ -935,7 +959,6 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect
menu.add(new GroupMarker(IDebugUIConstants.STEP_OVER_GROUP));
menu.add(new GroupMarker(IDebugUIConstants.STEP_RETURN_GROUP));
menu.add(new Separator(IDebugUIConstants.RENDER_GROUP));
- menu.add(getAction("AutoManageViews")); //$NON-NLS-1$
menu.add(new Separator(IDebugUIConstants.EMPTY_THREAD_GROUP));
menu.add(new Separator(IDebugUIConstants.THREAD_GROUP));
menu.add(new Separator(IDebugUIConstants.EMPTY_LAUNCH_GROUP));
@@ -1175,8 +1198,11 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
*/
public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(IDebugUIConstants.PREF_REUSE_EDITOR)) {
+ String property = event.getProperty();
+ if (property.equals(IDebugUIConstants.PREF_REUSE_EDITOR)) {
fReuseEditor = DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugUIConstants.PREF_REUSE_EDITOR);
+ } else if (property.equals(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES)) {
+ loadAutoManagePerspectives();
}
}
@@ -1206,7 +1232,6 @@ public class LaunchView extends AbstractDebugEventHandlerView implements ISelect
memento.putString(IDebugUIConstants.PREF_REUSE_EDITOR, Integer.toString(index));
}
}
- memento.putString(ATTR_AUTO_MANAGE_VIEWS, Boolean.toString(fAutoManage));
contextListener.saveState(memento);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java
index 6da18bb9e..734d88d56 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java
@@ -206,6 +206,15 @@ public interface IDebugUIConstants {
*/
public static final String PREF_SKIP_BREAKPOINTS_DURING_RUN_TO_LINE= PLUGIN_ID + ".skip_breakpoints_during_run_to_line"; //$NON-NLS-1$
+ /**
+ * String preference controlling in which perspectives view
+ * management will occur. The value is a comma-separated list
+ * of plug-in identifiers.
+ *
+ * @since 3.0
+ */
+ public static final String PREF_MANAGE_VIEW_PERSPECTIVES= PLUGIN_ID + ".manage_view_perspectives"; //$NON-NLS-1$
+
// Debug views
/**

Back to the top