« Return to Thread: Implement "Find in projects"

Implement "Find in projects"

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

Reply to Author | View in Thread

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

 « Return to Thread: Implement "Find in projects"