Skip to content
Snippets Groups Projects
Commit 23e59da9 authored by Dongyue Mou's avatar Dongyue Mou
Browse files

fixed a bug where connection service throw class cast exception

parent 079a1719
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,7 @@ import org.eclipse.draw2d.Figure; ...@@ -27,6 +27,7 @@ import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label; import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.PositionConstants; import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.TreeSearch;
import org.eclipse.draw2d.XYLayout; import org.eclipse.draw2d.XYLayout;
import org.eclipse.draw2d.geometry.Insets; import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.draw2d.geometry.Rectangle;
...@@ -46,7 +47,7 @@ import org.fortiss.tooling.kernel.model.INamedCommentedElement; ...@@ -46,7 +47,7 @@ import org.fortiss.tooling.kernel.model.INamedCommentedElement;
* @author mou * @author mou
* @author $Author: hoelzl $ * @author $Author: hoelzl $
* @version $Rev: 8344 $ * @version $Rev: 8344 $
* @ConQAT.Rating YELLOW Hash: EEB93FADF83491DB779EE5D849CCF0C8 * @ConQAT.Rating YELLOW Hash: 37E1662327ADFEAA93E620275D1FCB0B
*/ */
public abstract class SubDiagramEditPartBase<T extends ILayoutedModelElement & INamedCommentedElement> public abstract class SubDiagramEditPartBase<T extends ILayoutedModelElement & INamedCommentedElement>
extends ElementEditPartBase<T> { extends ElementEditPartBase<T> {
...@@ -88,18 +89,13 @@ public abstract class SubDiagramEditPartBase<T extends ILayoutedModelElement & I ...@@ -88,18 +89,13 @@ public abstract class SubDiagramEditPartBase<T extends ILayoutedModelElement & I
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
protected Rectangle determineBaseFigureBounds() { protected Rectangle determineBaseFigureBounds() {
Rectangle result = null; Rectangle result = new Rectangle();
for(Object o : getModelChildren()) { for(Object o : getModelChildren()) {
if(o instanceof ILayoutedModelElement) { if(o instanceof ILayoutedModelElement) {
Rectangle p = LayoutDataUtils.getNodeBounds((ILayoutedModelElement)o); Rectangle p = LayoutDataUtils.getNodeBounds((ILayoutedModelElement)o);
result = p.getUnion(result); result.union(p);
} }
} }
if(result == null) {
result = new Rectangle();
}
result.setLocation(DEFAULT_GRID_SIZE, DEFAULT_GRID_SIZE);
result.expand(DEFAULT_GRID_SIZE, DEFAULT_GRID_SIZE);
result.resize(DEFAULT_GRID_SIZE, DEFAULT_GRID_SIZE); result.resize(DEFAULT_GRID_SIZE, DEFAULT_GRID_SIZE);
return result; return result;
} }
...@@ -133,6 +129,20 @@ public abstract class SubDiagramEditPartBase<T extends ILayoutedModelElement & I ...@@ -133,6 +129,20 @@ public abstract class SubDiagramEditPartBase<T extends ILayoutedModelElement & I
protected boolean useLocalCoordinates() { protected boolean useLocalCoordinates() {
return true; return true;
} }
/** {@inheritDoc} */
@Override
public IFigure findFigureAt(int x, int y, TreeSearch search) {
// transparent
return null;
}
/** {@inheritDoc} */
@Override
public boolean isOpaque() {
// transparent
return false;
}
}; };
labelFigureLayer.setLayoutManager(new XYLayout()); labelFigureLayer.setLayoutManager(new XYLayout());
super.registerLabelFigure(labelFigureLayer); super.registerLabelFigure(labelFigureLayer);
......
...@@ -106,9 +106,14 @@ public class ConnectionCompositorService extends ...@@ -106,9 +106,14 @@ public class ConnectionCompositorService extends
return null; return null;
} }
for(IConnectionCompositor<EObject, EObject, EObject> connector : list) { for(IConnectionCompositor<EObject, EObject, EObject> connector : list) {
try {
if(connector.canConnect(source, target, parent, context)) { if(connector.canConnect(source, target, parent, context)) {
return connector; return connector;
} }
} catch(ClassCastException e) {
// the container class is not ensured to be compatible. so we ignore all such kinds
// of exceptions here
}
} }
return null; return null;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment