Ejemplo n.º 1
0
  @Override
  protected IFigure createFigure() {
    Figure f = new FreeformViewport();
    ToolbarLayout tb = new AnimationLayoutManager(true);
    tb.setSpacing(30);
    tb.setStretchMinorAxis(false);
    f.setLayoutManager(tb);
    f.setBorder(
        new MarginBorder(
            DiagramModel.TOP_MARGIN,
            DiagramModel.SIDE_MARGIN,
            DiagramModel.BOTTOM_MARGIN,
            DiagramModel.SIDE_MARGIN));
    f.addMouseMotionListener(this);
    f.setBackgroundColor(ColorScheme.diagramBackground);
    IFigure label =
        new Label(
            " \n Drag classes or methods from the Package Explorer "
                + "into the diagram to explore and understand code."
                + "\n Or, use the expandable Palette on the right side of the diagram "
                + "to design.");
    this.nonEmptyFigure = new NonEmptyFigure(label);
    NonEmptyFigureSupport.instructionHighlight(label, 10);
    f.add(nonEmptyFigure);

    warning = new Label("");
    warning.setLayoutManager(new ToolbarLayout());
    NonEmptyFigureSupport.instructionHighlight(warning, 10);
    f.add(warning);
    return f;
  }
Ejemplo n.º 2
0
  @Override
  public void activate() {
    if (isActive()) return;
    super.activate();
    Value detailLevel = null;
    try {
      detailLevel =
          ((RepositoryMgr) ((RootArtifact) getModel()).getRepo())
              .getFileRepo()
              .getStatement(RSECore.createRseUri("DetailNode"), RSECore.detailLevelURI, null)
              .getObject();
    } catch (Throwable t) {

    }
    if (detailLevel != null) {
      ((RootArtifact) getModel())
          .setDetailLevel(Integer.valueOf(((Literal) detailLevel).getLabel()));
    }

    DiagramModel diagramModel = ((DiagramModel) getModel());
    diagramModel.addPropertyChangeListener(this);
    NonEmptyFigureSupport.listenToModel((ArtifactFragment) getModel(), nonEmptyFigure);
    getViewer().getEditDomain().getCommandStack().addCommandStackEventListener(stackEventListener);
    addInstancePanel();

    if (diagramModel.getRepo() != null && diagramModel.getSavedDiagramResource() != null) {
      // Use the file repo to get the information
      ReloRdfRepository repo = diagramModel.getRepo().getFileRepo();
      Map<Resource, ArtifactFragment> instanceRes2AFMap = new HashMap<Resource, ArtifactFragment>();
      instanceResToAF = new HashMap<Resource, ArtifactFragment>();
      addSavedContainee(
          diagramModel, diagramModel.getSavedDiagramResource(), instanceRes2AFMap, repo);
      addSavedControlFlows(
          diagramModel, diagramModel.getSavedDiagramResource(), instanceRes2AFMap, repo);
      addSavedConnections(diagramModel, instanceRes2AFMap, repo);
    }
  }