diff options
author | Mickael Istria | 2011-11-24 15:06:22 +0000 |
---|---|---|
committer | Mickael Istria | 2011-11-24 15:06:22 +0000 |
commit | ecc1a505ff0ea2d38cf26f845f694d57dad4abc3 (patch) | |
tree | ac28630e7e6f4e8583ceca5bd6d7b931847dfede | |
parent | 6db3f73fecc38f93a058ca677c917030a48b84a3 (diff) | |
download | org.eclipse.gmf-tooling-GMFGraphRendererFigure-363449.tar.gz org.eclipse.gmf-tooling-GMFGraphRendererFigure-363449.tar.xz org.eclipse.gmf-tooling-GMFGraphRendererFigure-363449.zip |
* Fix a build.properties
* Minor improvements
3 files changed, 42 insertions, 13 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.edit/build.properties b/plugins/org.eclipse.gmf.graphdef.edit/build.properties index 28fbdd667..cf0cbf226 100644 --- a/plugins/org.eclipse.gmf.graphdef.edit/build.properties +++ b/plugins/org.eclipse.gmf.graphdef.edit/build.properties @@ -16,5 +16,6 @@ bin.includes = .,\ about.html,\ messages.properties jars.compile.order = . -source.. = src/ +source.. = src/,\ + src-extras/ output.. = bin/ diff --git a/plugins/org.eclipse.gmf.graphdef.edit/src-extras/org/eclipse/gmf/graphdef/edit/PreviewRenderedFigureOutlinePage.java b/plugins/org.eclipse.gmf.graphdef.edit/src-extras/org/eclipse/gmf/graphdef/edit/PreviewRenderedFigureOutlinePage.java index 7f730b649..fc5ab83db 100644 --- a/plugins/org.eclipse.gmf.graphdef.edit/src-extras/org/eclipse/gmf/graphdef/edit/PreviewRenderedFigureOutlinePage.java +++ b/plugins/org.eclipse.gmf.graphdef.edit/src-extras/org/eclipse/gmf/graphdef/edit/PreviewRenderedFigureOutlinePage.java @@ -37,6 +37,7 @@ class PreviewRenderedFigureOutlinePage extends Page implements IContentOutlinePa private RectangleFigure background; private Control control; + private ISelection selection; @Override public void createControl(Composite parent) { @@ -77,21 +78,22 @@ class PreviewRenderedFigureOutlinePage extends Page implements IContentOutlinePa getControl().setFocus(); } - @Override public void addSelectionChangedListener(ISelectionChangedListener listener) { } - @Override public ISelection getSelection() { - return new StructuredSelection(); + if (selection != null) { + return new StructuredSelection(); + } else { + return selection; + } } - @Override public void removeSelectionChangedListener(ISelectionChangedListener listener) { } - @Override public void setSelection(ISelection selection) { + this.selection = selection; handleSelectionChanged(selection); } @@ -115,12 +117,20 @@ class PreviewRenderedFigureOutlinePage extends Page implements IContentOutlinePa if (modelFigure != null) { GMFGraphRenderedFigure draw2figure = new GMFGraphRenderedFigure(modelFigure); - background.add(draw2figure, new GridData(SWT.FILL, SWT.FILL, false, false)); + try { + draw2figure.validate(); + background.add(draw2figure, new GridData(SWT.FILL, SWT.FILL, false, false)); + } catch (Exception ex) { + org.eclipse.draw2d.Label exceptionLabel = new org.eclipse.draw2d.Label(); + exceptionLabel.setForegroundColor(ColorConstants.black); + exceptionLabel.setText(ex.getLocalizedMessage()); + background.add(exceptionLabel, new GridData(SWT.FILL, SWT.FILL, true, true)); + } + } } } - @Override public void selectionChanged(SelectionChangedEvent event) { handleSelectionChanged(event.getSelection()); } diff --git a/plugins/org.eclipse.gmf.graphdef.runtime/src/org/eclipse/gmf/runtime/graphdef/GMFGraphRenderedFigure.java b/plugins/org.eclipse.gmf.graphdef.runtime/src/org/eclipse/gmf/runtime/graphdef/GMFGraphRenderedFigure.java index 478142d05..da9c025ec 100644 --- a/plugins/org.eclipse.gmf.graphdef.runtime/src/org/eclipse/gmf/runtime/graphdef/GMFGraphRenderedFigure.java +++ b/plugins/org.eclipse.gmf.graphdef.runtime/src/org/eclipse/gmf/runtime/graphdef/GMFGraphRenderedFigure.java @@ -22,6 +22,7 @@ import org.eclipse.draw2d.Figure; import org.eclipse.draw2d.GridData; import org.eclipse.draw2d.GridLayout; import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; import org.eclipse.draw2d.LayoutManager; import org.eclipse.draw2d.PolylineDecoration; import org.eclipse.draw2d.PolylineShape; @@ -46,6 +47,7 @@ import org.eclipse.gmf.gmfgraph.PolylineConnection; import org.eclipse.gmf.gmfgraph.RGBColor; import org.eclipse.gmf.gmfgraph.RealFigure; import org.eclipse.gmf.gmfgraph.RoundedRectangle; +import org.eclipse.gmf.gmfgraph.SVGFigure; import org.eclipse.gmf.gmfgraph.ScalablePolygon; import org.eclipse.gmf.gmfgraph.Shape; import org.eclipse.gmf.gmfgraph.StackLayout; @@ -79,11 +81,20 @@ public class GMFGraphRenderedFigure extends Figure { public GMFGraphRenderedFigure(org.eclipse.gmf.gmfgraph.Figure figureDef) { GridLayout manager = new GridLayout(); - setForegroundColor(ColorConstants.black); setLayoutManager(manager); ConvertedFigure res = toDraw2d(figureDef); mainFigure = res.figure; - add(mainFigure, new GridData(SWT.FILL, SWT.FILL, false, false)); + if (mainFigure == null) { + Label label = new Label(); + if (getFont() == null) { + setFont(Display.getDefault().getSystemFont()); + } + label.setText("Rendering not supported (yet?)"); + label.setForegroundColor(ColorConstants.black); + add(label, new GridData(SWT.FILL, SWT.FILL, true, true)); + } else { + add(mainFigure, new GridData(SWT.FILL, SWT.FILL, false, false)); + } } @Override @@ -126,13 +137,16 @@ public class GMFGraphRenderedFigure extends Figure { } else { // TODO connections, label, decoration, custom... // all other concrete types for a Figure + // TODO also: pluggability for figureDef, generator and previewer } if (figureDef.getLayoutData() != null) { layoutData = toDraw2d(figureDef.getLayoutData()); } - populate(figureDef, figure); + if (figure != null) { + populate(figureDef, figure); + } ConvertedFigure res = new ConvertedFigure(); res.figure = figure; @@ -328,8 +342,12 @@ public class GMFGraphRenderedFigure extends Figure { if (layoutData instanceof XYLayoutData) { XYLayoutData xyLayoutData = (XYLayoutData)layoutData; Rectangle res = new Rectangle(); - res.setSize(toDraw2d(xyLayoutData.getSize())); - res.setLocation(toDraw2d(xyLayoutData.getTopLeft())); + if (xyLayoutData.getSize() != null) { + res.setSize(toDraw2d(xyLayoutData.getSize())); + } + if (xyLayoutData.getTopLeft() != null) { + res.setLocation(toDraw2d(xyLayoutData.getTopLeft())); + } return res; } else if (layoutData instanceof GridLayoutData) { GridLayoutData gridLayoutData = (GridLayoutData) layoutData; |