/** * Upon activation, attach to the model element as a property change listener. */ @Override public void activate() { if (!isActive()) { super.activate(); TIMELINE_PREFERENCES.addPropertyChangeListener(this); TimelineViewer viewer = getViewer(); viewer.addPropertyChangeListener(listener); if (viewer.isAnimated()) { figure.addLayoutListener(LayoutAnimator.getDefault()); } ExpansionModel expansion = (ExpansionModel) getViewer().getProperty(ExpansionModel.ID); if (expansion != null) { expansion.addPropertyChangeListener(listener); } TreeTimelineContentProvider cp = getViewer().getTreeTimelineContentProvider(); if (cp != null) { cp.addListener(listener); } refreshVisuals(); } }
@Override protected IFigure createFigure() { ScalableFreeformLayeredPane layer = new ScalableFreeformLayeredPane(); layer.setLayoutManager(new FreeformLayout()); layer.setBorder(new LineBorder(1)); layer.addLayoutListener(LayoutAnimator.getDefault()); return layer; }
@Override protected IFigure createFigure() { ShapeCompartmentFigure figure = new ShapeCompartmentFigure(getCompartmentName(), getMapMode()); figure.getContentPane().setLayoutManager(getLayoutManager()); figure.getContentPane().addLayoutListener(LayoutAnimator.getDefault()); figure.setBorder(null); figure.setFitContents(true); figure.setToolTip((String) null); return figure; }
/** * Upon deactivation, detach from the model element as a property change listener. */ @Override public void deactivate() { if (isActive()) { TIMELINE_PREFERENCES.removePropertyChangeListener(this); TimelineViewer viewer = getViewer(); viewer.removePropertyChangeListener(listener); if (viewer.isAnimated()) { figure.removeLayoutListener(LayoutAnimator.getDefault()); } ExpansionModel expansion = (ExpansionModel) getViewer().getProperty(ExpansionModel.ID); if (expansion != null) { expansion.removePropertyChangeListener(listener); } if (alternatingColor != null) { //alternatingColor.dispose(); alternatingColor = null; } if (alternatingBorderColor != null) { alternatingBorderColor = null; } if (horizontalLineColor != null) { horizontalLineColor = null; } TreeTimelineContentProvider cp = getViewer().getTreeTimelineContentProvider(); if (cp != null) { cp.removeListener(listener); } super.deactivate(); } }
@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(); }
@Override public void deactivate() { if (getViewer().isAnimated()) { getFigure().removeLayoutListener(LayoutAnimator.getDefault()); } getTimeline().removePropertyChangeListener(listener); getViewer().getTimelineSectionModel().eAdapters().remove(listener); getViewer().removePropertyChangeListener(listener); getViewer().getTreeTimelineContentProvider().removeListener(listener); TIMELINE_PREFERENCES.removePropertyChangeListener(listener); super.deactivate(); }