Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Common filter makes contents of unfilter projects disappearing
Common filter makes contents of unfilter projects disappearing [message #330455] Tue, 29 July 2008 13:51 Go to next message
Eclipse UserFriend
Originally posted by: longhong1985.gmail.com

Hello. I am now using CNF to design a navigator view. I want the view to
show only a kind of IProject which contains my own IProjectNature(named
BSProjectNature). My filter is as following:
<extension
point="org.eclipse.ui.navigator.navigatorContent">
<commonFilter
activeByDefault="true"
id="org.opensuse.bs.ui.filters.hideNonBSProject"
name="Hide Non BS-Project">
<filterExpression>
<not>
<adapt
type="org.eclipse.core.resources.IProject">
<test
property="org.eclipse.core.resources.projectNature"
value="org.opensuse.bs.ui.bsprojectnature">
</test>
</adapt>
</not>
</filterExpression>
</commonFilter>
</extension>
The filter works, filtering all the non-bsproject. But it also makes
bsprojects to be just IProject nodes-folders and files of a bsproject
cannot be seen in the navigator then! I don't know why...Can anyone help?
Re: Common filter makes contents of unfilter projects disappearing [message #330457 is a reply to message #330455] Tue, 29 July 2008 14:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: longhong1985.gmail.com

Instead of using org.eclipse.core.expression in the Common filter, I
extends the ViewerFilter to filter nessesary IProjects. The MyViewFilter
just do the same work as the expression:
public class NonBSProjectFilter extends ViewerFilter {

public boolean select(Viewer viewer, Object parentElement, Object
element) {
if(element instanceof IProject) {
IProject project = (IProject) element;
try {
if(project.hasNature("org.opensuse.bs.ui.bsprojectnature")) {
return true;
}
else {
return false;
}
}catch(CoreException e) {
e.printStackTrace();
}
}
return true;
}

}
MyViewFilter doesn't filter elements of bsprojects. I don't know why
expression filters elements of bsprojects.
Re: Common filter makes contents of unfilter projects disappearing [message #330459 is a reply to message #330457] Tue, 29 July 2008 14:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: longhong1985.gmail.com

Sorry. My platform is:
Opensuse 11.0 Gnome
Eclipse 3.3.2
Sun Java 1.6.0u6
Re: Common filter makes contents of unfilter projects disappearing [message #330463 is a reply to message #330455] Tue, 29 July 2008 15:51 Go to previous messageGo to next message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
You should add to your filter that you want to see IFiles and IFolders,
that should do what you want.

longhong wrote:
> Hello. I am now using CNF to design a navigator view. I want the view to
> show only a kind of IProject which contains my own IProjectNature(named
> BSProjectNature). My filter is as following:
> <extension
> point="org.eclipse.ui.navigator.navigatorContent">
> <commonFilter
> activeByDefault="true"
> id="org.opensuse.bs.ui.filters.hideNonBSProject"
> name="Hide Non BS-Project">
> <filterExpression>
> <not>
> <adapt
> type="org.eclipse.core.resources.IProject">
> <test
> property="org.eclipse.core.resources.projectNature"
> value="org.opensuse.bs.ui.bsprojectnature">
> </test>
> </adapt>
> </not>
> </filterExpression>
> </commonFilter>
> </extension>
> The filter works, filtering all the non-bsproject. But it also makes
> bsprojects to be just IProject nodes-folders and files of a bsproject
> cannot be seen in the navigator then! I don't know why...Can anyone help?
>


--
*new* Common Navigator Framework section in:
3.4RC4 Platform Plugin Developer Guide (Programmer's Guide)
http://help.eclipse.org/ganymede/topic/org.eclipse.platform. doc.isv/guide/cnf.htm
http://dev.eclipse.org/blogs/francis
http://wiki.eclipse.org/Common_Navigator_Framework
http://wiki.eclipse.org/Common_Navigator_Framework_Use_Cases


You have brains in your head.
You have feet in your shoes.
- Dr Seuss, Oh the Places You'll Go


Re: Common filter makes contents of unfilter projects disappearing [message #330465 is a reply to message #330463] Tue, 29 July 2008 15:54 Go to previous message
Eclipse UserFriend
Originally posted by: longhong1985.gmail.com

I see. Thanks! :-)
Previous Topic:Code assist
Next Topic:open my editor only on .css files in PlugIn projects
Goto Forum:
  


Current Time: Fri Jul 05 03:25:04 GMT 2024

Powered by FUDForum. Page generated in 0.87329 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top