org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart Java Examples

The following examples show how to use org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart. 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: CrossflowDiagramEditorUtil.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
/**
* @generated
*/
public static void selectElementsInDiagram(IDiagramWorkbenchPart diagramPart, List<EditPart> editParts) {
	diagramPart.getDiagramGraphicalViewer().deselectAll();

	EditPart firstPrimary = null;
	for (EditPart nextPart : editParts) {
		diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart);
		if (firstPrimary == null && nextPart instanceof IPrimaryEditPart) {
			firstPrimary = nextPart;
		}
	}

	if (!editParts.isEmpty()) {
		diagramPart.getDiagramGraphicalViewer()
				.reveal(firstPrimary != null ? firstPrimary : (EditPart) editParts.get(0));
	}
}
 
Example #2
Source File: DiagramPartitioningUtil.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
public static void selectElementsInDiagram(IDiagramWorkbenchPart diagramPart, List<EditPart> editParts) {
	diagramPart.getDiagramGraphicalViewer().deselectAll();

	EditPart firstPrimary = null;
	for (Iterator<EditPart> it = editParts.iterator(); it.hasNext();) {
		EditPart nextPart = it.next();
		if (nextPart.isSelectable()) {
			diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart);
		}
		if (firstPrimary == null && nextPart instanceof IPrimaryEditPart) {
			firstPrimary = nextPart;
		}
	}
	if (!editParts.isEmpty()) {
		diagramPart.getDiagramGraphicalViewer()
				.reveal(firstPrimary != null ? firstPrimary : (EditPart) editParts.get(0));
	}
}
 
Example #3
Source File: ProcessDiagramEditorUtil.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
* @generated
*/
public static void selectElementsInDiagram(IDiagramWorkbenchPart diagramPart, List<EditPart> editParts) {
	diagramPart.getDiagramGraphicalViewer().deselectAll();

	EditPart firstPrimary = null;
	for (EditPart nextPart : editParts) {
		diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart);
		if (firstPrimary == null && nextPart instanceof IPrimaryEditPart) {
			firstPrimary = nextPart;
		}
	}

	if (!editParts.isEmpty()) {
		diagramPart.getDiagramGraphicalViewer()
				.reveal(firstPrimary != null ? firstPrimary : (EditPart) editParts.get(0));
	}
}
 
Example #4
Source File: DefinitionSectionDecorationProvider.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected boolean shouldDecorate(EObject element) {
	if (getDecoratorTarget().getAdapter(IPrimaryEditPart.class) instanceof StatechartTextEditPart) {
		StatechartTextEditPart adapter = (StatechartTextEditPart) getDecoratorTarget()
				.getAdapter(IPrimaryEditPart.class);
		BooleanValueStyle style = GMFNotationUtil.getBooleanValueStyle(adapter.getNotationView(),
				DiagramPartitioningUtil.INLINE_DEFINITION_SECTION_STYLE);
		return style == null ? true : style.isBooleanValue();
	}
	return false;
}
 
Example #5
Source File: StatechartValidationDecorationProvider.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
public void createDecorators(IDecoratorTarget decoratorTarget) {
	EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class);
	if (editPart instanceof BorderItemEditPart)
		return;
	if (editPart instanceof IPrimaryEditPart
			&& (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart)) {
		EditDomain ed = editPart.getViewer().getEditDomain();
		if (!(ed instanceof DiagramEditDomain)) {
			return;
		}
		if (shouldInstall(((DiagramEditDomain) ed).getEditorPart())) {
			decoratorTarget.installDecorator(getDecoratorKey(), createStatusDecorator(decoratorTarget, issueStore));
		}
	}
}
 
Example #6
Source File: StatechartValidationDecorationProvider.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
public void refresh() {
	Optional<EObject> element = getTargetEObject();
	if (!element.isPresent()) {
		return;
	}
	semanticID = element.get().eResource().getURIFragment(element.get());
	removeDecoration();
	EditPart editPart = (EditPart) getDecoratorTarget().getAdapter(EditPart.class);
	if (editPart == null || editPart.getViewer() == null || !(editPart instanceof IPrimaryEditPart)) {
		return;
	}
	decorate(getTargetView().get());
}
 
Example #7
Source File: InteractiveDecorator.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
public void refresh() {
	disposeDecoration();
	if (getDecoratorTarget().getAdapter(EditPart.class) instanceof IPrimaryEditPart) {
		final EObject semanticElement = getSemanticElement();
		if (shouldDecorate(getSemanticElement())) {
			setDecoration(createDecoration(semanticElement));
		}
	}
}
 
Example #8
Source File: HighlightingSupportAdapter.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
private void lockEditorInternal() {
	setSanityCheckEnablementState(false);
	for (Object editPart : diagramWorkbenchPart.getDiagramGraphicalViewer().getEditPartRegistry().values()) {
		if (editPart instanceof IPrimaryEditPart) {
			IGraphicalEditPart graphicalEditPart = (IGraphicalEditPart) editPart;
			IFigure figure = getTargetFigure(graphicalEditPart);
			figureStates.put(figure, new ColorMemento(figure));
		}
	}
	locked = true;
}