diff options
author | Luc Bourlier | 2004-12-13 21:11:34 +0000 |
---|---|---|
committer | Luc Bourlier | 2004-12-13 21:11:34 +0000 |
commit | 3a0dfe96550b9284f84ea2756c0299127827044d (patch) | |
tree | f323ae81b9dc36fc6fae34be6c42be6e6bdc3bfa /org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureProvider.java | |
parent | d2883d85f58bd00424fa1657170524e0aa032efd (diff) | |
download | eclipse.platform.debug-3a0dfe96550b9284f84ea2756c0299127827044d.tar.gz eclipse.platform.debug-3a0dfe96550b9284f84ea2756c0299127827044d.tar.xz eclipse.platform.debug-3a0dfe96550b9284f84ea2756c0299127827044d.zip |
Bug 80332 - logical structure factories
Diffstat (limited to 'org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureProvider.java')
-rw-r--r-- | org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureProvider.java | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureProvider.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureProvider.java new file mode 100644 index 000000000..e7f3dc52d --- /dev/null +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LogicalStructureProvider.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * Copyright (c) 2000, 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; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILogicalStructureProvider; +import org.eclipse.debug.core.ILogicalStructureType; +import org.eclipse.debug.core.model.IValue; + +/** + * Manage logical structure provider extensions + */ +public class LogicalStructureProvider { + + private IConfigurationElement fConfigurationElement; + + private String fModelIdentifier; + + private ILogicalStructureProvider fDelegate; + + public LogicalStructureProvider(IConfigurationElement element) throws CoreException { + fConfigurationElement= element; + fModelIdentifier= fConfigurationElement.getAttribute("modelIdentifier"); //$NON-NLS-1$ + if (fModelIdentifier == null) { + throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, DebugCoreMessages.getString("LogicalStructureProvider.0"), null)); //$NON-NLS-1$ + } + String className= fConfigurationElement.getAttribute("class"); //$NON-NLS-1$ + if (className == null) { + throw new CoreException(new Status(IStatus.ERROR, DebugPlugin.getUniqueIdentifier(), DebugPlugin.INTERNAL_ERROR, DebugCoreMessages.getString("LogicalStructureProvider.1"), null)); //$NON-NLS-1$ + } + } + + /** + * Return the logical structure type able to provide a logical structure for + * the given value. + */ + public ILogicalStructureType[] getLogicalStructures(IValue value) { + if (fModelIdentifier.equals(value.getModelIdentifier())) { + return getDelegate().getLogicalStructureTypes(value); + } + return new ILogicalStructureType[0]; + } + + /** + * Return the ILogicalStructureProvider for this extension. + */ + protected ILogicalStructureProvider getDelegate() { + if (fDelegate == null) { + try { + fDelegate = (ILogicalStructureProvider) fConfigurationElement.createExecutableExtension("class"); //$NON-NLS-1$ + } catch (CoreException e) { + DebugPlugin.log(e); + } + } + return fDelegate; + } + +} |