use of org.eclipse.gmf.runtime.notation.Node in project tdi-studio-se by Talend.
the class BusinessItemRelationshipNameViewFactory method createView.
/**
* @generated
*/
public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
Location location = (Location) view.getLayoutConstraint();
IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
location.setX(mapMode.DPtoLP(0));
location.setY(mapMode.DPtoLP(40));
return view;
}
use of org.eclipse.gmf.runtime.notation.Node in project tdi-studio-se by Talend.
the class DirectionalBusinessItemRelationshipNameViewFactory method createView.
/**
* @generated
*/
public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
Location location = (Location) view.getLayoutConstraint();
IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
location.setX(mapMode.DPtoLP(0));
location.setY(mapMode.DPtoLP(40));
return view;
}
use of org.eclipse.gmf.runtime.notation.Node in project statecharts by Yakindu.
the class SimulationImageRenderer method highlightElements.
public void highlightElements(final List<? extends EObject> objects, final Diagram diagram) {
AbstractTransactionalCommand cmd = new AbstractTransactionalCommand(TransactionUtil.getEditingDomain(diagram), "", null) {
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
// Init colors from preferences
RGB rgbForeGround = PreferenceConverter.getColor(SimulationActivator.getDefault().getPreferenceStore(), SimulationPreferenceConstants.STATE_FOREGROUND_HIGHLIGHTING_COLOR);
RGB rgbBackGround = PreferenceConverter.getColor(SimulationActivator.getDefault().getPreferenceStore(), SimulationPreferenceConstants.STATE_BACKGROUND_HIGHLIGHTING_COLOR);
RGB rgbTransitionActive = PreferenceConverter.getColor(SimulationActivator.getDefault().getPreferenceStore(), SimulationPreferenceConstants.TRANSITION_HIGHLIGHTING_COLOR);
Color color = new Color(Display.getDefault(), rgbForeGround);
Integer foreGround = FigureUtilities.colorToInteger(color);
color.dispose();
color = new Color(Display.getDefault(), rgbBackGround);
Integer background = FigureUtilities.colorToInteger(color);
color.dispose();
color = new Color(Display.getDefault(), rgbTransitionActive);
Integer transitionActive = FigureUtilities.colorToInteger(color);
color.dispose();
// Set styling
TreeIterator<EObject> eAllContents = diagram.eAllContents();
while (eAllContents.hasNext()) {
EObject next = eAllContents.next();
if (next instanceof View) {
for (EObject elementToHighlight : objects) {
EObject element = null;
if (next instanceof Node) {
element = ((Node) next).getElement();
} else if (next instanceof Edge) {
element = ((Edge) next).getElement();
}
if (element == null) {
// next instanceof BasicDecorationNode || next instanceof Shape
continue;
}
if (EcoreUtil.getURI(elementToHighlight).equals(EcoreUtil.getURI(element))) {
if (next instanceof Node) {
ShapeStyle style = (ShapeStyle) ((Node) next).getStyle(NotationPackage.Literals.SHAPE_STYLE);
if (style != null) {
style.setFillColor(background);
style.setLineColor(foreGround);
}
} else if (next instanceof Edge) {
ConnectorStyle style = (ConnectorStyle) ((View) next).getStyle(NotationPackage.Literals.CONNECTOR_STYLE);
if (style != null) {
style.setLineColor(transitionActive);
}
}
}
}
}
}
return CommandResult.newOKCommandResult();
}
};
try {
cmd.execute(new NullProgressMonitor(), null);
} catch (ExecutionException e) {
e.printStackTrace();
}
}
use of org.eclipse.gmf.runtime.notation.Node in project statecharts by Yakindu.
the class ExtractSubdiagramRefactoring method createEntryPoint.
protected void createEntryPoint(Edge edge, Diagram subdiagram) {
Transition transition = (Transition) edge.getElement();
Region entryPointContainer = getEntryPointContainer(transition);
Entry entryPoint = createSemanticEntryPoint(transition);
// re-wire old transition to targeting the selected state
transition.setTarget((State) subdiagram.getElement());
View oldTarget = edge.getTarget();
edge.setTarget(getContextObject());
// create node for entry point
View entryPointContainerView = helper.getViewForSemanticElement(entryPointContainer, subdiagram);
View entryPointRegionCompartment = ViewUtil.getChildBySemanticHint(entryPointContainerView, SemanticHints.REGION_COMPARTMENT);
Node entryNode = ViewService.createNode(entryPointRegionCompartment, entryPoint, SemanticHints.ENTRY, preferencesHint);
ViewService.createEdge(entryNode, oldTarget, entryPoint.getOutgoingTransitions().get(0), SemanticHints.TRANSITION, preferencesHint);
addEntryPointSpec(transition, entryPoint);
}
use of org.eclipse.gmf.runtime.notation.Node in project statecharts by Yakindu.
the class CreateSubdiagramCommand method unwrap.
public Node unwrap(ISelection selection) {
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
Object firstElement = structuredSelection.getFirstElement();
if (firstElement == null)
return null;
return (Node) ((StateEditPart) firstElement).getNotationView();
}
Aggregations