1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

New implementation of the "Refresh" actions for registers and shared libraries.

This commit is contained in:
Mikhail Khodjaiants 2004-06-09 19:11:54 +00:00
parent 585d6a4aac
commit a3b99f7790
17 changed files with 301 additions and 75 deletions

View file

@ -1,3 +1,16 @@
2004-06-09 Mikhail Khodjaiants
New implementation of the "Refresh" actions for registers and shared libraries.
* icons/full/clcl16/auto_refresh_co.gif: new
* icons/full/clcl16/refresh_co.gif: new
* plugin.properties
* plugin.xml
* CDebugImages.java
* AbstractRefreshActionDelegate.java: new
* RefreshRegistersAction.java: new
* RefreshSharedLibrariesAction.java: new
* SharedLibrariesView.java
* Refreshaction.java: removed
2004-06-08 Mikhail Khodjaiants
Warning clean-up.
* DebugTextHover.java

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 170 B

View file

@ -101,3 +101,6 @@ DisassemblySourceLineColor.label=Disassembly Source Line text color
DisassemblySourceLineColor.description=The color used in the Disassembly view for source lines.
DisassemblyFontDefinition.label=Disassembly View text font
DisassemblyFontDefinition.description=The font used in the Disassembly view.
RefreshAction.label=Refresh
RefreshAction.tooltip=Refresh View's Content

View file

@ -535,6 +535,21 @@
<viewerContribution
targetID="org.eclipse.cdt.debug.ui.SharedLibrariesView"
id="org.eclipse.cdt.debug.ui.SharedLibrariesViewPopupActions">
<action
helpContextId="refresh_shared_libraries_context"
label="%RefreshAction.label"
tooltip="%RefreshAction.tooltip"
icon="icons/full/elcl16/refresh_co.gif"
class="org.eclipse.cdt.debug.internal.ui.actions.RefreshSharedLibrariesAction"
style="push"
menubarPath="refreshGroup"
id="org.eclipse.cdt.debug.internal.ui.actions.RefreshSharedLibrariesAction">
<enablement>
<pluginState
value="activated"
id="org.eclipse.cdt.debug.ui"/>
</enablement>
</action>
</viewerContribution>
<objectContribution
objectClass="org.eclipse.cdt.debug.core.model.ICSharedLibrary"
@ -755,6 +770,31 @@
</selection>
</action>
</viewerContribution>
<viewerContribution
targetID="org.eclipse.debug.ui.RegisterView"
id="org.eclipse.debug.ui.registersView.popupMenu">
<menu
label="%Dummy"
id="org.eclipse.cdt.debug.ui.refresh">
<separator name="refreshGroup"/>
<separator name="emptyRefreshGroup"/>
</menu>
<action
helpContextId="refresh_registers_context"
label="%RefreshAction.label"
tooltip="%RefreshAction.tooltip"
icon="icons/full/elcl16/refresh_co.gif"
class="org.eclipse.cdt.debug.internal.ui.actions.RefreshRegistersAction"
style="push"
menubarPath="refreshGroup"
id="org.eclipse.cdt.debug.internal.ui.actions.RefreshRegistersAction">
<enablement>
<pluginState
value="activated"
id="org.eclipse.cdt.debug.ui"/>
</enablement>
</action>
</viewerContribution>
</extension>
<extension
point="org.eclipse.ui.viewActions">
@ -919,6 +959,54 @@
</enablement>
</action>
</viewContribution>
<viewContribution
targetID="org.eclipse.cdt.debug.ui.SharedLibrariesView"
id="org.eclipse.debug.ui.sharedLibrariesView.toolbar">
<action
helpContextId="refresh_shared_libraries_context"
disabledIcon="icons/full/dlcl16/refresh_co.gif"
hoverIcon="icons/full/clcl16/refresh_co.gif"
toolbarPath="refreshGroup"
label="%RefreshAction.label"
tooltip="%RefreshAction.tooltip"
icon="icons/full/elcl16/refresh_co.gif"
class="org.eclipse.cdt.debug.internal.ui.actions.RefreshSharedLibrariesAction"
style="push"
id="org.eclipse.cdt.debug.internal.ui.actions.RefreshSharedLibrariesAction">
<enablement>
<pluginState
value="activated"
id="org.eclipse.cdt.debug.ui"/>
</enablement>
</action>
</viewContribution>
<viewContribution
targetID="org.eclipse.debug.ui.RegisterView"
id="org.eclipse.debug.ui.registersView.toolbar">
<menu
label="%Dummy"
id="org.eclipse.cdt.debug.ui.refresh">
<separator name="refreshGroup"/>
<separator name="emptyRefreshGroup"/>
</menu>
<action
helpContextId="refresh_registers_context"
disabledIcon="icons/full/dlcl16/refresh_co.gif"
hoverIcon="icons/full/clcl16/refresh_co.gif"
toolbarPath="refreshGroup"
label="%RefreshAction.label"
tooltip="%RefreshAction.tooltip"
icon="icons/full/elcl16/refresh_co.gif"
class="org.eclipse.cdt.debug.internal.ui.actions.RefreshRegistersAction"
style="push"
id="org.eclipse.cdt.debug.internal.ui.actions.RefreshRegistersAction">
<enablement>
<pluginState
value="activated"
id="org.eclipse.cdt.debug.ui"/>
</enablement>
</action>
</viewContribution>
</extension>
<extension
point="org.eclipse.ui.editorActions">

View file

@ -96,8 +96,8 @@ public class CDebugImages
public static final String IMG_LCL_TYPE_NAMES = NAME_PREFIX + "tnames_co.gif"; //$NON-NLS-1$
public static final String IMG_LCL_CHANGE_REGISTER_VALUE = NAME_PREFIX + "change_reg_value_co.gif"; //$NON-NLS-1$
public static final String IMG_LCL_AUTO_REFRESH = NAME_PREFIX + "autorefresh_mem.gif"; //$NON-NLS-1$
public static final String IMG_LCL_REFRESH = NAME_PREFIX + "refresh_mem.gif"; //$NON-NLS-1$
public static final String IMG_LCL_AUTO_REFRESH = NAME_PREFIX + "auto_refresh_co.gif"; //$NON-NLS-1$
public static final String IMG_LCL_REFRESH = NAME_PREFIX + "refresh_co.gif"; //$NON-NLS-1$
public static final String IMG_LCL_MEMORY_SAVE = NAME_PREFIX + "memory_update.gif"; //$NON-NLS-1$
public static final String IMG_LCL_MEMORY_CLEAR = NAME_PREFIX + "memory_clear.gif"; //$NON-NLS-1$
public static final String IMG_LCL_SHOW_ASCII = NAME_PREFIX + "show_ascii.gif"; //$NON-NLS-1$

View file

@ -0,0 +1,128 @@
/**********************************************************************
* 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.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.ui.IDebugView;
import org.eclipse.jface.action.IAction;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionDelegate;
import org.eclipse.ui.texteditor.IUpdate;
/**
* The superclass for all "Refresh" action delegates.
*/
public abstract class AbstractRefreshActionDelegate extends ActionDelegate implements IViewActionDelegate, IUpdate {
private IAction fAction;
private IDebugView fView;
/* (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.actions.ActionDelegate#init(org.eclipse.jface.action.IAction)
*/
public void init( IAction action ) {
setAction( action );
super.init( 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;
}
/* (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 );
}
}
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
public void run( IAction action ) {
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(), DebugException.REQUEST_FAILED, "", null ); //$NON-NLS-1$
BusyIndicator.showWhile( Display.getCurrent(), new Runnable() {
public void run() {
try {
doAction();
}
catch( DebugException e ) {
ms.merge( e.getStatus() );
}
}
} );
if ( !ms.isOK() ) {
IWorkbenchWindow window = DebugUIPlugin.getActiveWorkbenchWindow();
if ( window != null ) {
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString( "internal.ui.actions.RefreshAction.Unable_to_refresh" ), ms.getChildren()[0] ); //$NON-NLS-1$
}
else {
DebugUIPlugin.log( ms );
}
}
}
protected IAction getAction() {
return fAction;
}
private void setAction( IAction action ) {
fAction = action;
}
protected void doAction() throws DebugException {
if ( getView() != null ) {
ICUpdateManager um = getUpdateManager( getView().getViewer().getInput() );
if ( um != null )
um.update();
}
}
protected abstract ICUpdateManager getUpdateManager( Object element );
}

View file

@ -1,72 +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.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.DebugException;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.ui.texteditor.IUpdate;
/**
* Enter type comment.
*
* @since: Feb 10, 2003
*/
public class RefreshAction extends Action implements IUpdate
{
private Viewer fViewer = null;
/**
* Constructor for RefreshAction.
*/
public RefreshAction( Viewer viewer, String text )
{
super( text );
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() );
return;
}
}
setEnabled( 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 )
{
try
{
uman.update();
}
catch( DebugException e )
{
CDebugUIPlugin.errorDialog( CDebugUIPlugin.getResourceString("internal.ui.actions.RefreshAction.Unable_to_refresh"), e.getStatus() ); //$NON-NLS-1$
}
}
}
}
}

View file

@ -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 "Refresh" action of the Registers view.
*/
public class RefreshRegistersAction extends AbstractRefreshActionDelegate {
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractRefreshActionDelegate#getUpdateManager(java.lang.Object)
*/
protected ICUpdateManager getUpdateManager( Object element ) {
if ( element instanceof IDebugElement ) {
return (ICUpdateManager)((IDebugElement)element).getDebugTarget().getAdapter( ICRegisterManager.class );
}
return null;
}
}

View file

@ -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 "Refresh" action of the Shared Libraries view.
*/
public class RefreshSharedLibrariesAction extends AbstractRefreshActionDelegate {
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.internal.ui.actions.RefreshActionDelegate#getUpdateManager(java.lang.Object)
*/
protected ICUpdateManager getUpdateManager( Object element ) {
if ( element instanceof IDebugElement ) {
return (ICUpdateManager)((IDebugElement)element).getDebugTarget().getAdapter( ICSharedLibraryManager.class );
}
return null;
}
}

View file

@ -20,6 +20,7 @@ import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler;
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandlerView;
import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.ui.IDebugUIConstants;
@ -155,6 +156,8 @@ public class SharedLibrariesView extends AbstractDebugEventHandlerView
* @see org.eclipse.debug.ui.AbstractDebugView#fillContextMenu(IMenuManager)
*/
protected void fillContextMenu( IMenuManager menu ) {
menu.add( new Separator( ICDebugUIConstants.EMPTY_REFRESH_GROUP ) );
menu.add( new Separator( ICDebugUIConstants.REFRESH_GROUP ) );
menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
updateObjects();
}
@ -163,6 +166,7 @@ public class SharedLibrariesView extends AbstractDebugEventHandlerView
* @see org.eclipse.debug.ui.AbstractDebugView#configureToolBar(IToolBarManager)
*/
protected void configureToolBar( IToolBarManager tbm ) {
tbm.add( new Separator( ICDebugUIConstants.REFRESH_GROUP ) );
}
/* (non-Javadoc)