diff options
15 files changed, 319 insertions, 12 deletions
diff --git a/org.eclipse.debug.ui/META-INF/MANIFEST.MF b/org.eclipse.debug.ui/META-INF/MANIFEST.MF index 46ccbf586..deafee9ab 100644 --- a/org.eclipse.debug.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.debug.ui/META-INF/MANIFEST.MF @@ -15,6 +15,7 @@ Export-Package: org.eclipse.debug.internal.ui; org.eclipse.debug.examples.mixedmode", org.eclipse.debug.internal.ui.actions;x-internal:=true, org.eclipse.debug.internal.ui.actions.breakpointGroups;x-internal:=true, + org.eclipse.debug.internal.ui.actions.breakpointSortBy;x-internal:=true, org.eclipse.debug.internal.ui.actions.breakpoints;x-internal:=true, org.eclipse.debug.internal.ui.actions.expressions;x-internal:=true, org.eclipse.debug.internal.ui.actions.variables;x-internal:=true, diff --git a/org.eclipse.debug.ui/plugin.properties b/org.eclipse.debug.ui/plugin.properties index 602a2ea78..aeffaf2ea 100644 --- a/org.eclipse.debug.ui/plugin.properties +++ b/org.eclipse.debug.ui/plugin.properties @@ -124,6 +124,8 @@ RunHistoryMenuAction.label=Run His&tory RunWithConfigurationAction.label=Run A&s RunToLine.label=Run to &Line SelectAll.label=Select &All +SortBy.label=Sor&t By +SortBy.tooltip=Sort By StepWithFiltersAction.label=Use Step &Filters StepWithFiltersAction.tooltip=Use Step Filters/Step Debug StepIntoAction.label=Step &Into diff --git a/org.eclipse.debug.ui/plugin.xml b/org.eclipse.debug.ui/plugin.xml index a2e624dc3..cfcd73fe9 100644 --- a/org.eclipse.debug.ui/plugin.xml +++ b/org.eclipse.debug.ui/plugin.xml @@ -853,6 +853,14 @@ label="%GroupBy.label" tooltip="%GroupBy.tooltip"> </action> + <action + id="org.eclipse.debug.ui.breakpointsView.toolbar.sortByAction" + menubarPath="defaultBreakpointGroup" + class="org.eclipse.debug.internal.ui.actions.breakpointSortBy.SortBreakpointsByAction" + helpContextId="sort_breakpoints_by_action_context" + label="%SortBy.label" + tooltip="%SortBy.tooltip"> + </action> </viewContribution> <!-- Contributions to Expression View Toolbar --> <viewContribution 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 cb3242303..2d3a1d4fd 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 @@ -65,6 +65,7 @@ public class DebugUIPreferenceInitializer extends AbstractPreferenceInitializer prefs.setDefault(IInternalDebugUIConstants.PREF_LAUNCH_LAST_IF_NOT_LAUNCHABLE, true); prefs.setDefault(IInternalDebugUIConstants.PREF_TERMINATE_AND_RELAUNCH_LAUNCH_ACTION, false); + prefs.setDefault(IInternalDebugUIConstants.PREF_BREAKPOINT_SORTING_ORDER, IInternalDebugUIConstants.BREAKPOINT_SORTING_ORDER_NAME); //View Management preference page prefs.setDefault(IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES, IDebugUIConstants.PREF_MANAGE_VIEW_PERSPECTIVES_DEFAULT); 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 34ca10529..9ae1f2adc 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 @@ -446,4 +446,25 @@ public interface IInternalDebugUIConstants { */ public static final String PREF_TERMINATE_AND_RELAUNCH_LAUNCH_ACTION = IDebugUIConstants.PLUGIN_ID + ".RelaunchAndTerminateLaunchAction"; //$NON-NLS-1$ + /** + * Int preference indicating the sorting order of breakpoints + * + * @since 3.12 + */ + public static final String PREF_BREAKPOINT_SORTING_ORDER = IDebugUIConstants.PLUGIN_ID + ".BreakpointSortingOrder"; //$NON-NLS-1$ + + /** + * Int indicating the breakpoints will be sorted by name + * + * @since 3.12 + */ + public static final int BREAKPOINT_SORTING_ORDER_NAME = 0; + + /** + * Int indicating the breakpoints will be sorted by Creation Time + * + * @since 3.12 + */ + public static final int BREAKPOINT_SORTING_ORDER_CREATION_TIME = 1; + } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointSortBy/Messages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointSortBy/Messages.java new file mode 100644 index 000000000..529890dad --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointSortBy/Messages.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * 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 - Initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.internal.ui.actions.breakpointSortBy; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.debug.internal.ui.actions.breakpointSortBy.Messages";//$NON-NLS-1$ + + public static String GroupBreakpointsSortByAction_Name; + public static String GroupBreakpointsSortByAction_CreationTime; + static { + // load message values from bundle file + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointSortBy/Messages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointSortBy/Messages.properties new file mode 100644 index 000000000..090ceeacf --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointSortBy/Messages.properties @@ -0,0 +1,13 @@ +############################################################################### +# 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 +############################################################################### + +GroupBreakpointsSortByAction_Name=&Name +GroupBreakpointsSortByAction_CreationTime=&Creation Time diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointSortBy/SortBreakpointsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointSortBy/SortBreakpointsAction.java new file mode 100644 index 000000000..1320f3291 --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointSortBy/SortBreakpointsAction.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * 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 implementation + *******************************************************************************/ +package org.eclipse.debug.internal.ui.actions.breakpointSortBy; + +import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; +import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointUIConstants; +import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; + +/** + * An action which sets the breakpoint sorting order on a breakpoint view, + * effectively telling the view to sort breakpoints according to some sorting + * order + */ +public class SortBreakpointsAction extends Action { + + private BreakpointsView fView; + int actionSort; + + /** + * Creates a new action which will sort breakpoints in the given breakpoint + * view using the given breakpoint container factory + * + * @param factory the factory that will be applied to the given view when + * this action is run + * @param view the breakpoints view + */ + public SortBreakpointsAction(BreakpointsView view, String name, int sortingBy) { + super(name, IAction.AS_RADIO_BUTTON); + if (sortingBy == DebugUIPlugin.getDefault().getPreferenceStore().getInt(IInternalDebugUIConstants.PREF_BREAKPOINT_SORTING_ORDER)) { + this.setChecked(true); + } + actionSort = sortingBy; + fView = view; + } + + /* + * (non-Javadoc) + * @see org.eclipse.jface.action.IAction#run() + */ + @Override + public void run() { + if (isChecked()) { + DebugUIPlugin.getDefault().getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_BREAKPOINT_SORTING_ORDER, actionSort); + } else { + DebugUIPlugin.getDefault().getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_BREAKPOINT_SORTING_ORDER, actionSort); + } + // update the presentation context element comparator sorting order + fView.getTreeModelViewer().getPresentationContext().setProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_ELEMENT_COMPARATOR_SORT, new Integer(actionSort)); + } + +} + diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointSortBy/SortBreakpointsByAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointSortBy/SortBreakpointsByAction.java new file mode 100644 index 000000000..6e80676cb --- /dev/null +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointSortBy/SortBreakpointsByAction.java @@ -0,0 +1,107 @@ +/******************************************************************************* + * 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 implementation + * Patrick Chuong (Texas Instruments) - Improve usability of the breakpoint view (Bug 238956) + *******************************************************************************/ +package org.eclipse.debug.internal.ui.actions.breakpointSortBy; + +import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; +import org.eclipse.debug.internal.ui.actions.breakpointGroups.AbstractBreakpointsViewAction; +import org.eclipse.jface.action.ActionContributionItem; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.IMenuCreator; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.events.MenuAdapter; +import org.eclipse.swt.events.MenuEvent; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; + +/** + * + */ +public class SortBreakpointsByAction extends AbstractBreakpointsViewAction implements IMenuCreator { + + private IAction fAction= null; + + public SortBreakpointsByAction() { + } + + /* (non-Javadoc) + * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) + */ + @Override + public void run(IAction action) { + } + + /* (non-Javadoc) + * @see org.eclipse.jface.action.IMenuCreator#dispose() + */ + @Override + public void dispose() { + } + + /* (non-Javadoc) + * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control) + */ + @Override + public Menu getMenu(Control parent) { + // Never called + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu) + */ + @Override + public Menu getMenu(Menu parent) { + Menu menu = new Menu(parent); + menu.addMenuListener(new MenuAdapter() { + @Override + public void menuShown(MenuEvent e) { + Menu m = (Menu)e.widget; + MenuItem[] items = m.getItems(); + for (int i=0; i < items.length; i++) { + items[i].dispose(); + } + fillMenu(m); + } + }); + return menu; + } + + /** + * Fill pull down menu with the "group by" options + */ + private void fillMenu(Menu menu) { + + // Add hard-coded sorting order by Name + IAction action = new SortBreakpointsAction(fView, Messages.GroupBreakpointsSortByAction_Name, IInternalDebugUIConstants.BREAKPOINT_SORTING_ORDER_NAME); + ActionContributionItem item = new ActionContributionItem(action); + item.fill(menu, 0); + + // Add hard-coded sorting order by Creation Time + action = new SortBreakpointsAction(fView, Messages.GroupBreakpointsSortByAction_CreationTime, IInternalDebugUIConstants.BREAKPOINT_SORTING_ORDER_CREATION_TIME); + item = new ActionContributionItem(action); + item.fill(menu, 1); + + } + + + /* (non-Javadoc) + * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) + */ + @Override + public void selectionChanged(IAction action, ISelection selection) { + if (action != fAction) { + action.setMenuCreator(this); + fAction= action; + } + } +} diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointUIConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointUIConstants.java index ad55c0751..e1d077fac 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointUIConstants.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/breakpoints/provisional/IBreakpointUIConstants.java @@ -60,4 +60,6 @@ public interface IBreakpointUIConstants { */ public static final String PROP_BREAKPOINTS_ELEMENT_COMPARATOR = "ElementComparator"; //$NON-NLS-1$ + public static final String PROP_BREAKPOINTS_ELEMENT_COMPARATOR_SORT = "ElementComparatorSort"; //$NON-NLS-1$ + } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java index 0fc5d434b..2d89a4654 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointManagerContentProvider.java @@ -275,6 +275,37 @@ public class BreakpointManagerContentProvider extends ElementContentProvider } } + void sortContainers() { + IBreakpoint[] breakpoints = filterBreakpoints(fInput, getSelectionFilter(fInput, getDebugContext()), fBpManager.getBreakpoints()); + + synchronized (this) { + ModelDelta delta = new ModelDelta(fInput, IModelDelta.NO_CHANGE); + // create a reference container, use for deleting elements and + // adding elements + ModelDelta dummyDelta = new ModelDelta(null, IModelDelta.NO_CHANGE); + BreakpointContainer refContainer = createRootContainer(dummyDelta, fInput, fOrganizers, breakpoints); + + // delete all elements + deleteAllElements(fContainer, delta); + + // adjust the old organizer with the reference organizer + BreakpointContainer.copyOrganizers(fContainer, refContainer); + + // insert all elements + IBreakpoint newBreakpoint = insertAddedElements(fContainer, refContainer, delta); + delta.setChildCount(fContainer.getChildren().length); + + // select the new breakpoint + if (newBreakpoint != null) { + appendModelDeltaToElement(delta, newBreakpoint, IModelDelta.SELECT); + } + if (DebugUIPlugin.DEBUG_BREAKPOINT_DELTAS) { + DebugUIPlugin.trace("POST BREAKPOINT DELTA (setOrganizers)\n"); //$NON-NLS-1$ + } + postModelChanged(delta, false); + } + } + private synchronized IStructuredSelection getDebugContext() { return fDebugContext; } @@ -285,7 +316,9 @@ public class BreakpointManagerContentProvider extends ElementContentProvider * @param event the event */ private void presentationPropertyChanged(PropertyChangeEvent event) { - if (IPresentationContext.PROPERTY_DISPOSED.equals(event.getProperty())) { + if (IBreakpointUIConstants.PROP_BREAKPOINTS_ELEMENT_COMPARATOR_SORT.equals(event.getProperty())) { + sortContainers(); + } else if (IPresentationContext.PROPERTY_DISPOSED.equals(event.getProperty())) { contextDisposed(fInput.getContext()); } if (IBreakpointUIConstants.PROP_BREAKPOINTS_ORGANIZERS.equals(event.getProperty())) { @@ -608,7 +641,7 @@ public class BreakpointManagerContentProvider extends ElementContentProvider // if a child exist in container, than recursively search into container. And also update the organizer of // of container to the one in the refContainer's child. } else if (element instanceof BreakpointContainer) { - ModelDelta childDelta = containerDelta.addNode(element, container.getChildIndex(element), IModelDelta.STATE, -1); + ModelDelta childDelta = containerDelta.addNode(element, container.getChildIndex(element), IModelDelta.INSTALL, -1); BreakpointContainer.copyOrganizers((BreakpointContainer) element, (BreakpointContainer) refChildren[i]); newBreakpoint = insertAddedElements((BreakpointContainer) element, (BreakpointContainer) refChildren[i], childDelta); childDelta.setChildCount(((BreakpointContainer) element).getChildren().length); @@ -618,6 +651,8 @@ public class BreakpointManagerContentProvider extends ElementContentProvider return newBreakpoint; } + + /** * Delete elements from existing container that doesn't exist in the reference container. * @@ -647,6 +682,21 @@ public class BreakpointManagerContentProvider extends ElementContentProvider } } + private void deleteAllElements(BreakpointContainer container, ModelDelta containerDelta) { + Object[] children = container.getChildren(); + // Object[] refChildren = refContainer.getChildren(); + + // if a child of container doesn't exist in refContainer, than + // remove it from container + for (int i = 0; i < children.length; ++i) { + if (children[i] instanceof BreakpointContainer) { + BreakpointContainer.removeAll((BreakpointContainer) children[i], containerDelta); + } else { + BreakpointContainer.removeBreakpoint(container, (IBreakpoint) children[i], containerDelta); + } + } + } + /** * Get the element that is in the collection. * diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java index b6cfeb3c2..565ff4855 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointContainer.java @@ -20,7 +20,6 @@ import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.Platform; - import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer; import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointOrganizer; @@ -30,7 +29,6 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta; import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate; import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta; - import org.eclipse.debug.ui.IDebugUIConstants; /** @@ -293,7 +291,7 @@ public class BreakpointContainer extends ElementContentProvider implements IAdap childDelta = rootDelta.addNode(container, fChildContainers.indexOf(container), IModelDelta.INSERTED|IModelDelta.INSTALL, -1); } else { - childDelta = rootDelta.addNode(container, fChildContainers.indexOf(container), IModelDelta.STATE, -1); + childDelta = rootDelta.addNode(container, fChildContainers.indexOf(container), IModelDelta.STATE, -1); } container.addBreakpoint(breakpoint, childDelta); @@ -362,7 +360,7 @@ public class BreakpointContainer extends ElementContentProvider implements IAdap public static void copyOrganizers(BreakpointContainer destContainer, BreakpointContainer sourceContainer) { destContainer.fNesting = sourceContainer.fNesting; destContainer.fOrganizer = sourceContainer.fOrganizer; - destContainer.fCategory = sourceContainer.fCategory; + destContainer.fCategory = sourceContainer.fCategory; } /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java index e29b2aaef..368ae3243 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java @@ -505,6 +505,7 @@ public class BreakpointsView extends VariablesView implements IBreakpointManager // update the presentation context organizer viewer.getPresentationContext().setProperty(IBreakpointUIConstants.PROP_BREAKPOINTS_ORGANIZERS, fOrganizers); } + System.out.println(); } /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ElementComparator.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ElementComparator.java index ab81f41b1..8537258b4 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ElementComparator.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ElementComparator.java @@ -1,5 +1,5 @@ /***************************************************************** - * Copyright (c) 2009, 2013 Texas Instruments and others + * Copyright (c) 2009, 2016 Texas Instruments 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 @@ -21,6 +21,7 @@ import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.ILineBreakpoint; import org.eclipse.debug.internal.core.IInternalDebugCoreConstants; import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; import org.eclipse.debug.internal.ui.breakpoints.provisional.IBreakpointContainer; import org.eclipse.debug.internal.ui.breakpoints.provisional.OtherBreakpointCategory; import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext; @@ -97,14 +98,31 @@ public class ElementComparator implements Comparator<Object> { * @return */ private int doCompare(IBreakpoint b1, IBreakpoint b2) { + int sortingOrder = DebugUIPlugin.getDefault().getPreferenceStore().getInt(IInternalDebugUIConstants.PREF_BREAKPOINT_SORTING_ORDER); + IMarker marker1 = b1.getMarker(); + IMarker marker2 = b2.getMarker(); + if (sortingOrder == IInternalDebugUIConstants.BREAKPOINT_SORTING_ORDER_CREATION_TIME) { + // The most relevant/ new ones to be shown on top + try { + long b1CreationTime = marker1.getCreationTime(); + long b2CreationTime = marker2.getCreationTime(); + if (b1CreationTime > b2CreationTime) { + return -1; + } else if (b1CreationTime < b2CreationTime) { + return 1; + } + } catch (CoreException e) { + e.printStackTrace(); + } + + } String text1 = IInternalDebugCoreConstants.EMPTY_STRING; String text2 = IInternalDebugCoreConstants.EMPTY_STRING; text1 += b1.getModelIdentifier(); text2 += b2.getModelIdentifier(); - IMarker marker1 = b1.getMarker(); - IMarker marker2 = b2.getMarker(); + try { if (marker1.exists() && marker2.exists()) { text1 += SPACE + marker1.getType(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java index d0158505c..928c937be 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementAdapterFactory.java @@ -14,7 +14,6 @@ package org.eclipse.debug.internal.ui.views.launch; import org.eclipse.core.runtime.IAdapterFactory; - import org.eclipse.debug.core.IExpressionManager; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchManager; @@ -86,7 +85,6 @@ import org.eclipse.debug.internal.ui.viewers.provisional.IAsynchronousLabelAdapt import org.eclipse.debug.internal.ui.viewers.update.DefaultModelProxyFactory; import org.eclipse.debug.internal.ui.viewers.update.DefaultModelSelectionPolicyFactory; import org.eclipse.debug.internal.ui.views.memory.renderings.MemorySegment; - import org.eclipse.debug.ui.sourcelookup.ISourceDisplay; /** @@ -128,7 +126,7 @@ public class DebugElementAdapterFactory implements IAdapterFactory { private static IElementContentProvider fgCPMemoryRetrieval = new MemoryRetrievalContentProvider(); private static IElementContentProvider fgCPMemoryBlock = new MemoryBlockContentProvider(); private static IElementContentProvider fgCPBreakpointManager = new BreakpointManagerContentProvider(); - private static IElementContentProvider fgCPBreakpoint = new BreakpointContentProvider(); + private static IElementContentProvider fgCPBreakpoint = new BreakpointContentProvider(); private static IElementMementoProvider fgMPFrame = new StackFrameMementoProvider(); private static IElementMementoProvider fgMPVariable = new VariableMementoProvider(); |