Author: DartPeng
Date: 2009-04-14 12:07:31 -0400 (Tue, 14 Apr 2009)
New Revision: 14739
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/plugin.xml
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/validate/SmooksModelValidator.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/SelectoreSelectionDialog.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/uitls/SearchComposite.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
Log:
JBIDE-4171
1.Change Boolean attribute display UI
2.Fix some warning problem with plugin.xml
3.Change attribute display UI creation order.
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/plugin.xml
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/plugin.xml 2009-04-14 15:33:33 UTC
(rev 14738)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/plugin.xml 2009-04-14 16:07:31 UTC
(rev 14739)
@@ -13,7 +13,7 @@
<extension point="org.eclipse.emf.ecore.extension_parser">
<parser
- type="smooks"
+ type="smooks10"
class="org.jboss.tools.smooks10.model.smooks.util.SmooksResourceFactoryImpl"/>
</extension>
<extension
point="org.eclipse.emf.edit.itemProviderAdapterFactories">
@@ -72,7 +72,7 @@
<package
uri="http://www.milyn.org/xsd/smooks-1.1.xsd"
class="org.jboss.tools.smooks.model.smooks.SmooksPackage"
- genModel="ecore.model/freemarker-1.1.genmodel"/>
+ genModel="ecore.model/smooks-1.1.genmodel"/>
</extension>
<extension point="org.eclipse.emf.ecore.extension_parser">
@@ -157,7 +157,7 @@
<package
class="org.jboss.tools.smooks.model.iorouting.IoroutingPackage"
genModel="model/io-routing-1.1.genmodel"
-
uri="http://www.milyn.org/xsd/smooks/csv-1.1.xsd">
+
uri="http://www.milyn.org/xsd/smooks/io-routing-1.1.xsd">
</package>
</extension>
<extension
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/validate/SmooksModelValidator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/validate/SmooksModelValidator.java 2009-04-14
15:33:33 UTC (rev 14738)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/validate/SmooksModelValidator.java 2009-04-14
16:07:31 UTC (rev 14739)
@@ -25,7 +25,6 @@
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
-//import org.eclipse.emf.edit.ui.EMFEditUIPlugin;
/**
* @author Dart (dpeng(a)redhat.com)
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-14
15:33:33 UTC (rev 14738)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java 2009-04-14
16:07:31 UTC (rev 14739)
@@ -24,12 +24,13 @@
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
+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;
@@ -117,7 +118,6 @@
public void createExtendUI(AdapterFactoryEditingDomain editingdomain, FormToolkit
toolkit, Composite parent, Object model,
SmooksMultiFormEditor formEditor) {
-
}
public boolean isFileSelectionFeature(EAttribute attribute) {
@@ -190,8 +190,8 @@
SmooksResourceListType smooksResourceList = getSmooksResourceList((EObject) model);
if (smooksResourceList != null) {
String displayName = propertyDescriptor.getDisplayName(model);
- toolkit.createLabel(parent, displayName + " :");
- final CCombo combo = new CCombo(parent, SWT.BORDER);
+ toolkit.createLabel(parent, displayName + "
:").setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ final Combo combo = new Combo(parent, SWT.BORDER);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
combo.setLayoutData(gd);
Object editValue = SmooksUIUtils.getEditValue(propertyDescriptor, model);
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SelectoreSelectionDialog.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SelectoreSelectionDialog.java 2009-04-14
15:33:33 UTC (rev 14738)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SelectoreSelectionDialog.java 2009-04-14
16:07:31 UTC (rev 14739)
@@ -212,8 +212,8 @@
list.add(model);
}
}
- } finally {
-
+ } catch(Throwable e){
+
}
}
}
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-14
15:33:33 UTC (rev 14738)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java 2009-04-14
16:07:31 UTC (rev 14739)
@@ -75,6 +75,7 @@
import org.jboss.tools.smooks.model.json.provider.JsonItemProviderAdapterFactory;
import org.jboss.tools.smooks.model.medi.provider.MEdiItemProviderAdapterFactory;
import org.jboss.tools.smooks.model.smooks.provider.SmooksItemProviderAdapterFactory;
+import org.jboss.tools.smooks.model.validate.SmooksModelValidator;
import org.jboss.tools.smooks.model.xsl.provider.XslItemProviderAdapterFactory;
import org.jboss.tools.smooks10.model.smooks.util.SmooksResourceFactoryImpl;
@@ -142,7 +143,8 @@
}
int newEndIndex = newContent.length() - 1;
int oldEndIndex = oldContent.length() - 1;
- while (newEndIndex >= startIndex && oldEndIndex >= startIndex &&
newContent.charAt(newEndIndex) == oldContent.charAt(oldEndIndex)) {
+ while (newEndIndex >= startIndex && oldEndIndex >= startIndex
+ && newContent.charAt(newEndIndex) == oldContent.charAt(oldEndIndex)) {
--newEndIndex;
--oldEndIndex;
}
@@ -327,36 +329,42 @@
textEditor.doSave(monitor);
((BasicCommandStack) editingDomain.getCommandStack()).saveIsDone();
firePropertyChange(PROP_DIRTY);
- return;
- }
- Map<?, ?> options = Collections.emptyMap();
- initSaveOptions(options);
- if (editingDomain != null) {
- ResourceSet resourceSet = editingDomain.getResourceSet();
- List<Resource> resourceList = resourceSet.getResources();
- monitor.beginTask("Saving Smooks config file", resourceList.size());
- try {
- for (Iterator<Resource> iterator = resourceList.iterator();
iterator.hasNext();) {
- Resource resource = (Resource) iterator.next();
- resource.save(options);
- monitor.worked(1);
+ } else {
+ Map<?, ?> options = Collections.emptyMap();
+ initSaveOptions(options);
+ if (editingDomain != null) {
+ ResourceSet resourceSet = editingDomain.getResourceSet();
+ List<Resource> resourceList = resourceSet.getResources();
+ monitor.beginTask("Saving Smooks config file", resourceList.size());
+ try {
+ for (Iterator<Resource> iterator = resourceList.iterator();
iterator.hasNext();) {
+ Resource resource = (Resource) iterator.next();
+ resource.save(options);
+ monitor.worked(1);
+ }
+ ((BasicCommandStack) editingDomain.getCommandStack()).saveIsDone();
+ textEditor.doRevertToSaved();
+ firePropertyChange(PROP_DIRTY);
+ } catch (IOException e) {
+ SmooksConfigurationActivator.getDefault().log(e);
+ } finally {
+ monitor.done();
}
- ((BasicCommandStack) editingDomain.getCommandStack()).saveIsDone();
- textEditor.doRevertToSaved();
- firePropertyChange(PROP_DIRTY);
- } catch (IOException e) {
- SmooksConfigurationActivator.getDefault().log(e);
- } finally {
- monitor.done();
}
}
+ if(this.smooksModel != null){
+ List<Object> lists = new ArrayList<Object>();
+ lists.add(smooksModel);
+ SmooksModelValidator validator = new SmooksModelValidator(lists,getEditingDomain());
+ validator.validate(monitor);
+ }
}
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
IFile file = ((IFileEditorInput) input).getFile();
- Resource smooksResource = new
SmooksResourceFactoryImpl().createResource(URI.createPlatformResourceURI(file.getFullPath().toPortableString(),
- false));
+ Resource smooksResource = new
SmooksResourceFactoryImpl().createResource(URI.createPlatformResourceURI(file
+ .getFullPath().toPortableString(), false));
try {
smooksResource.load(Collections.emptyMap());
smooksModel = smooksResource.getContents().get(0);
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-14
15:33:33 UTC (rev 14738)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksStuffPropertyDetailPage.java 2009-04-14
16:07:31 UTC (rev 14739)
@@ -28,7 +28,6 @@
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
@@ -36,11 +35,12 @@
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
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;
@@ -73,13 +73,16 @@
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());
@@ -103,57 +106,28 @@
GridLayout layout = new GridLayout();
layout.numColumns = 2;
detailsComposite.setLayout(layout);
- IPropertyUICreator creator =
PropertyUICreatorManager.getInstance().getPropertyUICreator(
- getModel());
- List<IItemPropertyDescriptor> propertyDes =
itemPropertySource.getPropertyDescriptors(getModel());
- for (Iterator<IItemPropertyDescriptor> iterator = propertyDes.iterator();
iterator.hasNext();) {
- final IItemPropertyDescriptor itemPropertyDescriptor = (IItemPropertyDescriptor)
iterator
- .next();
- EAttribute feature = (EAttribute) itemPropertyDescriptor.getFeature(getModel());
- boolean createDefault = true;
- if (creator != null) {
- if (creator.ignoreProperty(feature)) {
- continue;
- }
- Composite composite = creator.createPropertyUI(formToolkit, detailsComposite,
- itemPropertyDescriptor, getModel(), feature, getFormEditor());
- if (composite != null) {
- createDefault = false;
- }
+ 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());
+ if (attribute.isRequired()) {
+ createAttributeUI(detailsComposite, pd, creator);
}
- if (createDefault) {
- EClassifier typeClazz = feature.getEType();
- boolean hasCreated = false;
- if (typeClazz instanceof EEnum) {
- createEnumFieldEditor(detailsComposite, feature, (EEnum) typeClazz, formToolkit,
- itemPropertyDescriptor);
- hasCreated = true;
- }
- if (typeClazz.getInstanceClass() == String.class) {
- createStringFieldEditor(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);
- hasCreated = true;
- }
-// if (!hasCreated) {
-// createStringFieldEditor(detailsComposite, feature, formToolkit,
-// itemPropertyDescriptor);
-// }
+ }
+ for (int i = 0; i < propertyDes.size(); i++) {
+ IItemPropertyDescriptor pd = propertyDes.get(i);
+ EAttribute attribute = (EAttribute) pd.getFeature(getModel());
+ if (!attribute.isRequired()) {
+ createAttributeUI(detailsComposite, pd, creator);
}
}
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();
@@ -163,23 +137,79 @@
}
}
- protected void createEnumFieldEditor(Composite propertyComposite, EAttribute feature,
- final EEnum typeClass, FormToolkit formToolKit,
+ protected void createAttributeUI(Composite detailsComposite,
+ IItemPropertyDescriptor propertyDescriptor,
+ IPropertyUICreator creator) {
+ final IItemPropertyDescriptor itemPropertyDescriptor = propertyDescriptor;
+ 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());
+ if (composite != null) {
+ createDefault = false;
+ }
+ }
+ if (createDefault) {
+ EClassifier typeClazz = feature.getEType();
+ boolean hasCreated = false;
+ if (typeClazz instanceof EEnum) {
+ createEnumFieldEditor(detailsComposite, feature,
+ (EEnum) typeClazz, formToolkit, itemPropertyDescriptor);
+ hasCreated = true;
+ }
+ if (typeClazz.getInstanceClass() == String.class) {
+ createStringFieldEditor(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);
+ hasCreated = true;
+ }
+ if (!hasCreated) {
+ // createStringFieldEditor(detailsComposite, feature,
+ // formToolkit,
+ // itemPropertyDescriptor);
+ }
+ }
+ }
+
+ protected void 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 + " :");
- final CCombo combo = new CCombo(propertyComposite, SWT.NONE);
+ 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();) {
+ for (Iterator<EEnumLiteral> iterator = literalList.iterator(); iterator
+ .hasNext();) {
EEnumLiteral enumLiteral = (EEnumLiteral) iterator.next();
combo.add(enumLiteral.getName());
}
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 Enumerator) {
String[] strings = combo.getItems();
for (int i = 0; i < strings.length; i++) {
@@ -194,20 +224,24 @@
combo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
try {
- Object value = itemPropertyDescriptor.getPropertyValue(getModel());
- Method method = typeClass.getInstanceClass().getMethod("get",
- new Class<?>[] { String.class });
+ Object value = itemPropertyDescriptor
+ .getPropertyValue(getModel());
+ 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());
+ Object editValue = ((PropertyValueWrapper) value)
+ .getEditableValue(getModel());
if (editValue != null) {
if (!editValue.equals(v)) {
- itemPropertyDescriptor.setPropertyValue(getModel(), v);
+ itemPropertyDescriptor.setPropertyValue(
+ getModel(), v);
}
} else {
- itemPropertyDescriptor.setPropertyValue(getModel(), v);
+ itemPropertyDescriptor.setPropertyValue(getModel(),
+ v);
}
} else {
itemPropertyDescriptor.setPropertyValue(getModel(), v);
@@ -221,58 +255,85 @@
combo.setLayoutData(gd);
}
- protected void createBooleanFieldEditor(final Composite propertyComposite, EAttribute
feature,
- FormToolkit formToolkit, final IItemPropertyDescriptor itemPropertyDescriptor) {
+ 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 Button checkButton = formToolkit.createButton(propertyComposite, displayName,
SWT.CHECK);
+ 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);
- gd.horizontalSpan = 2;
- checkButton.setLayoutData(gd);
+ combo.setLayoutData(gd);
Object editValue = null;
if (value != null && value instanceof PropertyValueWrapper) {
- editValue = ((PropertyValueWrapper) value).getEditableValue(getModel());
- if (editValue != null && editValue instanceof Boolean)
- checkButton.setSelection((Boolean) editValue);
+ editValue = ((PropertyValueWrapper) value)
+ .getEditableValue(getModel());
+ if (editValue != null && editValue instanceof Boolean) {
+ if ((Boolean) editValue) {
+ combo.select(0);
+ } else {
+ combo.select(1);
+ }
+ }
}
- checkButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- itemPropertyDescriptor.setPropertyValue(getModel(), checkButton.getSelection());
+ combo.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ boolean bv = Boolean.valueOf(combo.getText());
+ itemPropertyDescriptor.setPropertyValue(getModel(), bv);
}
+
});
}
- protected void createStringFieldEditor(final Composite propertyComposite, EAttribute
feature,
- FormToolkit formToolKit, final IItemPropertyDescriptor itemPropertyDescriptor) {
+ protected void 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 + " :");
- final Text text = formToolKit.createText(propertyComposite, "", SWT.NONE);
+ formToolKit.createLabel(propertyComposite, displayName + " :")
+ .setForeground(
+ formToolKit.getColors().getColor(IFormColors.TITLE));
+ 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());
}
}
});
@@ -280,34 +341,43 @@
text.setLayoutData(gd);
}
- protected void createIntegerFieldEditor(final Composite propertyComposite, EAttribute
feature,
- FormToolkit formToolKit, final IItemPropertyDescriptor itemPropertyDescriptor) {
+ 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 + " :");
+ formToolKit.createLabel(propertyComposite, displayName + " :")
+ .setForeground(
+ formToolKit.getColors().getColor(IFormColors.TITLE));
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());
}
}
});
@@ -327,14 +397,16 @@
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);
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SearchComposite.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SearchComposite.java 2009-04-14
15:33:33 UTC (rev 14738)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SearchComposite.java 2009-04-14
16:07:31 UTC (rev 14739)
@@ -36,10 +36,10 @@
super(parent, style);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
GridLayout gl = new GridLayout();
- gl.marginWidth = 2;
+ gl.marginWidth = 0;
gl.numColumns = 2;
gl.makeColumnsEqualWidth = false;
- gl.marginHeight = 2;
+ gl.marginHeight = 0;
this.setLayout(gl);
if (toolkit != null) {
text = toolkit.createText(this, "");
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-14
15:33:33 UTC (rev 14738)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-04-14
16:07:31 UTC (rev 14739)
@@ -49,6 +49,7 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.forms.IFormColors;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -79,19 +80,19 @@
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 + " :");
+ 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);
int textType = SWT.FLAT;
if (multiText) {
@@ -132,19 +133,21 @@
* @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) {
link.addHyperlinkListener(listener);
}
} else {
- toolkit.createLabel(parent, label + " :");
+ toolkit.createLabel(parent, label + "
:").setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
}
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
int textType = SWT.FLAT;
@@ -181,15 +184,15 @@
}
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) {
link.addHyperlinkListener(listener);
}
} else {
- toolkit.createLabel(parent, label + " :");
+ toolkit.createLabel(parent, label + "
:").setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
}
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
int textType = SWT.FLAT;
@@ -244,8 +247,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);
@@ -265,15 +268,15 @@
}
public void setModelProcesser(IModelProcsser processer) {
-
+
}
}, (EObject) model);
}
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);
@@ -284,9 +287,10 @@
return null;
}
- public static void createCDATAFieldEditor(String label, AdapterFactoryEditingDomain
editingdomain, FormToolkit toolkit, Composite parent,
- Object model) {
+ 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));
GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
label1.setLayoutData(gd);
gd = new GridData(GridData.FILL_HORIZONTAL);
@@ -316,9 +320,10 @@
});
}
- public static void createCommentFieldEditor(String label, AdapterFactoryEditingDomain
editingdomain, FormToolkit toolkit, Composite parent,
- Object model) {
+ 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));
GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
label1.setLayoutData(gd);
gd = new GridData(GridData.FILL_HORIZONTAL);
@@ -348,8 +353,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();
@@ -367,7 +372,8 @@
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());
@@ -403,8 +409,9 @@
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) {
@@ -453,15 +460,17 @@
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
}
@@ -508,7 +517,8 @@
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();
@@ -536,15 +546,17 @@
return name.trim();
}
- public static Composite createJavaPropertySearchFieldEditor(BindingsType container,
Composite parent, FormToolkit toolkit,
- final IItemPropertyDescriptor propertyDescriptor, String buttonName, final EObject
model) {
+ 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
}
@@ -560,15 +572,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) {
- 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);
@@ -576,7 +589,8 @@
link.addHyperlinkListener(listener);
}
} else {
- toolkit.createLabel(parent, displayName + " :");
+ toolkit.createLabel(parent, displayName + " :").setForeground(
+ toolkit.getColors().getColor(IFormColors.TITLE));
}
final Composite classTextComposite = toolkit.createComposite(parent);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
@@ -585,7 +599,8 @@
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());