diff options
author | Darin Wright | 2004-11-17 05:24:08 +0000 |
---|---|---|
committer | Darin Wright | 2004-11-17 05:24:08 +0000 |
commit | 06a3feeb2b9f6017358d43e8b8ebeee9df51c1aa (patch) | |
tree | b79e8d4f3b9a7a56b07a5459098961ba0ed27c97 /org.eclipse.debug.core | |
parent | a08d6eeb31ebf724dcc7904132a8fd053afc4640 (diff) | |
download | eclipse.platform.debug-06a3feeb2b9f6017358d43e8b8ebeee9df51c1aa.tar.gz eclipse.platform.debug-06a3feeb2b9f6017358d43e8b8ebeee9df51c1aa.tar.xz eclipse.platform.debug-06a3feeb2b9f6017358d43e8b8ebeee9df51c1aa.zip |
[applied patch] Bug 78423 - Enhancements to Memory Rendering Extension Point
Diffstat (limited to 'org.eclipse.debug.core')
15 files changed, 0 insertions, 1827 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java index 574062c5f..8036e3a2b 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java @@ -483,8 +483,6 @@ public class DebugPlugin extends Plugin { fMemoryBlockManager.shutdown(); } - MemoryBlockManager.pluginShutdown(); - if (fEventListeners != null) { fEventListeners.removeAll(); } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/MemoryBlockManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/MemoryBlockManager.java index aa1b182c0..b92c504c7 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/MemoryBlockManager.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/MemoryBlockManager.java @@ -24,8 +24,6 @@ import org.eclipse.debug.core.model.IDebugTarget; import org.eclipse.debug.core.model.IMemoryBlock; import org.eclipse.debug.core.model.IMemoryBlockExtension; import org.eclipse.debug.core.model.IMemoryBlockRetrieval; -import org.eclipse.debug.internal.core.memory.IMemoryRenderingManager; -import org.eclipse.debug.internal.core.memory.MemoryRenderingManager; /** @@ -49,12 +47,6 @@ public class MemoryBlockManager implements IMemoryBlockManager, IDebugEventSetLi private static final int ADDED = 0; private static final int REMOVED = 1; /** - * The singleton memory rendering manager. - */ - private static MemoryRenderingManager fgMemoryRenderingManager; - - - /** * Notifies a memory block listener in a safe runnable to * handle exceptions. */ @@ -319,29 +311,5 @@ public class MemoryBlockManager implements IMemoryBlockManager, IDebugEventSetLi memoryBlocks = null; } } - - - /** - * Returns the memory rendering manager. - * @return the memory rendering manager. - * @see IMemoryRenderingManager - * @since 3.0 - */ - public static IMemoryRenderingManager getMemoryRenderingManager() { - if (fgMemoryRenderingManager == null) - { - fgMemoryRenderingManager = new MemoryRenderingManager(); - } - - return fgMemoryRenderingManager; - } - - public static void pluginShutdown() { - - if (fgMemoryRenderingManager != null) { - fgMemoryRenderingManager.shutdown(); - } - - } } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IDynamicRenderingFactory.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IDynamicRenderingFactory.java deleted file mode 100644 index fb3aa0560..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IDynamicRenderingFactory.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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.debug.internal.core.memory; - - - -/** - * Class for creating a list of dynamic rendering types. - * @since 3.0 - */ -public interface IDynamicRenderingFactory { - - /** - * @return a list of dynamic rendering types - */ - IDynamicRenderingInfo [] getRenderingInfos(); -} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IDynamicRenderingInfo.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IDynamicRenderingInfo.java deleted file mode 100644 index f2a4f4a70..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IDynamicRenderingInfo.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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.debug.internal.core.memory; - - -/** - * This interface represents a dynamic rendering type to be determined - * by debug providers at runtime. - * - * Dynamic rendering types must be tied to a rendering extension. - * When IMemoryRenderingManager.getAllRenderingInfo(Object obj) is called, - * the manager will query for the "dynamicRenderingFactory" property from all rendering extensions. - * - * If this property is defined in the rendering, the rendering defined will be considered - * dynamic. The manager will ask the dynamicRenderingFactory for a list of rendering types. - * - * The manager will create IMemoryRenderingInfo ojbect for each of the dynamic rendering - * type. The dynamic rendering info will have all the properties defined in the extension. - * When one of these dynamic renderings is created, it will use the rendering factory defined - * in the extension to create the rendering. - * @since 3.0 - */ -public interface IDynamicRenderingInfo { - - /** - * @return the parent rendering definition of the dynamic rendering type - */ - IMemoryRenderingInfo getParentRenderingInfo(); - - /** - * @return the rendering id of this rendering - */ - String getRenderingId(); - - /** - * @return the name of this dynamic rendering - */ - String getName(); -} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IMemoryRendering.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IMemoryRendering.java deleted file mode 100644 index e809a902a..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IMemoryRendering.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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.debug.internal.core.memory; - -import org.eclipse.debug.core.model.IMemoryBlock; - - - -/** - * Represent a memory rendering in Memory Rendering View - * @since 3.0 - */ -public interface IMemoryRendering -{ - /** - * @return the memory block of this rendering. - */ - public IMemoryBlock getBlock(); - - /** - * @return the rendering id of this rendering. - */ - public String getRenderingId(); - - -} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IMemoryRenderingFactory.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IMemoryRenderingFactory.java deleted file mode 100644 index 9263b56f8..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IMemoryRenderingFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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.debug.internal.core.memory; - -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IMemoryBlock; - - -/** - * A class to be optionally implemented by plugins that - * wishes to create its own renderings. - * - * If this class is not specified in the redering definition, a default - * factory will be used and an instance of MemoryRendering will be created. - * @since 3.0 - */ -public interface IMemoryRenderingFactory { - - /** - * @param memoryBlock - * @param renderingId - * @return the rendering created. Null if the rendering is not to be created. - * Throws a Debug Exception if an error has occurred. - */ - IMemoryRendering createRendering(IMemoryBlock memoryBlock, String renderingId) throws DebugException; -} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IMemoryRenderingInfo.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IMemoryRenderingInfo.java deleted file mode 100644 index fee4ea291..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IMemoryRenderingInfo.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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.debug.internal.core.memory; - -import org.eclipse.core.runtime.IConfigurationElement; - - -/** - * Store information about a type of rendering - * e.g. raw memory, ascii, ebcdic, integer, etc. - * Extension point org.eclipse.debug.ui.rendering is - * provided to allow plugins to contribute additional rendering - * types. - * @since 3.0 - */ -public interface IMemoryRenderingInfo -{ - /** - * @return the name of the rendering type. - * Name will be used to label the view tab of the rendering - */ - public String getName(); - - /** - * @return the id of this rendering - */ - public String getRenderingId(); - - /** - * Given the property id, get rendering specific property - * Return null if the property is nto available. - * @param propertyId - * @return the value of the given property - */ - public String getProperty(String propertyId); - - /** - * @return the configuration element of the rendering - */ - public IConfigurationElement getConfigElement(); - - /** - * @param propertyId - * @return the configuration element of the property - */ - public IConfigurationElement getPropertyConfigElement(String propertyId); - - /** - * @return the configuration element of all the properties - */ - public IConfigurationElement[] getAllProperties(); -} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IMemoryRenderingListener.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IMemoryRenderingListener.java deleted file mode 100644 index a97c4d59e..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IMemoryRenderingListener.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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.debug.internal.core.memory; - - - - -/** - * Rendering listeners listen for add/removal events from IMemoryRenderingManager. - * Implementors should add itself to IMemoryRenderingManager - * @since 3.0 - */ -public interface IMemoryRenderingListener -{ - /** - * This function is called when a new rendering is added. - * @param rendering - */ - void MemoryBlockRenderingAdded(IMemoryRendering rendering); - - /** - * Fired when a memory rendering is removed. - * @param rendering - */ - void MemoryBlockRenderingRemoved(IMemoryRendering rendering); -} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IMemoryRenderingManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IMemoryRenderingManager.java deleted file mode 100644 index da0231829..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/IMemoryRenderingManager.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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.debug.internal.core.memory; - -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.core.model.IMemoryBlock; - - -/** - * Manages all memory renderings in the workbench. - * @since 3.0 - */ -public interface IMemoryRenderingManager -{ - /** - * Tell the manager to add a new memory rendering - * @param mem - * @param renderingId - * @return the IMemoryRendering object created - */ - public IMemoryRendering addMemoryBlockRendering(IMemoryBlock mem, String renderingId) throws DebugException; - - - /** - * Tell the manager that a memory rendering has been removed. - * Remove all renderings with that same memory block and rendering ids - * @param mem - */ - public void removeMemoryBlockRendering(IMemoryBlock mem, String renderingId); - - /** - * Add the specified rendering from the manager and notify listeners - * @param rendering - */ - public void addMemoryBlockRendering(IMemoryRendering rendering) throws DebugException; - - /** - * Remove the specified rendering from the manager and notify listeners - * @param rendering - */ - public void removeMemoryBlockRendering(IMemoryRendering rendering); - - /** - * Add a listener to the memory rendering manager. - * @param listener - */ - public void addListener(IMemoryRenderingListener listener); - - - /** - * Remove a listener from the memory rendering manager. - * @param listener - */ - public void removeListener(IMemoryRenderingListener listener); - - /** - * Get renderings based on given memory block and rendering id. - * Return all renderings related to the memory block if renderingId - * is null. - * Return an empty array if the rendering cannot be found. - * @param mem - * @param renderingId - */ - public IMemoryRendering[] getRenderings(IMemoryBlock mem, String renderingId); - - /** - * Get all memory renderings from the given debug target - * Return an empty array if nothing can be found for the debug target. - * @param target - * @return all memory renderings from the given debug target - */ - public IMemoryRendering[] getRenderingsFromDebugTarget(IDebugTarget target); - - /** - * Get all memory renderings from the given memory block - * Return an empty array if nothing can be found for the memory block. - * @param block - * @return all memory renderings from the given memory block - */ - public IMemoryRendering[] getRenderingsFromMemoryBlock(IMemoryBlock block); - - /** - * @param renderingId - * @return rendering information of the given rendering id - */ - public IMemoryRenderingInfo getRenderingInfo(String renderingId); - - /** - * @param obj - * @return all rendering information valid for the given object - */ - public IMemoryRenderingInfo[] getAllRenderingInfo(Object obj); - - /** - * @param obj - * @return default renderings' ids for the given object - */ - public String[] getDefaultRenderings(Object obj); - -} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/MemoryRendering.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/MemoryRendering.java deleted file mode 100644 index fb84b2f91..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/MemoryRendering.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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.debug.internal.core.memory; - -import org.eclipse.debug.core.model.IMemoryBlock; - - -/** - * Implementation of IMemoryRendering - * @since 3.0 - */ -public class MemoryRendering implements IMemoryRendering -{ - private IMemoryBlock fBlock; - private String fRenderingId; - - - public MemoryRendering(IMemoryBlock block, String renderingId) - { - fBlock = block; - fRenderingId = renderingId; - } - - /** - * @return the memory block that this rendering displays - */ - public IMemoryBlock getBlock() - { - return fBlock; - } - - - /* (non-Javadoc) - * @see org.eclipse.debug.internal.core.memory.IMemoryRendering#getRenderingId() - */ - public String getRenderingId() - { - return fRenderingId; - } - - -} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/MemoryRenderingInfo.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/MemoryRenderingInfo.java deleted file mode 100644 index 770c0a966..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/MemoryRenderingInfo.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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.debug.internal.core.memory; - -import java.util.Enumeration; -import java.util.Hashtable; -import org.eclipse.core.runtime.IConfigurationElement; - - -/** - * Implementation of IMemoryRenderingInfo - * This class is for holding rendering information about a type - * of rendering. - * @since 3.0 - */ -public class MemoryRenderingInfo implements IMemoryRenderingInfo -{ - private String fRenderingId; // id of the type of rendering - private String fName; // name of the type of rendering - private Hashtable fProperties; // list of properties for the rendering type - private IConfigurationElement fElement; // configuration element defining this rendering type - - private static final String VALUE = "value"; //$NON-NLS-1$ - - public MemoryRenderingInfo(String renderingId, String name,IConfigurationElement element) - { - fRenderingId = renderingId; - fName = name; - fElement = element; - } - /** - * @return the rendering id - */ - public String getRenderingId() - { - return fRenderingId; - } - - /** - * @return the name of the rendering type - */ - public String getName() - { - return fName; - } - - /** - * Add a property to the rendering type. - * @param propertyId - * @param element - */ - public void addProperty(String propertyId, IConfigurationElement element){ - if (fProperties == null){ - fProperties = new Hashtable(); - } - - if (propertyId != null && element != null) - { - fProperties.put(propertyId, element); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IMemoryRenderingInfo#getProperty(java.lang.String) - */ - public String getProperty(String propertyId) { - - if (fProperties != null) - { - IConfigurationElement element = (IConfigurationElement)fProperties.get(propertyId); - - if (element != null) - { - String ret = element.getAttribute(VALUE); - return ret; - } - - return null; - } - - return null; - } - - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IMemoryRenderingInfo#getElement() - */ - public IConfigurationElement getConfigElement() { - return fElement; - } - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IMemoryRenderingInfo#getPropertyElement(java.lang.String) - */ - public IConfigurationElement getPropertyConfigElement(String propertyId) { - if (fProperties != null) - { - IConfigurationElement element = (IConfigurationElement)fProperties.get(propertyId); - return element; - } - return null; - } - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IMemoryRenderingInfo#getAllProperties() - */ - public IConfigurationElement[] getAllProperties() { - - Enumeration enumeration = fProperties.elements(); - IConfigurationElement[] elements = new IConfigurationElement[fProperties.size()]; - - int i=0; - while (enumeration.hasMoreElements()) - { - elements[i] = (IConfigurationElement)enumeration.nextElement(); - i++; - } - - return elements; - } - - -} diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/MemoryRenderingManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/MemoryRenderingManager.java deleted file mode 100644 index a0e90b584..000000000 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/memory/MemoryRenderingManager.java +++ /dev/null @@ -1,1040 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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.debug.internal.core.memory; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.StringTokenizer; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.ISafeRunnable; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.IDebugEventSetListener; -import org.eclipse.debug.core.IMemoryBlockListener; -import org.eclipse.debug.core.model.IDebugTarget; -import org.eclipse.debug.core.model.IMemoryBlock; -import org.eclipse.debug.internal.core.DebugCoreMessages; - -/** - * @since 3.0 - */ - -public class MemoryRenderingManager implements IMemoryRenderingManager, IDebugEventSetListener, IMemoryBlockListener -{ - private ArrayList listeners = new ArrayList(); - private ArrayList fRenderings = new ArrayList(); - private Hashtable fMemoryRenderingInfo = new Hashtable(); - private ArrayList fRenderingInfoOrderList = new ArrayList(); - private Hashtable fDefaultRenderings = new Hashtable(); - private Hashtable fRenderingBinds = new Hashtable(); - private Hashtable fDynamicRenderingMap = new Hashtable(); - private Hashtable fDynamicRenderingFactory = new Hashtable(); - - private static final int ADDED = 0; - private static final int REMOVED = 1; - - private static final String RENDERING_EXT = "memoryRenderings"; //$NON-NLS-1$ - private static final String RENDERING_ELEMENT = "rendering"; //$NON-NLS-1$ - private static final String RENDERING_PROPERTY_ELEMENT = "rendering_property"; //$NON-NLS-1$ - private static final String RENDERING_ID = "renderingId"; //$NON-NLS-1$ - private static final String NAME = "name"; //$NON-NLS-1$ - private static final String VALUE = "value"; //$NON-NLS-1$ - private static final String DEFAULT_RENDERING="default_renderings"; //$NON-NLS-1$ - private static final String MEMORYBLOCKCLASS = "memoryBlockClass"; //$NON-NLS-1$ - private static final String RENDERINGS="renderingIds"; //$NON-NLS-1$ - private static final String RENDERING_BIND = "rendering_binding"; //$NON-NLS-1$ - private static final String RENDERING_FACTORY = "renderingFactory"; //$NON-NLS-1$ - private static final String DYNAMIC_RENDERING_FACTORY = "dynamicRenderingFactory"; //$NON-NLS-1$ - - /** - * Notifies a memory block listener in a safe runnable to - * handle exceptions. - */ - class MemoryRenderingManagerNotifier implements ISafeRunnable { - - private IMemoryRenderingListener fListener; - private int fType; - private IMemoryRendering fRendering; - - /** - * @see org.eclipse.core.runtime.ISafeRunnable#handleException(java.lang.Throwable) - */ - public void handleException(Throwable exception) { - DebugPlugin.log(exception); - } - - /** - * @see org.eclipse.core.runtime.ISafeRunnable#run() - */ - public void run() throws Exception { - switch (fType) { - case ADDED: - fListener.MemoryBlockRenderingAdded(fRendering); - break; - case REMOVED: - fListener.MemoryBlockRenderingRemoved(fRendering); - break; - } - } - - /** - * Notfied listeners of added/removed rendering events - */ - public void notify(int update, IMemoryRendering rendering) { - if (listeners != null) { - fType = update; - fRendering = rendering; - Object[] copiedListeners= listeners.toArray(new IMemoryRenderingListener[listeners.size()]); - for (int i= 0; i < copiedListeners.length; i++) { - fListener = (IMemoryRenderingListener)copiedListeners[i]; - Platform.run(this); - } - } - fListener = null; - } - } - - public MemoryRenderingManager() - { - DebugPlugin.getDefault().getMemoryBlockManager().addListener(this); - buildMemoryRenderingInfo(); - } - - /** - * Build rendering info in the manager - * Then read in extended rendering types - */ - private void buildMemoryRenderingInfo() - { - // get rendering extensions - getExtendedRendering(); - } - - /** - * Read in and store extension to rendering - */ - private void getExtendedRendering() { - IExtensionPoint rendering= Platform.getExtensionRegistry().getExtensionPoint(DebugPlugin.getUniqueIdentifier(), RENDERING_EXT); - IExtension[] extensions = rendering.getExtensions(); - - for (int i=0; i<extensions.length; i++) - { - IConfigurationElement[] elements = extensions[i].getConfigurationElements(); - - for (int j=0; j<elements.length; j++) - { - if (elements[j].getName().equals(RENDERING_ELEMENT)) - { - addRendering(elements[j]); - } - else if (elements[j].getName().equals(RENDERING_PROPERTY_ELEMENT)) - { - addRenderingProperty(elements[j]); - } - else if (elements[j].getName().equals(DEFAULT_RENDERING)) - { - addDefaultRenderings(elements[j]); - } - else if (elements[j].getName().equals(RENDERING_BIND)) - { - addRenderingBind(elements[j]); - } - else - { - DebugPlugin.logMessage("Unknown element in rendering extenstion: " + elements[j].getName(), null); //$NON-NLS-1$ - } - } - } - } - - /** - * @param element - */ - private void addRendering(IConfigurationElement element) { - - String renderingId = element.getAttribute(RENDERING_ID); - String name = element.getAttribute(NAME); - - // if any of them is null, do not add, log an error - if (renderingId == null || - name == null) - { - String extension = element.getDeclaringExtension().getUniqueIdentifier(); - DebugPlugin.logMessage("Rendering defined is malformed: " + extension, null); //$NON-NLS-1$ - } - else - { - MemoryRenderingInfo info = new MemoryRenderingInfo(renderingId, name, element); - - if (fMemoryRenderingInfo.containsKey(renderingId)) - { - // if a rendering already exists with the same id, log a warning of duplicated rendering - Status status = new Status(IStatus.WARNING, DebugPlugin.getUniqueIdentifier(), 0, - "Duplicated rendering definition: " + renderingId, null); //$NON-NLS-1$ - DebugPlugin.log(status); - } - - fMemoryRenderingInfo.put(renderingId, info); - fRenderingInfoOrderList.add(renderingId); - } - - // get sub-elements from rendering and parse as properties - IConfigurationElement[] subElements = element.getChildren(); - for (int k=0; k < subElements.length; k++) - { - if (subElements[k].getName().equals(RENDERING_PROPERTY_ELEMENT)) - { - addRenderingProperty(subElements[k]); - } - else - { - DebugPlugin.logMessage("Unknown element in rendering extenstion: " + element.getName(), null); //$NON-NLS-1$ - } - } - } - - /** - * @param element - */ - private void addRenderingProperty(IConfigurationElement element) { - String renderingId = element.getAttribute(RENDERING_ID); - String propertyId = element.getAttribute(NAME); - String propertyValue = element.getAttribute(VALUE); - - if (renderingId == null || - propertyId == null || - propertyValue == null) - { - String extension = element.getDeclaringExtension().getUniqueIdentifier(); - DebugPlugin.logMessage("Rendering property defined is malformed: " + extension, null); //$NON-NLS-1$ - } - else - { - // find the rendering - MemoryRenderingInfo info = (MemoryRenderingInfo)fMemoryRenderingInfo.get(renderingId); - - if (info == null){ - DebugPlugin.logMessage("Rendering info for this property is not found: " + propertyId, null); //$NON-NLS-1$ - } - else - { - // add the property to the rendering - info.addProperty(propertyId, element); - } - } - } - - /** - * Process the configuration element into default rendering for - * a type of memory block. - * @param element - */ - private void addDefaultRenderings(IConfigurationElement element) - { - String memoryBlockClass = element.getAttribute(MEMORYBLOCKCLASS); - String renderings = element.getAttribute(RENDERINGS); - - if(memoryBlockClass == null || renderings == null) - { - String extension = element.getDeclaringExtension().getUniqueIdentifier(); - DebugPlugin.logMessage("Default rendering defined is malformed: " + extension, null); //$NON-NLS-1$ - return; - } - - ArrayList renderingsArray = new ArrayList(); - - // seperate renderings and create an array - int idx = renderings.indexOf(","); //$NON-NLS-1$ - if (idx == -1) - { - renderingsArray.add(renderings); - } - else - { - StringTokenizer tokenizer = new StringTokenizer(renderings, ","); //$NON-NLS-1$ - while (tokenizer.hasMoreElements()) - { - String rendering = tokenizer.nextToken(); - - rendering = rendering.trim(); - - // check if rendering is valid - - renderingsArray.add(rendering); - } - } - - if (fDefaultRenderings == null) - { - fDefaultRenderings = new Hashtable(); - } - - // check hash table to see if something is alreay added - ArrayList definedrenderings = (ArrayList)fDefaultRenderings.get(memoryBlockClass); - - if (definedrenderings == null) - { - // add renderings to hashtable - fDefaultRenderings.put(memoryBlockClass, renderingsArray); - } - else - { - for (int i=0; i<renderingsArray.size(); i++) - { - // append to the list - if (!definedrenderings.contains(renderingsArray.get(i))) - { - definedrenderings.add(renderingsArray.get(i)); - } - } - } - } - - private void addRenderingBind(IConfigurationElement element){ - - String memoryBlockClass = element.getAttribute(MEMORYBLOCKCLASS); - String renderings = element.getAttribute(RENDERINGS); - - if(memoryBlockClass == null || renderings == null) - { - String extension = element.getDeclaringExtension().getUniqueIdentifier(); - DebugPlugin.logMessage("Rendering bind defined is malformed: " + extension, null); //$NON-NLS-1$ - return; - } - - ArrayList renderingsArray = new ArrayList(); - - // seperate renderings and create an array - int idx = renderings.indexOf(","); //$NON-NLS-1$ - if (idx == -1) - { - renderingsArray.add(renderings); - } - else - { - StringTokenizer tokenizer = new StringTokenizer(renderings, ","); //$NON-NLS-1$ - while (tokenizer.hasMoreElements()) - { - String rendering = tokenizer.nextToken(); - rendering = rendering.trim(); - - // check if rendering is valid - - renderingsArray.add(rendering); - } - } - - if (fRenderingBinds == null) - { - fRenderingBinds = new Hashtable(); - } - - // check hash table to see if something is alreay added - ArrayList renderingIds = (ArrayList)fRenderingBinds.get(memoryBlockClass); - - if (renderingIds == null) - { - // add renderings to hashtable - fRenderingBinds.put(memoryBlockClass, renderingsArray); - } - else - { - for (int i=0; i<renderingsArray.size(); i++) - { - // append to the list - if (!renderingIds.contains(renderingsArray.get(i))) - { - renderingIds.add(renderingsArray.get(i)); - } - } - } - } - - private MemoryRenderingManagerNotifier getMemoryBlockNotifier() { - return new MemoryRenderingManagerNotifier(); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IMemoryRenderingManager#addMemoryBlockRendering(org.eclipse.debug.core.model.IMemoryBlock, java.lang.String) - */ - public IMemoryRendering addMemoryBlockRendering(IMemoryBlock mem, String renderingId) throws DebugException - { - if (fRenderings == null) - return null; - - IMemoryRendering newRendering = createRendering(mem, renderingId); - - // if an error has occurred, or if user has canceled - if (newRendering == null) - return newRendering; - - if (fRenderings.contains(newRendering)) - return newRendering; - - fRenderings.add(newRendering); - - // add listener for the first memory block added - if (fRenderings.size() == 1) - { - DebugPlugin.getDefault().addDebugEventListener(this); - } - - notifyListeners(ADDED, newRendering); - - return newRendering; - - } - - /** - * @param mem - * @param renderingId - * @return the memory rendering created by the factory or default rendering. - * Returns null if an error has occurred - */ - public IMemoryRendering createRendering(IMemoryBlock mem, String renderingId) throws DebugException{ - IMemoryRenderingInfo info = getRenderingInfo(renderingId); - - if (info != null){ - IConfigurationElement element = info.getConfigElement(); - - if (element != null){ - - String factoryAtt = element.getAttribute(RENDERING_FACTORY); - - if (factoryAtt != null){ - Object obj = null; - try { - obj = element.createExecutableExtension(RENDERING_FACTORY); - } catch (CoreException e) { - - // throw a debug exception due to error - IStatus stat = e.getStatus(); - DebugException de = new DebugException(stat); - throw de; - } - - if (obj == null) - return new MemoryRendering(mem, renderingId); - - if(obj instanceof IMemoryRenderingFactory) - { - IMemoryRenderingFactory factory = (IMemoryRenderingFactory)obj; - - IMemoryRendering rendering = null; - rendering = factory.createRendering(mem, renderingId); - return rendering; - } - } - } - else - { - String message= MessageFormat.format(DebugCoreMessages.getString("MemoryRenderingManager.ErrorMsg"), new String[]{renderingId}); //$NON-NLS-1$ - // throw a debug exception because the rendering info cannot be located - Status status = new Status(IStatus.ERROR, - DebugPlugin.getUniqueIdentifier(), - 0, message , null); //$NON-NLS-1$ - DebugException de = new DebugException(status); - throw de; - } - } - else - { - String message= MessageFormat.format(DebugCoreMessages.getString("MemoryRenderingManager.ErrorMsg"), new String[]{renderingId}); //$NON-NLS-1$ - // throw a debug exception because the rendering info cannot be located - Status status = new Status(IStatus.ERROR, - DebugPlugin.getUniqueIdentifier(), - 0, message, null); //$NON-NLS-1$ - DebugException de = new DebugException(status); - throw de; - } - return new MemoryRendering(mem, renderingId); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IMemoryRenderingManager#removeMemoryBlockRendering(org.eclipse.debug.core.model.IMemoryBlock, java.lang.String) - */ - public void removeMemoryBlockRendering(IMemoryBlock mem, String renderingId) - { - if(fRenderings == null) - return; - - IMemoryRendering[] toRemove = getRenderings(mem, renderingId); - - for (int i=0; i<toRemove.length; i++) - { - fRenderings.remove(toRemove[i]); - - // remove listener after the last memory block has been removed - if (fRenderings.size() == 0) - { - DebugPlugin.getDefault().removeDebugEventListener(this); - } - - notifyListeners(REMOVED, toRemove[i]); - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IMemoryRenderingManager#addMemoryBlockRendering(org.eclipse.debug.ui.IMemoryRendering) - */ - public void addMemoryBlockRendering(IMemoryRendering rendering) throws DebugException{ - - // do not allow duplicated objects - if (fRenderings.contains(rendering)) - return; - - fRenderings.add(rendering); - - // add listener for the first memory block added - if (fRenderings.size() == 1) - { - DebugPlugin.getDefault().addDebugEventListener(this); - } - - notifyListeners(ADDED, rendering); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IMemoryRenderingManager#removeMemoryBlockRendering(org.eclipse.debug.ui.IMemoryRendering) - */ - public void removeMemoryBlockRendering(IMemoryRendering rendering) { - if(rendering == null) - return; - - if(!fRenderings.contains(rendering)) - return; - - fRenderings.remove(rendering); - - // remove listener after the last memory block has been removed - if (fRenderings.size() == 0) - { - DebugPlugin.getDefault().removeDebugEventListener(this); - } - - notifyListeners(REMOVED, rendering); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IMemoryRenderingManager#getRenderings(org.eclipse.debug.core.model.IMemoryBlock, java.lang.String) - */ - public IMemoryRendering[] getRenderings(IMemoryBlock mem, String renderingId) - { - if (renderingId == null) - { - return getRenderingsFromMemoryBlock(mem); - } - - ArrayList ret = new ArrayList(); - for (int i=0; i<fRenderings.size(); i++) - { - if (fRenderings.get(i) instanceof IMemoryRendering) - { - IMemoryRendering rendering = (IMemoryRendering)fRenderings.get(i); - if (rendering.getBlock() == mem && renderingId.equals(rendering.getRenderingId())) - { - ret.add(rendering); - } - } - } - - return (IMemoryRendering[])ret.toArray(new IMemoryRendering[ret.size()]); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IMemoryRenderingManager#getRenderingsFromDebugTarget(org.eclipse.debug.core.model.IDebugTarget) - */ - public IMemoryRendering[] getRenderingsFromDebugTarget(IDebugTarget target) - { - ArrayList ret = new ArrayList(); - for (int i=0; i<fRenderings.size(); i++) - { - if (fRenderings.get(i) instanceof IMemoryRendering) - { - IMemoryRendering rendering = (IMemoryRendering)fRenderings.get(i); - if (rendering.getBlock().getDebugTarget() == target) - { - ret.add(rendering); - } - } - } - - return (IMemoryRendering[])ret.toArray(new IMemoryRendering[ret.size()]); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IMemoryRenderingManager#getRenderingsFromMemoryBlock(org.eclipse.debug.core.model.IMemoryBlock) - */ - public IMemoryRendering[] getRenderingsFromMemoryBlock(IMemoryBlock block) - { - ArrayList ret = new ArrayList(); - for (int i=0; i<fRenderings.size(); i++) - { - if (fRenderings.get(i) instanceof IMemoryRendering) - { - IMemoryRendering rendering = (IMemoryRendering)fRenderings.get(i); - if (rendering.getBlock() == block) - { - ret.add(rendering); - } - } - } - - return (IMemoryRendering[])ret.toArray(new IMemoryRendering[ret.size()]); - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IMemoryRenderingManager#addListener(org.eclipse.debug.ui.IMemoryBlockListener) - */ - public void addListener(IMemoryRenderingListener listener) - { - if(listeners == null) - return; - - if(listener == null){ - DebugPlugin.logMessage("Null argument passed into IMemoryRenderingManager.addListener", null); //$NON-NLS-1$ - return; - } - - if (!listeners.contains(listener)) - listeners.add(listener); - - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IMemoryRenderingManager#removeListener(org.eclipse.debug.ui.IMemoryBlockListener) - */ - public void removeListener(IMemoryRenderingListener listener) - { - if(listeners == null) - return; - - if(listener == null){ - DebugPlugin.logMessage("Null argument passed into IMemoryRenderingManager.removeListener", null); //$NON-NLS-1$ - return; - } - - if (listeners.contains(listener)) - listeners.remove(listener); - - } - - private void notifyListeners(int update, IMemoryRendering rendering) - { - getMemoryBlockNotifier().notify(update, rendering); - } - - - /* (non-Javadoc) - * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[]) - */ - public void handleDebugEvents(DebugEvent[] events) { - - for (int i=0; i < events.length; i++) - handleDebugEvent(events[i]); - - } - - public void handleDebugEvent(DebugEvent event) { - Object obj = event.getSource(); - IDebugTarget dt = null; - - if (event.getKind() == DebugEvent.TERMINATE) - { - // a terminate event could happen from an IThread or IDebugTarget - // Only handle terminate event from debug target - if (obj instanceof IDebugTarget) - { - dt = ((IDebugTarget)obj); - } - - // returns empty array if dt == null - IMemoryRendering[] deletedrendering = getRenderingsFromDebugTarget(dt); - - for (int i=0; i<deletedrendering.length; i++) - { - removeMemoryBlockRendering(deletedrendering[i].getBlock(), deletedrendering[i].getRenderingId()); - } - } - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IMemoryBlockListener#MemoryBlockAdded(org.eclipse.debug.core.model.IMemoryBlock) - */ - public void memoryBlocksAdded(IMemoryBlock[] memoryBlocks) - { - // do nothing when memory blocks are added - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IMemoryBlockListener#MemoryBlockRemoved(org.eclipse.debug.core.model.IMemoryBlock) - */ - public void memoryBlocksRemoved(IMemoryBlock[] memoryBlocks) - { - for (int j=0; j<memoryBlocks.length; j++) - { - IMemoryBlock memory = memoryBlocks[j]; - // remove all renderings related to the deleted memory block - IMemoryRendering[] renderings = getRenderingsFromMemoryBlock(memory); - - for (int i=0; i<renderings.length; i++) - { - removeMemoryBlockRendering(renderings[i].getBlock(), renderings[i].getRenderingId()); - } - } - } - - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IMemoryRenderingManager#getRenderingInfo(java.lang.String) - */ - public IMemoryRenderingInfo getRenderingInfo(String renderingId) - { - MemoryRenderingInfo info = (MemoryRenderingInfo)fMemoryRenderingInfo.get(renderingId); - - if (info != null) { - return info; - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IMemoryRenderingManager#getAllRenderingInfo(java.lang.Object) - */ - public IMemoryRenderingInfo[] getAllRenderingInfo(Object obj) - { - String[] hierarchy = getHierarchy(obj); - - ArrayList renderingIds = new ArrayList(); - ArrayList renderingInfos = new ArrayList(); - - // get all rendering ids - for (int i=0; i<hierarchy.length; i++) - { - ArrayList ids = (ArrayList)fRenderingBinds.get(hierarchy[i]); - - if (ids != null) - { - for (int j=0; j<ids.size(); j++) - { - if (!renderingIds.contains(ids.get(j))) - renderingIds.add(ids.get(j)); - } - } - } - - // get all rendering infos - for (int i=0; i<renderingIds.size(); i++){ - IMemoryRenderingInfo info = (IMemoryRenderingInfo)fMemoryRenderingInfo.get(renderingIds.get(i)); - IDynamicRenderingInfo[] dynamic = null; - - if (info != null) - dynamic = getDynamicRenderingInfo(info); - - if (dynamic != null) - { - for (int j=0; j<dynamic.length; j++) - { - IMemoryRenderingInfo dynamicInfo = (IMemoryRenderingInfo)fMemoryRenderingInfo.get(dynamic[j].getRenderingId()); - renderingInfos.add(dynamicInfo); - } - } - else if (info!= null) - { - renderingInfos.add(info); - } - } - - return (IMemoryRenderingInfo[])renderingInfos.toArray(new IMemoryRenderingInfo[renderingInfos.size()]); - } - - private IDynamicRenderingInfo[] getDynamicRenderingInfo(IMemoryRenderingInfo rendering) - { - IConfigurationElement element = rendering.getPropertyConfigElement(DYNAMIC_RENDERING_FACTORY); - - try { - if (element != null){ - - Object obj; - - obj = fDynamicRenderingFactory.get(rendering.getRenderingId()); - - if (obj == null) - obj = element.createExecutableExtension(VALUE); - - if (obj != null && obj instanceof IDynamicRenderingFactory) - { - fDynamicRenderingFactory.put(rendering.getRenderingId(), obj); - IDynamicRenderingInfo[] dynamicRenderingTypes = ((IDynamicRenderingFactory)obj).getRenderingInfos(); - - if (dynamicRenderingTypes != null) - { - addRenderingInfo(dynamicRenderingTypes); - - // now compare the returned list to what is orginally cached - Enumeration enumeration = fDynamicRenderingMap.keys(); - - while (enumeration.hasMoreElements()) - { - String dynamicRenderingId = (String)enumeration.nextElement(); - String staticRenderingId = (String)fDynamicRenderingMap.get(dynamicRenderingId); - - if (staticRenderingId.equals(rendering.getRenderingId())) - { - boolean found = false; - // check that this dynamic rendering still exists - for (int i=0; i<dynamicRenderingTypes.length; i++) - { - if (dynamicRenderingTypes[i].getRenderingId().equals(dynamicRenderingId)) - { - found = true; - break; - } - } - if (!found) - { - // if the rendering no longer exists, remove rendering info - fMemoryRenderingInfo.remove(dynamicRenderingId); - fDynamicRenderingMap.remove(dynamicRenderingId); - } - } - } - - // update map before returning - String staticRenderingId = rendering.getRenderingId(); - for (int i=0; i<dynamicRenderingTypes.length; i++) - { - fDynamicRenderingMap.put(dynamicRenderingTypes[i].getRenderingId(), staticRenderingId); - } - - return dynamicRenderingTypes; - } - return null; - } - - } - } catch (CoreException e) { - DebugPlugin.logMessage("Cannot create the dynamic rendering factory for " + element.getDeclaringExtension().getUniqueIdentifier(), null); //$NON-NLS-1$ - return null; - } - return null; - } - - private IMemoryRenderingInfo createRenderingInfo(IDynamicRenderingInfo info) - { - if (info == null) - return null; - - if (info.getParentRenderingInfo() == null) - { - DebugPlugin.logMessage("Dynamic rendering info does not have a parent " + info.getRenderingId(), null); //$NON-NLS-1$ - return null; - } - - IMemoryRenderingInfo parent = info.getParentRenderingInfo(); - MemoryRenderingInfo dynamicInfo = new MemoryRenderingInfo(info.getRenderingId(), info.getName(), info.getParentRenderingInfo().getConfigElement()); - - IConfigurationElement[] properties = parent.getAllProperties(); - - for (int i=0; i<properties.length; i++) - { - String name = properties[i].getAttribute(NAME); - if (name != null) - { - if (!name.equals(DYNAMIC_RENDERING_FACTORY)) - dynamicInfo.addProperty(name, properties[i]); - } - } - - return dynamicInfo; - } - - /* (non-Javadoc) - * @see org.eclipse.debug.ui.IMemoryRenderingManager#getDefaultRenderings(java.lang.Object) - */ - public String[] getDefaultRenderings(Object obj) { - - if (fDefaultRenderings == null) - { - return new String[0]; - } - - if (obj == null) - { - return new String[0]; - } - - // get all rendering info supporting the object - IMemoryRenderingInfo[] supported = getAllRenderingInfo(obj); - ArrayList results = new ArrayList(); - - // match it with default renderings - String hierarchy[] = getHierarchy(obj); - - // get defaults for the entire hierarchy - for (int i=0; i<hierarchy.length; i++) - { - ArrayList defaults = (ArrayList)fDefaultRenderings.get(hierarchy[i]); - // if defaults is defined - if (defaults != null) - { - for (int j=0; j<defaults.size(); j++) - { - // check if the default is supported - for (int k=0; k<supported.length; k++) - { - if (supported[k].getRenderingId().equals(defaults.get(j))) - { - results.add(supported[k].getRenderingId()); - } - } - } - } - } - - // return the list - return (String[])results.toArray(new String[results.size()]); - } - - protected void addRenderingInfo (IDynamicRenderingInfo[] dynamicRenderingTypes) - { - if (dynamicRenderingTypes != null) - { - // store in fMemoryRenderingInfo arrays so they can be queried - for (int i=0; i<dynamicRenderingTypes.length; i++) - { - IMemoryRenderingInfo dynamicInfo; - if (fMemoryRenderingInfo.get(dynamicRenderingTypes[i].getRenderingId()) == null) - { - dynamicInfo = createRenderingInfo(dynamicRenderingTypes[i]); - - if (dynamicInfo != null) - { - fMemoryRenderingInfo.put(dynamicRenderingTypes[i].getRenderingId(), dynamicInfo); - } - } - } - } - } - - /** - * @param obj - * @return all superclasses and interfaces - */ - private String[] getHierarchy(Object obj) - { - ArrayList hierarchy = new ArrayList(); - - // get class name - hierarchy.add(obj.getClass().getName()); - - // get all super classes - Class superClass = obj.getClass().getSuperclass(); - - while (superClass != null) - { - hierarchy.add(superClass.getName()); - superClass = superClass.getSuperclass(); - } - - // get all interfaces - ArrayList interfaces = new ArrayList(); - Class[] baseInterfaces = obj.getClass().getInterfaces(); - - for (int i=0; i<baseInterfaces.length; i++) - { - interfaces.add(baseInterfaces[i]); - } - - getInterfaces(interfaces, baseInterfaces); - - for (int i=0; i<interfaces.size(); i++) - { - hierarchy.add(((Class)interfaces.get(i)).getName()); - } - - return (String[])hierarchy.toArray(new String[hierarchy.size()]); - - } - - private void getInterfaces(ArrayList list, Class[] interfaces) - { - Class[] superInterfaces = new Class[0]; - for (int i=0 ;i<interfaces.length; i++) - { - superInterfaces = interfaces[i].getInterfaces(); - - for (int j=0; j<superInterfaces.length; j++) - { - list.add(superInterfaces[j]); - } - - getInterfaces(list, superInterfaces); - } - } - - /** - * Clean up when the plugin is shut down. - */ - public void shutdown() - { - // clean up - if (listeners != null) - { - listeners.clear(); - listeners = null; - } - - if (fRenderings != null) - { - fRenderings.clear(); - fRenderings = null; - } - - if (fMemoryRenderingInfo != null) - { - fMemoryRenderingInfo.clear(); - fMemoryRenderingInfo = null; - } - - if (fRenderingInfoOrderList != null) - { - fRenderingInfoOrderList.clear(); - fRenderingInfoOrderList = null; - } - - if (fDynamicRenderingMap != null) - { - fDynamicRenderingMap.clear(); - fDynamicRenderingMap = null; - } - - if (fDynamicRenderingFactory != null) - { - fDynamicRenderingFactory.clear(); - fDynamicRenderingFactory = null; - } - - // remove listener - DebugPlugin.getDefault().getMemoryBlockManager().removeListener(this); - } -} diff --git a/org.eclipse.debug.core/plugin.properties b/org.eclipse.debug.core/plugin.properties index f412c2bea..c2e3343d0 100644 --- a/org.eclipse.debug.core/plugin.properties +++ b/org.eclipse.debug.core/plugin.properties @@ -27,7 +27,6 @@ processFactoriesExtensionPointName=Process Factories logicalStructureTypesExtensionPointName=Logical Structure Types sourceContainerTypesName = Source Container Types sourcePathComputersName = Source Path Computers -renderingExtensionPointName = Memory Renderings run=&Run debug=&Debug diff --git a/org.eclipse.debug.core/plugin.xml b/org.eclipse.debug.core/plugin.xml index 5e3a70b58..435cfd73e 100644 --- a/org.eclipse.debug.core/plugin.xml +++ b/org.eclipse.debug.core/plugin.xml @@ -33,7 +33,6 @@ <extension-point id="logicalStructureTypes" name="%logicalStructureTypesExtensionPointName" schema="schema/logicalStructureTypes.exsd"/> <extension-point id="sourceContainerTypes" name="%sourceContainerTypesName" schema="schema/sourceContainerTypes.exsd"/> <extension-point id="sourcePathComputers" name="%sourcePathComputersName" schema="schema/sourcePathComputers.exsd"/> - <extension-point id="memoryRenderings" name="%renderingExtensionPointName" schema="schema/memoryRenderings.exsd"/> <!-- Extensions --> <extension diff --git a/org.eclipse.debug.core/schema/memoryRenderings.exsd b/org.eclipse.debug.core/schema/memoryRenderings.exsd deleted file mode 100644 index 397b97170..000000000 --- a/org.eclipse.debug.core/schema/memoryRenderings.exsd +++ /dev/null @@ -1,220 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.debug.core">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.debug.core" id="memoryRenderings" name="Memory Renderings"/>
- </appInfo>
- <documentation>
- Allows plug-ins to contribute renderings for memory blocks. A rendering translates raw bytes of a memory block into text that can be displayed in the memory view. The debug platform provides a HEX memory rendering. NOTE: this extension point was provided in the 3.0 release as experimental API, subject to change, and became public API in the 3.1 release.
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <choice>
- <element ref="rendering" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="rendering_binding" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="default_renderings" minOccurs="0" maxOccurs="unbounded"/>
- </choice>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="rendering">
- <annotation>
- <documentation>
- This element defines a rendering. A rendering is comprised of an id, a name, an optional rendering factory, and an optional list of rendering properties.
- </documentation>
- </annotation>
- <complexType>
- <sequence>
- <element ref="rendering_property" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="renderingId" type="string" use="required">
- <annotation>
- <documentation>
- unique identifier for this rendering
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- human-readable name of this rendering
- </documentation>
- </annotation>
- </attribute>
- <attribute name="renderingFactory" type="string">
- <annotation>
- <documentation>
- optional fully qualified name of the Java class that implements <code>org.eclipse.debug.core.memory.IMemoryRenderingFactory</code>. When unspecified, a default rendering factory will be used.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="rendering_property">
- <annotation>
- <documentation>
- Specifies rendering specific properties.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- human-readable name of this property
- </documentation>
- </annotation>
- </attribute>
- <attribute name="value" type="string" use="required">
- <annotation>
- <documentation>
- value of this property
- </documentation>
- </annotation>
- </attribute>
- <attribute name="renderingId" type="string">
- <annotation>
- <documentation>
- The rendering this property is associated with
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="rendering_binding">
- <annotation>
- <documentation>
- Binds a type of memory block with available renderings.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="memoryBlockTypeId" type="string" use="required">
- <annotation>
- <documentation>
- identifies the type of memory block this binding is for. Corresponds to the identifier returned by <code>IExtendedMemoryBlock.getMemoryBlockType()</code>.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="renderingIds" type="string" use="required">
- <annotation>
- <documentation>
- comma delimited list of memory renderings available for the associated type of memory block
- </documentation>
- </annotation>
- </attribute>
- <attribute name="memoryBlockClass" type="string">
- <annotation>
- <documentation>
- fully qualified name of the Java class implementing a memory block. This attribute is <b>deprecated</b> in release 3.1, and a <code>memoryBlockTypeId</code> must be provided instead.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="default_renderings">
- <annotation>
- <documentation>
- Specifies the default renderings to create for a specific type of memory block.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="memoryBlockTypeId" type="string" use="required">
- <annotation>
- <documentation>
- identifies the type of memory block this default renderings list is for. Corresponds to the identifier returned by <code>IExtendedMemoryBlock.getMemoryBlockType()</code>.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="renderingIds" type="string" use="required">
- <annotation>
- <documentation>
- comma delimited list of of memory renderings to be created by default for memory blocks of the associated type. Memory renderings are specified via their <code>renderingId</code>. An equivalent rendering binding must exist for a default rendering to be considered.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="memoryBlockClass" type="string">
- <annotation>
- <documentation>
- fully qualified name of the Java class implementing a memory block. This attribute is <b>deprecated</b> in release 3.1, and a <code>memoryBlockTypeId</code> must be provided instead.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- Eclipse 3.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2004 IBM Corporation and others.<br> -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 -<a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>
- </documentation>
- </annotation>
-
-</schema>
|