use of org.eclipse.gef.GraphicalEditPart in project tdi-studio-se by Talend.
the class RowSelectionEditPolicy method getLocatorFigure.
private IFigure getLocatorFigure(GraphicalEditPart owner) {
IFigure figure = owner.getFigure();
if (owner instanceof TableEntityPart) {
TableEntityFigure treeNodeFigure = (TableEntityFigure) figure;
// table figure to restrict the width
MapperTablePart abstractInOutTreePart = MapperUtils.getMapperTablePart((TableEntityPart) owner);
IFigure parentFigure = ((GraphicalEditPart) abstractInOutTreePart).getFigure();
Rectangle treeBounds = parentFigure.getBounds();
Rectangle rowBounds = treeNodeFigure.getElement().getBounds();
Rectangle treeNodeBounds = figure.getBounds();
figure = new Figure();
if (treeBounds.x + 1 != treeNodeBounds.x || treeNodeBounds.width > treeBounds.width) {
figure.setBounds(new Rectangle(treeBounds.x + 1, treeNodeBounds.y, treeBounds.width - 2, rowBounds.height));
return figure;
} else {
figure.setBounds(owner.getFigure().getBounds().getCopy());
figure.getBounds().height = rowBounds.height;
return figure;
}
} else if (figure instanceof VarEntityFigure) {
Rectangle copy = figure.getBounds().getCopy();
figure = new Figure();
figure.setBounds(copy);
return figure;
}
return owner.getFigure();
}
use of org.eclipse.gef.GraphicalEditPart in project tdi-studio-se by Talend.
the class TablePart method refreshVisuals.
@Override
protected void refreshVisuals() {
Table table = (Table) getModel();
Point loc = table.getLocation();
Dimension size = table.getSize();
Rectangle rectangle = new Rectangle(loc, size);
((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), rectangle);
}
use of org.eclipse.gef.GraphicalEditPart 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);
}
use of org.eclipse.gef.GraphicalEditPart in project cubrid-manager by CUBRID.
the class AbstractBasicPart method propertyChange.
public void propertyChange(PropertyChangeEvent evt) {
String property = evt.getPropertyName();
if (PropertyChangeProvider.CHILD_CHANGE.equals(property)) {
handleChildChange(evt);
} else if (PropertyChangeProvider.REORDER_CHANGE.equals(property)) {
handleReorderChange(evt);
} else if (PropertyChangeProvider.OUTPUT_CHANGE.equals(property)) {
handleOutputChange(evt);
} else if (PropertyChangeProvider.INPUT_CHANGE.equals(property)) {
handleInputChange(evt);
} else if (PropertyChangeProvider.TEXT_CHANGE.equals(property)) {
handleLabelChange(evt);
} else if (PropertyChangeProvider.BOUNDS_CHANGE.equals(property)) {
handleBoundsChange(evt);
} else if (PropertyChangeProvider.LAYOUT_CHANGE.equals(property)) {
handleLayoutChange(evt);
} else if (PropertyChangeProvider.AUTO_LAYOUT_TEMP.equals(property)) {
handleTmpAutoLayout(evt);
} else if (PropertyChangeProvider.VIEW_MODEL_CHANGE.equals(property)) {
handleViewModelChange(evt);
} else if (PropertyChangeProvider.RELATION_MAP_CHANGE.equals(property)) {
handleRelationMapChange(evt);
}
if (PropertyChangeProvider.TEXT_CHANGE.equals(property)) {
GraphicalEditPart graphicalEditPart = (GraphicalEditPart) (getViewer().getContents());
IFigure partFigure = graphicalEditPart.getFigure();
partFigure.getUpdateManager().performUpdate();
}
postSchemaDataChanged(evt);
}
use of org.eclipse.gef.GraphicalEditPart in project cubrid-manager by CUBRID.
the class GefViewerKeyHandler method keyPressed.
/**
* @see org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler.keyPressed
* @param event KeyEvent
* @return true or false.
*/
public boolean keyPressed(KeyEvent event) {
GraphicalEditPart editPart = getFocusEditPart();
if (editPart instanceof HANodePart) {
if (moveHANodesByKey(event)) {
return true;
}
if (deleteHANodeByKey(event)) {
return true;
}
}
if (editPart instanceof DashboardPart && event.keyCode == SWT.F5) {
DashboardPart dp = (DashboardPart) editPart;
dp.refresh();
List<?> childEditPart = dp.getChildren();
for (Object child : childEditPart) {
((EditPart) child).refresh();
}
}
return super.keyPressed(event);
}
Aggregations