[openrtm-commit:00735] r276 - in trunk/rtmtools/jp.go.aist.rtm.systemeditor: . src/jp/go/aist/rtm/systemeditor/nl src/jp/go/aist/rtm/systemeditor/ui/action src/jp/go/aist/rtm/systemeditor/ui/dialog src/jp/go/aist/rtm/systemeditor/ui/editor/editpolicy

openrtm @ openrtm.org openrtm @ openrtm.org
2012年 2月 21日 (火) 02:55:04 JST


Author: sakamoto
Date: 2012-02-21 02:55:03 +0900 (Tue, 21 Feb 2012)
New Revision: 276

Added:
   trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/action/ConnectPortActionDelegate.java
   trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/DisconnectDialog.java
Modified:
   trunk/rtmtools/jp.go.aist.rtm.systemeditor/plugin.properties
   trunk/rtmtools/jp.go.aist.rtm.systemeditor/plugin.xml
   trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/nl/messages.properties
   trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/DataConnectorCreaterDialog.java
   trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/ServiceConnectorCreaterDialog.java
   trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpolicy/GraphicalConnectorCreateManager.java
Log:
Update Single Port connection #2296

Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/plugin.properties
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/plugin.properties	2012-02-15 05:10:15 UTC (rev 275)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/plugin.properties	2012-02-20 17:55:03 UTC (rev 276)
@@ -68,6 +68,8 @@
 Decompose_Composite_Component =Decompose Composite Component
 Open_With_System_Diagram_Editor =Open With System Diagram Editor
 StartLogging.label =Start Logging
+ConnectPort.label =Connect
+DisconnectPort.label =Disconnect
 Set_Deploy_Info =Set Deploy Info.
 Deploy_System =Deploy System
 Deploy_Save =Save Deploy Info.

Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/plugin.xml
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/plugin.xml	2012-02-15 05:10:15 UTC (rev 275)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/plugin.xml	2012-02-20 17:55:03 UTC (rev 276)
@@ -352,6 +352,21 @@
 				menubarPath="additions">
 			</action>
 		</objectContribution>
+		<objectContribution
+			adaptable="true"
+			id="jp.go.aist.rtm.systemeditor.ui.objectContribution.Component"
+			objectClass="jp.go.aist.rtm.systemeditor.ui.editor.editpart.PortEditPart">
+			<action
+				class="jp.go.aist.rtm.systemeditor.ui.action.ConnectPortActionDelegate"
+				id="jp.go.aist.rtm.systemeditor.ui.action.ConnectPortActionDelegate.Disconnect"
+				label="%DisconnectPort.label">
+			</action>
+			<action
+				class="jp.go.aist.rtm.systemeditor.ui.action.ConnectPortActionDelegate"
+				id="jp.go.aist.rtm.systemeditor.ui.action.ConnectPortActionDelegate.Connect"
+				label="%ConnectPort.label">
+			</action>
+		</objectContribution>
 	</extension>
 
 	<extension point = "org.eclipse.ui.actionSets"> 

Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/nl/messages.properties
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/nl/messages.properties	2012-02-15 05:10:15 UTC (rev 275)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/nl/messages.properties	2012-02-20 17:55:03 UTC (rev 276)
@@ -1,5 +1,7 @@
 Common.dialog.confirm_title=Confirm
 Common.dialog.error_title=Error
+Common.button.add=Add
+Common.button.delete=Delete
 
 Restoration.0=Failed to restore RTC configuration:[
 Restoration.4=Failed to Activate RTC. [
@@ -328,3 +330,9 @@
 StartLoggingActionDelegate.start=Start Logging
 StartLoggingActionDelegate.stop=Stop Logging
 DeployActionDelegate.0=XML Format
+ConnectPortActionDelegate.connect=Connect
+ConnectPortActionDelegate.disconnect=Disconnect
+ConnectPortActionDelegate.error.1=Port can not be disconnect.
+ConnectPortActionDelegate.error.2=Disconnect failure. [{0}]
+DisconnectDialog.title=Disconnect Profile
+DisconnectDialog.explain=Select the connection for disconnect, apply with OK.

Added: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/action/ConnectPortActionDelegate.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/action/ConnectPortActionDelegate.java	                        (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/action/ConnectPortActionDelegate.java	2012-02-20 17:55:03 UTC (rev 276)
@@ -0,0 +1,133 @@
+package jp.go.aist.rtm.systemeditor.ui.action;
+
+import java.util.List;
+
+import jp.go.aist.rtm.systemeditor.ui.dialog.DisconnectDialog;
+import jp.go.aist.rtm.systemeditor.ui.editor.AbstractSystemDiagramEditor;
+import jp.go.aist.rtm.systemeditor.ui.editor.editpart.PortEditPart;
+import jp.go.aist.rtm.systemeditor.ui.editor.editpolicy.GraphicalConnectorCreateManager;
+import jp.go.aist.rtm.toolscommon.model.component.ConnectorProfile;
+import jp.go.aist.rtm.toolscommon.model.component.Port;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+import static jp.go.aist.rtm.systemeditor.nl.Messages.*;
+import static jp.go.aist.rtm.systemeditor.ui.util.RTMixin.*;
+
+public class ConnectPortActionDelegate implements IObjectActionDelegate {
+
+	static final String ACTION_CONNECT_ID = ConnectPortActionDelegate.class
+			.getName()
+			+ ".Connect";
+	static final String ACTION_DISCONNECT_ID = ConnectPortActionDelegate.class
+			.getName()
+			+ ".Disconnect";
+
+	static final String LABEL_CONNECT_PORT = getString("ConnectPortActionDelegate.connect");
+	static final String LABEL_DISCONNECT_PORT = getString("ConnectPortActionDelegate.disconnect");
+
+	static final String ERROR_CANNOT_DISCONNECT = getString("ConnectPortActionDelegate.error.1");
+	static final String ERROR_DISCONNECT_FAILURE = getString("ConnectPortActionDelegate.error.2");
+
+	AbstractSystemDiagramEditor editor;
+	Port port;
+
+	@Override
+	public void run(IAction action) {
+		if (isConnectAction(action)) {
+			runConnect();
+		} else {
+			runDisconnect();
+		}
+	}
+
+	public void runConnect() {
+		GraphicalConnectorCreateManager manager = new GraphicalConnectorCreateManager(
+				editor.getSite().getShell());
+		manager.setFirst(port);
+		if (!manager.validateSingle()) {
+			return;
+		}
+		manager.createProfileAndConnector();
+	}
+
+	public void runDisconnect() {
+		DisconnectDialog dialog = new DisconnectDialog(editor.getSite()
+				.getShell());
+		dialog.setPort(port);
+		int open = dialog.open();
+		if (open != IDialogConstants.OK_ID) {
+			return;
+		}
+		List<ConnectorProfile> deleteProfiles = dialog
+				.getDeleteConnectorProfiles();
+		if (port.getSynchronizer() == null) {
+			openError(ERROR_CANNOT_DISCONNECT);
+		}
+		String failIds = "";
+		for (ConnectorProfile prof : deleteProfiles) {
+			boolean ret = port.getSynchronizer().disconnect(
+					prof.getConnectorId());
+			if (!ret) {
+				if (!failIds.isEmpty()) {
+					failIds += ",";
+				}
+				failIds += prof.getConnectorId();
+			}
+		}
+		if (!failIds.isEmpty()) {
+			openError(form(ERROR_DISCONNECT_FAILURE, failIds));
+		}
+	}
+
+	@Override
+	public void selectionChanged(IAction action, ISelection selection) {
+		port = null;
+		if (selection instanceof IStructuredSelection) {
+			Object part = ((IStructuredSelection) selection).getFirstElement();
+			if (part instanceof PortEditPart) {
+				Port model = ((PortEditPart) part).getModel();
+				if (model instanceof Port) {
+					port = (Port) model;
+				}
+			}
+		}
+		action.setText((isConnectAction(action)) ? LABEL_CONNECT_PORT
+				: LABEL_DISCONNECT_PORT);
+		action.setEnabled(canExecution(action));
+	}
+
+	@Override
+	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+		if (targetPart instanceof AbstractSystemDiagramEditor) {
+			editor = (AbstractSystemDiagramEditor) targetPart;
+		}
+		action.setEnabled(canExecution(action));
+	}
+
+	boolean canExecution(IAction action) {
+		if (editor == null || port == null) {
+			return false;
+		}
+		if (isConnectAction(action)) {
+			return true;
+		} else {
+			return !port.getConnectorProfiles().isEmpty();
+		}
+	}
+
+	boolean isConnectAction(IAction action) {
+		return ACTION_CONNECT_ID.equals(action.getId());
+	}
+
+	void openError(String message) {
+		MessageDialog.openError(editor.getSite().getShell(), "Error", message);
+	}
+
+}

Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/DataConnectorCreaterDialog.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/DataConnectorCreaterDialog.java	2012-02-15 05:10:15 UTC (rev 275)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/DataConnectorCreaterDialog.java	2012-02-20 17:55:03 UTC (rev 276)
@@ -93,6 +93,11 @@
 		Text writeTimeoutText;
 		Combo emptyPolicyCombo;
 		Text readTimeoutText;
+		boolean enable;
+
+		public BufferPackage() {
+			this.enable = true;
+		}
 	}
 
 	public DataConnectorCreaterDialog(Shell parentShell) {
@@ -108,8 +113,11 @@
 		this.outport = outport;
 		this.inport = inport;
 
+		String outName = (outport != null) ? outport.getNameL() : "none";
+		String inName = (inport != null) ? inport.getNameL() : "none";
+
 		connectorProfile = ComponentFactory.eINSTANCE.createConnectorProfile();
-		connectorProfile.setName(outport.getNameL() + "_" + inport.getNameL());
+		connectorProfile.setName(outName + "_" + inName);
 
 		setShellStyle(this.getShellStyle() | SWT.RESIZE);
 		open();
@@ -558,6 +566,16 @@
 		});
 		createLabel(composite, "");
 
+		if ((isOutport && this.outport == null)
+				|| (!isOutport && this.inport == null)) {
+			pkg.enable = false;
+			pkg.lengthText.setEnabled(false);
+			pkg.fullPolicyCombo.setEnabled(false);
+			pkg.writeTimeoutText.setEnabled(false);
+			pkg.emptyPolicyCombo.setEnabled(false);
+			pkg.readTimeoutText.setEnabled(false);
+		}
+
 		return composite;
 	}
 
@@ -567,6 +585,15 @@
 		return l;
 	}
 
+	boolean isOffline() {
+		if (inport != null) {
+			return inport.eContainer() instanceof ComponentSpecification;
+		} else if (outport != null) {
+			return outport.eContainer() instanceof ComponentSpecification;
+		}
+		return false;
+	}
+
 	/**
 	 * モデル情報にアクセスし、表示に設定する
 	 */
@@ -580,13 +607,11 @@
 				.getDataType(), isAllowAny);
 		connectorProfile.setDataType(value);
 
-		boolean isOffline = inport.eContainer() instanceof ComponentSpecification;
-
 		SystemEditorPreferenceManager preference = SystemEditorPreferenceManager
 				.getInstance();
 
 		//
-		if (!isOffline) {
+		if (!isOffline()) {
 			types = ConnectorUtil.getAllowInterfaceTypes(outport, inport);
 			isAllowAny = ConnectorUtil.isAllowAnyInterfaceType(outport, inport);
 		} else {
@@ -597,7 +622,7 @@
 				.getInterfaceType(), isAllowAny);
 		connectorProfile.setInterfaceType(value);
 		//
-		if (!isOffline) {
+		if (!isOffline()) {
 			types = ConnectorUtil.getAllowDataflowTypes(outport, inport);
 			isAllowAny = ConnectorUtil.isAllowAnyDataflowType(outport, inport);
 		} else {
@@ -608,7 +633,7 @@
 				.getDataflowType(), isAllowAny);
 		connectorProfile.setDataflowType(value);
 		//
-		if (!isOffline) {
+		if (!isOffline()) {
 			types = ConnectorUtil.getAllowSubscriptionTypes(outport, inport);
 			isAllowAny = ConnectorUtil.isAllowAnySubscriptionType(outport,
 					inport);
@@ -620,7 +645,7 @@
 				.getSubscriptionType(), isAllowAny);
 		connectorProfile.setSubscriptionType(value);
 		//
-		if (!isOffline) {
+		if (!isOffline()) {
 			types = Arrays.asList(ConnectorProfile.PUSH_POLICY_TYPES);
 		} else {
 			types = Arrays.asList(preference.getPushPolicies());
@@ -642,12 +667,10 @@
 		String value;
 		boolean isAllowAny = false;
 
-		boolean isOffline = inport.eContainer() instanceof ComponentSpecification;
-
 		SystemEditorPreferenceManager preference = SystemEditorPreferenceManager
 				.getInstance();
 
-		if (!isOffline) {
+		if (!isOffline()) {
 			fullTypes = Arrays
 					.asList(ConnectorProfile.BUFFER_FULL_POLICY_TYPES);
 			emptyTypes = Arrays
@@ -657,7 +680,7 @@
 			emptyTypes = Arrays.asList(preference.getBufferEmptyPolicies());
 		}
 
-		if (ob != null) {
+		if (ob != null && ob.enable) {
 			//
 			value = loadCombo(ob.fullPolicyCombo, fullTypes, connectorProfile
 					.getOutportBufferFullPolicy(), isAllowAny);
@@ -686,7 +709,7 @@
 			ob.readTimeoutText.setText(value);
 		}
 		//
-		if (ib != null) {
+		if (ib != null && ib.enable) {
 			//
 			value = loadCombo(ib.fullPolicyCombo, fullTypes, connectorProfile
 					.getInportBufferFullPolicy(), isAllowAny);
@@ -721,9 +744,11 @@
 		combo.setItems(types.toArray(new String[0]));
 		String def = getDefaultValue(types, value, isAllowAny);
 		int index = types.indexOf(def);
-		index = (index == -1) ? 0 : index;
-		combo.select(index);
-		return types.get(index);
+		if (index != -1) {
+			combo.select(index);
+			return types.get(index);
+		}
+		return null;
 	}
 
 	/**
@@ -754,27 +779,24 @@
 	}
 
 	@Override
-	/**
-	 * {@inheritDoc}
-	 */
 	protected void configureShell(Shell shell) {
 		super.configureShell(shell);
 		shell.setText(Messages.getString("DataConnectorCreaterDialog.16")); //$NON-NLS-1$
 	}
 
+	@SuppressWarnings("unchecked")
 	@Override
-	/**
-	 * {@inheritDoc}
-	 */
 	protected void okPressed() {
-		if( additionalTableViewer!=null ) {
-			List<AdditionalEntry> additional = (List<AdditionalEntry>)additionalTableViewer.getInput();
-			//重複チェック
-			if( checkProperties(additional)==false) {
+		if (additionalTableViewer != null) {
+			List<AdditionalEntry> additional = (List<AdditionalEntry>) additionalTableViewer
+					.getInput();
+			// 重複チェック
+			if (checkProperties(additional) == false) {
 				return;
 			}
-			for(AdditionalEntry target : additional) {
-				connectorProfile.setProperty(target.getName(), target.getValue());
+			for (AdditionalEntry target : additional) {
+				connectorProfile.setProperty(target.getName(), target
+						.getValue());
 			}
 		}
 		dialogResult = connectorProfile;
@@ -783,19 +805,15 @@
 
 	@Override
 	/**
-	 * {@inheritDoc}
-	 * <p>
 	 * メッセージを設定する。 メッセージとしてはエラーメッセージを想定しており、
 	 * エラーメッセージが存在するか空文字かどうかにより、OKボタンのEnableの制御も行うように、オーバーライドした。
 	 */
 	public void setMessage(String newMessage, int newType) {
 		super.setMessage(newMessage, newType);
-
 		boolean isOkEnable = false;
 		if (newMessage.length() == 0) {
 			isOkEnable = true;
 		}
-
 		getButton(IDialogConstants.OK_ID).setEnabled(isOkEnable);
 	}
 
@@ -848,7 +866,7 @@
 			}
 		}
 
-		if (ob != null) {
+		if (ob != null && ob.enable) {
 			boolean isInt = false;
 			try {
 				int i = Integer.parseInt(ob.lengthText.getText());
@@ -892,7 +910,7 @@
 			}
 		}
 
-		if (ib != null) {
+		if (ib != null && ib.enable) {
 			boolean isInt = false;
 			try {
 				int i = Integer.parseInt(ib.lengthText.getText());

Added: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/DisconnectDialog.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/DisconnectDialog.java	                        (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/DisconnectDialog.java	2012-02-20 17:55:03 UTC (rev 276)
@@ -0,0 +1,221 @@
+package jp.go.aist.rtm.systemeditor.ui.dialog;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import jp.go.aist.rtm.toolscommon.model.component.ConnectorProfile;
+import jp.go.aist.rtm.toolscommon.model.component.Port;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+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.Table;
+import org.eclipse.swt.widgets.TableColumn;
+
+import static jp.go.aist.rtm.systemeditor.nl.Messages.*;
+
+public class DisconnectDialog extends TitleAreaDialog {
+
+	static final String DIALOG_TITLE = getString("DisconnectDialog.title");
+	static final String DIALOG_EXPLAN = getString("DisconnectDialog.explain");
+
+	static final String PROPERTY_CONN_ID = "PROPERTY_CONN_ID";
+	static final String PROPERTY_CONN_NAME = "PROPERTY_CONN_NAME";
+
+	static final String COLUMN_LABEL_CONN_ID = "Connector Id";
+	static final String COLUMN_LABEL_CONN_NAME = "Connector name";
+
+	static final String BUTTON_LABEL_DELETE = getString("Common.button.delete");
+
+	static final int EXEC_BUTTON_WIDTH = 70;
+
+	TableViewer tableViewer;
+	Table table;
+	Button deleteButton;
+
+	Port port;
+	List<ConnectorProfile> profiles;
+	List<ConnectorProfile> deleteProfiles;
+	ConnectorProfile selectedConnectorProfile;
+
+	public DisconnectDialog(Shell parentShell) {
+		super(parentShell);
+		setHelpAvailable(false);
+		setShellStyle(getShellStyle() | SWT.CENTER | SWT.RESIZE);
+	}
+
+	/** コネクション切断対象のポートを設定 */
+	public void setPort(Port port) {
+		this.port = port;
+	}
+
+	/** 切断するコネクタプロファイルのリストを取得 */
+	public List<ConnectorProfile> getDeleteConnectorProfiles() {
+		return this.deleteProfiles;
+	}
+
+	@Override
+	protected Control createDialogArea(Composite parent) {
+		GridLayout gl;
+		GridData gd;
+
+		setTitle(DIALOG_EXPLAN);
+
+		Composite mainComposite = new Composite((Composite) super
+				.createDialogArea(parent), SWT.NONE);
+		gl = new GridLayout(2, false);
+		gd = new GridData(GridData.FILL_BOTH);
+		mainComposite.setLayout(gl);
+		mainComposite.setLayoutData(gd);
+		mainComposite.setFont(parent.getFont());
+
+		Label label = new Label(mainComposite, SWT.NONE);
+		label.setText(port.getNameL());
+		gd = new GridData();
+		gd.horizontalAlignment = SWT.FILL;
+		gd.horizontalSpan = 2;
+		label.setLayoutData(gd);
+
+		tableViewer = new TableViewer(mainComposite, SWT.FULL_SELECTION
+				| SWT.SINGLE | SWT.BORDER);
+		tableViewer.setContentProvider(new ArrayContentProvider());
+		tableViewer.setColumnProperties(new String[] { PROPERTY_CONN_ID,
+				PROPERTY_CONN_NAME });
+		tableViewer.setLabelProvider(new ConnectorLabelProvider());
+		tableViewer
+				.addSelectionChangedListener(new ISelectionChangedListener() {
+					public void selectionChanged(SelectionChangedEvent event) {
+						StructuredSelection selection = (StructuredSelection) event
+								.getSelection();
+						selectedConnectorProfile = (ConnectorProfile) selection
+								.getFirstElement();
+						notifyModified();
+					}
+				});
+
+		table = tableViewer.getTable();
+		gl = new GridLayout(1, false);
+		gd = new GridData();
+		gd.verticalAlignment = SWT.FILL;
+		gd.horizontalAlignment = SWT.FILL;
+		gd.grabExcessVerticalSpace = true;
+		gd.grabExcessHorizontalSpace = true;
+		gd.heightHint = 150;
+		table.setLayout(gl);
+		table.setLayoutData(gd);
+		table.setLinesVisible(true);
+		table.setHeaderVisible(true);
+
+		TableColumn col = new TableColumn(table, SWT.NONE);
+		col.setText(COLUMN_LABEL_CONN_ID);
+		col.setWidth(300);
+		col = new TableColumn(table, SWT.NONE);
+		col.setText(COLUMN_LABEL_CONN_NAME);
+		col.setWidth(200);
+
+		Composite buttonComposite = new Composite(mainComposite, SWT.NONE);
+		gl = new GridLayout(1, false);
+		gd = new GridData();
+		gd.verticalAlignment = SWT.FILL;
+		buttonComposite.setLayout(gl);
+		buttonComposite.setLayoutData(gd);
+
+		deleteButton = new Button(buttonComposite, SWT.PUSH);
+		deleteButton.setText(BUTTON_LABEL_DELETE);
+		gd = new GridData();
+		gd.widthHint = EXEC_BUTTON_WIDTH;
+		deleteButton.setLayoutData(gd);
+		deleteButton.setEnabled(false);
+		deleteButton.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				if (selectedConnectorProfile != null) {
+					profiles.remove(selectedConnectorProfile);
+					deleteProfiles.add(selectedConnectorProfile);
+					selectedConnectorProfile = null;
+					tableViewer.refresh();
+				}
+				notifyModified();
+			}
+		});
+
+		buildData();
+
+		return mainComposite;
+	}
+
+	@Override
+	protected Control createButtonBar(Composite parent) {
+		Control composite = super.createButtonBar(parent);
+		notifyModified();
+		return composite;
+	}
+
+	@Override
+	protected void configureShell(Shell shell) {
+		super.configureShell(shell);
+		shell.setText(DIALOG_TITLE);
+	}
+
+	/** 表示内容を構築 */
+	void buildData() {
+		if (profiles == null) {
+			profiles = new ArrayList<ConnectorProfile>();
+			deleteProfiles = new ArrayList<ConnectorProfile>();
+		}
+		profiles.addAll(port.getConnectorProfiles());
+		tableViewer.setInput(profiles);
+	}
+
+	/** 変更を通知します */
+	void notifyModified() {
+		if (selectedConnectorProfile != null) {
+			deleteButton.setEnabled(true);
+		} else {
+			deleteButton.setEnabled(false);
+		}
+		if (deleteProfiles.isEmpty()) {
+			getButton(IDialogConstants.OK_ID).setEnabled(false);
+		} else {
+			getButton(IDialogConstants.OK_ID).setEnabled(true);
+		}
+	}
+
+	/** ラベルプロバイダ(コンポーネント) */
+	public class ConnectorLabelProvider extends LabelProvider implements
+			ITableLabelProvider {
+
+		@Override
+		public Image getColumnImage(Object element, int columnIndex) {
+			return null;
+		}
+
+		@Override
+		public String getColumnText(Object element, int columnIndex) {
+			ConnectorProfile entry = (ConnectorProfile) element;
+			if (columnIndex == 0) {
+				return entry.getConnectorId();
+			} else if (columnIndex == 1) {
+				return entry.getName();
+			}
+			return null;
+		}
+	}
+}

Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/ServiceConnectorCreaterDialog.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/ServiceConnectorCreaterDialog.java	2012-02-15 05:10:15 UTC (rev 275)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/ServiceConnectorCreaterDialog.java	2012-02-20 17:55:03 UTC (rev 276)
@@ -142,13 +142,18 @@
 		consumerLabels = new ArrayList<String>();
 		providerMap = new HashMap<String, ConnectorProfile.InterfaceId>();
 		providerLabels = new ArrayList<String>();
-		registInterfaceMap(first);
-		registInterfaceMap(second);
+		if (first != null) {
+			registInterfaceMap(first);
+		}
+		if (second != null) {
+			registInterfaceMap(second);
+		}
 
-		this.connectorProfile = ComponentFactory.eINSTANCE
-				.createConnectorProfile();
-		this.connectorProfile.setName(first.getNameL() + "_"
-				+ second.getNameL());
+		String firstName = (first != null) ? first.getNameL() : "none";
+		String secondName = (second != null) ? second.getNameL() : "none";
+
+  		connectorProfile = ComponentFactory.eINSTANCE.createConnectorProfile();
+		connectorProfile.setName(firstName + "_" + secondName);
 		this.connectorProfile.setProperty("port.connection.strictness", "strict");
 
 		open();
@@ -217,9 +222,10 @@
 
 		baseMessage = MSG_ERROR;
 		try {
-			List<PortInterfaceProfile> interfaces1 = first.getInterfaces();
-			List<PortInterfaceProfile> interfaces2 = second.getInterfaces();
-
+			List<PortInterfaceProfile> interfaces1 = (first != null) ? first
+					.getInterfaces() : new ArrayList<PortInterfaceProfile>();
+			List<PortInterfaceProfile> interfaces2 = (second != null) ? second
+					.getInterfaces() : new ArrayList<PortInterfaceProfile>();
 			int countMatch = countMatch(interfaces1, interfaces2);
 			if (countMatch > 0
 					&& countMatch == countTotal(interfaces1, interfaces2)) {
@@ -472,10 +478,12 @@
 			connectorProfile.setProperty(consumer, provider);
 		}
 		
-		if( additionalTableViewer!=null ) {
-			List<AdditionalEntry> additional = (List<AdditionalEntry>)additionalTableViewer.getInput();
-			for(AdditionalEntry target : additional) {
-				connectorProfile.setProperty(target.getName(), target.getValue());
+		if (additionalTableViewer != null) {
+			List<?> additional = (List<?>) additionalTableViewer.getInput();
+			for (Object o : additional) {
+				AdditionalEntry target = (AdditionalEntry) o;
+				connectorProfile.setProperty(target.getName(), target
+						.getValue());
 			}
 		}
 	}
@@ -514,11 +522,13 @@
 		shell.setText(DIALOG_TITLE);
 	}
 
+	@SuppressWarnings("unchecked")
 	@Override
 	protected void okPressed() {
-		if( additionalTableViewer!=null ) {
-			//重複チェック
-			if( checkProperties((List<AdditionalEntry>)additionalTableViewer.getInput())==false) {
+		if (additionalTableViewer != null) {
+			// 重複チェック
+			if (!checkProperties((List<AdditionalEntry>) additionalTableViewer
+					.getInput())) {
 				return;
 			}
 		}

Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpolicy/GraphicalConnectorCreateManager.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpolicy/GraphicalConnectorCreateManager.java	2012-02-15 05:10:15 UTC (rev 275)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/editpolicy/GraphicalConnectorCreateManager.java	2012-02-20 17:55:03 UTC (rev 276)
@@ -89,6 +89,11 @@
 				&& getTarget().validateSourceConnector(getSource());
 	}
 
+	public boolean validateSingle() {
+		return (getSource() != null && getTarget() == null)
+				|| (getSource() == null && getTarget() != null);
+	}
+
 	/**
 	 * ConnectorProfileを生成し、ポート接続を行います。
 	 * 
@@ -136,6 +141,18 @@
 			return new ServiceConnectorCreaterDialog(shell)
 					.getConnectorProfile((ServicePort) getSource(),
 							(ServicePort) getTarget());
+		} else if (getSource() instanceof OutPort && getTarget() == null) {
+			// OutPortのみ
+			return new DataConnectorCreaterDialog(shell).getConnectorProfile(
+					(OutPort) getSource(), null);
+		} else if (getSource() instanceof InPort && getTarget() == null) {
+			// InPortのみ
+			return new DataConnectorCreaterDialog(shell).getConnectorProfile(
+					null, (InPort) getSource());
+		} else if (getSource() instanceof ServicePort && getTarget() == null) {
+			// ServicePortのみ
+			return new ServiceConnectorCreaterDialog(shell)
+					.getConnectorProfile((ServicePort) getSource(), null);
 		} else {
 			return null;
 		}



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