0

This is my navigator view.

public class myNavigatorView extends ResourceNavigator {

private NavigatorActionGroup navigatorActionGroup;
private CollapseAllHandler collapseAllHandler;
public myNavigatorView() {
    // TODO Auto-generated constructor stub
}
protected void makeActions() {

    navigatorActionGroup = new NavigatorActionGroup( this );
    setActionGroup(navigatorActionGroup);

    IHandlerService service = (IHandlerService) getSite().getService(IHandlerService.class);
    service.activateHandler(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR,
            new ActionHandler(navigatorActionGroup.toggleLinkingAction));
    collapseAllHandler = new CollapseAllHandler(this.getViewer());
    service.activateHandler(CollapseAllHandler.COMMAND_ID,
            collapseAllHandler);
}
}

And when I double clicked the item I selected,the content didn't show in the editor.

layout.setEditorAreaVisible(true);
leftFolder.addView("BIT_DEC.myNavigator");
greg-449
  • 109,219
  • 232
  • 102
  • 145
user2301210
  • 399
  • 3
  • 12

1 Answers1

1

The resource navigator does this for open:

protected void handleOpen(ISelection selection) {
    if (selection instanceof IStructuredSelection) {
        getActionGroup().runDefaultAction((IStructuredSelection)selection);
    }
}

So your action group runDefaultAction method needs to do the open. The resource navigator code does this:

public void runDefaultAction(IStructuredSelection selection) {
    Object element = selection.getFirstElement();
    if (element instanceof IFile) {
        openFileAction.selectionChanged(selection);
        openFileAction.run();
    }
}

where openFileAction is an instance of org.eclipse.ui.actions.OpenFileAction.

Note: ResourceNavigator has been deprecated for a long time!

greg-449
  • 109,219
  • 232
  • 102
  • 145