[openrtm-commit:00619] r250 - trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview

openrtm @ openrtm.org openrtm @ openrtm.org
2012年 1月 30日 (月) 00:43:46 JST


Author: sakamoto
Date: 2012-01-30 00:43:45 +0900 (Mon, 30 Jan 2012)
New Revision: 250

Modified:
   trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/ConfigurationView.java
Log:
Modified ConfigrationSet Update #2291

Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/ConfigurationView.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/ConfigurationView.java	2012-01-29 15:43:35 UTC (rev 249)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/views/configurationview/ConfigurationView.java	2012-01-29 15:43:45 UTC (rev 250)
@@ -251,7 +251,7 @@
 						copiedComponent.getActiveConfigSet());
 
 		ConfigurationSet newActiveConfigurationSet = null;
-		if (activeConfigurationIndex != -1) {
+		if (activeConfigurationIndex != -1 && isActiveConfigurationSetChanged()) {
 			newActiveConfigurationSet = newConfigurationSetList
 					.get(activeConfigurationIndex);
 		}
@@ -275,6 +275,7 @@
 		buildData();
 
 		leftTable.setSelection(selectionIndex);
+		refreshRightData();
 	}
 
 	/** ActiveなRTCのコンフィグを変更するかを確認する */
@@ -300,36 +301,43 @@
 	}
 
 	/**
-	 * アクティブなコンフィグレーションを修正したかどうか
-	 * 
-	 * @return
+	 * アクティブなコンフィグレーションを切り替えたか
 	 */
-	private boolean isActiveConfigurationSetModified() {
-		if (copiedComponent.getActiveConfigSet() == null ||
-				copiedComponent.getActiveConfigSet().getConfigurationSet() == null) {
+	private boolean isActiveConfigurationSetChanged() {
+		if (copiedComponent.getActiveConfigSet() == null
+				|| copiedComponent.getActiveConfigSet().getConfigurationSet() == null) {
 			return targetComponent.getActiveConfigurationSet() != null;
 		}
-
-		if (targetComponent.getActiveConfigurationSet() == null)
+		if (targetComponent.getActiveConfigurationSet() == null) {
 			return true;
-		if (copiedComponent.getActiveConfigSet().getConfigurationSet().getId().equals(
-				targetComponent.getActiveConfigurationSet().getId()) == false) 
+		}
+		if (!copiedComponent.getActiveConfigSet().getConfigurationSet().getId()
+				.equals(targetComponent.getActiveConfigurationSet().getId())) {
 			return true;
-		if (copiedComponent.getActiveConfigSet().getNamedValueList()
-					.size() != targetComponent.getActiveConfigurationSet()
-					.getConfigurationData().size()) {
+		}
+		return false;
+	}
+
+	/**
+	 * アクティブなコンフィグレーションを修正したかどうか
+	 */
+	private boolean isActiveConfigurationSetModified() {
+		if (isActiveConfigurationSetChanged()) {
 			return true;
 		}
+		if (copiedComponent.getActiveConfigSet().getNamedValueList().size() != targetComponent
+				.getActiveConfigurationSet().getConfigurationData().size()) {
+			return true;
+		}
 		for (NamedValueConfigurationWrapper namedValue : copiedComponent
-					.getActiveConfigSet().getNamedValueList()) {
-			if (namedValue.isKeyModified()
-						|| namedValue.isValueModified()) {
-					return true;
+				.getActiveConfigSet().getNamedValueList()) {
+			if (namedValue.isKeyModified() || namedValue.isValueModified()) {
+				return true;
 			}
 		}
 		return false;
 	}
-
+	
 	/**
 	 * 編集後の新しいConfigurationSetを作成する。
 	 * <p>
@@ -468,7 +476,6 @@
 		gd.widthHint = BUTTON_WIDTH;
 		addConfigurationSetButton.setLayoutData(gd);
 		addConfigurationSetButton.addSelectionListener(new SelectionAdapter() {
-			@SuppressWarnings("unchecked") //$NON-NLS-1$
 			@Override
 			public void widgetSelected(SelectionEvent e) {
 				ConfigurationSetConfigurationWrapper csw = new ConfigurationSetConfigurationWrapper(
@@ -573,7 +580,6 @@
 		gd.widthHint = BUTTON_WIDTH;
 		copyConfigurationSetButton.setLayoutData(gd);
 		copyConfigurationSetButton.addSelectionListener(new SelectionAdapter() {
-			@SuppressWarnings("unchecked") //$NON-NLS-1$
 			@Override
 			public void widgetSelected(SelectionEvent e) {
 				if (leftTable.getSelectionIndex() < 0) return;
@@ -964,18 +970,18 @@
 		configrationSetNameLabel.setText(""); //$NON-NLS-1$
 		addNamedValueButton.setEnabled(false);
 
-		if (copiedComponent != null) {
-			if (leftTable.getSelectionIndex() != -1) {
-				addNamedValueButton.setEnabled(true);
-				ConfigurationSetConfigurationWrapper currentConfugurationSet = copiedComponent
-						.getConfigurationSetList().get(
-								leftTable.getSelectionIndex());
+		if (copiedComponent != null && leftTable.getSelectionIndex() != -1) {
+			ConfigurationSetConfigurationWrapper currentConfugurationSet = copiedComponent
+					.getConfigurationSetList().get(
+							leftTable.getSelectionIndex());
 
-				configrationSetNameLabel.setText(currentConfugurationSet
-						.getId());
+			configrationSetNameLabel.setText(currentConfugurationSet.getId());
 
-				rightTableViewer.setInput(currentConfugurationSet
-						.getNamedValueList());
+			rightTableViewer.setInput(currentConfugurationSet
+					.getNamedValueList());
+			//
+			if (!(targetComponent instanceof CorbaComponent)) {
+				addNamedValueButton.setEnabled(true);
 			}
 		}
 
@@ -984,7 +990,9 @@
 
 	private void updateDeleteNamedValueButtonEnable() {
 		if (rightTable.getSelectionIndex() != -1) {
-			deleteNamedValueButton.setEnabled(true);
+			if (!(targetComponent instanceof CorbaComponent)) {
+				deleteNamedValueButton.setEnabled(true);
+			}
 		} else {
 			deleteNamedValueButton.setEnabled(false);
 		}
@@ -1224,7 +1232,7 @@
 
 			boolean isModify = false;
 			if (columnIndex == 0) {
-				if (isActiveConfigurationSetModified()) {
+				if (isActiveConfigurationSetChanged()) {
 					if (targetComponent.getActiveConfigurationSet() == configurationSetConfigurationWrapper
 							.getConfigurationSet()
 							|| copiedComponent.getActiveConfigSet() == configurationSetConfigurationWrapper) {



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