From jbosstools-commits at lists.jboss.org Sat Jan 30 09:37:31 2010
Content-Type: multipart/mixed; boundary="===============7018137050055895498=="
MIME-Version: 1.0
From: jbosstools-commits at lists.jboss.org
To: jbosstools-commits at lists.jboss.org
Subject: [jbosstools-commits] JBoss Tools SVN: r20034 - in
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks:
graphical/editors/model/javamapping and 1 other directory.
Date: Sat, 30 Jan 2010 09:37:31 -0500
Message-ID: <201001301437.o0UEbVG5014575@svn01.web.mwc.hst.phx2.redhat.com>
--===============7018137050055895498==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: tfennelly
Date: 2010-01-30 09:37:31 -0500 (Sat, 30 Jan 2010)
New Revision: 20034
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smook=
s/editor/propertySections/DecodeParamMetaData.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smook=
s/editor/propertySections/DecodeParamMetaDataFactory.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smook=
s/graphical/editors/model/javamapping/JavaNode.java
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smook=
s/editor/propertySections/Messages.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smook=
s/editor/propertySections/ValueDecodeParamSection.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smook=
s/editor/propertySections/messages.properties
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smook=
s/graphical/editors/model/javamapping/JavaBeanChildGraphModel.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5687
Improve Decode Param support
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/s=
mooks/editor/propertySections/DecodeParamMetaData.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smoo=
ks/editor/propertySections/DecodeParamMetaData.java =
(rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smoo=
ks/editor/propertySections/DecodeParamMetaData.java 2010-01-30 14:37:31 UTC=
(rev 20034)
@@ -0,0 +1,54 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WIT=
HOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNE=
SS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more=
details.
+ * You should have received a copy of the GNU Lesser General Public Licens=
e,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009, JBoss Inc.
+ */
+package org.jboss.tools.smooks.editor.propertySections;
+
+/**
+ * Java value binding data decode parameter metadata.
+ *
+ * @author tom.fennelly(a)jbos=
s.com
+ */
+public class DecodeParamMetaData {
+
+ private String name;
+ private String defaultVal;
+ private boolean requiresConfiguration;
+ =
+ public DecodeParamMetaData(String name, String defaultVal) {
+ this.name =3D name;
+ this.defaultVal =3D defaultVal;
+ }
+ =
+ public DecodeParamMetaData(String name, String defaultVal, boolean requir=
esConfiguration) {
+ this(name, defaultVal);
+ this.requiresConfiguration =3D requiresConfiguration;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getDefaultVal() {
+ return defaultVal;
+ }
+
+ public boolean isRequiresConfiguration() {
+ return requiresConfiguration;
+ } =
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org=
/jboss/tools/smooks/editor/propertySections/DecodeParamMetaData.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/s=
mooks/editor/propertySections/DecodeParamMetaDataFactory.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smoo=
ks/editor/propertySections/DecodeParamMetaDataFactory.java =
(rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smoo=
ks/editor/propertySections/DecodeParamMetaDataFactory.java 2010-01-30 14:37=
:31 UTC (rev 20034)
@@ -0,0 +1,58 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WIT=
HOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNE=
SS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more=
details.
+ * You should have received a copy of the GNU Lesser General Public Licens=
e,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009, JBoss Inc.
+ */
+package org.jboss.tools.smooks.editor.propertySections;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.milyn.javabean.DataDecoder;
+import org.milyn.javabean.decoders.CalendarDecoder;
+import org.milyn.javabean.decoders.DateDecoder;
+import org.milyn.javabean.decoders.LocaleAwareDateDecoder;
+import org.milyn.javabean.decoders.SqlDateDecoder;
+import org.milyn.javabean.decoders.SqlTimeDecoder;
+
+/**
+ * Factory class for storing decode parameter metadata..
+ *
+ * @author tom.fennelly(a)jbos=
s.com
+ */
+public class DecodeParamMetaDataFactory {
+
+ private static Map, DecodeParamMetaData[]> c=
onfigMap =3D new HashMap, DecodeParamMetaData[=
]>();
+ =
+ static {
+ DecodeParamMetaData[] dateDecodeMD =3D new DecodeParamMetaData[] {
+ new DecodeParamMetaData(LocaleAwareDateDecoder.FORMAT, LocaleAwareDate=
Decoder.DEFAULT_DATE_FORMAT),
+ new DecodeParamMetaData(LocaleAwareDateDecoder.LOCALE_COUNTRY_CODE, nu=
ll),
+ new DecodeParamMetaData(LocaleAwareDateDecoder.LOCALE_LANGUAGE_CODE, n=
ull)
+ };
+
+ // The date decoders all have the same basic configuration...
+ configMap.put(DateDecoder.class, dateDecodeMD);
+ configMap.put(CalendarDecoder.class, dateDecodeMD);
+ configMap.put(SqlDateDecoder.class, dateDecodeMD);
+ configMap.put(SqlTimeDecoder.class, dateDecodeMD);
+ }
+ =
+ public static DecodeParamMetaData[] getDecodeParamMetaData(Class extend=
s DataDecoder> decoder) {
+ return configMap.get(decoder);
+ }
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org=
/jboss/tools/smooks/editor/propertySections/DecodeParamMetaDataFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tool=
s/smooks/editor/propertySections/Messages.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smoo=
ks/editor/propertySections/Messages.java 2010-01-29 23:30:31 UTC (rev 20033)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smoo=
ks/editor/propertySections/Messages.java 2010-01-30 14:37:31 UTC (rev 20034)
@@ -22,6 +22,8 @@
public static String ValueDecodeParamSection_NullText;
public static String ValueDecodeParamSection_ParamNameColumnText;
public static String ValueDecodeParamSection_ParamValueColumnText;
+ public static String ValueDecodeParamSection_EnumParamNameColumnText;
+ public static String ValueDecodeParamSection_EnumParamValueColumnText;
public static String ValueDecodeParamSection_SectionTitle;
static {
// initialize resource bundle
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tool=
s/smooks/editor/propertySections/ValueDecodeParamSection.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smoo=
ks/editor/propertySections/ValueDecodeParamSection.java 2010-01-29 23:30:31=
UTC (rev 20033)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smoo=
ks/editor/propertySections/ValueDecodeParamSection.java 2010-01-30 14:37:31=
UTC (rev 20034)
@@ -17,17 +17,16 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.Map.Entry;
=
-import org.eclipse.core.resources.IProject;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CompoundCommand;
-import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.IStructuredContentProvider;
@@ -50,23 +49,21 @@
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.forms.IFormColors;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFac=
tory;
-import org.jboss.tools.smooks.configuration.editors.SelectorCreationDialog;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavaBeanModel;
-import org.jboss.tools.smooks.configuration.editors.uitls.ProjectClassLoad=
er;
-import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+import org.jboss.tools.smooks.gef.model.AbstractSmooksGraphicalModel;
import org.jboss.tools.smooks.gef.tree.model.TreeNodeConnection;
+import org.jboss.tools.smooks.graphical.editors.model.javamapping.JavaBean=
ChildGraphModel;
import org.jboss.tools.smooks.model.javabean12.DecodeParamType;
-import org.jboss.tools.smooks.model.javabean12.Javabean12Factory;
import org.jboss.tools.smooks.model.javabean12.Javabean12Package;
import org.jboss.tools.smooks.model.javabean12.ValueType;
import org.milyn.javabean.DataDecoder;
+import org.milyn.javabean.decoders.EnumDecoder;
+import org.milyn.javabean.decoders.IntegerDecoder;
=
/**
* @author Dart
@@ -77,6 +74,9 @@
private Composite controlComposite;
private TableViewer paramterViewer;
private CCombo decoderCombo;
+ boolean isEnumTarget;
+ private TableColumn nameColumn;
+ private TableColumn valueColumn;
=
private static List DECODERS =3D new ArrayList();
=
@@ -189,74 +189,6 @@
}
}
=
- private String[] getDecoderParametersName(String decoder) {
- if (decoder !=3D null) {
- if ("Date".equals(decoder)) {
- return new String[] { "format", "locale-language", "locale-country" };
- }
-
- if ("Enum".equals(decoder)) {
- TreeNodeConnection lineModel =3D (TreeNodeConnection) getPresentSelect=
edGraphModel();
- Object model =3D lineModel.getTargetNode().getData();
- model =3D AdapterFactoryEditingDomain.unwrap(model);
- if (model !=3D null && model instanceof ValueType) {
- String[] enumFieldsString =3D null;
- List