mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Add new filter to hide/show non C Projects
This commit is contained in:
parent
0e68bf890b
commit
d02bc06723
5 changed files with 67 additions and 1 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2004-04-02 Alain Magloire
|
||||||
|
|
||||||
|
Add new filter to hide/show non C Projects.
|
||||||
|
|
||||||
|
* src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java
|
||||||
|
* src/org/eclipse/cdt/internal/ui/filters/NonCProjectsFilter.java
|
||||||
|
* plugin.properties
|
||||||
|
* plugin.xml
|
||||||
|
|
||||||
2004-04-01 Alain Magloire
|
2004-04-01 Alain Magloire
|
||||||
|
|
||||||
New set of icons to experiment, from Chris.
|
New set of icons to experiment, from Chris.
|
||||||
|
|
|
@ -135,9 +135,12 @@ HideArchiveFiles.description= Hides Archive files
|
||||||
HideObjectFiles.label= Object files
|
HideObjectFiles.label= Object files
|
||||||
HideObjectFiles.description= Hides Object files
|
HideObjectFiles.description= Hides Object files
|
||||||
|
|
||||||
HideNonCElements.label= Non-C Resource
|
HideNonCElements.label= Non-C resource
|
||||||
HideNonCElements.description= Show only C elements
|
HideNonCElements.description= Show only C elements
|
||||||
|
|
||||||
|
HideNonCProjects.label = Non-C projects
|
||||||
|
HideNonCProjects.description= Show only C projects
|
||||||
|
|
||||||
HideReferencedLibraries.label= Referenced libraries
|
HideReferencedLibraries.label= Referenced libraries
|
||||||
HideReferencedLibraries.description= Hides referenced libraries i.e. those not contained inside the project itself
|
HideReferencedLibraries.description= Hides referenced libraries i.e. those not contained inside the project itself
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,14 @@
|
||||||
class="org.eclipse.cdt.internal.ui.filters.ClosedProjectFilter"
|
class="org.eclipse.cdt.internal.ui.filters.ClosedProjectFilter"
|
||||||
id="org.eclipse.cdt.internal.ui.CView.ClosedProjectFilter">
|
id="org.eclipse.cdt.internal.ui.CView.ClosedProjectFilter">
|
||||||
</filter>
|
</filter>
|
||||||
|
<filter
|
||||||
|
enabled="false"
|
||||||
|
name="%HideNonCProjects.label"
|
||||||
|
targetId="org.eclipse.cdt.ui.CView"
|
||||||
|
description="%HideNonCProjects.description"
|
||||||
|
class="org.eclipse.cdt.internal.ui.filters.NonCProjectsFilter"
|
||||||
|
id="org.eclipse.cdt.internal.ui.CView.NonCProjectsFilter">
|
||||||
|
</filter>
|
||||||
<filter
|
<filter
|
||||||
enabled="false"
|
enabled="false"
|
||||||
name="%HideNonCElements.label"
|
name="%HideNonCElements.label"
|
||||||
|
|
|
@ -154,6 +154,8 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
|
||||||
}
|
}
|
||||||
} else if (element instanceof IParent) {
|
} else if (element instanceof IParent) {
|
||||||
return ((IParent)element).getChildren();
|
return ((IParent)element).getChildren();
|
||||||
|
} else if (element instanceof IProject) {
|
||||||
|
return getResources((IProject)element);
|
||||||
} else if (element instanceof IFolder) {
|
} else if (element instanceof IFolder) {
|
||||||
return getResources((IFolder)element);
|
return getResources((IFolder)element);
|
||||||
}
|
}
|
||||||
|
@ -324,6 +326,14 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
|
||||||
return concatenate(children, objects);
|
return concatenate(children, objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Object[] getResources(IProject project) {
|
||||||
|
try {
|
||||||
|
return project.members();
|
||||||
|
} catch (CoreException e) {
|
||||||
|
}
|
||||||
|
return NO_CHILDREN;
|
||||||
|
}
|
||||||
|
|
||||||
private Object[] getResources(IFolder folder) {
|
private Object[] getResources(IFolder folder) {
|
||||||
ICProject cproject = CoreModel.getDefault().create(folder.getProject());
|
ICProject cproject = CoreModel.getDefault().create(folder.getProject());
|
||||||
Object[] members = null;
|
Object[] members = null;
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2000, 2003 IBM Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Common Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/cpl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM Corporation - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package org.eclipse.cdt.internal.ui.filters;
|
||||||
|
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
|
import org.eclipse.jface.viewers.ViewerFilter;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters closed projects
|
||||||
|
*/
|
||||||
|
public class NonCProjectsFilter extends ViewerFilter {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see ViewerFilter
|
||||||
|
*/
|
||||||
|
public boolean select(Viewer viewer, Object parent, Object element) {
|
||||||
|
if (element instanceof ICProject) {
|
||||||
|
return true;
|
||||||
|
} else if (element instanceof IProject) {
|
||||||
|
return !((IProject)element).isOpen();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue