Author: DartPeng
Date: 2009-05-18 01:22:25 -0400 (Mon, 18 May 2009)
New Revision: 15319
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml
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/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/validate/ValidateResultLabelDecorator.java
Log:
JBIDE-4232
Mark problem image on treeitem when validating.
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml 2009-05-15 18:11:38 UTC (rev
15318)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml 2009-05-18 05:22:25 UTC (rev
15319)
@@ -60,9 +60,17 @@
Decorate smooks configuration page viewer
</description>
<enablement>
- <objectClass
-
name="org.jboss.tools.smooks.model.common.AbstractAnyType">
- </objectClass>
+ <or>
+ <objectClass
+
name="org.eclipse.emf.edit.provider.IWrapperItemProvider">
+ </objectClass>
+ <objectClass
+
name="org.jboss.tools.smooks.model.common.AbstractAnyType">
+ </objectClass>
+ <objectClass
+ name="org.eclipse.emf.ecore.util.FeatureMap$Entry">
+ </objectClass>
+ </or>
</enablement>
</decorator>
</extension>
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-15
18:11:38 UTC (rev 15318)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java 2009-05-18
05:22:25 UTC (rev 15319)
@@ -252,6 +252,10 @@
final Object cmodel = model;
combo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
+ if(combo.getText() == null || combo.getText().length() ==0){
+ ip.setPropertyValue(cmodel, null);
+ return;
+ }
Object editValue = SmooksUIUtils.getEditValue(ip, cmodel);
if (combo.getText().equals(editValue)) {
return;
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-05-15
18:11:38 UTC (rev 15318)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationFormPage.java 2009-05-18
05:22:25 UTC (rev 15319)
@@ -55,10 +55,10 @@
/**
* @author Dart Peng (dpeng(a)redhat.com) Date Apr 1, 2009
*/
-public class SmooksConfigurationFormPage extends FormPage implements
ISmooksModelValidateListener{
+public class SmooksConfigurationFormPage extends FormPage implements
ISmooksModelValidateListener {
private SmooksMasterDetailBlock masterDetailBlock = null;
-
+
private TableViewer inputDataViewer;
public SmooksConfigurationFormPage(FormEditor editor, String id, String title) {
@@ -78,10 +78,10 @@
EObject smooksModel = ((SmooksMultiFormEditor) getEditor()).getSmooksModel();
if (smooksModel != null) {
EObject parent = smooksModel;
- while(parent != null){
+ while (parent != null) {
EObject old = parent;
parent = parent.eContainer();
- if(parent == null){
+ if (parent == null) {
parent = old;
break;
}
@@ -106,8 +106,8 @@
}
protected void createMasterDetailBlock(IManagedForm managedForm) {
- masterDetailBlock = new SmooksMasterDetailBlock(getEditor(),
(AdapterFactoryEditingDomain) ((SmooksMultiFormEditor) getEditor())
- .getEditingDomain());
+ masterDetailBlock = new SmooksMasterDetailBlock(getEditor(),
+ (AdapterFactoryEditingDomain) ((SmooksMultiFormEditor)
getEditor()).getEditingDomain());
masterDetailBlock.createContent(managedForm);
}
@@ -215,7 +215,8 @@
wizard.setInput(getEditorInput());
wizard.setSite(getEditorSite());
wizard.setForcePreviousAndNextButtons(true);
- StructuredDataSelectionWizardDailog dialog = new
StructuredDataSelectionWizardDailog(getEditorSite().getShell(), wizard);
+ StructuredDataSelectionWizardDailog dialog = new StructuredDataSelectionWizardDailog(
+ getEditorSite().getShell(), wizard);
if (dialog.open() == WizardDialog.OK) {
IStructuredDataSelectionWizard wizard1 = dialog.getCurrentCreationWizard();
String type = wizard1.getInputDataTypeID();
@@ -287,10 +288,12 @@
}
public void validateEnd(List<Diagnostic> diagnosticResult) {
+ if (masterDetailBlock != null)
+ masterDetailBlock.refreshSmooksTreeViewer();
}
public void validateStart() {
-
+
}
}
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-05-15
18:11:38 UTC (rev 15318)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMasterDetailBlock.java 2009-05-18
05:22:25 UTC (rev 15319)
@@ -133,6 +133,10 @@
detailsPart.registerPage(EObject.class, new SmooksStuffPropertyDetailPage(
(SmooksMultiFormEditor) this.formEditor));
}
+
+ protected void refreshSmooksTreeViewer(){
+ smooksTreeViewer.refresh();
+ }
protected void createSmooksTreeViewer(FormToolkit tool, final IManagedForm managedForm,
Composite rootMainControl) {
@@ -159,6 +163,8 @@
smooksTreeViewer = new TreeViewer(tableComposite, SWT.NONE);
smooksTreeViewer.addSelectionChangedListener(this);
+
+
smooksTreeViewer.setContentProvider(new AdapterFactoryContentProvider(editingDomain
.getAdapterFactory()));
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/ValidateResultLabelDecorator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/ValidateResultLabelDecorator.java 2009-05-15
18:11:38 UTC (rev 15318)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/ValidateResultLabelDecorator.java 2009-05-18
05:22:25 UTC (rev 15319)
@@ -26,7 +26,9 @@
import org.eclipse.jface.viewers.ILightweightLabelDecorator;
import org.eclipse.jface.viewers.LabelDecorator;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.FileEditorInput;
import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
import org.jboss.tools.smooks.configuration.editors.GraphicsConstants;
@@ -106,7 +108,7 @@
protected int markErrorWarningPropertyUI(Diagnostic diagnostic, Object model) {
if (diagnostic == null || diagnostic.getSeverity() == Diagnostic.OK) {
- return Diagnostic.OK;
+ return -1;
}
List<?> data = diagnostic.getData();
for (Object object : data) {
@@ -128,36 +130,66 @@
return i;
}
}
-
return -1;
+ }
+ protected int markErrorWarningPropertyUI(List<Diagnostic> Listdiagnostic, Object
model) {
+ int type = -1;
+ for (Iterator<?> iterator = Listdiagnostic.iterator(); iterator.hasNext();) {
+ Diagnostic diagnostic = (Diagnostic) iterator.next();
+ type = markErrorWarningPropertyUI(diagnostic, model);
+ if (type == -1) {
+ continue;
+ }
+ if (type == Diagnostic.ERROR) {
+ return type;
+ }
+ }
+ return type;
}
- public void decorate(Object element, IDecoration decoration) {
+ public void decorate(Object element, IDecoration d) {
try {
element = AdapterFactoryEditingDomain.unwrap(element);
if (element instanceof AbstractAnyType) {
- IResource resource = SmooksUIUtils.getResource((EObject) element);
- IWorkbenchWindow window =
SmooksConfigurationActivator.getDefault().getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- return;
- }
- SmooksMultiFormEditor editor = (SmooksMultiFormEditor)
window.getActivePage().findEditor(
- new FileEditorInput((IFile) resource));
- int type = -1;
-// int type = markErrorWarningPropertyUI(editor.getDiagnosticList(), element);
- decoration.addOverlay(null, IDecoration.BOTTOM_RIGHT);
- if (type == Diagnostic.ERROR) {
- decoration.addOverlay(SmooksConfigurationActivator.getDefault().getImageRegistry().getDescriptor(
- GraphicsConstants.IMAGE_OVR_ERROR), IDecoration.BOTTOM_RIGHT);
- }
- if (type == Diagnostic.WARNING) {
- decoration.addOverlay(SmooksConfigurationActivator.getDefault().getImageRegistry().getDescriptor(
- GraphicsConstants.IMAGE_OVR_WARING), IDecoration.BOTTOM_RIGHT);
- }
+ final IResource resource = SmooksUIUtils.getResource((EObject) element);
+ final IDecoration decoration = d;
+ final Object fm = element;
+ Display.getDefault().syncExec(new Runnable() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (window == null) {
+ return;
+ }
+ SmooksMultiFormEditor editor = (SmooksMultiFormEditor)
window.getActivePage().findEditor(
+ new FileEditorInput((IFile) resource));
+ if (editor == null)
+ return;
+ int type = -1;
+ type = markErrorWarningPropertyUI(editor.getDiagnosticList(), fm);
+ if (type == -1)
+ return;
+ decoration.addOverlay(null, IDecoration.BOTTOM_RIGHT);
+ if (type == Diagnostic.ERROR) {
+ decoration.addOverlay(SmooksConfigurationActivator.getDefault().getImageRegistry()
+ .getDescriptor(GraphicsConstants.IMAGE_OVR_ERROR), IDecoration.BOTTOM_RIGHT);
+ }
+ if (type == Diagnostic.WARNING) {
+ decoration.addOverlay(SmooksConfigurationActivator.getDefault().getImageRegistry()
+ .getDescriptor(GraphicsConstants.IMAGE_OVR_WARING), IDecoration.BOTTOM_RIGHT);
+ }
+ }
+
+ });
}
} catch (Exception e) {
- // e.printStackTrace();
+ e.printStackTrace();
}
}