Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/LogicalViewDescriptor.java')
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/LogicalViewDescriptor.java93
1 files changed, 93 insertions, 0 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/LogicalViewDescriptor.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/LogicalViewDescriptor.java
new file mode 100644
index 000000000..6f405f1c1
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/registry/LogicalViewDescriptor.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 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.team.internal.ui.registry;
+
+import org.eclipse.core.runtime.*;
+import org.eclipse.team.ui.synchronize.content.ILogicalView;
+import org.eclipse.team.ui.synchronize.content.LogicalViewProvider;
+import org.eclipse.ui.internal.WorkbenchPlugin;
+
+/**
+ *
+ * TODO: Should have an icon
+ */
+public class LogicalViewDescriptor implements ILogicalView {
+
+ public static final String ATT_ID = "id"; //$NON-NLS-1$
+ public static final String ATT_NAME = "name"; //$NON-NLS-1$
+ public static final String ATT_CLASS = "class"; //$NON-NLS-1$
+
+ private IConfigurationElement element;
+ private String label;
+ private String description;
+ private String className;
+ private String id;
+ private LogicalViewProvider provider;
+
+ public LogicalViewDescriptor(IConfigurationElement element, String descText) throws CoreException {
+ this.element = element;
+ this.description = descText;
+ loadFromExtension();
+ }
+
+ /**
+ * load a view descriptor from the registry.
+ */
+ private void loadFromExtension() throws CoreException {
+ String identifier = element.getAttribute(ATT_ID);
+ label = element.getAttribute(ATT_NAME);
+ className = element.getAttribute(ATT_CLASS);
+
+ // Sanity check.
+ if ((label == null) || (className == null) || (identifier == null)) {
+ throw new CoreException(new Status(IStatus.ERROR, element.getDeclaringExtension().getDeclaringPluginDescriptor().getUniqueIdentifier(), 0, "Invalid extension (missing label or class name): " + identifier, //$NON-NLS-1$
+ null));
+ }
+
+ id = identifier;
+ }
+
+ private LogicalViewProvider createProvider() throws CoreException {
+ Object obj = WorkbenchPlugin.createExtension(element, ATT_CLASS);
+ return (LogicalViewProvider) obj;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.content.ILogicalView#getId()
+ */
+ public String getId() {
+ return id;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.content.ILogicalView#getLabel()
+ */
+ public String getLabel() {
+ return label;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.content.ILogicalView#getDescription()
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.synchronize.content.ILogicalView#getLogicalViewProvider()
+ */
+ public LogicalViewProvider getLogicalViewProvider() throws CoreException {
+ if (provider == null) {
+ provider = createProvider();
+ }
+ return provider;
+ }
+}

Back to the top