[openrtm-commit:03229] r810 - trunk/rtmtools/jp.go.aist.rtm.nameserviceview/src/jp/go/aist/rtm/nameserviceview/ui/views/nameserviceview

openrtm @ openrtm.org openrtm @ openrtm.org
2018年 3月 7日 (水) 13:14:29 JST


Author: ga
Date: 2018-03-07 13:14:29 +0900 (Wed, 07 Mar 2018)
New Revision: 810

Modified:
   trunk/rtmtools/jp.go.aist.rtm.nameserviceview/src/jp/go/aist/rtm/nameserviceview/ui/views/nameserviceview/NameServiceView.java
Log:
Modified to restore NameServer registered in NameServiceView at the end of RTSE. #4475

Modified: trunk/rtmtools/jp.go.aist.rtm.nameserviceview/src/jp/go/aist/rtm/nameserviceview/ui/views/nameserviceview/NameServiceView.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.nameserviceview/src/jp/go/aist/rtm/nameserviceview/ui/views/nameserviceview/NameServiceView.java	2018-03-07 03:40:28 UTC (rev 809)
+++ trunk/rtmtools/jp.go.aist.rtm.nameserviceview/src/jp/go/aist/rtm/nameserviceview/ui/views/nameserviceview/NameServiceView.java	2018-03-07 04:14:29 UTC (rev 810)
@@ -7,12 +7,15 @@
 import jp.go.aist.rtm.nameserviceview.manager.NameServiceViewPreferenceManager;
 import jp.go.aist.rtm.nameserviceview.model.manager.NameServerContext;
 import jp.go.aist.rtm.nameserviceview.model.manager.NameServerManager;
+import jp.go.aist.rtm.nameserviceview.model.manager.Node;
 import jp.go.aist.rtm.nameserviceview.model.manager.impl.NameServerManagerImpl;
+import jp.go.aist.rtm.nameserviceview.model.nameservice.NamingContextNode;
 import jp.go.aist.rtm.toolscommon.ui.views.propertysheetview.RtcPropertySheetPage;
 
 import org.eclipse.emf.common.notify.Adapter;
 import org.eclipse.emf.common.notify.Notification;
 import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.common.util.EList;
 import org.eclipse.jface.action.IMenuListener;
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.action.IToolBarManager;
@@ -221,13 +224,14 @@
 			lastNameServiceAddress = "127.0.0.1";
 		}
 		
-		final String nameServerAddress = lastNameServiceAddress;
+		final String[] nameServerAddressList = lastNameServiceAddress.split("\\|");
 
 		try {
 			new Thread(new Runnable() {
 				public void run() {
-			NameServerManagerImpl.getInstance().addNameServer(
-					nameServerAddress);
+					for(String nameServerAddress : nameServerAddressList) {
+						NameServerManagerImpl.getInstance().addNameServer(nameServerAddress);
+					}
 			}}).start();
 		} catch (Exception e) {
 			// void エラーは無視する
@@ -239,6 +243,18 @@
 	 * {@inheritDoc}
 	 */
 	public void dispose() {
+		EList<Node> nodes = NameServerManagerImpl.getInstance().getNodes();
+		StringBuilder nsList = new StringBuilder();
+		for(Node node : nodes) {
+			try {
+				String nsName = ((NamingContextNode)node).getNameServiceReference().getNameServerName();
+				if(0<nsList.length()) nsList.append("|");
+				nsList.append(nsName);
+			} catch (Exception e) {
+			}
+		}
+		setLastNameServiceAddress(nsList.toString());
+		
 		NameServerManagerImpl.getInstance().eAdapters().remove(
 				nameServerManagerListener);
 



openrtm-commit メーリングリストの案内