Java Code Examples for org.eclipse.gef.EditPart#SELECTED_NONE

The following examples show how to use org.eclipse.gef.EditPart#SELECTED_NONE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NonRevealingDragEditPartsTrackerEx.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected boolean handleButtonUp(int button) {
	if (stateTransition(STATE_DRAG_IN_PROGRESS, STATE_TERMINAL)) {
		eraseSourceFeedback();
		eraseTargetFeedback();
		performDrag();
		return true;
	}
	if (isInState(STATE_DRAG)) {
		performSelection();
		if (getFlag(FLAG_ENABLE_DIRECT_EDIT))
			performDirectEdit();
		if (button == 1 && getSourceEditPart().getSelected() != EditPart.SELECTED_NONE)
			reveal(getSourceEditPart());
		setState(STATE_TERMINAL);
		return true;
	}
	return false;
}
 
Example 2
Source File: CellEditPart.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This method notifies the View and Model of changes to the selection of
 * the EditPart.
 */
@Override
protected void fireSelectionChanged() {
	// If the Cell is invalid or disabled, we don't want to select it.
	Cell cell = (Cell) getModel();
	if (cell.getInvalid() || cell.getDisabled()) {
		return;
	}

	// Because the SELECTED_PRIMARY flag is a bit unpredictable, we consider
	// something selected as long as it's not receiving the SELECTED_NONE
	// flag.
	boolean selected = (getSelected() != EditPart.SELECTED_NONE);

	// Tell the figure and the model the selection choice.
	((CellFigure) getFigure()).setSelected(selected);
	((Cell) getModel()).setSelected(selected);

	// Call the same method for the super.
	super.fireSelectionChanged();

	return;
}
 
Example 3
Source File: CustomSubProcessResizableCompartmentEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void deactivate() {
	super.deactivate();
	super.hideSelection();
	if (getHost().getSelected() == EditPart.SELECTED_NONE) {
		ResizableCompartmentFigure compartmentFigure = getCompartmentFigure();
		if (compartmentFigure != null) {
			compartmentFigure.setSelected(false);
		}
	}
}
 
Example 4
Source File: LinkPart.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void setSelected(int value) {
	if (!getFigure().isVisible())
		return;
	PolylineConnection figure = (PolylineConnection) getFigure();
	if (value != EditPart.SELECTED_NONE) {
		figure.setLineWidth(2);
		figure.setForegroundColor(Link.HIGHLIGHT_COLOR);
	} else {
		figure.setLineWidth(1);
		figure.setForegroundColor(Link.COLOR);
	}
	super.setSelected(value);
}
 
Example 5
Source File: LinkPart.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void setSelected(int value) {
	PolylineConnection figure = (PolylineConnection) getFigure();
	Link link = ((Link) getModel());
	if (value != EditPart.SELECTED_NONE) {
		figure.setForegroundColor(Link.HIGHLIGHT_COLOR);
	} else {
		figure.setForegroundColor(link.getColor());
	}
	super.setSelected(value);
}
 
Example 6
Source File: Link.java    From olca-app with Mozilla Public License 2.0 4 votes vote down vote up
boolean isSelected() {
	return editPart.getSelected() != EditPart.SELECTED_NONE;
}