@Override
  public void createPartControl(Composite parent) {
    Control[] childern = parent.getChildren();
    for (Control control : childern) {
      control.setVisible(false);
    }
    form = new SashForm(parent, 512);
    form.setLayout(new FillLayout());
    folder = new TabFolder(form, 128);
    // theConjectures = new ValidationTable(form, this);
    // form.setWeights(new int[] { 85, 15 });
    theArch = new GenericTabItem("Architecture overview", folder, AllowedOverrunDirection.Both);
    theOverview =
        new GenericTabItem("Execution overview", folder, AllowedOverrunDirection.Vertical);
    cw.clear();
    IFile file = null;
    try {

      file = ((FileEditorInput) getEditorInput()).getFile();

      FileUtility.deleteMarker(file, null, TracefileViewerPlugin.PLUGIN_ID);

      theMarkers = new TracefileMarker(file);

      if (FileUtility.getContent(file).size() == 0) {
        ErrorDialog.openError(
            getSite().getShell(), "Editor open", "File is empty", Status.CANCEL_STATUS);
        return;
      }

    } catch (Exception e) {
      TracefileViewerPlugin.log(e);
    } catch (OutOfMemoryError m) {
      showMessage(
          "The trace file can not be visualized because the Java Virtual Machine ran out of heap space. Try to allow Overture more heap space using Virtual Machine custom arguments (e.g. -Xms40m -Xmx512m).");
      return;
    }

    try {
      parseFile(selectedFile.getAbsolutePath());
    } catch (Exception e) {
      TracefileViewerPlugin.log(e);
    }
    openValidationConjectures(file);
  }
 private void openValidationConjectures(IFile editorInputFile) {
   IPath p = new Path(editorInputFile.getName());
   p = p.addFileExtension("vtc");
   IFile vtcFile = editorInputFile.getParent().getFile(p);
   if (vtcFile.exists()) {
     try {
       ValidationConjecturesView v = getValidationConjecturesView();
       if (v != null) {
         conjectureData.clear();
         v.initializeLink(new InputStreamReader(vtcFile.getContents()), this);
         updateOverviewPage();
       }
     } catch (PartInitException e) {
       TracefileViewerPlugin.log(e);
     } catch (CoreException e) {
       TracefileViewerPlugin.log(e);
     }
   }
 }
  private void parseFile(final String fname) {

    Shell shell = super.getSite().getShell();

    try {
      IRunnableWithProgress op =
          new IRunnableWithProgress() {

            public void run(IProgressMonitor monitor)
                throws InvocationTargetException, InterruptedException {
              doParse(fname, monitor);
            }
          };
      new ProgressMonitorDialog(shell).run(false, true, op);
    } catch (InvocationTargetException e) {
      TracefileViewerPlugin.log(e);

    } catch (InterruptedException e) {
      TracefileViewerPlugin.log(e);
    }
  }
  /*
   * (non-Javadoc)
   * @see org.overture.ide.plugins.rttraceviewer.viewer.IViewCallback#updateOverviewPage ()
   */
  public void updateOverviewPage() {
    try {
      theOverview.disposeFigures();
      traceRunner.drawOverview(theOverview, new Long(currentTime));

      for (Long cpu : cpuTabs.keySet()) {
        GenericTabItem tab = cpuTabs.get(cpu);
        tab.disposeFigures();
        traceRunner.drawCpu(tab, cpu, new Long(currentTime));
      }

    } catch (Exception e) {
      TracefileViewerPlugin.log(e);
    }
  }
  void openValidationConjectures() {
    FileDialog fDlg = new FileDialog(getSite().getShell());
    String valFileName = fDlg.open();

    ValidationConjecturesView v = getValidationConjecturesView();
    if (v != null) {
      conjectureData.clear();
      try {
        v.initializeLink(new FileReader(valFileName), this);
      } catch (FileNotFoundException e) {
        TracefileViewerPlugin.log(e);
      }
      updateOverviewPage();
    }
  }
  @Override
  public void dispose() {

    try {
      ValidationConjecturesView v = getValidationConjecturesView();
      if (v != null) {
        v.unlink(this);
      }

      theOverview.disposeFigures();
      if (theMarkers != null) {
        theMarkers.dispose();
      }

    } catch (Exception e) {
      TracefileViewerPlugin.log(e);
    }
  }
 private ValidationConjecturesView getValidationConjecturesView() {
   IViewPart v;
   try {
     if (PlatformUI.getWorkbench().isClosing()) {
       return null;
     }
     v =
         PlatformUI.getWorkbench()
             .getActiveWorkbenchWindow()
             .getActivePage()
             .showView(IRealTimeTaceViewer.CONJECTURE_VIEW_ID);
     if (v instanceof ValidationConjecturesView) {
       return (ValidationConjecturesView) v;
     }
   } catch (CoreException e) {
     TracefileViewerPlugin.log(e);
   }
   return null;
 }
  private void createTabPages() {
    try {
      traceRunner.drawArchitecture(theArch);
      traceRunner.drawOverview(theOverview, new Long(currentTime));
      canExportJpg = true;
      canMoveHorizontal = true;
      canOpenValidation = true;
      Vector<Long> theCpus = traceRunner.getCpuIds();

      cpuTabs.clear();

      for (Long cpu : theCpus) {
        String cpuName = traceRunner.getCpuName(cpu);
        GenericTabItem theDetail =
            new GenericTabItem(cpuName, folder, AllowedOverrunDirection.Horizontal);
        traceRunner.drawCpu(theDetail, cpu, new Long(currentTime));
        cpuTabs.put(cpu, theDetail);
      }
    } catch (Exception e) {
      TracefileViewerPlugin.log(e);
    }
  }