private void navigateInProjectView() {
    SelectInContext context =
        new SelectInContext() {
          @Override
          @NotNull
          public Project getProject() {
            return myProject;
          }

          @Override
          @NotNull
          public VirtualFile getVirtualFile() {
            return myFile;
          }

          @Override
          @Nullable
          public Object getSelectorInFile() {
            return null;
          }

          @Override
          @Nullable
          public FileEditorProvider getFileEditorProvider() {
            return null;
          }
        };

    for (SelectInTarget target : SelectInManager.getInstance(myProject).getTargets()) {
      if (target.canSelect(context)) {
        target.selectIn(context, true);
        return;
      }
    }
  }
Exemplo n.º 2
0
    private boolean trySelectInCurrentPane(final SNode node) {
      final ProjectView projectView = ProjectView.getInstance(myProject);

      AbstractProjectViewPane selectedPane = projectView.getCurrentProjectViewPane();
      if (selectedPane == null) return false;

      SelectInTarget target = selectedPane.createSelectInTarget();
      if (target == null) return false;

      SNodeReference pointer =
          ModelAccess.instance()
              .runReadAction(
                  new Computable<SNodeReference>() {
                    @Override
                    public SNodeReference compute() {
                      return new jetbrains.mps.smodel.SNodePointer(node);
                    }
                  });
      MySelectInContext context = new MySelectInContext(pointer);
      if (!target.canSelect(context)) return false;

      target.selectIn(context, false);
      return true;
    }