diff options
Diffstat (limited to 'org.eclipse.debug.ui')
5 files changed, 281 insertions, 115 deletions
diff --git a/org.eclipse.debug.ui/plugin.properties b/org.eclipse.debug.ui/plugin.properties index f63ac59b5..fb141558a 100644 --- a/org.eclipse.debug.ui/plugin.properties +++ b/org.eclipse.debug.ui/plugin.properties @@ -375,3 +375,8 @@ command.description.1 = Load next page of memory command.name.1 = Next Page of Memory command.description.2 = Load previous page of memory command.name.2 = Previous Page of Memory + +console.background.label= Process console background +console.out.label= Standard out +console.in.label= Standard in +console.err.label= Standard error
\ No newline at end of file diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml index 637e25a59..ed3227915 100644 --- a/org.eclipse.debug.ui/plugin.xml +++ b/org.eclipse.debug.ui/plugin.xml @@ -2665,4 +2665,52 @@ M4 = Platform-specific fourth key </detailFactories> </extension> + <extension + point="org.eclipse.ui.themes"> + <colorDefinition + id="org.eclipse.debug.ui.console.background" + isEditable="false" + label="%console.background.label" + value="255,255,255"> + </colorDefinition> + <colorDefinition + id="org.eclipse.debug.ui.console.stream.out" + isEditable="false" + label="%console.out.label" + value="0,0,0"> + </colorDefinition> + <colorDefinition + id="org.eclipse.debug.ui.console.stream.in" + isEditable="false" + label="%console.in.label" + value="0,200,125"> + </colorDefinition> + <colorDefinition + id="org.eclipse.debug.ui.console.stream.err" + isEditable="false" + label="%console.err.label" + value="255,0,0"> + </colorDefinition> + + <theme + id="org.eclipse.ui.ide.systemDefault"> + <colorOverride + id="org.eclipse.debug.ui.console.background" + value="COLOR_LIST_BACKGROUND"> + </colorOverride> + <colorOverride + id="org.eclipse.debug.ui.console.stream.out" + value="COLOR_LIST_FOREGROUND"> + </colorOverride> + <colorOverride + id="org.eclipse.debug.ui.console.stream.in" + value="COLOR_LIST_FOREGROUND"> + </colorOverride> + <colorOverride + id="org.eclipse.debug.ui.console.stream.err" + value="COLOR_LIST_FOREGROUND"> + </colorOverride> + </theme> + </extension> + </plugin> diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java index 0ec2abeb0..a1b9e585c 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPlugin.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 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 @@ -22,23 +22,15 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import org.eclipse.core.resources.ISaveContext; -import org.eclipse.core.resources.ISaveParticipant; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.core.runtime.jobs.IJobChangeEvent; -import org.eclipse.core.runtime.jobs.IJobChangeListener; -import org.eclipse.core.runtime.jobs.IJobManager; -import org.eclipse.core.runtime.jobs.Job; +import com.ibm.icu.text.MessageFormat; + +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.service.packageadmin.PackageAdmin; +import org.osgi.util.tracker.ServiceTracker; + +import org.w3c.dom.Document; + import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; @@ -63,10 +55,31 @@ import org.eclipse.debug.internal.ui.stringsubstitution.SelectedResourceManager; import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointOrganizerManager; import org.eclipse.debug.internal.ui.views.console.ProcessConsoleManager; import org.eclipse.debug.internal.ui.views.launch.DebugElementHelper; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.debug.ui.IDebugModelPresentation; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.debug.ui.ILaunchGroup; + +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.core.runtime.jobs.IJobChangeEvent; +import org.eclipse.core.runtime.jobs.IJobChangeListener; +import org.eclipse.core.runtime.jobs.IJobManager; +import org.eclipse.core.runtime.jobs.Job; + +import org.eclipse.core.resources.ISaveContext; +import org.eclipse.core.resources.ISaveParticipant; +import org.eclipse.core.resources.IncrementalProjectBuilder; +import org.eclipse.core.resources.ResourcesPlugin; + import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.MessageDialogWithToggle; @@ -75,30 +88,28 @@ import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferenceConverter; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.window.Window; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; + import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.ui.progress.IProgressService; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.service.packageadmin.PackageAdmin; -import org.osgi.util.tracker.ServiceTracker; -import org.w3c.dom.Document; +import org.eclipse.ui.themes.IThemeManager; -import com.ibm.icu.text.MessageFormat; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.debug.ui.IDebugModelPresentation; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.debug.ui.ILaunchGroup; /** * The Debug UI Plug-in. * - * Since 3.3 this plugin registers an <code>ISaveParticipant</code>, allowing this plugin to participate + * Since 3.3 this plugin registers an <code>ISaveParticipant</code>, allowing this plugin to participate * in workspace persistence life-cycles * * @see ISaveParticipant @@ -122,7 +133,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { /** * Default label provider - */ + */ private static DefaultLabelProvider fgDefaultLabelProvider; /** @@ -174,6 +185,14 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { */ private Set fSaveParticipants = new HashSet(); + /** + * Theme listener. + * + * @since 3.4 + */ + private IPropertyChangeListener fThemeListener; + + public static boolean DEBUG = false; /** @@ -268,12 +287,12 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { public LaunchConfigurationManager getLaunchConfigurationManager() { if (fLaunchConfigurationManager == null) { fLaunchConfigurationManager = new LaunchConfigurationManager(); - } + } return fLaunchConfigurationManager; } /** - * Returns the context launching resource manager. If one has not been created prior to this + * Returns the context launching resource manager. If one has not been created prior to this * method call, a new manager is created and initialized, by calling its startup() method. * @return the context launching resource manager * @@ -310,7 +329,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { if (windows.length > 0) { return windows[0].getShell(); } - } + } else { return window.getShell(); } @@ -342,7 +361,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { Bundle bundle = Platform.getBundle(element.getContributor().getName()); if (bundle.getState() == Bundle.ACTIVE) { return element.createExecutableExtension(classAttribute); - } + } final Object [] ret = new Object[1]; final CoreException [] exc = new CoreException[1]; BusyIndicator.showWhile(null, new Runnable() { @@ -358,7 +377,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { throw exc[0]; } return ret[0]; - } + } /** * @see org.eclipse.ui.plugin.AbstractUIPlugin#createImageRegistry() @@ -409,6 +428,12 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { ResourcesPlugin.getWorkspace().removeSaveParticipant(this); + if (fThemeListener != null) { + if (PlatformUI.isWorkbenchRunning()) + PlatformUI.getWorkbench().getThemeManager().removePropertyChangeListener(fThemeListener); + fThemeListener= null; + } + } finally { super.stop(context); } @@ -449,7 +474,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { for(Iterator iter = fSaveParticipants.iterator(); iter.hasNext();) { ((ISaveParticipant)iter.next()).saving(saveContext); } - } + } public void rollback(ISaveContext saveContext) { for(Iterator iter = fSaveParticipants.iterator(); iter.hasNext();) { ((ISaveParticipant)iter.next()).rollback(saveContext); @@ -471,7 +496,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { // make sure the perspective manager is created // and be the first debug event listener fPerspectiveManager = new PerspectiveManager(); - fPerspectiveManager.startup(); + fPerspectiveManager.startup(); getLaunchingResourceManager(); @@ -487,6 +512,17 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { getLaunchConfigurationManager().startup(); + if (PlatformUI.isWorkbenchRunning()) { + fThemeListener= new IPropertyChangeListener() { + + public void propertyChange(PropertyChangeEvent event) { + if (IThemeManager.CHANGE_CURRENT_THEME.equals(event.getProperty())) + DebugUIPreferenceInitializer.setThemeBasedPreferences(getPreferenceStore(), true); + } + }; + PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(fThemeListener); + } + // do the asynchronous exec last - see bug 209920 getStandardDisplay().asyncExec( new Runnable() { @@ -525,7 +561,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { } } else { status= new Status(IStatus.ERROR, getUniqueIdentifier(), IDebugUIConstants.INTERNAL_ERROR, "Error within Debug UI: ", t); //$NON-NLS-1$ - log(status); + log(status); } ErrorDialog.openError(shell, title, message, status); } @@ -542,7 +578,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { /** * Logs the specified throwable with this plug-in's log. * - * @param t throwable to log + * @param t throwable to log */ public static void log(Throwable t) { log(newErrorStatus("Error logged from Debug UI: ", t)); //$NON-NLS-1$ @@ -556,7 +592,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { public static void logErrorMessage(String message) { // this message is intentionally not internationalized, as an exception may // be due to the resource bundle itself - log(newErrorStatus("Internal message logged from Debug UI: " + message, null)); //$NON-NLS-1$ + log(newErrorStatus("Internal message logged from Debug UI: " + message, null)); //$NON-NLS-1$ } /** @@ -583,11 +619,11 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { * @param configuration the configuration to display * @param groupIdentifier group identifier of the launch group the launch configuration * belongs to - * @param status the status to display, or <code>null</code> if none + * @param status the status to display, or <code>null</code> if none * @param showCancel if the cancel button should be shown in the particular instance of the dialog * @return the return code from opening the launch configuration dialog - * one of <code>Window.OK</code> or <code>Window.CANCEL</code> - * + * * @since 3.3 * */ @@ -597,7 +633,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { LaunchConfigurationEditDialog dialog = new LaunchConfigurationEditDialog(shell, configuration, group, showCancel); dialog.setInitialStatus(status); return dialog.open(); - } + } return Window.CANCEL; } @@ -617,11 +653,11 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { * belongs to * @param reservednames a set of launch configuration names that cannot be used when creating or renaming * the specified launch configuration - * @param status the status to display, or <code>null</code> if none + * @param status the status to display, or <code>null</code> if none * @param setDefaults whether to set default values in the configuration * @return the return code from opening the launch configuration dialog - * one of <code>Window.OK</code> or <code>Window.CANCEL</code> - * + * * @since 3.3 * */ @@ -632,7 +668,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { dialog.setInitialStatus(status); dialog.setDefaultsOnOpen(setDefaults); return dialog.open(); - } + } return Window.CANCEL; } @@ -649,7 +685,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { return false; } return PlatformUI.getWorkbench().saveAllEditors(confirm); - } + } /** * Save & build the workspace according to the user-specified preferences. Return <code>false</code> if @@ -693,14 +729,14 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { // canceled by user return false; } catch (InvocationTargetException e) { - String title= DebugUIMessages.DebugUIPlugin_Run_Debug_1; - String message= DebugUIMessages.DebugUIPlugin_Build_error__Check_log_for_details__2; + String title= DebugUIMessages.DebugUIPlugin_Run_Debug_1; + String message= DebugUIMessages.DebugUIPlugin_Build_error__Check_log_for_details__2; Throwable t = e.getTargetException(); errorDialog(getShell(), title, message, t); return false; } return true; - } + } /** * Returns the standard display to be used. The method first checks, if @@ -713,8 +749,8 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { if (display == null) { display= Display.getDefault(); } - return display; - } + return display; + } /** * Returns the a color based on the type of output. @@ -729,7 +765,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { } /** - * Returns the process console manager. The manager will be created lazily on + * Returns the process console manager. The manager will be created lazily on * the first access. * * @return ProcessConsoleManager @@ -795,7 +831,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { /** * Save dirty editors before launching, according to preferences. * - * @return whether to proceed with launch + * @return whether to proceed with launch * @deprecated Saving has been moved to the launch delegate <code>LaunchConfigurationDelegate</code> to allow for scoped saving * of resources that are only involved in the current launch, no longer the entire workspace */ @@ -803,13 +839,13 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { String saveDirty = getDefault().getPreferenceStore().getString(IInternalDebugUIConstants.PREF_SAVE_DIRTY_EDITORS_BEFORE_LAUNCH); if (saveDirty.equals(MessageDialogWithToggle.NEVER)) { return true; - } + } return saveAllEditors(saveDirty.equals(MessageDialogWithToggle.PROMPT)); } /** * Builds the workspace (according to preferences) and launches the given launch - * configuration in the specified mode. May return null if auto build is in process and + * configuration in the specified mode. May return null if auto build is in process and * user cancels the launch. * * @param configuration the configuration to launch @@ -827,7 +863,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { return configuration.launch( mode, new SubProgressMonitor(monitor, 1), - buildBeforeLaunch); + buildBeforeLaunch); } finally { @@ -854,7 +890,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { String waitForBuild = store.getString(IInternalDebugUIConstants.PREF_WAIT_FOR_BUILD); if (waitForBuild.equals(MessageDialogWithToggle.PROMPT)) { - MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoCancelQuestion(getShell(), DebugUIMessages.DebugUIPlugin_23, DebugUIMessages.DebugUIPlugin_24, null, false, store, IInternalDebugUIConstants.PREF_WAIT_FOR_BUILD); // + MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoCancelQuestion(getShell(), DebugUIMessages.DebugUIPlugin_23, DebugUIMessages.DebugUIPlugin_24, null, false, store, IInternalDebugUIConstants.PREF_WAIT_FOR_BUILD); // switch (dialog.getReturnCode()) { case IDialogConstants.CANCEL_ID: @@ -884,22 +920,22 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { try { jobManager.join(ResourcesPlugin.FAMILY_MANUAL_BUILD, new SubProgressMonitor(monitor, 1)); jobManager.join(ResourcesPlugin.FAMILY_AUTO_BUILD, new SubProgressMonitor(monitor, 1)); - } + } catch (InterruptedException e) {/* continue*/} if (!monitor.isCanceled()) { try { buildAndLaunch(configuration, mode, new SubProgressMonitor(monitor, 98)); - } + } catch (CoreException e) { throw new InvocationTargetException(e); } } - } - }; + } + }; try { progressService.busyCursorWhile(runnable); - } - catch (InterruptedException e) {} + } + catch (InterruptedException e) {} catch (InvocationTargetException e2) { handleInvocationTargetException(e2, configuration, mode); } @@ -911,19 +947,19 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { monitor.beginTask(MessageFormat.format(DebugUIMessages.DebugUIPlugin_25, new Object[] {configuration.getName()}), 1); try { buildAndLaunch(configuration, mode, new SubProgressMonitor(monitor, 1)); - } + } catch (CoreException e) { throw new InvocationTargetException(e); } - } + } }; try { PlatformUI.getWorkbench().getProgressService().busyCursorWhile(runnable); - } + } catch (InvocationTargetException e) { handleInvocationTargetException(e, configuration, mode); - } - catch (InterruptedException e) {} + } + catch (InterruptedException e) {} } } @@ -950,7 +986,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { return; } } - DebugUIPlugin.errorDialog(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, DebugUIMessages.DebugUITools_Exception_occurred_during_launch_2, t); // + DebugUIPlugin.errorDialog(DebugUIPlugin.getShell(), DebugUIMessages.DebugUITools_Error_1, DebugUIMessages.DebugUITools_Exception_occurred_during_launch_2, t); // } /** @@ -970,7 +1006,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { String waitPref = store.getString(IInternalDebugUIConstants.PREF_WAIT_FOR_BUILD); if (wait) { // if there are build jobs running, do we wait or not?? if (waitPref.equals(MessageDialogWithToggle.PROMPT)) { - MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoCancelQuestion(getShell(), DebugUIMessages.DebugUIPlugin_23, DebugUIMessages.DebugUIPlugin_24, null, false, store, IInternalDebugUIConstants.PREF_WAIT_FOR_BUILD); // + MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoCancelQuestion(getShell(), DebugUIMessages.DebugUIPlugin_23, DebugUIMessages.DebugUIPlugin_24, null, false, store, IInternalDebugUIConstants.PREF_WAIT_FOR_BUILD); // switch (dialog.getReturnCode()) { case IDialogConstants.CANCEL_ID: return; @@ -981,11 +1017,11 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { wait = false; break; } - } + } else { wait = waitPref.equals(MessageDialogWithToggle.ALWAYS); } - } + } final boolean waitInJob = wait; Job job = new Job(MessageFormat.format(DebugUIMessages.DebugUIPlugin_25, new Object[] {configuration.getName()})) { public IStatus run(final IProgressMonitor monitor) { @@ -994,9 +1030,9 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { * - Build & launch (98) */ monitor.beginTask(DebugUIMessages.DebugUITools_3, 100); try { - if(waitInJob) { + if(waitInJob) { StringBuffer buffer = new StringBuffer(configuration.getName()); - buffer.append(DebugUIMessages.DebugUIPlugin_0); + buffer.append(DebugUIMessages.DebugUIPlugin_0); ILaunchConfigurationWorkingCopy workingCopy = configuration.copy(buffer.toString()); workingCopy.setAttribute(ATTR_LAUNCHING_CONFIG_HANDLE, configuration.getMemento()); final ILaunch pendingLaunch = new PendingLaunch(workingCopy, mode, this); @@ -1019,7 +1055,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { try { jobManager.join(ResourcesPlugin.FAMILY_MANUAL_BUILD, new SubProgressMonitor(monitor, 1)); jobManager.join(ResourcesPlugin.FAMILY_AUTO_BUILD, new SubProgressMonitor(monitor, 1)); - } + } catch (InterruptedException e) {/*just continue.*/} DebugPlugin.getDefault().getLaunchManager().removeLaunch(pendingLaunch); } @@ -1042,7 +1078,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { Runnable r = new Runnable() { public void run() { DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUIPlugin.getShell(), new StructuredSelection(configuration), group.getIdentifier(), status); - } + } }; DebugUIPlugin.getStandardDisplay().asyncExec(r); } @@ -1061,7 +1097,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { job.setName(MessageFormat.format(DebugUIMessages.DebugUIPlugin_25, new Object[] {configuration.getName()})); if (wait) { - progressService.showInDialog(workbench.getActiveWorkbenchWindow().getShell(), job); + progressService.showInDialog(workbench.getActiveWorkbenchWindow().getShell(), job); } job.schedule(); } @@ -1122,7 +1158,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { } } return title; - } + } /** * Returns the image descriptor registry used for this plug-in. @@ -1152,7 +1188,7 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { if (iconURL != null) { return ImageDescriptor.createFromURL(iconURL); } - } + } return null; } @@ -1172,12 +1208,12 @@ public class DebugUIPlugin extends AbstractUIPlugin implements ILaunchListener { if (iconURL != null) { return ImageDescriptor.createFromURL(iconURL); } - } + } return null; } /** - * Performs extra filtering for launch configurations based on the preferences set on the + * Performs extra filtering for launch configurations based on the preferences set on the * Launch Configurations page * @param config the config to filter * @return true if it should pass the filter, false otherwise diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java index cf86a68bd..c4b6a11a7 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. + * Copyright (c) 2004, 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 @@ -17,9 +17,9 @@ import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.jface.dialogs.MessageDialogWithToggle; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferenceConverter; -import org.eclipse.swt.SWT; +import org.eclipse.jface.resource.ColorRegistry; import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; public class DebugUIPreferenceInitializer extends AbstractPreferenceInitializer { @@ -72,26 +72,10 @@ public class DebugUIPreferenceInitializer extends AbstractPreferenceInitializer prefs.setDefault(IDebugPreferenceConstants.CONSOLE_LOW_WATER_MARK, 80000); prefs.setDefault(IDebugPreferenceConstants.CONSOLE_HIGH_WATER_MARK, 100000); prefs.setDefault(IDebugPreferenceConstants.CONSOLE_TAB_WIDTH, 8); - - // colors - PreferenceConverter.setDefault(prefs, IDebugPreferenceConstants.CONSOLE_SYS_OUT_COLOR, new RGB(0, 0, 0)); - PreferenceConverter.setDefault(prefs, IDebugPreferenceConstants.CONSOLE_SYS_IN_COLOR, new RGB(0, 200, 125)); - PreferenceConverter.setDefault(prefs, IDebugPreferenceConstants.CONSOLE_SYS_ERR_COLOR, new RGB(255, 0, 0)); - // can be called in non-UI thread, so we must play safe - Display display = DebugUIPlugin.getStandardDisplay(); - if (Thread.currentThread().equals(display.getThread())) { - PreferenceConverter.setDefault(prefs, IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR, display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB()); - } else { - display.asyncExec(new Runnable() { - public void run() { - PreferenceConverter.setDefault( - DebugUIPlugin.getDefault().getPreferenceStore(), - IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR, - DebugUIPlugin.getStandardDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB()); - } - }); - } - + + // console colors + setThemeBasedPreferences(prefs, false); + PreferenceConverter.setDefault(prefs, IInternalDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND, new RGB(255, 255, 0)); PreferenceConverter.setDefault(prefs, IDebugUIConstants.PREF_MEMORY_HISTORY_UNKNOWN_COLOR, new RGB(114, 119, 129)); PreferenceConverter.setDefault(prefs, IDebugUIConstants.PREF_MEMORY_HISTORY_KNOWN_COLOR, new RGB(0, 0, 0)); @@ -116,21 +100,21 @@ public class DebugUIPreferenceInitializer extends AbstractPreferenceInitializer prefs.setDefault(IDebugUIConstants.ID_EXPRESSION_VIEW + '+' + "org.eclipse.debug.ui.ShowTypeNamesAction", false); //$NON-NLS-1$ // set default for column size preference - prefs.setDefault(IDebugPreferenceConstants.PREF_COLUMN_SIZE, + prefs.setDefault(IDebugPreferenceConstants.PREF_COLUMN_SIZE, IDebugPreferenceConstants.PREF_COLUMN_SIZE_DEFAULT); // set default for row size preference - prefs.setDefault(IDebugPreferenceConstants.PREF_ROW_SIZE, + prefs.setDefault(IDebugPreferenceConstants.PREF_ROW_SIZE, IDebugPreferenceConstants.PREF_ROW_SIZE_DEFAULT); // set default padded string - prefs.setDefault(IDebugUIConstants.PREF_PADDED_STR, + prefs.setDefault(IDebugUIConstants.PREF_PADDED_STR, IDebugPreferenceConstants.PREF_PADDED_STR_DEFAULT); - // set default code page for ascii and ebcdic - prefs.setDefault(IDebugUIConstants.PREF_DEFAULT_ASCII_CODE_PAGE, + // set default code page for ascii and ebcdic + prefs.setDefault(IDebugUIConstants.PREF_DEFAULT_ASCII_CODE_PAGE, IDebugPreferenceConstants.DEFAULT_ASCII_CP); - prefs.setDefault(IDebugUIConstants.PREF_DEFAULT_EBCDIC_CODE_PAGE, + prefs.setDefault(IDebugUIConstants.PREF_DEFAULT_EBCDIC_CODE_PAGE, IDebugPreferenceConstants.DEFAULT_EBCDIC_CP); if (MemoryViewUtil.isLinuxGTK()) { @@ -154,4 +138,68 @@ public class DebugUIPreferenceInitializer extends AbstractPreferenceInitializer prefs.setDefault(IInternalDebugUIConstants.PREF_FILTER_WORKING_SETS, false); prefs.setDefault(IInternalDebugUIConstants.PREF_FILTER_LAUNCH_TYPES, false); } + + /** + * Returns the RGB for the given key in the given color registry. + * + * @param registry the color registry + * @param key the key for the constant in the registry + * @param defaultRGB the default RGB if no entry is found + * @return RGB the RGB + * @since 3.4 + */ + private static RGB findRGB(ColorRegistry registry, String key, RGB defaultRGB) { + if (registry == null) + return defaultRGB; + + RGB rgb= registry.getRGB(key); + if (rgb != null) + return rgb; + + return defaultRGB; + } + + /** + * Sets the default value and fires a property + * change event if necessary. + * + * @param store the preference store + * @param key the preference key + * @param newValue the new value + * @param fireEvent <code>false</code> if no event should be fired + * @since 3.4 + */ + private static void setDefault(IPreferenceStore store, String key, RGB newValue, boolean fireEvent) { + if (!fireEvent) { + PreferenceConverter.setDefault(store, key, newValue); + } else { + RGB oldValue= null; + if (store.isDefault(key)) + oldValue= PreferenceConverter.getDefaultColor(store, key); + + PreferenceConverter.setDefault(store, key, newValue); + + if (oldValue != null && !oldValue.equals(newValue)) + store.firePropertyChangeEvent(key, oldValue, newValue); + } + } + + public static void setThemeBasedPreferences(IPreferenceStore store, boolean fireEvent) { + ColorRegistry registry= null; + if (PlatformUI.isWorkbenchRunning()) + registry= PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry(); + + setDefault(store, + IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR, + findRGB(registry, IInternalDebugUIConstants.THEME_CONSOLE_COLOR_BACKGROUND, new RGB(255, 255, 255)), fireEvent); + setDefault(store, + IDebugPreferenceConstants.CONSOLE_SYS_OUT_COLOR, + findRGB(registry, IInternalDebugUIConstants.THEME_CONSOLE_COLOR_STD_OUT, new RGB(0, 0, 0)), fireEvent); + setDefault(store, + IDebugPreferenceConstants.CONSOLE_SYS_IN_COLOR, + findRGB(registry, IInternalDebugUIConstants.THEME_CONSOLE_COLOR_STD_IN, new RGB(0, 200, 125)), fireEvent); + setDefault(store, + IDebugPreferenceConstants.CONSOLE_SYS_ERR_COLOR, + findRGB(registry, IInternalDebugUIConstants.THEME_CONSOLE_COLOR_STD_ERR, new RGB(255, 0, 0)), fireEvent); + } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java index 571e7e750..96583fa4d 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java @@ -412,5 +412,34 @@ public interface IInternalDebugUIConstants { * @since 3.4 */ public static final String ID_EXTERNAL_TOOL_BUILDER_LAUNCH_CATEGORY = "org.eclipse.ui.externaltools.builder"; //$NON-NLS-1$ + + //themes + + /** + * Theme color definition for process console background color. + * + * @since 3.4 + */ + public static final String THEME_CONSOLE_COLOR_BACKGROUND= "org.eclipse.debug.ui.console.background"; //$NON-NLS-1$ + + /** + * Theme color definition for process console standard out. + * + * @since 3.4 + */ + public static final String THEME_CONSOLE_COLOR_STD_OUT= "org.eclipse.debug.ui.console.stream.out"; //$NON-NLS-1$ + /** + * Theme color definition for process console standard in. + * + * @since 3.4 + */ + public static final String THEME_CONSOLE_COLOR_STD_IN= "org.eclipse.debug.ui.console.stream.in"; //$NON-NLS-1$ + + /** + * Theme color definition for process console standard err. + * + * @since 3.4 + */ + public static final String THEME_CONSOLE_COLOR_STD_ERR= "org.eclipse.debug.ui.console.stream.err"; //$NON-NLS-1$ } |