org.eclipse.swt.graphics.Resource Java Examples

The following examples show how to use org.eclipse.swt.graphics.Resource. 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: SWTGraphics2D.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Dispose the resource pool.
 */
private void disposeResourcePool() {
    for (Iterator it = this.resourcePool.iterator(); it.hasNext();) {
        Resource resource = (Resource) it.next();
        resource.dispose();
    }
    this.fontsPool.clear();
    this.colorsPool.clear();
    this.transformsPool.clear();
    this.resourcePool.clear();
}
 
Example #2
Source File: SWTGraphics2D.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Dispose the resource pool.
 */
private void disposeResourcePool() {
    for (Iterator it = this.resourcePool.iterator(); it.hasNext();) {
        Resource resource = (Resource) it.next();
        resource.dispose();
    }
    this.fontsPool.clear();
    this.colorsPool.clear();
    this.transformsPool.clear();
    this.resourcePool.clear();
}
 
Example #3
Source File: SWTGraphics2D.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Dispose the resource pool.
 */
private void disposeResourcePool() {
    for (Iterator it = this.resourcePool.iterator(); it.hasNext();) {
        Resource resource = (Resource) it.next();
        resource.dispose();
    }
    this.fontsPool.clear();
    this.colorsPool.clear();
    this.transformsPool.clear();
    this.resourcePool.clear();
}
 
Example #4
Source File: SWTGraphics2D.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Dispose the resource pool.
 */
private void disposeResourcePool() {
    for (Iterator it = this.resourcePool.iterator(); it.hasNext();) {
        Resource resource = (Resource) it.next();
        resource.dispose();
    }
    this.fontsPool.clear();
    this.colorsPool.clear();
    this.transformsPool.clear();
    this.resourcePool.clear();
}
 
Example #5
Source File: SWTGraphics2D.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Dispose the resource pool.
 */
private void disposeResourcePool() {
    for (Iterator it = this.resourcePool.iterator(); it.hasNext();) {
        Resource resource = (Resource) it.next();
        resource.dispose();
    }
    this.fontsPool.clear();
    this.colorsPool.clear();
    this.transformsPool.clear();
    this.resourcePool.clear();
}
 
Example #6
Source File: SWTGraphics2D.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Dispose the resource pool.
 */
private void disposeResourcePool() {
    for (Iterator it = this.resourcePool.iterator(); it.hasNext();) {
        Resource resource = (Resource) it.next();
        resource.dispose();
    }
    this.fontsPool.clear();
    this.colorsPool.clear();
    this.transformsPool.clear();
    this.resourcePool.clear();
}
 
Example #7
Source File: ResourceDisposer.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void dispose() {
	if (!isDisposed) {
		for (Resource r : resources) {
			UiUtils.dispose(r);
		}
		isDisposed = true;
	}
}
 
Example #8
Source File: SWTGraphics2D.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Dispose the resource pool.
 */
private void disposeResourcePool() {
    for (Iterator it = this.resourcePool.iterator(); it.hasNext();) {
        Resource resource = (Resource) it.next();
        resource.dispose();
    }
    this.fontsPool.clear();
    this.colorsPool.clear();
    this.transformsPool.clear();
    this.resourcePool.clear();
}
 
Example #9
Source File: TestProgressBar.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
private void dispose(final Resource... rs) {
	for (final Resource r : rs) {
		if (null != r && !r.isDisposed()) {
			r.dispose();
		}
	}
}
 
Example #10
Source File: UiUtils.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
public static void dispose(Resource r) {
  if (null != r && !r.isDisposed()) {
    r.dispose();
  }
}
 
Example #11
Source File: SwtUtils.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
public static void dispose(Resource r) {
	if (null != r && !r.isDisposed()) {
		r.dispose();
	}
}
 
Example #12
Source File: ResourceDisposer.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Registers resource for the future disposal
 */
public <T extends Resource> T register(T r) {
	resources.add(r);
	return r;
}
 
Example #13
Source File: SWTGraphicUtil.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Dispose safely any SWT resource
 *
 * @param resource the resource to dispose
 */
public static void safeDispose(final Resource resource) {
	if (resource != null && !resource.isDisposed()) {
		resource.dispose();
	}
}
 
Example #14
Source File: SWTUtil.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
public static <T extends Resource> T dispose(T resource) {
	if(resource != null) {
		resource.dispose();
	}
	return null;
}
 
Example #15
Source File: SWTGraphics2D.java    From ccu-historian with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Add given swt resource to the resource pool. All resources added
 * to the resource pool will be disposed when {@link #dispose()} is called.
 *
 * @param resource the resource to add to the pool.
 * @return the swt <code>Resource</code> just added.
 */
private Resource addToResourcePool(Resource resource) {
    this.resourcePool.add(resource);
    return resource;
}
 
Example #16
Source File: SWTGraphics2D.java    From SIMVA-SoS with Apache License 2.0 2 votes vote down vote up
/**
 * Add given swt resource to the resource pool. All resources added
 * to the resource pool will be disposed when {@link #dispose()} is called.
 *
 * @param resource the resource to add to the pool.
 * @return the swt <code>Resource</code> just added.
 */
private Resource addToResourcePool(Resource resource) {
    this.resourcePool.add(resource);
    return resource;
}
 
Example #17
Source File: SWTGraphics2D.java    From ECG-Viewer with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Add given swt resource to the resource pool. All resources added
 * to the resource pool will be disposed when {@link #dispose()} is called.
 *
 * @param resource the resource to add to the pool.
 * @return the swt <code>Resource</code> just added.
 */
private Resource addToResourcePool(Resource resource) {
    this.resourcePool.add(resource);
    return resource;
}
 
Example #18
Source File: UIUtils.java    From n4js with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Disposes the resource argument. Has no effect if the resource argument is either {@code null} or already
 * {@link Resource#isDisposed() disposed}.
 *
 * @param resource
 *            the resource to dispose. Optional, can be {@code null}.
 */
public static void dispose(final Resource resource) {
	if (null != resource && !resource.isDisposed()) {
		resource.dispose();
	}
}
 
Example #19
Source File: SWTGraphics2D.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Add given swt resource to the resource pool. All resources added
 * to the resource pool will be disposed when {@link #dispose()} is called.
 *
 * @param resource the resource to add to the pool.
 * @return the swt <code>Resource</code> just added.
 */
private Resource addToResourcePool(Resource resource) {
    this.resourcePool.add(resource);
    return resource;
}
 
Example #20
Source File: SWTGraphics2D.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Add given swt resource to the resource pool. All resources added
 * to the resource pool will be disposed when {@link #dispose()} is called.
 *  
 * @param resource the resource to add to the pool.
 * @return the swt <code>Resource</code> just added.
 */
private Resource addToResourcePool(Resource resource) {
    this.resourcePool.add(resource);
    return resource;
}
 
Example #21
Source File: SWTGraphicUtil.java    From nebula with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * Dispose safely any SWT resource when a widget is disposed
 *
 * @param widget widget attached to the resource
 * @param resource the resource to dispose
 */
public static void addDisposer(final Widget widget, final Resource resource) {
	widget.addDisposeListener(e -> {
		safeDispose(resource);
	});
}
 
Example #22
Source File: SWTGraphics2D.java    From buffer_bci with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Add given swt resource to the resource pool. All resources added
 * to the resource pool will be disposed when {@link #dispose()} is called.
 *
 * @param resource the resource to add to the pool.
 * @return the swt <code>Resource</code> just added.
 */
private Resource addToResourcePool(Resource resource) {
    this.resourcePool.add(resource);
    return resource;
}
 
Example #23
Source File: SWTGraphics2D.java    From openstock with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Add given swt resource to the resource pool. All resources added
 * to the resource pool will be disposed when {@link #dispose()} is called.
 *
 * @param resource the resource to add to the pool.
 * @return the swt <code>Resource</code> just added.
 */
private Resource addToResourcePool(Resource resource) {
    this.resourcePool.add(resource);
    return resource;
}