@Override public void dispose() { if (this.selectionListener!=null) { this.selectionListener.dispose(); } final Procedure1<Resource> _function = new Procedure1<Resource>() { @Override public void apply(final Resource it) { it.dispose(); } }; IterableExtensions.<Resource>forEach(this.swtResources, _function); this.swtResources.clear(); this.executorService.shutdown(); super.dispose(); }
@Override public boolean close() { // If already closed, there is nothing to do. // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=127505 Shell shell = getShell(); if (shell != null && !shell.isDisposed()) { saveDialogBounds(shell); } boolean closed = super.close(); for (Resource resource : this.resources) { resource.dispose(); } this.resources.clear(); return closed; }
/** * Dispose all registered OS resources. */ public static void disposeAll() { if (imageToDecoratorMap != null) { Iterator<HashMap<Image, Image>> baseImages = imageToDecoratorMap.values().iterator(); while (baseImages.hasNext()) { Iterator<Image> decorators = baseImages.next().values().iterator(); while (decorators.hasNext()) decorators.next().dispose(); } } Iterator<Resource> it = resourceTracker.values().iterator(); while (it.hasNext()) it.next().dispose(); }
private void dispose(final Resource... rs) { for (final Resource r : rs) { if (null != r && !r.isDisposed()) { r.dispose(); } } }
/** * 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(); }
protected void dispose(Resource[] resources){ if(resources != null){ for(int i = 0; i < resources.length; i ++){ dispose(resources[i]); } } }
public void disposeAll() { for (Resource resource : list) { if (!resource.isDisposed()) { resource.dispose(); } } list.clear(); }
public void widgetDisposed(DisposeEvent e) { for(Resource rs: m_resources) { if(!rs.isDisposed()) { rs.dispose(); } } }
private void dispose(final Resource... resources) { for (final Resource r : resources) { if (r != null) { r.dispose(); } } }
public void dispose(){ Iterator it = this.resources.iterator(); while( it.hasNext() ){ Resource resource = (Resource)it.next(); resource.dispose(); } this.resources.clear(); }
private List purgeDisposableIcons(){ List disposableIcons = new ArrayList(); Iterator it = this.disposableIcons.iterator(); while( it.hasNext() ){ Resource resource = (Resource)it.next(); disposableIcons.add( resource ); } this.disposableIcons.clear(); return disposableIcons; }
protected void dispose(Resource resource){ if(resource != null){ resource.dispose(); } }
public ResourceManager() { this.list = new ArrayList<Resource>(); }
public void add(Resource resource) { list.add(resource); }
protected void refresh(final EObject object, final Notification notification) { boolean _or = false; if (this.refreshing) { _or = true; } else { _or = this.mergingBack; } if (_or) { return; } this.refreshing = true; try { if (((object == this.currentViewedObject) && (notification != null))) { final EObject mergeResult = this.mergeForward(object, notification); if ((mergeResult != null)) { org.eclipse.emf.ecore.resource.Resource _eResource = mergeResult.eResource(); final String uriFragment = _eResource.getURIFragment(mergeResult); EObject _eContainer = mergeResult.eContainer(); SaveOptions.Builder _newBuilder = SaveOptions.newBuilder(); SaveOptions.Builder _format = _newBuilder.format(); SaveOptions _options = _format.getOptions(); final String serializedModel = this.serializer.serialize(_eContainer, _options); this.modelAccess.updateModel(serializedModel, uriFragment); String _editablePart = this.modelAccess.getEditablePart(); this.lastMergedContent = _editablePart; return; } } if ((this.currentViewedObject != null)) { final String content = this.modelAccess.getEditablePart(); boolean _notEquals = (!Objects.equal(content, this.lastMergedContent)); if (_notEquals) { EObject mergeSource = null; boolean _and = false; if (!(object != this.currentViewedObject)) { _and = false; } else { boolean _isEmpty = this.validationErrors.isEmpty(); _and = _isEmpty; } if (_and) { EObject _mergeBack = this.mergeBack(this.currentViewedObject, this.editingDomain); mergeSource = _mergeBack; } if ((mergeSource == null)) { this.handleDiscardedChanges(); } } } this.resourceValidator.setOriginalObject(object); if ((object == null)) { this.lastMergedContent = ""; this.modelAccess.updateModel(this.lastMergedContent); } else { org.eclipse.emf.ecore.resource.Resource _eResource_1 = object.eResource(); final String uriFragment_1 = _eResource_1.getURIFragment(object); EObject _eContainer_1 = object.eContainer(); SaveOptions.Builder _newBuilder_1 = SaveOptions.newBuilder(); SaveOptions.Builder _format_1 = _newBuilder_1.format(); SaveOptions _options_1 = _format_1.getOptions(); final String serializedModel_1 = this.serializer.serialize(_eContainer_1, _options_1); this.modelAccess.updateModel(serializedModel_1, uriFragment_1); this.viewer.setSelectedRange(0, 0); String _editablePart_1 = this.modelAccess.getEditablePart(); this.lastMergedContent = _editablePart_1; } this.currentViewedObject = object; } finally { this.refreshing = false; } }
/** * Dispose safely any SWT resource * * @param resource the resource to dispose */ private void safeDispose(final Resource resource) { if (resource != null && !resource.isDisposed()) { resource.dispose(); } }
private void disposeResource(final Resource resource) { if ((resource != null) && !resource.isDisposed()) { resource.dispose(); } }
public static Resource disposeResource(final Resource resource) { if (resource != null && !resource.isDisposed()) { resource.dispose(); } return null; }
public void registerResource(Resource rs) { if(rs == null) { throw new NullPointerException("Resource cannot be null."); } m_resources.add(rs); }
public static <T extends Resource> T dispose(T resource) { if(resource != null) { resource.dispose(); } return null; }
/** * 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(); } }
/** * 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; }