Implement "Find in projects"

View: New views
2 Messages — Rating Filter:   Alert me  

Implement "Find in projects"

by Marcus Blümel-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi folks,

I would like to implement the "find in projects" feature to files opened with my
custom project.
I created at first a very basic LogicalViewProvider that looked like this:

DataObject projectDirDO = DataObject.find(project.getProjectDirectory());
AbstractNode folderNode =  (AbstractNode) projectDirDO.getNodeDelegate();
folderNode.setIconBaseWithExtension("sims/limbsim/project/nb/LimbsProjectFileIcon.png");
return folderNode;

In this case I get an error message in case I press Shift+CRTL+1 on an open
document complaining about a missing "Project" in the nodes lookup.
Then I added the Project into the lookup of the node created in the
LogicalViewProvider. So I added the the following to the lines above:

FilterNode fn = new FilterNode(folderNode, null,
  new ProxyLookup(folderNode.getLookup(),
  Lookups.fixed(new Object[]{project})));
return fn;

Now the error message disappears but in the status bar appears:
"The document node could not be found in the Projects tab."

Question:
What is the easiest (or preferred) way to add this functionality to the
documents opened by a project. By the way, the "Find in files" action works.

Greetings,
Marcus

Re: Implement "Find in projects"

by Geoff Longo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ctrl-Shift-1 is "Select in Projects", is that what you mean?  If so,
did you implement the findPath(Node root, Object target) method in
your logical view provider?

On 5/8/08, Marcus Blümel <marcus.bluemel@...> wrote:

> Hi folks,
>
>  I would like to implement the "find in projects" feature to files opened
> with my custom project.
>  I created at first a very basic LogicalViewProvider that looked like this:
>
>  DataObject projectDirDO =
> DataObject.find(project.getProjectDirectory());
>  AbstractNode folderNode =  (AbstractNode) projectDirDO.getNodeDelegate();
> folderNode.setIconBaseWithExtension("sims/limbsim/project/nb/LimbsProjectFileIcon.png");
>  return folderNode;
>
>  In this case I get an error message in case I press Shift+CRTL+1 on an open
> document complaining about a missing "Project" in the nodes lookup.
>  Then I added the Project into the lookup of the node created in the
> LogicalViewProvider. So I added the the following to the lines above:
>
>  FilterNode fn = new FilterNode(folderNode, null,
>   new ProxyLookup(folderNode.getLookup(),
>   Lookups.fixed(new Object[]{project})));
>  return fn;
>
>  Now the error message disappears but in the status bar appears:
>  "The document node could not be found in the Projects tab."
>
>  Question:
>  What is the easiest (or preferred) way to add this functionality to the
> documents opened by a project. By the way, the "Find in files" action works.
>
>  Greetings,
>  Marcus
>