Esempio n. 1
0
  @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);
  }
Esempio n. 2
0
 public synchronized void updateIndex(ITmfContext context, TmfTimestamp timestamp) {
   // Build the index as we go along
   long rank = context.getRank();
   if (context.isValidRank() && (rank % fIndexPageSize) == 0) {
     // Determine the table position
     long position = rank / fIndexPageSize;
     // Add new entry at proper location (if empty)
     if (fCheckpoints.size() == position) {
       ITmfLocation<?> location = context.getLocation().clone();
       fCheckpoints.add(new TmfCheckpoint(timestamp.clone(), location));
       //                System.out.println(this + "[" + (fCheckpoints.size() - 1) + "] " +
       // timestamp + ", "
       //                        + location.toString());
     }
   }
 }
Esempio n. 3
0
  @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();
    }
  }