Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 219335 | Differences between
and this patch

Collapse All | Expand All

(-)ui/org/eclipse/jdt/internal/ui/viewsupport/ProblemTreeViewer.java (-3 / +8 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 246-252 Link Here
246
		return super.isExpandable(parent);
246
		return super.isExpandable(parent);
247
	}
247
	}
248
	
248
	
249
    protected final boolean hasFilteredChildren(Object parent) {
249
	/**
250
	 * Public method to test if a element has any children that passed the filters
251
	 * @param parent the element to test
252
	 * @return return <code>true</code> if the element has at least a child that passed the filters
253
	 */
254
	public final boolean hasFilteredChildren(Object parent) {
250
		Object[] rawChildren= getRawChildren(parent);
255
		Object[] rawChildren= getRawChildren(parent);
251
		return containsNonFiltered(rawChildren, parent);
256
		return containsNonFiltered(rawChildren, parent);
252
    }
257
    }
Lines 323-329 Link Here
323
	 * Public method to test if a element is filtered by the views active filters
328
	 * Public method to test if a element is filtered by the views active filters
324
	 * @param object the element to test for
329
	 * @param object the element to test for
325
	 * @param parent the parent element
330
	 * @param parent the parent element
326
	 * @return return <code>true if the element is filtered</code>
331
	 * @return return <code>true</code> if the element is filtered
327
	 */
332
	 */
328
	public boolean isFiltered(Object object, Object parent) {
333
	public boolean isFiltered(Object object, Object parent) {
329
		return isFiltered(object, parent, getFilters());
334
		return isFiltered(object, parent, getFilters());
(-)plugin.xml (-1 / +9 lines)
Lines 4710-4721 Link Here
4710
      </filter>
4710
      </filter>
4711
      <filter
4711
      <filter
4712
            targetId="org.eclipse.jdt.ui.PackageExplorer"
4712
            targetId="org.eclipse.jdt.ui.PackageExplorer"
4713
            name="%HideEmptyLibraryContainers.label"
4714
            enabled="true"
4715
            description="%HideEmptyLibraryContainers.description"
4716
            class="org.eclipse.jdt.internal.ui.filters.EmptyLibraryContainerFilter"
4717
            id="org.eclipse.jdt.ui.PackageExplorer.EmptyLibraryContainerFilter">
4718
      </filter>
4719
      <filter
4720
            targetId="org.eclipse.jdt.ui.PackageExplorer"
4713
            name="%HideReferencedLibraries.label"
4721
            name="%HideReferencedLibraries.label"
4714
            enabled="false"
4722
            enabled="false"
4715
            description="%HideReferencedLibraries.description"
4723
            description="%HideReferencedLibraries.description"
4716
            class="org.eclipse.jdt.internal.ui.filters.LibraryFilter"
4724
            class="org.eclipse.jdt.internal.ui.filters.LibraryFilter"
4717
            id="org.eclipse.jdt.ui.PackageExplorer.LibraryFilter">
4725
            id="org.eclipse.jdt.ui.PackageExplorer.LibraryFilter">
4718
      </filter>
4726
      </filter>      
4719
      <filter
4727
      <filter
4720
            targetId="org.eclipse.jdt.ui.PackageExplorer"
4728
            targetId="org.eclipse.jdt.ui.PackageExplorer"
4721
            name="%HideContainedLibraries.label"
4729
            name="%HideContainedLibraries.label"
(-)plugin.properties (+3 lines)
Lines 502-507 Link Here
502
HideNonJavaElements.label= Non-Java elements
502
HideNonJavaElements.label= Non-Java elements
503
HideNonJavaElements.description= Hides all non-Java elements
503
HideNonJavaElements.description= Hides all non-Java elements
504
504
505
HideEmptyLibraryContainers.label= Empty library containers 
506
HideEmptyLibraryContainers.description= Hides library containers which do not contain at least one library that is not filtered 
507
505
HideReferencedLibraries.label= Libraries from external
508
HideReferencedLibraries.label= Libraries from external
506
HideReferencedLibraries.description= Hides external libraries i.e. those not contained inside the project itself
509
HideReferencedLibraries.description= Hides external libraries i.e. those not contained inside the project itself
507
510
(-)ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java (-4 lines)
Lines 277-286 Link Here
277
		}
277
		}
278
278
279
		protected boolean isFiltered(Object object, Object parent, ViewerFilter[] filters) {
279
		protected boolean isFiltered(Object object, Object parent, ViewerFilter[] filters) {
280
			if (object instanceof PackageFragmentRootContainer) {
281
				return !hasFilteredChildren(object);
282
			}
283
			
284
			boolean res= super.isFiltered(object, parent, filters);
280
			boolean res= super.isFiltered(object, parent, filters);
285
			if (res && isEssential(object)) {
281
			if (res && isEssential(object)) {
286
				return false;
282
				return false;
(-)ui/org/eclipse/jdt/internal/ui/filters/EmptyLibraryContainerFilter.java (+35 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.internal.ui.filters;
12
13
import org.eclipse.jface.viewers.Viewer;
14
import org.eclipse.jface.viewers.ViewerFilter;
15
16
import org.eclipse.jdt.internal.ui.packageview.PackageFragmentRootContainer;
17
import org.eclipse.jdt.internal.ui.viewsupport.ProblemTreeViewer;
18
19
/**
20
 * The library container filter is a filter used to determine whether
21
 * library containers are shown that are empty or have all children filtered out by other filters. 
22
 * The filter is only applicable on a {@link ProblemTreeViewer}
23
 */
24
public class EmptyLibraryContainerFilter extends ViewerFilter {
25
	
26
	/* (non-Javadoc)
27
	 * Method declared on ViewerFilter.
28
	 */
29
	public boolean select(Viewer viewer, Object parentElement, Object element) {
30
		if (element instanceof PackageFragmentRootContainer && viewer instanceof ProblemTreeViewer) {
31
			return ((ProblemTreeViewer) viewer).hasFilteredChildren(element);
32
		}
33
		return true;
34
	}
35
}

Return to bug 219335