Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2006-11-09 16:31:12 -0500
committerDarin Wright2006-11-09 16:31:12 -0500
commit0d3cdd95e96b63b7629dcc68ddeadfe2d90cdcfb (patch)
tree163d2abc21e531cfb67957cd8939db3524e99f6d
parentc09eecb47bd1bb8dbb212f912d794087c30d5739 (diff)
downloadeclipse.platform.debug-viewer_rework_3_3.tar.gz
eclipse.platform.debug-viewer_rework_3_3.tar.xz
eclipse.platform.debug-viewer_rework_3_3.zip
merge with HEADviewer_rework_3_3
-rw-r--r--org.eclipse.debug.core/buildnotes_platform-debug.html10
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java23
-rw-r--r--org.eclipse.debug.core/schema/launchConfigurationTypes.exsd32
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java65
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SelectBreakpointWorkingsetDialog.java8
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java13
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java91
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java131
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/PerspectivePreferencePage.java10
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java36
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetCache.java24
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java56
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java31
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsView.java387
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java188
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/MaxDetailsLengthDialog.java2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java53
17 files changed, 497 insertions, 663 deletions
diff --git a/org.eclipse.debug.core/buildnotes_platform-debug.html b/org.eclipse.debug.core/buildnotes_platform-debug.html
index 933c7988f..6f243f016 100644
--- a/org.eclipse.debug.core/buildnotes_platform-debug.html
+++ b/org.eclipse.debug.core/buildnotes_platform-debug.html
@@ -187,8 +187,18 @@ The launch framework has been enhanced to support the following:
based on the selected variables.</li>
</ul>
+
+<h2>Nov 14, 2006</h2>
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=153461">153461</a>: DnD slow in breakpoints view.<br>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=163684">163684</a>: [variables view] Max details pane text length dialog does nothing<br>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=163400">163400</a>: fileExtension is deprecated but doesn't offer alternatives in schema description<br>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=163961">163961</a>: Schema description for launchConfigurationTypes outdated<br>
+
<h2>3.3 Milestone 3 - Nov 3, 2006</h2>
<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=159200">159200</a>: Step action should not automatically disable after the action is invoked.<br>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=162802">162802</a>: [launching] launch manager causes exception persisting preferred delegates<br>
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=162667">162667</a>: Javadoc warnings in N20061028-0010<br>
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=162816">162816</a>: [commands] StepFilterCommand can lead to NPE<br>
<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=162320">162320</a>: Toggle step filters action does not initialize state properly<br>
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
index 2105d81b8..3815db496 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
@@ -802,17 +802,34 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
value += line;
}
}
+ line = reader.readLine();
}
else {
int separator = line.indexOf('=');
if (separator > 0) {
key = line.substring(0, separator);
value = line.substring(separator + 1);
-
+ line = reader.readLine();
+ if(line != null) {
+ //this line has a '=' read ahead to check next line for '=', might be broken on more than one line
+ separator = line.indexOf('=');
+ while(separator < 0) {
+ value += line.trim();
+ line = reader.readLine();
+ if(line == null) {
+ //if next line read is the end of the file quit the loop
+ break;
+ }
+ separator = line.indexOf('=');
+ }
+ }
}
}
- cache.put(key, value);
- line = reader.readLine();
+ if(key != null) {
+ cache.put(key, value);
+ key = null;
+ value = null;
+ }
}
reader.close();
}
diff --git a/org.eclipse.debug.core/schema/launchConfigurationTypes.exsd b/org.eclipse.debug.core/schema/launchConfigurationTypes.exsd
index d96ad8e29..45dba14e5 100644
--- a/org.eclipse.debug.core/schema/launchConfigurationTypes.exsd
+++ b/org.eclipse.debug.core/schema/launchConfigurationTypes.exsd
@@ -123,7 +123,7 @@ With new API changes for 3.3M3 the sourceLocatorId id should be contributed via
<attribute name="migrationDelegate" type="string">
<annotation>
<documentation>
- Optional delegate used to migrate launch configurations of this type to be compatible with current tooling, since 3.2
+ specifies the fully qualified name of a Java class that implements &lt;code&gt;org.eclipse.debug.core.ILaunchConfigurationMigrationDelegate&lt;/code&gt;. Optional delegate used to migrate launch configurations of this type to be compatible with current tooling, since 3.2
</documentation>
<appInfo>
<meta.attribute kind="java" basedOn="org.eclipse.debug.core.ILaunchConfigurationMigrationDelegate"/>
@@ -168,6 +168,13 @@ without consulting with the Platform/Debug team.
</appInfo>
</annotation>
</attribute>
+ <attribute name="delegateDescription" type="string">
+ <annotation>
+ <documentation>
+ This attribute provides a description of the associated launch delegate i.e. what it does and what tooling it is assciated with. This attribute was added in the 3.3 release. EXPERIMENTAL.
+ </documentation>
+ </annotation>
+ </attribute>
</complexType>
</element>
@@ -203,7 +210,9 @@ without consulting with the Platform/Debug team.
<meta.section type="examples"/>
</appInfo>
<documentation>
- The following is an example of a launch configuration type extension point:
+ &lt;p&gt;
+The following is an example of a launch configuration type extension point:
+&lt;/p&gt;
&lt;p&gt;
&lt;pre&gt;
@@ -213,16 +222,20 @@ without consulting with the Platform/Debug team.
delegate=&quot;com.example.ExampleLaunchConfigurationDelegate&quot;
modes=&quot;run,debug&quot;
name=&quot;Example Application&quot;
- delegateName=&quot;Example Application Launch Tooling&quot;&gt;
- &lt;fileExtension extension=&quot;txt&quot; default=&quot;true&quot;/&gt;
- &lt;fileExtension extension=&quot;gif&quot; default=&quot;false&quot;/&gt;
+ migrationDelegate=&quot;com.example.migrationDelegate&quot;
+ sourceLocatorId=&quot;com.example.sourceLookupDirector&quot;
+ sourcePathComputerId=&quot;com.example.sourcePathComputer&quot;
+ delegateName=&quot;Example Application Launch Tooling&quot;
+ delegateDescription=&quot;This example tooling will run or debug example code.&quot;&gt;
&lt;/launchConfigurationType&gt;
&lt;/extension&gt;
&lt;/pre&gt;
&lt;/p&gt;
+&lt;p&gt;
In the example above, the specified type of launch configuration supports both run and debug modes.
-The launch configuration is applicable to .txt and .gif files, and is the default launch configuration for .txt files.
+The specified type also has an associated migration delegate, a source locator id, a source path computer, and launch delegate name and description.
+&lt;/p&gt;
</documentation>
</annotation>
@@ -231,7 +244,12 @@ The launch configuration is applicable to .txt and .gif files, and is the defaul
<meta.section type="apiInfo"/>
</appInfo>
<documentation>
- Value of the attribute &lt;b&gt;delegate&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;b&gt;org.eclipse.debug.core.model.ILaunchConfigurationDelegate&lt;/b&gt;.
+ &lt;p&gt;
+Value of the attribute &lt;b&gt;delegate&lt;/b&gt; must be a fully qualified name of a Java class that implements the interface &lt;code&gt;org.eclipse.debug.core.model.ILaunchConfigurationDelegate&lt;/code&gt;.
+&lt;/p&gt;
+&lt;p&gt;
+The value of the attribute &lt;b&gt;migrationDelegate&lt;/b&gt; must be a fully qualified name of a Java class that implements &lt;code&gt;org.eclipse.debug.core.ILaunchConfigurationMigrationDelegate&lt;/code&gt;.
+&lt;/p&gt;
</documentation>
</annotation>
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java
index a9377fd7c..57d62fba6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/RemoveFromWorkingSetAction.java
@@ -10,20 +10,19 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.actions.breakpointGroups;
-import java.util.Iterator;
-
import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointContainer;
import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsView;
-import org.eclipse.debug.internal.ui.views.breakpoints.WorkingSetCategory;
+import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsViewer;
+import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Item;
/**
* Removes a breakpoint from a breakpoint working set.
*/
public class RemoveFromWorkingSetAction extends BreakpointSelectionAction {
-
+
/**
* Constructs action to remove breakpoints from a category.
*
@@ -37,19 +36,18 @@ public class RemoveFromWorkingSetAction extends BreakpointSelectionAction {
* @see org.eclipse.jface.action.IAction#run()
*/
public void run() {
- Iterator iterator = getStructuredSelection().iterator();
- while (iterator.hasNext()) {
- Object object = iterator.next();
- if (object instanceof IBreakpoint) {
- IBreakpoint breakpoint = (IBreakpoint) object;
- BreakpointContainer[] containers = getBreakpointsView().getMovedFromContainers(breakpoint);
- if (containers != null) {
- for (int i = 0; i < containers.length; i++) {
- BreakpointContainer container = containers[i];
- container.getOrganizer().removeBreakpoint(breakpoint, container.getCategory());
- }
- }
- }
+ BreakpointsViewer viewer = (BreakpointsViewer) getBreakpointsView().getViewer();
+ Item[] items = viewer.getSelectedItems();
+ IBreakpoint breakpoint = null;
+ BreakpointContainer container = null;
+ for(int i = 0; i < items.length; i++) {
+ if(items[i].getData() instanceof IBreakpoint) {
+ breakpoint = (IBreakpoint) items[i].getData();
+ container = viewer.getRemovableContainer(items[i]);
+ if(container != null) {
+ container.getOrganizer().removeBreakpoint(breakpoint, container.getCategory());
+ }
+ }
}
}
@@ -57,33 +55,10 @@ public class RemoveFromWorkingSetAction extends BreakpointSelectionAction {
* @see org.eclipse.ui.actions.BaseSelectionListenerAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
*/
protected boolean updateSelection(IStructuredSelection selection) {
- if (selection.isEmpty() || !getBreakpointsView().isShowingGroups()) {
- return false;
- }
- Iterator iterator = selection.iterator();
- while (iterator.hasNext()) {
- Object object = iterator.next();
- if (object instanceof IBreakpoint) {
- IBreakpoint breakpoint = (IBreakpoint) object;
- BreakpointContainer[] containers = getBreakpointsView().getMovedFromContainers(breakpoint);
- if (containers == null || containers.length == 0) {
- return false;
- }
- for (int i = 0; i < containers.length; i++) {
- BreakpointContainer container = containers[i];
- if (container.getCategory() instanceof WorkingSetCategory) {
- WorkingSetCategory category = (WorkingSetCategory) container.getCategory();
- if (!IInternalDebugUIConstants.ID_BREAKPOINT_WORKINGSET.equals(category.getWorkingSet().getId())) {
- return false;
- }
- } else {
- return false;
- }
- }
- } else {
- return false;
- }
+ Object element = selection.getFirstElement();
+ if(element instanceof BreakpointContainer) {
+ return ((BreakpointContainer) element).getCategory().equals(IDebugUIConstants.BREAKPOINT_WORKINGSET_ID);
}
- return true;
+ return false;
}
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SelectBreakpointWorkingsetDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SelectBreakpointWorkingsetDialog.java
index 5138a2e34..ac1bb7a93 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SelectBreakpointWorkingsetDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpointGroups/SelectBreakpointWorkingsetDialog.java
@@ -98,12 +98,16 @@ public class SelectBreakpointWorkingsetDialog extends SelectionDialog {
fViewer.setContentProvider(new WorkingsetContent());
fViewer.setInput(new AdaptableList(PlatformUI.getWorkbench().getWorkingSetManager().getAllWorkingSets()));
fViewer.setLabelProvider(DebugUITools.newDebugModelPresentation());
- fViewer.setChecked(fInitialSelection, true);
+ if(fInitialSelection != null) {
+ fViewer.setChecked(fInitialSelection, true);
+ }
fViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
Object o = event.getElement();
fViewer.setAllChecked(false);
- fViewer.setChecked(o, true);
+ if(o != null) {
+ fViewer.setChecked(o, true);
+ }
}
});
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java
index 65e6aed6f..b8ece86ff 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/RemoveBreakpointAction.java
@@ -13,7 +13,6 @@ package org.eclipse.debug.internal.ui.actions.breakpoints;
import java.util.ArrayList;
import java.util.Iterator;
-import java.util.List;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -51,7 +50,6 @@ public class RemoveBreakpointAction extends AbstractRemoveActionDelegate {
if (selection.isEmpty()) {
return;
}
- final List state = ((BreakpointsView)getView()).getSelectionState();
final Iterator itr= selection.iterator();
final CoreException[] exception= new CoreException[1];
IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
@@ -118,6 +116,9 @@ public class RemoveBreakpointAction extends AbstractRemoveActionDelegate {
}
final IBreakpoint[] breakpoints = (IBreakpoint[]) breakpointsToDelete.toArray(new IBreakpoint[0]);
final IWorkingSet[] sets = (IWorkingSet[])groupsToDelete.toArray(new IWorkingSet[groupsToDelete.size()]);
+ if(breakpoints.length > 0) {
+ ((BreakpointsView)getView()).preserveSelection(getSelection());
+ }
new Job(ActionMessages.RemoveBreakpointAction_2) {
protected IStatus run(IProgressMonitor pmonitor) {
try {
@@ -125,14 +126,6 @@ public class RemoveBreakpointAction extends AbstractRemoveActionDelegate {
for (int i = 0; i < sets.length; i++) {
PlatformUI.getWorkbench().getWorkingSetManager().removeWorkingSet(sets[i]);
}
- if (state != null) {
- Runnable r = new Runnable() {
- public void run() {
- ((BreakpointsView) getView()).preserveSelectionState(state);
- }
- };
- DebugUIPlugin.getStandardDisplay().asyncExec(r);
- }
return Status.OK_STATUS;
} catch (CoreException e) {
DebugUIPlugin.log(e);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java
index 9805edf93..8e8ed6432 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java
@@ -11,7 +11,6 @@
package org.eclipse.debug.internal.ui.launchConfigurations;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -21,7 +20,6 @@ import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
import org.eclipse.debug.ui.AbstractDebugView;
-import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.IDebugView;
import org.eclipse.help.HelpSystem;
@@ -30,7 +28,6 @@ import org.eclipse.help.IContextProvider;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
@@ -38,8 +35,6 @@ import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.HelpEvent;
-import org.eclipse.swt.events.HelpListener;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.widgets.Composite;
@@ -47,9 +42,7 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.FilteredTree;
import org.eclipse.ui.dialogs.PatternFilter;
-import org.eclipse.ui.model.WorkbenchViewerComparator;
/**
* A tree view of launch configurations
@@ -57,16 +50,11 @@ import org.eclipse.ui.model.WorkbenchViewerComparator;
public class LaunchConfigurationView extends AbstractDebugView implements ILaunchConfigurationListener {
/**
- * the viewer from the view
- */
- private Viewer fViewer;
-
- /**
* the filtering tree viewer
*
* @since 3.2
*/
- private FilteredTree fTree;
+ private LaunchConfigurationFilteredTree fTree;
/**
* a handle to the launch manager
@@ -132,41 +120,10 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
* @see org.eclipse.debug.ui.AbstractDebugView#createViewer(org.eclipse.swt.widgets.Composite)
*/
protected Viewer createViewer(Composite parent) {
- fTree = new FilteredTree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, new PatternFilter());
- fTree.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
- TreeViewer treeViewer = fTree.getViewer();
- treeViewer.setLabelProvider(DebugUITools.newDebugModelPresentation());
- treeViewer.setComparator(new WorkbenchViewerComparator());
- treeViewer.setContentProvider(new LaunchConfigurationTreeContentProvider(fLaunchGroup.getMode(), parent.getShell()));
- if(fFilters != null) {
- for (int i = 0; i < fFilters.length; i++) {
- treeViewer.addFilter(fFilters[i]);
- }
- }
- treeViewer.addFilter(new LaunchGroupFilter(getLaunchGroup()));
- treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot());
- treeViewer.getControl().addHelpListener(new HelpListener() {
- public void helpRequested(HelpEvent evt) {
- handleHelpRequest(evt);
- }
- });
+ fTree = new LaunchConfigurationFilteredTree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, new PatternFilter(), fLaunchGroup, fFilters);
+ fTree.createViewControl();
getLaunchManager().addLaunchConfigurationListener(this);
- return treeViewer;
- }
-
- /**
- * Handle help events locally rather than deferring to WorkbenchHelp. This
- * allows help specific to the selected config type to be presented.
- *
- * @since 2.1
- */
- protected void handleHelpRequest(HelpEvent evt) {
- if (getTreeViewer().getTree() != evt.getSource()) {
- return;
- }
- String id = computeContextId();
- if (id!=null)
- PlatformUI.getWorkbench().getHelpSystem().displayHelp(id);
+ return fTree.getLaunchConfigurationViewer();
}
/*
@@ -181,7 +138,7 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
}
public IContext getContext(Object target) {
- String id = computeContextId();
+ String id = fTree.computeContextId();
if (id!=null)
return HelpSystem.getContext(id);
return null;
@@ -204,35 +161,6 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
public Text getFilteringTextControl() {
return fTree.getFilterControl();
}
-
- /**
- * Computes the context id for this viewer
- * @return the context id
- */
- private String computeContextId() {
- try {
- ISelection selection = getViewer().getSelection();
- if (!selection.isEmpty() && selection instanceof IStructuredSelection ) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- Object firstSelected = structuredSelection.getFirstElement();
- ILaunchConfigurationType configType = null;
- if (firstSelected instanceof ILaunchConfigurationType) {
- configType = (ILaunchConfigurationType) firstSelected;
- }
- else if (firstSelected instanceof ILaunchConfiguration) {
- configType = ((ILaunchConfiguration) firstSelected).getType();
- }
- if (configType != null) {
- String helpContextId = LaunchConfigurationPresentationManager.getDefault().getHelpContext(configType, getLaunchGroup().getMode());
- if (helpContextId != null) {
- return helpContextId;
- }
- }
- }
- }
- catch (CoreException ce) {DebugUIPlugin.log(ce);}
- return null;
- }
/**
* @see org.eclipse.debug.ui.AbstractDebugView#createActions()
@@ -275,8 +203,7 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
/**
* @see org.eclipse.debug.ui.AbstractDebugView#configureToolBar(org.eclipse.jface.action.IToolBarManager)
*/
- protected void configureToolBar(IToolBarManager tbm) {
- }
+ protected void configureToolBar(IToolBarManager tbm) {}
/**
* Returns this view's tree viewer
@@ -284,7 +211,7 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
* @return this view's tree viewer
*/
protected TreeViewer getTreeViewer() {
- return (TreeViewer)getViewer();
+ return fTree.getLaunchConfigurationViewer();
}
/**
@@ -432,7 +359,7 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
* usual initialzation (toolbars, etc).
*/
public void createLaunchDialogControl(Composite parent) {
- fViewer = createViewer(parent);
+ createViewer(parent);
createActions();
createContextMenu(getViewer().getControl());
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, getHelpContextId());
@@ -450,7 +377,7 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc
* @see org.eclipse.debug.ui.IDebugView#getViewer()
*/
public Viewer getViewer() {
- return fViewer;
+ return fTree.getLaunchConfigurationViewer();
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
index 2417fb4b2..08f35bfc9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java
@@ -59,8 +59,6 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
@@ -80,7 +78,6 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.WorkbenchJob;
@@ -125,7 +122,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
* Constant specifying how tall this dialog is allowed to get (as a percentage of
* total available screen height) as a result of preferred tab size.
*/
- protected static final float MAX_DIALOG_HEIGHT_PERCENT = 0.56f;
+ protected static final float MAX_DIALOG_HEIGHT_PERCENT = 0.60f;
/**
* Size of this dialog if there is no preference specifying a size.
*/
@@ -1458,16 +1455,6 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
WorkbenchJob job = new WorkbenchJob(EMPTY_STRING) {
public IStatus runInUIThread(IProgressMonitor monitor) {
TreeViewer viewer = fLaunchConfigurationView.getTreeViewer();
- TreeSelection sel = (TreeSelection)viewer.getSelection();
- TreePath path = null;
- int pidx = -1, cidx = -1;
- if(!sel.isEmpty()) {
- path = sel.getPaths()[0];
- pidx = findIndexOfParent(path.getFirstSegment());
- if(path.getSegmentCount() == 2) {
- cidx = findIndexOfChild(pidx, path.getLastSegment());
- }
- }
boolean newvalue = Boolean.valueOf(event.getNewValue().toString()).booleanValue();
if(event.getProperty().equals(IInternalDebugUIConstants.PREF_FILTER_LAUNCH_CLOSED)) {
updateFilter(newvalue, fClosedProjectFilter);
@@ -1483,17 +1470,12 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
}
else if(event.getProperty().equals(IInternalDebugUIConstants.PREF_FILTER_TYPE_LIST)) {
if(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_FILTER_LAUNCH_TYPES)) {
- viewer.removeFilter(fLCTFilter);
- viewer.addFilter(fLCTFilter);
+ viewer.refresh();
}
}
- if(viewer.getSelection().isEmpty()) {
- updateSelection(path, pidx, cidx);
- }
return Status.OK_STATUS;
}
};
-
job.runInUIThread(new NullProgressMonitor());
}
@@ -1511,113 +1493,4 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun
viewer.removeFilter(filter);
}
}
-
- /**
- * updates the selection after a filtering has taken place
- * @param path the <code>TreePath</code> to the last selected item
- * @param pidx the original index of the parent item
- * @param cidx the original index of the child item
- * @since 3.2
- */
- private void updateSelection(TreePath path, int pidx, int cidx) {
- TreeViewer viewer = fLaunchConfigurationView.getTreeViewer();
- Tree tree = viewer.getTree();
- int pcount = tree.getItemCount();
- if(tree.getItemCount() == 0) {
- setErrorMessage(null);
- setMessage(LaunchConfigurationsMessages.LaunchConfigurationsDialog_7);
- updateButtons();
- }
- else if(path != null) {
- Object sel = path.getLastSegment();
- int pidex = findIndexOfParent(path.getFirstSegment());
- if(path.getSegmentCount() == 1) {
- if(pidex == -1) {
- if(pidx > pcount) {
- pidx = pcount-1;
- }
- sel = (pidx == 0 ? tree.getItem(pidx).getData() : tree.getItem(pidx-1).getData());
- }
- else {
- sel = tree.getItem(pidex).getData();
- }
- }
- else {
- if(pidex == -1) {
- if(pidx > pcount) {
- pidx = pcount-1;
- }
- sel = (pidx == 0 ? tree.getItem(pidx).getData() : tree.getItem(pidx-1).getData());
- }
- else {
- int cidex = findIndexOfChild(findIndexOfParent(path.getFirstSegment()), path.getLastSegment());
- TreeItem parent = tree.getItem(pidex);
- int ccount = parent.getItemCount();
- if(cidex == -1) {
- if(parent.getItemCount() == 0) {
- sel = parent.getData();
- }
- else {
- if(cidx > ccount) {
- cidx = ccount-1;
- }
- sel = (cidx == 0 ? parent.getItem(cidx).getData() : parent.getItem(cidx-1).getData());
- }
- }
- else {
- sel = parent.getItem(cidex).getData();
- }
- }
- }
- viewer.setSelection(new StructuredSelection(sel));
- updateButtons();
- updateMessage();
- }
- else {
- setErrorMessage(null);
- setMessage(LaunchConfigurationsMessages.LaunchConfigurationDialog_Ready_to_launch_2);
- }
- }
-
- /**
- * finds the given parent item in the viewer, in this case the parent item will always be an
- * <code>ILaunchConfigurationType</code>
- * @param parent the parent item to find
- * @return the index of the parent item or -1 if not found
- * @since 3.2
- */
- private int findIndexOfParent(Object parent) {
- Tree tree = fLaunchConfigurationView.getTreeViewer().getTree();
- TreeItem[] roots = tree.getItems();
- for(int i = 0; i < roots.length; i++) {
- if(roots[i].getData().equals(parent)) {
- return i;
- }
- }
- return -1;
- }
-
- /**
- * Finds the index of a child item in the entire tree using the parent node and the child node
- * derived from a <code>TreePath</code>
- * @param parent the parent, in this case always an <code>ILaunchConfigurationType</code>
- * @param child the child to find within the parent, in this case always an <code>ILaunchConfiguration,</code>
- * @return the index of the child or -1 if not found
- * @since 3.2
- */
- private int findIndexOfChild(int pidx, Object child) {
- Tree tree = fLaunchConfigurationView.getTreeViewer().getTree();
- if(pidx != -1) {
- TreeItem root = tree.getItem(pidx);
- TreeItem[] children = root.getItems();
- Object data = null;
- for(int j = 0; j < children.length; j++) {
- data = children[j].getData();
- if(data != null && data.equals(child)) {
- return j;
- }
- }
- }
- return -1;
- }
} \ No newline at end of file
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/PerspectivePreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/PerspectivePreferencePage.java
index 326c26068..b6bc86245 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/PerspectivePreferencePage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/PerspectivePreferencePage.java
@@ -46,7 +46,6 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
@@ -376,15 +375,6 @@ public class PerspectivePreferencePage extends PreferencePage implements IWorkbe
}
}
fPerspectiveComp.layout(new Control[] {fComboPlaceHolder});
- resizeShell();
- }
-
- private void resizeShell() {
- Point pnt = this.getShell().getSize();
- Point p = this.getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
- if(pnt.x < p.x) {
- this.getShell().setSize(p);
- }
}
/**
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java
index c95ea4af1..0d608ed89 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointSetOrganizer.java
@@ -110,10 +110,10 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
Object newValue = event.getNewValue();
if (newValue instanceof IWorkingSet) {
set = (IWorkingSet) newValue;
- }//end if
+ }
else if (event.getOldValue() instanceof IWorkingSet) {
set = (IWorkingSet) event.getOldValue();
- }//end else if
+ }
String property = event.getProperty();
//fix for bug 103731
if (property.equals(IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE)) {
@@ -133,9 +133,9 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
IMarker marker = ((IBreakpoint)breakpoints[i]).getMarker();
fCache.addEntry(marker, set.getName());
fCache.flushMarkerCache(marker);
- }// end if
- }//end for
- }//end if
+ }
+ }
+ }
if (set != null && IInternalDebugUIConstants.ID_BREAKPOINT_WORKINGSET.equals(set.getId())) {
fireCategoryChanged(new WorkingSetCategory(set));
}
@@ -168,11 +168,11 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
// if we cannot find the one we want, try to get the default
if (set == null) {
set = getDefaultWorkingSet();
- }// end if
+ }
addBreakpointToSet(breakpoints[i], set);
- }// end for
+ }
}
- }// end for
+ }
}
/**
@@ -188,8 +188,8 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
for(int i = 0; i < elements.length; i++) {
if(elements[i].equals(breakpoint)) {
return;
- }//end if
- }//end for
+ }
+ }
fCache.addEntry(breakpoint.getMarker(), set.getName()); //fix for bug 103731
fCache.flushMarkerCache(breakpoint.getMarker());
IAdaptable[] newElements = new IAdaptable[elements.length + 1];
@@ -213,9 +213,9 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
set = workingSets[i];
if (IInternalDebugUIConstants.ID_BREAKPOINT_WORKINGSET.equals(set.getId())) {
clean(set);
- }// end if
- }// end for
- }//end breakpointsRemoved
+ }
+ }
+ }
/**
* Removes deleted breakpoints from the given working set.
@@ -330,7 +330,7 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
if (category instanceof WorkingSetCategory) {
IWorkingSet set = ((WorkingSetCategory) category).getWorkingSet();
addBreakpointToSet(breakpoint, set);
- }//end if
+ }
}
/**
@@ -347,8 +347,8 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
String name = (String) marker.getAttribute(type);
if (name != null) {
return name.split("\\" + IImportExportConstants.DELIMITER); //$NON-NLS-1$
- }// end if
- }// end try
+ }
+ }
catch (CoreException e) {DebugPlugin.log(e);}
return new String[] {};
}
@@ -368,8 +368,8 @@ public class BreakpointSetOrganizer extends AbstractBreakpointOrganizerDelegate
IAdaptable adaptable = elements[i];
if (!adaptable.equals(breakpoint)) {
list.add(adaptable);
- }//end if
- }//end for
+ }
+ }
fCache.removeMappedEntry(breakpoint.getMarker(), set.getName());
fCache.flushMarkerCache(breakpoint.getMarker());
set.setElements((IAdaptable[]) list.toArray(new IAdaptable[list.size()]));
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetCache.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetCache.java
index d1f62c7f3..8ad4f6c70 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetCache.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointWorkingSetCache.java
@@ -46,7 +46,7 @@ public class BreakpointWorkingSetCache {
*/
public BreakpointWorkingSetCache() {
fCache = new HashMap(15);
- }//end constructor
+ }
/**
* Adds an entry into the cache
@@ -59,13 +59,13 @@ public class BreakpointWorkingSetCache {
list = new Vector();
list.addElement(entry);
fCache.put(marker, list);
- }//end if
+ }
else {
if(!list.contains(entry)) {
list.addElement(entry);
- }//end if
- }//end else
- }//end addEntry
+ }
+ }
+ }
/**
* Removes an item from the list contained under the marker key, not the marker entry
@@ -76,8 +76,8 @@ public class BreakpointWorkingSetCache {
Vector list = (Vector)fCache.get(marker);
if(list != null) {
list.remove(entry);
- }//end if
- }//end removeMappedEntry
+ }
+ }
/**
* Flushes the cache of only the sepcified marker
@@ -95,14 +95,14 @@ public class BreakpointWorkingSetCache {
if(ws != null) {
names += name+IImportExportConstants.DELIMITER;
ids += ws.getId()+IImportExportConstants.DELIMITER;
- }//end if
- }//end for
+ }
+ }
try {
marker.setAttribute(IInternalDebugUIConstants.WORKING_SET_NAME, names);
marker.setAttribute(IInternalDebugUIConstants.WORKING_SET_ID, ids);
- }//end try
+ }
catch(CoreException e) {DebugPlugin.log(e);}
- }//end if
+ }
}
-}//end class
+}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java
index 90536c7bb..e3b498a85 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDragAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -13,23 +13,31 @@ package org.eclipse.debug.internal.ui.views.breakpoints;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.util.TransferDragSourceListener;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DragSourceAdapter;
import org.eclipse.swt.dnd.DragSourceEvent;
import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.widgets.Item;
import org.eclipse.ui.views.navigator.LocalSelectionTransfer;
+/**
+ * A drag adapter for the breakpoints viewer
+ */
public class BreakpointsDragAdapter extends DragSourceAdapter implements TransferDragSourceListener {
- private ISelectionProvider fProvider;
- private BreakpointsView fView;
- private BreakpointContainer[] fContainers;
+ /**
+ * the associated viewer for the adapter
+ */
+ private BreakpointsViewer fViewer;
+ private Item[] fItems = null;
- public BreakpointsDragAdapter(BreakpointsView view, ISelectionProvider provider) {
- Assert.isNotNull(provider);
- fProvider= provider;
- fView = view;
+ /**
+ * Constructor
+ * @param view the associiated view, which acts as the selection provider and therefore <b>must</b> implement <code>ISelectionProvider</code>
+ */
+ public BreakpointsDragAdapter(BreakpointsViewer viewer) {
+ Assert.isNotNull(viewer);
+ fViewer = viewer;
}
/**
@@ -43,29 +51,13 @@ public class BreakpointsDragAdapter extends DragSourceAdapter implements Transfe
* @see org.eclipse.swt.dnd.DragSourceListener#dragStart
*/
public void dragStart(DragSourceEvent event) {
- ISelection selection= fProvider.getSelection();
+ ISelection selection = fViewer.getSelection();
LocalSelectionTransfer.getInstance().setSelection(selection);
LocalSelectionTransfer.getInstance().setSelectionSetTime(event.time & 0xFFFFFFFFL);
- event.doit= isDragable(selection);
- }
-
- /**
- * Checks if the elements contained in the given selection can
- * be dragged.
- * <p>
- * Subclasses may override.
- *
- * @param selection containing the elements to be dragged
- */
- protected boolean isDragable(ISelection selection) {
- if (fView.canMove(selection)) {
- fContainers = fView.getMovedFromContainers(selection);
- return true;
- }
- return false;
+ event.doit = fViewer.canDrag(fViewer.getSelectedItems());
+ fItems = fViewer.getSelectedItems();
}
-
-
+
/* non Java-doc
* @see org.eclipse.swt.dnd.DragSourceListener#dragSetData
*/
@@ -73,18 +65,18 @@ public class BreakpointsDragAdapter extends DragSourceAdapter implements Transfe
// For consistency set the data to the selection even though
// the selection is provided by the LocalSelectionTransfer
// to the drop target adapter.
- event.data= LocalSelectionTransfer.getInstance().getSelection();
+ event.data = LocalSelectionTransfer.getInstance().getSelection();
}
-
/* non Java-doc
* @see org.eclipse.swt.dnd.DragSourceListener#dragFinished
*/
public void dragFinished(DragSourceEvent event) {
if (event.detail == DND.DROP_MOVE) {
// remove from source on move operation
- fView.performRemove(fContainers, LocalSelectionTransfer.getInstance().getSelection());
+ fViewer.performDrag(fItems);
}
+ fItems = null;
LocalSelectionTransfer.getInstance().setSelection(null);
LocalSelectionTransfer.getInstance().setSelectionSetTime(0);
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java
index a72606797..cd4096d9e 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsDropAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -10,38 +10,47 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.breakpoints;
-import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ViewerDropAdapter;
+import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.TransferData;
+import org.eclipse.swt.widgets.Item;
import org.eclipse.ui.views.navigator.LocalSelectionTransfer;
/**
* BreakpointsDropAdapter
*/
public class BreakpointsDropAdapter extends ViewerDropAdapter {
-
- private BreakpointsView fView;
+ private Item fTarget = null;
+
/**
* @param viewer
*/
- protected BreakpointsDropAdapter(BreakpointsView view, Viewer viewer) {
+ protected BreakpointsDropAdapter(BreakpointsViewer viewer) {
super(viewer);
- fView = view;
+ setFeedbackEnabled(false);
}
- /* (non-Javadoc)
+ /**
* @see org.eclipse.jface.viewers.ViewerDropAdapter#performDrop(java.lang.Object)
*/
public boolean performDrop(Object data) {
- return fView.performPaste(getCurrentTarget(), LocalSelectionTransfer.getInstance().getSelection());
+ return ((BreakpointsViewer)getViewer()).performDrop(fTarget, (IStructuredSelection) LocalSelectionTransfer.getInstance().getSelection());
}
- /* (non-Javadoc)
+ /**
+ * @see org.eclipse.jface.viewers.ViewerDropAdapter#determineTarget(org.eclipse.swt.dnd.DropTargetEvent)
+ */
+ protected Object determineTarget(DropTargetEvent event) {
+ fTarget = (Item) event.item;
+ return fTarget;
+ }
+
+ /**
* @see org.eclipse.jface.viewers.ViewerDropAdapter#validateDrop(java.lang.Object, int, org.eclipse.swt.dnd.TransferData)
*/
public boolean validateDrop(Object target, int operation, TransferData transferType) {
- return fView.canPaste(target, LocalSelectionTransfer.getInstance().getSelection());
+ return ((BreakpointsViewer)getViewer()).canDrop(fTarget, (IStructuredSelection) LocalSelectionTransfer.getInstance().getSelection());
}
-
}
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 cf020eb28..5728a1a70 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
@@ -63,10 +63,8 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.IMemento;
@@ -97,7 +95,12 @@ public class BreakpointsView extends AbstractDebugView implements ISelectionList
private BreakpointsViewEventHandler fEventHandler;
private ICheckStateListener fCheckListener= new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
- handleCheckStateChanged(event);
+ Object source = event.getElement();
+ if (source instanceof BreakpointContainer) {
+ handleContainerChecked(event, (BreakpointContainer) source);
+ } else if (source instanceof IBreakpoint) {
+ handleBreakpointChecked(event, (IBreakpoint) source);
+ }
}
};
private boolean fIsTrackingSelection= false;
@@ -132,6 +135,7 @@ public class BreakpointsView extends AbstractDebugView implements ISelectionList
fContentProvider= new BreakpointsContentProvider();
CheckboxTreeViewer viewer = new BreakpointsViewer(new Tree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK));
setViewer(viewer);
+ viewer.setUseHashlookup(true);
viewer.setContentProvider(fContentProvider);
viewer.setComparator(new BreakpointsComparator());
viewer.setInput(DebugPlugin.getDefault().getBreakpointManager());
@@ -144,7 +148,6 @@ public class BreakpointsView extends AbstractDebugView implements ISelectionList
}
});
viewer.setLabelProvider(new BreakpointsLabelProvider());
-
// Necessary so that the PropertySheetView hears about selections in this view
getSite().setSelectionProvider(viewer);
initIsTrackingSelection();
@@ -154,20 +157,16 @@ public class BreakpointsView extends AbstractDebugView implements ISelectionList
return viewer;
}
+ /**
+ * Initializes drag and drop for the breakpoints viewer
+ */
private void initDragAndDrop() {
- StructuredViewer viewer = (StructuredViewer)getViewer();
- int ops= DND.DROP_MOVE | DND.DROP_COPY;
+ BreakpointsViewer viewer = (BreakpointsViewer) getViewer();
+ int ops = DND.DROP_MOVE | DND.DROP_COPY;
// drop
- Transfer[] dropTransfers= new Transfer[] {
- LocalSelectionTransfer.getInstance()
- };
- viewer.addDropSupport(ops, dropTransfers, new BreakpointsDropAdapter(this, viewer));
-
+ viewer.addDropSupport(ops, new Transfer[] {LocalSelectionTransfer.getInstance()}, new BreakpointsDropAdapter(viewer));
// Drag
- Transfer[] dragTransfers= new Transfer[] {
- LocalSelectionTransfer.getInstance()
- };
- viewer.addDragSupport(ops, dragTransfers, new BreakpointsDragAdapter(this, viewer));
+ viewer.addDragSupport(ops, new Transfer[] {LocalSelectionTransfer.getInstance()}, new BreakpointsDragAdapter(viewer));
}
/**
@@ -186,6 +185,9 @@ public class BreakpointsView extends AbstractDebugView implements ISelectionList
setTrackSelection(false);
}
+ /**
+ * Initializes the persisted breakpoints organizers
+ */
private void initBreakpointOrganizers() {
IMemento memento = getMemento();
if (memento != null) {
@@ -246,20 +248,6 @@ public class BreakpointsView extends AbstractDebugView implements ISelectionList
}
/**
- * Responds to the user checking and unchecking breakpoints by enabling
- * and disabling them.
- *
- * @param event the check state change event
- */
- private void handleCheckStateChanged(CheckStateChangedEvent event) {
- Object source= event.getElement();
- if (source instanceof BreakpointContainer) {
- handleContainerChecked(event, (BreakpointContainer) source);
- } else if (source instanceof IBreakpoint) {
- handleBreakpointChecked(event, (IBreakpoint) source);
- }
- }
- /**
* A breakpoint has been checked/unchecked. Update the group
* element's checked/grayed state as appropriate.
*/
@@ -312,9 +300,9 @@ public class BreakpointsView extends AbstractDebugView implements ISelectionList
IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
try {
progressService.busyCursorWhile(runnable);
- } catch (InvocationTargetException e) {
- } catch (InterruptedException e) {
- }
+ }
+ catch (InvocationTargetException e) {}
+ catch (InterruptedException e) {}
}
/**
@@ -535,7 +523,7 @@ public class BreakpointsView extends AbstractDebugView implements ISelectionList
node.putString(KEY_VALUE, String.valueOf(fIsTrackingSelection));
StringBuffer buffer= new StringBuffer();
- IBreakpointOrganizer[] organizers = getBreakpointOrganizers();
+ IBreakpointOrganizer[] organizers = fContentProvider.getOrganizers();
if (organizers != null) {
for (int i = 0; i < organizers.length; i++) {
IBreakpointOrganizer organizer = organizers[i];
@@ -589,6 +577,10 @@ public class BreakpointsView extends AbstractDebugView implements ISelectionList
viewer.setSelection(selection);
}
+ /**
+ * returns the complete listing of breakpoints organizers
+ * @return the complete listing of breakpoint organizers
+ */
public IBreakpointOrganizer[] getBreakpointOrganizers() {
return fContentProvider.getOrganizers();
}
@@ -642,101 +634,99 @@ public class BreakpointsView extends AbstractDebugView implements ISelectionList
}
/**
- * Checks if the elements contained in the given selection can
- * be moved.
- *
- * @param selection containing the elements to be moved
- */
- public boolean canMove(ISelection selection) {
- if (selection.isEmpty() || !fContentProvider.isShowingGroups()) {
- return false;
- }
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) selection;
- Object[] objects = ss.toArray();
- for (int i = 0; i < objects.length; i++) {
- Object object = objects[i];
- if (object instanceof IBreakpoint) {
- IBreakpoint breakpoint = (IBreakpoint) object;
- BreakpointContainer[] containers = getMovedFromContainers(breakpoint);
- if (containers == null || containers.length == 0) {
- return false;
- }
- } else {
- return false;
- }
- }
- } else {
- return false;
- }
- return true;
- }
+ * This method is used solely to preserve the selection state of the viewer in the event that the current selection is to be removed
+ * @param selection the selection to be removed
+ *
+ * @since 3.3
+ */
+ public void preserveSelection(IStructuredSelection selection) {
+ if(selection != null && !selection.isEmpty()) {
+ TreeItem item = (TreeItem) ((BreakpointsViewer)getCheckboxViewer()).searchItem(selection.getFirstElement());
+ Object toselect = null;
+ if(item != null) {
+ TreeItem parent = item.getParentItem();
+ if(parent != null) {
+ int idx = 0;
+ if(parent.getItemCount() == 1) {
+ toselect = parent.getData();
+ }
+ idx = parent.indexOf(item);
+ if(idx == 0) {
+ if(parent.getItemCount() > 1) {
+ toselect = parent.getItem(1).getData();
+ }
+ else {
+ toselect = parent.getItem(0).getData();
+ }
+ }
+ if(idx > 0) {
+ toselect = parent.getItem(idx-1).getData();
+ }
+ }
+ else {
+ Tree tree = item.getParent();
+ TreeItem[] items = tree.getItems();
+ for(int i = 0; i < items.length; i++) {
+ if(item.equals(items[i])) {
+ if(i - 1 < 0 && items.length > 1) {
+ toselect = items[i+1];
+ break;
+ }
+ else if(items.length > 1){
+ toselect = items[i-1].getData();
+ break;
+ }
+ }
+ }
+ }
+ }
+ if(toselect != null) {
+ getViewer().setSelection(new StructuredSelection(toselect), true);
+ }
+ }
+ }
/**
* Returns whether the given selection can be pasted into the given target.
+ * <p>
+ * Scheme:
+ * <ul>
+ * <li>Breakpoints can only be pasted into allowable containers (i..e. like workings sets)</li>
+ * <li>Breakpoints can only be pasted into containers that they do not already reside in</li>
+ * <li>Breakpoints can only be pasted into containers, not other breakpoints</li>
+ * </ul>
+ * </p>
*
* @param target target of the paste
* @param selection the selection to paste
* @return whether the given selection can be pasted into the given target
+ *
+ * TODO Remove in favour of using <code>TreeItem</code>s and <code>TreePath</code>s to determine paste targets
*/
public boolean canPaste(Object target, ISelection selection) {
- if (target instanceof BreakpointContainer) {
- BreakpointContainer container = (BreakpointContainer) target;
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- Object[] objects = ((IStructuredSelection)selection).toArray();
- for (int i = 0; i < objects.length; i++) {
- if (objects[i] instanceof IBreakpoint) {
- IBreakpoint breakpoint = (IBreakpoint)objects[i];
- if (container.contains(breakpoint) || !container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
- return false;
- }
- } else {
- return false;
- }
- }
- return true;
- }
- }
- if(target instanceof IBreakpoint){
- IBreakpoint bp = (IBreakpoint)target;
- BreakpointContainer cont = getBreakpointContainer(bp);
- if(cont!=null){
- return canPaste(cont,selection);
- }
- }
- return false;
- }
-
- /**
- * Returns the BreakpointContainer which holds the
- * given breakpoint, or null if such a container cannot be found.
- * @param breakpoint the breakpoint whose container is to be returned
- * @return the container of the given breakpoint.
- * @since 3.2
- */
- private BreakpointContainer getBreakpointContainer(IBreakpoint breakpoint) {
- BreakpointContainer[] containers = fContentProvider.getContainers(breakpoint);
- if (containers != null && containers.length > 0) {
- return containers[0];
+ if(!(target instanceof BreakpointContainer)) {
+ return false;
}
- return null;
- }
-
- public void performRemove(BreakpointContainer[] containers, ISelection ss) {
- if (ss instanceof IStructuredSelection) {
- // remove from source on move operation
- IStructuredSelection selection = (IStructuredSelection) ss;
- Object[] breakpoints = selection.toArray();
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = (IBreakpoint) breakpoints[i];
- for (int j = 0; j < containers.length; j++) {
- BreakpointContainer container = containers[j];
- container.getOrganizer().removeBreakpoint(breakpoint, container.getCategory());
- }
+ if(selection.isEmpty()) {
+ return false;
+ }
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ BreakpointContainer container = (BreakpointContainer) target;
+ IBreakpoint breakpoint = null;
+ Object element = null;
+ for(Iterator iter = ss.iterator(); iter.hasNext();) {
+ element = iter.next();
+ if(!(element instanceof IBreakpoint)) {
+ return false;
+ }
+ breakpoint = (IBreakpoint) element;
+ if (container.contains(breakpoint) || !container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
+ return false;
}
- }
- }
-
+ }
+ return true;
+ }
+
/**
* Pastes the selection into the given target
*
@@ -744,6 +734,8 @@ public class BreakpointsView extends AbstractDebugView implements ISelectionList
* or a Breakpoint within a BreakpointContainer
* @param selection breakpoints
* @return whehther successful
+ *
+ * TODO remove in favour of using <code>TreeItem</code> as paste target
*/
public boolean performPaste(Object target, ISelection selection) {
if (target instanceof BreakpointContainer && selection instanceof IStructuredSelection) {
@@ -754,169 +746,14 @@ public class BreakpointsView extends AbstractDebugView implements ISelectionList
}
return true;
}
- if(target instanceof IBreakpoint){
- return performPaste(getBreakpointContainer((IBreakpoint)target),selection);
- }
return false;
- }
+ }
- public BreakpointContainer[] getMovedFromContainers(ISelection selection) {
- List list = new ArrayList();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) selection;
- Object[] objects = ss.toArray();
- for (int i = 0; i < objects.length; i++) {
- if (objects[i] instanceof IBreakpoint) {
- IBreakpoint breakpoint = (IBreakpoint) objects[i];
- BreakpointContainer[] containers = getMovedFromContainers(breakpoint);
- for (int j = 0; j < containers.length; j++) {
- list.add(containers[j]);
- }
- }
-
- }
- }
- return (BreakpointContainer[]) list.toArray(new BreakpointContainer[list.size()]);
- }
/**
- * Returns the parent of the given breakpoint that allows the breakpoint
- * to be removed. Only parents of selected breakpoints are considered.
- *
- * @param breakpoint candidate for removal
- * @return containers that the breakpoint should be removed from
+ * Returns if the breakpoints view is currently showing groups or not
+ * @return true of the breakpoints view showing groups, false otherwise
*/
- public BreakpointContainer[] getMovedFromContainers(IBreakpoint breakpoint) {
- BreakpointsViewer viewer = (BreakpointsViewer) getViewer();
- Item[] items = viewer.getSelectedItems();
- List list = new ArrayList();
- for (int i = 0; i < items.length; i++) {
- TreeItem item = (TreeItem) items[i];
- if (breakpoint.equals(item.getData())) {
- BreakpointContainer parent = getRemoveableParent(item, breakpoint);
- if (parent != null) {
- list.add(parent);
- }
- }
- }
- return (BreakpointContainer[]) list.toArray(new BreakpointContainer[list.size()]);
- }
-
- private BreakpointContainer getRemoveableParent(TreeItem item, IBreakpoint breakpoint) {
- TreeItem parentItem = item.getParentItem();
- if (parentItem != null) {
- Object data = parentItem.getData();
- if (data instanceof BreakpointContainer) {
- BreakpointContainer container = (BreakpointContainer) data;
- if (container.getOrganizer().canRemove(breakpoint, container.getCategory())) {
- return container;
- }
- }
- return getRemoveableParent(parentItem, breakpoint);
- }
- return null;
- }
-
public boolean isShowingGroups() {
return fContentProvider.isShowingGroups();
}
-
- /**
- * Returns a list containing a point indicating the breakpoint to attempt to
- * select a list of groups to select, or <code>null</code> if none.
- *
- * @return
- */
- public List getSelectionState() {
- Tree tree = ((BreakpointsViewer)getViewer()).getTree();
- TreeItem[] selection = tree.getSelection();
- if (selection.length > 0) {
- List list = new ArrayList();
- TreeItem[] roots = tree.getItems();
- TreeItem first = getFirstSelectedItem(roots, selection);
- if (first.getData() instanceof IBreakpoint) {
- TreeItem parentItem = first.getParentItem();
- if (parentItem == null) {
- list.add(new Point(0, indexOf(roots, first)));
- } else {
- int breakpointIndex = indexOf(parentItem.getItems(),first);
- while (parentItem.getParentItem() != null) {
- parentItem = parentItem.getParentItem();
- }
- int groupIndex = indexOf(roots, parentItem);
- list.add(new Point(groupIndex, breakpointIndex));
- }
- } else {
- for (int i = 0; i < selection.length; i++) {
- TreeItem item = selection[i];
- list.add(item.getData());
- }
- }
- return list;
- }
- return null;
- }
-
- private TreeItem getFirstSelectedItem(TreeItem[] items, TreeItem[] selection) {
- for (int i = 0; i < items.length; i++) {
- TreeItem item = items[i];
- if (indexOf(selection, item) >= 0) {
- return item;
- }
- TreeItem first = getFirstSelectedItem(item.getItems(), selection);
- if (first != null) {
- return first;
- }
- }
- return null;
- }
-
- private int indexOf(Object[] list, Object object) {
- for (int i = 0; i < list.length; i++) {
- if (object.equals(list[i])) {
- return i;
- }
- }
- return -1;
- }
-
- public void preserveSelectionState(List state) {
- if (state != null) {
- if (state.get(0) instanceof Point) {
- Point p = (Point) state.get(0);
- int groupIndex = p.x;
- int bpIndex = p.y;
- Tree tree = ((BreakpointsViewer)getViewer()).getTree();
- TreeItem[] roots = tree.getItems();
- TreeItem selection = null;
- if (roots.length > 0 && groupIndex < roots.length) {
- TreeItem group = roots[groupIndex];
- if (group.getData() instanceof IBreakpoint) {
- if (bpIndex < roots.length) {
- selection = roots[bpIndex];
- } else {
- selection = roots[roots.length -1];
- }
- } else {
- TreeItem[] bps = group.getItems();
- while (bps.length > 0 && !(bps[0].getData() instanceof IBreakpoint)) {
- group = bps[0];
- bps = group.getItems();
- }
- if (bpIndex < bps.length) {
- selection = bps[bpIndex];
- } else if (bps.length > 0) {
- selection = bps[bps.length - 1];
- } else {
- selection = group;
- }
- }
- }
- if (selection != null) {
- ((BreakpointsViewer)getViewer()).setSelection(selection);
- }
- } else {
- getViewer().setSelection(new StructuredSelection(state));
- }
- }
- }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java
index a697cef9d..073bf6dfe 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -11,6 +11,7 @@
package org.eclipse.debug.internal.ui.views.breakpoints;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
@@ -19,7 +20,9 @@ import org.eclipse.debug.core.IBreakpointManager;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreePath;
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
@@ -29,7 +32,7 @@ import org.eclipse.swt.widgets.Widget;
* Breakpoints viewer.
*/
public class BreakpointsViewer extends CheckboxTreeViewer {
-
+
/**
* Constructs a new breakpoints viewer with the given tree.
*
@@ -115,8 +118,185 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
getTree().setSelection(new TreeItem[]{item});
updateSelection(getSelection());
}
+
+ /**
+ * Returns the container from within the specified path that is the container the breakpoint can be removed from
+ * @param breakpoint the breakpoint to get the container for
+ * @return the first found container that includes the breakpoint that allows removal, or <code>null</code> if none found
+ * @since 3.3
+ */
+ public BreakpointContainer getRemovableContainer(Item item) {
+ if(item == null) {
+ return null;
+ }
+ if(item.getData() instanceof IBreakpoint) {
+ TreePath path = getTreePathFromItem(item);
+ if(path != null) {
+ IBreakpoint breakpoint = (IBreakpoint) path.getLastSegment();
+ BreakpointContainer container = null;
+ for(int i = path.getSegmentCount()-2; i > -1; i--) {
+ container = (BreakpointContainer) path.getSegment(i);
+ if(container.contains(breakpoint) && container.getOrganizer().canRemove(breakpoint, container.getCategory())) {
+ return container;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the addable breakpoint container of the specified breakpoint
+ * @param breakpoint the breakpoint to get the container for
+ * @return the first found addable container for the specified breakpoint or <code>null</code> if none found
+ * @since 3.3
+ */
+ public BreakpointContainer getAddableContainer(Item item) {
+ TreePath path = getTreePathFromItem(item);
+ if(path != null) {
+ Object element = path.getLastSegment();
+ if(element instanceof IBreakpoint) {
+ BreakpointContainer container = null;
+ IBreakpoint breakpoint = (IBreakpoint) element;
+ for(int i = path.getSegmentCount()-2; i > -1; i--) {
+ container = (BreakpointContainer) path.getSegment(i);
+ if(container.contains(breakpoint) && container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
+ return container;
+ }
+ }
+ }
+ }
+ return null;
+ }
+ /**
+ * Returns if the selected item in the tree can be dragged
+ * <p>
+ * Scheme:
+ * <ul>
+ * <li>breakpoint containers cannot be dragged</li>
+ * <li>breakpoints can be dragged iff the container they reside in supports the removal of breakpoints</li>
+ * </ul>
+ * </p>
+ * @param element the element to test if it can be dragged
+ * @return true if the selected element can be dragged, false otherwise
+ * @since 3.3
+ */
+ public boolean canDrag(Item[] items) {
+ if(items == null) {
+ return false;
+ }
+ if(items.length == 0) {
+ return false;
+ }
+ for(int i = 0; i < items.length; i++) {
+ if(getRemovableContainer(items[i]) == null) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Performs the actual removal of breakpoints from their respective (removable) containers on a successful drag operation
+ * @param selection the selection of breakpoints involved in the drag
+ * @since 3.3
+ */
+ public void performDrag(Item[] items) {
+ if(items == null) {
+ return;
+ }
+ BreakpointContainer container = null;
+ IBreakpoint breakpoint = null;
+ for(int i = 0; i < items.length; i++) {
+ if(!items[i].isDisposed()) {
+ breakpoint = (IBreakpoint)items[i].getData();
+ container = getRemovableContainer(items[i]);
+ if(container != null) {
+ container.getOrganizer().removeBreakpoint(breakpoint, container.getCategory());
+ }
+ }
+ }
+ }
+ /**
+ * Determines if the specified element can be dropped into the specified target
+ * <p>
+ * Scheme:
+ * <ul>
+ * <li>Breakpoints can be dropped into working sets</li>
+ * <li>Breakpoints can be dropped into breakpoints, provided there is a droppable parent of the target breakpoint</li>
+ * </ul>
+ * </p>
+ * @param target the target foor the drop
+ * @param element the element we want to drop
+ * @return true if the specified element can be dropped into the specified target, false otherwise
+ * @since 3.3
+ */
+ public boolean canDrop(Item target, IStructuredSelection selection) {
+ if(selection == null || target == null) {
+ return false;
+ }
+ for(Iterator iter = selection.iterator(); iter.hasNext();) {
+ if(!checkAddableParentContainers(target, (IBreakpoint) iter.next())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * This method is used to determine if there is an addable parent container available for the specified drop target.
+ * <p>
+ * A drop target can be either a <code>BreakpointContainer</code> or an <code>IBreakpoint</code>. This method always checks the entire heirarchy
+ * of the tree path for the specified target in the event one of the parent element does not support dropping.
+ * </p>
+ * @param target
+ * @param breakpoint
+ * @return
+ */
+ private boolean checkAddableParentContainers(Item target, IBreakpoint breakpoint) {
+ BreakpointContainer container = null;
+ TreePath path = getTreePathFromItem(target);
+ if(path != null) {
+ Object element = null;
+ for(int i = path.getSegmentCount()-1; i > -1; i--) {
+ element = path.getSegment(i);
+ if(element instanceof BreakpointContainer) {
+ container = (BreakpointContainer) element;
+ if(container.contains(breakpoint) || !container.getOrganizer().canAdd(breakpoint, container.getCategory())) {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Performs the actual addition of the selected breakpoints to the specified target
+ * @param target the target to add the selection of breakpoints to
+ * @param selection the selection of breakpoints
+ * @return true if the drop occurred, false otherwise
+ * @since 3.3
+ */
+ public boolean performDrop(Item target, IStructuredSelection selection) {
+ if(target == null || selection == null) {
+ return false;
+ }
+ IBreakpoint breakpoint = null;
+ Object element = target.getData();
+ BreakpointContainer container = (element instanceof BreakpointContainer ? (BreakpointContainer)element : getAddableContainer(target));
+ if(container == null) {
+ return false;
+ }
+ for(Iterator iter = selection.iterator(); iter.hasNext();) {
+ breakpoint = (IBreakpoint) iter.next();
+ container.getOrganizer().addBreakpoint(breakpoint, container.getCategory());
+ }
+ expandToLevel(target.getData(), ALL_LEVELS);
+ return true;
+ }
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.Viewer#refresh()
@@ -161,7 +341,7 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
TreeItem[] items = getTree().getItems();
for (int i = 0; i < items.length; i++) {
findAllOccurrences(items[i], element, list);
- }//end for
+ }
return (Widget[]) list.toArray(new Widget[0]);
}
@@ -174,7 +354,7 @@ public class BreakpointsViewer extends CheckboxTreeViewer {
private void findAllOccurrences(TreeItem item, Object element, ArrayList list) {
if (element.equals(item.getData())) {
list.add(item);
- }//end if
+ }
TreeItem[] items = item.getItems();
for (int i = 0; i < items.length; i++) {
findAllOccurrences(items[i], element, list);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/MaxDetailsLengthDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/MaxDetailsLengthDialog.java
index daa8036a2..b9cd169b9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/MaxDetailsLengthDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/MaxDetailsLengthDialog.java
@@ -106,6 +106,7 @@ public class MaxDetailsLengthDialog extends TrayDialog {
fTextWidget.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
validateInput();
+ fValue = fTextWidget.getText();
}
});
fErrorTextWidget = new Text(composite, SWT.READ_ONLY);
@@ -125,6 +126,7 @@ public class MaxDetailsLengthDialog extends TrayDialog {
try {
int max = Integer.parseInt(text);
DebugUIPlugin.getDefault().getPreferenceStore().setValue(IDebugUIConstants.PREF_MAX_DETAIL_LENGTH, max);
+ DebugUIPlugin.getDefault().savePluginPreferences();
}
catch (NumberFormatException e) {
DebugUIPlugin.log(e);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java
index a2633c4d3..e535ab62b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java
@@ -77,31 +77,38 @@ public class FileLink implements IConsoleHyperlink {
if (page != null) {
try {
IEditorPart editorPart = page.openEditor(new FileEditorInput(fFile), getEditorId() , false);
- if (fFileLineNumber > 0 && editorPart instanceof ITextEditor) {
- ITextEditor textEditor = (ITextEditor)editorPart;
- IEditorInput input = editorPart.getEditorInput();
- if (fFileOffset < 0) {
- IDocumentProvider provider = textEditor.getDocumentProvider();
- try {
- provider.connect(input);
- } catch (CoreException e) {
- // unable to link
- DebugUIPlugin.log(e);
- return;
+ if (fFileLineNumber > 0) {
+ ITextEditor textEditor = null;
+ if (editorPart instanceof ITextEditor) {
+ textEditor = (ITextEditor) editorPart;
+ } else {
+ textEditor = (ITextEditor) editorPart.getAdapter(ITextEditor.class);
+ }
+ if (textEditor != null) {
+ IEditorInput input = editorPart.getEditorInput();
+ if (fFileOffset < 0) {
+ IDocumentProvider provider = textEditor.getDocumentProvider();
+ try {
+ provider.connect(input);
+ } catch (CoreException e) {
+ // unable to link
+ DebugUIPlugin.log(e);
+ return;
+ }
+ IDocument document = provider.getDocument(input);
+ try {
+ IRegion region= document.getLineInformation(fFileLineNumber - 1);
+ fFileOffset = region.getOffset();
+ fFileLength = region.getLength();
+ } catch (BadLocationException e) {
+ // unable to link
+ DebugUIPlugin.log(e);
+ }
+ provider.disconnect(input);
}
- IDocument document = provider.getDocument(input);
- try {
- IRegion region= document.getLineInformation(fFileLineNumber - 1);
- fFileOffset = region.getOffset();
- fFileLength = region.getLength();
- } catch (BadLocationException e) {
- // unable to link
- DebugUIPlugin.log(e);
+ if (fFileOffset >= 0 && fFileLength >=0) {
+ textEditor.selectAndReveal(fFileOffset, fFileLength);
}
- provider.disconnect(input);
- }
- if (fFileOffset >= 0 && fFileLength >=0) {
- textEditor.selectAndReveal(fFileOffset, fFileLength);
}
}
} catch (PartInitException e) {

Back to the top