Java Code Examples for org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget#getAdapter()

The following examples show how to use org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget#getAdapter() . 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: CrossflowValidationDecoratorProvider.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
/**
* @generated
*/
public void createDecorators(IDecoratorTarget decoratorTarget) {
	EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class);
	if (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) {
		Object model = editPart.getModel();
		if ((model instanceof View)) {
			View view = (View) model;
			if (!(view instanceof Edge) && !view.isSetElement()) {
				return;
			}
		}
		EditDomain ed = editPart.getViewer().getEditDomain();
		if (!(ed instanceof DiagramEditDomain)) {
			return;
		}
		if (((DiagramEditDomain) ed).getEditorPart() instanceof CrossflowDiagramEditor) {
			decoratorTarget.installDecorator(KEY, new StatusDecorator(decoratorTarget));
		}
	}
}
 
Example 2
Source File: ProcessValidationDecoratorProvider.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
* @generated
*/
public void createDecorators(IDecoratorTarget decoratorTarget) {
	EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class);
	if (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) {
		Object model = editPart.getModel();
		if ((model instanceof View)) {
			View view = (View) model;
			if (!(view instanceof Edge) && !view.isSetElement()) {
				return;
			}
		}
		EditDomain ed = editPart.getViewer().getEditDomain();
		if (!(ed instanceof DiagramEditDomain)) {
			return;
		}
		if (((DiagramEditDomain) ed).getEditorPart() instanceof ProcessDiagramEditor) {
			decoratorTarget.installDecorator(KEY, new StatusDecorator(decoratorTarget));
		}
	}
}
 
Example 3
Source File: CrossflowShortcutsDecoratorProvider.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
public boolean provides(IOperation operation) {
	if (!(operation instanceof CreateDecoratorsOperation)) {
		return false;
	}
	IDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation).getDecoratorTarget();
	View view = (View) decoratorTarget.getAdapter(View.class);
	return view != null && WorkflowEditPart.MODEL_ID.equals(CrossflowVisualIDRegistry.getModelID(view));
}
 
Example 4
Source File: CrossflowShortcutsDecoratorProvider.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
public void createDecorators(IDecoratorTarget decoratorTarget) {
	View view = (View) decoratorTarget.getAdapter(View.class);
	if (view != null) {
		EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
		if (annotation != null) {
			decoratorTarget.installDecorator(SHORTCUTS_DECORATOR_ID, new ShortcutsDecorator(decoratorTarget));
		}
	}
}
 
Example 5
Source File: CrossflowValidationDecoratorProvider.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
public boolean provides(IOperation operation) {
	if (!(operation instanceof CreateDecoratorsOperation)) {
		return false;
	}
	IDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation).getDecoratorTarget();
	View view = (View) decoratorTarget.getAdapter(View.class);
	return view != null && WorkflowEditPart.MODEL_ID.equals(CrossflowVisualIDRegistry.getModelID(view));
}
 
Example 6
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 7
Source File: TransitionPriorityDecorationProvider.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createDecorators(IDecoratorTarget decoratorTarget) {
	EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class);
	if (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) {
		EditDomain ed = editPart.getViewer().getEditDomain();
		if (!(ed instanceof DiagramEditDomain)) {
			return;
		}
		if (shouldInstall(((DiagramEditDomain) ed).getEditorPart()) && editPart instanceof TransitionEditPart) {
			IDecorator decorator = createStatusDecorator(decoratorTarget);
			decorators.add(decorator);
			decoratorTarget.installDecorator(getDecoratorKey(), decorator);
		}
	}
}
 
Example 8
Source File: RegionPriorityDecorationProvider.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createDecorators(IDecoratorTarget decoratorTarget) {
	EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class);
	if (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) {
		EditDomain ed = editPart.getViewer().getEditDomain();
		if (!(ed instanceof DiagramEditDomain)) {
			return;
		}
		if (shouldInstall(((DiagramEditDomain) ed).getEditorPart()) && editPart instanceof RegionEditPart) {
			IDecorator decorator = createStatusDecorator(decoratorTarget);
			decorators.add(decorator);
			decoratorTarget.installDecorator(getDecoratorKey(), decorator);
		}
	}
}
 
Example 9
Source File: AbstractMarkerBasedDecorationProvider.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 GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) {
		EditDomain ed = editPart.getViewer().getEditDomain();
		if (!(ed instanceof DiagramEditDomain)) {
			return;
		}
		if (shouldInstall(((DiagramEditDomain) ed).getEditorPart())) {
			decoratorTarget.installDecorator(getDecoratorKey(), createStatusDecorator(decoratorTarget));
		}
	}
}
 
Example 10
Source File: AbstractDecoratorProvider.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
public boolean provides(IOperation operation) {
	if (!(operation instanceof CreateDecoratorsOperation)) {
		return false;
	}
	IDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation)
			.getDecoratorTarget();
	View view = (View) decoratorTarget.getAdapter(View.class);
	return view != null;
}
 
Example 11
Source File: ActivityDecoratorProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * getDecoratorTargetClassifier Utility method to determine if the
 * decoratorTarget is a supported type for this decorator and return the
 * associated EditPart element.
 * 
 * @param decoratorTarget
 *            IDecoratorTarget to check and return valid Classifier target.
 * @return node GraphicalEditPart if IDecoratorTarget can be supported, null
 *         otherwise.
 */
public static GraphicalEditPart getDecoratorTargetNode(IDecoratorTarget decoratorTarget) {
    if(decoratorTarget == null){
        return null;
    }
    ShapeNodeEditPart node = (ShapeNodeEditPart) decoratorTarget.getAdapter(ShapeNodeEditPart.class);
    if(node != null ){
        return node ;
    }

    return null;

}
 
Example 12
Source File: ProcessValidationDecoratorProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public boolean provides(IOperation operation) {
	if (!(operation instanceof CreateDecoratorsOperation)) {
		return false;
	}
	IDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation).getDecoratorTarget();
	View view = (View) decoratorTarget.getAdapter(View.class);
	return view != null && MainProcessEditPart.MODEL_ID.equals(ProcessVisualIDRegistry.getModelID(view));
}
 
Example 13
Source File: DefinitionSectionDecorationProvider.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
public void createDecorators(IDecoratorTarget decoratorTarget) {
	Object adapter = decoratorTarget.getAdapter(EObject.class);
	if (adapter instanceof SpecificationElement)
		decoratorTarget.installDecorator(DECORATOR_KEY, new DefinitionSectionDecorator(decoratorTarget));
}
 
Example 14
Source File: SubmachineDecorationProvider.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
public void createDecorators(IDecoratorTarget decoratorTarget) {
	Object adapter = decoratorTarget.getAdapter(EObject.class);
	if (adapter instanceof State)
		decoratorTarget.installDecorator(DECORATOR_KEY, new SubmachineDecorator(decoratorTarget));
}
 
Example 15
Source File: HighlightingSubmachineDecorationProvider.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
public void createDecorators(IDecoratorTarget decoratorTarget) {
	Object adapter = decoratorTarget.getAdapter(EObject.class);
	if (adapter instanceof State)
		decoratorTarget.installDecorator(DECORATOR_KEY, new HighlightingSubmachineDecorator(decoratorTarget));
}