diff options
author | Sarika Sinha | 2016-06-24 10:32:51 +0000 |
---|---|---|
committer | Sarika Sinha | 2016-09-09 11:48:04 +0000 |
commit | 414d0f61d474b7065cb3734772f39ad5a37d4349 (patch) | |
tree | d2b4b523dadbe146f32d4891dc23e9367030a0f2 /org.eclipse.debug.ui/ui/org/eclipse/debug | |
parent | ba0abc228cde4836afb6bc6fc4baf8259973e762 (diff) | |
download | eclipse.platform.debug-414d0f61d474b7065cb3734772f39ad5a37d4349.tar.gz eclipse.platform.debug-414d0f61d474b7065cb3734772f39ad5a37d4349.tar.xz eclipse.platform.debug-414d0f61d474b7065cb3734772f39ad5a37d4349.zip |
Bug 488664 - [Breakpoints] Ability to set up Breakpoint dependency
Change-Id: I62043723be1a1448ba3fe38e60b0e67f10c5df05
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug')
8 files changed, 152 insertions, 4 deletions
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 1ddf8b410..cb3242303 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 @@ -51,6 +51,7 @@ public class DebugUIPreferenceInitializer extends AbstractPreferenceInitializer prefs.setDefault(IInternalDebugUIConstants.PREF_RELAUNCH_IN_DEBUG_MODE, MessageDialogWithToggle.NEVER); prefs.setDefault(IInternalDebugUIConstants.PREF_CONTINUE_WITH_COMPILE_ERROR, MessageDialogWithToggle.PROMPT); prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_BREAKPOINTS, true); + prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_TRIGGER_BREAKPOINTS, true); prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_BREAKPOINTS_FROM_CONTAINER, true); prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_EXPRESSIONS, true); @@ -171,12 +172,14 @@ public class DebugUIPreferenceInitializer extends AbstractPreferenceInitializer * @since 3.4 */ private static RGB findRGB(ColorRegistry registry, String key, RGB defaultRGB) { - if (registry == null) + if (registry == null) { return defaultRGB; + } RGB rgb= registry.getRGB(key); - if (rgb != null) + if (rgb != null) { return rgb; + } return defaultRGB; } @@ -196,14 +199,16 @@ public class DebugUIPreferenceInitializer extends AbstractPreferenceInitializer PreferenceConverter.setDefault(store, key, newValue); } else { RGB oldValue= null; - if (store.isDefault(key)) + if (store.isDefault(key)) { oldValue= PreferenceConverter.getDefaultColor(store, key); + } PreferenceConverter.setDefault(store, key, newValue); - if (oldValue != null && !oldValue.equals(newValue)) + if (oldValue != null && !oldValue.equals(newValue)) { store.firePropertyChangeEvent(key, oldValue, newValue); } + } } public static void setThemeBasedPreferences(final IPreferenceStore store, final boolean fireEvent) { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java index 2b617ba5d..1855c13f6 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.java @@ -105,6 +105,9 @@ public class ActionMessages extends NLS { public static String RemoveBreakpointAction_6; public static String RemoveBreakpointAction_Exceptions_occurred_attempting_to_remove_a_breakpoint__5; public static String RemoveBreakpointAction_Removing_a_breakpoint_4; + + public static String RemoveAllTriggerpointsAction_0; + public static String RemoveAllTriggerpointsAction_1; public static String DeleteBreakpointOperationName; public static String DeleteBreakpointsOperationName; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties index 25055ad1f..97c8c0e1e 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/ActionMessages.properties @@ -60,6 +60,9 @@ RemoveBreakpointAction_6=Cancel RemoveBreakpointAction_Exceptions_occurred_attempting_to_remove_a_breakpoint__5=An exception occurred attempting to remove breakpoint(s). RemoveBreakpointAction_Removing_a_breakpoint_4=Removing a breakpoint +RemoveAllTriggerpointsAction_0=Remove All Triggerpoints +RemoveAllTriggerpointsAction_1=Are you sure you want to remove all triggerpoints? + DeleteBreakpointOperationName=Delete Breakpoint DeleteBreakpointsOperationName=Delete Breakpoints diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveAllTriggerpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveAllTriggerpointsAction.java new file mode 100644 index 000000000..1be6d04c8 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveAllTriggerpointsAction.java @@ -0,0 +1,126 @@ +/******************************************************************************* + * Copyright (c) 2016 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.actions.breakpoints; + + +import org.eclipse.core.resources.IMarkerDelta; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.IBreakpointsListener; +import org.eclipse.debug.core.model.IBreakpoint; +import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.debug.internal.ui.actions.AbstractRemoveAllActionDelegate; +import org.eclipse.debug.internal.ui.actions.ActionMessages; +import org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialogWithToggle; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.ui.IWorkbenchWindow; + +/** + * Removes all triggerpoints from the source (markers) + */ +public class RemoveAllTriggerpointsAction extends AbstractRemoveAllActionDelegate implements IBreakpointsListener { + + + /* (non-Javadoc) + * @see org.eclipse.debug.internal.ui.actions.selection.AbstractRemoveAllActionDelegate#isEnabled() + */ + @Override + protected boolean isEnabled() { + return DebugPlugin.getDefault().getBreakpointManager().getTriggerBreakpoints().length > 0; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.IBreakpointsListener#breakpointsAdded(org.eclipse.debug.core.model.IBreakpoint[]) + */ + @Override + public void breakpointsAdded(IBreakpoint[] breakpoints) { + update(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.IBreakpointsListener#breakpointsChanged(org.eclipse.debug.core.model.IBreakpoint[], org.eclipse.core.resources.IMarkerDelta[]) + */ + @Override + public void breakpointsChanged(IBreakpoint[] breakpoints, IMarkerDelta[] deltas) { + update(); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.IBreakpointsListener#breakpointsRemoved(org.eclipse.debug.core.model.IBreakpoint[], org.eclipse.core.resources.IMarkerDelta[]) + */ + @Override + public void breakpointsRemoved(IBreakpoint[] breakpoints, IMarkerDelta[] deltas) { + if (getAction() != null) { + update(); + } + } + + /* (non-Javadoc) + * @see org.eclipse.debug.internal.ui.actions.selection.AbstractRemoveAllActionDelegate#initialize() + */ + @Override + protected void initialize() { + DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(this); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose() + */ + @Override + public void dispose() { + DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(this); + super.dispose(); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) + */ + @Override + public void run(IAction action) { + IWorkbenchWindow window= DebugUIPlugin.getActiveWorkbenchWindow(); + if (window == null) { + return; + } + IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore(); + boolean prompt = store.getBoolean(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_TRIGGER_BREAKPOINTS); + boolean proceed = true; + if (prompt) { + MessageDialogWithToggle mdwt = MessageDialogWithToggle.openYesNoQuestion(window.getShell(), ActionMessages.RemoveAllTriggerpointsAction_0, ActionMessages.RemoveAllTriggerpointsAction_1, ActionMessages.RemoveAllBreakpointsAction_3, !prompt, null, null); + if (mdwt.getReturnCode() != IDialogConstants.YES_ID) { + proceed = false; + } else { + store.setValue(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_TRIGGER_BREAKPOINTS, !mdwt.getToggleState()); + } + } + if (proceed) { + new Job(ActionMessages.RemoveAllTriggerpointsAction_1) { + @Override + protected IStatus run(IProgressMonitor monitor) { + try { + DebugPlugin.getDefault().getBreakpointManager().removeAllTriggerpoints(); + } catch (CoreException e) { + DebugUIPlugin.log(e); + return Status.CANCEL_STATUS; + } + return Status.OK_STATUS; + } + }.schedule(); + } + } + +} 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 index b338c0a85..a4289d414 100644 --- 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 @@ -65,6 +65,7 @@ public class DebugPreferencePage extends FieldEditorPreferencePage implements IW 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())); + addField(new BooleanFieldEditor(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_TRIGGER_BREAKPOINTS, DebugPreferencesMessages.DebugPreferencePage_31, SWT.NONE, getFieldEditorParent())); SWTFactory.createHorizontalSpacer(getFieldEditorParent(), 2); ColorFieldEditor mem= new ColorFieldEditor(IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR, DebugPreferencesMessages.DebugPreferencePage_4, getFieldEditorParent()); 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 index d28da94aa..97e7cacec 100644 --- 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 @@ -40,6 +40,7 @@ public class DebugPreferencesMessages extends NLS { public static String DebugPreferencePage_0; public static String DebugPreferencePage_30; + public static String DebugPreferencePage_31; public static String DebugPreferencePage_4; public static String DebugPreferencePage_10; public static String DebugPreferencePage_11; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties index a50e596d6..b4a626577 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties @@ -42,6 +42,7 @@ 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_31=&Prompt for confirmation when removing all triggerpoints DebugPreferencePage_5=Prompt for confirmation when deleting all e&xpressions LaunchingPreferencePage_1=&Build (if required) before launching 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 index ee839409b..c6061e58c 100644 --- 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 @@ -157,6 +157,14 @@ public interface IDebugPreferenceConstants { * @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 to prompt when removing all + * breakpoints. + * + * @since 3.11 + */ + public static final String PREF_PROMPT_REMOVE_ALL_TRIGGER_BREAKPOINTS = IDebugUIConstants.PLUGIN_ID + ".remove_all_trigger_breakpoints_prompt"; //$NON-NLS-1$ /** * stores the boolean preference of whether or not to prompt when removing all of the breakpoints |