Author: DartPeng
Date: 2008-10-26 07:33:25 -0400 (Sun, 26 Oct 2008)
New Revision: 11185
Added:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/CompositeResolveCommand.java
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/ResolveCommand.java
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/Java2JavaResolveCommand.java
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/ProblemLabel.java
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/ResolveCommandPanel.java
Modified:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/DesignTimeAnalyzeResult.java
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/IMappingAnalyzer.java
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/java2xml/analyzer/Java2XMLAnalyzer.java
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2xml/XML2XMLAnalyzer.java
Log:
JBIDE-2867
Add Menu for the Error label , if user right-click error label , the menu will show the
user how to resolve the error.
Added:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/CompositeResolveCommand.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/CompositeResolveCommand.java
(rev 0)
+++
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/CompositeResolveCommand.java 2008-10-26
11:33:25 UTC (rev 11185)
@@ -0,0 +1,49 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.analyzer;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.tools.smooks.ui.modelparser.SmooksConfigurationFileGenerateContext;
+
+/**
+ * @author Dart
+ *
+ */
+public class CompositeResolveCommand extends ResolveCommand {
+
+ private List<ResolveCommand> commandList = new ArrayList<ResolveCommand>();
+
+ public CompositeResolveCommand(
+ SmooksConfigurationFileGenerateContext context) {
+ super(context);
+ }
+
+
+ public void addCommand(ResolveCommand command){
+ commandList.add(command);
+ }
+
+ public void removeCommand(ResolveCommand command){
+ commandList.remove(command);
+ }
+
+ public boolean isEmpty(){
+ if(commandList == null) return true;
+ return commandList.isEmpty();
+ }
+
+ @Override
+ public void execute() throws Exception {
+ if(commandList == null) return;
+ for (Iterator<ResolveCommand> iterator = commandList.iterator();
iterator.hasNext();) {
+ ResolveCommand command = (ResolveCommand) iterator.next();
+ command.execute();
+ }
+ }
+
+
+}
Property changes on:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/CompositeResolveCommand.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/DesignTimeAnalyzeResult.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/DesignTimeAnalyzeResult.java 2008-10-26
11:25:56 UTC (rev 11184)
+++
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/DesignTimeAnalyzeResult.java 2008-10-26
11:33:25 UTC (rev 11185)
@@ -3,13 +3,17 @@
*/
package org.jboss.tools.smooks.analyzer;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @author dart
*
*/
public class DesignTimeAnalyzeResult {
- public String errorMessage;
- public String warningMessage;
+ protected String errorMessage;
+ protected String warningMessage;
+ protected List<ResolveCommand> resolveCommandList = new
ArrayList<ResolveCommand>();
public String getErrorMessage() {
return errorMessage;
}
@@ -23,5 +27,17 @@
this.warningMessage = warningMessage;
}
+ public void addResolveCommand(ResolveCommand command){
+ this.resolveCommandList.add(command);
+ }
+ public void removeResolveCommand(ResolveCommand command){
+ this.resolveCommandList.remove(command);
+ }
+
+ public List<ResolveCommand> getResolveProblem(){
+ return resolveCommandList;
+ }
+
+
}
Modified:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/IMappingAnalyzer.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/IMappingAnalyzer.java 2008-10-26
11:25:56 UTC (rev 11184)
+++
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/IMappingAnalyzer.java 2008-10-26
11:33:25 UTC (rev 11185)
@@ -10,8 +10,6 @@
******************************************************************************/
package org.jboss.tools.smooks.analyzer;
-import java.util.List;
-
import org.jboss.tools.smooks.model.SmooksResourceListType;
import org.jboss.tools.smooks.ui.modelparser.SmooksConfigurationFileGenerateContext;
@@ -20,12 +18,31 @@
*
*/
public interface IMappingAnalyzer {
+ /**
+ * Parse the graphical model and generate the smooks config file model
+ * @param context
+ * @throws SmooksAnalyzerException
+ */
public void analyzeMappingGraphModel(
SmooksConfigurationFileGenerateContext context)
throws SmooksAnalyzerException;
+
+ /**
+ * Parse the smooks config file model what loaded by EMF , and create the relating
graphical model for it.
+ * @param listType
+ * @param sourceObject
+ * @param targetObject
+ * @return
+ */
public MappingResourceConfigList analyzeMappingSmooksModel(
SmooksResourceListType listType,Object sourceObject,Object targetObject);
+ /**
+ * Analyze the graphical model to find the incorrect logic model and return the analyze
result.<p>
+ * The graphical editor will display the analyze result.
+ * @param context
+ * @return
+ */
public DesignTimeAnalyzeResult[]
analyzeGraphModel(SmooksConfigurationFileGenerateContext context);
}
Added:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/ResolveCommand.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/ResolveCommand.java
(rev 0)
+++
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/ResolveCommand.java 2008-10-26
11:33:25 UTC (rev 11185)
@@ -0,0 +1,48 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.analyzer;
+
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.smooks.ui.modelparser.SmooksConfigurationFileGenerateContext;
+
+/**
+ * @author Dart
+ *
+ */
+public class ResolveCommand {
+ private SmooksConfigurationFileGenerateContext context;
+
+ private String resolveDescription ;
+
+ private Image image;
+
+ public void setResolveDescription(String resolveDescription) {
+ this.resolveDescription = resolveDescription;
+ }
+
+ public void setImage(Image image) {
+ this.image = image;
+ }
+
+ public ResolveCommand(SmooksConfigurationFileGenerateContext context){
+ this.context = context;
+ }
+
+ public SmooksConfigurationFileGenerateContext getContext() {
+ return context;
+ }
+
+ public void execute() throws Exception{
+
+ }
+
+ public Image getImage(){
+ return image;
+ }
+
+ public String getResolveDescription(){
+ return resolveDescription;
+ }
+
+}
Property changes on:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/analyzer/ResolveCommand.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/java2xml/analyzer/Java2XMLAnalyzer.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/java2xml/analyzer/Java2XMLAnalyzer.java 2008-10-26
11:25:56 UTC (rev 11184)
+++
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/java2xml/analyzer/Java2XMLAnalyzer.java 2008-10-26
11:33:25 UTC (rev 11185)
@@ -56,7 +56,6 @@
SmooksConfigurationFileGenerateContext context)
throws SmooksAnalyzerException {
// TODO will modify soon
-
if(true){
Shell shell = context.getShell();
MessageDialog.openWarning(shell, "Warning", "The java2xml can't be
generate to config file currently.");
Added:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/Java2JavaResolveCommand.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/Java2JavaResolveCommand.java
(rev 0)
+++
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/Java2JavaResolveCommand.java 2008-10-26
11:33:25 UTC (rev 11185)
@@ -0,0 +1,74 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.javabean.analyzer;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.tools.smooks.analyzer.ResolveCommand;
+import org.jboss.tools.smooks.ui.gef.model.AbstractStructuredDataModel;
+import org.jboss.tools.smooks.ui.gef.model.IConnectableModel;
+import org.jboss.tools.smooks.ui.gef.model.LineConnectionModel;
+import org.jboss.tools.smooks.ui.modelparser.SmooksConfigurationFileGenerateContext;
+
+/**
+ * @author Dart
+ *
+ */
+public class Java2JavaResolveCommand extends ResolveCommand {
+
+ private AbstractStructuredDataModel sourceModel;
+
+ private AbstractStructuredDataModel targetModel;
+
+ private List<LineConnectionModel> disconnectionModel = new
ArrayList<LineConnectionModel>();
+
+ public void addDisconnectionModel(LineConnectionModel line){
+ disconnectionModel.add(line);
+ }
+
+ public AbstractStructuredDataModel getSourceModel() {
+ return sourceModel;
+ }
+
+ public void setSourceModel(AbstractStructuredDataModel sourceModel) {
+ this.sourceModel = sourceModel;
+ }
+
+ public AbstractStructuredDataModel getTargetModel() {
+ return targetModel;
+ }
+
+ public void setTargetModel(AbstractStructuredDataModel targetModel) {
+ this.targetModel = targetModel;
+ }
+
+ public Java2JavaResolveCommand(
+ SmooksConfigurationFileGenerateContext context) {
+ super(context);
+ }
+
+ @Override
+ public void execute() throws Exception {
+ SmooksConfigurationFileGenerateContext context = getContext();
+ if(context == null) throw new RuntimeException("Smooks generated context is
NULL");
+ if(sourceModel != null && targetModel != null){
+ LineConnectionModel connectionModel = new LineConnectionModel();
+ connectionModel
+ .setSource((IConnectableModel) sourceModel);
+ connectionModel
+ .setTarget((IConnectableModel) targetModel);
+ connectionModel.connect();
+ return;
+ }
+ if(!disconnectionModel.isEmpty()){
+ for (Iterator<LineConnectionModel> iterator = disconnectionModel.iterator();
iterator.hasNext();) {
+ LineConnectionModel connection = (LineConnectionModel) iterator.next();
+ connection.disConnect();
+ }
+ return;
+ }
+ }
+}
Property changes on:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/Java2JavaResolveCommand.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java 2008-10-26
11:25:56 UTC (rev 11184)
+++
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/javabean/analyzer/JavaBeanAnalyzer.java 2008-10-26
11:33:25 UTC (rev 11185)
@@ -33,6 +33,7 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
+import org.jboss.tools.smooks.analyzer.CompositeResolveCommand;
import org.jboss.tools.smooks.analyzer.DesignTimeAnalyzeResult;
import org.jboss.tools.smooks.analyzer.IMappingAnalyzer;
import org.jboss.tools.smooks.analyzer.ISourceModelAnalyzer;
@@ -391,13 +392,13 @@
if (((IConnectableModel) pgm)
.getModelTargetConnections().isEmpty()) {
String errorMessage = "The parent of Java node \""
- + javaModel.getName()
- + "\" : \""
- + parent.getName()
- + "\" doesn't be connected by any source node";
+ + javaModel.getName()
+ + "\" : \""
+ + parent.getName()
+ + "\" doesn't be connected by any source node";
DesignTimeAnalyzeResult dr = new DesignTimeAnalyzeResult();
dr.setErrorMessage(errorMessage);
-
+ createResolveCommand(dr, context, javaModel, parent);
arList.add(dr);
}
}
@@ -407,6 +408,63 @@
return arList.toArray(new DesignTimeAnalyzeResult[0]);
}
+ private void createResolveCommand(DesignTimeAnalyzeResult result,
+ SmooksConfigurationFileGenerateContext context,
+ JavaBeanModel currentNode, JavaBeanModel parentNode) {
+ GraphRootModel root = context.getGraphicalRootModel();
+ HashMap<AbstractStructuredDataModel, AbstractStructuredDataModel> tempMap = new
HashMap<AbstractStructuredDataModel, AbstractStructuredDataModel>();
+ // Disconnect all connections command
+ Java2JavaResolveCommand disconnectCommand = new Java2JavaResolveCommand(
+ context);
+ CompositeResolveCommand compositeCommand = new CompositeResolveCommand(
+ context);
+ compositeCommand.setResolveDescription("Connect all needed connections");
+ disconnectCommand
+ .setResolveDescription("Disconnect all connections of the current \""
+ + currentNode.getName() + "\"node");
+ AbstractStructuredDataModel targetNode = UIUtils.findGraphModel(root,
+ currentNode);
+ if (targetNode instanceof IConnectableModel) {
+ List<Object> connections = ((IConnectableModel) targetNode)
+ .getModelTargetConnections();
+ for (Iterator iterator = connections.iterator(); iterator.hasNext();) {
+ LineConnectionModel line = (LineConnectionModel) iterator
+ .next();
+ AbstractStructuredDataModel source = (AbstractStructuredDataModel) line
+ .getSource();
+ JavaBeanModel sourceBean = (JavaBeanModel) source
+ .getReferenceEntityModel();
+ JavaBeanModel sourceParent = sourceBean.getParent();
+ if (sourceParent == null) {
+ sourceParent = sourceBean;
+ }
+ AbstractStructuredDataModel sourceParentNode = UIUtils
+ .findGraphModel(root, sourceParent);
+ // Connect the parent command
+ AbstractStructuredDataModel targetParentNode = UIUtils
+ .findGraphModel(root, parentNode);
+ if (tempMap.get(sourceParentNode) == null) {
+ Java2JavaResolveCommand connectParent = new Java2JavaResolveCommand(
+ context);
+ connectParent.setResolveDescription("Connect the \""
+ + sourceParent.getName() + "\" to the \""
+ + parentNode.getName() + "\"");
+ connectParent.setSourceModel(sourceParentNode);
+ connectParent.setTargetModel(targetParentNode);
+ result.addResolveCommand(connectParent);
+ tempMap.put(sourceParentNode,targetParentNode);
+ compositeCommand.addCommand(connectParent);
+ }
+
+ disconnectCommand.addDisconnectionModel(line);
+ }
+ }
+ result.addResolveCommand(disconnectCommand);
+ if (!compositeCommand.isEmpty()) {
+ result.addResolveCommand(compositeCommand);
+ }
+ }
+
/**
* If root node don't connect , it will ask user to connect them .
*
Added:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/ProblemLabel.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/ProblemLabel.java
(rev 0)
+++
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/ProblemLabel.java 2008-10-26
11:33:25 UTC (rev 11185)
@@ -0,0 +1,19 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.ui.editors;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * @author Dart
+ * @date 2008.10.24
+ */
+public class ProblemLabel extends Label {
+
+ public ProblemLabel(Composite parent, int style) {
+ super(parent, style);
+ }
+
+}
Property changes on:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/ProblemLabel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/ResolveCommandPanel.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/ResolveCommandPanel.java
(rev 0)
+++
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/ResolveCommandPanel.java 2008-10-26
11:33:25 UTC (rev 11185)
@@ -0,0 +1,140 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.ui.editors;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseTrackListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.events.IHyperlinkListener;
+import org.eclipse.ui.forms.widgets.ImageHyperlink;
+import org.jboss.tools.smooks.analyzer.ResolveCommand;
+import org.jboss.tools.smooks.ui.SmooksUIActivator;
+import org.jboss.tools.smooks.ui.gef.util.GraphicsConstants;
+import org.jboss.tools.smooks.utils.SmooksGraphConstants;
+import org.jboss.tools.smooks.utils.UIUtils;
+
+/**
+ * @author Dart
+ *
+ */
+public class ResolveCommandPanel extends Composite {
+
+ private static List<Shell> shellList = new ArrayList<Shell>();
+
+ public ResolveCommandPanel(Composite parent, int style) {
+ super(parent, style);
+ // TODO Auto-generated constructor stub
+ }
+
+ public static void open(List<ResolveCommand> list, Shell shell,
+ Point location) {
+ try {
+ closeAll();
+ if (shell == null)
+ return;
+ final Shell newShell = new Shell(shell, SWT.NONE);
+ FillLayout fill = new FillLayout();
+ fill.marginHeight = 0;
+ fill.marginWidth = 0;
+ newShell.setLayout(fill);
+ final ResolveCommandPanel panel = new ResolveCommandPanel(newShell,
+ SWT.NONE);
+ panel.setBackground(ColorConstants.cyan);
+ newShell.addFocusListener(new FocusListener(){
+
+ public void focusGained(FocusEvent arg0) {
+ System.out.println("Gained");
+ }
+
+ public void focusLost(FocusEvent arg0) {
+ if (!newShell.isDisposed()) {
+ newShell.close();
+ }
+ }
+ });
+
+ panel.setBackground(ColorConstants.black);
+ FillLayout layout = new FillLayout();
+ layout.marginHeight = 1;
+ layout.marginWidth = 1;
+ panel.setLayout(layout);
+
+ Composite com = new Composite(panel, SWT.NONE);
+ GridLayout glayout = new GridLayout();
+ com.setLayout(glayout);
+ if (list != null) {
+ for (Iterator iterator = list.iterator(); iterator.hasNext();) {
+ final ResolveCommand resolveCommand = (ResolveCommand) iterator
+ .next();
+ ImageHyperlink link = new ImageHyperlink(com, SWT.NONE);
+ link.addHyperlinkListener(new IHyperlinkListener() {
+
+ public void linkActivated(HyperlinkEvent arg0) {
+ try {
+ newShell.close();
+ resolveCommand.execute();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void linkEntered(HyperlinkEvent arg0) {
+
+ }
+
+ public void linkExited(HyperlinkEvent arg0) {
+
+ }
+
+ });
+ String text = resolveCommand.getResolveDescription();
+ if (text == null)
+ text = "<NULL>";
+ link.setText(text);
+ Image image = resolveCommand.getImage();
+ if (image == null) {
+ image = SmooksUIActivator.getDefault()
+ .getImageRegistry().get(
+ SmooksGraphConstants.IMAGE_EMPTY);
+ }
+ link.setImage(image);
+ }
+ }
+ newShell.setLocation(location);
+ newShell.setSize(new Point(400, 100));
+ shellList.add(newShell);
+
+ newShell.open();
+ newShell.setVisible(false);
+// newShell.setVisible(true);
+ } catch (Throwable e) {
+ UIUtils.showErrorDialog(shell, UIUtils.createErrorStatus(e));
+ }
+ }
+
+ public static void closeAll(){
+ for (Iterator iterator = shellList.iterator(); iterator.hasNext();) {
+ Shell shell = (Shell) iterator.next();
+ if(!shell.isDisposed()) shell.close();
+ }
+
+ shellList.clear();
+ }
+
+}
Property changes on:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/ResolveCommandPanel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-10-26
11:25:56 UTC (rev 11184)
+++
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/ui/editors/SmooksGraphicalFormPage.java 2008-10-26
11:33:25 UTC (rev 11185)
@@ -62,15 +62,19 @@
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DragSourceAdapter;
import org.eclipse.swt.dnd.DragSourceEvent;
import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.events.TreeEvent;
import org.eclipse.swt.events.TreeListener;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -80,6 +84,9 @@
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.IEditorInput;
@@ -94,7 +101,6 @@
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.ImageHyperlink;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import org.jboss.tools.smooks.analyzer.AnalyzerFactory;
@@ -104,6 +110,7 @@
import org.jboss.tools.smooks.analyzer.ITargetModelAnalyzer;
import org.jboss.tools.smooks.analyzer.MappingModel;
import org.jboss.tools.smooks.analyzer.MappingResourceConfigList;
+import org.jboss.tools.smooks.analyzer.ResolveCommand;
import org.jboss.tools.smooks.analyzer.ResourceConfigEraser;
import org.jboss.tools.smooks.analyzer.SmooksAnalyzerException;
import org.jboss.tools.smooks.analyzer.SmooksFileBuilder;
@@ -116,11 +123,11 @@
import org.jboss.tools.smooks.model.SmooksFactory;
import org.jboss.tools.smooks.model.SmooksResourceListType;
import org.jboss.tools.smooks.model.util.SmooksModelConstants;
+import org.jboss.tools.smooks.model.util.SmooksModelUtils;
import org.jboss.tools.smooks.ui.IStructuredDataCreationWizard;
import org.jboss.tools.smooks.ui.IViewerInitor;
import org.jboss.tools.smooks.ui.SmooksUIActivator;
import org.jboss.tools.smooks.ui.StructuredDataCreationWizardDailog;
-import org.jboss.tools.smooks.ui.ViewerInitorStore;
import org.jboss.tools.smooks.ui.gef.editparts.SmooksEditPartFactory;
import org.jboss.tools.smooks.ui.gef.model.AbstractStructuredDataModel;
import org.jboss.tools.smooks.ui.gef.model.GraphRootModel;
@@ -286,7 +293,7 @@
sashForm.setLayoutData(sashFormLd);
sashForm.setSashWidth(1);
-
+
designTimeAnalyzeResultRegion = toolkit.createComposite(sashForm);
GridLayout ngl = new GridLayout();
ngl.numColumns = 2;
@@ -1268,7 +1275,8 @@
DesignTimeAnalyzeResult result = (DesignTimeAnalyzeResult) iterator
.next();
if (result.getErrorMessage() != null) {
- if(canSaveFile) canSaveFile = false;
+ if (canSaveFile)
+ canSaveFile = false;
Label imageLabel = new Label(designTimeAnalyzeResultRegion,
SWT.NONE);
GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
@@ -1278,10 +1286,39 @@
SmooksGraphConstants.IMAGE_ERROR));
Label notifyLabel = new Label(designTimeAnalyzeResultRegion,
SWT.NONE);
+ Menu menu = new Menu(getSite().getShell(), SWT.POP_UP);
+ List<ResolveCommand> list = result.getResolveProblem();
+ for (Iterator iterator2 = list.iterator(); iterator2.hasNext();) {
+ final ResolveCommand resolveCommand = (ResolveCommand) iterator2
+ .next();
+ MenuItem item = new MenuItem(menu, SWT.NONE);
+ item.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent arg0) {
+ widgetSelected(arg0);
+ }
+
+ public void widgetSelected(SelectionEvent arg0) {
+ try {
+ resolveCommand.execute();
+ commandStackChanged = true;
+ analyzeDesignGraph();
+ firePropertyChange(PROP_DIRTY);
+ } catch (Exception e) {
+ UIUtils.showErrorDialog(getSite().getShell(),
+ UIUtils.createErrorStatus(e));
+ }
+ }
+
+ });
+ item.setText(resolveCommand.getResolveDescription());
+ item.setImage(resolveCommand.getImage());
+ }
+ notifyLabel.setMenu(menu);
GridData nlgd = new GridData(GridData.FILL_HORIZONTAL);
notifyLabel.setLayoutData(nlgd);
notifyLabel.setText(result.getErrorMessage());
-
+
}
}
}
@@ -1305,8 +1342,7 @@
}
updateNotifyMessage();
} catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ UIUtils.showErrorDialog(getSite().getShell(), UIUtils.createErrorStatus(e));
}
}
Modified:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java 2008-10-26
11:25:56 UTC (rev 11184)
+++
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2java/analyzer/XML2JavaAnalyzer.java 2008-10-26
11:33:25 UTC (rev 11185)
@@ -58,7 +58,6 @@
public void analyzeMappingGraphModel(
SmooksConfigurationFileGenerateContext context)
throws SmooksAnalyzerException {
-
SmooksResourceListType listType = context.getSmooksResourceListModel();
GraphRootModel rootModel = context.getGraphicalRootModel();
List children = rootModel.getChildren();
Modified:
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2xml/XML2XMLAnalyzer.java
===================================================================
---
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2xml/XML2XMLAnalyzer.java 2008-10-26
11:25:56 UTC (rev 11184)
+++
branches/jbosstools-3.0.0.Beta1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/xml2xml/XML2XMLAnalyzer.java 2008-10-26
11:33:25 UTC (rev 11185)
@@ -21,24 +21,28 @@
/*
* (non-Javadoc)
*
- * @see
org.jboss.tools.smooks.analyzer.IMappingAnalyzer#analyzeMappingGraphModel(org.jboss.tools.smooks.ui.modelparser.SmooksConfigurationFileGenerateContext)
+ * @see
+ * org.jboss.tools.smooks.analyzer.IMappingAnalyzer#analyzeMappingGraphModel
+ * (
+ * org.jboss.tools.smooks.ui.modelparser.SmooksConfigurationFileGenerateContext
+ * )
*/
public void analyzeMappingGraphModel(
SmooksConfigurationFileGenerateContext context)
throws SmooksAnalyzerException {
- if (true) {
- Shell shell = context.getShell();
- MessageDialog.openWarning(shell, "Warning",
- "The xml2xml can't be generate to config file currently.");
- return;
- }
+ Shell shell = context.getShell();
+ MessageDialog.openWarning(shell, "Warning",
+ "The xml2xml can't be generate to config file currently.");
+ return;
}
/*
* (non-Javadoc)
*
- * @see
org.jboss.tools.smooks.analyzer.IMappingAnalyzer#analyzeMappingSmooksModel(org.jboss.tools.smooks.model.SmooksResourceListType,
- * java.lang.Object, java.lang.Object)
+ * @see
+ * org.jboss.tools.smooks.analyzer.IMappingAnalyzer#analyzeMappingSmooksModel
+ * (org.jboss.tools.smooks.model.SmooksResourceListType, java.lang.Object,
+ * java.lang.Object)
*/
public MappingResourceConfigList analyzeMappingSmooksModel(
SmooksResourceListType listType, Object sourceObject,