Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Torregrosa Paez2015-10-01 07:08:31 -0400
committerPablo Torregrosa Paez2015-10-01 07:08:31 -0400
commitbbc09673d911817d6ef6f2df35061903abaa1564 (patch)
treeca567c20b8bb3dfd913f2f92111598613c30276c
parent8f336767adbfc0c2ff0000fc872c6464d516d563 (diff)
downloadorg.eclipse.tcf-bbc09673d911817d6ef6f2df35061903abaa1564.tar.gz
org.eclipse.tcf-bbc09673d911817d6ef6f2df35061903abaa1564.tar.xz
org.eclipse.tcf-bbc09673d911817d6ef6f2df35061903abaa1564.zip
Target Explorer: Added "Warning Origins" property to PeerNode
Change-Id: I4ab06675db6b23740db015a578360dd61813271e Signed-off-by: Pablo Torregrosa Paez <pablo.torregrosa@windriver.com>
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerNodeProperties.java5
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/utils/CommonUtils.java51
2 files changed, 55 insertions, 1 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerNodeProperties.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerNodeProperties.java
index 4c3508f8e..c1d1daed9 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerNodeProperties.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/interfaces/nodes/IPeerNodeProperties.java
@@ -63,6 +63,11 @@ public interface IPeerNodeProperties {
public static final String PROPERTY_WARNINGS = "Warnings"; //$NON-NLS-1$
/**
+ * Property: Contains for warnings origins (Map<String,String)
+ */
+ public static final String PROPERTY_WARNING_ORIGINS = "WarningOrigins"; //$NON-NLS-1$
+
+ /**
* Property: Exit error if any simulator or other started process died during connect.
*/
public static final String PROP_EXIT_ERROR = "ExitError"; //$NON-NLS-1$
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/utils/CommonUtils.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/utils/CommonUtils.java
index 293c65257..d96a742a2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/utils/CommonUtils.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.locator/src/org/eclipse/tcf/te/tcf/locator/utils/CommonUtils.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 Wind River Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2014, 2015 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
@@ -179,4 +179,53 @@ public final class CommonUtils {
peerNode.fireChangeEvent(IPeerNodeProperties.PROPERTY_WARNINGS, null, null);
return changed.get();
}
+
+ @SuppressWarnings("unchecked")
+ public static String getPeerWarningOrigin(final IPeerNode peerNode, final String warningKey) {
+ final AtomicReference<Object> warningOrigins = new AtomicReference<Object>();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ warningOrigins.set(peerNode.getProperty(IPeerNodeProperties.PROPERTY_WARNING_ORIGINS));
+ }
+ });
+
+ if (warningOrigins.get() != null && warningOrigins.get() instanceof Map<?,?>) {
+ return ((Map<String,String>)warningOrigins.get()).get(warningKey);
+ }
+ return null;
+ }
+
+ public static boolean setPeerWarningOrigin(final IPeerNode peerNode, final String warningKey, final String value) {
+ final AtomicBoolean changed = new AtomicBoolean();
+ Protocol.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ @SuppressWarnings("unchecked")
+ Map<String,String> warningsOrigins = (Map<String,String>)peerNode.getProperty(IPeerNodeProperties.PROPERTY_WARNING_ORIGINS);
+ if (warningsOrigins == null) {
+ if (value == null) {
+ return;
+ }
+ warningsOrigins = new HashMap<String,String>();
+ }
+ if (value != null) {
+ changed.set(!value.equals(warningsOrigins.get(warningKey)));
+ warningsOrigins.put(warningKey, value);
+ }
+ else {
+ changed.set(warningsOrigins.get(warningKey) != null);
+ warningsOrigins.remove(warningKey);
+ if (warningsOrigins.isEmpty()) {
+ warningsOrigins = null;
+ }
+ }
+ peerNode.setChangeEventsEnabled(false);
+ peerNode.setProperty(IPeerNodeProperties.PROPERTY_WARNING_ORIGINS, warningsOrigins);
+ peerNode.setChangeEventsEnabled(true);
+ }
+ });
+ peerNode.fireChangeEvent(IPeerNodeProperties.PROPERTY_WARNING_ORIGINS, null, null);
+ return changed.get();
+ }
}

Back to the top