Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorMikhail Khodjaiants2003-11-18 18:44:05 -0500
committerMikhail Khodjaiants2003-11-18 18:44:05 -0500
commitd47a5ddca53dfb1ac701673bfd96a660d60fde7b (patch)
treea0e2bb02f667f202b0f2fc64ad36f5f9097c4db5 /debug
parent2a86c34d377375a897b479c18b11f7b899a6c94b (diff)
downloadorg.eclipse.cdt-d47a5ddca53dfb1ac701673bfd96a660d60fde7b.tar.gz
org.eclipse.cdt-d47a5ddca53dfb1ac701673bfd96a660d60fde7b.tar.xz
org.eclipse.cdt-d47a5ddca53dfb1ac701673bfd96a660d60fde7b.zip
Applied the changes made to the corresponding classes of 'org.eclipse.debug.ui'.
Diffstat (limited to 'debug')
-rw-r--r--debug/org.eclipse.cdt.debug.ui/ChangeLog14
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java47
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractDebugActionDelegate.java80
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractListenerActionDelegate.java125
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddAddressBreakpointActionDelegate.java2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DebuggerConsoleActionDelegate.java4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/SignalZeroWorkbenchActionDelegate.java8
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/SwitchToDisassemblyActionDelegate.java4
8 files changed, 105 insertions, 179 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog
index ce919b617c9..990641cb0c5 100644
--- a/debug/org.eclipse.cdt.debug.ui/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog
@@ -1,3 +1,8 @@
+2003-11-13 Mikhail Khodjaiants
+ Use 'StringBuffer' instead of 'String' when generating stack frame labels.
+ Added a label for dummy stack frames instead of using the name provided by the rendered object.
+ * CDTDebugModelPresentation.java
+
2003-11-05 Mikhail Khodjaiants
The argument type of the 'getBreakpointAddress' of 'ICBreakpointManager' is changed from
'ICBreakpoint' to 'ICBreakpointManager'.
@@ -7,6 +12,15 @@
Fix for PR 45957: Memory view: last column does not show updates.
* MemoryPresentation.java
+2003-10-31 Mikhail Khodjaiants
+ Applied the changes made to the corresponding classes of 'org.eclipse.debug.ui'.
+ * AbstractDebugActionDelegate.java
+ * AbstractListenerActionDelegate.java
+ * AddAddressBreakpointActionDelegate.java
+ * DebuggerConsoleActionDelegate.java
+ * SwitchToDisassemblyActionDelegate.java
+ * SignalZeroWorkbenchActionDelegate.java
+
2003-10-28 Mikhail Khodjaiants
Changed name of source lookup preference page.
* plugin.properties
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java
index bcf8e5aaf72..6a7e46c2fe3 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java
@@ -96,6 +96,8 @@ public class CDTDebugModelPresentation extends LabelProvider
* @see #setAttribute(String, Object)
*/
public final static String DISPLAY_FULL_PATHS = "DISPLAY_FULL_PATHS"; //$NON-NLS-1$
+
+ private static final String DUMMY_STACKFRAME_LABEL = "...";
protected HashMap fAttributes = new HashMap(3);
@@ -521,32 +523,41 @@ public class CDTDebugModelPresentation extends LabelProvider
IStackFrameInfo info = (IStackFrameInfo)stackFrame.getAdapter( IStackFrameInfo.class );
if ( info != null )
{
- String label = new String();
- label += info.getLevel() + " ";
- if ( info.getFunction() != null && info.getFunction().trim().length() > 0 )
+ StringBuffer label = new StringBuffer();
+ label.append( info.getLevel() );
+ label.append( ' ' );
+ if ( info.getFunction() != null )
{
- label += info.getFunction() + "() ";
- if ( info.getFile() != null )
+ String function = info.getFunction().trim();
+ if ( function.length() > 0 )
{
- IPath path = new Path( info.getFile() );
- if ( !path.isEmpty() )
+ label.append( function );
+ label.append( "() " );
+ if ( info.getFile() != null )
{
- label += "at " + ( qualified ? path.toOSString() : path.lastSegment() ) + ":";
- if ( info.getFrameLineNumber() != 0 )
- label += info.getFrameLineNumber();
+ IPath path = new Path( info.getFile() );
+ if ( !path.isEmpty() )
+ {
+ label.append( "at " );
+ label.append( ( qualified ? path.toOSString() : path.lastSegment() ) );
+ label.append( ":" );
+ if ( info.getFrameLineNumber() != 0 )
+ label.append( info.getFrameLineNumber() );
+ }
}
}
}
else
- label += "<symbol is not available>";
- return label;
+ label.append( "<symbol is not available>" );
+ return label.toString();
}
- IDummyStackFrame dummy = (IDummyStackFrame)stackFrame.getAdapter( IDummyStackFrame.class );
- if ( dummy != null )
- {
- return stackFrame.getName();
- }
- return stackFrame.getName();
+ return ( stackFrame.getAdapter( IDummyStackFrame.class ) != null ) ?
+ getDummyStackFrameLabel( stackFrame ) : stackFrame.getName();
+ }
+
+ private String getDummyStackFrameLabel( IStackFrame stackFrame )
+ {
+ return DUMMY_STACKFRAME_LABEL;
}
protected String getVariableText( IVariable var ) throws DebugException
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractDebugActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractDebugActionDelegate.java
index 9769e3a3d14..1823b407e5d 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractDebugActionDelegate.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractDebugActionDelegate.java
@@ -1,10 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.actions;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
import java.util.Iterator;
import org.eclipse.core.runtime.MultiStatus;
@@ -17,6 +22,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.INullSelectionListener;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
@@ -25,7 +31,7 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-public abstract class AbstractDebugActionDelegate implements IWorkbenchWindowActionDelegate, IViewActionDelegate, ISelectionListener {
+public abstract class AbstractDebugActionDelegate implements IWorkbenchWindowActionDelegate, IViewActionDelegate, ISelectionListener, INullSelectionListener {
/**
* The underlying action for this delegate
@@ -112,10 +118,6 @@ public abstract class AbstractDebugActionDelegate implements IWorkbenchWindowAct
}
/**
- * Set the icons for this action on the first selection changed
- * event. This is necessary because the XML currently only
- * supports setting the enabled icon.
- * <p>
* AbstractDebugActionDelegates come in 2 flavors: IViewActionDelegate,
* IWorkbenchWindowActionDelegate delegates.
* </p>
@@ -154,46 +156,11 @@ public abstract class AbstractDebugActionDelegate implements IWorkbenchWindowAct
}
/**
- * Return whether the action should be enabled or not based on the given selection.
- */
- protected boolean getEnableStateForSelection(IStructuredSelection selection) {
- if (selection.size() == 0) {
- return false;
- }
- Iterator enum= selection.iterator();
- int count= 0;
- while (enum.hasNext()) {
- count++;
- if (count > 1 && !enableForMultiSelection()) {
- return false;
- }
- Object element= enum.next();
- if (!isEnabledFor(element)) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Returns whether this action should be enabled if there is
- * multi selection.
- */
- protected boolean enableForMultiSelection() {
- return true;
- }
-
- /**
* Performs the specific action on this element.
*/
protected abstract void doAction(Object element) throws DebugException;
/**
- * Returns whether this action will work for the given element
- */
- protected abstract boolean isEnabledFor(Object element);
-
- /**
* Returns the String to use as an error dialog title for
* a failed action. Default is to return null.
*/
@@ -328,4 +295,25 @@ public abstract class AbstractDebugActionDelegate implements IWorkbenchWindowAct
protected void setWindow(IWorkbenchWindow window) {
fWindow = window;
}
-} \ No newline at end of file
+
+ /**
+ * Return whether the action should be enabled or not based on the given selection.
+ */
+ protected boolean getEnableStateForSelection(IStructuredSelection selection) {
+ if (selection.size() == 0) {
+ return false;
+ }
+ Iterator enum= selection.iterator();
+ while (enum.hasNext()) {
+ Object element= enum.next();
+ if (!isEnabledFor(element)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ protected boolean isEnabledFor(Object element) {
+ return true;
+ }
+}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractListenerActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractListenerActionDelegate.java
index 1c6e0eda830..1f391967a5b 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractListenerActionDelegate.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AbstractListenerActionDelegate.java
@@ -1,76 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IDebugEventSetListener;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IPageListener;
-import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IActionDelegate2;
import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
-public abstract class AbstractListenerActionDelegate extends AbstractDebugActionDelegate implements IDebugEventSetListener, IPartListener, IPageListener {
-
- /**
- * @see IPartListener#partActivated(IWorkbenchPart)
- */
- public void partActivated(IWorkbenchPart part) {
- }
-
- /**
- * @see IPartListener#partBroughtToTop(IWorkbenchPart)
- */
- public void partBroughtToTop(IWorkbenchPart part) {
- }
-
- /**
- * @see IPartListener#partClosed(IWorkbenchPart)
- */
- public void partClosed(IWorkbenchPart part) {
- if (part.equals(getView())) {
- dispose();
- }
- }
-
- /**
- * @see IPartListener#partDeactivated(IWorkbenchPart)
- */
- public void partDeactivated(IWorkbenchPart part) {
- }
+public abstract class AbstractListenerActionDelegate extends AbstractDebugActionDelegate implements IDebugEventSetListener, IActionDelegate2 {
/**
- * @see IPartListener#partOpened(IWorkbenchPart)
- */
- public void partOpened(IWorkbenchPart part) {
- }
-
- /**
- * @see IWorkbenchWindowActionDelegate#dispose()
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+ * @see org.eclipse.ui.IActionDelegate2#dispose()
*/
public void dispose() {
super.dispose();
DebugPlugin.getDefault().removeDebugEventListener(this);
- getWindow().removePageListener(this);
- if (getView() != null) {
- getView().getViewSite().getPage().removePartListener(this);
- }
}
/**
* @see IDebugEventSetListener#handleDebugEvents(DebugEvent[])
*/
public void handleDebugEvents(final DebugEvent[] events) {
- if (getPage() == null || getAction() == null) {
+ if (getWindow() == null || getAction() == null) {
return;
}
Shell shell= getWindow().getShell();
@@ -91,22 +56,7 @@ public abstract class AbstractListenerActionDelegate extends AbstractDebugAction
}
};
- getPage().getWorkbenchWindow().getShell().getDisplay().asyncExec(r);
- }
-
- /**
- * Returns the page that this action works in.
- */
- protected IWorkbenchPage getPage() {
- if (getWindow() != null) {
- return getWindow().getActivePage();
- } else {
- IWorkbenchWindow window= DebugUIPlugin.getActiveWorkbenchWindow();
- if (window != null) {
- return window.getActivePage();
- }
- }
- return null;
+ shell.getDisplay().asyncExec(r);
}
/**
@@ -137,7 +87,6 @@ public abstract class AbstractListenerActionDelegate extends AbstractDebugAction
public void init(IWorkbenchWindow window){
super.init(window);
DebugPlugin.getDefault().addDebugEventListener(this);
- window.addPageListener(this);
}
/**
@@ -147,46 +96,18 @@ public abstract class AbstractListenerActionDelegate extends AbstractDebugAction
super.init(view);
DebugPlugin.getDefault().addDebugEventListener(this);
setWindow(view.getViewSite().getWorkbenchWindow());
- if ( getPage() != null )
- {
- getPage().addPartListener(this);
- getPage().getWorkbenchWindow().addPageListener(this);
- }
- }
-
- /**
- * @see IPageListener#pageActivated(IWorkbenchPage)
- */
- public void pageActivated(IWorkbenchPage page) {
- if (getAction() != null && getView() != null && getPage() != null && getPage().equals(page)) {
- Runnable r= new Runnable() {
- public void run() {
- if (getPage() != null) {
- IWorkbenchWindow window= getPage().getWorkbenchWindow();
- if (window != null && window.getShell() != null && !window.getShell().isDisposed()) {
- ISelection selection= getPage().getSelection(IDebugUIConstants.ID_DEBUG_VIEW);
- update(getAction(), selection);
- }
- }
- }
- };
-
- getPage().getWorkbenchWindow().getShell().getDisplay().asyncExec(r);
- }
}
/**
- * @see IPageListener#pageClosed(IWorkbenchPage)
+ * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
*/
- public void pageClosed(IWorkbenchPage page) {
- if (page.equals(getPage())) {
- dispose();
- }
+ public void init(IAction action) {
}
/**
- * @see IPageListener#pageOpened(IWorkbenchPage)
+ * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event)
*/
- public void pageOpened(IWorkbenchPage page) {
+ public void runWithEvent(IAction action, Event event) {
+ run(action);
}
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddAddressBreakpointActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddAddressBreakpointActionDelegate.java
index 96737064d19..a7bc28be279 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddAddressBreakpointActionDelegate.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddAddressBreakpointActionDelegate.java
@@ -63,7 +63,7 @@ public class AddAddressBreakpointActionDelegate extends AbstractListenerActionDe
*/
protected void doAction( Object element ) throws DebugException
{
- InputDialog dialog = new InputDialog( getPage().getWorkbenchWindow().getShell(),
+ InputDialog dialog = new InputDialog( getWindow().getShell(),
"Add Address Breakpoint",
"Enter address:",
null,
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DebuggerConsoleActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DebuggerConsoleActionDelegate.java
index 252dfdf93cc..dbacb4264e6 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DebuggerConsoleActionDelegate.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/DebuggerConsoleActionDelegate.java
@@ -30,12 +30,12 @@ public class DebuggerConsoleActionDelegate extends AbstractListenerActionDelegat
*/
protected void doAction( Object element ) throws DebugException
{
- if ( element != null && element instanceof CDebugElement )
+ if ( element != null && element instanceof CDebugElement && getAction() != null && getAction().isEnabled() )
{
IDebuggerProcessSupport dps = (IDebuggerProcessSupport)((CDebugElement)element).getDebugTarget().getAdapter( IDebuggerProcessSupport.class );
if ( dps != null && dps.supportsDebuggerProcess() )
{
- dps.setDebuggerProcessDefault( !dps.isDebuggerProcessDefault() );
+ dps.setDebuggerProcessDefault( getAction().isChecked() );
((CDebugElement)element).fireChangeEvent( DebugEvent.CLIENT_REQUEST );
if ( fViewPart != null && fViewPart instanceof AbstractDebugView )
{
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/SignalZeroWorkbenchActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/SignalZeroWorkbenchActionDelegate.java
index 2ba5d98a516..580650284c8 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/SignalZeroWorkbenchActionDelegate.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/SignalZeroWorkbenchActionDelegate.java
@@ -39,14 +39,6 @@ public class SignalZeroWorkbenchActionDelegate extends AbstractListenerActionDel
}
/**
- * @see AbstractDebugActionDelegate#enableForMultiSelection()
- */
- protected boolean enableForMultiSelection()
- {
- return false;
- }
-
- /**
* @see AbstractDebugActionDelegate#getStatusMessage()
*/
protected String getStatusMessage()
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/SwitchToDisassemblyActionDelegate.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/SwitchToDisassemblyActionDelegate.java
index beb99fb5085..9e8cfa2f30c 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/SwitchToDisassemblyActionDelegate.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/SwitchToDisassemblyActionDelegate.java
@@ -31,12 +31,12 @@ public class SwitchToDisassemblyActionDelegate extends AbstractListenerActionDel
*/
protected void doAction( Object element ) throws DebugException
{
- if ( element != null && element instanceof CDebugElement )
+ if ( element != null && element instanceof CDebugElement && getAction() != null && getAction().isEnabled() )
{
ISourceMode sourceMode = (ISourceMode)((CDebugElement)element).getDebugTarget().getAdapter( ISourceMode.class );
if ( sourceMode != null )
{
- sourceMode.setMode( ( sourceMode.getMode() == ISourceMode.MODE_SOURCE ) ? ISourceMode.MODE_DISASSEMBLY : ISourceMode.MODE_SOURCE );
+ sourceMode.setMode( ( getAction().isChecked() ) ? ISourceMode.MODE_DISASSEMBLY : ISourceMode.MODE_SOURCE );
((CDebugElement)element).fireChangeEvent( DebugEvent.CLIENT_REQUEST );
if ( fViewPart != null && fViewPart instanceof ISelectionChangedListener )
{

Back to the top