Examples of IGaService


Examples of org.eclipse.graphiti.services.IGaService

     * @param gaContainer
     * @return
     */
    private Polyline createArrow(GraphicsAlgorithmContainer gaContainer) {

      IGaService gaService = Graphiti.getGaService();
      Polyline polyline = gaService.createPolygon(
          gaContainer, new int[] { -9, 6, 0, 0, -9, -6 });
      polyline.setForeground(manageColor(IColorConstant.BLACK));
      polyline.setBackground(manageColor(IColorConstant.BLACK));
      polyline.setLineWidth(1);

View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

    // check whether the context has a size (e.g. from a create feature)
    // otherwise define a default size for the shape
    int width = context.getWidth() <= 0 ? 180 : context.getWidth();
    int height = context.getHeight() <= 0 ? 24 : context.getHeight();

    IGaService gaService = Graphiti.getGaService();

    {
      // create and set graphics algorithm
      RoundedRectangle roundedRectangle =
          gaService.createRoundedRectangle(containerShape, 5, 5);
      roundedRectangle.setStyle(StyleUtil.getStyleForLiteral(getDiagram()));
      gaService.setLocationAndSize(roundedRectangle,
          context.getX() + 10, context.getY() + 10, width, height);

      //Don't think this should happen, but want to check
      if (addedObj.eResource() == null) {
        Activator.logInfo("Literal has no resource");
      }

      // create link and wire it
      link(containerShape, addedObj);
    }


    // SHAPE WITH TEXT
    {
      // create shape for text
      Shape shape = peCreateService.createShape(containerShape, false);

      // create and set text graphics algorithm
      MultiText text = gaService.createDefaultMultiText(
          getDiagram(), shape, Utility.getLiteralValue(addedObj));
      text.setStyle(StyleUtil.getStyleForText(getDiagram()));
      text.setHorizontalAlignment(Orientation.ALIGNMENT_LEFT);
      text.setVerticalAlignment(Orientation.ALIGNMENT_TOP);
 
      gaService.setLocationAndSize(text, 0, 0, width, 20);

      // create link and wire it
      link(shape, addedObj);
    }
    return containerShape;
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

  public static Style getStyleForEClass(Diagram diagram) {
    final String styleId = "E-CLASS"; //$NON-NLS-1$

    Style style = findStyle(diagram, styleId);

    IGaService gaService = Graphiti.getGaService();
    if (style == null) { // style not found - create new style
      style = gaService.createStyle(diagram, styleId);
      style.setForeground(gaService.manageColor(diagram, E_CLASS_FOREGROUND));
      if (USE_GRADIENT_BACKGROUND) {
        gaService.setRenderingStyle(style, E_CLASS_GRADIENT);
      } else {
        style.setBackground(gaService.manageColor(diagram, E_CLASS_BACKGROUND));
      }
      style.setFilled(true);
      style.setLineWidth(2);
    }
    return style;
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

  public static Style getStyleForCamelClass(Diagram diagram) {
    final String styleId = "FUSE-CAMEL-NODE"; //$NON-NLS-1$

    Style style = findStyle(diagram, styleId);

    IGaService gaService = Graphiti.getGaService();
    if (style == null) { // style not found - create new style
      style = gaService.createStyle(diagram, styleId);
      style.setForeground(gaService.manageColor(diagram, E_CLASS_FOREGROUND));
      if (USE_GRADIENT_BACKGROUND) {
        gaService.setRenderingStyle(style, E_CLASS_GRADIENT);
      } else {
        style.setBackground(gaService.manageColor(diagram, E_CLASS_BACKGROUND));
      }
      style.setFilled(true);
      style.setLineWidth(2);
    }
    return style;
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

  public static Style getShadowStyleForCamelClass(Diagram diagram) {
    final String styleId = "FUSE-CAMEL-NODE-SHADOW"; //$NON-NLS-1$

    Style style = findStyle(diagram, styleId);

    IGaService gaService = Graphiti.getGaService();
    if (style == null) { // style not found - create new style
      style = gaService.createStyle(diagram, styleId);
      style.setForeground(gaService.manageColor(diagram, E_CLASS_SHADOW_FOREGROUND));
      style.setBackground(gaService.manageColor(diagram, E_CLASS_SHADOW_BACKGROUND));
      style.setFilled(true);
      style.setLineWidth(2);
    }
    return style;
  }
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

  }

  public static Style getStyleForCamelText(Diagram diagram) {
    final String styleId = "FUSE-CAMEL-NODE-TEXT"; //$NON-NLS-1$

    IGaService gaService = Graphiti.getGaService();

    // this is a child style of the e-class-style
    Style parentStyle = getStyleForEClass(diagram);
    Style style = null;
    if (parentStyle == null) {
      style = gaService.createStyle(diagram, styleId);
    } else {
      style = findStyle(parentStyle, styleId);
    }

    if (style == null) { // style not found - create new style
      style = gaService.createStyle(getStyleForEClass(diagram), styleId);
      // "overwrites" values from parent style
      style.setForeground(gaService.manageColor(diagram, E_CLASS_TEXT_FOREGROUND));
    }
    style.setFont(gaService.manageFont(diagram, DEFAULT_FONT, DEFAULT_FONT_SIZE, false, true));

    return style;
  }
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

  public static Style getStyleForPolygon(Diagram diagram) {
    final String styleId = "FUSE-CAMEL-POLYGON-ARROW"; //$NON-NLS-1$

    Style style = findStyle(diagram, styleId);
    IGaService gaService = Graphiti.getGaService();

    if (style == null) { // style not found - create new style
      style = gaService.createStyle(diagram, styleId);
      style.setForeground(gaService.manageColor(diagram, getColorConstant(PreferenceManager.getInstance().loadPreferenceAsString(PreferencesConstants.EDITOR_CONNECTION_COLOR))));
      style.setBackground(gaService.manageColor(diagram, getColorConstant(PreferenceManager.getInstance().loadPreferenceAsString(PreferencesConstants.EDITOR_CONNECTION_COLOR))));
      style.setLineWidth(1);
    }
    return style;
  }
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

    }

    // width of text and line (same as visible rectangle)
    for (Shape shape : containerShape.getChildren()) {
      GraphicsAlgorithm graphicsAlgorithm = shape.getGraphicsAlgorithm();
      IGaService gaService = Graphiti.getGaService();
      IDimension size = gaService.calculateSize(graphicsAlgorithm);
      if (rectangleWidth != size.getWidth()) {
        gaService.setWidth(graphicsAlgorithm, rectangleWidth);
        anythingChanged = true;
      }
    }

    return anythingChanged;
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

    // CONNECTION WITH POLYLINE
    Connection connection = peCreateService.createFreeFormConnection(getDiagram());
    connection.setStart(addConContext.getSourceAnchor());
    connection.setEnd(addConContext.getTargetAnchor());
   
    IGaService gaService = Graphiti.getGaService();
    Polyline polyline = gaService.createPolyline(connection);
    polyline.setStyle(StyleUtil.getStyleForEClass(getDiagram()));
    polyline.setForeground(manageColor(StyleUtil.getColorConstant(PreferenceManager.getInstance().loadPreferenceAsString(PreferencesConstants.EDITOR_CONNECTION_COLOR))));

    // create link and wire it
    link(connection, addedEReference);

    // add dynamic text decorator for the reference name
    ConnectionDecorator textDecorator = peCreateService.createConnectionDecorator(connection, true, 0.5, true);
    Text text = gaService.createDefaultText(getDiagram(), getDiagram().getGraphicsAlgorithm());
    textDecorator.setConnection(connection);
    text.setStyle(StyleUtil.getStyleForCamelText((getDiagram())));
    gaService.setLocation(text, 10, 0);
    // set reference name in the text decorator
    Flow flow = (Flow) context.getNewObject();
    text.setValue(flow.getName());
   
    // add static graphical decorators (composition and navigable)
View Full Code Here

Examples of org.eclipse.graphiti.services.IGaService

    if (pe == null) {
      Activator.getLogger().debug("Warning could not find PictogramElement for highlight node: " + node);
      return;
    }
   
    IGaService gaService = Graphiti.getGaService();
   
    try {
      if (pe instanceof ContainerShape) {
        ContainerShape cs = (ContainerShape) pe;
        if (highlight) {
          cs.getGraphicsAlgorithm().setLineVisible(true);
          cs.getGraphicsAlgorithm().setLineStyle(LineStyle.DASH);
          cs.getGraphicsAlgorithm().setLineWidth(cs.getGraphicsAlgorithm().getLineWidth() + 3);
          cs.getGraphicsAlgorithm().setForeground(gaService.manageColor(designEditor.getDiagram(), StyleUtil.getColorConstant("255,0,0")));
        } else {
          cs.getGraphicsAlgorithm().setLineVisible(false);
          cs.getGraphicsAlgorithm().setLineStyle(LineStyle.SOLID);
          cs.getGraphicsAlgorithm().setLineWidth(cs.getGraphicsAlgorithm().getLineWidth() - 3);
          cs.getGraphicsAlgorithm().setForeground(gaService.manageColor(designEditor.getDiagram(), StyleUtil.E_CLASS_FOREGROUND));
        }
       
        for (Shape shape : cs.getChildren()) {
          if (shape.getGraphicsAlgorithm() instanceof Text) {
            Text text = (Text) shape.getGraphicsAlgorithm();

            // now update node highlight
            if (highlight) {
              // set highlight
              text.setForeground(gaService.manageColor(designEditor.getDiagram(), StyleUtil.getColorConstant("255,0,0")));
            } else {
              // delete highlight
              text.setForeground(gaService.manageColor(designEditor.getDiagram(), StyleUtil.E_CLASS_TEXT_FOREGROUND));
            }
          }
        }
      }       
    } catch (Exception e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.