[jbosstools-commits] JBoss Tools SVN: r17549 - in trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute: editor and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Sep 14 12:18:22 EDT 2009


Author: scabanovich
Date: 2009-09-14 12:18:22 -0400 (Mon, 14 Sep 2009)
New Revision: 17549

Modified:
   trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/CheckListAdapter.java
   trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/CheckListFieldEditor.java
   trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ComboBoxFieldEditor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2607

Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/CheckListAdapter.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/CheckListAdapter.java	2009-09-14 16:17:42 UTC (rev 17548)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/CheckListAdapter.java	2009-09-14 16:18:22 UTC (rev 17549)
@@ -54,8 +54,9 @@
 	
 	public void checkAll() {
 		StringBuffer sb = new StringBuffer();
+		char separator = getSeparator();
 		for (int i = 0; i < tags.length; i++) {
-			if(i > 0) sb.append(';');
+			if(i > 0) sb.append(separator);
 			sb.append(tags[i]);
 		}
 		setValue(sb.toString());
@@ -138,4 +139,16 @@
 			return false;
 		}
 	}
+
+	public char getSeparator() {
+		XAttribute a = getAttribute();
+		if(a == null && getAttributeData() != null) {
+			a = getAttributeData().getAttribute();
+		}
+		if(a != null) {
+			String s = a.getProperty("separator");
+			if("comma".equals(s)) return ',';
+		}
+		return ';';
+	}
 }

Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/CheckListFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/CheckListFieldEditor.java	2009-09-14 16:17:42 UTC (rev 17548)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/CheckListFieldEditor.java	2009-09-14 16:18:22 UTC (rev 17549)
@@ -12,10 +12,13 @@
 
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
+import java.util.HashSet;
+import java.util.Set;
 import java.util.StringTokenizer;
 
 import org.jboss.tools.common.model.ui.IValueChangeListener;
 import org.jboss.tools.common.model.ui.IValueProvider;
+import org.jboss.tools.common.model.ui.attribute.adapter.CheckListAdapter;
 import org.jboss.tools.common.model.ui.wizards.query.list.TreeItemSelectionManager;
 import org.eclipse.jface.util.IPropertyChangeListener;
 import org.eclipse.jface.viewers.IContentProvider;
@@ -42,6 +45,8 @@
 	
 	private String stringValue;
 	private TreeViewer viewer;
+
+	String separator = ";";
 	
 	public CheckListFieldEditor() {}
 	
@@ -128,6 +133,9 @@
 			contentProvider = (IContentProvider)propertyEditor.getAdapter(ITreeContentProvider.class);
 			labelProvider = (ILabelProvider)propertyEditor.getAdapter(ILabelProvider.class);
 //			Object input = propertyEditor.getInput();
+			if(propertyEditor.getInput() instanceof CheckListAdapter) {
+				separator = "" + ((CheckListAdapter)propertyEditor.getInput()).getSeparator();
+			}
 		}
 		init();
 	}
@@ -148,15 +156,15 @@
 						lock++;
 						Tree tree = viewer.getTree();
 						TreeItem[] is = tree.getItems();
+						Set<String> vs = new HashSet<String>();
+						StringTokenizer values = new StringTokenizer(stringValue, ";,"); //$NON-NLS-1$
+						while(values.hasMoreTokens()) {
+							String n = values.nextToken();
+							vs.add(n);
+						}
 						for (int i = 0; i < is.length; i++) {
 							Object d = is[i].getData();
-							StringTokenizer values = new StringTokenizer(stringValue, ";,"); //$NON-NLS-1$
-							while(values.hasMoreTokens()) {
-								String n = values.nextToken();
-								if(n.equals(d)) {
-									is[i].setChecked(true);
-								}
-							}
+							is[i].setChecked(vs.contains(d));
 						}
 						lock--;
 					}
@@ -182,12 +190,12 @@
 			if (value.equals(currentItem))
 				currentItemExists = true;
 			else {
-				if(newValue.length() > 0 && !newValue.endsWith(";") && !newValue.endsWith(",")) newValue += ";"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				if(newValue.length() > 0 && !newValue.endsWith(";") && !newValue.endsWith(",")) newValue += separator; //$NON-NLS-1$ //$NON-NLS-2$
 				newValue += value;
 			}
 		}
 		if (!currentItemExists) {
-			if(newValue.length() > 0 && !newValue.endsWith(";") && !newValue.endsWith(",")) newValue += ";"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			if(newValue.length() > 0 && !newValue.endsWith(";") && !newValue.endsWith(",")) newValue += separator; //$NON-NLS-1$ //$NON-NLS-2$
 			newValue += currentItem;
 		}
 		valueChanged(newValue);

Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ComboBoxFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ComboBoxFieldEditor.java	2009-09-14 16:17:42 UTC (rev 17548)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/ComboBoxFieldEditor.java	2009-09-14 16:18:22 UTC (rev 17549)
@@ -256,6 +256,7 @@
 			
 			
 			SimpleContentProposalProvider cpp = new SimpleContentProposalProvider(set.toArray(new String[0]));
+			cpp.setFiltering(true);
 			KeyStroke ks = AttributeContentProposalProviderFactory.getCtrlSpaceKeyStroke();
 			
 			ContentProposalAdapter adapter = new ContentProposalAdapter(



More information about the jbosstools-commits mailing list