Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-06-06 17:24:23 +0000
committerUwe Stieber2012-06-06 17:35:50 +0000
commit8214fddbe1e2d05a18c3ddce520bdcd946b04484 (patch)
tree367d4ed8ab530f8c63ef38a2dbf898d12d7b6a7f /target_explorer/plugins/org.eclipse.tcf.te.runtime.model
parent7909093bb812eeb1170e922d3dcfb66b2bae648a (diff)
downloadorg.eclipse.tcf-8214fddbe1e2d05a18c3ddce520bdcd946b04484.tar.gz
org.eclipse.tcf-8214fddbe1e2d05a18c3ddce520bdcd946b04484.tar.xz
org.eclipse.tcf-8214fddbe1e2d05a18c3ddce520bdcd946b04484.zip
Target Explorer: Provide default model node factory delegate
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.runtime.model')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.model/plugin.xml22
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.model/src/org/eclipse/tcf/te/runtime/model/factory/ModelNodeFactoryDelegate.java37
2 files changed, 53 insertions, 6 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.model/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.runtime.model/plugin.xml
index 34249eeb3..767fb75c4 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.model/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.model/plugin.xml
@@ -1,6 +1,16 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension-point id="factoryDelegates" name="Model Node Factory Delegates" schema="schema/factoryDelegates.exsd"/>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="factoryDelegates" name="Model Node Factory Delegates" schema="schema/factoryDelegates.exsd"/>
+
+<!-- Model node factory delegate contributions -->
+ <extension point="org.eclipse.tcf.te.runtime.model.factoryDelegates">
+ <delegate
+ class="org.eclipse.tcf.te.runtime.model.factory.ModelNodeFactoryDelegate"
+ id="org.eclipse.tcf.te.runtime.model.factory.delegate">
+ <nodeType class="org.eclipse.tcf.te.runtime.model.interfaces.IModelNode"/>
+ <nodeType class="org.eclipse.tcf.te.runtime.model.interfaces.IContainerModelNode"/>
+ </delegate>
+ </extension>
+
+</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.model/src/org/eclipse/tcf/te/runtime/model/factory/ModelNodeFactoryDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.model/src/org/eclipse/tcf/te/runtime/model/factory/ModelNodeFactoryDelegate.java
new file mode 100644
index 000000000..1aa61fd36
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.model/src/org/eclipse/tcf/te/runtime/model/factory/ModelNodeFactoryDelegate.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.runtime.model.factory;
+
+import org.eclipse.tcf.te.runtime.model.ContainerModelNode;
+import org.eclipse.tcf.te.runtime.model.ModelNode;
+import org.eclipse.tcf.te.runtime.model.interfaces.IContainerModelNode;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+
+/**
+ * Default model node factory delegate implementation.
+ */
+public class ModelNodeFactoryDelegate extends AbstractFactoryDelegate {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.model.interfaces.factory.IFactoryDelegate#newInstance(java.lang.Class)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public <V extends IModelNode> V newInstance(Class<V> nodeInterface) {
+ if (IModelNode.class.equals(nodeInterface)) {
+ return (V) new ModelNode();
+ }
+ if (IContainerModelNode.class.equals(nodeInterface)) {
+ return (V) new ContainerModelNode();
+ }
+ return null;
+ }
+
+}

Back to the top