Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-05-28 10:08:45 -0400
committerUwe Stieber2013-05-28 10:15:11 -0400
commit75d0d127b256e4e034d4389c207bd16c78dee33b (patch)
treecf910dd9d0789bd67010ba888b2baf999685ec16
parent0407f23eb482fb9a9bd48123f3e0d9ae569f6388 (diff)
downloadorg.eclipse.tcf-75d0d127b256e4e034d4389c207bd16c78dee33b.tar.gz
org.eclipse.tcf-75d0d127b256e4e034d4389c207bd16c78dee33b.tar.xz
org.eclipse.tcf-75d0d127b256e4e034d4389c207bd16c78dee33b.zip
Target Explorer: Fix Bug 409294 - Illegal thread access exception in System Manager context menu
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/plugin.xml72
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/internal/services/PropertiesAccessService.java139
2 files changed, 182 insertions, 29 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/plugin.xml
index edcd440b1..f1839a5de 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/plugin.xml
@@ -1,29 +1,43 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-
-<!-- Model node factory delegate contributions -->
- <extension point="org.eclipse.tcf.te.runtime.model.factoryDelegates">
- <delegate
- class="org.eclipse.tcf.te.tcf.processes.core.model.internal.factory.ModelNodeFactoryDelegate"
- id="org.eclipse.tcf.te.tcf.processes.core.model.factory.delegate">
- <nodeType class="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
- </delegate>
- </extension>
-
-<!-- Launch Step contributions -->
- <extension point="org.eclipse.tcf.te.runtime.stepper.steps">
- <step
- id="org.eclipse.tcf.te.tcf.processes.core.launchProcessStep"
- class="org.eclipse.tcf.te.tcf.processes.core.steps.LaunchProcessStep"
- label="%LaunchProcessStep.name"/>
- <step
- id="org.eclipse.tcf.te.tcf.processes.core.resumeProcessStep"
- class="org.eclipse.tcf.te.tcf.processes.core.steps.ResumeProcessStep"
- label="%ResumeProcessStep.name">
- <requires id="org.eclipse.tcf.te.tcf.core.openChannelStep"/>
- <requires id="org.eclipse.tcf.te.tcf.processes.core.launchProcessStep"/>
- </step>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+<!-- Model node factory delegate contributions -->
+ <extension point="org.eclipse.tcf.te.runtime.model.factoryDelegates">
+ <delegate
+ class="org.eclipse.tcf.te.tcf.processes.core.model.internal.factory.ModelNodeFactoryDelegate"
+ id="org.eclipse.tcf.te.tcf.processes.core.model.factory.delegate">
+ <nodeType class="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ </delegate>
+ </extension>
+
+<!-- Service contributions -->
+ <extension point="org.eclipse.tcf.te.runtime.services.services">
+ <service
+ class="org.eclipse.tcf.te.tcf.processes.core.model.internal.services.PropertiesAccessService"
+ id="org.eclipse.tcf.te.tcf.processes.services.tcf.propertiesAccess">
+ <serviceType
+ bundleId="org.eclipse.tcf.te.runtime.services"
+ class="org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService"/>
+ <enablement>
+ <instanceof value="org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode"/>
+ </enablement>
+ </service>
+ </extension>
+
+<!-- Launch Step contributions -->
+ <extension point="org.eclipse.tcf.te.runtime.stepper.steps">
+ <step
+ id="org.eclipse.tcf.te.tcf.processes.core.launchProcessStep"
+ class="org.eclipse.tcf.te.tcf.processes.core.steps.LaunchProcessStep"
+ label="%LaunchProcessStep.name"/>
+ <step
+ id="org.eclipse.tcf.te.tcf.processes.core.resumeProcessStep"
+ class="org.eclipse.tcf.te.tcf.processes.core.steps.ResumeProcessStep"
+ label="%ResumeProcessStep.name">
+ <requires id="org.eclipse.tcf.te.tcf.core.openChannelStep"/>
+ <requires id="org.eclipse.tcf.te.tcf.processes.core.launchProcessStep"/>
+ </step>
+ </extension>
+
+</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/internal/services/PropertiesAccessService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/internal/services/PropertiesAccessService.java
new file mode 100644
index 000000000..c6db5ac3d
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.core/src/org/eclipse/tcf/te/tcf/processes/core/model/internal/services/PropertiesAccessService.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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.tcf.processes.core.model.internal.services;
+
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.te.runtime.services.AbstractService;
+import org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService;
+import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
+import org.eclipse.tcf.te.tcf.processes.core.model.interfaces.IProcessContextNode;
+
+/**
+ * Process context node properties access service implementation.
+ */
+public class PropertiesAccessService extends AbstractService implements IPropertiesAccessService {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService#getTargetAddress(java.lang.Object)
+ */
+ @Override
+ public Map<String, String> getTargetAddress(Object context) {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService#getProperty(java.lang.Object, java.lang.String)
+ */
+ @Override
+ public Object getProperty(final Object context, final String key) {
+ Assert.isNotNull(context);
+ Assert.isNotNull(key);
+
+ final AtomicReference<Object> value = new AtomicReference<Object>();
+ if (context instanceof IProcessContextNode) {
+ final IProcessContextNode node = (IProcessContextNode) context;
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ Object val = node.getProperty(key);
+ value.set(val);
+ }
+ };
+
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+ }
+
+ return value.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService#setProperty(java.lang.Object, java.lang.String, java.lang.Object)
+ */
+ @Override
+ public boolean setProperty(final Object context, final String key, final Object value) {
+ Assert.isNotNull(context);
+ Assert.isNotNull(key);
+
+ final AtomicBoolean result = new AtomicBoolean();
+ if (context instanceof IPeerModel) {
+ final IProcessContextNode node = (IProcessContextNode) context;
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ result.set(node.setProperty(key, value));
+ }
+ };
+
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+ }
+
+ return result.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService#isProperty(java.lang.Object, java.lang.String, java.lang.Object)
+ */
+ @Override
+ public boolean isProperty(final Object context, final String key, final Object value) {
+ Assert.isNotNull(context);
+ Assert.isNotNull(key);
+
+ final AtomicBoolean result = new AtomicBoolean();
+ if (context instanceof IPeerModel) {
+ final IProcessContextNode node = (IProcessContextNode) context;
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ result.set(node.isProperty(key, value));
+ }
+ };
+
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+ }
+
+ return result.get();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService#getParent(java.lang.Object)
+ */
+ @Override
+ public Object getParent(final Object context) {
+ Assert.isNotNull(context);
+
+ final AtomicReference<Object> value = new AtomicReference<Object>();
+ if (context instanceof IProcessContextNode) {
+ final IProcessContextNode node = (IProcessContextNode) context;
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ value.set(node.getParent());
+ }
+ };
+
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+ }
+
+ return value.get();
+ }
+}

Back to the top