Bug 72923 Delete from Package Explorer removes file but not empty package [package explorer]
This process is a little inconsistant. Sometimes it will work, but most of the time it will not remove the empty package structure. 1. Delete a java file in a package from the Package Explorer 2. Both java file and the empty package disappear from the Package Explorer 3. Add another file to the project 4. Click Refresh from the Package Explorer Expected Results: The empty package should not show up Actual Results: The empty package shows up Delete this package again Add a file Click Refresh The empty package shows up with one directory removed from it
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerContentProvider.java
private void postRemove(final Object element) {
		postRunnable(new Runnable() {
			public void run() {
				Control ctrl= fViewer.getControl();
				if (ctrl != null && !ctrl.isDisposed()) {
					fViewer.remove(element);
				}
			}
		});
	}
	
	private void postProjectStateChanged(final Object root) {
		postRunnable(new Runnable() {
			public void run() {
				fPart.projectStateChanged(root);
			}
		});
	}
	private void postRunnable(final Runnable r) {
		Control ctrl= fViewer.getControl();
		final Runnable trackedRunnable= new Runnable() {
			public void run() {
				try {
					r.run();
				} finally {
					removePendingChange();
				}
			}
		};
		if (ctrl != null && !ctrl.isDisposed()) {