Пример #1
0
  @Override
  public boolean performFinish() {
    IContainer c = Project.findContainerByPath(null, page.getContainerFullPath());
    if (c != null) {
      try {
        final IFile sorFile = c.getFile(new Path(page.getFileName()));
        IOAdapter io = new IOAdapter();
        SortSetXMLSaver r = new SortSetXMLSaver().setModel(new SortSet());

        r.setFile(new EclipseFileWrapper(sorFile))
            .setOutputStream(io.getOutputStream())
            .exportObject();
        Project.setContents(
            sorFile,
            io.getInputStream(),
            new Callback() {
              @Override
              public void onSuccess() {
                try {
                  UI.openInEditor(sorFile);
                } catch (PartInitException pie) {
                  /* ? */
                  pie.printStackTrace();
                }
              }
            });

        return true;
      } catch (SaveFailedException e) {
        page.setErrorMessage(e.getLocalizedMessage());
      }
    }
    return false;
  }
Пример #2
0
  protected static void createBigraph(IFile sigFile, IFile bigFile)
      throws LoadFailedException, SaveFailedException, CoreException {
    IOAdapter io = new IOAdapter();
    BRS b = new BRS();

    b.setSignature((Signature) new EclipseFileWrapper(sigFile).load());
    BRSXMLSaver r = new BRSXMLSaver();
    r.setFile(new EclipseFileWrapper(bigFile))
        .setModel(b)
        .setOutputStream(io.getOutputStream())
        .exportObject();
    bigFile.setContents(io.getInputStream(), 0, null);
  }