org.eclipse.ui.services.IDisposable Java Examples

The following examples show how to use org.eclipse.ui.services.IDisposable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractFXView.java    From gef with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void dispose() {
	// deactivate domain
	deactivate();

	// unhook selection forwarder
	unhookViewers();

	// unregister selection provider
	selectionProviderFactory = null;
	if (selectionProvider != null) {
		getSite().setSelectionProvider(null);
		if (selectionProvider instanceof IDisposable) {
			((IDisposable) selectionProvider).dispose();
		}
		selectionProvider = null;
	}

	// XXX: The propertySheetPage does not need to be disposed, as this is
	// already done by the PropertySheet (view) when this view is closed.
	propertySheetPage = null;
	propertySheetPageFactory = null;

	disposeActions();

	domain.dispose();
	domain = null;

	canvasFactory = null;
	if (!canvas.isDisposed()) {
		canvas.dispose();
	}
	canvas = null;

	super.dispose();
}
 
Example #2
Source File: PlotImageServiceMock.java    From dawnsci with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IDisposable createPlotDisposable(String plotName) throws Exception {
	
	// We plot to an offscreen plotting system, then take a screen shot of this.
	final PlotDisposable ret = new PlotDisposable();
	IPlottingSystem<?> system = plotName!=null 
	                       ? PlottingFactory.getPlottingSystem(plotName)
	                       : PlottingFactory.getLightWeightPlottingSystem();
	                       
	if (system==null) system = PlottingFactory.getLightWeightPlottingSystem();
	ret.setSystem(system);
			
	if (system.getPlotComposite()==null) {
		Display.getDefault().syncExec(new Runnable() {
			public void run() {
				final Shell   shell   = new Shell(Display.getDefault(), SWT.RESIZE|SWT.NO_TRIM);
				ret.setShell(shell);
				shell.setSize(600, 600);
				
				shell.setLayout(new FillLayout());
				final Composite main = new Composite(shell, SWT.NONE);
				main.setLayout(new GridLayout(1, false));
				
				final Composite plotter = new Composite(main, SWT.NONE);
				plotter.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
				
				ret.getSystem().createPlotPart(plotter, "Thumbnail", null, PlotType.XY, null);		
			}
		});
	}
	
	return ret;
}
 
Example #3
Source File: CommandUtils.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public static void disposeParameter( String parameterId, Command command )
		throws NotDefinedException
{
	ParameterType parameterType = command.getParameterType( parameterId );
	Object valueConverter = parameterType.getValueConverter( );
	if ( valueConverter instanceof IDisposable )
		( (IDisposable) valueConverter ).dispose( );
}
 
Example #4
Source File: EmbeddedEditorSite.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public EmbeddedEditorSite() {
    e4Context = getMWindow().getContext();
    IServiceLocatorCreator slc = (IServiceLocatorCreator) e4Context.get(IServiceLocatorCreator.class.getName());
    IWorkbenchWindow workbenchWindow = getWorkbenchWindow();
    this.serviceLocator = (ServiceLocator) slc.createServiceLocator(workbenchWindow, null, new IDisposable() {

        @Override
        public void dispose() {
            // not sure what to do here
        }
    }, e4Context);
    initializeDefaultServices();
}
 
Example #5
Source File: AbstractFXEditor.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void dispose() {
	// deactivate domain
	deactivate();

	// unhook selection forwarder
	unhookViewers();

	// The support class used for handling the dirty state
	if (dirtyStateProvider != null) {
		if (dirtyStateNotifier != null) {
			dirtyStateProvider.dirtyProperty()
					.removeListener(dirtyStateNotifier);
		}
		if (dirtyStateProvider instanceof IDisposable) {
			((IDisposable) dirtyStateProvider).dispose();
		}
		dirtyStateProvider = null;
		dirtyStateNotifier = null;
	}

	// unregister selection provider
	if (selectionProvider != null) {
		getSite().setSelectionProvider(null);
		if (selectionProvider instanceof IDisposable) {
			((IDisposable) selectionProvider).dispose();
		}
	}

	// XXX: The propertySheetPage does not need to be disposed, as this is
	// already done by the PropertySheet (view) when this view is closed.
	propertySheetPage = null;
	propertySheetPageFactory = null;

	disposeActions();

	domain.dispose();
	domain = null;

	canvasFactory = null;
	if (!canvas.isDisposed()) {
		canvas.dispose();
	}
	canvas = null;

	super.dispose();
}
 
Example #6
Source File: PlotImageData.java    From dawnsci with Eclipse Public License 1.0 4 votes vote down vote up
public IDisposable getDisposable() {
	return disposable;
}
 
Example #7
Source File: PlotImageData.java    From dawnsci with Eclipse Public License 1.0 4 votes vote down vote up
public void setDisposible(IDisposable disposable) {
	this.disposable = disposable;
}
 
Example #8
Source File: IPlotImageService.java    From dawnsci with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Creates an object which may be used to cache the plotting system
 * when looping over a stack and getting many images. For instance when
 * exporting surface or 1D plots. This  IDisposable is then set in the
 * call to PlotImageData to make it more efficient.
 * 
 * THREAD SAFE
 * 
 * @param plotName to use to look up plotting system (can be null)
 * @return
 * @throws Exception
 */
public IDisposable createPlotDisposable(String plotName) throws Exception;