use of org.eclipse.gef.SnapToGeometry in project cubrid-manager by CUBRID.
the class ERSchemaEditor method getAdapter.
/**
* Adaptable implementation for Editor
*/
public Object getAdapter(Class adapter) {
if (adapter == GraphicalViewer.class || adapter == EditPartViewer.class)
return getGraphicalViewer();
else if (adapter == CommandStack.class)
return getCommandStack();
else if (adapter == EditDomain.class)
return getEditDomain();
else if (adapter == ActionRegistry.class)
return getActionRegistry();
else if (adapter == IPropertySheetPage.class)
return getPropertySheetPage();
if (adapter == SnapToHelper.class) {
List snapStrategies = new ArrayList();
Boolean val = (Boolean) getGraphicalViewer().getProperty(RulerProvider.PROPERTY_RULER_VISIBILITY);
if (val != null && val.booleanValue()) {
snapStrategies.add(new SnapToGuides((GraphicalEditPart) this));
}
val = (Boolean) getGraphicalViewer().getProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED);
if (val != null && val.booleanValue()) {
snapStrategies.add(new SnapToGeometry((GraphicalEditPart) this));
}
val = (Boolean) getGraphicalViewer().getProperty(SnapToGrid.PROPERTY_GRID_ENABLED);
if (val != null && val.booleanValue()) {
snapStrategies.add(new SnapToGrid((GraphicalEditPart) this));
}
if (snapStrategies.size() == 0) {
return null;
}
if (snapStrategies.size() == 1) {
return (SnapToHelper) snapStrategies.get(0);
}
SnapToHelper[] sth = new SnapToHelper[snapStrategies.size()];
for (int i = 0; i < snapStrategies.size(); i++) {
sth[i] = (SnapToHelper) snapStrategies.get(i);
}
return new CompoundSnapToHelper(sth);
}
return super.getAdapter(adapter);
}
Aggregations