List of usage examples for org.eclipse.jface.viewers LabelProviderChangedEvent LabelProviderChangedEvent
public LabelProviderChangedEvent(IBaseLabelProvider source, Object element)
From source file:au.gov.ga.earthsci.application.IconLoader.java
License:Apache License
private void retrievalDone(IRetrievalData data, URL url) { Image image = null;//from ww w .j a v a2 s . c om if (data != null) { try { InputStream is = data.getInputStream(); try { image = new Image(Display.getDefault(), is); } finally { is.close(); } } catch (Exception e) { logger.error("Error loading image from " + url, e); //$NON-NLS-1$ } } Object[] loadingElementsArray = null; synchronized (semaphore) { final Set<Object> elements = urlElements.remove(url); for (Object element : elements) { setLoading(element, false); } if (image != null) { setImageForURL(url, image); } else { errorElements.addAll(elements); } loadingElementsArray = elements.toArray(); } final Object[] array = loadingElementsArray; Display.getDefault().asyncExec(new Runnable() { @Override public void run() { labelProvider.fireLabelProviderChanged(new LabelProviderChangedEvent(labelProvider, array)); } }); }
From source file:au.gov.ga.earthsci.application.IconLoader.java
License:Apache License
@Override public void nextFrame(Image image) { Object[] loadingElementsArray = null; synchronized (semaphore) { if (!loadingElements.isEmpty()) { loadingElementsArray = loadingElements.toArray(new Object[loadingElements.size()]); }// w w w. j a v a2 s . c om } if (loadingElementsArray != null) { final Object[] elements = loadingElementsArray; Display.getDefault().asyncExec(new Runnable() { @Override public void run() { labelProvider.fireLabelProviderChanged(new LabelProviderChangedEvent(labelProvider, elements)); } }); } }
From source file:au.gov.ga.earthsci.catalog.part.CatalogTreeLabelProvider.java
License:Apache License
@Override public Image getImage(final Object element) { if (!(element instanceof ICatalogTreeNode)) { return null; }/*from ww w . j av a2s .c om*/ if (element instanceof LoadingCatalogTreeNode) { ILoadingIconFrameListener loadingIconFrameListener = new ILoadingIconFrameListener() { @Override public void nextFrame(Image image) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { fireLabelProviderChanged( new LabelProviderChangedEvent(CatalogTreeLabelProvider.this, element)); } }); LoadingIconAnimator.get().removeListener(this); } }; LoadingIconAnimator.get().addListener(loadingIconFrameListener); return LoadingIconAnimator.get().getCurrentFrame(); } else if (element instanceof ErrorCatalogTreeNode) { return ImageRegistry.getInstance().get(ImageRegistry.ICON_ERROR); } ICatalogTreeNode node = (ICatalogTreeNode) element; URL iconURL = CatalogTreeLabelProviderRegistry.getProvider(node).getIconURL(node); return getImage(element, iconURL); }
From source file:au.gov.ga.earthsci.catalog.part.CatalogTreeLabelProvider.java
License:Apache License
private void updateElementsForURIs(Collection<URI> uris, SetMap<URI, ICatalogTreeNode> uriElements) { Set<ICatalogTreeNode> elements = new HashSet<ICatalogTreeNode>(); for (URI uri : uris) { Set<ICatalogTreeNode> nodes = uriElements.get(uri); if (nodes != null) { elements.addAll(nodes);/*from w ww . j a v a2 s . c om*/ } } Object[] elementsArray = elements.toArray(); fireLabelProviderChanged(new LabelProviderChangedEvent(CatalogTreeLabelProvider.this, elementsArray)); }
From source file:au.gov.ga.earthsci.layer.ui.LayerTreePart.java
License:Apache License
private void updateElementLabel(final Object element) { if (!structureViewer.getControl().isDisposed()) { structureViewer.getControl().getDisplay().asyncExec(new Runnable() { @Override// w w w. j a va2s. com public void run() { LabelProviderChangedEvent event = new LabelProviderChangedEvent(labelProvider, element); labelProvider.fireLabelProviderChanged(event); } }); } }
From source file:com.aptana.git.ui.internal.GitLightweightDecorator.java
License:Open Source License
public void indexChanged(IndexChangedEvent e) { // TODO Force a total refresh if the number of changed files is over some maximum? Set<IResource> resources = e.getFilesWithChanges(); // Need to mark all parents up to project for refresh so the dirty flag can get recomputed for these // ancestor folders! resources.addAll(getAllAncestors(resources)); // TODO On a commit clear the cache? // FIXME Only add projects if this was a commit (so the plus/minus changes), not just a file // edited/staged/unstaged // Also refresh any project sharing this repo (so the +/- commits ahead can be refreshed) for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) { GitRepository repo = getGitRepositoryManager().getAttached(project); if (repo != null && repo.equals(e.getRepository())) { resources.add(project);//from w ww. ja v a 2s .c om } } postLabelEvent(new LabelProviderChangedEvent(this, resources.toArray())); }
From source file:com.aptana.git.ui.internal.GitLightweightDecorator.java
License:Open Source License
public void repositoryAdded(RepositoryAddedEvent e) { e.getRepository().addListener(this); Set<IResource> resources = e.getRepository().getChangedResources(); resources.add(e.getProject());// w ww .j a v a 2s .c om postLabelEvent(new LabelProviderChangedEvent(this, resources.toArray())); }
From source file:com.aptana.git.ui.internal.GitLightweightDecorator.java
License:Open Source License
public void branchChanged(BranchChangedEvent e) { Set<IResource> resources = new HashSet<IResource>(); GitRepository repo = e.getRepository(); IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); for (IProject project : projects) { if (repo.equals(getGitRepositoryManager().getAttached(project))) resources.add(project);/* w w w .j a va 2s . co m*/ } // Project labels need to change, but the dirty/stage/unstaged flags should stay same (can't change branch with // staged/unstaged changes, dirty carry over). postLabelEvent(new LabelProviderChangedEvent(this, resources.toArray())); }
From source file:com.aptana.ide.debug.internal.ui.decorators.StartPageDecorator.java
License:Open Source License
public void startPageChanged(IResource resource) { LabelProviderChangedEvent event;/*from ww w . j a v a2 s . c o m*/ if (resource != null) { event = new LabelProviderChangedEvent(this, resource); } else { event = new LabelProviderChangedEvent(this); } fireLabelProviderChanged(event); }
From source file:com.aptana.ide.server.ui.decorators.StartPageDecorator.java
License:Open Source License
/** * @see java.util.Observer#update(java.util.Observable, java.lang.Object) *///from w w w . ja v a 2s . co m public void update(Observable arg0, Object arg1) { // Fire a label provider changed event to decorate the // resources whose image needs to be updated IResource oldDecoratedResource = decoratedResource; decoratedResource = StartPage.getInstance().getStartPageResource(); IResource[] updatedResources = null; if (oldDecoratedResource != null) { if (decoratedResource != null) { updatedResources = new IResource[] { oldDecoratedResource, decoratedResource }; } else { updatedResources = new IResource[] { oldDecoratedResource }; } } else if (decoratedResource != null) { updatedResources = new IResource[] { decoratedResource }; } if (updatedResources != null) { fireLabelEvent(new LabelProviderChangedEvent(this, updatedResources)); } }