org.eclipse.gmf.runtime.notation.Node Java Examples

The following examples show how to use org.eclipse.gmf.runtime.notation.Node. 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: BonitaModelExporterImpl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Bounds getBounds(Node view) {
    LayoutConstraint layoutConstraint = view.getLayoutConstraint();
    if (layoutConstraint instanceof Bounds) {
        Bounds bounds = NotationFactory.eINSTANCE.createBounds();
        bounds.setHeight(((Bounds) layoutConstraint).getHeight());
        bounds.setWidth(((Bounds) layoutConstraint).getWidth());
        bounds.setX(((Bounds) layoutConstraint).getX());
        bounds.setY(((Bounds) layoutConstraint).getY());
        Dimension defaultSize = getDefaultSize(view);
        if (bounds.getHeight() == -1) {
            bounds.setHeight(defaultSize.height);
        }
        if (bounds.getWidth() == -1) {
            bounds.setWidth(defaultSize.width);
        }
        return bounds;
    }
    return null;
}
 
Example #2
Source File: ScriptedTaskItemSemanticEditPolicy.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
/**
* @generated
*/
private void addDestroyChildNodesCommand(ICompositeCommand cmd) {
	View view = (View) getHost().getModel();
	for (Iterator<?> nit = view.getChildren().iterator(); nit.hasNext();) {
		Node node = (Node) nit.next();
		switch (CrossflowVisualIDRegistry.getVisualID(node)) {
		case ScriptedTaskScriptedTaskOutputVariablesCompartmentEditPart.VISUAL_ID:
			for (Iterator<?> cit = node.getChildren().iterator(); cit.hasNext();) {
				Node cnode = (Node) cit.next();
				switch (CrossflowVisualIDRegistry.getVisualID(cnode)) {
				case Field2EditPart.VISUAL_ID:
					cmd.add(new DestroyElementCommand(
							new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
					// don't need explicit deletion of cnode as parent's view deletion would clean child views as well 
					// cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
					break;
				}
			}
			break;
		}
	}
}
 
Example #3
Source File: LanguageItemSemanticEditPolicy.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
/**
* @generated
*/
private void addDestroyChildNodesCommand(ICompositeCommand cmd) {
	View view = (View) getHost().getModel();
	for (Iterator<?> nit = view.getChildren().iterator(); nit.hasNext();) {
		Node node = (Node) nit.next();
		switch (CrossflowVisualIDRegistry.getVisualID(node)) {
		case LanguageLanguageParametersCompartmentEditPart.VISUAL_ID:
			for (Iterator<?> cit = node.getChildren().iterator(); cit.hasNext();) {
				Node cnode = (Node) cit.next();
				switch (CrossflowVisualIDRegistry.getVisualID(cnode)) {
				case ParameterEditPart.VISUAL_ID:
					cmd.add(new DestroyElementCommand(
							new DestroyElementRequest(getEditingDomain(), cnode.getElement(), false))); // directlyOwned: true
					// don't need explicit deletion of cnode as parent's view deletion would clean child views as well 
					// cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
					break;
				}
			}
			break;
		}
	}
}
 
Example #4
Source File: CustomProcessViewProvider.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Node createSubProcessEvent_3058(final EObject domainElement,
        final View containerView, final int index, final boolean persisted,
        final PreferencesHint preferencesHint) {
    final Node node = super.createSubProcessEvent_3058(domainElement, containerView, index,
            persisted, preferencesHint);
    ((FillStyle) node.getStyle(NotationPackage.eINSTANCE.getFillStyle())).setFillColor(new RGB(184, 185, 218).hashCode());
    ((LineStyle) node.getStyle(NotationPackage.eINSTANCE.getLineStyle())).setLineColor(new RGB(44, 109, 163).hashCode());
    for (final Object child : node.getPersistedChildren()) {
        if (child instanceof DrawerStyle) {
            final Object store = preferencesHint.getPreferenceStore();
            boolean isCollapsed = true;
            if (store instanceof org.eclipse.jface.preference.PreferenceStore) {
                isCollapsed = ((org.eclipse.jface.preference.PreferenceStore) preferencesHint.getPreferenceStore()).getBoolean("isCollapsed");
            }
            ((DrawerStyle) child).setCollapsed(isCollapsed);
        }
    }
    return node;
}
 
Example #5
Source File: LoopTaskDecorator.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected int getDelta(final Node view) {
    int delta = -1 ;
    if(view != null){
        final int height = ((Size)view.getLayoutConstraint()).getHeight() ;
        if(height != 0){
            delta = - (height / 25) ;
            if(delta > -1 ){
                delta = -1 ;
            }
        }else{
            delta = - 1 ;
        }

    }
    return delta;
}
 
Example #6
Source File: DragEditPartsTrackerExWithoutCopyWithModKeyPressed.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void executeCurrentCommand() {
	if(getOperationSet().size() > 1){
		FiguresHelper.AVOID_OVERLAP_ENABLE = false ;
		super.executeCurrentCommand();
		FiguresHelper.AVOID_OVERLAP_ENABLE = true ;
		CompoundCommand cc = new CompoundCommand("Check Overlap") ;
		for(Object ep : getOperationSet()){
			if(ep instanceof IGraphicalEditPart){
				IGraphicalEditPart gep = (IGraphicalEditPart) ep ;
				Location loc = (Location) ((Node) ((IGraphicalEditPart) ep).getNotationView()).getLayoutConstraint() ;
				Point oldLoc = new Point(loc.getX(), loc.getY()) ;
				Point newLoc = FiguresHelper.handleCompartmentMargin(gep, loc.getX(), loc.getY(),(gep.resolveSemanticElement() instanceof SubProcessEvent)) ;
				if((newLoc.x != 0 && newLoc.y != 0) && !newLoc.equals(oldLoc)){
					cc.add(new ICommandProxy(new SetBoundsCommand(gep.getEditingDomain(), "Check Overlap", new EObjectAdapter(gep.getNotationView()),newLoc))) ;
				}
			}
		}
		executeCommand(cc) ;
	}else{
		super.executeCurrentCommand() ;
	}
}
 
Example #7
Source File: BPMNShapeFactory.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public BPMNShape createPool(String participantId, Pool pool) {
    final BPMNShape processShape = DiFactory.eINSTANCE.createBPMNShape();
    processShape.setBpmnElement(QName.valueOf(participantId));
    Node poolNode = modelExporter.getElementNotationNode(pool);
    final org.eclipse.gmf.runtime.notation.Bounds bounds = modelExporter.getBounds(poolNode);
    final Bounds processBounds = DcFactory.eINSTANCE.createBounds();

    processBounds.setHeight(computePoolHeight(pool));
    processBounds.setWidth(bounds.getWidth());
    processBounds.setX(bounds.getX());
    processBounds.setY(computePoolY(modelExporter.getPools(), pool, modelExporter));
    processShape.setBounds(processBounds);
    processShape.setId(modelExporter.getEObjectID(poolNode));
    processShape.setIsHorizontal(true);
    return processShape;
}
 
Example #8
Source File: SetLabelsOffsetOperation.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
/**
	 * Update the offset ({@link Bounds}) of the labels {@link Node}. This method
	 * must be called after setting the newPointList and the labelToUpdate. If the
	 * methods {@link #setLabelsToUpdate(ConnectionEditPart)} or
	 * {@link #setLabelsToUpdate(ConnectionEditPart, PointList)} are not called,
	 * this method has no effect.
	 */
	public void updateGMFLabelsOffset() {
//		System.out.println("update label offsets");
		if (labelsWithNewOffset != null) {
			// Update Bounds of the three labels Node (Center, Begin and End)
			Set<Entry<Node, Point>> entries = labelsWithNewOffset.entrySet();
			for (Entry<Node, Point> entry : entries) {
				LayoutConstraint layoutConstraint = entry.getKey().getLayoutConstraint();
				if (layoutConstraint instanceof Location) {
					Location bounds = (Location) layoutConstraint;
					bounds.setX(entry.getValue().x);
					bounds.setY(entry.getValue().y);
				}
			}
		}
	}
 
Example #9
Source File: MultiInstanceSubprocessDecorator.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected int getDelta(final Node view) {

    int delta = -1 ;
    if(view != null){
        final int height = ((Size)view.getLayoutConstraint()).getHeight() ;
        if(height != 0){
            delta = -(height / 10);
            if(delta > -1 ){
                delta = -1 ;
            }
        }else{
            delta = - 1 ;
        }

    }
    return delta;
}
 
Example #10
Source File: BPMNShapeFactory.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public BPMNShape createBoundary(BoundaryEvent boundaryEvent, TBoundaryEvent bpmnBoundary, Bounds parentBounds) {
    final BPMNShape boundaryShape = DiFactory.eINSTANCE.createBPMNShape();
    Node boundaryNode = modelExporter.getElementNotationNode(boundaryEvent);
    boundaryShape.setBpmnElement(QName.valueOf(bpmnBoundary.getId()));
    final org.eclipse.gmf.runtime.notation.Bounds bounds = modelExporter.getBounds(boundaryNode);
    int xOffset = bounds.getX();
    if (xOffset == 0) {
        xOffset = 20;
    }
    int yOffset = bounds.getY();
    if (yOffset == 0) {
        yOffset = (int) parentBounds.getHeight() - (bounds.getHeight() / 2);
    }
    final Bounds boundaryBounds = DcFactory.eINSTANCE.createBounds();
    boundaryBounds.setHeight(bounds.getHeight());
    boundaryBounds.setWidth(bounds.getWidth());
    boundaryBounds.setX(parentBounds.getX() + xOffset);
    boundaryBounds.setY(parentBounds.getY() + yOffset);
    boundaryShape.setBounds(boundaryBounds);
    boundaryShape.setId(modelExporter.getEObjectID(boundaryNode));
    attachLabel(boundaryNode, boundaryEvent.getName(), boundaryShape);
    return boundaryShape;
}
 
Example #11
Source File: ExtractSubdiagramRefactoring.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
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);
}
 
Example #12
Source File: MultipleShapesHorizontalMoveTool.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void executeCurrentCommand() {
 FiguresHelper.AVOID_OVERLAP_ENABLE = false ;
 super.executeCurrentCommand();
 FiguresHelper.AVOID_OVERLAP_ENABLE = true ;
 CompoundCommand cc = new CompoundCommand("Check Overlap") ;
 for(IGraphicalEditPart ep : _movingShapes){
	 Location loc = (Location) ((Node) ep.getNotationView()).getLayoutConstraint() ;
	 Point oldLoc = new Point(loc.getX(), loc.getY()) ;
	 Point newLoc = FiguresHelper.handleCompartmentMargin(ep, loc.getX(), loc.getY(),(ep.resolveSemanticElement() instanceof SubProcessEvent)) ;
	 if((newLoc.x != 0 && newLoc.y != 0) && !newLoc.equals(oldLoc)){
		 cc.add(new ICommandProxy(new SetBoundsCommand(_container.getEditingDomain(), "Check Overlap", new EObjectAdapter(ep.getNotationView()),newLoc))) ;
	 }
 }
 executeCommand(cc) ;
}
 
Example #13
Source File: TransitionViewFactory.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected void decorateView(View containerView, View view,
		IAdaptable element, String semanticHint, int index,
		boolean persisted) {

	FontStyle fontStyle = NotationFactory.eINSTANCE.createFontStyle();
	view.getStyles().add(fontStyle);

	super.decorateView(containerView, view, element, semanticHint, index,
			persisted);

	Node label = FactoryUtils.createLabel(view,
			SemanticHints.TRANSITION_EXPRESSION);
	Location location = (Location) label.getLayoutConstraint();
	location.setX(0);
	location.setY(10);

}
 
Example #14
Source File: BPMNShapeFactory.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public BPMNShape createLane(String laneId, Lane lane, Bounds parentBounds) {
    final BPMNShape laneShape = DiFactory.eINSTANCE.createBPMNShape();
    laneShape.setBpmnElement(QName.valueOf(laneId));
    Node laneNode = modelExporter.getElementNotationNode(lane);
    final org.eclipse.gmf.runtime.notation.Bounds bounds = modelExporter.getBounds(laneNode);
    final Bounds laneBounds = DcFactory.eINSTANCE.createBounds();
    laneBounds.setHeight(bounds.getHeight());
    laneBounds.setWidth(parentBounds.getWidth() - 30);
    laneBounds.setX(parentBounds.getX() + 30);
    laneBounds.setY(parentBounds.getY()
            + computeLaneY(modelExporter.getLanes(modelExporter.getParentPool(lane)), lane, modelExporter));
    laneShape.setBounds(laneBounds);
    laneShape.setId(modelExporter.getEObjectID(laneNode));
    laneShape.setIsHorizontal(true);
    return laneShape;
}
 
Example #15
Source File: ProcessViewProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public Node createCallActivity_2036(EObject domainElement, View containerView, int index, boolean persisted,
		PreferencesHint preferencesHint) {
	Shape node = NotationFactory.eINSTANCE.createShape();
	node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
	node.setType(ProcessVisualIDRegistry.getType(CallActivityEditPart.VISUAL_ID));
	ViewUtil.insertChildView(containerView, node, index, persisted);
	node.setElement(domainElement);
	stampShortcut(containerView, node);
	// initializeFromPreferences 
	final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

	org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore,
			IPreferenceConstants.PREF_LINE_COLOR);
	ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getLineStyle_LineColor(),
			FigureUtilities.RGBToInteger(lineRGB));
	FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
	if (nodeFontStyle != null) {
		FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
		nodeFontStyle.setFontName(fontData.getName());
		nodeFontStyle.setFontHeight(fontData.getHeight());
		nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
		nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
		org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore,
				IPreferenceConstants.PREF_FONT_COLOR);
		nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
	}
	org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(prefStore,
			IPreferenceConstants.PREF_FILL_COLOR);
	ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getFillStyle_FillColor(),
			FigureUtilities.RGBToInteger(fillRGB));
	Node label5092 = createLabel(node, ProcessVisualIDRegistry.getType(CallActivityNameEditPart.VISUAL_ID));
	return node;
}
 
Example #16
Source File: ProcBuilder.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void addPool(String id, final String name, final String version, final Point location, final Dimension size) throws ProcBuilderException {

    if (diagramPart == null) {
        throw new ProcBuilderException("Impossible to add Pool outside a diagram");
    }

    id = NamingUtils.convertToId(id);
    final ViewAndElementDescriptor viewDescriptor = new ViewAndElementDescriptor(new CreateElementRequestAdapter(new CreateElementRequest(
            ProcessElementTypes.Pool_2007)), Node.class,
            ((IHintedType) ProcessElementTypes.Pool_2007).getSemanticHint(), diagramPart.getDiagramPreferencesHint());
    final CreateViewAndElementRequest createRequest = createCreationRequest(
            location, size, viewDescriptor);
    diagramPart.getDiagramEditDomain().getDiagramCommandStack().execute(diagramPart.getCommand(createRequest));

    final Node newNode = (Node) viewDescriptor.getAdapter(Node.class);
    final Pool pool = (Pool) newNode.getElement();
    commandStack.append(SetCommand.create(editingDomain, pool, ProcessPackage.eINSTANCE.getElement_Name(), name));
    commandStack.append(SetCommand.create(editingDomain, pool, ProcessPackage.eINSTANCE.getAbstractProcess_Version(), version));

    if (size != null) {
        commandStack.append(SetCommand.create(editingDomain, newNode.getLayoutConstraint(), NotationPackage.eINSTANCE.getSize_Width(), size.width));
        commandStack.append(SetCommand.create(editingDomain, newNode.getLayoutConstraint(), NotationPackage.eINSTANCE.getSize_Height(), size.height));
    }
    commandStack.append(SetCommand.create(editingDomain, newNode.getStyle(NotationPackage.eINSTANCE.getLineStyle()),
            NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.colorToInteger(ColorConstants.lightGray)));

    processIds.put(pool, id);
    processes.put(id, pool);
    currentContainer = pool;
    currentStep = pool;
    currentElement = pool;
    currentView = newNode;
    execute();
}
 
Example #17
Source File: CustomProcessViewProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node createPool_2007(final EObject domainElement, final View containerView,
        final int index, final boolean persisted, final PreferencesHint preferencesHint) {
    final Node node = super.createPool_2007(domainElement, containerView, index, persisted, preferencesHint);
    node.getStyles().add(NotationFactory.eINSTANCE.createFillStyle());
    final Size layoutConstraint = (Size) node.getLayoutConstraint();
    if (layoutConstraint.getWidth() <= 0) {
        int defaultInt = ((IPreferenceStore) preferencesHint.getPreferenceStore()).getDefaultInt("poolDefaultWidth");
        layoutConstraint.setWidth(defaultInt > 0 ? defaultInt : CustomPoolEditPart.getDefaultWidth());
        layoutConstraint.setHeight(CustomPoolEditPart.CONSTANT_DEFAULT_HEIGHT);
    }
    return node;
}
 
Example #18
Source File: CustomProcessViewProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node createScriptTask_3028(final EObject domainElement,
        final View containerView, final int index, final boolean persisted,
        final PreferencesHint preferencesHint) {
    final Node node = super.createScriptTask_3028(domainElement, containerView, index,
            persisted, preferencesHint);
    ((FillStyle) node.getStyle(NotationPackage.eINSTANCE.getFillStyle())).setFillColor(new RGB(184, 185, 218).hashCode());
    ((LineStyle) node.getStyle(NotationPackage.eINSTANCE.getLineStyle())).setLineColor(new RGB(44, 109, 163).hashCode());
    return node;
}
 
Example #19
Source File: ProcessViewProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public Node createIntermediateThrowSignalEvent_3022(EObject domainElement, View containerView, int index,
		boolean persisted, PreferencesHint preferencesHint) {
	Shape node = NotationFactory.eINSTANCE.createShape();
	node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
	node.setType(ProcessVisualIDRegistry.getType(IntermediateThrowSignalEvent2EditPart.VISUAL_ID));
	ViewUtil.insertChildView(containerView, node, index, persisted);
	node.setElement(domainElement);
	// initializeFromPreferences 
	final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

	org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore,
			IPreferenceConstants.PREF_LINE_COLOR);
	ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getLineStyle_LineColor(),
			FigureUtilities.RGBToInteger(lineRGB));
	FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
	if (nodeFontStyle != null) {
		FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
		nodeFontStyle.setFontName(fontData.getName());
		nodeFontStyle.setFontHeight(fontData.getHeight());
		nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
		nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
		org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore,
				IPreferenceConstants.PREF_FONT_COLOR);
		nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
	}
	org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(prefStore,
			IPreferenceConstants.PREF_FILL_COLOR);
	ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getFillStyle_FillColor(),
			FigureUtilities.RGBToInteger(fillRGB));
	Node label5037 = createLabel(node,
			ProcessVisualIDRegistry.getType(IntermediateThrowSignalEventLabel2EditPart.VISUAL_ID));
	label5037.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
	Location location5037 = (Location) label5037.getLayoutConstraint();
	location5037.setX(0);
	location5037.setY(5);
	return node;
}
 
Example #20
Source File: ProcessViewProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public Node createTask_3005(EObject domainElement, View containerView, int index, boolean persisted,
		PreferencesHint preferencesHint) {
	Shape node = NotationFactory.eINSTANCE.createShape();
	node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
	node.setType(ProcessVisualIDRegistry.getType(Task2EditPart.VISUAL_ID));
	ViewUtil.insertChildView(containerView, node, index, persisted);
	node.setElement(domainElement);
	// initializeFromPreferences 
	final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

	org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore,
			IPreferenceConstants.PREF_LINE_COLOR);
	ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getLineStyle_LineColor(),
			FigureUtilities.RGBToInteger(lineRGB));
	FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
	if (nodeFontStyle != null) {
		FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
		nodeFontStyle.setFontName(fontData.getName());
		nodeFontStyle.setFontHeight(fontData.getHeight());
		nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
		nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
		org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore,
				IPreferenceConstants.PREF_FONT_COLOR);
		nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
	}
	org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(prefStore,
			IPreferenceConstants.PREF_FILL_COLOR);
	ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getFillStyle_FillColor(),
			FigureUtilities.RGBToInteger(fillRGB));
	Node label5005 = createLabel(node, ProcessVisualIDRegistry.getType(TaskName2EditPart.VISUAL_ID));
	return node;
}
 
Example #21
Source File: GroupStatesIntoCompositeRefactoring.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
protected void moveSelectedStateNodesTo(View containerView, Bounds compositeBounds) {

		for (GraphicalEditPart editPart : getContextObjects()) {
			Node stateNode = (Node)editPart.getNotationView();
			ViewUtil.insertChildView(containerView, stateNode, ViewUtil.APPEND, true);
			Bounds newBounds = NotationFactory.eINSTANCE.createBounds();
			Bounds oldBounds = (Bounds)stateNode.getLayoutConstraint();
			newBounds.setX(oldBounds.getX() - compositeBounds.getX() - 7); //FIXME use bounds of region view
			newBounds.setY(oldBounds.getY() - compositeBounds.getY() - 34); //FIXME use bounds of region view
			
			((Node)editPart.getNotationView()).setLayoutConstraint(newBounds);
		}
	}
 
Example #22
Source File: ProcessViewProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public Node createIntermediateCatchTimerEvent_3017(EObject domainElement, View containerView, int index,
		boolean persisted, PreferencesHint preferencesHint) {
	Shape node = NotationFactory.eINSTANCE.createShape();
	node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
	node.setType(ProcessVisualIDRegistry.getType(IntermediateCatchTimerEvent2EditPart.VISUAL_ID));
	ViewUtil.insertChildView(containerView, node, index, persisted);
	node.setElement(domainElement);
	// initializeFromPreferences 
	final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

	org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore,
			IPreferenceConstants.PREF_LINE_COLOR);
	ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getLineStyle_LineColor(),
			FigureUtilities.RGBToInteger(lineRGB));
	FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
	if (nodeFontStyle != null) {
		FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
		nodeFontStyle.setFontName(fontData.getName());
		nodeFontStyle.setFontHeight(fontData.getHeight());
		nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
		nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
		org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore,
				IPreferenceConstants.PREF_FONT_COLOR);
		nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
	}
	org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(prefStore,
			IPreferenceConstants.PREF_FILL_COLOR);
	ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getFillStyle_FillColor(),
			FigureUtilities.RGBToInteger(fillRGB));
	Node label5032 = createLabel(node,
			ProcessVisualIDRegistry.getType(IntermediateCatchTimerEventLabel2EditPart.VISUAL_ID));
	label5032.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
	Location location5032 = (Location) label5032.getLayoutConstraint();
	location5032.setX(0);
	location5032.setY(5);
	return node;
}
 
Example #23
Source File: GroupStatesIntoCompositeRefactoring.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
protected void doGraphicalRefactoring() {
	Node compositeStateView = createNodeForCompositeState(compositeState);
	Node innerRegionNode = ViewService.createNode(
			getStateFigureCompartmentView(compositeStateView), innerRegion,
			SemanticHints.REGION, preferencesHint);
	
	View regionCompartment = ViewUtil.getChildBySemanticHint(innerRegionNode, SemanticHints.REGION_COMPARTMENT);
	moveSelectedStateNodesTo(regionCompartment, (Bounds)compositeStateView.getLayoutConstraint());
}
 
Example #24
Source File: CustomProcessViewProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node createServiceTask_3027(final EObject domainElement,
        final View containerView, final int index, final boolean persisted,
        final PreferencesHint preferencesHint) {
    final Node node = super.createServiceTask_3027(domainElement, containerView, index,
            persisted, preferencesHint);
    ((FillStyle) node.getStyle(NotationPackage.eINSTANCE.getFillStyle())).setFillColor(new RGB(184, 185, 218).hashCode());
    ((LineStyle) node.getStyle(NotationPackage.eINSTANCE.getLineStyle())).setLineColor(new RGB(44, 109, 163).hashCode());
    return node;
}
 
Example #25
Source File: CustomProcessViewProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Node createSendTask_2026(final EObject domainElement, final View containerView,
        final int index, final boolean persisted, final PreferencesHint preferencesHint) {
    final Node node = super.createSendTask_2026(domainElement, containerView, index,
            persisted, preferencesHint);
    ((FillStyle) node.getStyle(NotationPackage.eINSTANCE.getFillStyle())).setFillColor(new RGB(184, 185, 218).hashCode());
    ((LineStyle) node.getStyle(NotationPackage.eINSTANCE.getLineStyle())).setLineColor(new RGB(44, 109, 163).hashCode());
    return node;
}
 
Example #26
Source File: ExtractSubdiagramRefactoring.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
protected Rectangle getActualBounds(Node child) {
	IEditorPart lastActiveEditor = ActiveEditorTracker.getLastActiveEditor();
	if (lastActiveEditor instanceof StatechartDiagramEditor) {
		IDiagramGraphicalViewer viewer = ((StatechartDiagramEditor) lastActiveEditor).getDiagramGraphicalViewer();
		IGraphicalEditPart editPart = (IGraphicalEditPart) viewer.getEditPartRegistry().get(child);
		return editPart.getFigure().getBounds();
	}
	return Rectangle.SINGLETON;
}
 
Example #27
Source File: ExtractSubdiagramRefactoring.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
protected void createExitPoint(Edge edge, Diagram subdiagram) {
	Transition transition = (Transition) edge.getElement();
	// create semantic exit point
	Region exitPointContainer = getExitPointContainer(transition);
	Exit exitPoint = createSemanticExitPoint(transition);

	// create node for exit point
	View exitPointContainerView = helper.getViewForSemanticElement(exitPointContainer, subdiagram);
	View exitPointRegionCompartment = ViewUtil.getChildBySemanticHint(exitPointContainerView,
			SemanticHints.REGION_COMPARTMENT);
	Node exitNode = ViewService.createNode(exitPointRegionCompartment, exitPoint, SemanticHints.EXIT,
			preferencesHint);

	// re-wire existing transition to new exit point
	Vertex oldTransitionTarget = transition.getTarget();
	transition.setTarget(exitPoint);
	View oldEdgeTarget = edge.getTarget();
	edge.setTarget(exitNode);

	// create transition from selected state to former transition target
	Transition exitPointTransition = SGraphFactory.eINSTANCE.createTransition();
	exitPointTransition.setSource((State) subdiagram.getElement());
	exitPointTransition.setTarget(oldTransitionTarget);
	ViewService.createEdge(getContextObject(), oldEdgeTarget, exitPointTransition, SemanticHints.TRANSITION,
			preferencesHint);

	addExitPointSpec(exitPointTransition, exitPoint);
}
 
Example #28
Source File: ProcessViewProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public Node createEndErrorEvent_3050(EObject domainElement, View containerView, int index, boolean persisted,
		PreferencesHint preferencesHint) {
	Shape node = NotationFactory.eINSTANCE.createShape();
	node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
	node.setType(ProcessVisualIDRegistry.getType(EndErrorEvent2EditPart.VISUAL_ID));
	ViewUtil.insertChildView(containerView, node, index, persisted);
	node.setElement(domainElement);
	// initializeFromPreferences 
	final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

	org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore,
			IPreferenceConstants.PREF_LINE_COLOR);
	ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getLineStyle_LineColor(),
			FigureUtilities.RGBToInteger(lineRGB));
	FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
	if (nodeFontStyle != null) {
		FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
		nodeFontStyle.setFontName(fontData.getName());
		nodeFontStyle.setFontHeight(fontData.getHeight());
		nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
		nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
		org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore,
				IPreferenceConstants.PREF_FONT_COLOR);
		nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
	}
	org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(prefStore,
			IPreferenceConstants.PREF_FILL_COLOR);
	ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getFillStyle_FillColor(),
			FigureUtilities.RGBToInteger(fillRGB));
	Node label5052 = createLabel(node, ProcessVisualIDRegistry.getType(EndErrorEventLabel2EditPart.VISUAL_ID));
	label5052.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
	Location location5052 = (Location) label5052.getLayoutConstraint();
	location5052.setX(0);
	location5052.setY(5);
	return node;
}
 
Example #29
Source File: ProcessViewProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public Node createStartSignalEvent_3023(EObject domainElement, View containerView, int index, boolean persisted,
		PreferencesHint preferencesHint) {
	Shape node = NotationFactory.eINSTANCE.createShape();
	node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
	node.setType(ProcessVisualIDRegistry.getType(StartSignalEvent2EditPart.VISUAL_ID));
	ViewUtil.insertChildView(containerView, node, index, persisted);
	node.setElement(domainElement);
	// initializeFromPreferences 
	final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

	org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore,
			IPreferenceConstants.PREF_LINE_COLOR);
	ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getLineStyle_LineColor(),
			FigureUtilities.RGBToInteger(lineRGB));
	FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
	if (nodeFontStyle != null) {
		FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
		nodeFontStyle.setFontName(fontData.getName());
		nodeFontStyle.setFontHeight(fontData.getHeight());
		nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
		nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
		org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore,
				IPreferenceConstants.PREF_FONT_COLOR);
		nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
	}
	org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(prefStore,
			IPreferenceConstants.PREF_FILL_COLOR);
	ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getFillStyle_FillColor(),
			FigureUtilities.RGBToInteger(fillRGB));
	Node label5038 = createLabel(node, ProcessVisualIDRegistry.getType(StartSignalEventLabel2EditPart.VISUAL_ID));
	label5038.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
	Location location5038 = (Location) label5038.getLayoutConstraint();
	location5038.setX(0);
	location5038.setY(5);
	return node;
}
 
Example #30
Source File: ProcessViewProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
public Node createIntermediateCatchSignalEvent_3021(EObject domainElement, View containerView, int index,
		boolean persisted, PreferencesHint preferencesHint) {
	Shape node = NotationFactory.eINSTANCE.createShape();
	node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
	node.setType(ProcessVisualIDRegistry.getType(IntermediateCatchSignalEvent2EditPart.VISUAL_ID));
	ViewUtil.insertChildView(containerView, node, index, persisted);
	node.setElement(domainElement);
	// initializeFromPreferences 
	final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

	org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore,
			IPreferenceConstants.PREF_LINE_COLOR);
	ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getLineStyle_LineColor(),
			FigureUtilities.RGBToInteger(lineRGB));
	FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
	if (nodeFontStyle != null) {
		FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
		nodeFontStyle.setFontName(fontData.getName());
		nodeFontStyle.setFontHeight(fontData.getHeight());
		nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
		nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
		org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore,
				IPreferenceConstants.PREF_FONT_COLOR);
		nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
	}
	org.eclipse.swt.graphics.RGB fillRGB = PreferenceConverter.getColor(prefStore,
			IPreferenceConstants.PREF_FILL_COLOR);
	ViewUtil.setStructuralFeatureValue(node, NotationPackage.eINSTANCE.getFillStyle_FillColor(),
			FigureUtilities.RGBToInteger(fillRGB));
	Node label5036 = createLabel(node,
			ProcessVisualIDRegistry.getType(IntermediateCatchSignalEventLabel2EditPart.VISUAL_ID));
	label5036.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
	Location location5036 = (Location) label5036.getLayoutConstraint();
	location5036.setX(0);
	location5036.setY(5);
	return node;
}