1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.internal.ui.viewsupport;
13 import org.eclipse.swt.widgets.Control;
15 import org.eclipse.jface.util.Assert;
16 import org.eclipse.jface.viewers.StructuredViewer;
18 import org.eclipse.core.resources.IResourceChangeEvent;
19 import org.eclipse.core.resources.IResourceChangeListener;
20 import org.eclipse.core.resources.IResourceDelta;
23 public class FilterUpdater implements IResourceChangeListener {
25 private StructuredViewer fViewer;
27 public FilterUpdater(StructuredViewer viewer) {
28 Assert.isNotNull(viewer);
33 * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
35 public void resourceChanged(IResourceChangeEvent event) {
36 IResourceDelta delta= event.getDelta();
40 IResourceDelta[] projDeltas = delta.getAffectedChildren(IResourceDelta.CHANGED);
41 for (int i= 0; i < projDeltas.length; i++) {
42 IResourceDelta pDelta= projDeltas[i];
43 if ((pDelta.getFlags() & IResourceDelta.DESCRIPTION) != 0) {
44 final Control ctrl= fViewer.getControl();
45 if (ctrl != null && !ctrl.isDisposed()) {
46 // async is needed due to bug 33783
47 ctrl.getDisplay().asyncExec(new Runnable() {
49 if (!ctrl.isDisposed())
50 fViewer.refresh(false);