Author: DartPeng
Date: 2009-04-15 06:22:15 -0400 (Wed, 15 Apr 2009)
New Revision: 14754
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/XSDFileCollect.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/provider/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/provider/CalcDocumentRootItemProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/provider/CalcItemProviderAdapterFactory.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/provider/CounterItemProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/calc/
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/calc/CounterUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/datasource/
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/datasource/DataSourceJndiUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/datasource/DirectUICreator.java
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/META-INF/MANIFEST.MF
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/provider/SmooksResourceListTypeItemProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/Codegenerator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreatorManager.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationFormPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksStuffPropertyDetailPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/SmooksResourceListTypeUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/IModelProcsser.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java
Log:
JBIDE-4171
Change CDATA/Comment edit UI
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/META-INF/MANIFEST.MF 2009-04-15
09:49:21 UTC (rev 14753)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/META-INF/MANIFEST.MF 2009-04-15
10:22:15 UTC (rev 14754)
@@ -13,6 +13,10 @@
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.jboss.tools.smooks.core,
+ org.jboss.tools.smooks.model.calc,
+ org.jboss.tools.smooks.model.calc.impl,
+ org.jboss.tools.smooks.model.calc.provider,
+ org.jboss.tools.smooks.model.calc.util,
org.jboss.tools.smooks.model.common,
org.jboss.tools.smooks.model.common.impl,
org.jboss.tools.smooks.model.common.provider,
@@ -21,6 +25,10 @@
org.jboss.tools.smooks.model.csv.impl,
org.jboss.tools.smooks.model.csv.provider,
org.jboss.tools.smooks.model.csv.util,
+ org.jboss.tools.smooks.model.datasource,
+ org.jboss.tools.smooks.model.datasource.impl,
+ org.jboss.tools.smooks.model.datasource.provider,
+ org.jboss.tools.smooks.model.datasource.util,
org.jboss.tools.smooks.model.dbrouting,
org.jboss.tools.smooks.model.dbrouting.impl,
org.jboss.tools.smooks.model.dbrouting.provider,
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/XSDFileCollect.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/XSDFileCollect.java
(rev 0)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/XSDFileCollect.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -0,0 +1,27 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.core;
+
+import java.io.File;
+
+/**
+ * @author DartPeng
+ *
+ */
+public class XSDFileCollect {
+ public static void main(String[] args) {
+ String path =
"/home/DartPeng/Work/eclipse/smooks-configuration-workspace/org.jboss.tools.smooks.core/xsd";
+ File folder = new File(path);
+ File[] files = folder.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ File file = files[i];
+ if (file.isFile()) {
+ String name = file.getName();
+ if(name.endsWith(".xsd")){
+ System.out.println(file.getName());
+ }
+ }
+ }
+ }
+}
Property changes on:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/XSDFileCollect.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/provider/CalcDocumentRootItemProvider.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/provider/CalcDocumentRootItemProvider.java
(rev 0)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/provider/CalcDocumentRootItemProvider.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -0,0 +1,168 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.jboss.tools.smooks.model.calc.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+import org.jboss.tools.smooks.model.calc.CalcDocumentRoot;
+import org.jboss.tools.smooks.model.calc.CalcFactory;
+import org.jboss.tools.smooks.model.calc.CalcPackage;
+import org.jboss.tools.smooks.model.xsl.provider.Xsl1EditPlugin;
+
+/**
+ * This is the item provider adapter for a {@link
org.jboss.tools.smooks.model.calc.CalcDocumentRoot} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class CalcDocumentRootItemProvider
+ extends ItemProviderAdapter
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public CalcDocumentRootItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren} and is used to deduce an
appropriate feature for an
+ * {@link org.eclipse.emf.edit.command.AddCommand}, {@link
org.eclipse.emf.edit.command.RemoveCommand} or
+ * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object)
{
+ if (childrenFeatures == null) {
+ super.getChildrenFeatures(object);
+ childrenFeatures.add(CalcPackage.Literals.CALC_DOCUMENT_ROOT__COUNTER);
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EStructuralFeature getChildFeature(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use
for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildFeature(object, child);
+ }
+
+ /**
+ * This returns CalcDocumentRoot.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object,
getResourceLocator().getImage("full/obj16/CalcDocumentRoot"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ return getString("_UI_CalcDocumentRoot_type");
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any
cached
+ * children and by creating a viewer notification, which it passes to {@link
#fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(CalcDocumentRoot.class)) {
+ case CalcPackage.CALC_DOCUMENT_ROOT__COUNTER:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(),
true, false));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the
children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors,
Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add
+ (createChildParameter
+ (CalcPackage.Literals.CALC_DOCUMENT_ROOT__COUNTER,
+ CalcFactory.eINSTANCE.createCounter()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return Xsl1EditPlugin.INSTANCE;
+ }
+
+}
Property changes on:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/provider/CalcDocumentRootItemProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/provider/CalcItemProviderAdapterFactory.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/provider/CalcItemProviderAdapterFactory.java
(rev 0)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/provider/CalcItemProviderAdapterFactory.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -0,0 +1,227 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.jboss.tools.smooks.model.calc.provider;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+
+import org.eclipse.emf.edit.provider.ChangeNotifier;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IChangeNotifier;
+import org.eclipse.emf.edit.provider.IDisposable;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.INotifyChangedListener;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+
+import org.jboss.tools.smooks.model.calc.util.CalcAdapterFactory;
+
+/**
+ * This is the factory that is used to provide the interfaces needed to support Viewers.
+ * The adapters generated by this factory convert EMF adapter notifications into calls to
{@link #fireNotifyChanged fireNotifyChanged}.
+ * The adapters also support Eclipse property sheets.
+ * Note that most of the adapters are shared among multiple instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class CalcItemProviderAdapterFactory extends CalcAdapterFactory implements
ComposeableAdapterFactory, IChangeNotifier, IDisposable {
+ /**
+ * This keeps track of the root adapter factory that delegates to this adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ComposedAdapterFactory parentAdapterFactory;
+
+ /**
+ * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IChangeNotifier changeNotifier = new ChangeNotifier();
+
+ /**
+ * This keeps track of all the supported types checked by {@link #isFactoryForType
isFactoryForType}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Object> supportedTypes = new ArrayList<Object>();
+
+ /**
+ * This constructs an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public CalcItemProviderAdapterFactory() {
+ supportedTypes.add(IEditingDomainItemProvider.class);
+ supportedTypes.add(IStructuredItemContentProvider.class);
+ supportedTypes.add(ITreeItemContentProvider.class);
+ supportedTypes.add(IItemLabelProvider.class);
+ supportedTypes.add(IItemPropertySource.class);
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link
org.jboss.tools.smooks.model.calc.Counter} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected CounterItemProvider counterItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.jboss.tools.smooks.model.calc.Counter}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createCounterAdapter() {
+ if (counterItemProvider == null) {
+ counterItemProvider = new CounterItemProvider(this);
+ }
+
+ return counterItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link
org.jboss.tools.smooks.model.calc.CalcDocumentRoot} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected CalcDocumentRootItemProvider calcDocumentRootItemProvider;
+
+ /**
+ * This creates an adapter for a {@link
org.jboss.tools.smooks.model.calc.CalcDocumentRoot}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createCalcDocumentRootAdapter() {
+ if (calcDocumentRootItemProvider == null) {
+ calcDocumentRootItemProvider = new CalcDocumentRootItemProvider(this);
+ }
+
+ return calcDocumentRootItemProvider;
+ }
+
+ /**
+ * This returns the root adapter factory that contains this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ComposeableAdapterFactory getRootAdapterFactory() {
+ return parentAdapterFactory == null ? this :
parentAdapterFactory.getRootAdapterFactory();
+ }
+
+ /**
+ * This sets the composed adapter factory that contains this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
+ this.parentAdapterFactory = parentAdapterFactory;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object type) {
+ return supportedTypes.contains(type) || super.isFactoryForType(type);
+ }
+
+ /**
+ * This implementation substitutes the factory itself as the key for the adapter.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter adapt(Notifier notifier, Object type) {
+ return super.adapt(notifier, this);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object adapt(Object object, Object type) {
+ if (isFactoryForType(type)) {
+ Object adapter = super.adapt(object, type);
+ if (!(type instanceof Class) || (((Class<?>)type).isInstance(adapter))) {
+ return adapter;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * This adds a listener.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void addListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.addListener(notifyChangedListener);
+ }
+
+ /**
+ * This removes a listener.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void removeListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.removeListener(notifyChangedListener);
+ }
+
+ /**
+ * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void fireNotifyChanged(Notification notification) {
+ changeNotifier.fireNotifyChanged(notification);
+
+ if (parentAdapterFactory != null) {
+ parentAdapterFactory.fireNotifyChanged(notification);
+ }
+ }
+
+ /**
+ * This disposes all of the item providers created by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void dispose() {
+ if (counterItemProvider != null) counterItemProvider.dispose();
+ if (calcDocumentRootItemProvider != null) calcDocumentRootItemProvider.dispose();
+ }
+
+}
Property changes on:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/provider/CalcItemProviderAdapterFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/provider/CounterItemProvider.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/provider/CounterItemProvider.java
(rev 0)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/provider/CounterItemProvider.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -0,0 +1,375 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.jboss.tools.smooks.model.calc.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+import org.jboss.tools.smooks.model.calc.CalcPackage;
+import org.jboss.tools.smooks.model.calc.Counter;
+import org.jboss.tools.smooks.model.smooks.provider.ElementVisitorItemProvider;
+import org.jboss.tools.smooks.model.xsl.provider.Xsl1EditPlugin;
+
+/**
+ * This is the item provider adapter for a {@link
org.jboss.tools.smooks.model.calc.Counter} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class CounterItemProvider
+ extends ElementVisitorItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public CounterItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addStartExpressionPropertyDescriptor(object);
+ addAmountExpressionPropertyDescriptor(object);
+ addResetConditionPropertyDescriptor(object);
+ addAmountPropertyDescriptor(object);
+ addBeanIdPropertyDescriptor(object);
+ addCountOnElementPropertyDescriptor(object);
+ addCountOnElementNSPropertyDescriptor(object);
+ addDirectionPropertyDescriptor(object);
+ addExecuteAfterPropertyDescriptor(object);
+ addStartPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Start Expression feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addStartExpressionPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Counter_startExpression_feature"),
+ getString("_UI_PropertyDescriptor_description",
"_UI_Counter_startExpression_feature", "_UI_Counter_type"),
+ CalcPackage.Literals.COUNTER__START_EXPRESSION,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Amount Expression feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addAmountExpressionPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Counter_amountExpression_feature"),
+ getString("_UI_PropertyDescriptor_description",
"_UI_Counter_amountExpression_feature", "_UI_Counter_type"),
+ CalcPackage.Literals.COUNTER__AMOUNT_EXPRESSION,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Reset Condition feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addResetConditionPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Counter_resetCondition_feature"),
+ getString("_UI_PropertyDescriptor_description",
"_UI_Counter_resetCondition_feature", "_UI_Counter_type"),
+ CalcPackage.Literals.COUNTER__RESET_CONDITION,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Amount feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addAmountPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Counter_amount_feature"),
+ getString("_UI_PropertyDescriptor_description",
"_UI_Counter_amount_feature", "_UI_Counter_type"),
+ CalcPackage.Literals.COUNTER__AMOUNT,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Bean Id feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addBeanIdPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Counter_beanId_feature"),
+ getString("_UI_PropertyDescriptor_description",
"_UI_Counter_beanId_feature", "_UI_Counter_type"),
+ CalcPackage.Literals.COUNTER__BEAN_ID,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Count On Element feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addCountOnElementPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Counter_countOnElement_feature"),
+ getString("_UI_PropertyDescriptor_description",
"_UI_Counter_countOnElement_feature", "_UI_Counter_type"),
+ CalcPackage.Literals.COUNTER__COUNT_ON_ELEMENT,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Count On Element NS feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addCountOnElementNSPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Counter_countOnElementNS_feature"),
+ getString("_UI_PropertyDescriptor_description",
"_UI_Counter_countOnElementNS_feature", "_UI_Counter_type"),
+ CalcPackage.Literals.COUNTER__COUNT_ON_ELEMENT_NS,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Direction feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addDirectionPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Counter_direction_feature"),
+ getString("_UI_PropertyDescriptor_description",
"_UI_Counter_direction_feature", "_UI_Counter_type"),
+ CalcPackage.Literals.COUNTER__DIRECTION,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Execute After feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addExecuteAfterPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Counter_executeAfter_feature"),
+ getString("_UI_PropertyDescriptor_description",
"_UI_Counter_executeAfter_feature", "_UI_Counter_type"),
+ CalcPackage.Literals.COUNTER__EXECUTE_AFTER,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Start feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addStartPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Counter_start_feature"),
+ getString("_UI_PropertyDescriptor_description",
"_UI_Counter_start_feature", "_UI_Counter_type"),
+ CalcPackage.Literals.COUNTER__START,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This returns Counter.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object,
getResourceLocator().getImage("full/obj16/Counter"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((Counter)object).getTargetProfile();
+ return label == null || label.length() == 0 ?
+ getString("_UI_Counter_type") :
+ getString("_UI_Counter_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any
cached
+ * children and by creating a viewer notification, which it passes to {@link
#fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(Counter.class)) {
+ case CalcPackage.COUNTER__START_EXPRESSION:
+ case CalcPackage.COUNTER__AMOUNT_EXPRESSION:
+ case CalcPackage.COUNTER__RESET_CONDITION:
+ case CalcPackage.COUNTER__AMOUNT:
+ case CalcPackage.COUNTER__BEAN_ID:
+ case CalcPackage.COUNTER__COUNT_ON_ELEMENT:
+ case CalcPackage.COUNTER__COUNT_ON_ELEMENT_NS:
+ case CalcPackage.COUNTER__DIRECTION:
+ case CalcPackage.COUNTER__EXECUTE_AFTER:
+ case CalcPackage.COUNTER__START:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(),
false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the
children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors,
Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return Xsl1EditPlugin.INSTANCE;
+ }
+
+}
Property changes on:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/provider/CounterItemProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/provider/SmooksResourceListTypeItemProvider.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/provider/SmooksResourceListTypeItemProvider.java 2009-04-15
09:49:21 UTC (rev 14753)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/provider/SmooksResourceListTypeItemProvider.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -23,9 +23,13 @@
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;
+import org.jboss.tools.smooks.model.calc.CalcFactory;
+import org.jboss.tools.smooks.model.calc.CalcPackage;
import org.jboss.tools.smooks.model.common.provider.AbstractAnyTypeItemProvider;
import org.jboss.tools.smooks.model.csv.CsvFactory;
import org.jboss.tools.smooks.model.csv.CsvPackage;
+import org.jboss.tools.smooks.model.datasource.DatasourceFactory;
+import org.jboss.tools.smooks.model.datasource.DatasourcePackage;
import org.jboss.tools.smooks.model.dbrouting.DbroutingFactory;
import org.jboss.tools.smooks.model.dbrouting.DbroutingPackage;
import org.jboss.tools.smooks.model.edi.EdiFactory;
@@ -273,6 +277,17 @@
newChildDescriptors.add(createChildParameter(SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_READER_GROUP,
FeatureMapUtil
.createEntry(JsonPackage.Literals.JSON_DOCUMENT_ROOT__READER,
JsonFactory.eINSTANCE.createJsonReader())));
+ // for calc
+ newChildDescriptors.add(createChildParameter(SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_RESOURCE_CONFIG_GROUP,
FeatureMapUtil
+ .createEntry(CalcPackage.Literals.CALC_DOCUMENT_ROOT__COUNTER,
CalcFactory.eINSTANCE.createCounter())));
+
+ // for datasource
+ newChildDescriptors.add(createChildParameter(SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_RESOURCE_CONFIG_GROUP,
FeatureMapUtil
+ .createEntry(DatasourcePackage.Literals.DATA_SOURCE_DOCUMENT_ROOT__DIRECT,
DatasourceFactory.eINSTANCE.createDirect())));
+
+ newChildDescriptors.add(createChildParameter(SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_RESOURCE_CONFIG_GROUP,
FeatureMapUtil
+ .createEntry(DatasourcePackage.Literals.DATA_SOURCE_DOCUMENT_ROOT__JNDI,
DatasourceFactory.eINSTANCE.createDataSourceJndi())));
+
// for javabean
newChildDescriptors.add(createChildParameter(SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_RESOURCE_CONFIG_GROUP,
FeatureMapUtil
.createEntry(JavabeanPackage.Literals.DOCUMENT_ROOT__BINDINGS,
JavabeanFactory.eINSTANCE.createBindingsType())));
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java 2009-04-15
09:49:21 UTC (rev 14753)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -31,6 +31,9 @@
import org.jboss.tools.smooks.model.graphics.ext.InputType;
import org.jboss.tools.smooks.model.graphics.ext.SmooksGraphicsExtFactory;
import org.jboss.tools.smooks.model.graphics.ext.SmooksGraphicsExtType;
+import org.jboss.tools.smooks.model.smooks.ConditionType;
+import org.jboss.tools.smooks.model.smooks.ConditionsType;
+import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
import org.jboss.tools.smooks10.model.smooks.ParamType;
import org.jboss.tools.smooks10.model.smooks.ResourceConfigType;
import org.jboss.tools.smooks10.model.smooks.ResourceType;
@@ -481,5 +484,13 @@
}
return null;
}
+
+ public static List<ConditionType> collectConditionType(SmooksResourceListType
resourceList){
+ ConditionsType conditions = resourceList.getConditions();
+ if(conditions != null){
+ return conditions.getCondition();
+ }
+ return Collections.emptyList();
+ }
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/Codegenerator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/Codegenerator.java 2009-04-15
09:49:21 UTC (rev 14753)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/Codegenerator.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -13,18 +13,18 @@
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;
-import org.jboss.tools.smooks.model.dbrouting.DbroutingPackage;
-import org.jboss.tools.smooks.model.smooks.SmooksPackage;
+import org.jboss.tools.smooks.model.calc.CalcPackage;
+import org.jboss.tools.smooks.model.datasource.DatasourcePackage;
public class Codegenerator {
- String basePath =
"F:\\works\\eclipse_wtp_3.0.3\\eclipse\\workspace_cr1\\org.jboss.tools.smooks.ui\\src\\org\\jboss\\tools\\smooks\\configuration\\editors\\uitls\\temp\\";
+ String basePath =
"/home/DartPeng/Work/eclipse/smooks-configuration-workspace/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/temp/";
String tempContents = "";
public Codegenerator() {
try {
FileReader reader = new FileReader(
new File(
- "F:\\works\\eclipse_wtp_3.0.3\\eclipse\\workspace_cr1\\org.jboss.tools.smooks.ui\\src\\org\\jboss\\tools\\smooks\\configuration\\editors\\Template.txt"));
+ "/home/DartPeng/Work/eclipse/smooks-configuration-workspace/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/Template.txt"));
BufferedReader r = new BufferedReader(reader);
String line = r.readLine();
while (line != null) {
@@ -44,7 +44,7 @@
public static void main(String[] args) {
Codegenerator g = new Codegenerator();
try {
- g.generateCodes(SmooksPackage.eINSTANCE);
+ g.generateCodes(DatasourcePackage.eINSTANCE);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java 2009-04-15
09:49:21 UTC (rev 14753)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -30,7 +30,6 @@
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.forms.IFormColors;
import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.jboss.tools.smooks.configuration.editors.uitls.IFieldDialog;
@@ -52,7 +51,7 @@
protected IModelProcsser fileFiledEditorModelProcess;
protected IHyperlinkListener fileFiledEditorLinkListener;
-
+
protected List<ViewerFilter> viewerFilters = null;
/*
@@ -78,12 +77,20 @@
if (isFileSelectionFeature(feature)) {
return createFileSelectionFieldEditor(toolkit, parent, propertyDescriptor, model,
feature, formEditor);
}
+ if(isConditionSelectionFeature(feature)){
+ SmooksUIUtils.createContionsChoiceFieldEditor(parent, toolkit, propertyDescriptor,
model);
+ return parent;
+ }
if (feature == SmooksPackage.eINSTANCE.getAbstractReader_TargetProfile()) {
}
return null;
}
+ protected boolean isConditionSelectionFeature(EAttribute feature) {
+ return false;
+ }
+
public IHyperlinkListener getFileFiledEditorLinkListener() {
return fileFiledEditorLinkListener;
}
@@ -120,10 +127,9 @@
SmooksMultiFormEditor formEditor) {
}
- public boolean isFileSelectionFeature(EAttribute attribute) {
+ protected boolean isFileSelectionFeature(EAttribute attribute) {
return false;
}
-
public Composite createFileSelectionFieldEditor(FormToolkit toolkit, Composite parent,
IItemPropertyDescriptor propertyDescriptor, Object model,
EAttribute feature, SmooksMultiFormEditor formEditor) {
@@ -136,7 +142,7 @@
IModelProcsser p = getModelProcesser();
String path = wizard.getFilePath();
if (p != null) {
- path = p.processModel(path).toString();
+ path = p.unwrapValue(path).toString();
}
return path;
}
@@ -156,7 +162,7 @@
getFileFiledEditorLinkListener());
}
- public boolean isSelectorFeature(EAttribute attribute) {
+ protected boolean isSelectorFeature(EAttribute attribute) {
return false;
}
@@ -180,7 +186,7 @@
return null;
}
- public boolean isBeanIDRefFieldFeature(EAttribute attribute) {
+ protected boolean isBeanIDRefFieldFeature(EAttribute attribute) {
return false;
}
@@ -189,8 +195,7 @@
if (model instanceof EObject) {
SmooksResourceListType smooksResourceList = getSmooksResourceList((EObject) model);
if (smooksResourceList != null) {
- String displayName = propertyDescriptor.getDisplayName(model);
- toolkit.createLabel(parent, displayName + "
:").setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ SmooksUIUtils.createFiledEditorLabel(parent, toolkit, propertyDescriptor, model,
false);
final Combo combo = new Combo(parent, SWT.BORDER);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
combo.setLayoutData(gd);
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreatorManager.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreatorManager.java 2009-04-15
09:49:21 UTC (rev 14753)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreatorManager.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -13,7 +13,10 @@
import java.util.HashMap;
import java.util.Map;
+import org.jboss.tools.smooks.configuration.editors.calc.CounterUICreator;
import org.jboss.tools.smooks.configuration.editors.csv.CsvReaderUICreator;
+import org.jboss.tools.smooks.configuration.editors.datasource.DataSourceJndiUICreator;
+import org.jboss.tools.smooks.configuration.editors.datasource.DirectUICreator;
import org.jboss.tools.smooks.configuration.editors.dbrouting.ExecutorUICreator;
import
org.jboss.tools.smooks.configuration.editors.dbrouting.ResultSetRowSelectorUICreator;
import org.jboss.tools.smooks.configuration.editors.dbrouting.ResultSetUICreator;
@@ -66,7 +69,10 @@
import org.jboss.tools.smooks.configuration.editors.xsl.OutputToUICreator;
import org.jboss.tools.smooks.configuration.editors.xsl.TemplateUICreator;
import org.jboss.tools.smooks.configuration.editors.xsl.XslUICreator;
+import org.jboss.tools.smooks.model.calc.impl.CounterImpl;
import org.jboss.tools.smooks.model.csv.impl.CsvReaderImpl;
+import org.jboss.tools.smooks.model.datasource.impl.DataSourceJndiImpl;
+import org.jboss.tools.smooks.model.datasource.impl.DirectImpl;
import org.jboss.tools.smooks.model.dbrouting.impl.ExecutorImpl;
import org.jboss.tools.smooks.model.dbrouting.impl.ResultSetImpl;
import org.jboss.tools.smooks.model.dbrouting.impl.ResultSetRowSelectorImpl;
@@ -226,10 +232,15 @@
map.put(ResultSetImpl.class, new ResultSetUICreator());
map.put(ResultSetRowSelectorImpl.class, new ResultSetRowSelectorUICreator());
+ // for calc
+ map.put(CounterImpl.class, new CounterUICreator());
+
+ // for datasource
+ map.put(DirectImpl.class, new DirectUICreator());
+ map.put(DataSourceJndiImpl.class, new DataSourceJndiUICreator());
-
/*
- * up if for smooks1.1
+ * up is for smooks1.1
*/
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationFormPage.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationFormPage.java 2009-04-15
09:49:21 UTC (rev 14753)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationFormPage.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -133,7 +133,7 @@
tableComposite.setBackground(GraphicsConstants.BORDER_CORLOER);
tableComposite.setLayout(fillLayout);
- inputDataViewer = new TableViewer(tableComposite, SWT.MULTI);
+ inputDataViewer = new TableViewer(tableComposite, SWT.MULTI | SWT.FULL_SELECTION);
TableColumn header = new TableColumn(inputDataViewer.getTable(), SWT.NONE);
header.setText("Type");
header.setWidth(100);
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java 2009-04-15
09:49:21 UTC (rev 14753)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -138,8 +138,8 @@
configurationSection = tool.createSection(rootMainControl, Section.TITLE_BAR
| Section.DESCRIPTION);
configurationSection
- .setDescription("Define Smooks stuffes for configuration file in the following
section.");
- configurationSection.setText("All Smooks Stuffes");
+ .setDescription("Define Smooks elements for configuration file in the following
section.");
+ configurationSection.setText("Smooks elements");
sectionPart = new SectionPart(configurationSection);
managedForm.addPart(sectionPart);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java 2009-04-15
09:49:21 UTC (rev 14753)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -61,8 +61,10 @@
import org.jboss.tools.smooks.configuration.SmooksConstants;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.configuration.wizards.SmooksConfigurationFileNewWizard;
+import org.jboss.tools.smooks.model.calc.provider.CalcItemProviderAdapterFactory;
import org.jboss.tools.smooks.model.common.provider.CommonItemProviderAdapterFactory;
import org.jboss.tools.smooks.model.csv.provider.CsvItemProviderAdapterFactory;
+import
org.jboss.tools.smooks.model.datasource.provider.DatasourceItemProviderAdapterFactory;
import
org.jboss.tools.smooks.model.dbrouting.provider.DbroutingItemProviderAdapterFactory;
import org.jboss.tools.smooks.model.edi.provider.EdiItemProviderAdapterFactory;
import
org.jboss.tools.smooks.model.fileRouting.provider.FileRoutingItemProviderAdapterFactory;
@@ -188,6 +190,8 @@
adapterFactory.addAdapterFactory(new JmsroutingItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new DbroutingItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new CsvItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new DatasourceItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new CalcItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new GroovyItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new FileRoutingItemProviderAdapterFactory());
adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
@@ -220,7 +224,7 @@
configurationPage = createSmooksConfigurationFormPage();
try {
int index = this.addPage(configurationPage);
- setPageText(index, "Configuraion");
+ setPageText(index, "Design");
} catch (PartInitException e) {
e.printStackTrace();
}
@@ -309,7 +313,7 @@
}
protected SmooksConfigurationFormPage createSmooksConfigurationFormPage() {
- return new SmooksConfigurationFormPage(this, "ConfigurationPage",
"Configuration Page");
+ return new SmooksConfigurationFormPage(this, "DesignPage", "Design
Page");
}
protected void initSaveOptions(Map<?, ?> options) {
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksStuffPropertyDetailPage.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksStuffPropertyDetailPage.java 2009-04-15
09:49:21 UTC (rev 14753)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksStuffPropertyDetailPage.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -11,7 +11,6 @@
package org.jboss.tools.smooks.configuration.editors;
import java.lang.reflect.Method;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.common.util.Enumerator;
@@ -30,22 +29,20 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Spinner;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.IDetailsPage;
-import org.eclipse.ui.forms.IFormColors;
import org.eclipse.ui.forms.IFormPart;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
-import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
+import org.jboss.tools.smooks.configuration.editors.uitls.IModelProcsser;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
/**
*
@@ -73,16 +70,13 @@
public SmooksStuffPropertyDetailPage(SmooksMultiFormEditor formEditor) {
super();
this.formEditor = formEditor;
- editingDomain = (AdapterFactoryEditingDomain) formEditor
- .getEditingDomain();
- labelProvider = new AdapterFactoryLabelProvider(editingDomain
- .getAdapterFactory());
+ editingDomain = (AdapterFactoryEditingDomain) formEditor.getEditingDomain();
+ labelProvider = new AdapterFactoryLabelProvider(editingDomain.getAdapterFactory());
}
public void createContents(Composite parent) {
parent.setLayout(new FillLayout());
- section = formToolkit.createSection(parent, Section.DESCRIPTION
- | Section.TITLE_BAR);
+ section = formToolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR);
Composite client = formToolkit.createComposite(section);
section.setLayout(new FillLayout());
@@ -106,10 +100,8 @@
GridLayout layout = new GridLayout();
layout.numColumns = 2;
detailsComposite.setLayout(layout);
- IPropertyUICreator creator = PropertyUICreatorManager.getInstance()
- .getPropertyUICreator(getModel());
- List<IItemPropertyDescriptor> propertyDes = itemPropertySource
- .getPropertyDescriptors(getModel());
+ IPropertyUICreator creator =
PropertyUICreatorManager.getInstance().getPropertyUICreator(getModel());
+ List<IItemPropertyDescriptor> propertyDes =
itemPropertySource.getPropertyDescriptors(getModel());
for (int i = 0; i < propertyDes.size(); i++) {
IItemPropertyDescriptor pd = propertyDes.get(i);
EAttribute attribute = (EAttribute) pd.getFeature(getModel());
@@ -125,9 +117,8 @@
}
}
if (creator != null) {
- creator.createExtendUI((AdapterFactoryEditingDomain) formEditor
- .getEditingDomain(), formToolkit, detailsComposite,
- getModel(), getFormEditor());
+ creator.createExtendUI((AdapterFactoryEditingDomain) formEditor.getEditingDomain(),
formToolkit, detailsComposite, getModel(),
+ getFormEditor());
}
formToolkit.paintBordersFor(detailsComposite);
detailsComposite.pack();
@@ -137,20 +128,16 @@
}
}
- protected void createAttributeUI(Composite detailsComposite,
- IItemPropertyDescriptor propertyDescriptor,
- IPropertyUICreator creator) {
+ protected void createAttributeUI(Composite detailsComposite, IItemPropertyDescriptor
propertyDescriptor, IPropertyUICreator creator) {
final IItemPropertyDescriptor itemPropertyDescriptor = propertyDescriptor;
- EAttribute feature = (EAttribute) itemPropertyDescriptor
- .getFeature(getModel());
+ EAttribute feature = (EAttribute) itemPropertyDescriptor.getFeature(getModel());
boolean createDefault = true;
if (creator != null) {
if (creator.ignoreProperty(feature)) {
return;
}
- Composite composite = creator.createPropertyUI(formToolkit,
- detailsComposite, itemPropertyDescriptor, getModel(),
- feature, getFormEditor());
+ Composite composite = creator.createPropertyUI(formToolkit, detailsComposite,
itemPropertyDescriptor, getModel(), feature,
+ getFormEditor());
if (composite != null) {
createDefault = false;
}
@@ -159,24 +146,18 @@
EClassifier typeClazz = feature.getEType();
boolean hasCreated = false;
if (typeClazz instanceof EEnum) {
- createEnumFieldEditor(detailsComposite, feature,
- (EEnum) typeClazz, formToolkit, itemPropertyDescriptor);
+ createEnumFieldEditor(detailsComposite, feature, (EEnum) typeClazz, formToolkit,
itemPropertyDescriptor);
hasCreated = true;
}
if (typeClazz.getInstanceClass() == String.class) {
- createStringFieldEditor(detailsComposite, feature, formToolkit,
- itemPropertyDescriptor);
+ createStringFieldEditor(detailsComposite, feature, formToolkit,
itemPropertyDescriptor);
}
- if (typeClazz.getInstanceClass() == Boolean.class
- || typeClazz.getInstanceClass() == boolean.class) {
- createBooleanFieldEditor(detailsComposite, feature,
- formToolkit, itemPropertyDescriptor);
+ if (typeClazz.getInstanceClass() == Boolean.class || typeClazz.getInstanceClass() ==
boolean.class) {
+ createBooleanFieldEditor(detailsComposite, feature, formToolkit,
itemPropertyDescriptor);
hasCreated = true;
}
- if (typeClazz.getInstanceClass() == Integer.class
- || typeClazz.getInstanceClass() == int.class) {
- createIntegerFieldEditor(detailsComposite, feature,
- formToolkit, itemPropertyDescriptor);
+ if (typeClazz.getInstanceClass() == Integer.class || typeClazz.getInstanceClass() ==
int.class) {
+ createStringFieldEditor(detailsComposite, feature, formToolkit,
itemPropertyDescriptor);
hasCreated = true;
}
if (!hasCreated) {
@@ -187,197 +168,127 @@
}
}
- protected void createEnumFieldEditor(Composite propertyComposite,
- EAttribute feature, final EEnum typeClass, FormToolkit formToolKit,
+ protected Control createEnumFieldEditor(Composite propertyComposite, EAttribute feature,
final EEnum typeClass, FormToolkit formToolKit,
final IItemPropertyDescriptor itemPropertyDescriptor) {
- String displayName = itemPropertyDescriptor.getDisplayName(getModel());
- if (feature.isRequired()) {
- displayName = "*" + displayName;
- }
- formToolKit.createLabel(propertyComposite, displayName + " :")
- .setForeground(
- formToolKit.getColors().getColor(IFormColors.TITLE));
- final Combo combo = new Combo(propertyComposite, SWT.BORDER
- | SWT.READ_ONLY);
- formToolKit.adapt(combo, true, false);
List<EEnumLiteral> literalList = typeClass.getELiterals();
- for (Iterator<EEnumLiteral> iterator = literalList.iterator(); iterator
- .hasNext();) {
- EEnumLiteral enumLiteral = (EEnumLiteral) iterator.next();
- combo.add(enumLiteral.getName());
+ String[] items = new String[literalList.size()];
+ for (int i = 0; i < literalList.size(); i++) {
+ EEnumLiteral enumLiteral = (EEnumLiteral) literalList.get(i);
+ items[i] = (enumLiteral.getName());
}
- Object value = itemPropertyDescriptor.getPropertyValue(getModel());
- if (value != null && value instanceof PropertyValueWrapper) {
- Object editValue = ((PropertyValueWrapper) value)
- .getEditableValue(getModel());
- if (editValue != null && editValue instanceof Enumerator) {
- String[] strings = combo.getItems();
- for (int i = 0; i < strings.length; i++) {
- String item = strings[i];
- if (item.equals(((Enumerator) editValue).getName())) {
- combo.select(i);
- break;
- }
+ final IItemPropertyDescriptor fip = itemPropertyDescriptor;
+ IModelProcsser processer = new IModelProcsser() {
+
+ public Object unwrapValue(Object model) {
+ Object editValue = SmooksUIUtils.getEditValue(fip, getModel());
+ if (editValue instanceof Enumerator) {
+ return ((Enumerator) editValue).getName();
}
+ return null;
}
- }
- combo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
+
+ public Object wrapValue(Object model) {
+ String name = model.toString();
+ Object v = null;
try {
- Object value = itemPropertyDescriptor
- .getPropertyValue(getModel());
- Method method = typeClass.getInstanceClass().getMethod(
- "get", new Class<?>[] { String.class });
+ Method method = typeClass.getInstanceClass().getMethod("get", new
Class<?>[] { String.class });
// it's static method
- Object v = method.invoke(null, combo.getText());
- if (value != null && value instanceof PropertyValueWrapper) {
- Object editValue = ((PropertyValueWrapper) value)
- .getEditableValue(getModel());
- if (editValue != null) {
-
- if (!editValue.equals(v)) {
- itemPropertyDescriptor.setPropertyValue(
- getModel(), v);
- }
- } else {
- itemPropertyDescriptor.setPropertyValue(getModel(),
- v);
- }
- } else {
- itemPropertyDescriptor.setPropertyValue(getModel(), v);
+ if (method != null) {
+ v = method.invoke(null, name);
}
} catch (Throwable t) {
- SmooksConfigurationActivator.getDefault().log(t);
}
+ return v;
}
- });
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- combo.setLayoutData(gd);
+
+ };
+ return SmooksUIUtils.createChoiceFieldEditor(propertyComposite, formToolkit,
itemPropertyDescriptor, getModel(), items, processer, true);
}
- protected void createBooleanFieldEditor(final Composite propertyComposite,
- EAttribute feature, FormToolkit formToolkit,
+ protected void createBooleanFieldEditor(final Composite propertyComposite, EAttribute
feature, FormToolkit formToolkit,
final IItemPropertyDescriptor itemPropertyDescriptor) {
- String displayName = itemPropertyDescriptor.getDisplayName(getModel());
- displayName += " :";
- if (feature.isRequired()) {
- displayName = "*" + displayName;
- }
- formToolkit.createLabel(propertyComposite, displayName + " :")
- .setForeground(
- formToolkit.getColors().getColor(IFormColors.TITLE));
- Object value = itemPropertyDescriptor.getPropertyValue(getModel());
- final Combo combo = new Combo(propertyComposite, SWT.BORDER
- | SWT.READ_ONLY);
- combo.add("TRUE");
- combo.add("FALSE");
- // combo.setEditable(false);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- combo.setLayoutData(gd);
- Object editValue = null;
- if (value != null && value instanceof PropertyValueWrapper) {
- editValue = ((PropertyValueWrapper) value)
- .getEditableValue(getModel());
- if (editValue != null && editValue instanceof Boolean) {
- if ((Boolean) editValue) {
- combo.select(0);
- } else {
- combo.select(1);
+ IModelProcsser processer = new IModelProcsser() {
+
+ public Object unwrapValue(Object model) {
+ if (model instanceof Boolean) {
+ if ((Boolean) model) {
+ return "TRUE";
+ } else {
+ return "FALSE";
+ }
}
+ return "FALSE";
}
- }
- combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- boolean bv = Boolean.valueOf(combo.getText());
- itemPropertyDescriptor.setPropertyValue(getModel(), bv);
+ public Object wrapValue(Object model) {
+ try {
+ return Boolean.parseBoolean(model.toString());
+ } catch (Throwable t) {
+ }
+ return Boolean.FALSE;
}
- });
+ };
+ SmooksUIUtils.createChoiceFieldEditor(propertyComposite, formToolkit,
itemPropertyDescriptor, getModel(), new String[] { "TRUE", "FALSE" },
+ processer, true);
}
- protected void createStringFieldEditor(final Composite propertyComposite,
- EAttribute feature, FormToolkit formToolKit,
+ protected Text createStringFieldEditor(final Composite propertyComposite, EAttribute
feature, FormToolkit formToolKit,
final IItemPropertyDescriptor itemPropertyDescriptor) {
- String displayName = itemPropertyDescriptor.getDisplayName(getModel());
- if (feature.isRequired()) {
- displayName = "*" + displayName;
- }
- formToolKit.createLabel(propertyComposite, displayName + " :")
- .setForeground(
- formToolKit.getColors().getColor(IFormColors.TITLE));
- final Text text = formToolKit.createText(propertyComposite, "",
- SWT.NONE);
+ SmooksUIUtils.createFiledEditorLabel(propertyComposite, formToolKit,
itemPropertyDescriptor, getModel(), false);
+ final Text text = formToolKit.createText(propertyComposite, "", SWT.NONE);
Object value = itemPropertyDescriptor.getPropertyValue(getModel());
if (value != null && value instanceof PropertyValueWrapper) {
- Object editValue = ((PropertyValueWrapper) value)
- .getEditableValue(getModel());
+ Object editValue = ((PropertyValueWrapper) value).getEditableValue(getModel());
if (editValue != null)
text.setText(editValue.toString());
}
text.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
- Object value = itemPropertyDescriptor
- .getPropertyValue(getModel());
+ Object value = itemPropertyDescriptor.getPropertyValue(getModel());
if (value != null && value instanceof PropertyValueWrapper) {
- Object editValue = ((PropertyValueWrapper) value)
- .getEditableValue(getModel());
+ Object editValue = ((PropertyValueWrapper) value).getEditableValue(getModel());
if (editValue != null) {
if (!editValue.equals(text.getText())) {
- itemPropertyDescriptor.setPropertyValue(getModel(),
- text.getText());
+ itemPropertyDescriptor.setPropertyValue(getModel(), text.getText());
}
} else {
- itemPropertyDescriptor.setPropertyValue(getModel(),
- text.getText());
+ itemPropertyDescriptor.setPropertyValue(getModel(), text.getText());
}
} else {
- itemPropertyDescriptor.setPropertyValue(getModel(), text
- .getText());
+ itemPropertyDescriptor.setPropertyValue(getModel(), text.getText());
}
}
});
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
text.setLayoutData(gd);
+ return text;
}
- protected void createIntegerFieldEditor(final Composite propertyComposite,
- EAttribute feature, FormToolkit formToolKit,
+ protected void createIntegerFieldEditor(final Composite propertyComposite, EAttribute
feature, FormToolkit formToolKit,
final IItemPropertyDescriptor itemPropertyDescriptor) {
- String displayName = itemPropertyDescriptor.getDisplayName(getModel());
- if (feature.isRequired()) {
- displayName = "*" + displayName;
- }
- formToolKit.createLabel(propertyComposite, displayName + " :")
- .setForeground(
- formToolKit.getColors().getColor(IFormColors.TITLE));
+ SmooksUIUtils.createFiledEditorLabel(propertyComposite, formToolKit,
itemPropertyDescriptor, getModel(), false);
final Spinner spinner = new Spinner(propertyComposite, SWT.BORDER);
Object value = itemPropertyDescriptor.getPropertyValue(getModel());
if (value != null && value instanceof PropertyValueWrapper) {
- Object editValue = ((PropertyValueWrapper) value)
- .getEditableValue(getModel());
+ Object editValue = ((PropertyValueWrapper) value).getEditableValue(getModel());
if (editValue != null && editValue instanceof Integer)
spinner.setSelection((Integer) editValue);
}
spinner.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
- Object value = itemPropertyDescriptor
- .getPropertyValue(getModel());
+ Object value = itemPropertyDescriptor.getPropertyValue(getModel());
if (value != null && value instanceof PropertyValueWrapper) {
- Object editValue = ((PropertyValueWrapper) value)
- .getEditableValue(getModel());
+ Object editValue = ((PropertyValueWrapper) value).getEditableValue(getModel());
if (editValue != null) {
if (!editValue.equals(spinner.getSelection())) {
- itemPropertyDescriptor.setPropertyValue(getModel(),
- spinner.getSelection());
+ itemPropertyDescriptor.setPropertyValue(getModel(), spinner.getSelection());
}
} else {
- itemPropertyDescriptor.setPropertyValue(getModel(),
- spinner.getSelection());
+ itemPropertyDescriptor.setPropertyValue(getModel(), spinner.getSelection());
}
} else {
- itemPropertyDescriptor.setPropertyValue(getModel(), spinner
- .getSelection());
+ itemPropertyDescriptor.setPropertyValue(getModel(), spinner.getSelection());
}
}
});
@@ -397,16 +308,13 @@
setOldModel(oldModel);
this.selection = selection;
this.formPart = part;
- this.itemPropertySource = (IItemPropertySource) editingDomain
- .getAdapterFactory().adapt(getModel(),
- IItemPropertySource.class);
+ this.itemPropertySource = (IItemPropertySource)
editingDomain.getAdapterFactory().adapt(getModel(), IItemPropertySource.class);
if (getOldModel() == getModel())
return;
if (getOldModel() != getModel()) {
if (propertyComposite != null) {
propertyComposite.dispose();
- propertyComposite = new Composite(propertyMainComposite,
- SWT.NONE);
+ propertyComposite = new Composite(propertyMainComposite, SWT.NONE);
}
createStuffDetailsComposite(propertyComposite);
}
@@ -469,9 +377,10 @@
protected void refreshWhenSelectionChanged() {
Object model = getModel();
if (model instanceof EObject) {
- String text = labelProvider.getText(model);
+ String text = ((EObject) model).eClass().getName();
section.setText(text);
- section.setDescription("Details of " + text);
+ section.setDescription("Details of " + text + ". Required fields are
denoted by \"*\".");
+ section.layout();
}
}
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/calc/CounterUICreator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/calc/CounterUICreator.java
(rev 0)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/calc/CounterUICreator.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.configuration.editors.calc;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
+import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
+import org.jboss.tools.smooks.model.calc.CalcPackage;
+
+/**
+ * @author Dart Peng (dpeng(a)redhat.com) Date Apr 10, 2009
+ */
+public class CounterUICreator extends PropertyUICreator {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.IPropertyUICreator#
+ * createPropertyUI(org.eclipse.ui.forms.widgets.FormToolkit,
+ * org.eclipse.swt.widgets.Composite,
+ * org.eclipse.emf.edit.provider.IItemPropertyDescriptor, java.lang.Object,
+ * org.eclipse.emf.ecore.EAttribute)
+ */
+ public Composite createPropertyUI(FormToolkit toolkit, Composite parent,
IItemPropertyDescriptor propertyDescriptor, Object model,
+ EAttribute feature, SmooksMultiFormEditor formEditor) {
+
+ if (feature == CalcPackage.eINSTANCE.getCounter_StartExpression()) {
+ }
+ if (feature == CalcPackage.eINSTANCE.getCounter_AmountExpression()) {
+ }
+ if (feature == CalcPackage.eINSTANCE.getCounter_ResetCondition()) {
+ }
+ if (feature == CalcPackage.eINSTANCE.getCounter_Amount()) {
+ }
+ if (feature == CalcPackage.eINSTANCE.getCounter_BeanId()) {
+ }
+ if (feature == CalcPackage.eINSTANCE.getCounter_CountOnElementNS()) {
+ }
+ if (feature == CalcPackage.eINSTANCE.getCounter_Direction()) {
+ }
+ if (feature == CalcPackage.eINSTANCE.getCounter_ExecuteAfter()) {
+ }
+ if (feature == CalcPackage.eINSTANCE.getCounter_Start()) {
+ }
+ return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature,
formEditor);
+ }
+
+ @Override
+ public boolean isSelectorFeature(EAttribute attribute) {
+ if (attribute == CalcPackage.eINSTANCE.getCounter_CountOnElement()) {
+ return true;
+ }
+ return super.isSelectorFeature(attribute);
+ }
+
+
+
+}
\ No newline at end of file
Property changes on:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/calc/CounterUICreator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/datasource/DataSourceJndiUICreator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/datasource/DataSourceJndiUICreator.java
(rev 0)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/datasource/DataSourceJndiUICreator.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.configuration.editors.datasource;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
+import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
+import org.jboss.tools.smooks.model.datasource.DatasourcePackage;
+
+/**
+ * @author Dart Peng (dpeng(a)redhat.com) Date Apr 10, 2009
+ */
+public class DataSourceJndiUICreator extends PropertyUICreator {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.IPropertyUICreator#
+ * createPropertyUI(org.eclipse.ui.forms.widgets.FormToolkit,
+ * org.eclipse.swt.widgets.Composite,
+ * org.eclipse.emf.edit.provider.IItemPropertyDescriptor, java.lang.Object,
+ * org.eclipse.emf.ecore.EAttribute)
+ */
+ public Composite createPropertyUI(FormToolkit toolkit, Composite parent,
IItemPropertyDescriptor propertyDescriptor, Object model,
+ EAttribute feature, SmooksMultiFormEditor formEditor) {
+
+ if (feature == DatasourcePackage.eINSTANCE.getDataSourceJndi_AutoCommit()) {
+ }
+ if (feature == DatasourcePackage.eINSTANCE.getDataSourceJndi_BindOnElement()) {
+ }
+ if (feature == DatasourcePackage.eINSTANCE.getDataSourceJndi_Datasource()) {
+ }
+
+ return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature,
formEditor);
+ }
+
+ @Override
+ public boolean isSelectorFeature(EAttribute attribute) {
+ if (attribute == DatasourcePackage.eINSTANCE.getDataSourceJndi_BindOnElement()) {
+ return true;
+ }
+ return super.isSelectorFeature(attribute);
+ }
+
+
+
+}
\ No newline at end of file
Property changes on:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/datasource/DataSourceJndiUICreator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/datasource/DirectUICreator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/datasource/DirectUICreator.java
(rev 0)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/datasource/DirectUICreator.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.configuration.editors.datasource;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
+import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
+import org.jboss.tools.smooks.model.datasource.DatasourcePackage;
+
+/**
+ * @author Dart Peng (dpeng(a)redhat.com) Date Apr 10, 2009
+ */
+public class DirectUICreator extends PropertyUICreator {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.IPropertyUICreator#
+ * createPropertyUI(org.eclipse.ui.forms.widgets.FormToolkit,
+ * org.eclipse.swt.widgets.Composite,
+ * org.eclipse.emf.edit.provider.IItemPropertyDescriptor, java.lang.Object,
+ * org.eclipse.emf.ecore.EAttribute)
+ */
+ public Composite createPropertyUI(FormToolkit toolkit, Composite parent,
IItemPropertyDescriptor propertyDescriptor, Object model,
+ EAttribute feature, SmooksMultiFormEditor formEditor) {
+ if (feature == DatasourcePackage.eINSTANCE.getDirect_AutoCommit()) {
+ }
+ if (feature == DatasourcePackage.eINSTANCE.getDirect_BindOnElementNS()) {
+ }
+ if (feature == DatasourcePackage.eINSTANCE.getDirect_Datasource()) {
+ }
+ if (feature == DatasourcePackage.eINSTANCE.getDirect_Password()) {
+ }
+ if (feature == DatasourcePackage.eINSTANCE.getDirect_Url()) {
+ }
+ if (feature == DatasourcePackage.eINSTANCE.getDirect_Username()) {
+ }
+ return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature,
formEditor);
+ }
+
+ @Override
+ public boolean isJavaTypeFeature(EAttribute attribute) {
+ if (attribute == DatasourcePackage.eINSTANCE.getDirect_Driver()) {
+ return true;
+ }
+ return super.isJavaTypeFeature(attribute);
+ }
+
+ @Override
+ public boolean isSelectorFeature(EAttribute attribute) {
+ if (attribute == DatasourcePackage.eINSTANCE.getDirect_BindOnElement()) {
+ return true;
+ }
+ return super.isSelectorFeature(attribute);
+ }
+
+
+
+}
\ No newline at end of file
Property changes on:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/datasource/DirectUICreator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java 2009-04-15
09:49:21 UTC (rev 14753)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -48,8 +48,9 @@
@Override
public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit
toolkit,
Composite parent, Object model, SmooksMultiFormEditor formEditor) {
- SmooksUIUtils.createMixedTextFieldEditor("Value", editingdomain, toolkit,
parent, model);
- SmooksUIUtils.createCDATAFieldEditor("Template Contents", editingdomain,
toolkit, parent, model);
+ SmooksUIUtils.createMixedTextFieldEditor("Text Value", editingdomain,
toolkit, parent, model);
+ SmooksUIUtils.createCDATAFieldEditor("Template Contents(CDATA)",
editingdomain, toolkit, parent, model);
+ SmooksUIUtils.createCommentFieldEditor("Template Contents(Comment)",
editingdomain, toolkit, parent, model);
}
@Override
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java 2009-04-15
09:49:21 UTC (rev 14753)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ParamTypeUICreator.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -46,7 +46,7 @@
@Override
public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit
toolkit,
Composite parent, Object model, SmooksMultiFormEditor formEditor) {
- SmooksUIUtils.createMixedTextFieldEditor("Value", editingdomain, toolkit,
parent, model);
- SmooksUIUtils.createCDATAFieldEditor("CDATA", editingdomain, toolkit, parent,
model);
+ SmooksUIUtils.createMixedTextFieldEditor("Text Value", editingdomain,
toolkit, parent, model , false , 500);
+ SmooksUIUtils.createCDATAFieldEditor("CDATA Value", editingdomain, toolkit,
parent, model);
}
}
\ No newline at end of file
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/SmooksResourceListTypeUICreator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/SmooksResourceListTypeUICreator.java 2009-04-15
09:49:21 UTC (rev 14753)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/SmooksResourceListTypeUICreator.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -32,15 +32,13 @@
* org.eclipse.emf.edit.provider.IItemPropertyDescriptor, java.lang.Object,
* org.eclipse.emf.ecore.EAttribute)
*/
- public Composite createPropertyUI(FormToolkit toolkit, Composite parent,
- IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
- SmooksMultiFormEditor formEditor) {
+ public Composite createPropertyUI(FormToolkit toolkit, Composite parent,
IItemPropertyDescriptor propertyDescriptor, Object model,
+ EAttribute feature, SmooksMultiFormEditor formEditor) {
if (feature == SmooksPackage.eINSTANCE.getSmooksResourceListType_AbstractReaderGroup())
{
}
if (feature ==
SmooksPackage.eINSTANCE.getSmooksResourceListType_AbstractResourceConfigGroup()) {
}
- if (feature == SmooksPackage.eINSTANCE.getSmooksResourceListType_DefaultConditionRef())
{
- }
+
if (feature ==
SmooksPackage.eINSTANCE.getSmooksResourceListType_DefaultSelectorNamespace()) {
}
if (feature ==
SmooksPackage.eINSTANCE.getSmooksResourceListType_DefaultTargetProfile()) {
@@ -57,4 +55,12 @@
return super.isSelectorFeature(attribute);
}
+ @Override
+ protected boolean isConditionSelectionFeature(EAttribute feature) {
+ if (feature == SmooksPackage.eINSTANCE.getSmooksResourceListType_DefaultConditionRef())
{
+ return true;
+ }
+ return super.isConditionSelectionFeature(feature);
+ }
+
}
\ No newline at end of file
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/IModelProcsser.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/IModelProcsser.java 2009-04-15
09:49:21 UTC (rev 14753)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/IModelProcsser.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -8,5 +8,6 @@
*
*/
public interface IModelProcsser {
- Object processModel(Object model);
+ Object unwrapValue(Object model);
+ Object wrapValue(Object model);
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-04-15
09:49:21 UTC (rev 14753)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -14,6 +14,7 @@
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IFile;
@@ -24,6 +25,7 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.xml.type.AnyType;
@@ -43,7 +45,10 @@
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
@@ -54,6 +59,7 @@
import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.ui.forms.widgets.Section;
import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
import org.jboss.tools.smooks.configuration.editors.IXMLStructuredObject;
import org.jboss.tools.smooks.configuration.editors.SelectorAttributes;
@@ -64,6 +70,8 @@
import org.jboss.tools.smooks.model.graphics.ext.SmooksGraphicsExtType;
import
org.jboss.tools.smooks.model.graphics.ext.util.SmooksGraphicsExtResourceFactoryImpl;
import org.jboss.tools.smooks.model.javabean.BindingsType;
+import org.jboss.tools.smooks.model.smooks.ConditionType;
+import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
/**
@@ -80,25 +88,50 @@
public static final String XSL_NAMESPACE = "
xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" ";
- public static void createMixedTextFieldEditor(String label, AdapterFactoryEditingDomain
editingdomain,
- FormToolkit toolkit, Composite parent, Object model) {
+ public static void createMixedTextFieldEditor(String label, AdapterFactoryEditingDomain
editingdomain, FormToolkit toolkit, Composite parent,
+ Object model) {
createMixedTextFieldEditor(label, editingdomain, toolkit, parent, model, false, 0);
}
- public static void createMultiMixedTextFieldEditor(String label,
AdapterFactoryEditingDomain editingdomain,
- FormToolkit toolkit, Composite parent, Object model, int height) {
+ public static void createMultiMixedTextFieldEditor(String label,
AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit,
+ Composite parent, Object model, int height) {
createMixedTextFieldEditor(label, editingdomain, toolkit, parent, model, true,
height);
}
- public static void createMixedTextFieldEditor(String label, AdapterFactoryEditingDomain
editingdomain,
- FormToolkit toolkit, Composite parent, Object model, boolean multiText, int height) {
- toolkit.createLabel(parent, label + "
:").setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ public static void createMixedTextFieldEditor(String label, AdapterFactoryEditingDomain
editingdomain, FormToolkit toolkit, Composite parent,
+ Object model, boolean multiText, int height) {
+ GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
+ Section section = null;
+ Composite textContainer = null;
+ if (multiText) {
+ Composite space = toolkit.createComposite(parent);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ gd.heightHint = 10;
+ space.setLayoutData(gd);
+
+ section = toolkit.createSection(parent, Section.TITLE_BAR | Section.TWISTIE);
+ FillLayout layout = new FillLayout();
+ section.setLayout(layout);
+ section.setText(label);
+
+ Composite textComposite = toolkit.createComposite(section);
+ section.setClient(textComposite);
+ textComposite.setLayout(new GridLayout());
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ section.setLayoutData(gd);
+ textContainer = textComposite;
+ } else {
+ toolkit.createLabel(parent, label + "
:").setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ textContainer = parent;
+ }
+ gd = new GridData(GridData.FILL_HORIZONTAL);
int textType = SWT.FLAT;
if (multiText) {
- textType = SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL;
+ textType = SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL;
}
- final Text valueText = toolkit.createText(parent, "", textType);
+ final Text valueText = toolkit.createText(textContainer, "", textType);
gd = new GridData(GridData.FILL_HORIZONTAL);
if (multiText && height > 0) {
gd.heightHint = height;
@@ -108,6 +141,9 @@
String text = SmooksModelUtils.getAnyTypeText((AnyType) model);
if (text != null) {
valueText.setText(text);
+ if (text.length() > 0 && section != null) {
+ section.setExpanded(true);
+ }
}
}
final Object fm = model;
@@ -125,6 +161,23 @@
});
}
+ public static Control createFiledEditorLabel(Composite parent, FormToolkit formToolKit,
IItemPropertyDescriptor itemPropertyDescriptor,
+ Object model, boolean isLink) {
+ String displayName = itemPropertyDescriptor.getDisplayName(model);
+ EAttribute feature = (EAttribute) itemPropertyDescriptor.getFeature(model);
+ if (feature.isRequired()) {
+ displayName = "*" + displayName;
+ }
+ if (!isLink) {
+ Label label = formToolKit.createLabel(parent, displayName + " :");
+ label.setForeground(formToolKit.getColors().getColor(IFormColors.TITLE));
+ return label;
+ } else {
+ Hyperlink link = formToolKit.createHyperlink(parent, displayName + " :",
SWT.NONE);
+ return link;
+ }
+ }
+
/**
* Can't use
*
@@ -133,14 +186,12 @@
* @param parent
* @param model
*/
- public static void createFilePathFieldEditor(AdapterFactoryEditingDomain editingdomain,
FormToolkit toolkit,
- Composite parent, Object model) {
+ public static void createFilePathFieldEditor(AdapterFactoryEditingDomain editingdomain,
FormToolkit toolkit, Composite parent, Object model) {
// IHyperlinkListener link
}
- public static void createLinkMixedTextFieldEditor(String label,
AdapterFactoryEditingDomain editingdomain,
- FormToolkit toolkit, Composite parent, Object model, boolean multiText, int height,
boolean linkLabel,
- IHyperlinkListener listener) {
+ public static void createLinkMixedTextFieldEditor(String label,
AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent,
+ Object model, boolean multiText, int height, boolean linkLabel, IHyperlinkListener
listener) {
if (linkLabel) {
Hyperlink link = toolkit.createHyperlink(parent, label, SWT.NONE);
if (listener != null) {
@@ -184,8 +235,8 @@
}
public static void createLinkTextValueFieldEditor(String label,
AdapterFactoryEditingDomain editingdomain,
- IItemPropertyDescriptor propertyDescriptor, FormToolkit toolkit, Composite parent,
Object model,
- boolean multiText, int height, boolean linkLabel, IHyperlinkListener listener) {
+ IItemPropertyDescriptor propertyDescriptor, FormToolkit toolkit, Composite parent,
Object model, boolean multiText, int height,
+ boolean linkLabel, IHyperlinkListener listener) {
if (linkLabel) {
Hyperlink link = toolkit.createHyperlink(parent, label, SWT.NONE);
if (listener != null) {
@@ -247,8 +298,8 @@
return path;
}
- public static Composite createSelectorFieldEditor(FormToolkit toolkit, Composite
parent,
- final IItemPropertyDescriptor propertyDescriptor, Object model, final
SmooksGraphicsExtType extType) {
+ public static Composite createSelectorFieldEditor(FormToolkit toolkit, Composite parent,
final IItemPropertyDescriptor propertyDescriptor,
+ Object model, final SmooksGraphicsExtType extType) {
return createDialogFieldEditor(parent, toolkit, propertyDescriptor, "Browse",
new IFieldDialog() {
public Object open(Shell shell) {
SelectoreSelectionDialog dialog = new SelectoreSelectionDialog(shell, extType);
@@ -275,8 +326,8 @@
}
public static SmooksGraphicsExtType loadSmooksGraphicsExt(IFile file) throws IOException
{
- Resource resource = new
SmooksGraphicsExtResourceFactoryImpl().createResource(URI.createPlatformResourceURI(
- file.getFullPath().toPortableString(), false));
+ Resource resource = new
SmooksGraphicsExtResourceFactoryImpl().createResource(URI.createPlatformResourceURI(file.getFullPath()
+ .toPortableString(), false));
resource.load(Collections.emptyMap());
if (resource.getContents().size() > 0) {
Object obj = resource.getContents().get(0);
@@ -287,15 +338,29 @@
return null;
}
- public static void createCDATAFieldEditor(String label, AdapterFactoryEditingDomain
editingdomain,
- FormToolkit toolkit, Composite parent, Object model) {
- Label label1 = toolkit.createLabel(parent, label + " :");
- label1.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ public static void createCDATAFieldEditor(String label, AdapterFactoryEditingDomain
editingdomain, FormToolkit toolkit, Composite parent,
+ Object model) {
GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
- label1.setLayoutData(gd);
+ Composite space = toolkit.createComposite(parent);
gd = new GridData(GridData.FILL_HORIZONTAL);
- final Text cdataText = toolkit.createText(parent, "", SWT.MULTI |
SWT.H_SCROLL | SWT.V_SCROLL);
+ gd.horizontalSpan = 2;
+ gd.heightHint = 10;
+ space.setLayoutData(gd);
+
+ Section section = toolkit.createSection(parent, Section.TITLE_BAR | Section.TWISTIE |
Section.DESCRIPTION);
+ FillLayout layout = new FillLayout();
+ section.setLayout(layout);
+ section.setText(label);
+
+ Composite textComposite = toolkit.createComposite(section);
+ section.setClient(textComposite);
+ textComposite.setLayout(new GridLayout());
+ final Text cdataText = toolkit.createText(textComposite, "", SWT.MULTI |
SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ section.setLayoutData(gd);
+ toolkit.paintBordersFor(textComposite);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
gd.heightHint = 300;
cdataText.setLayoutData(gd);
@@ -303,8 +368,12 @@
String cdata = SmooksModelUtils.getAnyTypeCDATA((AnyType) model);
if (cdata != null) {
cdataText.setText(cdata);
+ if (cdata.length() > 0) {
+ section.setExpanded(true);
+ }
}
}
+
final Object fm = model;
final AdapterFactoryEditingDomain fEditingDomain = editingdomain;
cdataText.addModifyListener(new ModifyListener() {
@@ -320,22 +389,37 @@
});
}
- public static void createCommentFieldEditor(String label, AdapterFactoryEditingDomain
editingdomain,
- FormToolkit toolkit, Composite parent, Object model) {
- Label label1 = toolkit.createLabel(parent, label + " :");
- label1.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ public static void createCommentFieldEditor(String label, AdapterFactoryEditingDomain
editingdomain, FormToolkit toolkit, Composite parent,
+ Object model) {
GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
- label1.setLayoutData(gd);
+ Composite space = toolkit.createComposite(parent);
gd = new GridData(GridData.FILL_HORIZONTAL);
- final Text cdataText = toolkit.createText(parent, "", SWT.MULTI |
SWT.H_SCROLL | SWT.V_SCROLL);
+ gd.horizontalSpan = 2;
+ gd.heightHint = 10;
+ space.setLayoutData(gd);
+
+ Section section = toolkit.createSection(parent, Section.TITLE_BAR | Section.TWISTIE |
Section.DESCRIPTION);
+ FillLayout layout = new FillLayout();
+ section.setLayout(layout);
+ section.setText(label);
+
+ Composite textComposite = toolkit.createComposite(section);
+ section.setClient(textComposite);
+ textComposite.setLayout(new GridLayout());
+ final Text cdataText = toolkit.createText(textComposite, "", SWT.MULTI |
SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ section.setLayoutData(gd);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
gd.heightHint = 300;
cdataText.setLayoutData(gd);
if (model instanceof AnyType) {
- String cdata = SmooksModelUtils.getAnyTypeComment((AnyType) model);
- if (cdata != null) {
- cdataText.setText(cdata);
+ String comment = SmooksModelUtils.getAnyTypeComment((AnyType) model);
+ if (comment != null) {
+ cdataText.setText(comment);
+ if (comment.length() > 0)
+ section.setExpanded(true);
}
}
final Object fm = model;
@@ -353,8 +437,8 @@
});
}
- public static Composite createJavaTypeSearchFieldEditor(Composite parent, FormToolkit
toolkit,
- final IItemPropertyDescriptor propertyDescriptor, final EObject model) {
+ public static Composite createJavaTypeSearchFieldEditor(Composite parent, FormToolkit
toolkit, final IItemPropertyDescriptor propertyDescriptor,
+ final EObject model) {
if (model instanceof EObject) {
final Resource resource = ((EObject) model).eResource();
URI uri = resource.getURI();
@@ -363,8 +447,7 @@
String path = uri.toPlatformString(true);
workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(new
Path(path));
JavaTypeFieldDialog dialog = new JavaTypeFieldDialog(workspaceResource);
- String displayName = propertyDescriptor.getDisplayName(model);
- Hyperlink link = toolkit.createHyperlink(parent, displayName + " :",
SWT.NONE);
+ Hyperlink link = (Hyperlink) createFiledEditorLabel(parent, toolkit,
propertyDescriptor, model, true);
final Composite classTextComposite = toolkit.createComposite(parent);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
classTextComposite.setLayoutData(gd);
@@ -372,8 +455,7 @@
fillLayout.marginHeight = 0;
fillLayout.marginWidth = 0;
classTextComposite.setLayout(fillLayout);
- final SearchComposite searchComposite = new SearchComposite(classTextComposite,
toolkit,
- "Search Class", dialog, SWT.NONE);
+ final SearchComposite searchComposite = new SearchComposite(classTextComposite,
toolkit, "Search Class", dialog, SWT.NONE);
Object editValue = getEditValue(propertyDescriptor, model);
if (editValue != null) {
searchComposite.getText().setText(editValue.toString());
@@ -409,9 +491,8 @@
if (result != null)
JavaUI.openInEditor(result);
else {
- MessageDialog.openInformation(classTextComposite.getShell(), "Can't
find type",
- "Can't find type \"" + typeName + "\" in
\""
- + javaProject.getProject().getName() + "\" project.");
+ MessageDialog.openInformation(classTextComposite.getShell(), "Can't
find type", "Can't find type \"" + typeName
+ + "\" in \"" + javaProject.getProject().getName() +
"\" project.");
}
}
} catch (PartInitException ex) {
@@ -460,17 +541,15 @@
return null;
}
- public static Composite createJavaMethodSearchFieldEditor(BindingsType container,
Composite parent,
- FormToolkit toolkit, final IItemPropertyDescriptor propertyDescriptor, String
buttonName,
- final EObject model) {
+ public static Composite createJavaMethodSearchFieldEditor(BindingsType container,
Composite parent, FormToolkit toolkit,
+ final IItemPropertyDescriptor propertyDescriptor, String buttonName, final EObject
model) {
String classString = ((BindingsType) container).getClass_();
IJavaProject project = getJavaProject(container);
try {
ProjectClassLoader classLoader = new ProjectClassLoader(project);
Class<?> clazz = classLoader.loadClass(classString);
JavaMethodsSelectionDialog dialog = new JavaMethodsSelectionDialog(project, clazz);
- return SmooksUIUtils.createDialogFieldEditor(parent, toolkit, propertyDescriptor,
"Select method", dialog,
- (EObject) model);
+ return SmooksUIUtils.createDialogFieldEditor(parent, toolkit, propertyDescriptor,
"Select method", dialog, (EObject) model);
} catch (Exception e) {
// ignore
}
@@ -517,8 +596,7 @@
return generateFullPath(node, sperator);
}
- public static String generatePath(IXMLStructuredObject startNode, IXMLStructuredObject
stopNode,
- final String sperator, boolean includeContext) {
+ public static String generatePath(IXMLStructuredObject startNode, IXMLStructuredObject
stopNode, final String sperator, boolean includeContext) {
String name = "";
if (startNode == stopNode) {
return startNode.getNodeName();
@@ -546,17 +624,89 @@
return name.trim();
}
- public static Composite createJavaPropertySearchFieldEditor(BindingsType container,
Composite parent,
- FormToolkit toolkit, final IItemPropertyDescriptor propertyDescriptor, String
buttonName,
- final EObject model) {
+ public static SmooksResourceListType getSmooks11ResourceListType(EObject model) {
+ if (model instanceof SmooksResourceListType)
+ return (SmooksResourceListType) model;
+ EObject parent = model;
+ while (parent != null) {
+ parent = parent.eContainer();
+ if (parent instanceof SmooksResourceListType)
+ return (SmooksResourceListType) parent;
+ }
+ return null;
+ }
+
+ public static Control createContionsChoiceFieldEditor(Composite parent, FormToolkit
formToolkit, IItemPropertyDescriptor itemPropertyDescriptor,
+ Object model) {
+ SmooksResourceListType listType = getSmooks11ResourceListType((EObject) model);
+ List<String> names = new ArrayList<String>();
+ if (listType != null) {
+ List<ConditionType> conditions =
SmooksModelUtils.collectConditionType(listType);
+ for (Iterator<ConditionType> iterator = conditions.iterator();
iterator.hasNext();) {
+ ConditionType conditionType = (ConditionType) iterator.next();
+ String id = conditionType.getId();
+ if (id != null && id.length() != 0) {
+ names.add(id);
+ }
+ }
+ }
+ return createChoiceFieldEditor(parent, formToolkit, itemPropertyDescriptor, model,
names.toArray(new String[] {}), null, false);
+ }
+
+ public static Control createChoiceFieldEditor(Composite parent, FormToolkit formToolkit,
IItemPropertyDescriptor itemPropertyDescriptor,
+ Object model, String[] items, IModelProcsser processer, boolean readOnly) {
+ SmooksUIUtils.createFiledEditorLabel(parent, formToolkit, itemPropertyDescriptor,
model, false);
+ Object editValue = getEditValue(itemPropertyDescriptor, model);
+ if (processer != null) {
+ editValue = processer.unwrapValue(editValue);
+ }
+ int currentSelect = -1;
+ int style = SWT.BORDER;
+ if (readOnly) {
+ style = style | SWT.READ_ONLY;
+ }
+ final Combo combo = new Combo(parent, style);
+ if (items != null) {
+ for (int i = 0; i < items.length; i++) {
+ combo.add(items[i]);
+ if (items[i].equals(editValue)) {
+ currentSelect = i;
+ }
+ }
+ }
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ combo.setLayoutData(gd);
+ if (currentSelect != -1) {
+ combo.select(currentSelect);
+ }
+ final Object fm = model;
+ final IItemPropertyDescriptor fipd = itemPropertyDescriptor;
+ final IModelProcsser fp = processer;
+ combo.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ String text = combo.getText();
+ Object setValue = text;
+ if (fp != null) {
+ setValue = fp.wrapValue(text);
+ }
+ if (setValue.equals(getEditValue(fipd, fm))) {
+ return;
+ }
+ fipd.setPropertyValue(fm, setValue);
+ }
+ });
+ return combo;
+ }
+
+ public static Composite createJavaPropertySearchFieldEditor(BindingsType container,
Composite parent, FormToolkit toolkit,
+ final IItemPropertyDescriptor propertyDescriptor, String buttonName, final EObject
model) {
String classString = ((BindingsType) container).getClass_();
IJavaProject project = getJavaProject(container);
try {
ProjectClassLoader classLoader = new ProjectClassLoader(project);
Class<?> clazz = classLoader.loadClass(classString);
JavaPropertiesSelectionDialog dialog = new JavaPropertiesSelectionDialog(project,
clazz);
- return SmooksUIUtils.createDialogFieldEditor(parent, toolkit, propertyDescriptor,
"Select property",
- dialog, (EObject) model);
+ return SmooksUIUtils.createDialogFieldEditor(parent, toolkit, propertyDescriptor,
"Select property", dialog, (EObject) model);
} catch (Exception e) {
// ignore
}
@@ -572,25 +722,16 @@
return null;
}
- public static Composite createDialogFieldEditor(Composite parent, FormToolkit toolkit,
- final IItemPropertyDescriptor propertyDescriptor, String buttonName, IFieldDialog
dialog,
- final EObject model) {
+ public static Composite createDialogFieldEditor(Composite parent, FormToolkit toolkit,
final IItemPropertyDescriptor propertyDescriptor,
+ String buttonName, IFieldDialog dialog, final EObject model) {
return createDialogFieldEditor(parent, toolkit, propertyDescriptor, buttonName, dialog,
model, false, null);
}
- public static Composite createDialogFieldEditor(Composite parent, FormToolkit toolkit,
- final IItemPropertyDescriptor propertyDescriptor, String buttonName, IFieldDialog
dialog,
- final EObject model, boolean labelLink, IHyperlinkListener listener) {
-
- String displayName = propertyDescriptor.getDisplayName(model);
- if (labelLink) {
- Hyperlink link = toolkit.createHyperlink(parent, displayName + " :",
SWT.NONE);
- if (listener != null) {
- link.addHyperlinkListener(listener);
- }
- } else {
- toolkit.createLabel(parent, displayName + " :").setForeground(
- toolkit.getColors().getColor(IFormColors.TITLE));
+ public static Composite createDialogFieldEditor(Composite parent, FormToolkit toolkit,
final IItemPropertyDescriptor propertyDescriptor,
+ String buttonName, IFieldDialog dialog, final EObject model, boolean labelLink,
IHyperlinkListener listener) {
+ Control label = createFiledEditorLabel(parent, toolkit, propertyDescriptor, model,
labelLink);
+ if (label instanceof Hyperlink && listener != null) {
+ ((Hyperlink) label).addHyperlinkListener(listener);
}
final Composite classTextComposite = toolkit.createComposite(parent);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
@@ -599,8 +740,7 @@
fillLayout.marginHeight = 0;
fillLayout.marginWidth = 0;
classTextComposite.setLayout(fillLayout);
- final SearchComposite searchComposite = new SearchComposite(classTextComposite,
toolkit, buttonName, dialog,
- SWT.NONE);
+ final SearchComposite searchComposite = new SearchComposite(classTextComposite,
toolkit, buttonName, dialog, SWT.NONE);
Object editValue = getEditValue(propertyDescriptor, model);
if (editValue != null) {
searchComposite.getText().setText(editValue.toString());
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java 2009-04-15
09:49:21 UTC (rev 14753)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java 2009-04-15
10:22:15 UTC (rev 14754)
@@ -62,8 +62,9 @@
@Override
public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit
toolkit,
Composite parent, Object model, SmooksMultiFormEditor formEditor) {
- SmooksUIUtils.createMixedTextFieldEditor("Value", editingdomain, toolkit,
parent, model);
- SmooksUIUtils.createCDATAFieldEditor("Template Contents", editingdomain,
toolkit, parent, model);
+ SmooksUIUtils.createMixedTextFieldEditor("Text Value", editingdomain,
toolkit, parent, model);
+ SmooksUIUtils.createCDATAFieldEditor("Template Contents (CDATA)",
editingdomain, toolkit, parent, model);
+ SmooksUIUtils.createCommentFieldEditor("Template Contents (Comment)",
editingdomain, toolkit, parent, model);
}
}
\ No newline at end of file