@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); }
@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(); } }