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;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.TreeSearch;
import org.eclipse.draw2d.XYLayout;
import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.draw2d.geometry.Rectangle;
......@@ -46,7 +47,7 @@ import org.fortiss.tooling.kernel.model.INamedCommentedElement;
* @author mou
* @author $Author: hoelzl $
* @version $Rev: 8344 $
* @ConQAT.Rating YELLOW Hash: EEB93FADF83491DB779EE5D849CCF0C8
* @ConQAT.Rating YELLOW Hash: 37E1662327ADFEAA93E620275D1FCB0B
*/
public abstract class SubDiagramEditPartBase<T extends ILayoutedModelElement & INamedCommentedElement>
extends ElementEditPartBase<T> {
......@@ -88,18 +89,13 @@ public abstract class SubDiagramEditPartBase<T extends ILayoutedModelElement & I
/** {@inheritDoc} */
@Override
protected Rectangle determineBaseFigureBounds() {
Rectangle result = null;
Rectangle result = new Rectangle();
for(Object o : getModelChildren()) {
if(o instanceof ILayoutedModelElement) {
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);
return result;
}
......@@ -133,6 +129,20 @@ public abstract class SubDiagramEditPartBase<T extends ILayoutedModelElement & I
protected boolean useLocalCoordinates() {
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());
super.registerLabelFigure(labelFigureLayer);
......
......@@ -106,8 +106,13 @@ public class ConnectionCompositorService extends
return null;
}
for(IConnectionCompositor<EObject, EObject, EObject> connector : list) {
if(connector.canConnect(source, target, parent, context)) {
return connector;
try {
if(connector.canConnect(source, target, parent, context)) {
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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment