mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 09:55:29 +02:00
New implementation of the "Auto-Refresh" actions for registers and shared libraries.
This commit is contained in:
parent
81859be811
commit
7a8f06f905
8 changed files with 203 additions and 68 deletions
|
@ -1,3 +1,13 @@
|
|||
2004-06-11 Mikhail Khodjaiants
|
||||
New implementation of the "Auto-Refresh" actions for registers and shared libraries.
|
||||
* plugin.properties
|
||||
* plugin.xml
|
||||
* AbstractAutoRefreshActionDelegate.java: new
|
||||
* AutoRefreshRegistersAction.java: new
|
||||
* AutoRefreshSharedLibrariesAction.java: new
|
||||
* AutoRefreshAction.java: removed
|
||||
* AbstractRefreshActionDelegate.java
|
||||
|
||||
2004-06-09 Mikhail Khodjaiants
|
||||
New implementation of the "Refresh" actions for registers and shared libraries.
|
||||
* icons/full/clcl16/auto_refresh_co.gif: new
|
||||
|
|
|
@ -103,4 +103,6 @@ DisassemblyFontDefinition.label=Disassembly View text font
|
|||
DisassemblyFontDefinition.description=The font used in the Disassembly view.
|
||||
|
||||
RefreshAction.label=Refresh
|
||||
RefreshAction.tooltip=Refresh View's Content
|
||||
RefreshAction.tooltip=Refresh View's Content
|
||||
AutoRefreshAction.label=Auto-Refresh
|
||||
AutoRefreshAction.tooltip=Automatically Refresh View's Content
|
||||
|
|
|
@ -979,6 +979,23 @@
|
|||
id="org.eclipse.cdt.debug.ui"/>
|
||||
</enablement>
|
||||
</action>
|
||||
<action
|
||||
helpContextId="auto_refresh_shared_libraries_context"
|
||||
disabledIcon="icons/full/dlcl16/auto_refresh_co.gif"
|
||||
hoverIcon="icons/full/clcl16/auto_refresh_co.gif"
|
||||
toolbarPath="refreshGroup"
|
||||
label="%AutoRefreshAction.label"
|
||||
tooltip="%AutoRefreshAction.tooltip"
|
||||
icon="icons/full/elcl16/auto_refresh_co.gif"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.AutoRefreshSharedLibrariesActionDelegate"
|
||||
style="toggle"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.AutoRefreshSharedLibrariesActionDelegate">
|
||||
<enablement>
|
||||
<pluginState
|
||||
value="activated"
|
||||
id="org.eclipse.cdt.debug.ui"/>
|
||||
</enablement>
|
||||
</action>
|
||||
</viewContribution>
|
||||
<viewContribution
|
||||
targetID="org.eclipse.debug.ui.RegisterView"
|
||||
|
@ -1006,6 +1023,24 @@
|
|||
id="org.eclipse.cdt.debug.ui"/>
|
||||
</enablement>
|
||||
</action>
|
||||
<action
|
||||
helpContextId="auto_refresh_registers_context"
|
||||
disabledIcon="icons/full/dlcl16/auto_refresh_co.gif"
|
||||
hoverIcon="icons/full/clcl16/auto_refresh_co.gif"
|
||||
toolbarPath="refreshGroup"
|
||||
label="%AutoRefreshAction.label"
|
||||
tooltip="%AutoRefreshAction.tooltip"
|
||||
icon="icons/full/elcl16/auto_refresh_co.gif"
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.AutoRefreshRegistersActionDelegate"
|
||||
style="toggle"
|
||||
state="false"
|
||||
id="org.eclipse.cdt.debug.internal.ui.actions.AutoRefreshRegistersActionDelegate">
|
||||
<enablement>
|
||||
<pluginState
|
||||
value="activated"
|
||||
id="org.eclipse.cdt.debug.ui"/>
|
||||
</enablement>
|
||||
</action>
|
||||
</viewContribution>
|
||||
</extension>
|
||||
<extension
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 QNX Software Systems 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:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
import org.eclipse.cdt.debug.core.ICUpdateManager;
|
||||
import org.eclipse.debug.ui.IDebugView;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.ui.IViewActionDelegate;
|
||||
import org.eclipse.ui.IViewPart;
|
||||
import org.eclipse.ui.actions.ActionDelegate;
|
||||
import org.eclipse.ui.texteditor.IUpdate;
|
||||
|
||||
/**
|
||||
* The superclass for all "Auto-Refresh" action delegates.
|
||||
*/
|
||||
public abstract class AbstractAutoRefreshActionDelegate extends ActionDelegate implements IViewActionDelegate, IUpdate {
|
||||
|
||||
private IAction fAction;
|
||||
private IDebugView fView;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.actions.ActionDelegate#init(org.eclipse.jface.action.IAction)
|
||||
*/
|
||||
public void init( IAction action ) {
|
||||
setAction( action );
|
||||
super.init( action );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
|
||||
*/
|
||||
public void init( IViewPart view ) {
|
||||
setView( view );
|
||||
if ( getView() != null ) {
|
||||
getView().add( this );
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.texteditor.IUpdate#update()
|
||||
*/
|
||||
public void update() {
|
||||
IAction action = getAction();
|
||||
if ( getView() != null && action != null ) {
|
||||
ICUpdateManager um = getUpdateManager( getView().getViewer().getInput() );
|
||||
action.setEnabled( ( um != null ) ? um.canUpdate() : false );
|
||||
action.setChecked( ( um != null ) ? um.getAutoModeEnabled() : false );
|
||||
}
|
||||
}
|
||||
|
||||
public void run( IAction action ) {
|
||||
if ( getView() != null ) {
|
||||
ICUpdateManager um = getUpdateManager( getView().getViewer().getInput() );
|
||||
if ( um != null )
|
||||
um.setAutoModeEnabled( action.isChecked() );
|
||||
}
|
||||
}
|
||||
|
||||
protected IAction getAction() {
|
||||
return fAction;
|
||||
}
|
||||
|
||||
private void setAction( IAction action ) {
|
||||
fAction = action;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.actions.ActionDelegate#dispose()
|
||||
*/
|
||||
public void dispose() {
|
||||
if ( getView() != null )
|
||||
getView().remove( this );
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
protected IDebugView getView() {
|
||||
return fView;
|
||||
}
|
||||
|
||||
private void setView( IViewPart view ) {
|
||||
fView = ( view instanceof IDebugView ) ? (IDebugView)view : null;
|
||||
}
|
||||
|
||||
protected abstract ICUpdateManager getUpdateManager( Object element );
|
||||
}
|
|
@ -78,7 +78,6 @@ public abstract class AbstractRefreshActionDelegate extends ActionDelegate imple
|
|||
action.setEnabled( ( um != null ) ? um.canUpdate() : false );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
import org.eclipse.cdt.debug.core.ICUpdateManager;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.ui.texteditor.IUpdate;
|
||||
|
||||
/**
|
||||
* Enter type comment.
|
||||
*
|
||||
* @since: Feb 10, 2003
|
||||
*/
|
||||
public class AutoRefreshAction extends Action implements IUpdate
|
||||
{
|
||||
private Viewer fViewer = null;
|
||||
|
||||
/**
|
||||
* Constructor for AutoRefreshAction.
|
||||
*/
|
||||
public AutoRefreshAction( Viewer viewer, String text )
|
||||
{
|
||||
super( text, IAction.AS_CHECK_BOX );
|
||||
fViewer = viewer;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.texteditor.IUpdate#update()
|
||||
*/
|
||||
public void update()
|
||||
{
|
||||
if ( fViewer != null && fViewer.getInput() instanceof IAdaptable )
|
||||
{
|
||||
ICUpdateManager uman = (ICUpdateManager)((IAdaptable)fViewer.getInput()).getAdapter( ICUpdateManager.class );
|
||||
if ( uman != null )
|
||||
{
|
||||
setEnabled( uman.canUpdate() );
|
||||
setChecked( uman.getAutoModeEnabled() );
|
||||
return;
|
||||
}
|
||||
}
|
||||
setEnabled( false );
|
||||
setChecked( false );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.action.IAction#run()
|
||||
*/
|
||||
public void run()
|
||||
{
|
||||
if ( fViewer != null && fViewer.getInput() instanceof IAdaptable )
|
||||
{
|
||||
ICUpdateManager uman = (ICUpdateManager)((IAdaptable)fViewer.getInput()).getAdapter( ICUpdateManager.class );
|
||||
if ( uman != null )
|
||||
{
|
||||
uman.setAutoModeEnabled( isChecked() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 QNX Software Systems 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:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
import org.eclipse.cdt.debug.core.ICRegisterManager;
|
||||
import org.eclipse.cdt.debug.core.ICUpdateManager;
|
||||
import org.eclipse.debug.core.model.IDebugElement;
|
||||
|
||||
/**
|
||||
* A delegate for the "Auto-Refresh" action of the Registers view.
|
||||
*/
|
||||
public class AutoRefreshRegistersActionDelegate extends AbstractAutoRefreshActionDelegate {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractAutoRefreshActionDelegate#getUpdateManager(java.lang.Object)
|
||||
*/
|
||||
protected ICUpdateManager getUpdateManager( Object element ) {
|
||||
if ( element instanceof IDebugElement ) {
|
||||
return (ICUpdateManager)((IDebugElement)element).getDebugTarget().getAdapter( ICRegisterManager.class );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 QNX Software Systems 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:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||
|
||||
import org.eclipse.cdt.debug.core.ICSharedLibraryManager;
|
||||
import org.eclipse.cdt.debug.core.ICUpdateManager;
|
||||
import org.eclipse.debug.core.model.IDebugElement;
|
||||
|
||||
/**
|
||||
* A delegate for the "Auto-Refresh" action of the Shared Libraries view.
|
||||
*/
|
||||
public class AutoRefreshSharedLibrariesActionDelegate extends AbstractAutoRefreshActionDelegate {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractAutoRefreshActionDelegate#getUpdateManager(java.lang.Object)
|
||||
*/
|
||||
protected ICUpdateManager getUpdateManager( Object element ) {
|
||||
if ( element instanceof IDebugElement ) {
|
||||
return (ICUpdateManager)((IDebugElement)element).getDebugTarget().getAdapter( ICSharedLibraryManager.class );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue