@Override protected IFigure createFigure() { IFigure r = new Figure(); RowDataFigureLayout layout = new RowDataFigureLayout(getTimeline().getPage()); layout.setRowElementHeight(TimelineUtils.getRowElementHeight(this)); layout.setOverlapFactor(TIMELINE_PREFERENCES.getFloat(TimelinePreferencePage.P_ROW_ELEMENT_OVERLAP)); r.setLayoutManager(layout); r.setOpaque(false); // // This tricky little method makes sure that the headers of the timeline // that correspond to this row have the same height r.addLayoutListener(new LayoutListener.Stub() { @Override public void postLayout(IFigure container) { int height = container.getBounds().height; List list = (List) getViewer().getEditPartRegistry().get(getModel()); for (Object o : list) { GraphicalEditPart ep = (GraphicalEditPart) o; Request request = new Request(REQ_ROW_DATA_LAYOUT); request.getExtendedData().put("height", height); ep.performRequest(request); } } }); return r; }
@Override public void activate() { super.activate(); if (getLabelProvider() != null) { getLabelProvider().addListener(listener); } expansionModel = (ExpansionModel) getViewer().getProperty(ExpansionModel.ID); if (expansionModel != null) { expansionModel.addPropertyChangeListener(listener); } getFigure().addLayoutListener(new LayoutListener.Stub() { @Override public void postLayout(IFigure container) { updateVisibility(); } }); getViewer().addPropertyChangeListener(listener); getTimelineTreeContentProvider().addListener(listener); TIMELINE_PREFERENCES.addPropertyChangeListener(listener); getViewer().getTimelineSectionModel().eAdapters().add(listener); serviceListener = new ServiceListener(getViewer().getTimeline(), (EObject)getModel()); getTimeline().addPropertyChangeListener(listener); getTimeline().getWorkspaceResourceService().addResourceChangeListener(serviceListener); }
@Override public void activate() { if (getViewer().isAnimated()) { getFigure().addLayoutListener(LayoutAnimator.getDefault()); } getFigure().addLayoutListener(new LayoutListener.Stub() { @Override public void postLayout(IFigure container) { updateVisibility(); } }); TIMELINE_PREFERENCES.addPropertyChangeListener(listener); getTimeline().addPropertyChangeListener(listener); getViewer().addPropertyChangeListener(listener); getViewer().getTreeTimelineContentProvider().addListener(listener); getViewer().getTimelineSectionModel().eAdapters().add(listener); super.activate(); }