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 Palladio-Editors-Sirius by PalladioSimulator.
the class AbstractRotatableImageEditPart method refreshVisuals.
/**
* {@inheritDoc}
*
* @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeEditPart#refreshVisuals()
*/
protected void refreshVisuals() {
super.refreshVisuals();
RotatableSVGWorkspaceImageFigure figure = this.getPrimaryShape();
getSourceConnections();
EObject element = this.resolveSemanticElement();
if (element instanceof CustomStyle) {
CustomStyle imageStyle = (CustomStyle) element;
figure.refreshFigure(imageStyle);
((GraphicalEditPart) this.getParent()).setLayoutConstraint(this, this.getFigure(), new Rectangle(0, 0, figure.getPreferredSize().width, figure.getPreferredSize().height));
}
}
use of org.eclipse.gef.GraphicalEditPart in project knime-core by knime.
the class WorkflowMarqueeSelectionTool method performMarqueeSelect.
private void performMarqueeSelect() {
EditPartViewer viewer = getCurrentViewer();
Collection<GraphicalEditPart> newSelections = new LinkedHashSet<GraphicalEditPart>(), deselections = new HashSet<GraphicalEditPart>();
calculateNewSelection(newSelections, deselections);
if (getSelectionMode() != DEFAULT_MODE) {
newSelections.addAll(viewer.getSelectedEditParts());
newSelections.removeAll(deselections);
}
viewer.setSelection(new StructuredSelection(newSelections.toArray()));
}
use of org.eclipse.gef.GraphicalEditPart in project knime-core by knime.
the class WorkflowMarqueeSelectionTool method calculateConnections.
private void calculateConnections(final Collection<GraphicalEditPart> newSelections, final Collection<GraphicalEditPart> deselections) {
// determine the currently selected nodes minus the ones that are to be
// deselected
Collection<EditPart> currentNodes = new HashSet<EditPart>();
if (getSelectionMode() != DEFAULT_MODE) {
// everything is deselected
// in default mode
Iterator<EditPart> iter = getCurrentViewer().getSelectedEditParts().iterator();
while (iter.hasNext()) {
EditPart selected = iter.next();
if (!(selected instanceof ConnectionEditPart) && !deselections.contains(selected)) {
currentNodes.add(selected);
}
}
}
// add new connections to be selected to newSelections
Collection<ConnectionEditPart> connections = new ArrayList<ConnectionEditPart>();
for (Iterator<GraphicalEditPart> nodes = newSelections.iterator(); nodes.hasNext(); ) {
GraphicalEditPart node = nodes.next();
for (Iterator<ConnectionEditPart> itr = node.getSourceConnections().iterator(); itr.hasNext(); ) {
ConnectionEditPart sourceConn = itr.next();
if (sourceConn.getSelected() == EditPart.SELECTED_NONE && (newSelections.contains(sourceConn.getTarget()) || currentNodes.contains(sourceConn.getTarget()))) {
connections.add(sourceConn);
}
}
for (Iterator<ConnectionEditPart> itr = node.getTargetConnections().iterator(); itr.hasNext(); ) {
ConnectionEditPart targetConn = itr.next();
if (targetConn.getSelected() == EditPart.SELECTED_NONE && (newSelections.contains(targetConn.getSource()) || currentNodes.contains(targetConn.getSource()))) {
connections.add(targetConn);
}
}
}
newSelections.addAll(connections);
// add currently selected connections that are to be deselected to
// deselections
connections = new HashSet<ConnectionEditPart>();
for (Iterator<GraphicalEditPart> nodes = deselections.iterator(); nodes.hasNext(); ) {
GraphicalEditPart node = nodes.next();
for (Iterator<ConnectionEditPart> itr = node.getSourceConnections().iterator(); itr.hasNext(); ) {
ConnectionEditPart sourceConn = itr.next();
if (sourceConn.getSelected() != EditPart.SELECTED_NONE) {
connections.add(sourceConn);
}
}
for (Iterator<ConnectionEditPart> itr = node.getTargetConnections().iterator(); itr.hasNext(); ) {
ConnectionEditPart targetConn = itr.next();
if (targetConn.getSelected() != EditPart.SELECTED_NONE) {
connections.add(targetConn);
}
}
}
deselections.addAll(connections);
}
use of org.eclipse.gef.GraphicalEditPart in project knime-core by knime.
the class WorkflowMarqueeSelectionTool method calculateNewSelection.
private void calculateNewSelection(final Collection<GraphicalEditPart> newSelections, final Collection<GraphicalEditPart> deselections) {
Rectangle marqueeRect = getMarqueeSelectionRectangle();
for (Iterator<GraphicalEditPart> itr = getAllChildren().iterator(); itr.hasNext(); ) {
GraphicalEditPart child = itr.next();
IFigure figure = child.getFigure();
if (!child.isSelectable() || child.getTargetEditPart(MARQUEE_REQUEST) != child || !isFigureVisible(figure) || !figure.isShowing()) {
continue;
}
if (!(child instanceof NodeContainerEditPart || child instanceof ConnectionContainerEditPart || child instanceof AbstractWorkflowPortBarEditPart || child instanceof AnnotationEditPart)) {
continue;
}
Rectangle r = figure.getBounds().getCopy();
figure.translateToAbsolute(r);
boolean included = false;
if (child instanceof ConnectionEditPart && marqueeRect.intersects(r)) {
Rectangle relMarqueeRect = Rectangle.SINGLETON;
figure.translateToRelative(relMarqueeRect.setBounds(marqueeRect));
included = ((PolylineConnection) figure).getPoints().intersects(relMarqueeRect);
} else if (child instanceof AnnotationEditPart) {
// select WorkflowAnnotations only if they are fully included in the selection
if (figure instanceof WorkflowAnnotationFigure) {
included = marqueeRect.contains(r);
}
} else if (marqueeBehavior == BEHAVIOR_NODES_AND_CONNECTIONS_TOUCHED) {
included = marqueeRect.intersects(r);
} else {
included = marqueeRect.contains(r);
}
if (included) {
if (isToggle()) {
if (wasSelected(child)) {
deselections.add(child);
} else {
newSelections.add(child);
}
} else {
newSelections.add(child);
}
} else if (isToggle()) {
// readded if it was in the selection before
if (wasSelected(child)) {
newSelections.add(child);
} else {
deselections.add(child);
}
}
}
if (marqueeBehavior == BEHAVIOR_NODES_AND_CONNECTIONS_TOUCHED) {
calculateConnections(newSelections, deselections);
}
}
Aggregations