Author: DartPeng
Date: 2009-11-28 15:46:14 -0500 (Sat, 28 Nov 2009)
New Revision: 18908
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/BeanIdRefValidator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/editparts/TreeContainerEditPart.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/editparts/TreeNodeEditPart.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/figures/TreeContainerFigure.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksJavaMappingGraphicalEditor.java
Log:
JBIDE-5298
Done. when refresh the figure, to get the root layer to refresh too.
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/BeanIdRefValidator.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/BeanIdRefValidator.java 2009-11-28
19:45:06 UTC (rev 18907)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/BeanIdRefValidator.java 2009-11-28
20:46:14 UTC (rev 18908)
@@ -78,7 +78,7 @@
if (idRef != null) {
if (!idList.contains(idRef) && beanIDRefFeature != null &&
beanIDRefFeature instanceof EAttribute) {
- return newWaringDiagnostic("Reference BeanId '" + idRef + "'
dosen't exist.", model,
+ return newWaringDiagnostic("The Java Bean '" + idRef + "'
dosen't exist.", model,
(EAttribute) beanIDRefFeature);
}
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/editparts/TreeContainerEditPart.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/editparts/TreeContainerEditPart.java 2009-11-28
19:45:06 UTC (rev 18907)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/editparts/TreeContainerEditPart.java 2009-11-28
20:46:14 UTC (rev 18908)
@@ -65,7 +65,7 @@
int serverity = model.getSeverity();
String message = getSeverityMessage(model);
if (serverity == IValidatableModel.NONE) {
- i = model.getImage();
+ i = model.getImage();
}
if (serverity == IValidatableModel.ERROR) {
i =
SmooksConfigurationActivator.getDefault().getImageRegistry().get(GraphicsConstants.IMAGE_ERROR);
@@ -96,6 +96,8 @@
try {
((GraphicalEditPart) this.getParent()).setLayoutConstraint(this, this.getFigure(), new
Rectangle(location,
size));
+ IFigure figure = getFigure().getParent();
+ figure.repaint();
} catch (Exception e) {
e.printStackTrace();
}
@@ -131,8 +133,8 @@
ISmooksModelProvider modelProvider = (ISmooksModelProvider)
editor.getAdapter(ISmooksModelProvider.class);
if (modelProvider != null && getModel() instanceof IMoveableModel) {
- Rectangle rect = ((IMoveableModel) getModel()).getBounds();
-// recordBounds(graph, rect);
+ // Rectangle rect = ((IMoveableModel) getModel()).getBounds();
+ // recordBounds(graph, rect);
}
}
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/editparts/TreeNodeEditPart.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/editparts/TreeNodeEditPart.java 2009-11-28
19:45:06 UTC (rev 18907)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/editparts/TreeNodeEditPart.java 2009-11-28
20:46:14 UTC (rev 18908)
@@ -10,6 +10,7 @@
import java.util.List;
import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.FreeformLayer;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.gef.ConnectionEditPart;
@@ -184,34 +185,45 @@
}
protected void refreshVisuals() {
- TreeNodeModel node = (TreeNodeModel) getModel();
- String text = node.getText();
- if (text != null) {
- ((TreeNodeFigure) getFigure()).setLabelText(text);
- }
- Label tooltip = null;
- int serverity = node.getSeverity();
- String message = getSeverityMessage(node);
- Image image = node.getImage();
- if (serverity == IValidatableModel.NONE) {
- image = node.getImage();
+ try {
+ TreeNodeModel node = (TreeNodeModel) getModel();
+ String text = node.getText();
+ if (text != null) {
+ ((TreeNodeFigure) getFigure()).setLabelText(text);
+ }
+ Label tooltip = null;
+ int serverity = node.getSeverity();
+ String message = getSeverityMessage(node);
+ Image image = node.getImage();
+ if (serverity == IValidatableModel.NONE) {
+ image = node.getImage();
+ }
+ if (serverity == IValidatableModel.ERROR) {
+ image =
SmooksConfigurationActivator.getDefault().getImageRegistry().get(GraphicsConstants.IMAGE_ERROR);
+ tooltip = errorLabel;
+ tooltip.setText(message);
+ }
+ if (serverity == IValidatableModel.WARNING) {
+ image = SmooksConfigurationActivator.getDefault().getImageRegistry().get(
+ GraphicsConstants.IMAGE_WARNING);
+ tooltip = warningLabel;
+ tooltip.setText(message);
+ }
+ if (image != null) {
+ ((TreeNodeFigure) getFigure()).setLabelImage(image);
+ }
+ ((TreeNodeFigure) getFigure()).setToolTip(tooltip);
+ IFigure parent = getFigure();
+ while (parent != null && !(parent instanceof FreeformLayer)) {
+ parent = parent.getParent();
+ }
+ if (parent != null) {
+ parent.repaint();
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
}
- if (serverity == IValidatableModel.ERROR) {
- image =
SmooksConfigurationActivator.getDefault().getImageRegistry().get(GraphicsConstants.IMAGE_ERROR);
- tooltip = errorLabel;
- tooltip.setText(message);
- }
- if (serverity == IValidatableModel.WARNING) {
- image =
SmooksConfigurationActivator.getDefault().getImageRegistry().get(GraphicsConstants.IMAGE_WARNING);
- tooltip = warningLabel;
- tooltip.setText(message);
- }
- if (image != null) {
- ((TreeNodeFigure) getFigure()).setLabelImage(image);
- }
- ((TreeNodeFigure) getFigure()).setToolTip(tooltip);
- super.refreshVisuals();
// Dimension size = getFigure().getPreferredSize(-1, -1);
// Rectangle rect = getFigure().getBounds();
@@ -298,45 +310,49 @@
}
}
-// protected void recordBounds(SmooksGraphicsExtType graphicsExt, Rectangle bounds) {
-// GraphType graph = graphicsExt.getGraph();
-// if (graph == null) {
-// graph = GraphFactory.eINSTANCE.createGraphType();
-// graphicsExt.setGraph(graph);
-// }
-// String figureId = generateFigureID();
-// if (figureId == null)
-// return;
-// FigureType figure = SmooksGraphUtil.findFigureType(graph, figureId);
-//
-// if (figure == null) {
-// figure = GraphFactory.eINSTANCE.createFigureType();
-// figure.setId(figureId);
-// graph.getFigure().add(figure);
-// }
-// recordFigureBounds(figure, bounds);
-// }
-//
-// protected void recordFigureBounds(FigureType figureType, Rectangle bounds) {
-// figureType.setX(String.valueOf(bounds.getLocation().x));
-// figureType.setY(String.valueOf(bounds.getLocation().y));
-//
-// figureType.setHeight(String.valueOf(bounds.getSize().height));
-// figureType.setWidth(String.valueOf(bounds.getSize().width));
-//
-// EObject ext = figureType;
-// while (ext != null && !(ext instanceof SmooksGraphicsExtType)) {
-// ext = ext.eContainer();
-// }
-//
-// if (ext != null && ext instanceof SmooksGraphicsExtType) {
-// List<ISmooksGraphChangeListener> listeners = ((SmooksGraphicsExtType)
ext).getChangeListeners();
-// for (Iterator<?> iterator = listeners.iterator(); iterator.hasNext();) {
-// ISmooksGraphChangeListener smooksGraphChangeListener = (ISmooksGraphChangeListener)
iterator.next();
-// smooksGraphChangeListener.graphChanged((SmooksGraphicsExtType) ext);
-// }
-// }
-// }
+ // protected void recordBounds(SmooksGraphicsExtType graphicsExt, Rectangle
+ // bounds) {
+ // GraphType graph = graphicsExt.getGraph();
+ // if (graph == null) {
+ // graph = GraphFactory.eINSTANCE.createGraphType();
+ // graphicsExt.setGraph(graph);
+ // }
+ // String figureId = generateFigureID();
+ // if (figureId == null)
+ // return;
+ // FigureType figure = SmooksGraphUtil.findFigureType(graph, figureId);
+ //
+ // if (figure == null) {
+ // figure = GraphFactory.eINSTANCE.createFigureType();
+ // figure.setId(figureId);
+ // graph.getFigure().add(figure);
+ // }
+ // recordFigureBounds(figure, bounds);
+ // }
+ //
+ // protected void recordFigureBounds(FigureType figureType, Rectangle
+ // bounds) {
+ // figureType.setX(String.valueOf(bounds.getLocation().x));
+ // figureType.setY(String.valueOf(bounds.getLocation().y));
+ //
+ // figureType.setHeight(String.valueOf(bounds.getSize().height));
+ // figureType.setWidth(String.valueOf(bounds.getSize().width));
+ //
+ // EObject ext = figureType;
+ // while (ext != null && !(ext instanceof SmooksGraphicsExtType)) {
+ // ext = ext.eContainer();
+ // }
+ //
+ // if (ext != null && ext instanceof SmooksGraphicsExtType) {
+ // List<ISmooksGraphChangeListener> listeners = ((SmooksGraphicsExtType)
+ // ext).getChangeListeners();
+ // for (Iterator<?> iterator = listeners.iterator(); iterator.hasNext();) {
+ // ISmooksGraphChangeListener smooksGraphChangeListener =
+ // (ISmooksGraphChangeListener) iterator.next();
+ // smooksGraphChangeListener.graphChanged((SmooksGraphicsExtType) ext);
+ // }
+ // }
+ // }
protected String generateFigureID() {
return null;
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/figures/TreeContainerFigure.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/figures/TreeContainerFigure.java 2009-11-28
19:45:06 UTC (rev 18907)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/gef/tree/figures/TreeContainerFigure.java 2009-11-28
20:46:14 UTC (rev 18908)
@@ -444,6 +444,7 @@
*/
public void setContentFigure(IFigure contentFigure) {
this.contentFigure = contentFigure;
+// this.repaint(0,0,0,0);
repaint();
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java 2009-11-28
19:45:06 UTC (rev 18907)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java 2009-11-28
20:46:14 UTC (rev 18908)
@@ -1351,10 +1351,14 @@
}
}
+
+ protected String getDiagnosticMessage(Diagnostic diagnostic){
+ return diagnostic.getMessage();
+ }
protected void refreshValidateResult(Diagnostic diagnostic) {
int severity = diagnostic.getSeverity();
- String message = diagnostic.getMessage();
+ String message = getDiagnosticMessage(diagnostic);
if (severity == Diagnostic.ERROR || severity == Diagnostic.WARNING) {
List<?> datas = diagnostic.getData();
AbstractSmooksGraphicalModel obj = null;
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksJavaMappingGraphicalEditor.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksJavaMappingGraphicalEditor.java 2009-11-28
19:45:06 UTC (rev 18907)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksJavaMappingGraphicalEditor.java 2009-11-28
20:46:14 UTC (rev 18908)
@@ -12,6 +12,7 @@
import java.util.List;
+import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
import org.eclipse.gef.palette.PaletteRoot;
@@ -27,9 +28,11 @@
import
org.jboss.tools.smooks.graphical.editors.model.javamapping.JavaMappingActionCreator;
import org.jboss.tools.smooks.model.javabean.BindingsType;
import org.jboss.tools.smooks.model.javabean.ExpressionType;
+import org.jboss.tools.smooks.model.javabean.JavabeanPackage;
import org.jboss.tools.smooks.model.javabean.ValueType;
import org.jboss.tools.smooks.model.javabean.WiringType;
import org.jboss.tools.smooks.model.javabean12.BeanType;
+import org.jboss.tools.smooks.model.javabean12.Javabean12Package;
/**
* @author Dart
@@ -48,6 +51,56 @@
* (non-Javadoc)
*
* @seeorg.jboss.tools.smooks.graphical.editors.SmooksGraphicalEditorPart#
+ * getDiagnosticMessage(org.eclipse.emf.common.util.Diagnostic)
+ */
+ @Override
+ protected String getDiagnosticMessage(Diagnostic diagnostic) {
+ List<?> datas = diagnostic.getData();
+ if (datas.size() == 2) {
+ Object parentObj = datas.get(0);
+
+ if (parentObj instanceof BeanType || parentObj instanceof BindingsType) {
+ Object obj = datas.get(1);
+ if (obj == JavabeanPackage.Literals.BINDINGS_TYPE__BEAN_ID
+ || obj == Javabean12Package.Literals.BEAN_TYPE__BEAN_ID) {
+ String message = diagnostic.getMessage();
+ if (message != null && message.startsWith("The required feature"))
{
+ return "The Bean ID shouldn't be empty";
+ }
+ }
+ }
+
+ if (parentObj instanceof ValueType
+ || parentObj instanceof org.jboss.tools.smooks.model.javabean12.ValueType) {
+ Object obj = datas.get(1);
+ if (obj == JavabeanPackage.Literals.VALUE_TYPE__DATA
+ || obj == Javabean12Package.Literals.VALUE_TYPE__DATA) {
+ String message = diagnostic.getMessage();
+ if (message != null && message.startsWith("The required feature"))
{
+ return "The node must be linked with input source";
+ }
+ }
+ }
+
+ if (parentObj instanceof WiringType
+ || parentObj instanceof org.jboss.tools.smooks.model.javabean12.WiringType) {
+ Object obj = datas.get(1);
+ if (obj == JavabeanPackage.Literals.WIRING_TYPE__BEAN_ID_REF
+ || obj == Javabean12Package.Literals.WIRING_TYPE__BEAN_ID_REF) {
+ String message = diagnostic.getMessage();
+ if (message != null && message.startsWith("The required feature"))
{
+ return "The node must link to another Java Bean";
+ }
+ }
+ }
+ }
+ return super.getDiagnosticMessage(diagnostic);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.graphical.editors.SmooksGraphicalEditorPart#
* getPaletteRoot()
*/
// @Override