diff options
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java')
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java index ab9dcdd90..938b6ac52 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java @@ -7,7 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation - * Wind River - Bug 206407 AbstractMemoryRendering connect()s the wrong "this" + * Wind River - Bug 206407 AbstractMemoryRendering connect()s the wrong "this" *******************************************************************************/ package org.eclipse.debug.ui.memory; @@ -41,13 +41,13 @@ import org.eclipse.ui.IWorkbenchActionConstants; * Abstract implementation of a memory rendering. * <p> * To contribute an action to a rendering, an <code>objectContribution</code> can - * be used on a rendering implementation class itself using a + * be used on a rendering implementation class itself using a * <code>popupMenus</code> extension. Additionally, the context menu created * by <code>createPopupMenu()</code> is registered with an identifier of this * rendering's container identifier. Actions may also be contributed to the * container's context menu specifically by using a <code>viewerContribution</code> * on a <code>popupMenus</code> extension that has a <code>targetID</code> referring - * to this rendering container's identifier. + * to this rendering container's identifier. * </p> * <p> * Clients implementing memory renderings must subclass this class. @@ -62,7 +62,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements private boolean fVisible = true; private MenuManager fPopupMenuMgr; private String fRenderingId; - + private class ConnectionJob extends Job { Runnable fRunnable; @@ -79,25 +79,25 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements return Status.OK_STATUS; } } - + /** * Client may provide a label decorator adapter from its memory block * to decorate the label of a rendering. - * @since 3.2 + * @since 3.2 */ private ILabelDecorator fLabelDecorator; private IMenuListener fMenuListener; - + /** * Constructs a new rendering of the given type. - * + * * @param renderingId memory rendering type identifier */ public AbstractMemoryRendering(String renderingId) { fRenderingId = renderingId; } - + /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IMemoryRendering#init(org.eclipse.debug.ui.memory.IMemoryRenderingSite, org.eclipse.debug.core.model.IMemoryBlock) */ @@ -105,7 +105,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements public void init(IMemoryRenderingContainer container, IMemoryBlock block) { fContainer = container; fMemoryBlock = block; - + fLabelDecorator = fMemoryBlock.getAdapter(ILabelDecorator.class); } @@ -121,11 +121,11 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements Runnable runnable = new Runnable(){ @Override public void run() { - ((IMemoryBlockExtension)fMemoryBlock).disconnect(AbstractMemoryRendering.this); + ((IMemoryBlockExtension)fMemoryBlock).disconnect(AbstractMemoryRendering.this); }}; new ConnectionJob(runnable).schedule(); } - + if (fPopupMenuMgr != null) { fPopupMenuMgr.removeMenuListener(fMenuListener); @@ -133,7 +133,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements fPopupMenuMgr.dispose(); fPopupMenuMgr = null; } - + if (fPropertyListeners != null) fPropertyListeners = null; } @@ -165,13 +165,13 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements @Override public void becomesVisible() { fVisible = true; - + if (fMemoryBlock instanceof IMemoryBlockExtension) { Runnable runnable = new Runnable(){ @Override public void run() { - ((IMemoryBlockExtension)fMemoryBlock).connect(AbstractMemoryRendering.this); + ((IMemoryBlockExtension)fMemoryBlock).connect(AbstractMemoryRendering.this); }}; new ConnectionJob(runnable).schedule(); } @@ -188,7 +188,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements Runnable runnable = new Runnable(){ @Override public void run() { - ((IMemoryBlockExtension)fMemoryBlock).disconnect(AbstractMemoryRendering.this); + ((IMemoryBlockExtension)fMemoryBlock).disconnect(AbstractMemoryRendering.this); }}; new ConnectionJob(runnable).schedule(); } @@ -216,10 +216,10 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements */ @Override public void addPropertyChangeListener(IPropertyChangeListener listener) { - + if (fPropertyListeners == null) fPropertyListeners = new ListenerList<>(); - + fPropertyListeners.add(listener); } @@ -228,7 +228,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements */ @Override public void removePropertyChangeListener(IPropertyChangeListener listener) { - + if (fPropertyListeners == null) return; fPropertyListeners.remove(listener); @@ -241,18 +241,18 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements public Image getImage() { return decorateImage(null); } - + /** * Decorates and returns this rendering's image. - * + * * @param image base image * @return decorated image * @since 3.2 - */ + */ protected Image decorateImage(Image image) { if (fLabelDecorator != null) return fLabelDecorator.decorateImage(image, this); - return image; + return image; } /* (non-Javadoc) @@ -263,26 +263,26 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements { if (fMemoryBlock == null) return IInternalDebugCoreConstants.EMPTY_STRING; - + StringBuffer label = new StringBuffer(IInternalDebugCoreConstants.EMPTY_STRING); - + if (fMemoryBlock instanceof IMemoryBlockExtension) { String expression = ((IMemoryBlockExtension)fMemoryBlock).getExpression(); - + if (expression == null) expression = IInternalDebugCoreConstants.EMPTY_STRING; - + label.append(expression); - + if (expression.startsWith("&")) //$NON-NLS-1$ - label.insert(0, "&"); //$NON-NLS-1$ - + label.insert(0, "&"); //$NON-NLS-1$ + // show full address if the rendering is visible // hide address if the rendering is invisible try { if (fVisible && ((IMemoryBlockExtension)fMemoryBlock).getBigBaseAddress() != null) - { + { label.append(" : 0x"); //$NON-NLS-1$ label.append(((IMemoryBlockExtension)fMemoryBlock).getBigBaseAddress().toString(16).toUpperCase()); } @@ -295,13 +295,13 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements long address = fMemoryBlock.getStartAddress(); label.append(Long.toHexString(address).toUpperCase()); } - + IMemoryRenderingType type = DebugUITools.getMemoryRenderingManager().getRenderingType(getRenderingId()); - + if (type != null) { String preName = type.getLabel(); - + if (preName != null) { label.append(" <"); //$NON-NLS-1$ @@ -309,13 +309,13 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements label.append(">"); //$NON-NLS-1$ } } - + return decorateLabel(label.toString()); } - + /** * Decorates and returns this rendering's label. - * + * * @param label base label * @return decorated label * @since 3.2 @@ -323,24 +323,24 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements protected String decorateLabel(String label) { if (fLabelDecorator != null) return fLabelDecorator.decorateText(label.toString(), this); - return label.toString(); + return label.toString(); } - + /** * Helper method for creating a pop up menu in the rendering for a control. * Call this method when a context menu is required for a control * in a rendering. * <p> * To contribute an action to a rendering, an <code>objectContribution</code> can - * be used on a rendering implementation class itself using a + * be used on a rendering implementation class itself using a * <code>popupMenus</code> extension. Additionally, the context menu created * by this method is registered with an identifier of this rendering's container. - * Actions may also be contributed to the context menu specifically by using a + * Actions may also be contributed to the context menu specifically by using a * <code>viewerContribution</code> on a <code>popupMenus</code> extension - * that has a <code>targetID</code> referring to this rendering container's identifier. + * that has a <code>targetID</code> referring to this rendering container's identifier. * </p> * <p> - * Clients are expected to become a menu listener for their pop up + * Clients are expected to become a menu listener for their pop up * menu if they require to fill the context menu for the rendering. * </p> * @param control - control to create the pop up menu for @@ -353,37 +353,37 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements fPopupMenuMgr.setRemoveAllWhenShown(true); IMemoryRenderingSite site = fContainer.getMemoryRenderingSite(); String menuId = fContainer.getId(); - + ISelectionProvider selProvider = site.getSite().getSelectionProvider(); - + fMenuListener = new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); }}; fPopupMenuMgr.addMenuListener(fMenuListener); - + site.getSite().registerContextMenu(menuId, fPopupMenuMgr, selProvider); } - + Menu popupMenu = fPopupMenuMgr.createContextMenu(control); control.setMenu(popupMenu); } - + /** * Returns the pop up menu manager for this rendering, or <code>null</code> * if none. - * + * * @return the pop up menu manager for this rendering, or <code>null</code> */ protected MenuManager getPopupMenuManager() { return fPopupMenuMgr; } - + /** * Fires the given event to all registered listeners. - * + * * @param event the event to fire */ protected void firePropertyChangedEvent(PropertyChangeEvent event) @@ -396,10 +396,10 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements SafeRunner.run(notifier); } } - + /** * Returns the container hosting this memory rendering. - * + * * @return the container hosting this memory rendering */ public IMemoryRenderingContainer getMemoryRenderingContainer() @@ -409,7 +409,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements /** * Returns whether this rendering is currently visible. - * + * * @return whether this rendering is currently visible */ public boolean isVisible() { |