Author: DartPeng
Date: 2009-05-12 03:54:28 -0400 (Tue, 12 May 2009)
New Revision: 15219
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.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/uitls/SmooksUIUtils.java
Log:
JBIDE-4232
change the notification image position
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-05-12
07:02:01 UTC (rev 15218)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/validate/SmooksModelValidator.java 2009-05-12
07:54:28 UTC (rev 15219)
@@ -41,6 +41,8 @@
private boolean starting = false;
private boolean waiting = false;
private Object lock = new Object();
+
+ private long watingTime = 300;
private List<ISmooksModelValidateListener> listeners = new
ArrayList<ISmooksModelValidateListener>();
@@ -109,64 +111,69 @@
}
public void startValidate(final Collection<?> selectedObjects, final EditingDomain
editingDomain) {
+ if (starting) {
+ synchronized (lock) {
+ waiting = true;
+ }
+ return;
+ }
Thread thread = new Thread() {
public void run() {
- if (starting) {
- synchronized (lock) {
- waiting = true;
+ long startTime = System.currentTimeMillis();
+ synchronized (lock) {
+ starting = true;
+ waiting = true;
+ }
+ while (waiting) {
+ try {
+ waiting = false;
+ Thread.sleep(watingTime);
+ Thread.yield();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
}
- return;
- } else {
- synchronized (lock) {
- starting = true;
- waiting = true;
+ }
+ try {
+ for (Iterator<?> iterator = listeners.iterator(); iterator.hasNext();) {
+ final ISmooksModelValidateListener l = (ISmooksModelValidateListener)
iterator.next();
+ Display.getDefault().syncExec(new Runnable() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ l.validateStart();
+ }
+
+ });
+
}
- while (waiting) {
- try {
- waiting = false;
- Thread.sleep(700);
- Thread.yield();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- try {
- for (Iterator<?> iterator = listeners.iterator(); iterator.hasNext();) {
- final ISmooksModelValidateListener l = (ISmooksModelValidateListener)
iterator.next();
- Display.getDefault().syncExec(new Runnable(){
- /* (non-Javadoc)
- * @see java.lang.Runnable#run()
- */
- public void run() {
- l.validateStart();
- }
-
- });
-
- }
-
- final Diagnostic d = validate(selectedObjects, editingDomain);
+ final Diagnostic d = validate(selectedObjects, editingDomain);
- for (Iterator<?> iterator = listeners.iterator(); iterator.hasNext();) {
- final ISmooksModelValidateListener l = (ISmooksModelValidateListener)
iterator.next();
- Display.getDefault().syncExec(new Runnable(){
+ for (Iterator<?> iterator = listeners.iterator(); iterator.hasNext();) {
+ final ISmooksModelValidateListener l = (ISmooksModelValidateListener)
iterator.next();
+ Display.getDefault().syncExec(new Runnable() {
- /* (non-Javadoc)
- * @see java.lang.Runnable#run()
- */
- public void run() {
- l.validateEnd(d);
- }
-
- });
- }
- } finally {
- waiting = false;
- starting = false;
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ l.validateEnd(d);
+ }
+
+ });
}
+ } finally {
+ waiting = false;
+ starting = false;
+ long engTime = System.currentTimeMillis();
+ System.out.println(engTime - startTime);
}
-
}
};
thread.setName("Validate Smooks model");
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-05-12
07:02:01 UTC (rev 15218)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java 2009-05-12
07:54:28 UTC (rev 15219)
@@ -27,6 +27,7 @@
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
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.Shell;
@@ -199,10 +200,30 @@
if (smooksResourceList != null) {
FieldMarkerWrapper wrapper = SmooksUIUtils.createFieldEditorLabel(null,parent,
toolkit, propertyDescriptor, model, false);
editPart.setFieldMarker(wrapper.getMarker());
- final Combo combo = new Combo(parent, SWT.BORDER);
+
+ Composite tcom = toolkit.createComposite(parent);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginLeft = 0;
+ layout.marginRight = 0;
+ layout.horizontalSpacing = 0;
+ tcom.setLayout(layout);
+
+ FieldMarkerComposite notificationComposite = new FieldMarkerComposite(tcom,
SWT.NONE);
+ GridData gd = new GridData();
+ gd.heightHint = 8;
+ gd.widthHint = 8;
+ gd.horizontalAlignment = GridData.BEGINNING;
+ gd.verticalAlignment = GridData.BEGINNING;
+ notificationComposite.setLayoutData(gd);
+ editPart.setFieldMarker(notificationComposite);
+
+ final Combo combo = new Combo(tcom, SWT.BORDER);
editPart.setContentControl(combo);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
combo.setLayoutData(gd);
+ tcom.setLayoutData(gd);
+
Object editValue = SmooksUIUtils.getEditValue(propertyDescriptor, model);
if (editValue != null) {
combo.setText(editValue.toString());
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-05-12
07:02:01 UTC (rev 15218)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-05-12
07:54:28 UTC (rev 15219)
@@ -152,17 +152,17 @@
displayName = itemPropertyDescriptor.getDisplayName(model);
EAttribute feature = (EAttribute) itemPropertyDescriptor.getFeature(model);
if (feature.isRequired()) {
- displayName = "*" + displayName;
+ displayName = displayName + "*";
}
}
Composite labelComposite = formToolKit.createComposite(parent);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginLeft = 0;
- layout.marginRight = 0;
- layout.horizontalSpacing = 0;
- labelComposite.setLayout(layout);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+// GridLayout layout = new GridLayout();
+// layout.numColumns = 2;
+// layout.marginLeft = 0;
+// layout.marginRight = 0;
+// layout.horizontalSpacing = 0;
+ labelComposite.setLayout(new FillLayout());
+// GridData gd = new GridData(GridData.FILL_HORIZONTAL);
Control labelControl = null;
if (!isLink) {
@@ -173,19 +173,19 @@
Hyperlink link = formToolKit.createHyperlink(labelComposite, displayName + "
:", SWT.NONE);
labelControl = link;
}
- gd = new GridData();
- labelControl.setLayoutData(gd);
+// gd = new GridData();
+// labelControl.setLayoutData(gd);
- FieldMarkerComposite notificationComposite = new FieldMarkerComposite(labelComposite,
SWT.NONE);
- gd = new GridData();
- gd.heightHint = 8;
- gd.widthHint = 8;
- gd.horizontalAlignment = GridData.BEGINNING;
- gd.verticalAlignment = GridData.BEGINNING;
- notificationComposite.setLayoutData(gd);
+// FieldMarkerComposite notificationComposite = new FieldMarkerComposite(labelComposite,
SWT.NONE);
+// gd = new GridData();
+// gd.heightHint = 8;
+// gd.widthHint = 8;
+// gd.horizontalAlignment = GridData.BEGINNING;
+// gd.verticalAlignment = GridData.BEGINNING;
+// notificationComposite.setLayoutData(gd);
wrapper.setLabelControl(labelControl);
- wrapper.setMarker(notificationComposite);
+// wrapper.setMarker(notificationComposite);
return wrapper;
}
@@ -429,12 +429,32 @@
if (multiText) {
textType = SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL;
}
- final Text valueText = toolkit.createText(textContainer, "", textType);
+ Composite tcom = toolkit.createComposite(textContainer);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginLeft = 0;
+ layout.marginRight = 0;
+ layout.horizontalSpacing = 0;
+ tcom.setLayout(layout);
+
+ FieldMarkerComposite notificationComposite = new FieldMarkerComposite(tcom, SWT.NONE);
+ gd = new GridData();
+ gd.heightHint = 8;
+ gd.widthHint = 8;
+ gd.horizontalAlignment = GridData.BEGINNING;
+ gd.verticalAlignment = GridData.BEGINNING;
+ notificationComposite.setLayoutData(gd);
+ fieldEditPart.setFieldMarker(notificationComposite);
+
+ final Text valueText = toolkit.createText(tcom, "", textType);
gd = new GridData(GridData.FILL_HORIZONTAL);
if (multiText && height > 0) {
gd.heightHint = height;
}
valueText.setLayoutData(gd);
+
+ tcom.setLayoutData(gd);
+
toolkit.paintBordersFor(textContainer);
if (openFile) {
Button fileBrowseButton = toolkit.createButton(textContainer, "Browse",
SWT.NONE);
@@ -619,8 +639,29 @@
fillLayout.marginHeight = 0;
fillLayout.marginWidth = 0;
classTextComposite.setLayout(fillLayout);
- final SearchComposite searchComposite = new SearchComposite(classTextComposite,
toolkit,
+
+ Composite tcom = toolkit.createComposite(classTextComposite);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginLeft = 0;
+ layout.marginRight = 0;
+ layout.horizontalSpacing = 0;
+ tcom.setLayout(layout);
+
+ FieldMarkerComposite notificationComposite = new FieldMarkerComposite(tcom,
SWT.NONE);
+ gd = new GridData();
+ gd.heightHint = 8;
+ gd.widthHint = 8;
+ gd.horizontalAlignment = GridData.BEGINNING;
+ gd.verticalAlignment = GridData.BEGINNING;
+ notificationComposite.setLayoutData(gd);
+ editpart.setFieldMarker(notificationComposite);
+
+
+ final SearchComposite searchComposite = new SearchComposite(tcom, toolkit,
"Search Class", dialog, SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ searchComposite.setLayoutData(gd);
Object editValue = getEditValue(propertyDescriptor, model);
if (editValue != null) {
searchComposite.getText().setText(editValue.toString());
@@ -845,7 +886,25 @@
if (readOnly) {
style = style | SWT.READ_ONLY;
}
- final Combo combo = new Combo(parent, style);
+
+ Composite tcom = formToolkit.createComposite(parent);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginLeft = 0;
+ layout.marginRight = 0;
+ layout.horizontalSpacing = 0;
+ tcom.setLayout(layout);
+
+ FieldMarkerComposite notificationComposite = new FieldMarkerComposite(tcom, SWT.NONE);
+ GridData gd = new GridData();
+ gd.heightHint = 8;
+ gd.widthHint = 8;
+ gd.horizontalAlignment = GridData.BEGINNING;
+ gd.verticalAlignment = GridData.BEGINNING;
+ notificationComposite.setLayoutData(gd);
+ fieldEditPart.setFieldMarker(notificationComposite);
+
+ final Combo combo = new Combo(tcom, style);
combo.add("");
if (items != null) {
for (int i = 0; i < items.length; i++) {
@@ -855,8 +914,10 @@
}
}
}
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ tcom.setLayoutData(gd);
combo.setLayoutData(gd);
+
if (currentSelect != -1) {
combo.select(currentSelect);
}
@@ -933,8 +994,29 @@
fillLayout.marginHeight = 0;
fillLayout.marginWidth = 0;
classTextComposite.setLayout(fillLayout);
- final SearchComposite searchComposite = new SearchComposite(classTextComposite,
toolkit, buttonName, dialog,
+
+ Composite tcom = toolkit.createComposite(classTextComposite);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginLeft = 0;
+ layout.marginRight = 0;
+ layout.horizontalSpacing = 0;
+ tcom.setLayout(layout);
+
+ FieldMarkerComposite notificationComposite = new FieldMarkerComposite(tcom, SWT.NONE);
+ gd = new GridData();
+ gd.heightHint = 8;
+ gd.widthHint = 8;
+ gd.horizontalAlignment = GridData.BEGINNING;
+ gd.verticalAlignment = GridData.BEGINNING;
+ notificationComposite.setLayoutData(gd);
+ editpart.setFieldMarker(notificationComposite);
+
+ final SearchComposite searchComposite = new SearchComposite(tcom, toolkit, buttonName,
dialog,
SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ searchComposite.setLayoutData(gd);
+
Object editValue = getEditValue(propertyDescriptor, model);
if (editValue != null) {
searchComposite.getText().setText(editValue.toString());
@@ -956,6 +1038,8 @@
}
}
});
+
+
toolkit.paintBordersFor(classTextComposite);
editpart.setContentControl(classTextComposite);
return editpart;