@Override
  public void createPartControl(final Composite parent) {
    fParent = parent;
    if (fTrace != null) {
      setPartName(fTrace.getName());
      fEventsTable = createEventsTable(parent, fTrace.getCacheSize());
      fEventsTable.addSelectionChangedListener(this);
      fEventsTable.setTrace(fTrace, true);
      fEventsTable.refreshBookmarks(fFile);

      /* ensure start time is set */
      final ITmfContext context = fTrace.seekEvent(0);
      fTrace.getNext(context);
      context.dispose();

      broadcast(new TmfTraceOpenedSignal(this, fTrace, fFile));
    } else {
      fEventsTable = new TmfEventsTable(parent, 0);
      fEventsTable.addSelectionChangedListener(this);
    }
    IStatusLineManager statusLineManager = getEditorSite().getActionBars().getStatusLineManager();
    fEventsTable.setStatusLineManager(statusLineManager);
    addPropertyListener(this);
    ResourcesPlugin.getWorkspace()
        .addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE);
    // we need to wrap the ISelectionProvider interface in the editor because
    // the events table can be replaced later while the selection changed listener
    // is only added once by the platform to the selection provider set here
    getSite().setSelectionProvider(this);
    getSite().getPage().addPartListener(this);
  }
 /** @since 2.0 */
 @Override
 public ISelection getSelection() {
   if (fEventsTable == null) {
     return StructuredSelection.EMPTY;
   }
   return fEventsTable.getSelection();
 }
 /** @since 2.1 */
 @Override
 public void gotoMarker(IMarker marker) {
   if (fTrace == null || fEventsTable == null) {
     fPendingGotoMarker = marker;
   } else {
     fEventsTable.gotoMarker(marker);
   }
 }
 @Override
 public void dispose() {
   if (getSite() != null) {
     getSite().getPage().removePartListener(this);
   }
   ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
   removePropertyListener(this);
   if (fTrace != null) {
     broadcast(new TmfTraceClosedSignal(this, fTrace));
   }
   if (fEventsTable != null) {
     fEventsTable.dispose();
   }
   super.dispose();
 }
  @Override
  public void propertyChanged(final Object source, final int propId) {
    if (propId == IEditorPart.PROP_INPUT && getEditorInput() instanceof TmfEditorInput) {
      if (fTrace != null) {
        broadcast(new TmfTraceClosedSignal(this, fTrace));
      }
      fTraceSelected = false;
      fFile = ((TmfEditorInput) getEditorInput()).getFile();
      fTrace = ((TmfEditorInput) getEditorInput()).getTrace();
      /* change the input to a FileEditorInput to allow open handlers to find this editor */
      super.setInput(new FileEditorInput(fFile));
      fEventsTable.dispose();
      if (fTrace != null) {
        setPartName(fTrace.getName());
        fEventsTable = createEventsTable(fParent, fTrace.getCacheSize());
        fEventsTable.addSelectionChangedListener(this);
        fEventsTable.setTrace(fTrace, true);
        fEventsTable.refreshBookmarks(fFile);
        if (fPendingGotoMarker != null) {
          fEventsTable.gotoMarker(fPendingGotoMarker);
          fPendingGotoMarker = null;
        }

        /* ensure start time is set */
        final ITmfContext context = fTrace.seekEvent(0);
        fTrace.getNext(context);
        context.dispose();

        broadcast(new TmfTraceOpenedSignal(this, fTrace, fFile));
      } else {
        setPartName(getEditorInput().getName());
        fEventsTable = new TmfEventsTable(fParent, 0);
        fEventsTable.addSelectionChangedListener(this);
      }
      fParent.layout();
    }
  }
 /**
  * Update the display to use the updated timestamp format
  *
  * @param signal the incoming signal
  * @since 2.0
  */
 @TmfSignalHandler
 public void timestampFormatUpdated(TmfTimestampFormatUpdateSignal signal) {
   if (fEventsTable != null) {
     fEventsTable.refresh();
   }
 }
 /** Add a bookmark */
 public void addBookmark() {
   fEventsTable.addBookmark(fFile);
 }
 @Override
 public void setFocus() {
   fEventsTable.setFocus();
 }