mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 09:15:38 +02:00
Allow clients to contribute IRestart adapters.
This commit is contained in:
parent
b3b077cfc3
commit
91f17114ea
2 changed files with 38 additions and 25 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2006-03-29 Mikhail Khodjaiants
|
||||||
|
Allow clients to contribute IRestart adapters.
|
||||||
|
* RestartActionDelegate.java
|
||||||
|
|
||||||
2006-03-15 Mikhail Khodjaiants
|
2006-03-15 Mikhail Khodjaiants
|
||||||
An ICDebuggerPage adapter is added to retain compatibility with old extensions.
|
An ICDebuggerPage adapter is added to retain compatibility with old extensions.
|
||||||
+ CDebuggerPageAdapter.java
|
+ CDebuggerPageAdapter.java
|
||||||
|
|
|
@ -11,32 +11,33 @@
|
||||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.model.IRestart;
|
import org.eclipse.cdt.debug.core.model.IRestart;
|
||||||
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
|
import org.eclipse.debug.core.model.IDebugElement;
|
||||||
|
import org.eclipse.debug.core.model.IDebugTarget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The delegate of the "Restart" action.
|
* The delegate of the "Restart" action.
|
||||||
*/
|
*/
|
||||||
public class RestartActionDelegate extends AbstractListenerActionDelegate {
|
public class RestartActionDelegate extends AbstractListenerActionDelegate {
|
||||||
|
|
||||||
/*
|
/* (non-Javadoc)
|
||||||
* (non-Javadoc)
|
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#doAction(java.lang.Object)
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#doAction(Object)
|
|
||||||
*/
|
*/
|
||||||
protected void doAction( Object element ) throws DebugException {
|
protected void doAction( Object element ) throws DebugException {
|
||||||
if ( element instanceof IRestart ) {
|
IRestart restartTarget = getRestartTarget( element );
|
||||||
((IRestart)element).restart();
|
if ( restartTarget != null ) {
|
||||||
|
restartTarget.restart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* (non-Javadoc)
|
||||||
* (non-Javadoc)
|
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#isEnabledFor(java.lang.Object)
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#isEnabledFor(Object)
|
|
||||||
*/
|
*/
|
||||||
protected boolean isEnabledFor( Object element ) {
|
protected boolean isEnabledFor( Object element ) {
|
||||||
if ( element instanceof IRestart ) {
|
IRestart restartTarget = getRestartTarget( element );
|
||||||
return checkCapability( (IRestart)element );
|
if ( restartTarget != null ) {
|
||||||
|
return checkCapability( restartTarget );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -45,29 +46,22 @@ public class RestartActionDelegate extends AbstractListenerActionDelegate {
|
||||||
return element.canRestart();
|
return element.canRestart();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/* (non-Javadoc)
|
||||||
* @see AbstractDebugActionDelegate#enableForMultiSelection()
|
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#getStatusMessage()
|
||||||
*/
|
|
||||||
protected boolean enableForMultiSelection() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see AbstractDebugActionDelegate#getStatusMessage()
|
|
||||||
*/
|
*/
|
||||||
protected String getStatusMessage() {
|
protected String getStatusMessage() {
|
||||||
return ActionMessages.getString( "RestartActionDelegate.0" ); //$NON-NLS-1$
|
return ActionMessages.getString( "RestartActionDelegate.0" ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/* (non-Javadoc)
|
||||||
* @see AbstractDebugActionDelegate#getErrorDialogMessage()
|
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#getErrorDialogMessage()
|
||||||
*/
|
*/
|
||||||
protected String getErrorDialogMessage() {
|
protected String getErrorDialogMessage() {
|
||||||
return ActionMessages.getString( "RestartActionDelegate.1" ); //$NON-NLS-1$
|
return ActionMessages.getString( "RestartActionDelegate.1" ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/* (non-Javadoc)
|
||||||
* @see AbstractDebugActionDelegate#getErrorDialogTitle()
|
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractDebugActionDelegate#getErrorDialogTitle()
|
||||||
*/
|
*/
|
||||||
protected String getErrorDialogTitle() {
|
protected String getErrorDialogTitle() {
|
||||||
return ActionMessages.getString( "RestartActionDelegate.2" ); //$NON-NLS-1$
|
return ActionMessages.getString( "RestartActionDelegate.2" ); //$NON-NLS-1$
|
||||||
|
@ -79,4 +73,19 @@ public class RestartActionDelegate extends AbstractListenerActionDelegate {
|
||||||
protected boolean isRunInBackground() {
|
protected boolean isRunInBackground() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected IRestart getRestartTarget( Object element ) {
|
||||||
|
if ( element instanceof IAdaptable )
|
||||||
|
return (IRestart)((IAdaptable)element).getAdapter( IRestart.class );
|
||||||
|
return getDefaultRestartTarget( element );
|
||||||
|
}
|
||||||
|
|
||||||
|
private IRestart getDefaultRestartTarget( Object element ) {
|
||||||
|
if ( element instanceof IDebugElement ) {
|
||||||
|
IDebugTarget target = ((IDebugElement)element).getDebugTarget();
|
||||||
|
if ( target instanceof IRestart )
|
||||||
|
return (IRestart)target;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue