private void disposeRulerViewer(GraphicalViewer viewer) { if (viewer == null) return; /* * There's a tie from the editor's range model to the RulerViewport (via * a listener) to the RulerRootEditPart to the RulerViewer. Break this * tie so that the viewer doesn't leak and can be garbage collected. */ dockLayoutPanel.remove(northPanel); dockLayoutPanel.remove(westPanel); dockLayoutPanel.forceLayout(); RangeModel rModel = new DefaultRangeModel(); Viewport port = ((FigureCanvas) viewer.getControl()).getViewport(); port.setHorizontalRangeModel(rModel); port.setVerticalRangeModel(rModel); rulerEditDomain.removeViewer(viewer); viewer.getRootEditPart().deactivate(); // viewer.getControl().dispose(); }
private void disposeRulerViewer( GraphicalViewer viewer ) { if ( viewer == null ) return; /* * There's a tie from the editor's range model to the RulerViewport (via * a listener) to the RulerRootEditPart to the RulerViewer. Break this * tie so that the viewer doesn't leak and can be garbage collected. */ RangeModel rModel = new DefaultRangeModel( ); Viewport port = ( (FigureCanvas) viewer.getControl( ) ).getViewport( ); port.setHorizontalRangeModel( new RulerDefaultRangeModel( rModel ) ); port.setVerticalRangeModel( new RulerDefaultRangeModel( rModel ) ); rulerEditDomain.removeViewer( viewer ); viewer.getControl( ).dispose( ); }
private void disposeRulerViewer(GraphicalViewer viewer) { if (viewer == null) return; /* * There's a tie from the editor's range model to the RulerViewport (via a listener) to the RulerRootEditPart to the * RulerViewer. Break this tie so that the viewer doesn't leak and can be garbage collected. */ RangeModel rModel = new DefaultRangeModel(); Viewport port = ((FigureCanvas) viewer.getControl()).getViewport(); port.setHorizontalRangeModel(rModel); port.setVerticalRangeModel(rModel); rulerEditDomain.removeViewer(viewer); viewer.getControl().dispose(); }
private Control createTimelineRegion(Composite parent) { Composite timelineRegion = new EnsembleComposite(parent, SWT.NONE); timelineRegion.setData("debug", Timeline.class.getSimpleName() + ".timelineRegion"); timelineRegion.setLayout(new BorderLayout()); // create the range model first final RangeModel rangeModel = new DefaultRangeModel(); setHorizontalRangeModel(rangeModel); // frozen top timeline contents // date/time ruler (scale) Composite timelineTopComposite = buildTopTimeline(timelineRegion); timelineTopComposite.setLayoutData(SWT.TOP); // timeline contents ScrolledComposite scroller = buildTimelineContents(timelineRegion); scroller.setLayoutData(SWT.CENTER); // scroller TimelineViewer timelineHScroller = buildTimeline(timelineRegion, getTimelineModel(), new SplitScrollEditPartFactory<T>()); timelineHScroller.getControl().setLayoutData(SWT.BOTTOM); scroller.getContent().addListener(SWT.MouseHorizontalWheel, new Listener() { @Override public void handleEvent(Event event) { int value = rangeModel.getValue(); value -= 5 * event.count; rangeModel.setValue(value); } }); return timelineRegion; }
private void disposeRulerViewer(GraphicalViewer viewer) { if (viewer == null) return; /* * There's a tie from the editor's range model to the RulerViewport (via * a listener) to the RulerRootEditPart to the RulerViewer. Break this * tie so that the viewer doesn't leak and can be garbage collected. */ RangeModel rModel = new DefaultRangeModel(); Viewport port = ((FigureCanvas) viewer.getControl()).getViewport(); port.setHorizontalRangeModel(rModel); port.setVerticalRangeModel(rModel); rulerEditDomain.removeViewer(viewer); viewer.getControl().dispose(); }