diff options
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tm.te.runtime.model')
18 files changed, 1294 insertions, 0 deletions
diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime.model/.classpath b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/.classpath new file mode 100644 index 000000000..8a8f1668c --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime.model/.options b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/.options new file mode 100644 index 000000000..93f91f555 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/.options @@ -0,0 +1 @@ +org.eclipse.tm.te.runtime.model/debugmode = 0 diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime.model/.project b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/.project new file mode 100644 index 000000000..d3c870f8a --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.tm.te.runtime.model</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime.model/.settings/org.eclipse.jdt.core.prefs b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..48ac52c3f --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,82 @@ +#Mon Oct 03 10:14:43 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime.model/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/META-INF/MANIFEST.MF new file mode 100644 index 000000000..62eccd344 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.tm.te.runtime.model;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.eclipse.tm.te.runtime.model.activator.CoreBundleActivator +Bundle-Vendor: %providerName +Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0", + org.eclipse.tm.te.runtime;bundle-version="1.0.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Export-Package: org.eclipse.tm.te.runtime.model, + org.eclipse.tm.te.runtime.model.activator;x-internal:=true, + org.eclipse.tm.te.runtime.model.interfaces, + org.eclipse.tm.te.runtime.model.nls;x-internal:=true diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime.model/build.properties b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/build.properties new file mode 100644 index 000000000..f4ae97015 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/build.properties @@ -0,0 +1,5 @@ +source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties
diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime.model/plugin.properties b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/plugin.properties new file mode 100644 index 000000000..49eafce1b --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/plugin.properties @@ -0,0 +1,12 @@ +################################################################################## +# Copyright (c) 2011 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 +################################################################################## + +pluginName = Target Explorer, Model Runtime plug-in +providerName = Eclipse.org diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime.model/pom.xml b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/pom.xml new file mode 100644 index 000000000..ab2f3105d --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/pom.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.eclipse.tcf</groupId> + <artifactId>tcf-parent</artifactId> + <version>0.5.0-SNAPSHOT</version> + <relativePath>../../../pom.xml</relativePath> + </parent> + + <version>1.0.0.qualifier</version> + <artifactId>org.eclipse.tm.te.runtime.model</artifactId> + <packaging>eclipse-plugin</packaging> +</project> diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/ContainerModelNode.java b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/ContainerModelNode.java new file mode 100644 index 000000000..0189611d1 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/ContainerModelNode.java @@ -0,0 +1,319 @@ +/******************************************************************************* + * Copyright (c) 2011 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.tm.te.runtime.model; + +import java.util.ArrayList; +import java.util.EventObject; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +import org.eclipse.core.runtime.jobs.ISchedulingRule; +import org.eclipse.tm.te.runtime.events.EventManager; +import org.eclipse.tm.te.runtime.model.interfaces.IContainerModelNode; +import org.eclipse.tm.te.runtime.model.interfaces.IModelNode; + +/** + * A common (data) model container node implementation. + * <p> + * <b>Note:</b> The (data) model node implementation is not thread-safe. Clients requiring + * a thread-safe implementation should subclass the properties container and + * overwrite {@link #checkThreadAccess()}. + */ +public class ContainerModelNode extends ModelNode implements IContainerModelNode { + // Note: Do _not_ use sorted sets/trees here! The trees get not resorted if the element state + // changes. We may loose the possibility to find the element again within the tree! + private final List<IModelNode> childList = new ArrayList<IModelNode>(); + + // Lock to use for synchronization purpose + private final Lock childListLock = new ReentrantLock(); + + // empty array + public static final IModelNode[] EMPTY_MODEL_NODE_ARRAY = new IModelNode[0]; + + /** + * Constructor. + */ + public ContainerModelNode() { + super(); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IContainerModelNode#getChildren() + */ + @Override + public IModelNode[] getChildren() { + return internalGetChildren(); + } + + /** + * Return the real child list. + */ + protected final IModelNode[] internalGetChildren() { + // Create the list that will hold the copy (non-deep copy) + List<IModelNode> children = new ArrayList<IModelNode>(); + try { + // Acquire the lock while copying the child references + childListLock.lock(); + // Add the children to the returned list copy + children.addAll(childList); + } finally { + // Release the lock + childListLock.unlock(); + } + return children.toArray(new IModelNode[children.size()]); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IContainerModelNode#getChildren(java.lang.Class) + */ + @Override + @SuppressWarnings("unchecked") + public <T> List<T> getChildren(Class<T> instanceOf) { + // Create the list that will hold the found children being + // a instance of the given class + List<T> children = new ArrayList<T>(); + try { + // Acquire the lock while copying the child references + childListLock.lock(); + // Walk through all the children and check for the class + for (IModelNode child : childList) { + if (instanceOf.isInstance(child)) { + children.add((T)child); + } + } + } finally { + // Release the look + childListLock.unlock(); + } + + return children; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IContainerModelNode#hasChildren() + */ + @Override + public boolean hasChildren() { + boolean hasChildren = false; + try { childListLock.lock(); hasChildren = !childList.isEmpty(); } finally { childListLock.unlock(); } + return hasChildren; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IContainerModelNode#add(org.eclipse.tm.te.runtime.interfaces.nodes.IModelNode) + */ + @Override + public boolean add(IModelNode node) { + if (node != null) { + try { + childListLock.lock(); + // set the parent if not set otherwise before. + if (node.getParent() == null) { + node.setParent(this); + } + else { + assert node.getParent() == this : "Attempt to add child node to " + getName() + " with this != node.getParent()!!!"; //$NON-NLS-1$ //$NON-NLS-2$ + } + childList.add(node); + } finally { + childListLock.unlock(); + } + + EventObject event = newEvent(this, NOTIFY_ADDED, null, new IModelNode[] { node }); + if (event != null) EventManager.getInstance().fireEvent(event); + + return true; + } + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IContainerModelNode#remove(org.eclipse.tm.te.runtime.interfaces.nodes.IModelNode, boolean) + */ + @Override + public boolean remove(IModelNode node, boolean recursive) { + if (node instanceof IContainerModelNode && recursive) { + IContainerModelNode container = (IContainerModelNode)node; + container.clear(); + } + + boolean removed = false; + // Removes the given node from this container + try { childListLock.lock(); removed = childList.remove(node); } finally { childListLock.unlock(); } + // Unlink the parent and fire the removed notification if the element got removed + if (removed) { + EventObject event = newEvent(this, NOTIFY_REMOVED, new IModelNode[] { node }, null); + if (event != null) EventManager.getInstance().fireEvent(event); + } + + return removed; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IContainerModelNode#removeAll(java.lang.Class) + */ + @Override + public <T> boolean removeAll(Class<T> nodeType) { + boolean removed = false; + List<T> children; + + try { + childListLock.lock(); + children = getChildren(nodeType); + removed |= childList.removeAll(children); + } finally { + childListLock.unlock(); + } + + if (removed) { + EventObject event = newEvent(this, NOTIFY_REMOVED, children, null); + if (event != null) EventManager.getInstance().fireEvent(event); + } + + return removed; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IContainerModelNode#clear() + */ + @Override + public boolean clear() { + boolean removed = false; + + boolean changed = setChangeEventsEnabled(false); + + try { + childListLock.lock(); + IModelNode[] children = internalGetChildren(); + for (IModelNode element : children) { + removed |= remove(element, true); + } + } finally { + childListLock.unlock(); + } + + if (changed) setChangeEventsEnabled(true); + + return removed; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IContainerModelNode#size() + */ + @Override + public int size() { + return childList.size(); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IContainerModelNode#contains(org.eclipse.tm.te.runtime.interfaces.nodes.IModelNode) + */ + @Override + public boolean contains(IModelNode node) { + if (node != null) { + try { + childListLock.lock(); + return childList.contains(node); + } finally { + childListLock.unlock(); + } + } + return false; + } + + /** + * Returns weather the scheduling rule of container model nodes is considering + * children or not. If recursive scheduling rule locking is enabled, than any job + * having a child of this container model node as scheduling rule, will conflict + * with this container model node. + * + * @return <code>True</code> if recursive scheduling rule locking is enabled, <code>false</code> otherwise. + */ + protected boolean isSchedulingLockedRecursivly() { + return true; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.nodes.ModelNode#contains(org.eclipse.core.runtime.jobs.ISchedulingRule) + */ + @Override + public boolean contains(ISchedulingRule rule) { + // We deal only with scheduling rules we know about (as the interface + // declaration of ISchedulingRule#contains requests) and if recursive + // scheduling rule locking is on. + if (isSchedulingLockedRecursivly() && rule instanceof IModelNode) { + // Iterate through the children and if one of the children + // contains the given scheduling rule, this container model + // node contains the given scheduling rule as well. + try { + childListLock.lock(); + IModelNode[] children = internalGetChildren(); + for (IModelNode child : children) { + if (child.contains(rule)) { + return true; + } + } + } finally { + childListLock.unlock(); + } + } + + return super.contains(rule); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.nodes.ModelNode#isConflicting(org.eclipse.core.runtime.jobs.ISchedulingRule) + */ + @Override + public boolean isConflicting(ISchedulingRule rule) { + // We deal only with scheduling rules we know about (as the interface + // declaration of ISchedulingRule#contains requests) and if recursive + // scheduling rule locking is on. + if (isSchedulingLockedRecursivly() && rule instanceof IModelNode) { + // Iterate through the children and if one of the children + // is conflicting with the given scheduling rule, this + // container model node is conflicting the given scheduling + // rule as well. + try { + childListLock.lock(); + IModelNode[] children = internalGetChildren(); + for (IModelNode child : children) { + if (child.isConflicting(rule)) { + return true; + } + } + } finally { + childListLock.unlock(); + } + } + + return super.isConflicting(rule); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.nodes.ModelNode#find(java.util.UUID) + */ + @Override + public IModelNode find(UUID uuid) { + IModelNode find = super.find(uuid); + if (find != null) return find; + + for (IModelNode child : childList) { + find = child.find(uuid); + if (find != null) { + return find; + } + } + + return find; + } +} diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/MessageModelNode.java b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/MessageModelNode.java new file mode 100644 index 000000000..682f273b5 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/MessageModelNode.java @@ -0,0 +1,97 @@ +/******************************************************************************* + * Copyright (c) 2011 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.tm.te.runtime.model; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.tm.te.runtime.model.activator.CoreBundleActivator; + +/** + * A common (data) model node representing a message. + * <p> + * <b>Note:</b> The (data) model node implementation is not thread-safe. Clients requiring + * a thread-safe implementation should subclass the model node. + */ +public class MessageModelNode extends ModelNode { + + /** + * Property: Message severity. + */ + public static final String PROPERTY_SEVERITY = "severity"; //$NON-NLS-1$ + + /** + * Message severity: Pending. + */ + public static final int PENDING = 0xFF; + + /** + * Message model node image id: Severity Pending. + */ + public final static String OBJECT_MESSAGE_PENDING_ID = CoreBundleActivator.getUniqueIdentifier() + ".message.pending"; //$NON-NLS-1$ + + /** + * Message model node image id: Severity Info. + */ + public final static String OBJECT_MESSAGE_INFO_ID = CoreBundleActivator.getUniqueIdentifier() + ".message.info"; //$NON-NLS-1$ + + /** + * Message model node image id: Severity Warning. + */ + public final static String OBJECT_MESSAGE_WARNING_ID = CoreBundleActivator.getUniqueIdentifier() + ".message.warning"; //$NON-NLS-1$ + + /** + * Message model node image id: Severity Error. + */ + public final static String OBJECT_MESSAGE_ERROR_ID = CoreBundleActivator.getUniqueIdentifier() + ".message.error"; //$NON-NLS-1$ + + // Flag to mark the message node locked (immutable). + private boolean locked = false; + + /** + * Constructor. + * + * @param message The message to show in the tree. + * @param severity The severity for the message to show as icon. + * + * @see IStatus + */ + public MessageModelNode(String message, int severity, boolean locked) { + super(); + setProperty(PROPERTY_NAME, message); + setProperty(PROPERTY_SEVERITY, severity); + this.locked = locked; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.nodes.PropertiesContainer#setProperty(java.lang.String, java.lang.Object) + */ + @Override + public boolean setProperty(String key, Object value) { + if (locked) return false; + return super.setProperty(key, value); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.nodes.ModelNode#getImageId() + */ + @Override + public String getImageId() { + switch (getIntProperty(PROPERTY_SEVERITY)) { + case PENDING: + return OBJECT_MESSAGE_PENDING_ID; + case IStatus.INFO: + return OBJECT_MESSAGE_INFO_ID; + case IStatus.WARNING: + return OBJECT_MESSAGE_WARNING_ID; + case IStatus.ERROR: + return OBJECT_MESSAGE_ERROR_ID; + } + return null; + } +} diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/ModelNode.java b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/ModelNode.java new file mode 100644 index 000000000..910f1b642 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/ModelNode.java @@ -0,0 +1,288 @@ +/******************************************************************************* + * Copyright (c) 2011 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.tm.te.runtime.model; + +import java.util.UUID; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.jobs.ISchedulingRule; +import org.eclipse.tm.te.runtime.activator.CoreBundleActivator; +import org.eclipse.tm.te.runtime.interfaces.tracing.ITraceIds; +import org.eclipse.tm.te.runtime.model.interfaces.IContainerModelNode; +import org.eclipse.tm.te.runtime.model.interfaces.IModelNode; +import org.eclipse.tm.te.runtime.model.interfaces.IModelNodeProvider; +import org.eclipse.tm.te.runtime.properties.PropertiesContainer; + +/** + * A common (data) model node implementation. + * <p> + * <b>Note:</b> The (data) model node implementation is not thread-safe. Clients requiring + * a thread-safe implementation should subclass the properties container and + * overwrite {@link #checkThreadAccess()}. + */ +public class ModelNode extends PropertiesContainer implements IModelNode, IModelNodeProvider { + // Reference to the parent model node + private IContainerModelNode parent = null; + + // Flag to remember the dirty state of the (data) model node. + private boolean dirty; + // Flag to remember the pending state of the (data) model node. + private boolean pending; + + // Flag to control if property change events are suppressed + // until the model node is added to a parent container model node. + protected boolean suppressEventsOnNullParent = true; + + /** + * Constructor. + */ + public ModelNode() { + super(); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IModelNode#getParent() + */ + @Override + public final IContainerModelNode getParent() { + Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$ + return parent; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IModelNode#getParent(java.lang.Class) + */ + @Override + public final IContainerModelNode getParent(Class<?> nodeType) { + Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$ + if (this.parent != null) { + if (nodeType.isInstance(this.parent)) { + return this.parent; + } + return this.parent.getParent(nodeType); + } + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IModelNode#setParent(org.eclipse.tm.te.runtime.interfaces.nodes.IContainerModelNode) + */ + @Override + public final void setParent(IContainerModelNode parent) { + Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$ + if (this.parent != null) { + throw new IllegalStateException("Model node already associated with a parent container model node!"); //$NON-NLS-1$ + } + this.parent = parent; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IModelNode#move(org.eclipse.tm.te.runtime.interfaces.nodes.IContainerModelNode) + */ + @Override + public final void move(IContainerModelNode newParent) { + Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$ + Assert.isNotNull(newParent); + + // If the node is associated with a parent container, remove the node from + // the container node non-recursive (keeping all children if being ourself + // a container model node) + if (this.parent != null) { + // Remove the node from the old parent container + if (!this.parent.contains(this) || this.parent.remove(this, false)) { + // Unset the parent reference (will enable the add to the new container) + this.parent = null; + } + } + + // Re-add to the new parent. This may cause an + // IllegalStateException if the previous removal from + // the old parent container failed. + newParent.add(this); + return; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IModelNode#isVisible() + */ + @Override + public boolean isVisible() { + return getBooleanProperty(PROPERTY_IS_VISIBLE); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IModelNode#getError() + */ + @Override + public String getError() { + return getStringProperty(PROPERTY_ERROR); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IModelNode#getName() + */ + @Override + public String getName() { + String name = (String)super.getProperty(PROPERTY_NAME); + return name != null ? name : ""; //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.nodes.PropertiesContainer#getProperty(java.lang.String) + */ + @Override + public Object getProperty(String key) { + if (PROPERTY_NAME.equals(key)) { + return getName(); + } + return super.getProperty(key); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IModelNode#getDescription() + */ + @Override + public String[] getDescription() { + return new String[]{}; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IModelNode#getImageId() + */ + @Override + public String getImageId() { + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.nodes.PropertiesContainer#toString() + */ + @Override + public String toString() { + StringBuilder toString = new StringBuilder(getClass().getName()); + + toString.append("{"); //$NON-NLS-1$ + toString.append(super.toString()); + toString.append("}"); //$NON-NLS-1$ + + return toString.toString(); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.nodes.PropertiesContainer#dropEvent(java.lang.Object, java.lang.String, java.lang.Object, java.lang.Object) + */ + @Override + protected boolean dropEvent(Object source, String key, Object oldValue, Object newValue) { + boolean drop = super.dropEvent(source, key, oldValue, newValue); + if (drop) return true; + + // If the parent is null, it must be allowed to fire change events explicitly + if (parent == null && suppressEventsOnNullParent) { + if (CoreBundleActivator.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_EVENTS)) { + CoreBundleActivator.getTraceHandler().trace("Drop change event (null parent)\n\t\t" + //$NON-NLS-1$ + "for eventId = " + key, //$NON-NLS-1$ + 0, ITraceIds.TRACE_EVENTS, IStatus.WARNING, this); + } + return true; + } + + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IModelNodeProvider#getModelNode() + */ + @Override + public final IModelNode getModelNode() { + return this; + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.jobs.ISchedulingRule#contains(org.eclipse.core.runtime.jobs.ISchedulingRule) + */ + @Override + public boolean contains(ISchedulingRule rule) { + // We deal only with scheduling rules we know about (as the interface + // declaration of ISchedulingRule#contains requests). + if (rule instanceof IModelNode) { + // The IModelNode itself is an leaf node and cannot have children. + // Therefore, the IModelNode can contains only itself. + return rule == this; + } + + // If we don't know about the scheduling rule, we must return false. + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.jobs.ISchedulingRule#isConflicting(org.eclipse.core.runtime.jobs.ISchedulingRule) + */ + @Override + public boolean isConflicting(ISchedulingRule rule) { + // We deal only with scheduling rules we know about (as the interface + // declaration of ISchedulingRule#contains requests). + if (rule instanceof IModelNode) { + // The IModelNode itself is an leaf node and cannot have children. + // Therefore, the IModelNode can conflict only with itself. + return rule == this; + } + + // If we don't know about the scheduling rule, we must return false. + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IModelNode#setDirty(boolean) + */ + @Override + public final void setDirty(boolean dirty) { + Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$ + this.dirty = dirty; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IModelNode#isDirty() + */ + @Override + public final boolean isDirty() { + Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$ + return dirty; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IModelNode#setPending(boolean) + */ + @Override + public final void setPending(boolean pending) { + Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$ + this.pending = pending; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IModelNode#isPending() + */ + @Override + public final boolean isPending() { + Assert.isTrue(checkThreadAccess(), "Illegal Thread Access"); //$NON-NLS-1$ + return pending; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.te.runtime.interfaces.nodes.IModelNode#find(java.util.UUID) + */ + @Override + public IModelNode find(UUID uuid) { + if (getUUID().equals(uuid)) { + return this; + } + return null; + } +} diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/PendingOperationModelNode.java b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/PendingOperationModelNode.java new file mode 100644 index 000000000..d7de627ab --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/PendingOperationModelNode.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2011 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.tm.te.runtime.model; + +import org.eclipse.tm.te.runtime.model.nls.Messages; + + +/** + * An immutable model node to visualize a pending operation. + */ +public final class PendingOperationModelNode extends MessageModelNode { + + /** + * Constructor. + */ + public PendingOperationModelNode() { + super(Messages.PendingOperationModelNode_label, PENDING, true); + } +} diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/activator/CoreBundleActivator.java b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/activator/CoreBundleActivator.java new file mode 100644 index 000000000..5538009d3 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/activator/CoreBundleActivator.java @@ -0,0 +1,72 @@ +/*******************************************************************************
+ * Copyright (c) 2011 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.tm.te.runtime.model.activator;
+
+import org.eclipse.tm.te.runtime.tracing.TraceHandler;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class CoreBundleActivator implements BundleActivator {
+ // The bundle context
+ private static BundleContext context;
+ // The trace handler instance
+ private static TraceHandler traceHandler;
+
+ /**
+ * Returns the bundle context
+ *
+ * @return the bundle context
+ */
+ public static BundleContext getContext() {
+ return context;
+ }
+
+ /**
+ * Convenience method which returns the unique identifier of this plugin.
+ */
+ public static String getUniqueIdentifier() {
+ if (getContext() != null && getContext().getBundle() != null) {
+ return getContext().getBundle().getSymbolicName();
+ }
+ return null;
+ }
+
+ /**
+ * Returns the bundles trace handler.
+ *
+ * @return The bundles trace handler.
+ */
+ public static TraceHandler getTraceHandler() {
+ if (traceHandler == null) {
+ traceHandler = new TraceHandler(getUniqueIdentifier());
+ }
+ return traceHandler;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext bundleContext) throws Exception {
+ CoreBundleActivator.context = bundleContext;
+ }
+
+ /* (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext bundleContext) throws Exception {
+ CoreBundleActivator.context = null;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/interfaces/IContainerModelNode.java b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/interfaces/IContainerModelNode.java new file mode 100644 index 000000000..c5afd1765 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/interfaces/IContainerModelNode.java @@ -0,0 +1,99 @@ +/******************************************************************************* + * Copyright (c) 2011 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.tm.te.runtime.model.interfaces; + +import java.util.List; + + +/** + * A container (data) model node. + * <p> + * The container can have both container model node and model node + * children. Container model nodes can be used as synchronization + * object for the Eclipse jobs API. + */ +public interface IContainerModelNode extends IModelNode { + /** + * Property change notification: Specific child node has been added. + */ + public static final String NOTIFY_ADDED = "added"; //$NON-NLS-1$ + + /** + * Property change notification: Specific child node has been removed. + */ + public static final String NOTIFY_REMOVED = "removed"; //$NON-NLS-1$ + + /** + * Property change notification: Unspecified child nodes may have changed, added or removed. + */ + public static final String NOTIFY_CHANGED = "changed"; //$NON-NLS-1$ + + /** + * Adds the given child node to the list of children. + * + * @param child The child node to append. Must not be <code>null</code>! + */ + public boolean add(IModelNode child); + + /** + * Removes the given node from the list of children. + * + * @param node The node to remove or <code>null</code>. + * @param recursive If <code>true</code> and the node is a container model node, the children + * of the container model node will be removed recursively. + * + * @return <code>true</code> if the list of children contained the given node, <code>false</code> otherwise. + */ + public boolean remove(IModelNode node, boolean recursive); + + /** + * Remove all child nodes recursively. + */ + public boolean clear(); + + /** + * Remove all child nodes with a special type. + * + * @param nodeType The node type. + * @return <code>True</code> if child nodes got removed from the mode, <code>false</code> if not. + */ + public <T> boolean removeAll(Class<T> nodeType); + + /** + * Returns the child nodes. + */ + public IModelNode[] getChildren(); + + /** + * Returns all child nodes with a special type. + * + * @param nodeType The node type. + * @return The list of nodes or an empty list. + */ + public <T> List<T> getChildren(Class<T> nodeType); + + /** + * Returns true if node may have children. + */ + boolean hasChildren(); + + /** + * Returns the current count of child nodes. + */ + public int size(); + + /** + * Returns if or if not the given model node is a child of this container. + * + * @param node The model node. + * @return <code>true</code> if the given model node is a child of this container, <code>false</code> otherwise. + */ + public boolean contains(IModelNode node); +} diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/interfaces/IModelNode.java b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/interfaces/IModelNode.java new file mode 100644 index 000000000..93e596eac --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/interfaces/IModelNode.java @@ -0,0 +1,160 @@ +/******************************************************************************* + * Copyright (c) 2011 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.tm.te.runtime.model.interfaces; + +import java.util.UUID; + +import org.eclipse.core.runtime.jobs.ISchedulingRule; +import org.eclipse.tm.te.runtime.interfaces.properties.IPropertiesContainer; + +/** + * A common (data) model node. + * <p> + * Each model node is capable of dealing with generic properties, provides + * it's own image and label for representation within the UI and can be used + * as synchronization object for the Eclipse job model. + */ +public interface IModelNode extends IPropertiesContainer, ISchedulingRule { + + /** + * Property: Model node name. May be used to represent the node + * in UI widgets. + */ + public static final String PROPERTY_NAME = "name"; //$NON-NLS-1$ + + /** + * Property: Model node visible state. May be used to hide the node + * in UI widgets like lists, tables or trees. + */ + public static final String PROPERTY_IS_VISIBLE = "isVisible"; //$NON-NLS-1$ + + /** + * Property: Type. May be used to group nodes or set an node type id. + */ + public static final String PROPERTY_TYPE = "type"; //$NON-NLS-1$ + + /** + * Property: Type label. May be used to represent the group or node + * type in UI widgets. + */ + public static final String PROPERTY_TYPE_LABEL = "typeLabel"; //$NON-NLS-1$ + + /** + * Property: Model node error text. May be used to decorate the + * node in UI widgets with the error text. + */ + public static final String PROPERTY_ERROR = "error"; //$NON-NLS-1$ + + /** + * Returns the parent node. + * @return The parent + */ + public IContainerModelNode getParent(); + + /** + * Returns the first parent node that implements the given type + * or <code>null</code> if no matching parent can be found. + * + * @param nodeType The interface/class the parent needs to implement/extend. + * @return The parent or <code>null</code>. + */ + public IContainerModelNode getParent(Class<?> nodeType); + + /** + * Associated the given container model node as parent. The parent node + * can be set only once. + * + * @param parent The parent container model node. + * @throws <code>IllegalStateException</code> if the node had been associated already with a parent. + */ + public void setParent(IContainerModelNode parent) throws IllegalStateException; + + /** + * Moves the model node to the specified new parent container. If the model + * node is associated with a parent container, the node will be removed from + * the old parent container node non-recursive. + * <p> + * <b>Note:</b> The method will trigger 2 change events, a {@link IContainerModelNode#NOTIFY_REMOVED} + * notification for the old parent (if any) and a {@link IContainerModelNode#NOTIFY_ADDED} notification + * for the new parent container. + * + * @param newParent The new parent container. Must not be <code>null</code>. + * @throws IllegalStateException if the move of the node failed. + */ + public void move(IContainerModelNode newParent) throws IllegalStateException; + + /** + * Return <code>true</code>, if this model node should be visible. + */ + public boolean isVisible(); + + /** + * Returns the text label to be shown within the UI for this node. + */ + public String getName(); + + /** + * Returns the image id of the image to show within the UI for + * this node. If this node can be adapted to {@linkplain ImageRegistry.class}, + * the image is retrieved from the adapter. + * + * @return The image id or <code>null</code>. + */ + public String getImageId(); + + /** + * Returns the current error or null if no error to show in the status line of the UI. + */ + public String getError(); + + /** + * Returns up to descriptive strings to show in the status line of the UI. + * If getErrorText() returns a not null value, this strings are ignored. + */ + public String[] getDescription(); + + /** + * Set the nodes dirty state. + * <p> + * If a node is dirty, it should be refreshed. + * + * @param dirty The dirty state. + */ + public void setDirty(boolean dirty); + + /** + * Returns the nodes dirty state. + * + * @return <code>True</code> if this node is dirty and needs to be refreshed, <code>false</code> otherwise. + */ + public boolean isDirty(); + + /** + * Set the nodes pending state. + * + * @param pending The pending state. + */ + public void setPending(boolean pending); + + /** + * Returns the nodes pending state. + * + * @return <code>True</code> if an (asynchronous) operation (i.e. refresh) is running for this node. + */ + public boolean isPending(); + + /** + * Lookup a model node by it's unique identifier. + * + * @param uuid The unique identifier. Must not be <code>null</code>. + * @return The model node matching the given unique identifier, or <code>null</code>. + */ + public IModelNode find(UUID uuid); +} diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/interfaces/IModelNodeProvider.java b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/interfaces/IModelNodeProvider.java new file mode 100644 index 000000000..64ee3ae77 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/interfaces/IModelNodeProvider.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2011 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.tm.te.runtime.model.interfaces; + +import org.eclipse.core.runtime.IAdaptable; + +/** + * Interface to implement from objects which are associated + * with (data) model nodes and providing access to them. + */ +public interface IModelNodeProvider extends IAdaptable { + + /** + * Returns the associated (data) model node. + * + * @return The (data) model node or <code>null</code>. + */ + public IModelNode getModelNode(); +} diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/nls/Messages.java b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/nls/Messages.java new file mode 100644 index 000000000..955297a79 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/nls/Messages.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2011 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.tm.te.runtime.model.nls; + +import org.eclipse.osgi.util.NLS; + +/** + * Target Explorer Model Runtime plugin externalized strings management. + */ +public class Messages extends NLS { + + // The plug-in resource bundle name + private static final String BUNDLE_NAME = "org.eclipse.tm.te.runtime.model.nls.Messages"; //$NON-NLS-1$ + + /** + * Static constructor. + */ + static { + // Load message values from bundle file + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + // **** Declare externalized string id's down here ***** + + public static String PendingOperationModelNode_label; +} diff --git a/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/nls/Messages.properties new file mode 100644 index 000000000..78a70ddeb --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.runtime.model/src/org/eclipse/tm/te/runtime/model/nls/Messages.properties @@ -0,0 +1,6 @@ +# +# org.eclipse.tm.te.runtime.model +# Externalized Strings. +# + +PendingOperationModelNode_label=Pending... |