• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java OpenSourceUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.util.OpenSourceUtil的典型用法代码示例。如果您正苦于以下问题:Java OpenSourceUtil类的具体用法?Java OpenSourceUtil怎么用?Java OpenSourceUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OpenSourceUtil类属于com.intellij.util包,在下文中一共展示了OpenSourceUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addTreeMouseListeners

import com.intellij.util.OpenSourceUtil; //导入依赖的package包/类
private void addTreeMouseListeners() {
    EditSourceOnDoubleClickHandler.install(getTree(), new Runnable() {
        @Override
        public void run() {
            TreePath path = getTree().getSelectionPath();
            if (path == null)
                return;
            DefaultMutableTreeNode selectedElement = (DefaultMutableTreeNode)path.getLastPathComponent();
            if (selectedElement == null)
                return;
            GlobalConfigsTreeStructure.GlobalConfigNode configNode = (GlobalConfigsTreeStructure.GlobalConfigNode)selectedElement.getUserObject();
            if (configNode == null)
                return;
            PsiElement element = configNode.getXmlTag();
            if (element == null)
                return;
            OpenSourceUtil.navigate((Navigatable)element);
        }
    });

    CustomizationUtil.installPopupHandler(getTree(), IdeActions.GROUP_STRUCTURE_VIEW_POPUP, ActionPlaces.STRUCTURE_VIEW_POPUP);
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:23,代码来源:GlobalConfigsToolWindowPanel.java


示例2: addTreeKeyListener

import com.intellij.util.OpenSourceUtil; //导入依赖的package包/类
private void addTreeKeyListener() {
  getTree().addKeyListener(
      new KeyAdapter() {
      @Override
      public void keyPressed(KeyEvent e) {
        if (KeyEvent.VK_ENTER == e.getKeyCode()) {
          DataContext dataContext = DataManager.getInstance().getDataContext(getTree());
          OpenSourceUtil.openSourcesFrom(dataContext, false);
        }
        else if (KeyEvent.VK_ESCAPE == e.getKeyCode()) {
          if (e.isConsumed())
          {
            return;
          }
          PsiCopyPasteManager copyPasteManager = PsiCopyPasteManager.getInstance();
          boolean[] isCopied = new boolean[1];
          if (copyPasteManager.getElements(isCopied) != null && !isCopied[0]) {
            copyPasteManager.clear();
            e.consume();
          }
        }
      }
    });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:StructureViewComponent.java


示例3: actionPerformed

import com.intellij.util.OpenSourceUtil; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final Navigatable[] navigatableArray = e.getData(CommonDataKeys.NAVIGATABLE_ARRAY);
  if (navigatableArray != null && navigatableArray.length > 0) {
    ApplicationManager.getApplication().invokeLater(new Runnable() {
      @Override
      public void run() {
        OpenSourceUtil.navigate(navigatableArray);
      }
    });
    DialogWrapper dialog = DialogWrapper.findInstance(mySourceComponent);
    if (dialog != null && dialog.isModal()) {
      dialog.doCancelAction();
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:EditSourceForDialogAction.java


示例4: scrollToSource

import com.intellij.util.OpenSourceUtil; //导入依赖的package包/类
protected void scrollToSource(final Component tree) {
  DataContext dataContext=DataManager.getInstance().getDataContext(tree);
  getReady(dataContext).doWhenDone(new Runnable() {
    @Override
    public void run() {
      DataContext context = DataManager.getInstance().getDataContext(tree);
      final VirtualFile vFile = CommonDataKeys.VIRTUAL_FILE.getData(context);
      if (vFile != null) {
        // Attempt to navigate to the virtual file with unknown file type will show a modal dialog
        // asking to register some file type for this file. This behaviour is undesirable when autoscrolling.
        if (vFile.getFileType() == FileTypes.UNKNOWN || vFile.getFileType() instanceof INativeFileType) return;

        //IDEA-84881 Don't autoscroll to very large files
        if (vFile.getLength() > PersistentFSConstants.getMaxIntellisenseFileSize()) return;
      }
      Navigatable[] navigatables = CommonDataKeys.NAVIGATABLE_ARRAY.getData(context);
      if (navigatables != null) {
        if (navigatables.length > 1) {
          return;
        }
        for (Navigatable navigatable : navigatables) {
          // we are not going to open modal dialog during autoscrolling
          if (!navigatable.canNavigateToSource()) return;
        }
      }
      OpenSourceUtil.navigate(false, true, navigatables);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:AutoScrollToSourceHandler.java


示例5: onSelected

import com.intellij.util.OpenSourceUtil; //导入依赖的package包/类
public void onSelected(@Nullable final SMTestProxy selectedTestProxy,
                       @NotNull final TestResultsViewer viewer,
                       @NotNull final TestFrameworkRunningModel model) {
  //TODO: tests o "onSelected"
  SMRunnerUtil.runInEventDispatchThread(new Runnable() {
    public void run() {
      if (ScrollToTestSourceAction.isScrollEnabled(model)) {
        final Navigatable descriptor = TestsUIUtil.getOpenFileDescriptor(selectedTestProxy, model);
        if (descriptor != null) {
          OpenSourceUtil.navigate(false, descriptor);
        }
      }
    }
  }, ModalityState.NON_MODAL);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:SMTRunnerUIActionsHandler.java


示例6: actionPerformed

import com.intellij.util.OpenSourceUtil; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
  final Navigatable[] navigatableArray = e.getData(CommonDataKeys.NAVIGATABLE_ARRAY);
  if (navigatableArray != null && navigatableArray.length > 0) {
    ApplicationManager.getApplication().invokeLater(new Runnable() {
      public void run() {
        OpenSourceUtil.navigate(navigatableArray);
      }
    });
    DialogWrapper dialog = DialogWrapper.findInstance(mySourceComponent);
    if (dialog != null && dialog.isModal()) {
      dialog.doCancelAction();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:EditSourceForDialogAction.java


示例7: initTree

import com.intellij.util.OpenSourceUtil; //导入依赖的package包/类
private void initTree() {
  myTree.setCellRenderer(new MyTreeCellRenderer());
  myTree.setRootVisible(false);
  myTree.setShowsRootHandles(true);
  UIUtil.setLineStyleAngled(myTree);
  TreeUtil.installActions(myTree);
  EditSourceOnDoubleClickHandler.install(myTree);
  new TreeSpeedSearch(myTree);
  myCopyPasteDelegator = new CopyPasteDelegator(myProject, this) {
    @Override
    @NotNull
    protected PsiElement[] getSelectedElements() {
      return getSelectedPsiElements();
    }
  };
  myTreeExpansionMonitor = PackageTreeExpansionMonitor.install(myTree, myProject);
  final ScopeTreeStructureExpander[] extensions = Extensions.getExtensions(ScopeTreeStructureExpander.EP_NAME, myProject);
  for (ScopeTreeStructureExpander expander : extensions) {
    myTree.addTreeWillExpandListener(expander);
  }
  if (extensions.length == 0) {
    myTree.addTreeWillExpandListener(new SortingExpandListener());
  }
  myTree.addKeyListener(new KeyAdapter() {
    @Override
    public void keyPressed(KeyEvent e) {
      if (KeyEvent.VK_ENTER == e.getKeyCode()) {
        final Object component = myTree.getLastSelectedPathComponent();
        if (component instanceof DefaultMutableTreeNode) {
          final DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)component;
          if (selectedNode.isLeaf()) {
            OpenSourceUtil.openSourcesFrom(DataManager.getInstance().getDataContext(myTree), false);
          }
        }
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:ScopeTreeViewPanel.java


示例8: doClickAction

import com.intellij.util.OpenSourceUtil; //导入依赖的package包/类
static void doClickAction(AnActionEvent e, Collection<Define> set, String title) {
  if (set.size() == 1) {
    final Navigatable n = (Navigatable)set.iterator().next().getPsiElement();
    OpenSourceUtil.navigate(true, n);
  } else {
    final Define[] array = set.toArray(new Define[set.size()]);
    NavigationUtil.getPsiElementPopup(ContainerUtil.map(array, new Function<Define, PsiElement>() {
      @Override
      public PsiElement fun(Define define) {
        return define.getPsiElement();
      }
    }, PsiElement.EMPTY_ARRAY), title).show(new RelativePoint((MouseEvent)e.getInputEvent()));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:OverridingDefineRenderer.java


示例9: valueChanged

import com.intellij.util.OpenSourceUtil; //导入依赖的package包/类
public void valueChanged(TreeSelectionEvent e) {
  TreePath path = e.getPath();
  if (path == null) return;
  TestProxy proxy = (TestProxy)tree.getSelectedTest();
  if (proxy == null) return;
  if (ScrollToTestSourceAction.isScrollEnabled(TestNGResults.this)) {
    OpenSourceUtil.openSourcesFrom(tree, false);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:TestNGResults.java


示例10: scrollToSource

import com.intellij.util.OpenSourceUtil; //导入依赖的package包/类
protected void scrollToSource(final Component tree) {
  DataContext dataContext=DataManager.getInstance().getDataContext(tree);
  getReady(dataContext).doWhenDone(new Runnable() {
    @Override
    public void run() {
      DataContext context = DataManager.getInstance().getDataContext(tree);
      final VirtualFile vFile = PlatformDataKeys.VIRTUAL_FILE.getData(context);
      if (vFile != null) {
        // Attempt to navigate to the virtual file with unknown file type will show a modal dialog
        // asking to register some file type for this file. This behaviour is undesirable when autoscrolling.
        if (vFile.getFileType() == FileTypes.UNKNOWN || vFile.getFileType() instanceof INativeFileType) return;

        //IDEA-84881 Don't autoscroll to very large files
        if (vFile.getLength() > PersistentFSConstants.getMaxIntellisenseFileSize()) return;
      }
      Navigatable[] navigatables = PlatformDataKeys.NAVIGATABLE_ARRAY.getData(context);
      if (navigatables != null) {
        if (navigatables.length > 1) {
          return;
        }
        for (Navigatable navigatable : navigatables) {
          // we are not going to open modal dialog during autoscrolling
          if (!navigatable.canNavigateToSource()) return;
        }
      }
      OpenSourceUtil.navigate(false, true, navigatables);
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:30,代码来源:AutoScrollToSourceHandler.java


示例11: onSelected

import com.intellij.util.OpenSourceUtil; //导入依赖的package包/类
public void onSelected(@Nullable final SMTestProxy selectedTestProxy,
                       @NotNull final TestResultsViewer viewer,
                       @NotNull final TestFrameworkRunningModel model) {
  //TODO: tests o "onSelected"
  SMRunnerUtil.runInEventDispatchThread(new Runnable() {
    public void run() {
      if (ScrollToTestSourceAction.isScrollEnabled(model)) {
        OpenSourceUtil.openSourcesFrom(model.getTreeView(), false);
      }
    }
  }, ModalityState.NON_MODAL);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:SMTRunnerUIActionsHandler.java


示例12: actionPerformed

import com.intellij.util.OpenSourceUtil; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
  final Navigatable[] navigatableArray = e.getData(PlatformDataKeys.NAVIGATABLE_ARRAY);
  if (navigatableArray != null && navigatableArray.length > 0) {
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        OpenSourceUtil.navigate(navigatableArray);
      }
    });
    myDialogWrapper.doCancelAction();
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:EditSourceInCommitAction.java


示例13: initTree

import com.intellij.util.OpenSourceUtil; //导入依赖的package包/类
private void initTree() {
  myTree.setCellRenderer(new MyTreeCellRenderer());
  myTree.setRootVisible(false);
  myTree.setShowsRootHandles(true);
  UIUtil.setLineStyleAngled(myTree);
  TreeUtil.installActions(myTree);
  EditSourceOnDoubleClickHandler.install(myTree);
  new TreeSpeedSearch(myTree);
  myCopyPasteDelegator = new CopyPasteDelegator(myProject, this) {
    @Override
    @NotNull
    protected PsiElement[] getSelectedElements() {
      return getSelectedPsiElements();
    }
  };
  myTreeExpansionMonitor = PackageTreeExpansionMonitor.install(myTree, myProject);
  final ScopeTreeStructureExpander[] extensions = Extensions.getExtensions(ScopeTreeStructureExpander.EP_NAME, myProject);
  for (ScopeTreeStructureExpander expander : extensions) {
    myTree.addTreeWillExpandListener(expander);
  }
  if (extensions.length == 0) {
    myTree.addTreeWillExpandListener(new SortingExpandListener());
  }
  myTree.addKeyListener(new KeyAdapter() {
    @Override
    public void keyPressed(KeyEvent e) {
      if (KeyEvent.VK_ENTER == e.getKeyCode()) {
        final Object component = myTree.getLastSelectedPathComponent();
        if (component instanceof DefaultMutableTreeNode) {
          final DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)component;
          if (selectedNode.isLeaf()) {
            OpenSourceUtil.openSourcesFrom(DataManager.getInstance().getDataContext(myTree), false);
          }
        }
      }
    }
  });
  CustomizationUtil.installPopupHandler(myTree, IdeActions.GROUP_PROJECT_VIEW_POPUP, ActionPlaces.PROJECT_VIEW_POPUP);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:40,代码来源:ScopeTreeViewPanel.java


示例14: doClickAction

import com.intellij.util.OpenSourceUtil; //导入依赖的package包/类
static void doClickAction(AnActionEvent e, Collection<Define> set, String title) {
  if (set.size() == 1) {
    final Navigatable n = (Navigatable)set.iterator().next().getPsiElement();
    OpenSourceUtil.navigate(true, n);
  } else {
    final Define[] array = set.toArray(new Define[set.size()]);
    NavigationUtil.getPsiElementPopup(ContainerUtil.map(array, new Function<Define, PsiElement>() {
      public PsiElement fun(Define define) {
        return define.getPsiElement();
      }
    }, PsiElement.EMPTY_ARRAY), title).show(new RelativePoint((MouseEvent)e.getInputEvent()));
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:OverridingDefineRenderer.java


示例15: scrollToSource

import com.intellij.util.OpenSourceUtil; //导入依赖的package包/类
protected void scrollToSource(final Component tree) {
  DataContext dataContext=DataManager.getInstance().getDataContext(tree);
  getReady(dataContext).doWhenDone(new Runnable() {
    @Override
    public void run() {
      DataContext context = DataManager.getInstance().getDataContext(tree);
      final VirtualFile vFile = context.getData(PlatformDataKeys.VIRTUAL_FILE);
      if (vFile != null) {
        // Attempt to navigate to the virtual file with unknown file type will show a modal dialog
        // asking to register some file type for this file. This behaviour is undesirable when autoscrolling.
        if (vFile.getFileType() == UnknownFileType.INSTANCE || vFile.getFileType() instanceof INativeFileType) return;

        //IDEA-84881 Don't autoscroll to very large files
        if (vFile.getLength() > PersistentFSConstants.getMaxIntellisenseFileSize()) return;
      }
      Navigatable[] navigatables = context.getData(PlatformDataKeys.NAVIGATABLE_ARRAY);
      if (navigatables != null) {
        if (navigatables.length > 1) {
          return;
        }
        for (Navigatable navigatable : navigatables) {
          // we are not going to open modal dialog during autoscrolling
          if (!navigatable.canNavigateToSource()) return;
        }
      }
      OpenSourceUtil.openSourcesFrom(context, false);
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:30,代码来源:AutoScrollToSourceHandler.java


示例16: initTree

import com.intellij.util.OpenSourceUtil; //导入依赖的package包/类
private void initTree() {
  myTree.setCellRenderer(new MyTreeCellRenderer());
  myTree.setRootVisible(false);
  myTree.setShowsRootHandles(true);
  UIUtil.setLineStyleAngled(myTree);
  TreeUtil.installActions(myTree);
  EditSourceOnDoubleClickHandler.install(myTree);
  new TreeSpeedSearch(myTree);
  myCopyPasteDelegator = new CopyPasteDelegator(myProject, this) {
    @Override
    @Nonnull
    protected PsiElement[] getSelectedElements() {
      return getSelectedPsiElements();
    }
  };
  myTreeExpansionMonitor = PackageTreeExpansionMonitor.install(myTree, myProject);
  final ScopeTreeStructureExpander[] extensions = Extensions.getExtensions(ScopeTreeStructureExpander.EP_NAME, myProject);
  for (ScopeTreeStructureExpander expander : extensions) {
    myTree.addTreeWillExpandListener(expander);
  }
  if (extensions.length == 0) {
    myTree.addTreeWillExpandListener(new SortingExpandListener());
  }
  myTree.addKeyListener(new KeyAdapter() {
    @Override
    public void keyPressed(KeyEvent e) {
      if (KeyEvent.VK_ENTER == e.getKeyCode()) {
        final Object component = myTree.getLastSelectedPathComponent();
        if (component instanceof DefaultMutableTreeNode) {
          final DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)component;
          if (selectedNode.isLeaf()) {
            OpenSourceUtil.openSourcesFrom(DataManager.getInstance().getDataContext(myTree), false);
          }
        }
      }
    }
  });
  CustomizationUtil.installPopupHandler(myTree, IdeActions.GROUP_PROJECT_VIEW_POPUP, ActionPlaces.PROJECT_VIEW_POPUP);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:40,代码来源:ScopeTreeViewPanel.java


示例17: doClickAction

import com.intellij.util.OpenSourceUtil; //导入依赖的package包/类
static void doClickAction(AnActionEvent e, Collection<Define> set, String title) {
  if (set.size() == 1) {
    final Navigatable n = (Navigatable)set.iterator().next().getPsiElement();
    OpenSourceUtil.navigate(true, n);
  } else {
    final Define[] array = set.toArray(new Define[set.size()]);
    NavigationUtil.getPsiElementPopup(ContainerUtil.map(array, define -> define.getPsiElement(), PsiElement.EMPTY_ARRAY), title).show(new RelativePoint((MouseEvent)e.getInputEvent()));
  }
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:10,代码来源:OverridingDefineRenderer.java


示例18: actionPerformed

import com.intellij.util.OpenSourceUtil; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
  DataContext dataContext = e.getDataContext();
  OpenSourceUtil.navigate(myFocusEditor, getNavigatables(dataContext));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:BaseNavigateToSourceAction.java


示例19: selectInEditor

import com.intellij.util.OpenSourceUtil; //导入依赖的package包/类
public static void selectInEditor(final JComponent component) {
  OpenSourceUtil.openSourcesFrom(DataManager.getInstance().getDataContext(component), false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:SelectInEditorHandler.java


示例20: createPanel

import com.intellij.util.OpenSourceUtil; //导入依赖的package包/类
private JPanel createPanel() {
  createModel();
  myTree = new MyTree();
  myTree.setLineStyleAngled();
  myTree.setRootVisible(false);
  myTree.setShowsRootHandles(true);
  myTree.updateUI();
  myTree.setLargeModel(true);

  myTree.addKeyListener(new KeyAdapter() {
    public void keyPressed(KeyEvent e) {
      if (e.getKeyCode() == KeyEvent.VK_ENTER) {
        OpenSourceUtil.openSourcesFrom(DataManager.getInstance().getDataContext(myTree), false);
      }
    }
  });

  myTree.addMouseListener(new PopupHandler() {
    public void invokePopup(Component comp, int x, int y) {
      popupInvoked(comp, x, y);
    }
  });

  EditSourceOnDoubleClickHandler.install(myTree);

  myAutoScrollToSourceHandler.install(myTree);

  myOccurenceNavigatorSupport = new OccurenceNavigatorSupport(myTree) {
    protected Navigatable createDescriptorForNode(DefaultMutableTreeNode node) {
      if (!(node instanceof MessageNode)) {
        return null;
      }
      MessageNode messageNode = (MessageNode)node;
      AntBuildMessageView.MessageType type = messageNode.getType();

      if (type != AntBuildMessageView.MessageType.MESSAGE && type != AntBuildMessageView.MessageType.ERROR) {
        return null;
      }

      if (!isValid(messageNode.getFile())) {
        return null;
      }

      return new OpenFileDescriptor(myProject, messageNode.getFile(), messageNode.getOffset());
    }

    @Nullable
    public String getNextOccurenceActionName() {
      return AntBundle.message("ant.execution.next.error.warning.action.name");
    }

    @Nullable
    public String getPreviousOccurenceActionName() {
      return AntBundle.message("ant.execution.previous.error.warning.action.name");
    }
  };

  return JBUI.Panels.simplePanel(MessageTreeRenderer.install(myTree));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:60,代码来源:TreeView.java



注:本文中的com.intellij.util.OpenSourceUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NodeStatusPBImpl类代码示例发布时间:2022-05-22
下一篇:
Java FileSystemReleaseFilter类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap