Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Rennie2013-07-31 16:44:16 +0000
committerMike Rennie2013-07-31 16:44:16 +0000
commitd975f27f12707ae6598994c5e3c6bd5e271d46c4 (patch)
treec7d1b2b1a202e19c0c2ccaaff959f4dd25286f0d /org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters
parent4fcde1ffaf34791bd406d47ce72d17e2801432a3 (diff)
downloadeclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.tar.gz
eclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.tar.xz
eclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.zip
Bug 352626 - Move platform debug to Java 1.6 BREE
Diffstat (limited to 'org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters')
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/AdapterFactory.java2
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/AddPDAMemoryBlockAction.java5
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java6
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/ModelProxyFactory.java1
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetContentProvider.java6
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetProxy.java1
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java9
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAThreadEventHandler.java8
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAViewActionProvider.java14
-rw-r--r--org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAVirtualFindAction.java144
10 files changed, 120 insertions, 76 deletions
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/AdapterFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/AdapterFactory.java
index 689c50649..02a382c5c 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/AdapterFactory.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/AdapterFactory.java
@@ -30,6 +30,7 @@ public class AdapterFactory implements IAdapterFactory {
private static IModelProxyFactory fgFactory = new ModelProxyFactory();
private static IViewActionProvider fgViewActionProvider = new PDAViewActionProvider();
+ @Override
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (IElementContentProvider.class.equals(adapterType)) {
if (adaptableObject instanceof PDADebugTarget) {
@@ -49,6 +50,7 @@ public class AdapterFactory implements IAdapterFactory {
return null;
}
+ @Override
public Class[] getAdapterList() {
return new Class[]{IElementContentProvider.class, IModelProxyFactory.class, IViewActionProvider.class};
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/AddPDAMemoryBlockAction.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/AddPDAMemoryBlockAction.java
index 1a8ff182d..8ce7996f1 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/AddPDAMemoryBlockAction.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/AddPDAMemoryBlockAction.java
@@ -34,6 +34,7 @@ public class AddPDAMemoryBlockAction implements IActionDelegate2{
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
+ @Override
public void run(IAction action) {
IWorkbenchWindow window = DebugUIPlugin.getActiveWorkbenchWindow();
if (window != null) {
@@ -73,6 +74,7 @@ public class AddPDAMemoryBlockAction implements IActionDelegate2{
/* (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) {
PDADebugTarget target = getTarget(selection);
action.setEnabled(target != null && !target.isTerminated());
@@ -81,18 +83,21 @@ public class AddPDAMemoryBlockAction implements IActionDelegate2{
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
*/
+ @Override
public void init(IAction action) {
}
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate2#dispose()
*/
+ @Override
public void dispose() {
}
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event)
*/
+ @Override
public void runWithEvent(IAction action, Event event) {
run(action);
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java
index 3375fb088..3eed074e3 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/CommandAdapterFactory.java
@@ -24,7 +24,8 @@ public class CommandAdapterFactory implements IAdapterFactory {
private static IRestartHandler fgRestartHandler = new PDARestartDebugCommand();
- public Object getAdapter(Object adaptableObject, Class adapterType) {
+ @Override
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
if (IRestartHandler.class.equals(adapterType)) {
if (adaptableObject instanceof PDADebugTarget) {
return fgRestartHandler;
@@ -33,7 +34,8 @@ public class CommandAdapterFactory implements IAdapterFactory {
return null;
}
- public Class[] getAdapterList() {
+ @Override
+ public Class[] getAdapterList() {
return new Class[]{IRestartHandler.class};
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/ModelProxyFactory.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/ModelProxyFactory.java
index a8e5959f1..4f5586ee1 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/ModelProxyFactory.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/ModelProxyFactory.java
@@ -20,6 +20,7 @@ import org.eclipse.debug.ui.IDebugUIConstants;
public class ModelProxyFactory implements IModelProxyFactory {
+ @Override
public IModelProxy createModelProxy(Object element, IPresentationContext context) {
if (IDebugUIConstants.ID_DEBUG_VIEW.equals(context.getId())) {
if (element instanceof PDADebugTarget){
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetContentProvider.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetContentProvider.java
index ed0c069ee..fad17ae43 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetContentProvider.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetContentProvider.java
@@ -27,7 +27,8 @@ public class PDADebugTargetContentProvider extends ElementContentProvider {
/* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#getChildCount(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate)
*/
- protected int getChildCount(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
+ @Override
+ protected int getChildCount(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
PDAThread thread = ((PDADebugTarget) element).getThread(0);
if (thread != null) {
if (thread.hasStackFrames()) {
@@ -40,6 +41,7 @@ public class PDADebugTargetContentProvider extends ElementContentProvider {
/* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#hasChildren(java.lang.Object, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate)
*/
+ @Override
protected boolean hasChildren(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
PDAThread thread = ((PDADebugTarget) element).getThread(0);
if (thread != null) {
@@ -51,6 +53,7 @@ public class PDADebugTargetContentProvider extends ElementContentProvider {
/* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#getChildren(java.lang.Object, int, int, org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate)
*/
+ @Override
protected Object[] getChildren(Object parent, int index, int length, IPresentationContext context, IViewerUpdate monitor) throws CoreException {
if (context.getId().equals(IDebugUIConstants.ID_DEBUG_VIEW)) {
PDAThread thread = ((PDADebugTarget) parent).getThread(0);
@@ -64,6 +67,7 @@ public class PDADebugTargetContentProvider extends ElementContentProvider {
/* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.model.elements.ElementContentProvider#supportsContextId(java.lang.String)
*/
+ @Override
protected boolean supportsContextId(String id) {
return IDebugUIConstants.ID_DEBUG_VIEW.equals(id);
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetProxy.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetProxy.java
index e905e12fe..7aee1b507 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetProxy.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDADebugTargetProxy.java
@@ -31,6 +31,7 @@ public class PDADebugTargetProxy extends DebugTargetProxy {
/* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.viewers.update.DebugTargetProxy#createEventHandlers()
*/
+ @Override
protected DebugEventHandler[] createEventHandlers() {
return new DebugEventHandler[] { new DebugTargetEventHandler(this), new PDAThreadEventHandler(this) };
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java
index 7bb788b24..41ff6c1de 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDARestartDebugCommand.java
@@ -24,14 +24,16 @@ import org.eclipse.debug.examples.core.pda.model.PDADebugTarget;
*/
public class PDARestartDebugCommand extends AbstractDebugCommand implements IRestartHandler {
- protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {
+ @Override
+ protected void doExecute(Object[] targets, IProgressMonitor monitor, IRequest request) throws CoreException {
for (int i = 0; i < targets.length; i++) {
((PDADebugTarget)targets[i]).restart();
monitor.worked(1);
}
}
- protected Object getTarget(Object element) {
+ @Override
+ protected Object getTarget(Object element) {
IDebugTarget target = (IDebugTarget)getAdapter(element, IDebugTarget.class);
if (target instanceof PDADebugTarget) {
return target;
@@ -39,7 +41,8 @@ public class PDARestartDebugCommand extends AbstractDebugCommand implements IRes
return null;
}
- protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request)
+ @Override
+ protected boolean isExecutable(Object[] targets, IProgressMonitor monitor, IEnabledStateRequest request)
throws CoreException
{
for (int i = 0; i < targets.length; i++) {
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAThreadEventHandler.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAThreadEventHandler.java
index 60d0bbc6c..ed3082637 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAThreadEventHandler.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAThreadEventHandler.java
@@ -41,6 +41,7 @@ public class PDAThreadEventHandler extends DebugEventHandler {
super(proxy);
}
+ @Override
protected void handleSuspend(DebugEvent event) {
IThread thread = (IThread) event.getSource();
int extras = IModelDelta.STATE;
@@ -60,28 +61,34 @@ public class PDAThreadEventHandler extends DebugEventHandler {
return o1.equals(o2);
}
+ @Override
protected void handleResume(DebugEvent event) {
IThread thread = (IThread) event.getSource();
fireDeltaAndClearTopFrame(thread, IModelDelta.STATE | IModelDelta.CONTENT);
}
+ @Override
protected void handleCreate(DebugEvent event) {
fireDeltaAndClearTopFrame((IThread) event.getSource(), IModelDelta.ADDED);
}
+ @Override
protected void handleTerminate(DebugEvent event) {
fireDeltaAndClearTopFrame((IThread) event.getSource(), IModelDelta.REMOVED);
}
+ @Override
protected void handleChange(DebugEvent event) {
fireDeltaUpdatingTopFrame((IThread) event.getSource(), IModelDelta.STATE);
}
+ @Override
protected void handleLateSuspend(DebugEvent suspend, DebugEvent resume) {
IThread thread = (IThread) suspend.getSource();
fireDeltaUpdatingTopFrame(thread, IModelDelta.CONTENT | IModelDelta.EXPAND);
}
+ @Override
protected void handleSuspendTimeout(DebugEvent event) {
IThread thread = (IThread) event.getSource();
fireDeltaAndClearTopFrame(thread, IModelDelta.CONTENT);
@@ -144,6 +151,7 @@ public class PDAThreadEventHandler extends DebugEventHandler {
fireDelta(delta);
}
+ @Override
protected boolean handlesEvent(DebugEvent event) {
return event.getSource() instanceof PDAThread;
}
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAViewActionProvider.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAViewActionProvider.java
index cb575878e..9af6fc981 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAViewActionProvider.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAViewActionProvider.java
@@ -1,12 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2012 Wind River Systems and others.
+ * Copyright (c) 2012, 2013 Wind River Systems 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:
- * Wind River Systems - initial implementation
+ * Wind River Systems - initial implementation
+ * IBM Corporation - bug fixing
*/
package org.eclipse.debug.examples.ui.pda.adapters;
@@ -27,16 +28,17 @@ import org.eclipse.jface.action.IAction;
*/
public class PDAViewActionProvider implements IViewActionProvider {
- Map fActions = new HashMap();
-
+ Map<IPresentationContext, Action> fActions = new HashMap<IPresentationContext, Action>();
+
/* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.viewers.model.provisional.IViewActionProvider#getAction(org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext, java.lang.String)
*/
+ @Override
public IAction getAction(IPresentationContext presentationContext, String actionID) {
if (presentationContext.getId().equals(IDebugUIConstants.ID_VARIABLE_VIEW) &&
- IDebugView.FIND_ACTION.equals(actionID) )
+ IDebugView.FIND_ACTION.equals(actionID) )
{
- Action action = (Action)fActions.get(presentationContext);
+ Action action = fActions.get(presentationContext);
if (action == null) {
action = new PDAVirtualFindAction(presentationContext);
fActions.put(presentationContext, action);
diff --git a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAVirtualFindAction.java b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAVirtualFindAction.java
index b5e613ef3..204227995 100644
--- a/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAVirtualFindAction.java
+++ b/org.eclipse.debug.examples.ui/src/org/eclipse/debug/examples/ui/pda/adapters/PDAVirtualFindAction.java
@@ -57,46 +57,54 @@ import org.eclipse.ui.texteditor.IUpdate;
/**
* Action which prompts user with a filtered list selection dialog to find an element in tree.
- *
+ *
* @since 3.3
*/
public class PDAVirtualFindAction extends Action implements IUpdate {
-
+
private final TreeModelViewer fClientViewer;
-
+
protected class VirtualViewerListener implements IViewerUpdateListener, ILabelUpdateListener {
-
+
private boolean fViewerUpdatesComplete = false;
private boolean fLabelUpdatesComplete = false;
private IProgressMonitor fProgressMonitor;
- private int fRemainingUpdatesCount = 0;
-
- public void labelUpdateStarted(ILabelUpdate update) {}
- public void labelUpdateComplete(ILabelUpdate update) {
- incrementProgress(1);
+ private int fRemainingUpdatesCount = 0;
+
+ @Override
+ public void labelUpdateStarted(ILabelUpdate update) {}
+ @Override
+ public void labelUpdateComplete(ILabelUpdate update) {
+ incrementProgress(1);
}
- public void labelUpdatesBegin() {
- fLabelUpdatesComplete = false;
+ @Override
+ public void labelUpdatesBegin() {
+ fLabelUpdatesComplete = false;
}
- public void labelUpdatesComplete() {
+ @Override
+ public void labelUpdatesComplete() {
fLabelUpdatesComplete = true;
completeProgress();
}
-
- public void updateStarted(IViewerUpdate update) {}
- public void updateComplete(IViewerUpdate update) {
+
+ @Override
+ public void updateStarted(IViewerUpdate update) {}
+ @Override
+ public void updateComplete(IViewerUpdate update) {
if (update instanceof IChildrenUpdate) {
incrementProgress(((IChildrenUpdate)update).getLength());
}
}
- public void viewerUpdatesBegin() {
- fViewerUpdatesComplete = false;
+ @Override
+ public void viewerUpdatesBegin() {
+ fViewerUpdatesComplete = false;
}
- public void viewerUpdatesComplete() {
+ @Override
+ public void viewerUpdatesComplete() {
fViewerUpdatesComplete = true;
completeProgress();
}
-
+
private void completeProgress() {
IProgressMonitor pm;
synchronized (this) {
@@ -104,9 +112,9 @@ public class PDAVirtualFindAction extends Action implements IUpdate {
}
if (pm != null && fLabelUpdatesComplete && fViewerUpdatesComplete) {
pm.done();
- }
+ }
}
-
+
private void incrementProgress(int count) {
IProgressMonitor pm;
synchronized (this) {
@@ -115,28 +123,31 @@ public class PDAVirtualFindAction extends Action implements IUpdate {
}
if (pm != null && fLabelUpdatesComplete && fViewerUpdatesComplete) {
pm.worked(count);
- }
+ }
}
}
-
+
private static class FindLabelProvider extends LabelProvider {
private final VirtualTreeModelViewer fVirtualViewer;
- private final Map fTextCache = new HashMap();
- public FindLabelProvider(VirtualTreeModelViewer viewer, List items) {
+ private final Map<VirtualItem, String> fTextCache = new HashMap<VirtualItem, String>();
+
+ public FindLabelProvider(VirtualTreeModelViewer viewer, List<VirtualItem> items) {
fVirtualViewer = viewer;
for (int i = 0; i < items.size(); i++) {
- VirtualItem item = (VirtualItem)items.get(i);
+ VirtualItem item = items.get(i);
fTextCache.put(item, fVirtualViewer.getText(item, 0));
}
}
-
+
+ @Override
public Image getImage(Object element) {
return fVirtualViewer.getImage((VirtualItem) element, 0);
}
+ @Override
public String getText(Object element) {
- return (String)fTextCache.get(element);
+ return fTextCache.get(element);
}
}
@@ -154,8 +165,8 @@ public class PDAVirtualFindAction extends Action implements IUpdate {
clientViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.EXPAND);
listener.fRemainingUpdatesCount = calcUpdatesCount(stateDelta);
VirtualTreeModelViewer fVirtualViewer = new VirtualTreeModelViewer(
- clientViewer.getDisplay(),
- SWT.NONE,
+ clientViewer.getDisplay(),
+ SWT.NONE,
makeVirtualPresentationContext(clientViewer.getPresentationContext()));
fVirtualViewer.addViewerUpdateListener(listener);
fVirtualViewer.addLabelUpdateListener(listener);
@@ -166,59 +177,62 @@ public class PDAVirtualFindAction extends Action implements IUpdate {
fVirtualViewer.updateViewer(stateDelta);
return fVirtualViewer;
}
-
+
protected IPresentationContext makeVirtualPresentationContext(final IPresentationContext clientViewerContext) {
return new PresentationContext(clientViewerContext.getId()) {
-
+
{
String[] clientProperties = clientViewerContext.getProperties();
for (int i = 0; i < clientProperties.length; i++) {
setProperty(clientProperties[i], clientViewerContext.getProperty(clientProperties[i]));
}
-
+
}
-
- public String[] getColumns() {
+
+ @Override
+ public String[] getColumns() {
String[] clientColumns = super.getColumns();
-
+
if (clientColumns == null || clientColumns.length == 0) {
// No columns are used.
return null;
}
-
+
// Try to find the name column.
for (int i = 0; i < clientColumns.length; i++) {
if (IDebugUIConstants.COLUMN_ID_VARIABLE_NAME.equals(clientColumns[i])) {
- return new String[] { IDebugUIConstants.COLUMN_ID_VARIABLE_NAME };
+ return new String[] { IDebugUIConstants.COLUMN_ID_VARIABLE_NAME };
}
}
-
+
return new String[] { clientColumns[0] };
}
};
}
-
+
+ @Override
public void run() {
final VirtualViewerListener listener = new VirtualViewerListener();
VirtualTreeModelViewer virtualViewer = initVirtualViewer(fClientViewer, listener);
-
+
ProgressMonitorDialog dialog = new TimeTriggeredProgressMonitorDialog(fClientViewer.getControl().getShell(), 500);
final IProgressMonitor monitor = dialog.getProgressMonitor();
dialog.setCancelable(true);
-
+
try {
dialog.run(
- true, true,
+ true, true,
new IRunnableWithProgress() {
- public void run(final IProgressMonitor m) throws InvocationTargetException, InterruptedException {
+ @Override
+ public void run(final IProgressMonitor m) throws InvocationTargetException, InterruptedException {
synchronized(listener) {
listener.fProgressMonitor = m;
listener.fProgressMonitor.beginTask(DebugUIPlugin.removeAccelerators(getText()), listener.fRemainingUpdatesCount);
}
-
+
while ((!listener.fLabelUpdatesComplete || !listener.fViewerUpdatesComplete) && !listener.fProgressMonitor.isCanceled()) {
Thread.sleep(1);
- }
+ }
synchronized(listener) {
listener.fProgressMonitor = null;
}
@@ -230,10 +244,10 @@ public class PDAVirtualFindAction extends Action implements IUpdate {
} catch (InterruptedException e) {
return;
}
-
+
VirtualItem root = virtualViewer.getTree();
if (!monitor.isCanceled()) {
- List list = new ArrayList();
+ List<VirtualItem> list = new ArrayList<VirtualItem>();
collectAllChildren(root, list);
FindLabelProvider labelProvider = new FindLabelProvider(virtualViewer, list);
VirtualItem result = performFind(list, labelProvider);
@@ -246,11 +260,12 @@ public class PDAVirtualFindAction extends Action implements IUpdate {
virtualViewer.removeViewerUpdateListener(listener);
virtualViewer.dispose();
}
-
+
private int calcUpdatesCount(IModelDelta stateDelta) {
final int[] count = new int[] {0};
stateDelta.accept( new IModelDeltaVisitor() {
- public boolean visit(IModelDelta delta, int depth) {
+ @Override
+ public boolean visit(IModelDelta delta, int depth) {
if ((delta.getFlags() & IModelDelta.EXPAND) != 0) {
count[0] += delta.getChildCount();
return true;
@@ -258,12 +273,12 @@ public class PDAVirtualFindAction extends Action implements IUpdate {
return false;
}
});
-
+
// Double it to account for separate element and label update ticks.
return count[0] * 2;
}
-
- private void collectAllChildren(VirtualItem element, List collect) {
+
+ private void collectAllChildren(VirtualItem element, List<VirtualItem> collect) {
VirtualItem[] children = element.getItems();
if (children != null) {
for (int i = 0; i < children.length; i++) {
@@ -274,11 +289,11 @@ public class PDAVirtualFindAction extends Action implements IUpdate {
}
}
}
-
- protected VirtualItem performFind(List items, FindLabelProvider labelProvider) {
+
+ protected VirtualItem performFind(List<VirtualItem> items, FindLabelProvider labelProvider) {
FindElementDialog dialog = new FindElementDialog(
- fClientViewer.getControl().getShell(),
- labelProvider,
+ fClientViewer.getControl().getShell(),
+ labelProvider,
items.toArray());
dialog.setTitle("PDA Variables View Find"); //$NON-NLS-1$
dialog.setMessage("&Specify an element to select (? = any character, * = any String):"); //$NON-NLS-1$
@@ -290,28 +305,29 @@ public class PDAVirtualFindAction extends Action implements IUpdate {
}
return null;
}
-
+
protected void setSelectionToClient(VirtualTreeModelViewer virtualViewer, ILabelProvider labelProvider, VirtualItem findItem) {
virtualViewer.getTree().setSelection(new VirtualItem[] { findItem } );
ModelDelta stateDelta = new ModelDelta(virtualViewer.getInput(), IModelDelta.NO_CHANGE);
virtualViewer.saveElementState(TreePath.EMPTY, stateDelta, IModelDelta.SELECT);
fClientViewer.updateViewer(stateDelta);
-
+
ISelection selection = fClientViewer.getSelection();
if (!selection.isEmpty() &&
- selection instanceof IStructuredSelection &&
+ selection instanceof IStructuredSelection &&
((IStructuredSelection)selection).getFirstElement().equals(findItem.getData()) ) {
} else {
DebugUIPlugin.errorDialog(
- fClientViewer.getControl().getShell(),
+ fClientViewer.getControl().getShell(),
"Error", //$NON-NLS-1$
"Could not select item:" + labelProvider.getText(findItem), //$NON-NLS-1$
new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), "Element no longer in viewer.")); //$NON-NLS-1$
- }
+ }
}
-
+
+ @Override
public void update() {
setEnabled( fClientViewer.getInput() != null && fClientViewer.getChildCount(TreePath.EMPTY) > 0 );
}
-
+
}

Back to the top