Ejemplo n.º 1
0
  private void setRuler(RulerProvider provider, int orientation) {
    Object ruler = null;
    if (isRulerVisible && provider != null)
      // provider.getRuler() might return null (at least the API does not
      // prevent that)
      ruler = provider.getRuler();

    if (ruler == null) {
      // Ruler is not visible or is not present
      setRulerContainer(null, orientation);
      // Layout right-away to prevent an empty control from showing
      layout(true);
      return;
    }

    GraphicalViewer container = getRulerContainer(orientation);
    if (container == null) {
      container = createRulerContainer(orientation);
      setRulerContainer(container, orientation);
    }
    if (container.getContents() != ruler) {
      container.setContents(ruler);
      needToLayout = true;
      Display.getCurrent().asyncExec(runnable);
    }
  }
Ejemplo n.º 2
0
  private void refreshGraphicalViewer() {
    IEditorInput input = getEditorInput();
    if (input instanceof IFileEditorInput) {
      try {
        IFile file = ((IFileEditorInput) input).getFile();
        GraphicalViewer viewer = getGraphicalViewer();

        // desirialize
        RootModel newRoot = null;
        try {
          newRoot = DiagramSerializer.deserialize(file.getContents());
        } catch (Exception ex) {
          UMLPlugin.logException(ex);
          return;
        }

        // copy to editing model
        RootModel root = (RootModel) viewer.getContents().getModel();
        root.copyFrom(newRoot);

      } catch (Exception ex) {
        UMLPlugin.logException(ex);
      }
    }
  }
  /** {@inheritDoc} */
  @Override
  public void doTask(ERDiagram diagram) throws Exception {
    this.outputDir = getAbsolutePath(this.outputDir);
    this.outputDir = this.outputDir + "/dbdocs/";

    this.log("Output to : " + this.outputDir);

    // 出力ディレクトリの削除
    File dir = new File(outputDir);
    FileUtils.deleteDirectory(dir);

    dir = new File(outputDir + "image");
    dir.mkdirs();

    String outputImageFilePath = this.outputDir + "image/er.png";

    this.log("Output image to : " + outputImageFilePath);

    Image img = null;
    GraphicalViewer viewer = null;

    try {
      viewer = Activator.createGraphicalViewer(diagram);

      int format = ExportToImageAction.getFormatType(outputImageFilePath);

      img = Activator.createImage(viewer);

      ExportToImageManager exportToImageManager =
          new ExportToImageManager(img, format, outputImageFilePath);
      exportToImageManager.doProcess();

      Map<TableView, Location> tableLocationMap =
          ExportToHtmlAction.getTableLocationMap(viewer, diagram);

      ExportToHtmlManager reportManager =
          new ExportToHtmlManager(this.outputDir, diagram, tableLocationMap);

      this.log("Output html beginning...");

      reportManager.doProcess();

    } finally {
      if (viewer != null) {
        viewer.getContents().deactivate();
      }
      if (img != null) {
        img.dispose();
      }
    }
  }