[openrtm-commit:01809] r563 - in trunk/rtmtools/jp.go.aist.rtm.nameserviceview: . src/jp/go/aist/rtm/nameserviceview/nl src/jp/go/aist/rtm/nameserviceview/ui/action src/jp/go/aist/rtm/nameserviceview/ui/dialog

openrtm @ openrtm.org openrtm @ openrtm.org
2016年 3月 5日 (土) 18:38:03 JST


Author: ga
Date: 2016-03-05 18:38:03 +0900 (Sat, 05 Mar 2016)
New Revision: 563

Added:
   trunk/rtmtools/jp.go.aist.rtm.nameserviceview/src/jp/go/aist/rtm/nameserviceview/ui/action/ShowIORActionDelegate.java
   trunk/rtmtools/jp.go.aist.rtm.nameserviceview/src/jp/go/aist/rtm/nameserviceview/ui/dialog/ShowIORDialog.java
Modified:
   trunk/rtmtools/jp.go.aist.rtm.nameserviceview/plugin.properties
   trunk/rtmtools/jp.go.aist.rtm.nameserviceview/plugin.xml
   trunk/rtmtools/jp.go.aist.rtm.nameserviceview/src/jp/go/aist/rtm/nameserviceview/nl/messages.properties
Log:
Modified for ConfigrationView And NameServiceView #3444, #3445

Modified: trunk/rtmtools/jp.go.aist.rtm.nameserviceview/plugin.properties
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.nameserviceview/plugin.properties	2016-03-05 09:37:47 UTC (rev 562)
+++ trunk/rtmtools/jp.go.aist.rtm.nameserviceview/plugin.properties	2016-03-05 09:38:03 UTC (rev 563)
@@ -30,6 +30,7 @@
 Add_Context =Add Context
 Delete_from_Name_Service =Delete from Name Service
 Delete_from_View =Delete from View
+Show_IOR =Show IOR
 RT_Name_Service_View_Actions =RT Name Service View Actions
 RT_Name_Service_View =RT Name Service View
 Connection =Connection 

Modified: trunk/rtmtools/jp.go.aist.rtm.nameserviceview/plugin.xml
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.nameserviceview/plugin.xml	2016-03-05 09:37:47 UTC (rev 562)
+++ trunk/rtmtools/jp.go.aist.rtm.nameserviceview/plugin.xml	2016-03-05 09:38:03 UTC (rev 563)
@@ -128,7 +128,6 @@
 				class="jp.go.aist.rtm.nameserviceview.ui.action.AddContextAction" > 
 			</action>
 		</objectContribution>
-			
 		<objectContribution
 			id="jp.go.aist.rtm.nameserviceview.ui.action.DeleteINamingContextActionDelegate"
         	objectClass="jp.go.aist.rtm.nameserviceview.model.nameservice.NamingObjectNode">
@@ -138,7 +137,6 @@
 				class="jp.go.aist.rtm.nameserviceview.ui.action.DeleteNodeActionDelegate">
 			</action>
 		</objectContribution>
-
 		<objectContribution
 			id="jp.go.aist.rtm.nameserviceview.ui.action.DeleteNameServiceAction"
         	objectClass="jp.go.aist.rtm.nameserviceview.model.nameservice.NamingContextNode">
@@ -148,6 +146,24 @@
 				class="jp.go.aist.rtm.nameserviceview.ui.action.DeleteNodeActionDelegate">
 			</action>
 		</objectContribution>
+		<objectContribution
+			id="jp.go.aist.rtm.nameserviceview.ui.action.ShowIORActionDelegate"
+        	objectClass="jp.go.aist.rtm.nameserviceview.model.nameservice.NamingObjectNode">
+			<action id="jp.go.aist.rtm.nameserviceview.ui.action.ShowIORActionDelegate"
+				label="%Show_IOR"
+				menubarPath="namingContextObjectContribution"
+				class="jp.go.aist.rtm.nameserviceview.ui.action.ShowIORActionDelegate">
+			</action>
+		</objectContribution>
+		<objectContribution
+			id="jp.go.aist.rtm.nameserviceview.ui.action.ShowIORActionDelegate.context"
+        	objectClass="jp.go.aist.rtm.nameserviceview.model.nameservice.NamingContextNode">
+			<action id="jp.go.aist.rtm.nameserviceview.ui.action.ShowIORActionDelegate"
+				label="%Show_IOR"
+				menubarPath="namingContextObjectContribution"
+				class="jp.go.aist.rtm.nameserviceview.ui.action.ShowIORActionDelegate">
+			</action>
+		</objectContribution>
 		
 	</extension>
 

Modified: trunk/rtmtools/jp.go.aist.rtm.nameserviceview/src/jp/go/aist/rtm/nameserviceview/nl/messages.properties
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.nameserviceview/src/jp/go/aist/rtm/nameserviceview/nl/messages.properties	2016-03-05 09:37:47 UTC (rev 562)
+++ trunk/rtmtools/jp.go.aist.rtm.nameserviceview/src/jp/go/aist/rtm/nameserviceview/nl/messages.properties	2016-03-05 09:38:03 UTC (rev 563)
@@ -73,3 +73,5 @@
 NameServiceViewPreferencePage.6=is not a valid input.
 Delete_from_Name_Service =Delete from Name Service
 Delete_from_View =Delete from View
+ShowIORDialog.title=Show IOR
+

Added: trunk/rtmtools/jp.go.aist.rtm.nameserviceview/src/jp/go/aist/rtm/nameserviceview/ui/action/ShowIORActionDelegate.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.nameserviceview/src/jp/go/aist/rtm/nameserviceview/ui/action/ShowIORActionDelegate.java	                        (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.nameserviceview/src/jp/go/aist/rtm/nameserviceview/ui/action/ShowIORActionDelegate.java	2016-03-05 09:38:03 UTC (rev 563)
@@ -0,0 +1,52 @@
+package jp.go.aist.rtm.nameserviceview.ui.action;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import jp.go.aist.rtm.nameserviceview.ui.dialog.ShowIORDialog;
+import jp.go.aist.rtm.toolscommon.corba.CorbaUtil;
+import jp.go.aist.rtm.toolscommon.model.core.CorbaWrapperObject;
+
+/**
+ * IOR情報を表示するアクション
+ */
+public class ShowIORActionDelegate implements IObjectActionDelegate {
+
+	private static final Logger LOGGER = LoggerFactory.getLogger(ShowIORActionDelegate.class);
+
+	private IWorkbenchPart targetPart;
+	private IStructuredSelection selection;
+
+	@Override
+	public void run(IAction action) {
+		Object first = this.selection.getFirstElement();
+		if (!(first instanceof CorbaWrapperObject)) {
+			LOGGER.error("Unexpected the selected object: obj=<{}>", first);
+			return;
+		}
+
+		CorbaUtil.IORInfo info = CorbaUtil.getIORInfo(((CorbaWrapperObject) first).getCorbaObject());
+		LOGGER.debug("IORInfo: <{}>", info);
+
+		ShowIORDialog dialog = new ShowIORDialog(this.targetPart.getSite().getShell(), info);
+		dialog.open();
+	}
+
+	@Override
+	public void selectionChanged(IAction action, ISelection selection) {
+		LOGGER.trace("selectionChanged: action=<{}> selection=<{}>", action, selection);
+		this.selection = (IStructuredSelection) selection;
+	}
+
+	@Override
+	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+		LOGGER.trace("setActivePart: action=<{}> target=<{}>", action, targetPart);
+		this.targetPart = targetPart;
+	}
+
+}


Property changes on: trunk/rtmtools/jp.go.aist.rtm.nameserviceview/src/jp/go/aist/rtm/nameserviceview/ui/action/ShowIORActionDelegate.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/rtmtools/jp.go.aist.rtm.nameserviceview/src/jp/go/aist/rtm/nameserviceview/ui/dialog/ShowIORDialog.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.nameserviceview/src/jp/go/aist/rtm/nameserviceview/ui/dialog/ShowIORDialog.java	                        (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.nameserviceview/src/jp/go/aist/rtm/nameserviceview/ui/dialog/ShowIORDialog.java	2016-03-05 09:38:03 UTC (rev 563)
@@ -0,0 +1,135 @@
+package jp.go.aist.rtm.nameserviceview.ui.dialog;
+
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+import jp.go.aist.rtm.nameserviceview.nl.Messages;
+import jp.go.aist.rtm.toolscommon.corba.CorbaUtil;
+
+/**
+ * IOR情報を表示するダイアログ
+ */
+public class ShowIORDialog extends TitleAreaDialog {
+
+	private static final String TITLE_DIALOG = Messages.getString("ShowIORDialog.title");
+
+	private Text iorText;
+	private Text typeIdText;
+	private Text profileText;
+
+	private CorbaUtil.IORInfo selection;
+
+	public ShowIORDialog(Shell parentShell, CorbaUtil.IORInfo iorInfo) {
+		super(parentShell);
+		setHelpAvailable(false);
+		this.selection = iorInfo;
+		setShellStyle(getShellStyle() | SWT.CENTER | SWT.RESIZE);
+	}
+
+	@Override
+	protected Control createDialogArea(Composite parent) {
+		GridLayout gl = new GridLayout();
+		Composite mainComposite = (Composite) super.createDialogArea(parent);
+		mainComposite.setLayout(gl);
+		mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+		createComposite(mainComposite);
+		return mainComposite;
+	}
+
+	private void createComposite(Composite mainComposite) {
+		Composite composite = new Composite(mainComposite, SWT.NONE);
+		GridLayout gl = new GridLayout(2, false);
+		composite.setLayout(gl);
+		composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+		// IOR
+		Label ior = new Label(composite, SWT.NONE);
+		ior.setText("IOR:");
+		this.iorText = new Text(composite, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.BORDER);
+		GridData gd = new GridData(GridData.GRAB_HORIZONTAL);
+		gd.widthHint = 600;
+		gd.heightHint = 160;
+		gd.horizontalSpan = 1;
+		gd.horizontalAlignment = GridData.FILL;
+		gd.grabExcessHorizontalSpace = true;
+		this.iorText.setLayoutData(gd);
+		this.iorText.setEditable(false);
+
+		// Type ID
+		Label typeId = new Label(composite, SWT.NONE);
+		typeId.setText("Type ID:");
+		this.typeIdText = new Text(composite, SWT.SINGLE | SWT.BORDER);
+		gd = new GridData(GridData.GRAB_HORIZONTAL);
+		gd.horizontalSpan = 1;
+		gd.horizontalAlignment = GridData.FILL;
+		gd.grabExcessHorizontalSpace = true;
+		this.typeIdText.setLayoutData(gd);
+		this.typeIdText.setEditable(false);
+
+		// Profile
+		Label profile = new Label(composite, SWT.NONE);
+		profile.setText("Profile:");
+		gd = new GridData(GridData.GRAB_HORIZONTAL);
+		gd.horizontalSpan = 2;
+		gd.horizontalAlignment = GridData.FILL;
+		gd.grabExcessHorizontalSpace = true;
+		profile.setLayoutData(gd);
+		this.profileText = new Text(composite, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.BORDER);
+		gd = new GridData(GridData.GRAB_HORIZONTAL);
+		gd.widthHint = 600;
+		gd.heightHint = 160;
+		gd.horizontalSpan = 2;
+		gd.horizontalAlignment = GridData.FILL;
+		gd.grabExcessHorizontalSpace = true;
+		this.profileText.setLayoutData(gd);
+		this.profileText.setEditable(false);
+
+		refreshIORInfo();
+	}
+
+	/**
+	 * IOR情報を画面表示に設定します。
+	 */
+	private void refreshIORInfo() {
+		this.iorText.setText("");
+		this.typeIdText.setText("");
+		this.profileText.setText("");
+		if (this.selection == null) {
+			return;
+		}
+		StringBuffer sb = new StringBuffer();
+		if (!this.selection.taggedProfiles.isEmpty()) {
+			CorbaUtil.IORInfo.TaggedProfile prof = this.selection.taggedProfiles.get(0);
+			sb.append(String.format("Server: %s:%s\r\n", prof.host, prof.port));
+			sb.append(String.format("GPIO Version: %s\r\n", prof.gpioVersion));
+			sb.append(String.format("Object Key: %s\r\n", prof.objKey));
+			sb.append("Components:\r\n");
+			for (String comp : prof.components) {
+				sb.append(String.format("- %s\r\n", comp));
+			}
+		}
+		this.iorText.setText(this.selection.ior);
+		this.typeIdText.setText(this.selection.typeId);
+		this.profileText.setText(sb.toString());
+	}
+
+	@Override
+	protected void configureShell(Shell shell) {
+		super.configureShell(shell);
+		shell.setText(TITLE_DIALOG);
+	}
+
+	@Override
+	protected Point getInitialSize() {
+		return getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+	}
+
+}


Property changes on: trunk/rtmtools/jp.go.aist.rtm.nameserviceview/src/jp/go/aist/rtm/nameserviceview/ui/dialog/ShowIORDialog.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain



More information about the openrtm-commit mailing list