diff options
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences')
14 files changed, 0 insertions, 4263 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/BooleanFieldEditor2.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/BooleanFieldEditor2.java deleted file mode 100644 index 91e434280..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/BooleanFieldEditor2.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.preferences; - - -import org.eclipse.jface.preference.BooleanFieldEditor; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -/** - * A boolean field editor that provides access to this editors boolean - * button. - */ -public class BooleanFieldEditor2 extends BooleanFieldEditor { - - private Button fChangeControl; - - /** - * @see BooleanFieldEditor#BooleanFieldEditor(java.lang.String, java.lang.String, int, org.eclipse.swt.widgets.Composite) - */ - public BooleanFieldEditor2( - String name, - String labelText, - int style, - Composite parent) { - super(name, labelText, style, parent); - } - - /** - * @see org.eclipse.jface.preference.BooleanFieldEditor#getChangeControl(Composite) - */ - public Button getChangeControl(Composite parent) { - if (fChangeControl == null) { - fChangeControl = super.getChangeControl(parent); - } - return fChangeControl; - } - - -} - diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java deleted file mode 100644 index 5a4b7253b..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java +++ /dev/null @@ -1,237 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.preferences; - - -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.IDebugHelpContextIds; -import org.eclipse.jface.preference.BooleanFieldEditor; -import org.eclipse.jface.preference.ColorFieldEditor; -import org.eclipse.jface.preference.FieldEditor; -import org.eclipse.jface.preference.FieldEditorPreferencePage; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.IntegerFieldEditor; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.PlatformUI; - -/** - * A page to set the preferences for the console - */ -public class ConsolePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { - - /** - * This class exists to provide visibility to the - * <code>refreshValidState</code> method and to perform more intelligent - * clearing of the error message. - */ - protected class ConsoleIntegerFieldEditor extends IntegerFieldEditor { - - public ConsoleIntegerFieldEditor(String name, String labelText, Composite parent) { - super(name, labelText, parent); - } - - /** - * @see org.eclipse.jface.preference.FieldEditor#refreshValidState() - */ - protected void refreshValidState() { - super.refreshValidState(); - } - - /** - * Clears the error message from the message line if the error - * message is the error message from this field editor. - */ - protected void clearErrorMessage() { - if (canClearErrorMessage()) { - super.clearErrorMessage(); - } - } - } - - private BooleanFieldEditor2 fWrapEditor = null; - private ConsoleIntegerFieldEditor fWidthEditor = null; - - private BooleanFieldEditor2 fUseBufferSize = null; - private ConsoleIntegerFieldEditor fBufferSizeEditor = null; - - private ConsoleIntegerFieldEditor fTabSizeEditor = null; - - /** - * Create the console page. - */ - public ConsolePreferencePage() { - super(GRID); - setDescription(DebugPreferencesMessages.ConsolePreferencePage_Console_settings); - setPreferenceStore(DebugUIPlugin.getDefault().getPreferenceStore()); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#createControl(Composite) - */ - public void createControl(Composite parent) { - super.createControl(parent); - PlatformUI.getWorkbench().getHelpSystem().setHelp( - getControl(), - IDebugHelpContextIds.CONSOLE_PREFERENCE_PAGE ); - } - - /** - * Create all field editors for this page - */ - public void createFieldEditors() { - - fWrapEditor = new BooleanFieldEditor2(IDebugPreferenceConstants.CONSOLE_WRAP, DebugPreferencesMessages.ConsolePreferencePage_Wrap_text_1, SWT.NONE, getFieldEditorParent()); - addField(fWrapEditor); - - fWidthEditor = new ConsoleIntegerFieldEditor(IDebugPreferenceConstants.CONSOLE_WIDTH, DebugPreferencesMessages.ConsolePreferencePage_Console_width, getFieldEditorParent()); - addField(fWidthEditor); - fWidthEditor.setValidRange(80, 1000); - fWidthEditor.setErrorMessage(DebugPreferencesMessages.ConsolePreferencePage_console_width); - - fWrapEditor.getChangeControl(getFieldEditorParent()).addSelectionListener( - new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - updateWidthEditor(); - } - } - ); - - fUseBufferSize = new BooleanFieldEditor2(IDebugPreferenceConstants.CONSOLE_LIMIT_CONSOLE_OUTPUT, DebugPreferencesMessages.ConsolePreferencePage_Limit_console_output_1, SWT.NONE, getFieldEditorParent()); - addField(fUseBufferSize); - - fBufferSizeEditor = new ConsoleIntegerFieldEditor(IDebugPreferenceConstants.CONSOLE_LOW_WATER_MARK, DebugPreferencesMessages.ConsolePreferencePage_Console_buffer_size__characters___2, getFieldEditorParent()); - addField(fBufferSizeEditor); - fBufferSizeEditor.setValidRange(1000, 1000000); - fBufferSizeEditor.setErrorMessage(DebugPreferencesMessages.ConsolePreferencePage_The_console_buffer_size_must_be_at_least_1000_characters__1); - - fUseBufferSize.getChangeControl(getFieldEditorParent()).addSelectionListener( - new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - updateBufferSizeEditor(); - } - } - ); - - fTabSizeEditor = new ConsoleIntegerFieldEditor(IDebugPreferenceConstants.CONSOLE_TAB_WIDTH, DebugPreferencesMessages.ConsolePreferencePage_12, getFieldEditorParent()); - addField(fTabSizeEditor); - fTabSizeEditor.setValidRange(1,100); - fTabSizeEditor.setErrorMessage(DebugPreferencesMessages.ConsolePreferencePage_13); - - addField(new BooleanFieldEditor(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT, DebugPreferencesMessages.ConsolePreferencePage_Show__Console_View_when_there_is_program_output_3, SWT.NONE, getFieldEditorParent())); - addField(new BooleanFieldEditor(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR, DebugPreferencesMessages.ConsolePreferencePage_Show__Console_View_when_there_is_program_error_3, SWT.NONE, getFieldEditorParent())); - - ColorFieldEditor sysout= new ColorFieldEditor(IDebugPreferenceConstants.CONSOLE_SYS_OUT_COLOR, DebugPreferencesMessages.ConsolePreferencePage_Standard_Out__2, getFieldEditorParent()); - ColorFieldEditor syserr= new ColorFieldEditor(IDebugPreferenceConstants.CONSOLE_SYS_ERR_COLOR, DebugPreferencesMessages.ConsolePreferencePage_Standard_Error__3, getFieldEditorParent()); - ColorFieldEditor sysin= new ColorFieldEditor(IDebugPreferenceConstants.CONSOLE_SYS_IN_COLOR, DebugPreferencesMessages.ConsolePreferencePage_Standard_In__4, getFieldEditorParent()); - ColorFieldEditor background= new ColorFieldEditor(IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR, DebugPreferencesMessages.ConsolePreferencePage_11, getFieldEditorParent()); - - addField(sysout); - addField(syserr); - addField(sysin); - addField(background); - } - - /** - * @see IWorkbenchPreferencePage#init(IWorkbench) - */ - public void init(IWorkbench workbench) { - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferencePage#performOk() - */ - public boolean performOk() { - boolean ok= super.performOk(); - // update high water mark to be (about) 100 lines (100 * 80 chars) greater than low water mark - IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore(); - int low = store.getInt(IDebugPreferenceConstants.CONSOLE_LOW_WATER_MARK); - int high = low + 8000; - store.setValue(IDebugPreferenceConstants.CONSOLE_HIGH_WATER_MARK, high); - return ok; - } - - /** - * @see org.eclipse.jface.preference.FieldEditorPreferencePage#initialize() - */ - protected void initialize() { - super.initialize(); - updateWidthEditor(); - updateBufferSizeEditor(); - } - - /** - * Update enablement of width editor based on enablement of 'fixed width' editor. - */ - protected void updateWidthEditor() { - Button b = fWrapEditor.getChangeControl(getFieldEditorParent()); - fWidthEditor.getTextControl(getFieldEditorParent()).setEnabled(b.getSelection()); - fWidthEditor.getLabelControl(getFieldEditorParent()).setEnabled(b.getSelection()); - } - - /** - * Update enablement of buffer size editor based on enablement of 'limit - * console output' editor. - */ - protected void updateBufferSizeEditor() { - Button b = fUseBufferSize.getChangeControl(getFieldEditorParent()); - fBufferSizeEditor.getTextControl(getFieldEditorParent()).setEnabled(b.getSelection()); - fBufferSizeEditor.getLabelControl(getFieldEditorParent()).setEnabled(b.getSelection()); - } - - /** - * @see org.eclipse.jface.preference.PreferencePage#performDefaults() - */ - protected void performDefaults() { - super.performDefaults(); - updateWidthEditor(); - updateBufferSizeEditor(); - } - - protected boolean canClearErrorMessage() { - if (fWidthEditor.isValid() && fBufferSizeEditor.isValid()) { - return true; - } - return false; - } - - /** - * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) - */ - public void propertyChange(PropertyChangeEvent event) { - - if (event.getProperty().equals(FieldEditor.IS_VALID)) { - boolean newValue = ((Boolean) event.getNewValue()).booleanValue(); - // If the new value is true then we must check all field editors. - // If it is false, then the page is invalid in any case. - if (newValue) { - if (fWidthEditor != null && event.getSource() != fWidthEditor) { - fWidthEditor.refreshValidState(); - } - if (fBufferSizeEditor != null && event.getSource() != fBufferSizeEditor) { - fBufferSizeEditor.refreshValidState(); - } - checkState(); - } else { - super.propertyChange(event); - } - - } else { - super.propertyChange(event); - } - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencePage.java deleted file mode 100644 index 9f6ea8800..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencePage.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.preferences; - -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.IDebugHelpContextIds; -import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; -import org.eclipse.debug.internal.ui.SWTFactory; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.preference.BooleanFieldEditor; -import org.eclipse.jface.preference.ColorFieldEditor; -import org.eclipse.jface.preference.FieldEditorPreferencePage; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.PlatformUI; - -/** - * The page for setting debugger preferences. Built on the 'field editor' infrastructure. - */ -public class DebugPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage, IDebugPreferenceConstants { - - public DebugPreferencePage() { - super(GRID); - - IPreferenceStore store= DebugUIPlugin.getDefault().getPreferenceStore(); - setPreferenceStore(store); - setDescription(DebugPreferencesMessages.DebugPreferencePage_1); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#createControl(Composite) - */ - public void createControl(Composite parent) { - super.createControl(parent); - PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.DEBUG_PREFERENCE_PAGE); - } - - /** - * @see FieldEditorPreferencePage#createFieldEditors - */ - protected void createFieldEditors() { - addField(new BooleanFieldEditor(IDebugUIConstants.PREF_REUSE_EDITOR, DebugPreferencesMessages.DebugPreferencePage_2, SWT.NONE, getFieldEditorParent())); - - SWTFactory.createHorizontalSpacer(getFieldEditorParent(), 2); - - addField(new BooleanFieldEditor(IDebugUIConstants.PREF_ACTIVATE_WORKBENCH, DebugPreferencesMessages.DebugPreferencePage_3, SWT.NONE, getFieldEditorParent())); - addField(new BooleanFieldEditor(IInternalDebugUIConstants.PREF_ACTIVATE_DEBUG_VIEW, DebugPreferencesMessages.DebugPreferencePage_26, SWT.NONE, getFieldEditorParent())); - - SWTFactory.createHorizontalSpacer(getFieldEditorParent(), 2); - - addField(new BooleanFieldEditor(IDebugUIConstants.PREF_SKIP_BREAKPOINTS_DURING_RUN_TO_LINE, DebugPreferencesMessages.DebugPreferencePage_25, SWT.NONE, getFieldEditorParent())); - addField(new BooleanFieldEditor(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_BREAKPOINTS, DebugPreferencesMessages.DebugPreferencePage_29, SWT.NONE, getFieldEditorParent())); - addField(new BooleanFieldEditor(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_BREAKPOINTS_FROM_CONTAINER, DebugPreferencesMessages.DebugPreferencePage_30, SWT.NONE, getFieldEditorParent())); - addField(new BooleanFieldEditor(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_EXPRESSIONS, DebugPreferencesMessages.DebugPreferencePage_5, SWT.NONE, getFieldEditorParent())); - - SWTFactory.createHorizontalSpacer(getFieldEditorParent(), 2); - ColorFieldEditor mem= new ColorFieldEditor(IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR, DebugPreferencesMessages.DebugPreferencePage_4, getFieldEditorParent()); - addField(mem); - mem = new ColorFieldEditor(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND, DebugPreferencesMessages.DebugPreferencePage_28, getFieldEditorParent()); - addField(mem); - mem= new ColorFieldEditor(IDebugUIConstants.PREF_MEMORY_HISTORY_UNKNOWN_COLOR, DebugPreferencesMessages.DebugPreferencePage_0, getFieldEditorParent()); - addField(mem); - mem= new ColorFieldEditor(IDebugUIConstants.PREF_MEMORY_HISTORY_KNOWN_COLOR, DebugPreferencesMessages.DebugPreferencePage_27, getFieldEditorParent()); - addField(mem); - } - - /** - * @see IWorkbenchPreferencePage#init(IWorkbench) - */ - public void init(IWorkbench workbench) {} - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java deleted file mode 100644 index 7c0681c04..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java +++ /dev/null @@ -1,196 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.preferences; - -import org.eclipse.osgi.util.NLS; - -public class DebugPreferencesMessages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.debug.internal.ui.preferences.DebugPreferencesMessages";//$NON-NLS-1$ - - public static String ConsolePreferencePage_11; - - public static String ConsolePreferencePage_Console_settings; - public static String ConsolePreferencePage_Show__Console_View_when_there_is_program_error_3; - public static String ConsolePreferencePage_Show__Console_View_when_there_is_program_output_3; - public static String ConsolePreferencePage_Standard_Error__3; - public static String ConsolePreferencePage_Standard_In__4; - public static String ConsolePreferencePage_Standard_Out__2; - public static String ConsolePreferencePage_Wrap_text_1; - public static String ConsolePreferencePage_Console_width; - public static String ConsolePreferencePage_Limit_console_output_1; - public static String ConsolePreferencePage_Console_buffer_size__characters___2; - public static String ConsolePreferencePage_The_console_buffer_size_must_be_at_least_1000_characters__1; - public static String ConsolePreferencePage_console_width; - public static String ConsolePreferencePage_12; - public static String ConsolePreferencePage_13; - - public static String DebugPreferencePage_1; - public static String DebugPreferencePage_2; - - public static String DebugPreferencePage_29; - public static String DebugPreferencePage_3; - public static String DebugPreferencePage_0; - - public static String DebugPreferencePage_30; - public static String DebugPreferencePage_4; - public static String DebugPreferencePage_10; - public static String DebugPreferencePage_11; - public static String DebugPreferencePage_21; - public static String DebugPreferencePage_22; - public static String DebugPreferencePage_23; - public static String DebugPreferencePage_24; - public static String DebugPreferencePage_25; - public static String DebugPreferencePage_26; - public static String DebugPreferencePage_27; - - public static String DefaultLaunchConfigurationsPropertiesPage_0; - - public static String DefaultLaunchConfigurationsPropertiesPage_1; - public static String DefaultLaunchConfigurationsPropertiesPage_11; - public static String DefaultLaunchConfigurationsPropertiesPage_12; - public static String DefaultLaunchConfigurationsPropertiesPage_2; - public static String DefaultLaunchConfigurationsPropertiesPage_3; - public static String DefaultLaunchConfigurationsPropertiesPage_4; - public static String DefaultLaunchConfigurationsPropertiesPage_5; - public static String DefaultLaunchConfigurationsPropertiesPage_6; - public static String DefaultLaunchConfigurationsPropertiesPage_7; - public static String DefaultLaunchConfigurationsPropertiesPage_8; - public static String DefaultLaunchConfigurationsPropertiesPage_9; - - public static String LaunchDelegatesPreferencePage_0; - - public static String LaunchDelegatesPreferencePage_1; - public static String LaunchDelegatesPreferencePage_2; - public static String LaunchDelegatesPreferencePage_3; - - public static String LaunchDelegatesPreferencePage_4; - - public static String LaunchersPreferencePage_0; - - public static String LaunchingPreferencePage_40; - public static String LaunchingPreferencePage_1; - public static String LaunchingPreferencePage_2; - public static String LaunchingPreferencePage_3; - public static String LaunchingPreferencePage_37; - public static String LaunchingPreferencePage_38; - public static String LaunchingPreferencePage_39; - public static String LaunchingPreferencePage_4; - - public static String LaunchingPreferencePage_41; - public static String LaunchingPreferencePage_5; - public static String LaunchingPreferencePage_6; - public static String LaunchingPreferencePage_7; - public static String LaunchingPreferencePage_8; - public static String LaunchingPreferencePage_9; - public static String LaunchingPreferencePage_10; - public static String LaunchingPreferencePage_11; - public static String LaunchingPreferencePage_12; - public static String LaunchingPreferencePage_13; - public static String LaunchingPreferencePage_14; - public static String LaunchingPreferencePage_15; - public static String LaunchingPreferencePage_16; - public static String LaunchingPreferencePage_17; - public static String LaunchingPreferencePage_18; - public static String LaunchingPreferencePage_21; - public static String LaunchingPreferencePage_22; - public static String LaunchingPreferencePage_23; - public static String LaunchingPreferencePage_26; - public static String LaunchingPreferencePage_27; - public static String LaunchingPreferencePage_0; - public static String LaunchingPreferencePage_28; - public static String LaunchingPreferencePage_29; - public static String LaunchingPreferencePage_30; - public static String LaunchingPreferencePage_31; - public static String LaunchingPreferencePage_32; - public static String LaunchingPreferencePage_33; - public static String LaunchingPreferencePage_34; - public static String LaunchingPreferencePage_35; - public static String LaunchingPreferencePage_36; - - public static String LaunchingPreferencePage_confirm_0; - - public static String LaunchPerspectivePreferencePage_0; - - public static String LaunchPerspectivePreferencePage_1; - - public static String PerspectivePreferencePage_0; - public static String PerspectivePreferencePage_1; - public static String PerspectivePreferencePage_2; - public static String PerspectivePreferencePage_4; - public static String PerspectivePreferencePage_5; - - public static String LaunchConfigurationsPreferencePage_1; - public static String LaunchConfigurationsPreferencePage_0; - - public static String ProcessPropertyPage_Command_Line__1; - - public static String SimpleVariablePreferencePage_3; - public static String SimpleVariablePreferencePage_4; - public static String SimpleVariablePreferencePage_5; - public static String SimpleVariablePreferencePage_6; - public static String SimpleVariablePreferencePage_7; - public static String SimpleVariablePreferencePage_8; - public static String SimpleVariablePreferencePage_9; - public static String SimpleVariablePreferencePage_10; - public static String SimpleVariablePreferencePage_11; - public static String SimpleVariablePreferencePage_12; - public static String SimpleVariablePreferencePage_13; - public static String SimpleVariablePreferencePage_14; - public static String SimpleVariablePreferencePage_15; - public static String SimpleVariablePreferencePage_16; - public static String SimpleLaunchVariablePreferencePage_21; - public static String SimpleLaunchVariablePreferencePage_22; - public static String SimpleLaunchVariablePreferencePage_23; - - public static String StringVariablePreferencePage_20; - public static String StringVariablePreferencePage_21; - public static String StringVariablePreferencePage_22; - public static String StringVariablePreferencePage_23; - public static String StringVariablePreferencePage_24; - public static String StringVariablePreferencePage_25; - public static String StringVariablePreferencePage_26; - public static String StringVariablePreferencePage_27; - - public static String ViewManagementPreferencePage_0; - public static String ViewManagementPreferencePage_1; - public static String ViewManagementPreferencePage_2; - public static String ViewManagementPreferencePage_3; - public static String ViewManagementPreferencePage_4; - public static String ViewManagementPreferencePage_5; - - static { - // load message values from bundle file - NLS.initializeMessages(BUNDLE_NAME, DebugPreferencesMessages.class); - } - - public static String LaunchConfigurationsPreferencePage_2; - - public static String LaunchConfigurationsPreferencePage_3; - - public static String ProcessPropertyPage_0; - - public static String ProcessPropertyPage_1; - - public static String ProcessPropertyPage_2; - - public static String ProcessPropertyPage_3; - - public static String ProcessPropertyPage_4; - - public static String ProcessPropertyPage_5; - - public static String DebugPreferencePage_28; - - public static String DebugPreferencePage_5; - - public static String RunDebugPropertiesPage_0; - -} 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 deleted file mode 100644 index f712d8e3a..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties +++ /dev/null @@ -1,155 +0,0 @@ -############################################################################### -# Copyright (c) 2000, 2009 IBM Corporation and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# IBM Corporation - initial API and implementation -############################################################################### - -ConsolePreferencePage_Console_settings=Debug Console Settings. -ConsolePreferencePage_Show__Console_View_when_there_is_program_error_3=Show when &program writes to standard error -ConsolePreferencePage_Show__Console_View_when_there_is_program_output_3=&Show when program writes to standard out -ConsolePreferencePage_Standard_Error__3=Standard &Error text color: -ConsolePreferencePage_Standard_In__4=Standard &In text color: -ConsolePreferencePage_Standard_Out__2=Standard &Out text color: -ConsolePreferencePage_Wrap_text_1=Fixed &width console -ConsolePreferencePage_Console_width=&Maximum character width: -ConsolePreferencePage_Limit_console_output_1=&Limit console output -ConsolePreferencePage_Console_buffer_size__characters___2=Console &buffer size (characters): -ConsolePreferencePage_The_console_buffer_size_must_be_at_least_1000_characters__1=Buffer size must be between 1000 and 1000000 inclusive. -ConsolePreferencePage_console_width=Character width must be between 80 and 1000 inclusive. -ConsolePreferencePage_12=Displayed &tab width: -ConsolePreferencePage_13=Tab width must be between 1 and 100 inclusive. -ConsolePreferencePage_11=Back&ground color: - -DebugPreferencePage_1=General Settings for Running and Debugging. -DebugPreferencePage_2=Re&use editor when displaying source code -DebugPreferencePage_3=Activate the workbenc&h when a breakpoint is hit -DebugPreferencePage_0=&Memory unbuffered color: -DebugPreferencePage_4=Changed &value color: -DebugPreferencePage_10=Si&ze of recently launched applications list: -DebugPreferencePage_11=The size of recently launched applications should be between {0} and {1} -DebugPreferencePage_21=Open the associated perspective when an application suspends -DebugPreferencePage_22=A&lways -DebugPreferencePage_23=&Never -DebugPreferencePage_24=&Prompt -DebugPreferencePage_25=Skip &breakpoints during a 'Run to Line' operation. -DebugPreferencePage_26=A&ctivate the debug view when a breakpoint is hit -DebugPreferencePage_27=Memor&y buffered color: -DebugPreferencePage_28=Changed value bac&kground color: -DebugPreferencePage_29=&Prompt for confirmation when deleting all breakpoints. -DebugPreferencePage_30=Prompt for confirmation when deleting breakpoint con&tainers. -DebugPreferencePage_5=Prompt for confirmation when deleting all e&xpressions. - -LaunchingPreferencePage_1=&Build (if required) before launching -LaunchingPreferencePage_2=Save required dirty editors before launching -LaunchingPreferencePage_3=Alwa&ys -LaunchingPreferencePage_4=&Never -LaunchingPreferencePage_5=&Prompt -LaunchingPreferencePage_6=Wait for ongoing build to complete before launching -LaunchingPreferencePage_7=A&lways -LaunchingPreferencePage_8=N&ever -LaunchingPreferencePage_9=Pro&mpt -LaunchingPreferencePage_0=Select the launch configurations to &migrate: -LaunchersPreferencePage_0=Currently there are no conflicting launchers. -LaunchingPreferencePage_10=Remove term&inated launches when a new launch is created -LaunchingPreferencePage_11=Open the associated perspective when launching -LaunchingPreferencePage_12=Al&ways -LaunchingPreferencePage_13=Ne&ver -LaunchingPreferencePage_14=Pr&ompt -LaunchingPreferencePage_15=Launch in debug mode when workspace contains breakpoints -LaunchingPreferencePage_16=Alway&s -LaunchingPreferencePage_17=Neve&r -LaunchingPreferencePage_18=Promp&t -LaunchingPreferencePage_21=Continue launch if project contains errors -LaunchingPreferencePage_22=Al&ways -LaunchingPreferencePage_23=Pr&ompt -LaunchingPreferencePage_26=Search for, select, and upgrade launch configurations to be compatible with current tooling. -LaunchingPreferencePage_27=Mi&grate... -LaunchingPreferencePage_28=Select Launch Configurations -LaunchingPreferencePage_29=No Candidates -LaunchingPreferencePage_30=None of the available launch configurations require migration. -LaunchingPreferencePage_31=Migrating launch configurations... -LaunchingPreferencePage_32=Launch Configuration Filters -LaunchingPreferencePage_33=&Filter configurations in closed projects -LaunchingPreferencePage_34=Filter configurations in dele&ted or missing projects -LaunchingPreferencePage_35=Migration -LaunchingPreferencePage_36=General Options -LaunchingPreferencePage_37=Always launch the previously launched appli&cation -LaunchingPreferencePage_38=Launch t&he selected resource or active editor. If not launchable: -LaunchingPreferencePage_39=Launch the associated pro&ject -LaunchingPreferencePage_40=Launch Operation -LaunchingPreferencePage_41=La&unch the previously launched application -LaunchingPreferencePage_confirm_0=Prompt for confirmation when removin&g a configuration from the launch history - -ProcessPropertyPage_Command_Line__1=Co&mmand Line: -ProcessPropertyPage_0=Run-&at time: -ProcessPropertyPage_1=&Path: -ProcessPropertyPage_2=Process properties -ProcessPropertyPage_3=No path information available -ProcessPropertyPage_4=No time information available -ProcessPropertyPage_5=No command line information provided - -SimpleVariablePreferencePage_3=Variable -SimpleVariablePreferencePage_4=Value -SimpleVariablePreferencePage_5=Description -SimpleVariablePreferencePage_6=&Create and configure string substitution variables. -SimpleVariablePreferencePage_7=&New... -SimpleVariablePreferencePage_8=&Edit... -SimpleVariablePreferencePage_9=&Remove -SimpleVariablePreferencePage_10=&Name: -SimpleVariablePreferencePage_11=&Value: -SimpleVariablePreferencePage_12=&Description: -SimpleVariablePreferencePage_13=New String Substitution Variable -SimpleVariablePreferencePage_14=Edit Variable: {0} -SimpleVariablePreferencePage_15=Overwrite variable? -SimpleVariablePreferencePage_16=A variable named {0} already exists. Overwrite? -SimpleLaunchVariablePreferencePage_21=Remove Contributed Variables -SimpleLaunchVariablePreferencePage_22=The following variables were contributed by plug-ins. Removing them may cause unknown problems.\n{0}\nProceed? -SimpleLaunchVariablePreferencePage_23=\ [contributed] -StringVariablePreferencePage_24=Error -StringVariablePreferencePage_25=Unable to save changes -StringVariablePreferencePage_26=\ [read only] -StringVariablePreferencePage_27=Contributed By -StringVariablePreferencePage_23=Cannot overwrite read only variable -StringVariablePreferencePage_22=A read only variable named {0} already exists. Read only variables can not be overwritten. -StringVariablePreferencePage_21=Problem creating variable -StringVariablePreferencePage_20=Variables cannot have an empty name. -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 -ViewManagementPreferencePage_2=&Perspectives: -ViewManagementPreferencePage_3=Do ¬ automatically open/close views which have been manually closed/opened. -ViewManagementPreferencePage_4=The list of views that have been manually opened/closed is persisted between sessions. -ViewManagementPreferencePage_5=&Reset -PerspectivePreferencePage_0=These settings control perspectives for running and debugging. A perspective can automatically open when launching or when an application suspends. -PerspectivePreferencePage_1=Appli&cation Types/Launchers: -PerspectivePreferencePage_2=Modes/Perspec&tives: -PerspectivePreferencePage_4=None -PerspectivePreferencePage_5=These settings assign perspectives to each application type or launcher and launch mode set. Select "None" to indicate that a perspective should not be opened. -LaunchConfigurationsPreferencePage_0=Filter checked launch configuration type&s: -LaunchConfigurationsPreferencePage_1=Launch Configurations -LaunchConfigurationsPreferencePage_2=Delete &configurations when associated resource is deleted -LaunchConfigurationsPreferencePage_3=Apply window &working set(s) -LaunchDelegatesPreferencePage_1=The settings on this page specify which launcher to use when multiple launchers are available for a configuration and launch mode. -LaunchDelegatesPreferencePage_2=Launch &Type/Mode: -LaunchDelegatesPreferencePage_3=P&referred Launcher: -LaunchDelegatesPreferencePage_0=Default Launcher -LaunchDelegatesPreferencePage_4=Launcher Description -LaunchPerspectivePreferencePage_0=There is no perspective information available to change. -LaunchPerspectivePreferencePage_1=The selected types/launchers do not have any common mode sets. -DefaultLaunchConfigurationsPropertiesPage_0=This page allows you to manage launch configurations associated with the currently selected resource. -DefaultLaunchConfigurationsPropertiesPage_1=Launch con&figurations for ''{0}'': -DefaultLaunchConfigurationsPropertiesPage_2=&New... -DefaultLaunchConfigurationsPropertiesPage_3=Create new launch configuration -DefaultLaunchConfigurationsPropertiesPage_4=Du&plicate -DefaultLaunchConfigurationsPropertiesPage_5=Duplicate selected launch configuration -DefaultLaunchConfigurationsPropertiesPage_6=&Edit... -DefaultLaunchConfigurationsPropertiesPage_7=Edit selected launch configuration -DefaultLaunchConfigurationsPropertiesPage_8=De&lete -DefaultLaunchConfigurationsPropertiesPage_9=Delete selected launch configuration -DefaultLaunchConfigurationsPropertiesPage_11=Select Configuration Type -DefaultLaunchConfigurationsPropertiesPage_12=&Select the type of configuration to create: -RunDebugPropertiesPage_0=There was a problem trying to edit {0} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java deleted file mode 100644 index 971aa7fb7..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java +++ /dev/null @@ -1,298 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * QNX Software Systems - Mikhail Khodjaiants - Registers View (Bug 53640) - * Wind River Systems - Pawel Piech - Added Modules view (bug 211158) - *******************************************************************************/ -package org.eclipse.debug.internal.ui.preferences; - - -import org.eclipse.debug.ui.IDebugUIConstants; - -/** - * Constants defining the keys to be used for accessing preferences - * inside the debug ui plugin's preference bundle. - * - * In descriptions (of the keys) below describe the preference - * stored at the given key. The type indicates type of the stored preferences - * - * The preference store is loaded by the plugin (DebugUIPlugin). - * @see DebugUIPlugin.initializeDefaultPreferences(IPreferenceStore) - for initialization of the store - */ -public interface IDebugPreferenceConstants { - - /** - * The symbolic names for colors for displaying the content in the Console - * @see org.eclipse.jface.resource.ColorRegistry - */ - public static final String CONSOLE_SYS_ERR_COLOR= "org.eclipse.debug.ui.errorColor"; //$NON-NLS-1$ - public static final String CONSOLE_SYS_OUT_COLOR= "org.eclipse.debug.ui.outColor"; //$NON-NLS-1$ - public static final String CONSOLE_SYS_IN_COLOR= "org.eclipse.debug.ui.inColor"; //$NON-NLS-1$ - public static final String CONSOLE_BAKGROUND_COLOR= "org.eclipse.debug.ui.consoleBackground"; //$NON-NLS-1$ - - /** - * @deprecated use IDebugUIConstants.PREF_MEMORY_HISTORY_UNKNOWN_COLOR instead - */ - public static final String MEMORY_VIEW_UNBUFFERED_LINE_COLOR = IDebugUIConstants.PLUGIN_ID + ".MemoryViewLineColor"; //$NON-NLS-1$ - - /** - * @deprecated use IDebugUIConstants.PREF_MEMORY_HISTORY_KNOWN_COLOR instead - */ - public static final String MEMORY_VIEW_BUFFERED_LINE_COLOR = IDebugUIConstants.PLUGIN_ID + ".MemoryViewBufferedLineColor"; //$NON-NLS-1$ - - /** - * (boolean) Whether or not the text in the console will wrap - */ - public static final String CONSOLE_WRAP= "Console.wrap"; //$NON-NLS-1$ - - /** - * (int) The maximum console character width, if wrapping. - */ - public static final String CONSOLE_WIDTH = "Console.width"; //$NON-NLS-1$ - - /** - * (boolean) Whether or not the console view is shown - * when there is program output. - */ - public static final String CONSOLE_OPEN_ON_OUT= "DEBUG.consoleOpenOnOut"; //$NON-NLS-1$ - /** - * (boolean) Whether or not the console view is shown - * when there is program error. - */ - public static final String CONSOLE_OPEN_ON_ERR= "DEBUG.consoleOpenOnErr"; //$NON-NLS-1$ - - /** - * Console buffer high and low water marks - */ - public static final String CONSOLE_LIMIT_CONSOLE_OUTPUT = "Console.limitConsoleOutput"; //$NON-NLS-1$ - public static final String CONSOLE_LOW_WATER_MARK = "Console.lowWaterMark"; //$NON-NLS-1$ - public static final String CONSOLE_HIGH_WATER_MARK = "Console.highWaterMark"; //$NON-NLS-1$ - - /** - * Integer preference specifying the number of spaces composing a - * tab in the console. - * - * @since 3.0 - */ - public static final String CONSOLE_TAB_WIDTH= "Console.console_tab_width"; //$NON-NLS-1$ - - - - /** - * The orientation of the detail view in the VariablesView - */ - public static final String VARIABLES_DETAIL_PANE_ORIENTATION = "Variables.detail.orientation"; //$NON-NLS-1$ - public static final String EXPRESSIONS_DETAIL_PANE_ORIENTATION = "Expressions.detail.orientation"; //$NON-NLS-1$ - public static final String REGISTERS_DETAIL_PANE_ORIENTATION = "Registers.detail.orientation"; //$NON-NLS-1$ - public static final String MODULES_DETAIL_PANE_ORIENTATION = "Modules.detail.orientation"; //$NON-NLS-1$ - public static final String VARIABLES_DETAIL_PANE_RIGHT = "Variables.detail.orientation.right"; //$NON-NLS-1$ - public static final String VARIABLES_DETAIL_PANE_UNDERNEATH = "Variables.detail.orientation.underneath"; //$NON-NLS-1$ - public static final String VARIABLES_DETAIL_PANE_HIDDEN = "Variables.detail.orientation.hidden"; //$NON-NLS-1$ - - /** - * Memento for the last selected launch config in the - * launch config dialog. - * - * @deprecated no longer supported - */ - public static final String PREF_LAST_LAUNCH_CONFIGURATION_SELECTION = IDebugUIConstants.PLUGIN_ID + ".lastLaunchConfigSelection"; //$NON-NLS-1$ - - /** - * The maximum size of the launch history list - */ - public static int MAX_LAUNCH_HISTORY_SIZE= 40; - - /** - * Boolean preference controlling whether the text in the detail panes is - * wrapped. When <code>true</code> the text in the detail panes will be - * wrapped in new variable view. - * - * @since 2.1 - */ - public static final String PREF_DETAIL_PANE_WORD_WRAP = IDebugUIConstants.PLUGIN_ID + ".detail_pane_word_wrap"; //$NON-NLS-1$ - - /** - * Column size preference for the Memory View - * - * @since 3.0 - */ - public static final String PREF_COLUMN_SIZE = "org.eclipse.debug.ui.memory.columnSize"; //$NON-NLS-1$ - - /** - * Default column size for the Memory View - * - * @since 3.0 - */ - public static final int PREF_COLUMN_SIZE_DEFAULT = 4; - - - /** - * Row size preference for Memory View - * - * @since 3.2 - */ - public static final String PREF_ROW_SIZE = "org.eclipse.debug.ui.memory.rowSize"; //$NON-NLS-1$ - - /** - * Default row size for the Memory View - * - * @since 3.2 - */ - public static final int PREF_ROW_SIZE_DEFAULT = 16; - - /** - * Stores the boolean preference of whether to prompt when removing all breakpoints. - * @since 3.3 - */ - public static final String PREF_PROMPT_REMOVE_ALL_BREAKPOINTS = IDebugUIConstants.PLUGIN_ID + ".remove_all_breakpoints_prompt"; //$NON-NLS-1$ - - /** - * stores the boolean preference of whether or not to prompt when removing all of the breakpoints - * from a breakpoints container. - * @since 3.3 - */ - public static final String PREF_PROMPT_REMOVE_BREAKPOINTS_FROM_CONTAINER = IDebugUIConstants.PLUGIN_ID + ".remove_breakpoints_from_container_prompt"; //$NON-NLS-1$ - - /** - * Stores the boolean preference of whether to prompt when removing all expressions. - * @since 3.5 - */ - public static final String PREF_PROMPT_REMOVE_ALL_EXPRESSIONS = IDebugUIConstants.PLUGIN_ID + ".remove_all_expressions_prompt"; //$NON-NLS-1$ - - /** - * Default padded string for renderings - * - * @since 3.1 - */ - public static final String PREF_PADDED_STR_DEFAULT = "??"; //$NON-NLS-1$ - - /** - * Default ASCII code page if ASCII code page preference is not set. - * @since 3.1 - */ - public static final String DEFAULT_ASCII_CP = "CP1252"; //$NON-NLS-1$ - - - /** - * Default EBCDIC code page if EBCDIC code page preference is not set. - * @since 3.1 - */ - public static final String DEFAULT_EBCDIC_CP = "CP037"; //$NON-NLS-1$ - - /** - * Preference to determine if table rendering should dynamically load - * memory as the user scrolls - * - * @since 3.1 - */ - public static final String PREF_DYNAMIC_LOAD_MEM = "org.eclpise.debug.ui.memory.dynamicLoad"; //$NON-NLS-1$ - - - /** - * Size of buffer in a table rendering when dynamic loading mode is off. - * - * @since 3.1 - */ - public static final String PREF_TABLE_RENDERING_PAGE_SIZE = "org.eclispe.debug.ui.memory.pageSize"; //$NON-NLS-1$ - - /** - * Default page size when dynamic loading mode is off. This preference is stored - * in number of lines. - * - * @since 3.1 - */ - public static final int DEFAULT_PAGE_SIZE = 20; - /** - * Preference for defining behavior when resetting a memory monitor. - * Possible values: - * - RESET_AL - reset all renderings regardless if they are visible or not - * - RESET_VISIBLE - reset visible renderings - * - * @since 3.2 - */ - public static final String PREF_RESET_MEMORY_BLOCK = IDebugUIConstants.PLUGIN_ID + ".reset_memory_block"; //$NON-NLS-1$ - - /** - * Constant to indicate that the memory view will reset all memory renderings when the reset - * memory monitor action is invoked. - * - * @since 3.2 - */ - public static final String RESET_ALL = IDebugUIConstants.PLUGIN_ID + "resetMemoryBlock.all"; //$NON-NLS-1$ - - - /** - * Constant to indicate that the memory view will reset visible memory renderings when - * the reset memory monitor action is invoked - * - * @since 3.2 - */ - public static final String RESET_VISIBLE = IDebugUIConstants.PLUGIN_ID + "resetMemoryBlock.visible"; //$NON-NLS-1$ - - /** - * Preference identifier for the row size in a table rendering. - * This preference is expected to be saved by an </code>IPersistableDebugElement</code>. - * Memory Blocks can optionally provide and save this preference to customize - * the initial format of a table rendering. - * - * The value of this property is an Integer. The value can be one of the - * following values: 1, 2, 4, 8, 16. This value must be greater than - * <code>PREF_COL_SIZE_BY_MODEL</code> and must also be divisible by <code>PREF_COL_SIZE_BY_MODEL</code>. - * - * @since 3.2 - */ - public static final String PREF_ROW_SIZE_BY_MODEL = "org.eclipse.debug.ui.AbstractTableRendering.rowSize"; //$NON-NLS-1$ - /** - * Preference identifier for the column size in a table rendering. - * This preference is expected to be saved by an <code>IPersistableDebugElement</code>. - * Memory Blocks can optionally provide and save this preference to customize - * the initial format of a table rendering. - * - * The value of this property is an Integer. The value can be one of the - * following values: 1, 2, 4, 8, 16. This value must be smaller than - * <code>PREF_ROW_SIZE_BY_MODEL</code>. <code>PREF_ROW_SIZE_BY_MODEL</code> must be divisible by <code>PREF_COL_SIZE_BY_MODEL</code>. - * - * @since 3.2 - */ - public static final String PREF_COL_SIZE_BY_MODEL = "org.eclipse.debug.ui.AbstractTableRendering.colSize"; //$NON-NLS-1$ - - /** - * Number of lines to preload before the visible region in the table rendering - * - * @since 3.3 - */ - public static final String PREF_TABLE_RENDERING_PRE_BUFFER_SIZE = "org.eclispe.debug.ui.memory.preBufferSize"; //$NON-NLS-1$ - - /** - * Number of lines to preload after the visible region in the table rendering - * - * @since 3.3 - */ - public static final String PREF_TABLE_RENDERING_POST_BUFFER_SIZE = "org.eclispe.debug.ui.memory.postBufferSize"; //$NON-NLS-1$ - - /** - * The layout mode in Debug view. - * - * @since 3.5 - */ - public static final String DEBUG_VIEW_MODE = "org.eclispe.debug.ui.Debug_view.mode"; //$NON-NLS-1$ - public static final String DEBUG_VIEW_MODE_AUTO = "Debug_view.mode.auto"; //$NON-NLS-1$ - public static final String DEBUG_VIEW_MODE_COMPACT = "Debug_view.mode.compact"; //$NON-NLS-1$ - public static final String DEBUG_VIEW_MODE_FULL = "Debug_view.mode.full"; //$NON-NLS-1$ - - /** - * Preference whether to auto-expand in the breadcrumb drop-down viewers. - * - * @since 3.5 - */ - public static final String DEBUG_VIEW_BREADCRUMB_AUTO_EXPAND_DROP_DOWN = "org.eclispe.debug.ui.Debug_view.Breadcrumb.dropDownAutoexpand"; //$NON-NLS-1$ -} - - - diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchConfigurationsPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchConfigurationsPreferencePage.java deleted file mode 100644 index b0850b8eb..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchConfigurationsPreferencePage.java +++ /dev/null @@ -1,396 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.preferences; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Platform; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.internal.core.Preferences; -import org.eclipse.debug.internal.core.IInternalDebugCoreConstants; -import org.eclipse.debug.internal.core.LaunchManager; -import org.eclipse.debug.internal.ui.AbstractDebugCheckboxSelectionDialog; -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.IDebugHelpContextIds; -import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; -import org.eclipse.debug.internal.ui.SWTFactory; -import org.eclipse.debug.internal.ui.launchConfigurations.LaunchCategoryFilter; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.preference.BooleanFieldEditor; -import org.eclipse.jface.preference.FieldEditor; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.IBaseLabelProvider; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.wizard.ProgressMonitorPart; -import org.eclipse.swt.SWT; -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.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.model.AdaptableList; -import org.eclipse.ui.model.WorkbenchContentProvider; -import org.eclipse.ui.model.WorkbenchViewerComparator; - -/** - * Provides the Launch Configuration preference page to the Run/Debug preferences - * - * This page allows users to set filtering options as well as perform migration tasks. - * This class is not intended to be sub-classed - * @since 3.2 - */ -public class LaunchConfigurationsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - - /** - * Creates a dialog that allows users to select one or more projects to migrate. - * @since 3.2 - */ - class LaunchConfigurationMigrationSelectionDialog extends AbstractDebugCheckboxSelectionDialog { - - private Object fInput; - - public LaunchConfigurationMigrationSelectionDialog(Shell parentShell, Object input) { - super(parentShell); - fInput = input; - setShellStyle(getShellStyle() | SWT.RESIZE); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getDialogSettingsId() - */ - protected String getDialogSettingsId() { - return IDebugUIConstants.PLUGIN_ID + ".MIGRATION_SELECTION_DIALOG"; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getHelpContextId() - */ - protected String getHelpContextId() { - return IDebugHelpContextIds.SELECT_LAUNCH_CONFIGURATION_MIGRATION_DIALOG; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getViewerInput() - */ - protected Object getViewerInput() { - return fInput; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getViewerLabel() - */ - protected String getViewerLabel() { - return DebugPreferencesMessages.LaunchingPreferencePage_0; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getContentProvider() - */ - protected IContentProvider getContentProvider() { - return new WorkbenchContentProvider(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getLabelProvider() - */ - protected IBaseLabelProvider getLabelProvider() { - return DebugUITools.newDebugModelPresentation(); - } - } - - /** - * Content provider for the launch configuration type table - */ - class TableContentProvider implements IStructuredContentProvider { - - public Object[] getElements(Object inputElement) { - return getLaunchConfigurationTypes(); - } - - public void dispose() {} - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {} - } - - /** - * to monitor the progress of the migration process - */ - private ProgressMonitorPart fMonitor; - - /** - * the migrate now button - */ - private Button fMigrateNow; - - /** - * a list of the field editors - */ - private List fFieldEditors; - - /** - * Boolean editor for debug core plug-in preference - */ - private Button fDeleteConfigs; - - /** - * The table for the launch configuration types - */ - private Table fTable; - - /** - * Constructor - */ - public LaunchConfigurationsPreferencePage() { - super(); - setPreferenceStore(DebugUIPlugin.getDefault().getPreferenceStore()); - setTitle(DebugPreferencesMessages.LaunchConfigurationsPreferencePage_1); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent) { - super.createControl(parent); - PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.LAUNCH_CONFIGURATION_PREFERENCE_PAGE); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) - */ - protected Control createContents(Composite parent) { - fFieldEditors = new ArrayList(); - Composite comp = SWTFactory.createComposite(parent, parent.getFont(), 1, 1, GridData.FILL_HORIZONTAL); - //filtering options - Group group = SWTFactory.createGroup(comp, DebugPreferencesMessages.LaunchingPreferencePage_32, 1, 1, GridData.FILL_HORIZONTAL); - Composite spacer = SWTFactory.createComposite(group, group.getFont(), 1, 1, GridData.FILL_HORIZONTAL); - FieldEditor edit = new BooleanFieldEditor(IInternalDebugUIConstants.PREF_FILTER_LAUNCH_CLOSED, DebugPreferencesMessages.LaunchingPreferencePage_33, SWT.NONE, spacer); - fFieldEditors.add(edit); - edit = new BooleanFieldEditor(IInternalDebugUIConstants.PREF_FILTER_LAUNCH_DELETED, DebugPreferencesMessages.LaunchingPreferencePage_34, SWT.NONE, spacer); - fFieldEditors.add(edit); - edit = new BooleanFieldEditor(IInternalDebugUIConstants.PREF_FILTER_WORKING_SETS, DebugPreferencesMessages.LaunchConfigurationsPreferencePage_3, SWT.NONE, spacer); - fFieldEditors.add(edit); - fDeleteConfigs = SWTFactory.createCheckButton(comp, DebugPreferencesMessages.LaunchConfigurationsPreferencePage_2, null, false, 3); - - //add table options - createTypeFiltering(group); - - //migration - group = SWTFactory.createGroup(comp, DebugPreferencesMessages.LaunchingPreferencePage_35, 1, 1, GridData.FILL_HORIZONTAL); - Label label = new Label(group, SWT.LEFT | SWT.WRAP); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.widthHint = 350; - label.setLayoutData(gd); - label.setText(DebugPreferencesMessages.LaunchingPreferencePage_26); - label.setFont(parent.getFont()); - fMigrateNow = SWTFactory.createPushButton(group, DebugPreferencesMessages.LaunchingPreferencePage_27, null); - gd = new GridData(SWT.BEGINNING); - - fMigrateNow.setLayoutData(gd); - fMigrateNow.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) {} - public void widgetSelected(SelectionEvent e) { - handleMigrateNowSelected(); - } - }); - - //init field editors - initFieldEditors(); - fTable.setEnabled(getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_FILTER_LAUNCH_TYPES)); - return comp; - } - - /** - * @param parent the parent to add this composite to - * @return the new composite with the type selection table in it - */ - private Composite createTypeFiltering(Composite parent) { - Composite comp = SWTFactory.createComposite(parent, parent.getFont(), 1, 1, GridData.FILL_HORIZONTAL); - BooleanFieldEditor2 editor = new BooleanFieldEditor2(IInternalDebugUIConstants.PREF_FILTER_LAUNCH_TYPES, DebugPreferencesMessages.LaunchConfigurationsPreferencePage_0, SWT.NONE, comp); - editor.setPropertyChangeListener(new IPropertyChangeListener() { - public void propertyChange(PropertyChangeEvent event) { - boolean newvalue = false; - if(event.getNewValue() instanceof Boolean) { - newvalue = ((Boolean)event.getNewValue()).booleanValue(); - } - else { - newvalue = Boolean.valueOf(event.getNewValue().toString()).booleanValue(); - } - if(newvalue) { - fTable.setEnabled(true); - } - else { - fTable.setEnabled(false); - } - } - }); - fFieldEditors.add(editor); - fTable = new Table(comp, SWT.CHECK | SWT.BORDER); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.heightHint = 155; - fTable.setLayoutData(gd); - CheckboxTableViewer tviewer = new CheckboxTableViewer(fTable); - tviewer.setLabelProvider(DebugUITools.newDebugModelPresentation()); - tviewer.setContentProvider(new TableContentProvider()); - tviewer.setComparator(new WorkbenchViewerComparator()); - // filter external tool builders - tviewer.addFilter(new LaunchCategoryFilter(IInternalDebugUIConstants.ID_EXTERNAL_TOOL_BUILDER_LAUNCH_CATEGORY)); - tviewer.setInput(getLaunchConfigurationTypes()); - fTable.setFont(parent.getFont()); - return comp; - } - - /** - * returns the launch configuration types - * @return the launch configuration types - */ - private ILaunchConfigurationType[] getLaunchConfigurationTypes() { - return DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes(); - } - - /** - * handles the Migrate button being clicked - * - * @since 3.2 - */ - private void handleMigrateNowSelected() { - try { - ILaunchManager lmanager = DebugPlugin.getDefault().getLaunchManager(); - ILaunchConfiguration[] configurations = lmanager.getMigrationCandidates(); - //separate the private from the public - List pub = new ArrayList(); - for(int i = 0; i < configurations.length; i++) { - if(DebugUITools.isPrivate(configurations[i])) { - //auto-migrate private ones - configurations[i].migrate(); - } - else { - pub.add(configurations[i]); - } - } - if(pub.size() == 0) { - MessageDialog.openInformation(getShell(), DebugPreferencesMessages.LaunchingPreferencePage_29, DebugPreferencesMessages.LaunchingPreferencePage_30); - return; - } - LaunchConfigurationMigrationSelectionDialog listd = new LaunchConfigurationMigrationSelectionDialog(getShell(),new AdaptableList(pub)); - listd.setTitle(DebugPreferencesMessages.LaunchingPreferencePage_28); - listd.setInitialSelections(configurations); - if(listd.open() == IDialogConstants.OK_ID) { - fMonitor = new ProgressMonitorPart(fMigrateNow.getParent(), new GridLayout()); - Object[] objs = listd.getResult(); - fMonitor.beginTask(DebugPreferencesMessages.LaunchingPreferencePage_31, objs.length); - for(int i = 0; i < objs.length; i++) { - if(objs[i] instanceof ILaunchConfiguration) { - ((ILaunchConfiguration)objs[i]).migrate(); - } - fMonitor.worked(1); - } - fMonitor.done(); - fMonitor.dispose(); - } - } - catch (CoreException e) {DebugUIPlugin.log(e);} - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) - */ - public void init(IWorkbench workbench) {} - - /** - * Initializes the field editors to their values - * @since 3.2 - */ - private void initFieldEditors() { - FieldEditor editor; - for(int i = 0; i < fFieldEditors.size(); i++) { - editor = (FieldEditor)fFieldEditors.get(i); - editor.setPreferenceStore(getPreferenceStore()); - editor.load(); - } - fDeleteConfigs.setSelection( - Platform.getPreferencesService().getBoolean(DebugPlugin.getUniqueIdentifier(), - LaunchManager.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE, true, null)); - //restore the tables' checked state - String[] types = getPreferenceStore().getString(IInternalDebugUIConstants.PREF_FILTER_TYPE_LIST).split("\\,"); //$NON-NLS-1$ - TableItem[] items = fTable.getItems(); - ILaunchConfigurationType type; - for(int i = 0; i < types.length; i++) { - for(int j = 0; j < items.length; j++) { - type = (ILaunchConfigurationType)items[j].getData(); - if(type.getIdentifier().equals(types[i])) { - items[j].setChecked(true); - } - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#performDefaults() - */ - protected void performDefaults() { - fDeleteConfigs.setSelection(Preferences.getDefaultBoolean(DebugPlugin.getUniqueIdentifier(), LaunchManager.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE, true)); - FieldEditor editor = null; - for(int i = 0; i < fFieldEditors.size(); i++) { - editor = (FieldEditor)fFieldEditors.get(i); - editor.loadDefault(); - if(editor instanceof BooleanFieldEditor2) { - fTable.setEnabled(((BooleanFieldEditor2)editor).getBooleanValue()); - } - } - - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#performOk() - */ - public boolean performOk() { - //save field editors - for(int i = 0; i < fFieldEditors.size(); i++) { - ((FieldEditor)fFieldEditors.get(i)).store(); - } - Preferences.setBoolean(DebugPlugin.getUniqueIdentifier(), LaunchManager.PREF_DELETE_CONFIGS_ON_PROJECT_DELETE, fDeleteConfigs.getSelection(), null); - //save table - String types = IInternalDebugCoreConstants.EMPTY_STRING; - TableItem[] items = fTable.getItems(); - ILaunchConfigurationType type; - for(int i = 0; i < items.length; i++) { - if(items[i].getChecked()) { - type = (ILaunchConfigurationType)items[i].getData(); - types += type.getIdentifier()+","; //$NON-NLS-1$ - } - } - getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_FILTER_TYPE_LIST, types); - return super.performOk(); - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchPerspectivePreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchPerspectivePreferencePage.java deleted file mode 100644 index 3783607e2..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchPerspectivePreferencePage.java +++ /dev/null @@ -1,625 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.preferences; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.debug.core.ILaunchDelegate; -import org.eclipse.debug.internal.core.IInternalDebugCoreConstants; -import org.eclipse.debug.internal.core.LaunchDelegate; -import org.eclipse.debug.internal.core.LaunchManager; -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.IDebugHelpContextIds; -import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; -import org.eclipse.debug.internal.ui.SWTFactory; -import org.eclipse.debug.internal.ui.launchConfigurations.LaunchCategoryFilter; -import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPresentationManager; -import org.eclipse.debug.internal.ui.launchConfigurations.PerspectiveManager; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.MessageDialogWithToggle; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.preference.RadioGroupFieldEditor; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.GridData; -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.Tree; -import org.eclipse.swt.widgets.TreeItem; -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; -import org.eclipse.ui.activities.ActivityManagerEvent; -import org.eclipse.ui.activities.IActivityManagerListener; -import org.eclipse.ui.activities.WorkbenchActivityHelper; -import org.eclipse.ui.model.WorkbenchViewerComparator; - -/** - * The preference page for selecting and changing launch perspectives - * - * @since 3.3 - */ -public class LaunchPerspectivePreferencePage extends PreferencePage implements IWorkbenchPreferencePage, IActivityManagerListener { - - /** - * Represents a perspective delta for a given type, delegate and mode set combination. - */ - final class PerspectiveChange { - private ILaunchConfigurationType fType = null; - private ILaunchDelegate fDelegate = null; - private Set fModes = null; - private String fPid = null; - - public PerspectiveChange(ILaunchConfigurationType type, ILaunchDelegate delegate, Set modes, String perspectiveid) { - fType = type; - fDelegate = delegate; - fModes = modes; - fPid = perspectiveid; - } - - public ILaunchConfigurationType getType() {return fType;} - public ILaunchDelegate getDelegate() {return fDelegate;} - public String getPerspectiveId() {return fPid;} - public Set getModes() {return fModes;} - public boolean equals(Object o) { - if(o instanceof PerspectiveChange) { - PerspectiveChange change = (PerspectiveChange) o; - return change.getDelegate() == fDelegate && - change.getType().equals(fType) && - change.getModes().equals(fModes); - } - return super.equals(o); - } - } - - /** - * Implementation to expose use of getFilteredChildren method - */ - final class PerspectivesTreeViewer extends TreeViewer { - public PerspectivesTreeViewer(Tree tree) { - super(tree); - } - public Object[] getFilteredChildren(Object o) {return super.getFilteredChildren(o);} - } - - /** - * Provides content for the configuration tree viewer - */ - final class PerspectiveContentProvider implements ITreeContentProvider { - public Object[] getChildren(Object parentElement) { - if(parentElement instanceof ILaunchConfigurationType) { - ILaunchConfigurationType type = (ILaunchConfigurationType) parentElement; - return ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).getLaunchDelegates(type.getIdentifier()); - } - return new Object[0]; - } - public Object[] getElements(Object inputElement) { - return DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes(); - } - public boolean hasChildren(Object element) {return element instanceof ILaunchConfigurationType;} - public Object getParent(Object element) {return null;} - public void dispose() {} - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {} - } - - /** - * Panel container that is reused to present series of combo boxes to users for perspective selections - */ - class PerspectivesPanel { - - private Composite fMainComposite = null; - private Label fMessage = null; - - public PerspectivesPanel(Composite parent, String heading) { - createPanel(parent, heading); - } - - protected void createPanel(Composite parent, String heading) { - fMainComposite = SWTFactory.createComposite(parent, 2, 1, GridData.FILL_BOTH); - SWTFactory.createWrapLabel(fMainComposite, heading, 2); - fMessage = SWTFactory.createWrapLabel(fMainComposite, IInternalDebugCoreConstants.EMPTY_STRING, 2, 250); - } - - public void setMessage(String msg) { - fMessage.setText((msg == null ? IInternalDebugCoreConstants.EMPTY_STRING : msg)); - } - - public void refreshPanel(IStructuredSelection selection) { - //get rid of any existing children, but leave the first two (the label for the control, and the message area) - Control[] children = fMainComposite.getChildren(); - for(int i = 2; i < children.length; i++) { - children[i].dispose(); - } - if(fgCurrentWorkingContext == null) { - fgCurrentWorkingContext = new HashSet(); - } - fgCurrentWorkingContext.clear(); - if(!selection.isEmpty()) { - Point pt = getShell().getSize(); - createCombos(fMainComposite, selection.toArray()); - fMainComposite.layout(); - if(!fInitializing) { - Point pt2 = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT, true); - if(pt2.x > pt.x) { - getShell().setSize(pt2); - } - } - } - else { - SWTFactory.createWrapLabel(fMainComposite, DebugPreferencesMessages.LaunchPerspectivePreferencePage_0, 2, 275); - } - fMainComposite.layout(); - } - } - - /** - * Widgets - */ - private RadioGroupFieldEditor fSwitchLaunch = null; - private RadioGroupFieldEditor fSwitchSuspend = null; - private Tree fTree = null; - private PerspectivesTreeViewer fTreeViewer = null; - private PerspectivesPanel fPerspectivesPanel = null; - - /** - * Caches - */ - private static String[] fgPerspectiveLabels = null; - private static Map fgPerspectiveIdMap = null; - private static HashSet fgChangeSet = null; - private static HashSet fgCurrentWorkingContext = null; - - /** - * fields - */ - private boolean fInitializing = false; - - /** - * A default selection listener to be reused by all combo boxes presenting perspective data - */ - private SelectionListener fSelectionListener = new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) {} - public void widgetSelected(SelectionEvent e) { - Object o = e.getSource(); - if(o instanceof Combo) { - Combo combo = (Combo) o; - LaunchDelegate delegate = null; - ILaunchConfigurationType type = null; - PerspectiveChange change = null; - Set modes = null; - for(Iterator iter = fgCurrentWorkingContext.iterator(); iter.hasNext();) { - o = iter.next(); - if(o instanceof ILaunchDelegate) { - delegate = (LaunchDelegate) o; - type = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(delegate.getLaunchConfigurationTypeId()); - } - else if(o instanceof ILaunchConfigurationType) { - delegate = null; - type = (ILaunchConfigurationType) o; - } - modes = (Set) combo.getData(); - change = findChange(type, delegate, modes); - if(change == null) { - change = new PerspectiveChange(type, delegate, modes, (String)fgPerspectiveIdMap.get(combo.getText())); - fgChangeSet.add(change); - } - else { - change.fPid = (String)fgPerspectiveIdMap.get(combo.getText()); - } - } - } - } - }; - - /** - * Constructor - */ - public LaunchPerspectivePreferencePage() {} - - /** - * @see org.eclipse.jface.dialogs.DialogPage#dispose() - */ - public void dispose() { - PlatformUI.getWorkbench().getActivitySupport().getActivityManager().removeActivityManagerListener(this); - fgPerspectiveIdMap.clear(); - fgPerspectiveIdMap = null; - fgPerspectiveLabels = null; - fgChangeSet.clear(); - fgChangeSet = null; - if(fgCurrentWorkingContext != null) { - fgCurrentWorkingContext.clear(); - fgCurrentWorkingContext = null; - } - super.dispose(); - } - - /** - * @see org.eclipse.jface.preference.PreferencePage#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent) { - super.createControl(parent); - PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.PERSPECTIVE_PREFERENCE_PAGE); - } - - /** - * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) - */ - protected Control createContents(Composite parent) { - - SWTFactory.createWrapLabel(parent, DebugPreferencesMessages.PerspectivePreferencePage_0, 2, 300); - - SWTFactory.createVerticalSpacer(parent, 1); - - fSwitchLaunch = new RadioGroupFieldEditor( - IInternalDebugUIConstants.PREF_SWITCH_TO_PERSPECTIVE, - DebugPreferencesMessages.LaunchingPreferencePage_11, 3, - new String[][] {{DebugPreferencesMessages.LaunchingPreferencePage_12, MessageDialogWithToggle.ALWAYS }, - { DebugPreferencesMessages.LaunchingPreferencePage_13, MessageDialogWithToggle.NEVER }, - { DebugPreferencesMessages.LaunchingPreferencePage_14, MessageDialogWithToggle.PROMPT } }, - SWTFactory.createComposite(parent, 1, 2, GridData.FILL_HORIZONTAL), - true); - fSwitchLaunch.setPreferenceName(IInternalDebugUIConstants.PREF_SWITCH_TO_PERSPECTIVE); - fSwitchLaunch.setPreferenceStore(getPreferenceStore()); - fSwitchSuspend = new RadioGroupFieldEditor( - IInternalDebugUIConstants.PREF_SWITCH_PERSPECTIVE_ON_SUSPEND, - DebugPreferencesMessages.DebugPreferencePage_21, 3, - new String[][] {{ DebugPreferencesMessages.DebugPreferencePage_22, MessageDialogWithToggle.ALWAYS }, - { DebugPreferencesMessages.DebugPreferencePage_23, MessageDialogWithToggle.NEVER }, - { DebugPreferencesMessages.DebugPreferencePage_24, MessageDialogWithToggle.PROMPT } }, - SWTFactory.createComposite(parent, 1, 2, GridData.FILL_HORIZONTAL), - true); - fSwitchSuspend.setPreferenceName(IInternalDebugUIConstants.PREF_SWITCH_PERSPECTIVE_ON_SUSPEND); - fSwitchSuspend.setPreferenceStore(getPreferenceStore()); - - SWTFactory.createVerticalSpacer(parent, 1); - SWTFactory.createWrapLabel(parent, DebugPreferencesMessages.PerspectivePreferencePage_5, 2, 300); - Composite comp = SWTFactory.createComposite(parent, parent.getFont(), 2, 1, GridData.FILL_BOTH, 0, 0); - createTreeViewer(comp); - fPerspectivesPanel = new PerspectivesPanel(comp, DebugPreferencesMessages.PerspectivePreferencePage_2); - initializeControls(); - PlatformUI.getWorkbench().getActivitySupport().getActivityManager().addActivityManagerListener(this); - Dialog.applyDialogFont(parent); - return parent; - } - - /** - * Creates the <code>Tree</code> and <code>TreeViewer</code> widgets - * @param parent the parent to add these components to - */ - protected void createTreeViewer(Composite parent) { - Composite comp = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_VERTICAL); - SWTFactory.createWrapLabel(comp, DebugPreferencesMessages.PerspectivePreferencePage_1, 1); - fTree = new Tree(comp, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.MULTI); - GridData gd = new GridData(GridData.FILL_VERTICAL); - gd.widthHint = 220; - gd.heightHint = 250; - fTree.setLayoutData(gd); - fTreeViewer = new PerspectivesTreeViewer(fTree); - fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - fPerspectivesPanel.refreshPanel((IStructuredSelection) event.getSelection()); - } - }); - fTreeViewer.setLabelProvider(DebugUITools.newDebugModelPresentation()); - fTreeViewer.setComparator(new WorkbenchViewerComparator()); - fTreeViewer.setContentProvider(new PerspectiveContentProvider()); - // filter external tool builders - fTreeViewer.addFilter(new LaunchCategoryFilter(IInternalDebugUIConstants.ID_EXTERNAL_TOOL_BUILDER_LAUNCH_CATEGORY)); - fTreeViewer.setInput(DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationTypes()); - } - - /** - * Creates a set of combo boxes on a per-selection basis that display a listing of available perspectives to switch to - * @param parent the parent to add the created combo boxes to - * @param selection the selection in the tree viewer - */ - protected void createCombos(Composite parent, Object[] selection) { - Set modes = collectCommonModeSets(selection); - if(modes.isEmpty()) { - fPerspectivesPanel.setMessage(DebugPreferencesMessages.LaunchPerspectivePreferencePage_1); - return; - } - fPerspectivesPanel.setMessage(IInternalDebugCoreConstants.EMPTY_STRING); - List fmodes = null; - Combo combo = null; - Set smodes = null; - for(Iterator iter = modes.iterator(); iter.hasNext();) { - smodes = (Set) iter.next(); - fmodes = LaunchConfigurationPresentationManager.getDefault().getLaunchModeNames(smodes); - if(!fmodes.isEmpty()) { - //add the mode set and create a combo - SWTFactory.createLabel(parent, fmodes.toString()+":", 1); //$NON-NLS-1$ - combo = SWTFactory.createCombo(parent, SWT.READ_ONLY, 1, fgPerspectiveLabels); - String text = getComboSelection(smodes); - if(text != null) { - combo.setText(text); - } - combo.setData(smodes); - combo.addSelectionListener(fSelectionListener); - GridData gd = (GridData)combo.getLayoutData(); - gd.grabExcessHorizontalSpace = true; - } - } - } - - /** - * Returns the text item to select for the current combo context given the current working set context - * @param modes the set of modes - * @return the text to select in the current combo / current working set context, or "None" - */ - private String getComboSelection(Set modes) { - String text = DebugPreferencesMessages.PerspectivePreferencePage_4; - IStructuredSelection ss = (IStructuredSelection) fTreeViewer.getSelection(); - if(ss != null && !ss.isEmpty()) { - Object o = null; - Set tmp = new HashSet(); - String id = null; - ILaunchConfigurationType type = null; - LaunchDelegate delegate = null; - PerspectiveChange change = null; - for(Iterator iter = ss.iterator(); iter.hasNext();) { - o = iter.next(); - if(o instanceof LaunchDelegate) { - delegate = (LaunchDelegate) o; - type = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(delegate.getLaunchConfigurationTypeId()); - } - else if(o instanceof ILaunchConfigurationType) { - type = (ILaunchConfigurationType) o; - } - change = findChange(type, delegate, modes); - if(change != null) { - id = change.getPerspectiveId(); - } - else { - id = DebugUIPlugin.getDefault().getPerspectiveManager().getLaunchPerspective(type, modes, delegate); - } - if(id == null) { - id = IDebugUIConstants.PERSPECTIVE_NONE; - } - tmp.add(id); - } - if(tmp.size() == 1) { - id = (String) tmp.iterator().next(); - if(!IDebugUIConstants.PERSPECTIVE_NONE.equals(id)) { - String label = null; - for(Iterator iter = fgPerspectiveIdMap.keySet().iterator(); iter.hasNext();) { - label = (String) iter.next(); - if(id.equals(fgPerspectiveIdMap.get(label))) { - return label; - } - } - } - } - } - - return text; - } - - /** - * Traverses the current change set to find a matching change. Matching in this context considers only the - * type, delegate and mode set, we do not compare perspective ids, as they can change many times. - * @param type the type - * @param delegate the delegate, possibly <code>null</code> - * @param modes the current mode set - * @return the existing <code>PerspectiveChange</code> if there is one, <code>null</code> otherwise - */ - private PerspectiveChange findChange(ILaunchConfigurationType type, ILaunchDelegate delegate, Set modes) { - PerspectiveChange change = new PerspectiveChange(type, delegate, modes, null); - Object o = null; - for(Iterator iter = fgChangeSet.iterator(); iter.hasNext();) { - o = iter.next(); - if(change.equals(o)) { - return (PerspectiveChange) o; - } - } - return null; - } - - /** - * Collects a list of mode sets that are common to the current selection context. It is possible - * that there are no mode sets in comomon. - * @param selection the current selection context - * @param list the list to fill - * @return a list of mode sets or an empty list, never <code>null</code> - */ - protected Set collectCommonModeSets(Object[] selection) { - HashSet common = new HashSet(); - //prep selection context, remove types from the equation - HashSet delegates = new HashSet(); - Object o = null; - Object[] kids = null; - for(int i = 0; i < selection.length; i++) { - o = selection[i]; - if(o instanceof ILaunchDelegate) { - delegates.add(o); - } - else if(o instanceof ILaunchConfigurationType) { - fgCurrentWorkingContext.add(o); - kids = fTreeViewer.getFilteredChildren(o); - delegates.addAll(Arrays.asList(kids)); - } - } - //compare the listing of delegates to find common mode sets - ILaunchDelegate delegate = null; - List modes = null; - HashSet pruned = new HashSet(); - Set fmodes = null; - if(!delegates.isEmpty()) { - for(Iterator iter = delegates.iterator(); iter.hasNext();) { - delegate = (ILaunchDelegate) iter.next(); - modes = delegate.getModes(); - for(Iterator iter2 = modes.iterator(); iter2.hasNext();) { - fmodes = (Set) iter2.next(); - if(isCommonModeset(fmodes, delegates, pruned)) { - common.add(fmodes); - fgCurrentWorkingContext.add(delegate); - } - } - } - } - return common; - } - - /** - * Returns if the specified mode set is common to the listing of delegates, at the same time adding any not common - * mode sets to a listing used to prune the search as we go along - * @param modeset the set to test for commonality - * @param delegates the listing to test against - * @param pruned the monotonic listing of pruned mode sets - * @return true if the specified mode set is common to all members of the specified listing of launch delegates, false otherwise - */ - private boolean isCommonModeset(Set modeset, Set delegates, Set pruned) { - if(!pruned.contains(modeset)) { - ILaunchDelegate delegate = null; - boolean common = true; - for(Iterator iter = delegates.iterator(); iter.hasNext();) { - delegate = (ILaunchDelegate) iter.next(); - common &= delegate.getModes().contains(modeset); - } - if(!common) { - pruned.add(modeset); - } - else { - return true; - } - } - return false; - } - - /** - * Restores the widget state from the preference store, called after all of the widgets have been created and triggers - * a selection changed event from the tree viewer - */ - protected void initializeControls() { - fInitializing = true; - if(fTree.getItemCount() > 0) { - TreeItem item = fTree.getItem(0); - fTreeViewer.setSelection(new StructuredSelection(item.getData())); - fTreeViewer.expandToLevel(item.getData(), 1); - } - //load the group selections - fSwitchLaunch.load(); - fSwitchSuspend.load(); - fInitializing = false; - } - - /** - * @see org.eclipse.jface.preference.PreferencePage#performDefaults() - */ - protected void performDefaults() { - fgChangeSet.clear(); - fSwitchLaunch.loadDefault(); - fSwitchSuspend.loadDefault(); - - PerspectiveManager pm = DebugUIPlugin.getDefault().getPerspectiveManager(); - TreeItem[] items = fTree.getItems(); - ILaunchConfigurationType type = null; - Set modes = null; - Set modeset = null; - Object[] delegates = null; - for(int i = 0; i < items.length; i++) { - //reset type - type = (ILaunchConfigurationType) items[i].getData(); - modes = type.getSupportedModeCombinations(); - delegates = fTreeViewer.getFilteredChildren(type); - for(Iterator iter = modes.iterator(); iter.hasNext();) { - modeset = (Set) iter.next(); - fgChangeSet.add(new PerspectiveChange(type, null, modeset, pm.getDefaultLaunchPerspective(type, null, modeset))); - } - for(int j = 0; j < delegates.length; j++) { - modes = new HashSet(((ILaunchDelegate)delegates[j]).getModes()); - for(Iterator iter = modes.iterator(); iter.hasNext();) { - modeset = (Set) iter.next(); - fgChangeSet.add(new PerspectiveChange(type, (ILaunchDelegate) delegates[j], modeset, pm.getDefaultLaunchPerspective(type, (ILaunchDelegate) delegates[j], modeset))); - } - } - } - if(fTree.getItemCount() > 0) { - TreeItem item = fTree.getItem(0); - fTreeViewer.setSelection(new StructuredSelection(item.getData())); - fTreeViewer.expandToLevel(item.getData(), 1); - } - super.performDefaults(); - } - - /** - * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) - */ - public void init(IWorkbench workbench) { - setPreferenceStore(DebugUIPlugin.getDefault().getPreferenceStore()); - fgChangeSet = new HashSet(); - //init the labels mapping and the list of labels - fgPerspectiveIdMap = new HashMap(); - ArrayList labels = new ArrayList(); - labels.add(DebugPreferencesMessages.PerspectivePreferencePage_4); - IPerspectiveRegistry registry = PlatformUI.getWorkbench().getPerspectiveRegistry(); - IPerspectiveDescriptor[] descriptors = registry.getPerspectives(); - String label = null; - for(int i = 0; i < descriptors.length; i++) { - if(!WorkbenchActivityHelper.filterItem(descriptors[i])) { - label = descriptors[i].getLabel(); - labels.add(label); - fgPerspectiveIdMap.put(label, descriptors[i].getId()); - } - } - fgPerspectiveLabels = (String[]) labels.toArray(new String[labels.size()]); - } - - /** - * @see org.eclipse.ui.activities.IActivityManagerListener#activityManagerChanged(org.eclipse.ui.activities.ActivityManagerEvent) - */ - public void activityManagerChanged(ActivityManagerEvent activityManagerEvent) { - if(!fTree.isDisposed()) { - fTreeViewer.refresh(); - } - } - - /** - * @see org.eclipse.jface.preference.PreferencePage#performOk() - */ - public boolean performOk() { - fSwitchLaunch.store(); - fSwitchSuspend.store(); - if(!fgChangeSet.isEmpty()) { - PerspectiveChange change = null; - PerspectiveManager mgr = DebugUIPlugin.getDefault().getPerspectiveManager(); - for(Iterator iter = fgChangeSet.iterator(); iter.hasNext();) { - change = (PerspectiveChange) iter.next(); - mgr.setLaunchPerspective(change.getType(), change.getModes(), change.getDelegate(), change.getPerspectiveId()); - } - } - return super.performOk(); - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchersPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchersPreferencePage.java deleted file mode 100644 index a22f10830..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchersPreferencePage.java +++ /dev/null @@ -1,323 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.preferences; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.debug.core.ILaunchDelegate; -import org.eclipse.debug.internal.core.IInternalDebugCoreConstants; -import org.eclipse.debug.internal.core.LaunchManager; -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.DefaultLabelProvider; -import org.eclipse.debug.internal.ui.IDebugHelpContextIds; -import org.eclipse.debug.internal.ui.SWTFactory; -import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationPresentationManager; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.model.WorkbenchViewerComparator; - -/** - * This class provides a preference page for selecting and changing preferred launch delegates for those of them - * that have conflicting delegates. - * - * Delegates are considered to be conflicting if they are for the same launch configuration type, and apply to the same - * mode sets. - * - * @since 3.3 - */ -public class LaunchersPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - - /** - * Class to collect and persist attributes to sufficiently describe a duplicate launch delegate - */ - class DuplicateDelegate { - private ILaunchConfigurationType fType = null; - private ILaunchDelegate[] fDelegates = null; - private Set fModes = null; - - public DuplicateDelegate(ILaunchConfigurationType type, ILaunchDelegate[] delegates, Set modes) { - fModes = modes; - fType = type; - fDelegates = delegates; - } - - public ILaunchConfigurationType getType() { - return fType; - } - public ILaunchDelegate[] getDelegates() { - return fDelegates; - } - public Set getModeSet() { - return fModes; - } - } - - /** - * label provider to extend the default one, provides labels to both the tree and table of this page - */ - class LabelProvider extends DefaultLabelProvider { - public String getText(Object element) { - if(element instanceof ILaunchConfigurationType) { - return super.getText(element); - } - else if(element instanceof DuplicateDelegate) { - DuplicateDelegate dd = (DuplicateDelegate) element; - return LaunchConfigurationPresentationManager.getDefault().getLaunchModeNames(dd.getModeSet()).toString(); - } - else if(element instanceof ILaunchDelegate){ - return ((ILaunchDelegate) element).getName(); - } - return element.toString(); - } - } - - /** - * This class is used to provide content to the tree - */ - class TreeProvider implements ITreeContentProvider { - public Object[] getChildren(Object parentElement) { - if(parentElement instanceof ILaunchConfigurationType) { - ILaunchConfigurationType type = (ILaunchConfigurationType) parentElement; - Set dupes = (Set) fDuplicates.get(type); - if(dupes != null) { - return dupes.toArray(); - } - return null; - } - return null; - } - public boolean hasChildren(Object element) { - return element instanceof ILaunchConfigurationType; - } - public Object[] getElements(Object inputElement) { - if(inputElement instanceof Map) { - return ((Map)inputElement).keySet().toArray(); - } - return null; - } - public Object getParent(Object element) {return null;} - public void dispose() {} - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {} - } - - private TreeViewer fTreeViewer = null; - private CheckboxTableViewer fTableViewer = null; - private Map fDuplicates = null; - private Map fDupeSelections = null; - private boolean fDirty = false; - private Text fDescription = null; - - /** - * Constructor - */ - public LaunchersPreferencePage() { - setTitle(DebugPreferencesMessages.LaunchDelegatesPreferencePage_0); - } - - /** - * @see org.eclipse.jface.preference.PreferencePage#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent) { - super.createControl(parent); - PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.LAUNCH_DELEGATES_PREFERENCE_PAGE); - } - - /** - * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) - */ - protected Control createContents(Composite parent) { - Composite comp = SWTFactory.createComposite(parent, 2, 1, GridData.FILL_BOTH); - SWTFactory.createWrapLabel(comp, DebugPreferencesMessages.LaunchDelegatesPreferencePage_1, 2, 300); - - boolean enabled = fDuplicates.size() > 0; - if(!enabled) { - SWTFactory.createVerticalSpacer(comp, 1); - SWTFactory.createWrapLabel(comp, DebugPreferencesMessages.LaunchersPreferencePage_0, 2, 300); - } - - SWTFactory.createVerticalSpacer(comp, 1); - //tree - Composite comp1 = SWTFactory.createComposite(comp, 1, 1, GridData.FILL_VERTICAL); - SWTFactory.createLabel(comp1, DebugPreferencesMessages.LaunchDelegatesPreferencePage_2, 1); - Tree tree = new Tree(comp1, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE); - tree.setEnabled(enabled); - tree.setFont(parent.getFont()); - GridData gd = new GridData(GridData.FILL_BOTH); - gd.grabExcessHorizontalSpace = false; - tree.setLayoutData(gd); - fTreeViewer = new TreeViewer(tree); - fTreeViewer.setComparator(new WorkbenchViewerComparator()); - fTreeViewer.setContentProvider(new TreeProvider()); - fTreeViewer.setLabelProvider(new LabelProvider()); - fTreeViewer.setInput(fDuplicates); - fTreeViewer.expandToLevel(2); - fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - Object obj = ((IStructuredSelection) event.getSelection()).getFirstElement(); - if(obj instanceof DuplicateDelegate) { - fTableViewer.setAllChecked(false); - DuplicateDelegate dd = (DuplicateDelegate) obj; - fTableViewer.setInput(dd.getDelegates()); - fTableViewer.setSelection(null); - obj = fDupeSelections.get(dd); - if(obj != null) { - fTableViewer.setChecked(obj, true); - fTableViewer.setSelection(new StructuredSelection(obj)); - } - } - else { - fTableViewer.setInput(null); - } - } - }); - - //table - Composite comp2 = SWTFactory.createComposite(comp, comp.getFont(), 1, 1, GridData.FILL_BOTH); - SWTFactory.createLabel(comp2, DebugPreferencesMessages.LaunchDelegatesPreferencePage_3, 1); - Table table = new Table(comp2, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK | SWT.SINGLE); - table.setEnabled(enabled); - table.setLayoutData(new GridData(GridData.FILL_BOTH)); - table.setFont(parent.getFont()); - fTableViewer = new CheckboxTableViewer(table); - fTableViewer.setComparator(new WorkbenchViewerComparator()); - fTableViewer.setLabelProvider(new LabelProvider()); - fTableViewer.setContentProvider(new ArrayContentProvider()); - fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - IStructuredSelection ss = (IStructuredSelection) event.getSelection(); - if(ss != null && !ss.isEmpty()) { - ILaunchDelegate delegate = (ILaunchDelegate)ss.getFirstElement(); - fDescription.setText(delegate.getDescription()); - } - else { - fDescription.setText(IInternalDebugCoreConstants.EMPTY_STRING); - } - } - }); - fTableViewer.addCheckStateListener(new ICheckStateListener() { - public void checkStateChanged(CheckStateChangedEvent event) { - fDirty = true; - Object element = event.getElement(); - boolean checked = event.getChecked(); - //always set checked, this way users cannot 'undo' a change to selecting a preferred delegate - //The story for this is that on startup if there are dupes, the user is prompted to pick a delegate, after that they cannot - //return to a state of not being able to launch something, but can pick a different delegate - fTableViewer.setCheckedElements(new Object[] {element}); - //set the selection to be the checked element - //https://bugs.eclipse.org/bugs/show_bug.cgi?id=233233 - fTableViewer.setSelection(new StructuredSelection(element)); - //persist the selection - Object obj = ((IStructuredSelection) fTreeViewer.getSelection()).getFirstElement(); - if(obj instanceof DuplicateDelegate) { - fDupeSelections.remove(obj); - if(checked) { - fDupeSelections.put(obj, element); - } - } - } - }); - Group group = SWTFactory.createGroup(comp, DebugPreferencesMessages.LaunchDelegatesPreferencePage_4, 1, 2, GridData.FILL_BOTH); - fDescription = SWTFactory.createText(group, SWT.WRAP | SWT.READ_ONLY, 1, GridData.FILL_BOTH); - fDescription.setEnabled(enabled); - fDescription.setBackground(group.getBackground()); - return comp; - } - - /** - * @see org.eclipse.jface.preference.PreferencePage#performOk() - */ - public boolean performOk() { - if(fDirty && fDupeSelections != null && fDupeSelections.size() > 0) { - fDirty = false; - DuplicateDelegate dd = null; - ILaunchDelegate delegate = null; - for(Iterator iter = fDupeSelections.keySet().iterator(); iter.hasNext();) { - dd = (DuplicateDelegate) iter.next(); - delegate = (ILaunchDelegate) fDupeSelections.get(dd); - try { - dd.getType().setPreferredDelegate(dd.getModeSet(), delegate); - } - catch (CoreException e) {DebugUIPlugin.log(e);} - } - } - return super.performOk(); - } - - /** - * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) - */ - public void init(IWorkbench workbench) { - //init a listing of duplicate delegates arranged by type - try { - setPreferenceStore(DebugUIPlugin.getDefault().getPreferenceStore()); - LaunchManager lm = (LaunchManager) DebugPlugin.getDefault().getLaunchManager(); - ILaunchConfigurationType[] types = lm.getLaunchConfigurationTypes(); - fDuplicates = new HashMap(); - fDupeSelections = new HashMap(); - Set modes = null; - ILaunchDelegate[] delegates = null; - Set modeset = null; - Set tmp = null; - ILaunchDelegate prefdelegate = null; - DuplicateDelegate dd = null; - for(int i = 0; i < types.length; i++) { - modes = types[i].getSupportedModeCombinations(); - for(Iterator iter = modes.iterator(); iter.hasNext();) { - modeset = (Set) iter.next(); - delegates = types[i].getDelegates(modeset); - if(delegates.length > 1) { - tmp = (Set) fDuplicates.get(types[i]); - if(tmp == null) { - tmp = new HashSet(); - } - dd = new DuplicateDelegate(types[i], delegates, modeset); - tmp.add(dd); - fDuplicates.put(types[i], tmp); - prefdelegate = types[i].getPreferredDelegate(modeset); - if(prefdelegate != null) { - fDupeSelections.put(dd, prefdelegate); - } - } - } - } - } - catch(CoreException e) {DebugUIPlugin.log(e);} - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchingPreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchingPreferencePage.java deleted file mode 100644 index ad0fbbca9..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchingPreferencePage.java +++ /dev/null @@ -1,218 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.preferences; - -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.IDebugHelpContextIds; -import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; -import org.eclipse.debug.internal.ui.SWTFactory; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jface.dialogs.MessageDialogWithToggle; -import org.eclipse.jface.preference.BooleanFieldEditor; -import org.eclipse.jface.preference.FieldEditor; -import org.eclipse.jface.preference.FieldEditorPreferencePage; -import org.eclipse.jface.preference.IntegerFieldEditor; -import org.eclipse.jface.preference.RadioGroupFieldEditor; -import org.eclipse.jface.preference.StringFieldEditor; -import org.eclipse.swt.SWT; -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.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Group; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.PlatformUI; - -import com.ibm.icu.text.MessageFormat; - -/** - * A preference page for configuring launching preferences. - * - * @since 3.0.0 - */ -public class LaunchingPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { - - private Button fUseContextLaunching; - private Button fUseOldLaunching; - private Button fLaunchLastIfNotLaunchable; - private Button fCheckParent; - - /** - * The default constructor - */ - public LaunchingPreferencePage() { - super(); - setPreferenceStore(DebugUIPlugin.getDefault().getPreferenceStore()); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent) { - super.createControl(parent); - PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.LAUNCHING_PREFERENCE_PAGE); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) - */ - protected Control createContents(Composite parent) { - Composite comp = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_HORIZONTAL); - //save dirty editors - FieldEditor edit = new RadioGroupFieldEditor(IInternalDebugUIConstants.PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH, DebugPreferencesMessages.LaunchingPreferencePage_2, 3, - new String[][] {{DebugPreferencesMessages.LaunchingPreferencePage_3, MessageDialogWithToggle.ALWAYS}, - {DebugPreferencesMessages.LaunchingPreferencePage_4, MessageDialogWithToggle.NEVER}, - {DebugPreferencesMessages.LaunchingPreferencePage_5, MessageDialogWithToggle.PROMPT}}, - comp, - true); - addField(edit); - - //wait for build - edit = new RadioGroupFieldEditor(IInternalDebugUIConstants.PREF_WAIT_FOR_BUILD, - DebugPreferencesMessages.LaunchingPreferencePage_6, 3, - new String[][] {{DebugPreferencesMessages.LaunchingPreferencePage_7, MessageDialogWithToggle.ALWAYS}, - {DebugPreferencesMessages.LaunchingPreferencePage_8, MessageDialogWithToggle.NEVER}, - {DebugPreferencesMessages.LaunchingPreferencePage_9, MessageDialogWithToggle.PROMPT}}, - comp, - true); - addField(edit); - - //re-launch in debug mode - edit = new RadioGroupFieldEditor(IInternalDebugUIConstants.PREF_RELAUNCH_IN_DEBUG_MODE, - DebugPreferencesMessages.LaunchingPreferencePage_15, 3, - new String[][] {{DebugPreferencesMessages.LaunchingPreferencePage_16, MessageDialogWithToggle.ALWAYS}, - {DebugPreferencesMessages.LaunchingPreferencePage_17, MessageDialogWithToggle.NEVER}, - {DebugPreferencesMessages.LaunchingPreferencePage_18, MessageDialogWithToggle.PROMPT}}, - comp, - true); - addField(edit); - - //continue with compile errors - edit = new RadioGroupFieldEditor(IInternalDebugUIConstants.PREF_CONTINUE_WITH_COMPILE_ERROR, - DebugPreferencesMessages.LaunchingPreferencePage_21, 2, - new String[][] {{DebugPreferencesMessages.LaunchingPreferencePage_22, MessageDialogWithToggle.ALWAYS}, - {DebugPreferencesMessages.LaunchingPreferencePage_23, MessageDialogWithToggle.PROMPT}}, - comp, - true); - addField(edit); - - //filtering options - Group group = SWTFactory.createGroup(comp, DebugPreferencesMessages.LaunchingPreferencePage_36, 1, 1, GridData.FILL_HORIZONTAL); - Composite spacer = SWTFactory.createComposite(group, 1, 1, GridData.FILL_HORIZONTAL); - edit = new BooleanFieldEditor(IDebugUIConstants.PREF_BUILD_BEFORE_LAUNCH, DebugPreferencesMessages.LaunchingPreferencePage_1, SWT.NONE, spacer); - edit.fillIntoGrid(spacer, 2); - addField(edit); - edit = new BooleanFieldEditor(IDebugUIConstants.PREF_AUTO_REMOVE_OLD_LAUNCHES, DebugPreferencesMessages.LaunchingPreferencePage_10, SWT.NONE, spacer); - edit.fillIntoGrid(spacer, 2); - addField(edit); - - edit = new BooleanFieldEditor(IInternalDebugUIConstants.PREF_REMOVE_FROM_LAUNCH_HISTORY, DebugPreferencesMessages.LaunchingPreferencePage_confirm_0, spacer); - edit.fillIntoGrid(spacer, 2); - addField(edit); - - //history list size preference - IntegerFieldEditor editor = new IntegerFieldEditor(IDebugUIConstants.PREF_MAX_HISTORY_SIZE, DebugPreferencesMessages.DebugPreferencePage_10, spacer); - editor.fillIntoGrid(spacer, 2); - addField(editor); - int historyMax = IDebugPreferenceConstants.MAX_LAUNCH_HISTORY_SIZE; - editor.setTextLimit(Integer.toString(historyMax).length()); - editor.setErrorMessage(MessageFormat.format(DebugPreferencesMessages.DebugPreferencePage_11, new Object[] { new Integer(1), new Integer(historyMax)})); - editor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE); - editor.setValidRange(1, historyMax); - editor.setEmptyStringAllowed(false); - - //CONTEXTLAUNCHING - createContextLaunchingControls(comp); - initialize(); - checkState(); - return comp; - } - - /** - * Creates the context launching portion of the page, which includes two radio buttons and - * a nested check box - * @param parent the parent to add this control to - * - * @since 3.3.0 - * CONTEXTLAUNCHING - */ - private void createContextLaunchingControls(Composite parent) { - Group group = SWTFactory.createGroup(parent, DebugPreferencesMessages.LaunchingPreferencePage_40, 1, 1, GridData.FILL_HORIZONTAL); - fUseOldLaunching = SWTFactory.createRadioButton(group, DebugPreferencesMessages.LaunchingPreferencePage_37); - fUseContextLaunching = SWTFactory.createRadioButton(group, DebugPreferencesMessages.LaunchingPreferencePage_38); - fUseContextLaunching.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) {} - public void widgetSelected(SelectionEvent e) { - boolean enabled = ((Button)e.widget).getSelection(); - fCheckParent.setEnabled(enabled); - fLaunchLastIfNotLaunchable.setEnabled(enabled); - } - }); - Composite space = SWTFactory.createComposite(group, 1, 1, GridData.FILL_HORIZONTAL); - GridData gd = (GridData) space.getLayoutData(); - gd.horizontalIndent = 10; - GridLayout layout = (GridLayout) space.getLayout(); - layout.marginHeight = 0; - fCheckParent = SWTFactory.createRadioButton(space, DebugPreferencesMessages.LaunchingPreferencePage_39); - fLaunchLastIfNotLaunchable = SWTFactory.createRadioButton(space, DebugPreferencesMessages.LaunchingPreferencePage_41); - - //initialize the buttons - boolean value = getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH); - fUseOldLaunching.setSelection(!value); - fUseContextLaunching.setSelection(value); - boolean enable = getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_LAUNCH_PARENT_PROJECT); - fCheckParent.setSelection(enable); - fCheckParent.setEnabled(value); - fLaunchLastIfNotLaunchable.setSelection(!enable); - fLaunchLastIfNotLaunchable.setEnabled(value); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) - */ - public void init(IWorkbench workbench) {} - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#performDefaults() - */ - protected void performDefaults() { - boolean value = getPreferenceStore().getDefaultBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH); - fUseOldLaunching.setSelection(!value); - fUseContextLaunching.setSelection(value); - boolean parent = getPreferenceStore().getDefaultBoolean(IInternalDebugUIConstants.PREF_LAUNCH_PARENT_PROJECT); - fCheckParent.setSelection(parent); - fCheckParent.setEnabled(value); - fLaunchLastIfNotLaunchable.setSelection(!parent); - fLaunchLastIfNotLaunchable.setEnabled(value); - super.performDefaults(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#performOk() - */ - public boolean performOk() { - getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH, fUseContextLaunching.getSelection()); - getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_LAUNCH_PARENT_PROJECT, fCheckParent.getSelection()); - getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_LAUNCH_LAST_IF_NOT_LAUNCHABLE, fLaunchLastIfNotLaunchable.getSelection()); - return super.performOk(); - } - - /** - * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors() - */ - protected void createFieldEditors() { - //do nothing we overload the create contents method - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ProcessPropertyPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ProcessPropertyPage.java deleted file mode 100644 index 11b627ef4..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ProcessPropertyPage.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.preferences; - - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.eclipse.debug.core.model.IDebugElement; -import org.eclipse.debug.core.model.IProcess; -import org.eclipse.debug.internal.ui.IDebugHelpContextIds; -import org.eclipse.debug.internal.ui.SWTFactory; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.dialogs.PropertyPage; - -public class ProcessPropertyPage extends PropertyPage { - - private static Font fHeadingFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT); - - /** - * Constructor for ProcessPropertyPage - */ - public ProcessPropertyPage() { - super(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) - */ - protected Control createContents(Composite ancestor) { - noDefaultAndApplyButton(); - Composite parent = SWTFactory.createComposite(ancestor, ancestor.getFont(), 1, 1, GridData.FILL_BOTH); - - IProcess proc = getProcess(); - - //create the process time section - SWTFactory.createLabel(parent, DebugPreferencesMessages.ProcessPropertyPage_0, fHeadingFont, 1); - Text text = SWTFactory.createText(parent, SWT.READ_ONLY, 1); - ((GridData)text.getLayoutData()).horizontalIndent = 10; - PlatformUI.getWorkbench().getHelpSystem().setHelp(text, IDebugHelpContextIds.PROCESS_PAGE_RUN_AT); - text.setText(getTimeText(proc)); - text.setBackground(parent.getBackground()); - SWTFactory.createVerticalSpacer(parent, 2); - - //create the path name section - SWTFactory.createLabel(parent, DebugPreferencesMessages.ProcessPropertyPage_1, fHeadingFont, 1); - text = SWTFactory.createText(parent, SWT.WRAP | SWT.READ_ONLY, 1); - ((GridData)text.getLayoutData()).horizontalIndent = 10; - text.setText(getPathText(proc)); - text.setBackground(parent.getBackground()); - SWTFactory.createVerticalSpacer(parent, 2); - - //create commandline section - SWTFactory.createLabel(parent, DebugPreferencesMessages.ProcessPropertyPage_Command_Line__1, fHeadingFont, 1); - text = SWTFactory.createText(parent, - SWT.WRAP | SWT.READ_ONLY | SWT.BORDER | SWT.V_SCROLL, - 1, - convertWidthInCharsToPixels(10), - convertHeightInCharsToPixels(15), - GridData.FILL_BOTH); - text.setBackground(parent.getBackground()); - ((GridData)text.getLayoutData()).horizontalIndent = 10; - String commandLineText = getCommandLineText(proc); - if (commandLineText != null) { - text.setText(commandLineText); - } - - setTitle(DebugPreferencesMessages.ProcessPropertyPage_2); - return parent; - } - - /** - * Gets the process from the selected element - * @return the process or null if the element is not a process - * - * @since 3.2 - */ - private IProcess getProcess() { - IProcess proc = null; - Object obj = getElement(); - if (obj instanceof IDebugElement) { - obj = ((IDebugElement)obj).getDebugTarget().getProcess(); - } - if (obj instanceof IProcess) { - proc = ((IProcess)obj); - } - return proc; - } - - /** - * returns the path text - * @param proc the process to extract the path text from - * @return the path text or a message indicating no path text available - * - * @since 3.2 - */ - private String getPathText(IProcess proc) { - String text = DebugPreferencesMessages.ProcessPropertyPage_3; - if(proc != null) { - String tmp = proc.getLabel(); - int idx = tmp.lastIndexOf("("); //$NON-NLS-1$ - if(idx < 0) { - idx = tmp.length(); - } - text = tmp.substring(0, idx); - } - return text; - } - - /** - * gets the pattern of text from the process label specified by regex - * @param proc the process to compile the regex against - * @param deftext the default text to return if the process is null - * @param regex the regex to match in the process label - * @return the regex matched text or the default supplied text if the process is null - * - * @since 3.2 - */ - private String getTimeText(IProcess proc) { - String text = DebugPreferencesMessages.ProcessPropertyPage_4; - if(proc != null) { - Pattern pattern = Pattern.compile("\\(.*\\)"); //$NON-NLS-1$ - Matcher matcher = pattern.matcher(proc.getLabel()); - if(matcher.find()) { - text = matcher.group(0); - } - } - return text; - } - - /** - * Initializes the text to be displayed in the commandline text widget - * @param proc the process to compile the label fragment from - * @return the commandline text or the empty string - * - * @since 3.2 - */ - private String getCommandLineText(IProcess proc) { - String cmdline = DebugPreferencesMessages.ProcessPropertyPage_5; - if(proc != null) { - cmdline = proc.getAttribute(IProcess.ATTR_CMDLINE); - } - return cmdline; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent) { - super.createControl(parent); - PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.PROCESS_PROPERTY_PAGE); - } - -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java deleted file mode 100644 index 1112114d1..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/RunDebugPropertiesPage.java +++ /dev/null @@ -1,527 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.preferences; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.internal.core.LaunchManager; -import org.eclipse.debug.internal.ui.AbstractDebugListSelectionDialog; -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.DefaultLabelProvider; -import org.eclipse.debug.internal.ui.IDebugHelpContextIds; -import org.eclipse.debug.internal.ui.SWTFactory; -import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationComparator; -import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationManager; -import org.eclipse.debug.ui.ILaunchGroup; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.SWT; -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.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Table; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.dialogs.PropertyPage; -import org.eclipse.ui.dialogs.SelectionDialog; - -import com.ibm.icu.text.MessageFormat; - -/** - * Displays default launch configuration settings for a selected resource - associated launch configurations. - * - * @see {@link PropertyPage} - * @see {@link ILaunchConfiguration} - * @see {@link org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog} - * @see {@link IDebugHelpContextIds#DEFAULT_LAUNCHCONFIGURATION_PROPERTY_PAGE} - * - * CONTEXTLAUNCHING - * - * @since 3.3.0 - */ -public class RunDebugPropertiesPage extends PropertyPage { - /** - * Set of configurations to be deleted - */ - private Set fDeletedConfigurations = new HashSet(); - - /** - * Set of original default candidates for the resource - */ - private Set fOriginalCandidates; - - /** - * Holds configurations that need to be saved when the page closes - */ - private Set fChangedConfigurations = new HashSet(); - - /** - * List of the applicable launch config types for the backing resource - */ - private List fTypeCandidates = null; - - //widgets - private TableViewer fViewer; - private Button fNewButton = null; - private Button fEditButton = null; - private Button fDuplicateButton = null; - private Button fDeleteButton = null; - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) - */ - protected Control createContents(Composite parent) { - PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IDebugHelpContextIds.RUN_DEBUG_RESOURCE_PROPERTY_PAGE); - collectConfigCandidates(getResource()); - Composite topComposite = SWTFactory.createComposite(parent, 2, 1, GridData.FILL_BOTH); - - SWTFactory.createWrapLabel(topComposite, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_0, 2, 300); - SWTFactory.createVerticalSpacer(topComposite, 2); - SWTFactory.createWrapLabel(topComposite, MessageFormat.format(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_1, new String[]{getResource().getName()}), 2, 300); - fViewer = createViewer(topComposite); - - Composite buttonComp = SWTFactory.createComposite(topComposite, 1, 1, GridData.FILL_VERTICAL); - GridLayout layout = (GridLayout) buttonComp.getLayout(); - layout.marginHeight = 0; - fNewButton = SWTFactory.createPushButton(buttonComp, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_2, null); - fNewButton.setToolTipText(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_3); - fNewButton.setEnabled(collectTypeCandidates().length > 0); - fNewButton.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) {} - public void widgetSelected(SelectionEvent e) { - handleNew(); - } - }); - - fDuplicateButton = SWTFactory.createPushButton(buttonComp, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_4, null); - fDuplicateButton.setToolTipText(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_5); - fDuplicateButton.setEnabled(false); - fDuplicateButton.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) {} - public void widgetSelected(SelectionEvent e) { - handleCopy(); - } - }); - fEditButton = SWTFactory.createPushButton(buttonComp, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_6, null); - fEditButton.setToolTipText(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_7); - fEditButton.setEnabled(false); - fEditButton.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) {} - public void widgetSelected(SelectionEvent e) { - handleEdit(); - } - }); - fDeleteButton = SWTFactory.createPushButton(buttonComp, DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_8, null); - fDeleteButton.setToolTipText(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_9); - fDeleteButton.setEnabled(false); - fDeleteButton.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) {} - public void widgetSelected(SelectionEvent e) { - handleDelete(); - } - }); - - fViewer.setSelection(new StructuredSelection()); - applyDialogFont(topComposite); - return topComposite; - } - - /** - * Creates and returns the viewer that will display the possible default configurations. - * - * @param parent parent composite to create the viewer in - * @return viewer viewer that will display possible default configurations - */ - protected TableViewer createViewer(Composite parent){ - TableViewer viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); - viewer.setLabelProvider(new DefaultLabelProvider()); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setComparator(new LaunchConfigurationComparator()); - Table builderTable = viewer.getTable(); - GridData tableGridData = new GridData(GridData.FILL_BOTH); - tableGridData.heightHint = 300; - tableGridData.widthHint = 300; - builderTable.setLayoutData(tableGridData); - IResource resource = getResource(); - viewer.setInput(collectConfigCandidates(resource)); - viewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - ISelection sel = event.getSelection(); - if(sel instanceof IStructuredSelection) { - IStructuredSelection ss = (IStructuredSelection) sel; - boolean empty = ss.isEmpty(); - int size = ss.size(); - fEditButton.setEnabled(!empty && size == 1); - fDuplicateButton.setEnabled(!empty && size == 1); - fDeleteButton.setEnabled(!empty); - setErrorMessage(null); - } - } - }); - viewer.addDoubleClickListener(new IDoubleClickListener() { - public void doubleClick(DoubleClickEvent arg0) { - handleEdit(); - } - }); - return viewer; - } - - /** - * @see org.eclipse.jface.dialogs.DialogPage#dispose() - */ - public void dispose() { - if(fOriginalCandidates != null) { - fOriginalCandidates.clear(); - fOriginalCandidates = null; - } - if(fChangedConfigurations != null) { - fChangedConfigurations.clear(); - fChangedConfigurations = null; - } - super.dispose(); - } - - /** - * Returns the viewer displaying possible default configurations. - * - * @return viewer - */ - protected TableViewer getViewer() { - return fViewer; - } - - /** - * Returns the launch manager - * @return the launch manager - */ - protected LaunchManager getLaunchManager() { - return (LaunchManager) DebugPlugin.getDefault().getLaunchManager(); - } - - /** - * Collects the applicable launch configuration types for the backing resource. - * Default implementation uses the launch shortcut evaluation expressions and leverages the - * mapping of launch shortcut to config type id to derive the applicable types. - * @return the listing of applicable launch configuration types for the backing resource - */ - protected ILaunchConfigurationType[] collectTypeCandidates() { - if(fTypeCandidates == null) { - String[] types = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getApplicableConfigurationTypes(getResource()); - fTypeCandidates = new ArrayList(types.length); - for(int i = 0; i < types.length; i++) { - fTypeCandidates.add(DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(types[i])); - } - - Collections.sort(fTypeCandidates, new Comparator() { - public int compare(Object o1, Object o2) { - ILaunchConfigurationType t1 = (ILaunchConfigurationType) o1; - ILaunchConfigurationType t2 = (ILaunchConfigurationType) o2; - return t1.getName().compareTo(t2.getName()); - } - }); - } - return (ILaunchConfigurationType[]) fTypeCandidates.toArray(new ILaunchConfigurationType[fTypeCandidates.size()]); - } - - /** - * Returns a set of potential default configurations candidates for the given - * resource. The configurations are working copies. - * - * @param resource resource - * @return list of default candidates - */ - protected Set collectConfigCandidates(IResource resource) { - if(fOriginalCandidates == null) { - fOriginalCandidates = new HashSet(); - try { - ILaunchConfiguration[] configs = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getApplicableLaunchConfigurations(null, resource); - for(int i = 0; i < configs.length; i++) { - fOriginalCandidates.add(configs[i].getWorkingCopy()); - } - } - catch(CoreException ce) {DebugUIPlugin.log(ce);} - } - return fOriginalCandidates; - } - - - - /** - * Returns the resource this property page is open on. - * - * @return resource - */ - protected IResource getResource() { - Object element = getElement(); - IResource resource = null; - if (element instanceof IResource) { - resource = (IResource) element; - } else if (element instanceof IAdaptable) { - resource = (IResource) ((IAdaptable)element).getAdapter(IResource.class); - } - return resource; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#performOk() - */ - public boolean performOk() { - //delete - Iterator iter = fDeletedConfigurations.iterator(); - while (iter.hasNext()) { - ILaunchConfigurationWorkingCopy currentConfig = (ILaunchConfigurationWorkingCopy) iter.next(); - try{ - if (currentConfig.getOriginal() != null){ - currentConfig.getOriginal().delete(); - } - } catch (CoreException e) { - DebugPlugin.logMessage("Problem deleting configuration " + currentConfig.getName(), e); //$NON-NLS-1$ - } - } - //add - iter = fChangedConfigurations.iterator(); - while (iter.hasNext()) { - ILaunchConfigurationWorkingCopy currentConfig = (ILaunchConfigurationWorkingCopy) iter.next(); - try{ - currentConfig.doSave(); - } catch (CoreException e) { - DebugPlugin.logMessage("Problem saving changes to configuration " + currentConfig.getName(), e); //$NON-NLS-1$ - } - } - - return super.performOk(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#performDefaults() - */ - protected void performDefaults() { - setErrorMessage(null); - setValid(true); - fOriginalCandidates.clear(); - fOriginalCandidates = null; - getViewer().setInput(collectConfigCandidates(getResource())); - fChangedConfigurations.clear(); - fDeletedConfigurations.clear(); - fViewer.refresh(true, true); - super.performDefaults(); - } - - /** - * Returns the names of the launch configurations passed in as original input to the tree viewer - * @return the names of the original launch configurations - */ - private Set getConfigurationNames() { - Set names = new HashSet(); - Iterator iter = fOriginalCandidates.iterator(); - while (iter.hasNext()) { - names.add(((ILaunchConfiguration)iter.next()).getName()); - } - iter = fChangedConfigurations.iterator(); - while (iter.hasNext()) { - names.add(((ILaunchConfiguration)iter.next()).getName()); - } - return names; - } - - /** - * Returns selected configurations. - * - * @return selected configurations - */ - private ILaunchConfigurationWorkingCopy[] getSelectedConfigurations() { - IStructuredSelection ss = (IStructuredSelection) fViewer.getSelection(); - return (ILaunchConfigurationWorkingCopy[]) ss.toList().toArray(new ILaunchConfigurationWorkingCopy[ss.size()]); - } - - /** - * Copy the selection - */ - private void handleCopy() { - ILaunchConfigurationWorkingCopy configuration = getSelectedConfigurations()[0]; - try { - ILaunchConfigurationWorkingCopy copy = configuration.copy( - ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()).generateUniqueLaunchConfigurationNameFrom(configuration.getName(), getConfigurationNames())); - copy.setAttributes(configuration.getAttributes()); - fChangedConfigurations.add(copy); - fViewer.add(copy); - fViewer.setSelection(new StructuredSelection(copy)); - } catch (CoreException e) { - setErrorMessage(e.getMessage()); - } - } - - /** - * Delete the selection - */ - private void handleDelete() { - Table table = fViewer.getTable(); - int[] indices = table.getSelectionIndices(); - Arrays.sort(indices); - ILaunchConfiguration[] configurations = getSelectedConfigurations(); - for (int i = 0; i < configurations.length; i++) { - fDeletedConfigurations.add(configurations[i]); - fChangedConfigurations.remove(configurations[i]); - fViewer.remove(configurations[i]); - } - if (indices[0] < table.getItemCount()) { - fViewer.setSelection(new StructuredSelection(table.getItem(indices[0]).getData())); - } else if (table.getItemCount() > 0) { - fViewer.setSelection(new StructuredSelection(table.getItem(table.getItemCount() - 1).getData())); - } - } - - /** - * Edit the selection - */ - private void handleEdit() { - ILaunchConfigurationWorkingCopy config = getSelectedConfigurations()[0]; - int ret = edit(config, false); - if(ret == IDialogConstants.OK_ID) { - fChangedConfigurations.add(config); - fViewer.refresh(config, true, true); - } - else if(ret == IDialogConstants.ABORT_ID) { - setErrorMessage(MessageFormat.format(DebugPreferencesMessages.RunDebugPropertiesPage_0, new String[] {config.getName()})); - } - } - - /** - * Edits the given configuration as a nested working copy. - * Returns the code from the dialog used to edit the configuration. - * - * @param configuration - * @param setDefaults whether to set default values in the config - * @return dialog return code - OK or CANCEL - */ - private int edit(ILaunchConfigurationWorkingCopy configuration, boolean setDefaults) { - try { - LaunchConfigurationManager lcm = DebugUIPlugin.getDefault().getLaunchConfigurationManager(); - ILaunchGroup group = null; - // bug 208034, we should try modes we know about first then guess - ILaunchConfigurationType type = configuration.getType(); - if(type.supportsMode(ILaunchManager.RUN_MODE)) { - group = lcm.getLaunchGroup(type, ILaunchManager.RUN_MODE); - } - else if(type.supportsMode(ILaunchManager.DEBUG_MODE)) { - group = lcm.getLaunchGroup(type, ILaunchManager.DEBUG_MODE); - } - else if(type.supportsMode(ILaunchManager.PROFILE_MODE)) { - group = lcm.getLaunchGroup(type, ILaunchManager.PROFILE_MODE); - } - else { - Set modes = type.getSupportedModeCombinations(); - for(Iterator iter = modes.iterator(); iter.hasNext();) { - group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(type, (Set)iter.next()); - if(group != null) { - break; - } - } - } - if(group != null) { - return DebugUIPlugin.openLaunchConfigurationPropertiesDialog(getShell(), configuration, group.getIdentifier(), getConfigurationNames(), null, setDefaults); - } - } - catch(CoreException ce) {} - return IDialogConstants.ABORT_ID; - } - - /** - * Create a new configuration - */ - private void handleNew() { - - final ILaunchConfigurationType[] typeCandidates = collectTypeCandidates(); - - SelectionDialog dialog = new AbstractDebugListSelectionDialog(getShell()){ - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getDialogSettingsId() - */ - protected String getDialogSettingsId() { - return DebugUIPlugin.getUniqueIdentifier() + ".SELECT_CONFIGURATION_TYPE_DIALOG"; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getViewerInput() - */ - protected Object getViewerInput() { - return typeCandidates; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getHelpContextId() - */ - protected String getHelpContextId() { - return IDebugHelpContextIds.SELECT_CONFIGURATION_TYPE_DIALOG; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getViewerLabel() - */ - protected String getViewerLabel() { - return DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_12; - } - - }; - dialog.setTitle(DebugPreferencesMessages.DefaultLaunchConfigurationsPropertiesPage_11); - - if (dialog.open() == Window.OK) { - Object[] result = dialog.getResult(); - if (result.length == 1) { - ILaunchConfigurationType type = (ILaunchConfigurationType) result[0]; - try { - ILaunchConfigurationWorkingCopy wc = type.newInstance(null, - ((LaunchManager)DebugPlugin.getDefault().getLaunchManager()). - generateUniqueLaunchConfigurationNameFrom("New_configuration", getConfigurationNames())); //$NON-NLS-1$ - int ret = edit(wc, true); - if (ret == Window.OK) { - fChangedConfigurations.add(wc); - fViewer.add(wc); - fViewer.setSelection(new StructuredSelection(wc)); - } - else if(ret == IDialogConstants.ABORT_ID) { - setErrorMessage(MessageFormat.format(DebugPreferencesMessages.RunDebugPropertiesPage_0, new String[] {wc.getName()})); - } - } catch (CoreException e) { - setErrorMessage(e.getMessage()); - } - } - } - } -} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/StringVariablePreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/StringVariablePreferencePage.java deleted file mode 100644 index bc353eaac..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/StringVariablePreferencePage.java +++ /dev/null @@ -1,715 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM 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.core.runtime.CoreException; -import org.eclipse.core.variables.IStringVariableManager; -import org.eclipse.core.variables.IValueVariable; -import org.eclipse.core.variables.VariablesPlugin; -import org.eclipse.debug.internal.core.IInternalDebugCoreConstants; -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.IDebugHelpContextIds; -import org.eclipse.debug.internal.ui.MultipleInputDialog; -import org.eclipse.debug.internal.ui.SWTFactory; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.preference.PreferencePage; -import org.eclipse.jface.viewers.ColumnLayoutData; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IColorProvider; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.jface.window.Window; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.PlatformUI; - -import com.ibm.icu.text.MessageFormat; - -/** - * Preference page for creating and configuring simple - * launch variables. - * - * @see org.eclipse.debug.core.variables.IValueVariable - * @see org.eclipse.debug.core.variables.ISimpleVariableRegistry - */ -public class StringVariablePreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - - private TableViewer variableTable; - protected Button envAddButton; - protected Button envEditButton; - protected Button envRemoveButton; - - protected SimpleVariableContentProvider variableContentProvider= new SimpleVariableContentProvider(); - - protected static final String NAME_LABEL= DebugPreferencesMessages.SimpleVariablePreferencePage_10; - protected static final String VALUE_LABEL = DebugPreferencesMessages.SimpleVariablePreferencePage_11; - protected static final String DESCRIPTION_LABEL = DebugPreferencesMessages.SimpleVariablePreferencePage_12; - - protected static final String STRING_VARIABLE_PREFERENCE_KEY = "StringVariablePreferencePage"; //$NON-NLS-1$ - - protected static String[] variableTableColumnProperties= { - "variable", //$NON-NLS-1$ - "value", //$NON-NLS-1$ - "description" //$NON-NLS-1$ - }; - protected String[] variableTableColumnHeaders= { - DebugPreferencesMessages.SimpleVariablePreferencePage_3, - DebugPreferencesMessages.SimpleVariablePreferencePage_4, - DebugPreferencesMessages.SimpleVariablePreferencePage_5, - DebugPreferencesMessages.StringVariablePreferencePage_27 - }; - protected ColumnLayoutData[] variableTableColumnLayouts= { - new ColumnWeightData(30), - new ColumnWeightData(25), - new ColumnWeightData(25), - new ColumnWeightData(20) - }; - - public StringVariablePreferencePage() { - setDescription(DebugPreferencesMessages.SimpleVariablePreferencePage_6); - } - - /** - * @see PreferencePage#createControl(Composite) - */ - public void createControl(Composite parent) { - super.createControl(parent); - PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.SIMPLE_VARIABLE_PREFERENCE_PAGE); - } - - protected Control createContents(Composite parent) { - noDefaultAndApplyButton(); - Font font= parent.getFont(); - //The main composite - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight=0; - layout.marginWidth=0; - layout.numColumns= 2; - composite.setLayout(layout); - composite.setFont(font); - - createTable(composite); - createButtons(composite); - - return composite; - } - - /** - * Creates and configures the table containing launch configuration variables - * and their associated value. - */ - private void createTable(Composite parent) { - Font font= parent.getFont(); - // Create table composite - Composite tableComposite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.numColumns = 1; - GridData gridData = new GridData(GridData.FILL_BOTH); - gridData.heightHint = 150; - gridData.widthHint = 400; - tableComposite.setLayout(layout); - tableComposite.setLayoutData(gridData); - tableComposite.setFont(font); - // Create table - variableTable = new TableViewer(tableComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION); - Table table = variableTable.getTable(); - table.setHeaderVisible(true); - table.setLinesVisible(true); - table.setFont(font); - gridData = new GridData(GridData.FILL_BOTH); - variableTable.getControl().setLayoutData(gridData); - variableTable.setContentProvider(variableContentProvider); - variableTable.setColumnProperties(variableTableColumnProperties); - variableTable.addFilter(new VariableFilter()); - variableTable.setComparator(new ViewerComparator() { - public int compare(Viewer iViewer, Object e1, Object e2) { - if (e1 == null) { - return -1; - } else if (e2 == null) { - return 1; - } else { - return ((VariableWrapper)e1).getName().compareToIgnoreCase(((VariableWrapper)e2).getName()); - } - } - }); - - variableTable.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - handleTableSelectionChanged(event); - } - }); - - variableTable.addDoubleClickListener(new IDoubleClickListener() { - public void doubleClick(DoubleClickEvent event) { - if (!variableTable.getSelection().isEmpty()) { - handleEditButtonPressed(); - } - } - }); - variableTable.getTable().addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent event) { - if (event.character == SWT.DEL && event.stateMask == 0) { - handleRemoveButtonPressed(); - } - } - }); - - for (int i = 0; i < variableTableColumnHeaders.length; i++) { - TableColumn tc = new TableColumn(table, SWT.NONE, i); - tc.setResizable(variableTableColumnLayouts[i].resizable); - tc.setText(variableTableColumnHeaders[i]); - } - - // Try restoring column widths from preferences, if widths aren't stored, init columns to default - if (!restoreColumnWidths()){ - restoreDefaultColumnWidths(); - } - - variableTable.setInput(getVariableManager()); - variableTable.setLabelProvider(new SimpleVariableLabelProvider()); - } - - /** - * Creates the new/edit/remove buttons for the variable table - * @param parent the composite in which the buttons should be created - */ - private void createButtons(Composite parent) { - // Create button composite - Composite buttonComposite = new Composite(parent, SWT.NONE); - GridLayout glayout = new GridLayout(); - glayout.marginHeight = 0; - glayout.marginWidth = 0; - glayout.numColumns = 1; - GridData gdata = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); - buttonComposite.setLayout(glayout); - buttonComposite.setLayoutData(gdata); - buttonComposite.setFont(parent.getFont()); - - // Create buttons - envAddButton = SWTFactory.createPushButton(buttonComposite, DebugPreferencesMessages.SimpleVariablePreferencePage_7, null); - envAddButton.addSelectionListener(new SelectionAdapter() - { - public void widgetSelected(SelectionEvent event) { - handleAddButtonPressed(); - } - }); - envEditButton = SWTFactory.createPushButton(buttonComposite, DebugPreferencesMessages.SimpleVariablePreferencePage_8, null); - envEditButton.addSelectionListener(new SelectionAdapter() - { - public void widgetSelected(SelectionEvent event) { - handleEditButtonPressed(); - } - }); - envEditButton.setEnabled(false); - envRemoveButton = SWTFactory.createPushButton(buttonComposite, DebugPreferencesMessages.SimpleVariablePreferencePage_9, null); - envRemoveButton.addSelectionListener(new SelectionAdapter() - { - public void widgetSelected(SelectionEvent event) { - handleRemoveButtonPressed(); - } - }); - envRemoveButton.setEnabled(false); - } - - private void handleAddButtonPressed() { - boolean done = false; - String name = null; - String description = null; - String value = null; - while (!done){ - - MultipleInputDialog dialog= new MultipleInputDialog(getShell(), DebugPreferencesMessages.SimpleVariablePreferencePage_13); - dialog.addTextField(NAME_LABEL, name, false); - dialog.addBrowseField(VALUE_LABEL, value, true); - dialog.addTextField(DESCRIPTION_LABEL, description, true); - - if (dialog.open() != Window.OK) { - done = true; - } - else { - name= dialog.getStringValue(NAME_LABEL).trim(); - value = dialog.getStringValue(VALUE_LABEL); - description= dialog.getStringValue(DESCRIPTION_LABEL); - done = addVariable(name, description, value); - } - } - } - - /** - * Attempts to create and add a new variable with the given properties. Returns - * whether the operation completed successfully (either the variable was added - * successfully, or the user cancelled the operation). Returns false if the name - * is null or the user chooses not to overwrite an existing variable. - * - * @param name name of the variable, cannot be <code>null</code> or empty. - * @param description description of the variable or <code>null</code> - * @param value value of the variable or <code>null</code> - * @return whether the operation completed successfully - */ - private boolean addVariable(String name, String description, String value) { - if (name == null || name.length() == 0){ - MessageDialog.openError(getShell(),DebugPreferencesMessages.StringVariablePreferencePage_21, DebugPreferencesMessages.StringVariablePreferencePage_20); - return false; - } - List editedVariables= variableContentProvider.getWorkingSetVariables(); - Iterator iter= editedVariables.iterator(); - while (iter.hasNext()) { - VariableWrapper currentVariable = (VariableWrapper) iter.next(); - if (!currentVariable.isRemoved()) { - String currentName = currentVariable.getName(); - if (currentName.equals(name)) { - if (currentVariable.isReadOnly()){ - MessageDialog.openError(getShell(),DebugPreferencesMessages.StringVariablePreferencePage_23, MessageFormat.format(DebugPreferencesMessages.StringVariablePreferencePage_22, new String[] {name})); - return false; - } - else { - MessageDialog dialog = new MessageDialog(getShell(), DebugPreferencesMessages.SimpleVariablePreferencePage_15, null, MessageFormat.format(DebugPreferencesMessages.SimpleVariablePreferencePage_16, new String[] {name}), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0); - int overWrite= dialog.open(); - if (overWrite == 0) { - currentVariable.setValue(value); - currentVariable.setDescription(description); - variableTable.update(currentVariable, null); - return true; - } else if(overWrite == 1){ - return false; - } else { - return true; // Cancel was pressed, return true so operation is ended - } - } - } - } - } - VariableWrapper newVariable = new VariableWrapper(name, description, value); - variableContentProvider.addVariable(newVariable); - variableTable.refresh(); - return true; - } - - private void handleEditButtonPressed() { - IStructuredSelection selection= (IStructuredSelection) variableTable.getSelection(); - VariableWrapper variable= (VariableWrapper) selection.getFirstElement(); - if (variable == null || variable.isReadOnly()) { - return; - } - String value= variable.getValue(); - String description= variable.getDescription(); - String name= variable.getName(); - MultipleInputDialog dialog= new MultipleInputDialog(getShell(), MessageFormat.format(DebugPreferencesMessages.SimpleVariablePreferencePage_14, new String[] {name})); - dialog.addBrowseField(VALUE_LABEL, value, true); - dialog.addTextField(DESCRIPTION_LABEL, description, true); - - if (dialog.open() == Window.OK) { - value= dialog.getStringValue(VALUE_LABEL); - description= dialog.getStringValue(DESCRIPTION_LABEL); - if (value != null) { - variable.setValue(value); - } - if (description != null) { - variable.setDescription(description); - } - variableTable.update(variable, null); - } - } - - /** - * Remove the selection variables. - */ - private void handleRemoveButtonPressed() { - IStructuredSelection selection= (IStructuredSelection) variableTable.getSelection(); - List variablesToRemove= selection.toList(); - StringBuffer contributedVariablesToRemove= new StringBuffer(); - Iterator iter= variablesToRemove.iterator(); - while (iter.hasNext()) { - VariableWrapper variable = (VariableWrapper) iter.next(); - if (variable.isContributed()) { - contributedVariablesToRemove.append('\t').append(variable.getName()).append('\n'); - } - } - if (contributedVariablesToRemove.length() > 0) { - boolean remove= MessageDialog.openQuestion(getShell(), DebugPreferencesMessages.SimpleLaunchVariablePreferencePage_21, MessageFormat.format(DebugPreferencesMessages.SimpleLaunchVariablePreferencePage_22, new String[] {contributedVariablesToRemove.toString()})); // - if (!remove) { - return; - } - } - VariableWrapper[] variables= (VariableWrapper[]) variablesToRemove.toArray(new VariableWrapper[0]); - for (int i = 0; i < variables.length; i++) { - variables[i].setRemoved(true); - } - variableTable.refresh(); - } - - /** - * Responds to a selection changed event in the variable table - * @param event the selection change event - */ - protected void handleTableSelectionChanged(SelectionChangedEvent event) { - IStructuredSelection selection = ((IStructuredSelection)event.getSelection()); - VariableWrapper variable= (VariableWrapper) selection.getFirstElement(); - if (variable == null || variable.isReadOnly()) { - envEditButton.setEnabled(false); - envRemoveButton.setEnabled(false); - } - else { - envEditButton.setEnabled(selection.size() == 1); - envRemoveButton.setEnabled(selection.size() > 0); - } - } - - public void init(IWorkbench workbench) { - } - - /** - * Clear the variables. - */ - protected void performDefaults() { - variableContentProvider.init(); - variableTable.refresh(); - super.performDefaults(); - } - - /** - * Sets the saved state for reversion. - */ - public boolean performOk() { - variableContentProvider.saveChanges(); - saveColumnWidths(); - return super.performOk(); - } - - /** - * Returns the DebugPlugin's singleton instance of the - * launch variable manager - * @return the singleton instance of the simple variable registry. - */ - private IStringVariableManager getVariableManager() { - return VariablesPlugin.getDefault().getStringVariableManager(); - } - - public void saveColumnWidths() { - StringBuffer widthPreference = new StringBuffer(); - for (int i = 0; i < variableTable.getTable().getColumnCount(); i++) { - widthPreference.append(variableTable.getTable().getColumn(i).getWidth()); - widthPreference.append(','); - } - if (widthPreference.length() > 0){ - DebugUIPlugin.getDefault().getPreferenceStore().setValue(STRING_VARIABLE_PREFERENCE_KEY, widthPreference.toString()); - } - } - - private boolean restoreColumnWidths() { - String[] columnWidthStrings = DebugUIPlugin.getDefault().getPreferenceStore().getString(STRING_VARIABLE_PREFERENCE_KEY).split(","); //$NON-NLS-1$ - int columnCount = variableTable.getTable().getColumnCount(); - if (columnWidthStrings.length != columnCount){ - return false; // Preferred column sizes not stored correctly. - } - for (int i = 0; i < columnCount; i++) { - try{ - int columnWidth = Integer.parseInt(columnWidthStrings[i]); - variableTable.getTable().getColumn(i).setWidth(columnWidth); - } catch (NumberFormatException e){ - DebugUIPlugin.log(new Throwable("Problem loading persisted column sizes for StringVariablePreferencesPage",e)); //$NON-NLS-1$ - } - } - return true; - } - - private void restoreDefaultColumnWidths(){ - TableLayout layout = new TableLayout(); - for (int i = 0; i < variableTableColumnLayouts.length; i++) { - layout.addColumnData(variableTableColumnLayouts[i]); - } - variableTable.getTable().setLayout(layout); - } - - private class SimpleVariableContentProvider implements IStructuredContentProvider { - /** - * The content provider stores variable wrappers for use during editing. - */ - private List fWorkingSet = new ArrayList(); - - public Object[] getElements(Object inputElement) { - return fWorkingSet.toArray(); - } - - /** - * Adds the given variable to the 'wrappers' - * - * @param variable variable to add - */ - public void addVariable(VariableWrapper variable) { - fWorkingSet.add(variable); - } - - public void dispose() { - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - if (newInput == null || !(newInput instanceof IStringVariableManager)){ - return; - } - init(); - } - - /** - * Saves the edited variable state to the variable manager. - */ - public void saveChanges() { - IStringVariableManager manager = getVariableManager(); - Iterator iterator = fWorkingSet.iterator(); - List remove = new ArrayList(); - List add = new ArrayList(); - while (iterator.hasNext()) { - VariableWrapper variable = (VariableWrapper) iterator.next(); - if (!variable.isReadOnly()) { - IValueVariable underlyingVariable = variable.getUnderlyingVariable(); - if (variable.isRemoved()) { - if (underlyingVariable != null) { - // if added and removed there is no underlying variable - remove.add(underlyingVariable); - } - } else if (variable.isAdded()) { - IValueVariable vv = manager.newValueVariable(variable.getName(), variable.getDescription()); - vv.setValue(variable.getValue()); - add.add(vv); - } else if (variable.isChanged()) { - underlyingVariable.setValue(variable.getValue()); - underlyingVariable.setDescription(variable.getDescription()); - } - } - } - // remove - if (!remove.isEmpty()) { - manager.removeVariables((IValueVariable[]) remove.toArray(new IValueVariable[remove.size()])); - } - // add - if (!add.isEmpty()) { - try { - manager.addVariables((IValueVariable[]) add.toArray(new IValueVariable[add.size()])); - } catch (CoreException e) { - DebugUIPlugin.errorDialog(getShell(), DebugPreferencesMessages.StringVariablePreferencePage_24, DebugPreferencesMessages.StringVariablePreferencePage_25, e.getStatus()); // - } - } - } - - /** - * Re-initializes to the variables currently stored in the manager. - */ - public void init() { - fWorkingSet.clear(); - IStringVariableManager manager = getVariableManager(); - IValueVariable[] variables = manager.getValueVariables(); - for (int i = 0; i < variables.length; i++) { - fWorkingSet.add(new VariableWrapper(variables[i])); - } - } - - /** - * Returns the 'working set' of variables - * - * @return the working set of variables (not yet saved) - */ - public List getWorkingSetVariables() { - return fWorkingSet; - } - - } - - class VariableWrapper { - - protected IValueVariable fVariable; - protected String fNewName = null; - protected String fNewDesc = null; - protected String fNewValue = null; - boolean fRemoved = false; - boolean fAdded = false; - - public VariableWrapper(IValueVariable variable) { - fVariable = variable; - } - - public VariableWrapper(String name, String desc, String value) { - fNewName = name; - fNewDesc = desc; - fNewValue = value; - fAdded = true; - } - - public boolean isAdded() { - return fAdded; - } - - public String getName() { - if (fNewName == null) { - return fVariable.getName(); - } - return fNewName; - } - - public void setName(String name) { - fNewName = name; - } - - public String getDescription() { - if (fNewDesc == null) { - return fVariable.getDescription(); - } - return fNewDesc; - } - - public String getValue() { - if (fNewValue == null) { - return fVariable.getValue(); - } - return fNewValue; - } - - public void setValue(String value) { - fNewValue = value; - } - - public void setDescription(String desc) { - fNewDesc = desc; - } - - public boolean isChanged() { - return !fAdded && !fRemoved && (fNewValue != null || fNewDesc != null); - } - - public boolean isReadOnly() { - if (fVariable == null) { - return false; - } - return fVariable.isReadOnly(); - } - - public boolean isContributed() { - if (fVariable == null) { - return false; - } - return fVariable.isContributed(); - } - - public IValueVariable getUnderlyingVariable() { - return fVariable; - } - - public boolean isRemoved() { - return fRemoved; - } - - public void setRemoved(boolean removed) { - fRemoved = removed; - } - } - - private class SimpleVariableLabelProvider extends LabelProvider implements ITableLabelProvider, IColorProvider { - public Image getColumnImage(Object element, int columnIndex) { - return null; - } - public String getColumnText(Object element, int columnIndex) { - if (element instanceof VariableWrapper) { - VariableWrapper variable= (VariableWrapper) element; - switch (columnIndex) { - case 0 : - StringBuffer name = new StringBuffer(); - name.append(variable.getName()); - if (variable.isReadOnly()){ - name.append(DebugPreferencesMessages.StringVariablePreferencePage_26); - } - return name.toString(); - case 1: - String value= variable.getValue(); - if (value == null) { - value= IInternalDebugCoreConstants.EMPTY_STRING; - } - return value; - case 2: - String description= variable.getDescription(); - if (description == null) { - description= IInternalDebugCoreConstants.EMPTY_STRING; - } - return description; - case 3: - String contribution = IInternalDebugCoreConstants.EMPTY_STRING; - if (variable.isContributed()) { - String pluginId = getVariableManager().getContributingPluginId(variable.getUnderlyingVariable()); - if (pluginId != null) { - contribution = pluginId; - } else { - contribution = DebugPreferencesMessages.SimpleLaunchVariablePreferencePage_23; - } - } - return contribution; - - } - } - return null; - } - public Color getForeground(Object element) { - return null; - } - public Color getBackground(Object element) { - if (element instanceof VariableWrapper) { - if (((VariableWrapper) element).isReadOnly()) { - Display display= Display.getCurrent(); - return display.getSystemColor(SWT.COLOR_INFO_BACKGROUND); - } - } - return null; - } - } - - class VariableFilter extends ViewerFilter { - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) - */ - public boolean select(Viewer viewer, Object parentElement, Object element) { - return !((VariableWrapper)element).isRemoved(); - } - - } -} 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 deleted file mode 100644 index 0e9349466..000000000 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ViewManagementPreferencePage.java +++ /dev/null @@ -1,272 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.debug.internal.ui.preferences; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import org.eclipse.debug.internal.core.IInternalDebugCoreConstants; -import org.eclipse.debug.internal.ui.DebugUIPlugin; -import org.eclipse.debug.internal.ui.IDebugHelpContextIds; -import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; -import org.eclipse.debug.internal.ui.SWTFactory; -import org.eclipse.debug.internal.ui.views.ViewContextService; -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.IStructuredContentProvider; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -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.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; -import org.eclipse.ui.model.PerspectiveLabelProvider; - -/** - * Preference page for configuring the debugger's automatic - * view management. - */ -public class ViewManagementPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { - - private CheckboxTableViewer fPerspectiveViewer; - private Button fTrackViewsButton; - private Button fResetViewsButton; - // This flag indicates whether or not the user has pressed the reset button - private boolean fResetPressed= false; - private PerspectiveLabelProvider fLabelProvider= null; - private SelectionListener fSelectionListener= new SelectionAdapter() { - - public void widgetSelected(SelectionEvent e) { - Object source = e.getSource(); - if (source == fResetViewsButton) { - handleResetPressed(); - } else if (source == fTrackViewsButton) { - handleTrackViewsToggled(); - } - } - - }; - - public ViewManagementPreferencePage() { - super(); - setTitle(DebugPreferencesMessages.ViewManagementPreferencePage_1); - setDescription(DebugPreferencesMessages.ViewManagementPreferencePage_0); - setPreferenceStore(DebugUITools.getPreferenceStore()); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#createControl(org.eclipse.swt.widgets.Composite) - */ - public void createControl(Composite parent) { - super.createControl(parent); - PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IDebugHelpContextIds.VIEW_MANAGEMENT_PREFERENCE_PAGE); - } - - /* (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)); - composite.setFont(parent.getFont()); - - createPerspectiveViewer(composite); - - createViewTrackingOptions(composite); - - Dialog.applyDialogFont(composite); - - return composite; - } - - /** - * @param composite - */ - private void createViewTrackingOptions(Composite composite) { - fTrackViewsButton= new Button(composite, SWT.CHECK); - fTrackViewsButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - fTrackViewsButton.setText(DebugPreferencesMessages.ViewManagementPreferencePage_3); - fTrackViewsButton.setSelection(DebugUITools.getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_TRACK_VIEWS)); - fTrackViewsButton.addSelectionListener(fSelectionListener); - - Label label= new Label(composite, SWT.WRAP); - label.setText(DebugPreferencesMessages.ViewManagementPreferencePage_4); - label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - fResetViewsButton= SWTFactory.createPushButton(composite, DebugPreferencesMessages.ViewManagementPreferencePage_5, null); - ((GridData) fResetViewsButton.getLayoutData()).horizontalAlignment= GridData.BEGINNING; - fResetViewsButton.addSelectionListener(fSelectionListener); - updateResetButton(); - } - - private void handleResetPressed() { - fResetPressed= true; - fResetViewsButton.setEnabled(false); - } - - protected void handleTrackViewsToggled() { - if (fTrackViewsButton.getSelection()) { - // When toggled on, possibly re-enable the reset button - updateResetButton(); - } else { - // When toggled off, disable the reset button - fResetViewsButton.setEnabled(false); - } - } - - /** - * @param parent - */ - private void createPerspectiveViewer(Composite parent) { - Label label= new Label(parent, SWT.WRAP); - label.setText(DebugPreferencesMessages.ViewManagementPreferencePage_2); - 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); - fLabelProvider= new PerspectiveLabelProvider(); - fPerspectiveViewer.setLabelProvider(fLabelProvider); - fPerspectiveViewer.setInput(this); - - Set perspectives; - String preference = DebugUIPlugin.getDefault().getPreferenceStore().getString( - IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES); - if (IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES_DEFAULT.equals(preference)) { - perspectives = ViewContextService.getDefaultEnabledPerspectives(); - } else { - perspectives = ViewContextService.parseList(preference); - } - checkPerspectives(perspectives); - } - - private void checkPerspectives(Set perspectives) { - fPerspectiveViewer.setAllChecked(false); - IPerspectiveRegistry registry= PlatformUI.getWorkbench().getPerspectiveRegistry(); - Iterator perspectiveIds= perspectives.iterator(); - while (perspectiveIds.hasNext()) { - IPerspectiveDescriptor descriptor = registry.findPerspectiveWithId((String) perspectiveIds.next()); - if (descriptor != null) { - fPerspectiveViewer.setChecked(descriptor, true); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.IPreferencePage#performOk() - */ - public boolean performOk() { - Object[] descriptors = fPerspectiveViewer.getCheckedElements(); - Set perspectives = new HashSet(); - for (int i = 0; i < descriptors.length; i++) { - perspectives.add( ((IPerspectiveDescriptor)descriptors[i]).getId() ); - } - if (perspectives.equals(ViewContextService.getDefaultEnabledPerspectives())) { - getPreferenceStore().setValue(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES, - IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES_DEFAULT); - } else { - StringBuffer buffer= new StringBuffer(); - for (Iterator itr = perspectives.iterator(); itr.hasNext();) { - buffer.append(itr.next()).append(','); - } - getPreferenceStore().setValue(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES, buffer.toString()); - } - - boolean trackViews = fTrackViewsButton.getSelection(); - getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_TRACK_VIEWS, trackViews); - if (fResetPressed || !trackViews) { - // Reset if the user has pressed reset or chosen to no longer track views - getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_USER_VIEW_BINDINGS, IInternalDebugCoreConstants.EMPTY_STRING); - } - return super.performOk(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.preference.PreferencePage#performDefaults() - */ - protected void performDefaults() { - checkPerspectives( ViewContextService.getDefaultEnabledPerspectives() ); - fTrackViewsButton.setSelection(getPreferenceStore().getDefaultBoolean(IInternalDebugUIConstants.PREF_TRACK_VIEWS)); - fResetPressed= false; - updateResetButton(); - super.performDefaults(); - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) - */ - public void init(IWorkbench workbench) { - } - - /** - * Updates enablement of the reset button. - * Enable if either persisted view collection is not empty. - * Always disable if "track views" is turned off. - */ - private void updateResetButton() { - boolean enableReset= !IInternalDebugCoreConstants.EMPTY_STRING.equals(getPreferenceStore().getString(IInternalDebugUIConstants.PREF_USER_VIEW_BINDINGS)); - // Only enable the button if there are views to clear, the user hasn't pressed the reset - // button, and the option to "track views" is turned on. - fResetViewsButton.setEnabled(enableReset && !fResetPressed && fTrackViewsButton.getSelection()); - } - - private static class PerspectiveProvider implements IStructuredContentProvider { - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) - */ - public Object[] getElements(Object inputElement) { - return PlatformUI.getWorkbench().getPerspectiveRegistry().getPerspectives(); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) - */ - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IContentProvider#dispose() - */ - public void dispose() { - } - - } - /* (non-Javadoc) - * @see org.eclipse.jface.dialogs.IDialogPage#dispose() - */ - public void dispose() { - super.dispose(); - if (fLabelProvider != null) { - fLabelProvider.dispose(); - } - } -} |