Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcvs2svn2006-10-23 14:54:23 +0000
committercvs2svn2006-10-23 14:54:23 +0000
commit0ec684e7d594b913bc4b29f78990efe6771cc0f5 (patch)
tree4c2f4fdf1e2363bfa974ef6112c7f9a100260e4e
parent3bf03713bd2741190ad59af13af26aef453477e2 (diff)
downloadeclipse.platform.debug-0ec684e7d594b913bc4b29f78990efe6771cc0f5.tar.gz
eclipse.platform.debug-0ec684e7d594b913bc4b29f78990efe6771cc0f5.tar.xz
eclipse.platform.debug-0ec684e7d594b913bc4b29f78990efe6771cc0f5.zip
This commit was manufactured by cvs2svn to create branch
'viewer_rework_3_3'. Cherrypick from master 2006-10-23 14:54:22 UTC Darin Wright <darin> 'Bug 157090 should adopt ICU Collator and use new APIs on StructuredViewer': org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchDelegateProxy.java org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsComparator.java
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchDelegateProxy.java79
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsComparator.java134
2 files changed, 213 insertions, 0 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchDelegateProxy.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchDelegateProxy.java
new file mode 100644
index 000000000..2d55b435e
--- /dev/null
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/ILaunchDelegateProxy.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2006 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.core;
+
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
+
+/**
+ * A proxy to a launch configuration delegate. Represents a
+ * launch delegate contributed to the <code>org.eclipse.debug.core.launchDelegates</code>
+ * extension point.
+ *
+ * @since 3.3
+ * <p>
+ * <strong>EXPERIMENTAL</strong>. This interface has been added as
+ * part of a work in progress. There is no guarantee that this API will
+ * remain unchanged during the 3.3 release cycle. Please do not use this API
+ * without consulting with the Platform/Debug team.
+ * </p>
+ */
+public interface ILaunchDelegateProxy {
+
+ /**
+ * Returns this delegate's unique identifier.
+ *
+ * @return launch delegate identifier
+ */
+ public String getId();
+
+ /**
+ * Returns a human readable name for this launch delegate
+ * or <code>null</code> if none.
+ *
+ * @return name or <code>null</code>
+ */
+ public String getName();
+
+ /**
+ * Returns the name of the plug-in that contributed this delegate.
+ *
+ * @return contributor name
+ */
+ public String getContributorName();
+
+ /**
+ * Returns the delegate that performs the actual launch.
+ * Causes the delegate to be instantiated.
+ *
+ * @return launch delegate
+ * @exception CoreException if unable to instantiate the delegate
+ */
+ public ILaunchConfigurationDelegate getDelegate() throws CoreException;
+
+ /**
+ * Returns the launch modes this delegate supports.
+ *
+ * @return launch modes as a set of launch mode identifiers
+ */
+ public Set getModes();
+
+ /**
+ * Returns the launch modes this delegate supports in combination with
+ * its modes specified by <code>getModes()</code>.
+ *
+ * @return launch options as a set of launch mode identifiers
+ */
+ public Set getOptions();
+
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsComparator.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsComparator.java
new file mode 100644
index 000000000..54fbeac34
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsComparator.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * 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.views.breakpoints;
+
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.core.model.ILineBreakpoint;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.jface.viewers.IBasicPropertyConstants;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+/**
+ * @since 3.3
+ */
+public class BreakpointsComparator extends ViewerComparator {
+ /**
+ * @see ViewerSorter#isSorterProperty(Object, String)
+ */
+ public boolean isSorterProperty(Object element,String propertyId) {
+ return propertyId.equals(IBasicPropertyConstants.P_TEXT);
+ }
+
+ /**
+ * Returns a negative, zero, or positive number depending on whether
+ * the first element is less than, equal to, or greater than
+ * the second element.
+ * <p>
+ * Group breakpoints by debug model
+ * within debug model, group breakpoints by type
+ * within type groups, sort by line number (if applicable) and then
+ * alphabetically by label
+ *
+ * @param viewer the viewer
+ * @param e1 the first element
+ * @param e2 the second element
+ * @return a negative number if the first element is less than the
+ * second element; the value <code>0</code> if the first element is
+ * equal to the second element; and a positive number if the first
+ * element is greater than the second element
+ */
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ if (!(e1 instanceof IBreakpoint)) {
+ return super.compare(viewer, e1, e2);
+ }
+
+ IBreakpoint b1= (IBreakpoint)e1;
+ IBreakpoint b2= (IBreakpoint)e2;
+ String modelId1= b1.getModelIdentifier();
+ String modelId2= b2.getModelIdentifier();
+ int result= modelId1.compareTo(modelId2);
+ if (result != 0) {
+ return result;
+ }
+ String type1= ""; //$NON-NLS-1$
+ String type2= ""; //$NON-NLS-1$
+ IMarker marker1= b1.getMarker();
+ if (!marker1.exists()) {
+ return 0;
+ }
+ try {
+ type1= marker1.getType();
+ } catch (CoreException ce) {
+ DebugUIPlugin.log(ce);
+ }
+ try {
+ IMarker marker2= b2.getMarker();
+ if (!marker2.exists()) {
+ return 0;
+ }
+ type2= marker2.getType();
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e);
+ }
+
+ result= type1.compareTo(type2);
+ if (result != 0) {
+ return result;
+ }
+ // model and type are the same
+
+ ILabelProvider lprov = (ILabelProvider) ((StructuredViewer)viewer).getLabelProvider();
+ String name1= lprov.getText(e1);
+ String name2= lprov.getText(e2);
+
+ boolean lineBreakpoint= false;
+ try {
+ lineBreakpoint= marker1.isSubtypeOf(IBreakpoint.LINE_BREAKPOINT_MARKER);
+ } catch (CoreException ce) {
+ }
+ if (lineBreakpoint) {
+ return compareLineBreakpoints(b1, b2, name1,name2);
+ }
+
+ return name1.compareTo(name2);
+ }
+
+ protected int compareLineBreakpoints(IBreakpoint b1, IBreakpoint b2, String name1, String name2) {
+ int colon1= name1.indexOf(':');
+ if (colon1 != -1) {
+ int colon2= name2.indexOf(':');
+ if (colon2 != -1) {
+ String upToColon1= name1.substring(0, colon1);
+ if (name2.startsWith(upToColon1)) {
+ int l1= 0;
+ int l2= 0;
+ try {
+ l1= ((ILineBreakpoint)b1).getLineNumber();
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e);
+ }
+ try {
+ l2= ((ILineBreakpoint)b2).getLineNumber();
+ } catch (CoreException e) {
+ DebugUIPlugin.log(e);
+ }
+ return l1 - l2;
+ }
+ }
+ }
+ return name1.compareTo(name2);
+ }
+ }

Back to the top