Java 类com.intellij.util.EditSourceOnEnterKeyHandler 实例源码

项目:tools-idea    文件:FilesystemToolwindow.java   
public FilesystemToolwindow(final VirtualFile root, Project project) {
  myRoot = root;
  myProject = project;

  myToolWindow = ToolWindowManager.getInstance(project).registerToolWindow("File System", false, ToolWindowAnchor.LEFT);
  myContent = new MyContent();

  final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, true, false, true, true);
  descriptor.setRoots(myRoot);

  myFsTree = new FileSystemTreeImpl(project, descriptor);
  myContent.add(ScrollPaneFactory.createScrollPane(myFsTree.getTree()), BorderLayout.CENTER);
  EditSourceOnDoubleClickHandler.install(myFsTree.getTree());
  EditSourceOnEnterKeyHandler.install(myFsTree.getTree());

  final ContentFactory contentFactory = new ContentFactoryImpl();
  final Content content = contentFactory.createContent(myContent, null, false);
  myToolWindow.getContentManager().addContent(content);
}
项目:intellij-ce-playground    文件:UnversionedViewDialog.java   
public UnversionedViewDialog(final Project project) {
  super(project, true);
  setTitle("Unversioned Files");
  myProject = project;
  final Runnable closer = new Runnable() {
    public void run() {
      UnversionedViewDialog.this.close(0);
    }
  };
  myView = new ChangesListView(project) {
    @Override
    public void calcData(DataKey key, DataSink sink) {
      super.calcData(key, sink);
      if (ChangesListView.UNVERSIONED_FILES_DATA_KEY.is(key.getName())) {
        sink.put(key, Arrays.asList(getSelectedFiles()));
      }
    }

    @Override
    protected void editSourceRegistration() {
      EditSourceOnDoubleClickHandler.install(this, closer);
      EditSourceOnEnterKeyHandler.install(this, closer);
    }
  };
  myChangeListManager = ChangeListManager.getInstance(project);
  createPanel();
  setOKButtonText("Close");

  init();
  initData(((ChangeListManagerImpl) myChangeListManager).getUnversionedFiles());
  myView.setMinimumSize(new Dimension(100, 100));
}
项目:intellij-ce-playground    文件:EditorsPanel.java   
public EditorsPanel(final Project project, List<EditorInfo> editors) {
  super(new BorderLayout());
  myProject = project;
  myModel.setItems(editors);
  add(ScrollPaneFactory.createScrollPane(myTable), BorderLayout.CENTER);
  EditSourceOnDoubleClickHandler.install(myTable);
  EditSourceOnEnterKeyHandler.install(myTable, null);
}
项目:intellij-ce-playground    文件:IntersectingLocalChangesPanel.java   
private void initUI() {
  final DefaultMutableTreeNode root = new DefaultMutableTreeNode();

  myJTree = new JTree(root);
  myJTree.setRootVisible(false);
  myJTree.setShowsRootHandles(false);
  myJTree.setCellRenderer(new ChangesBrowserNodeRenderer(myProject, true, false));

  TreeModelBuilder builder = new TreeModelBuilder(myProject, true);
  final DefaultTreeModel treeModel = builder.buildModelFromFilePaths(myFilesToShow);
  myJTree.setModel(treeModel);

  myJTree.expandPath(new TreePath(root.getPath()));

  final JLabel label = new JLabel(myText) {
    @Override
    public Dimension getPreferredSize() {
      final Dimension superValue = super.getPreferredSize();
      return new Dimension((int) superValue.getWidth(), (int) (superValue.getHeight() * 1.7));
    }
  };
  label.setUI(new MultiLineLabelUI());
  label.setBackground(UIUtil.getTextFieldBackground());
  label.setVerticalTextPosition(JLabel.TOP);
  myPanel.setBackground(UIUtil.getTextFieldBackground());
  myPanel.add(label, BorderLayout.NORTH);
  myPanel.add(myJTree, BorderLayout.CENTER);

  EditSourceOnDoubleClickHandler.install(myJTree);
  EditSourceOnEnterKeyHandler.install(myJTree);

  final EditSourceAction editSourceAction = new EditSourceAction();
  editSourceAction.registerCustomShortcutSet(CommonShortcuts.getEditSource(), myPanel);
}
项目:tools-idea    文件:UnversionedViewDialog.java   
public UnversionedViewDialog(final Project project) {
  super(project, true);
  setTitle("Unversioned Files");
  myProject = project;
  final Runnable closer = new Runnable() {
    public void run() {
      UnversionedViewDialog.this.close(0);
    }
  };
  myView = new ChangesListView(project) {
    @Override
    public void calcData(DataKey key, DataSink sink) {
      super.calcData(key, sink);
      if (ChangesListView.UNVERSIONED_FILES_DATA_KEY.is(key.getName())) {
        sink.put(key, Arrays.asList(getSelectedFiles()));
      }
    }

    @Override
    protected void editSourceRegistration() {
      EditSourceOnDoubleClickHandler.install(this, closer);
      EditSourceOnEnterKeyHandler.install(this, closer);
    }
  };
  myChangeListManager = ChangeListManager.getInstance(project);
  createPanel();
  setOKButtonText("Close");

  init();
  initData(((ChangeListManagerImpl) myChangeListManager).getUnversionedFiles());
  myView.setMinimumSize(new Dimension(100, 100));
}
项目:tools-idea    文件:EditorsPanel.java   
public EditorsPanel(final Project project, List<EditorInfo> editors) {
  super(new BorderLayout());
  myProject = project;
  myModel.setItems(editors);
  add(ScrollPaneFactory.createScrollPane(myTable), BorderLayout.CENTER);
  EditSourceOnDoubleClickHandler.install(myTable);
  EditSourceOnEnterKeyHandler.install(myTable, null);
}
项目:tools-idea    文件:IntersectingLocalChangesPanel.java   
private void initUI() {
  final DefaultMutableTreeNode root = new DefaultMutableTreeNode();

  myJTree = new JTree(root);
  myJTree.setRootVisible(false);
  myJTree.setShowsRootHandles(false);
  myJTree.setCellRenderer(new ChangesBrowserNodeRenderer(myProject, true, false));

  TreeModelBuilder builder = new TreeModelBuilder(myProject, true);
  final DefaultTreeModel treeModel = builder.buildModelFromFilePaths(myFilesToShow);
  myJTree.setModel(treeModel);

  myJTree.expandPath(new TreePath(root.getPath()));

  final JLabel label = new JLabel(myText) {
    @Override
    public Dimension getPreferredSize() {
      final Dimension superValue = super.getPreferredSize();
      return new Dimension((int) superValue.getWidth(), (int) (superValue.getHeight() * 1.7));
    }
  };
  label.setUI(new MultiLineLabelUI());
  label.setBackground(UIUtil.getTextFieldBackground());
  label.setVerticalTextPosition(JLabel.TOP);
  myPanel.setBackground(UIUtil.getTextFieldBackground());
  myPanel.add(label, BorderLayout.NORTH);
  myPanel.add(myJTree, BorderLayout.CENTER);

  EditSourceOnDoubleClickHandler.install(myJTree);
  EditSourceOnEnterKeyHandler.install(myJTree);

  final EditSourceAction editSourceAction = new EditSourceAction();
  editSourceAction.registerCustomShortcutSet(CommonShortcuts.getEditSource(), myPanel);
}
项目:consulo    文件:SpecificFilesViewDialog.java   
protected SpecificFilesViewDialog(@Nonnull Project project,
                                  @Nonnull String title,
                                  @Nonnull Key<Stream<VirtualFile>> shownDataKey,
                                  @Nonnull List<VirtualFile> initDataFiles) {
  super(project, true);
  setTitle(title);
  myProject = project;
  final Runnable closer = () -> this.close(0);
  myView = new ChangesListView(project) {
    @Override
    public void calcData(Key<?> key, DataSink sink) {
      super.calcData(key, sink);
      if (shownDataKey == key) {
        sink.put(shownDataKey, getSelectedFiles());
      }
    }

    @Override
    protected void editSourceRegistration() {
      EditSourceOnDoubleClickHandler.install(this, closer);
      EditSourceOnEnterKeyHandler.install(this, closer);
    }
  };
  myChangeListManager = ChangeListManager.getInstance(project);
  createPanel();
  setOKButtonText("Close");

  init();
  initData(initDataFiles);
  myView.setMinimumSize(new Dimension(100, 100));
}
项目:intellij-ce-playground    文件:TreeUIHelperImpl.java   
public void installEditSourceOnEnterKeyHandler(final JTree tree) {
  EditSourceOnEnterKeyHandler.install(tree);
}
项目:intellij-ce-playground    文件:UpdateInfoTree.java   
private void createTree() {
  SmartExpander.installOn(myTree);
  SelectionSaver.installOn(myTree);
  createTreeModel();

  myTree.addTreeSelectionListener(new TreeSelectionListener() {
    public void valueChanged(TreeSelectionEvent e) {
      AbstractTreeNode treeNode = (AbstractTreeNode)e.getPath().getLastPathComponent();
      VirtualFilePointer pointer = null;
      if (treeNode instanceof FileTreeNode) {
        pointer = ((FileTreeNode)treeNode).getFilePointer();
      }
      if (pointer != null && pointer.isValid()) {
        mySelectedUrl = pointer.getUrl();
        mySelectedFile = pointer.getFile();
      }
      else {
        mySelectedUrl = null;
        mySelectedFile = null;
      }
    }
  });
  myTree.setCellRenderer(new UpdateTreeCellRenderer());
  TreeUtil.installActions(myTree);
  new TreeSpeedSearch(myTree, new Convertor<TreePath, String>() {
    public String convert(TreePath path) {
      Object last = path.getLastPathComponent();
      if (last instanceof AbstractTreeNode) {
        return ((AbstractTreeNode)last).getText();
      }
      return TreeSpeedSearch.NODE_DESCRIPTOR_TOSTRING.convert(path);
    }
  }, true);

  myTree.addMouseListener(new PopupHandler() {
    public void invokePopup(Component comp, int x, int y) {
      final DefaultActionGroup group = (DefaultActionGroup)ActionManager.getInstance().getAction("UpdateActionGroup");
      if (group != null) { //if no UpdateActionGroup was configured
        ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UPDATE_POPUP,
                                                                                      group);
        popupMenu.getComponent().show(comp, x, y);
      }
    }
  });
  EditSourceOnDoubleClickHandler.install(myTree);
  EditSourceOnEnterKeyHandler.install(myTree);

  myTree.setSelectionRow(0);
}
项目:intellij-ce-playground    文件:ChangesListView.java   
protected void editSourceRegistration() {
  EditSourceOnDoubleClickHandler.install(this);
  EditSourceOnEnterKeyHandler.install(this);
}
项目:tools-idea    文件:TreeUIHelperImpl.java   
public void installEditSourceOnEnterKeyHandler(final JTree tree) {
  EditSourceOnEnterKeyHandler.install(tree);
}
项目:tools-idea    文件:UpdateInfoTree.java   
private void createTree() {
  SmartExpander.installOn(myTree);
  SelectionSaver.installOn(myTree);
  createTreeModel();

  myTree.addTreeSelectionListener(new TreeSelectionListener() {
    public void valueChanged(TreeSelectionEvent e) {
      AbstractTreeNode treeNode = (AbstractTreeNode)e.getPath().getLastPathComponent();
      VirtualFilePointer pointer = null;
      if (treeNode instanceof FileTreeNode) {
        pointer = ((FileTreeNode)treeNode).getFilePointer();
      }
      if (pointer != null && pointer.isValid()) {
        mySelectedUrl = pointer.getUrl();
        mySelectedFile = pointer.getFile();
      }
      else {
        mySelectedUrl = null;
        mySelectedFile = null;
      }
    }
  });
  myTree.setCellRenderer(new UpdateTreeCellRenderer());
  TreeUtil.installActions(myTree);
  new TreeSpeedSearch(myTree, new Convertor<TreePath, String>() {
    public String convert(TreePath path) {
      Object last = path.getLastPathComponent();
      if (last instanceof AbstractTreeNode) {
        return ((AbstractTreeNode)last).getName();
      }
      return TreeSpeedSearch.NODE_DESCRIPTOR_TOSTRING.convert(path);
    }
  });

  myTree.addMouseListener(new PopupHandler() {
    public void invokePopup(Component comp, int x, int y) {
      final DefaultActionGroup group = (DefaultActionGroup)ActionManager.getInstance().getAction("UpdateActionGroup");
      if (group != null) { //if no UpdateActionGroup was configured
        ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UPDATE_POPUP,
                                                                                      group);
        popupMenu.getComponent().show(comp, x, y);
      }
    }
  });
  EditSourceOnDoubleClickHandler.install(myTree);
  EditSourceOnEnterKeyHandler.install(myTree);

  myTree.setSelectionRow(0);
}
项目:tools-idea    文件:ChangesListView.java   
protected void editSourceRegistration() {
  EditSourceOnDoubleClickHandler.install(this);
  EditSourceOnEnterKeyHandler.install(this);
}
项目:consulo    文件:TreeUIHelperImpl.java   
@Override
public void installEditSourceOnEnterKeyHandler(final JTree tree) {
  EditSourceOnEnterKeyHandler.install(tree);
}
项目:consulo    文件:UpdateInfoTree.java   
private void createTree() {
  SmartExpander.installOn(myTree);
  SelectionSaver.installOn(myTree);
  createTreeModel();

  myTree.addTreeSelectionListener(new TreeSelectionListener() {
    public void valueChanged(TreeSelectionEvent e) {
      AbstractTreeNode treeNode = (AbstractTreeNode)e.getPath().getLastPathComponent();
      VirtualFilePointer pointer = null;
      if (treeNode instanceof FileTreeNode) {
        pointer = ((FileTreeNode)treeNode).getFilePointer();
        if (!pointer.isValid()) pointer = null;
      }
      if (pointer != null) {
        mySelectedUrl = getFilePath(pointer);
        mySelectedFile = pointer.getFile();
      }
      else {
        mySelectedUrl = null;
        mySelectedFile = null;
      }
    }
  });
  myTree.setCellRenderer(new UpdateTreeCellRenderer());
  TreeUtil.installActions(myTree);
  new TreeSpeedSearch(myTree, path -> {
    Object last = path.getLastPathComponent();
    if (last instanceof AbstractTreeNode) {
      return ((AbstractTreeNode)last).getText();
    }
    return TreeSpeedSearch.NODE_DESCRIPTOR_TOSTRING.convert(path);
  }, true);

  myTree.addMouseListener(new PopupHandler() {
    public void invokePopup(Component comp, int x, int y) {
      final DefaultActionGroup group = (DefaultActionGroup)ActionManager.getInstance().getAction("UpdateActionGroup");
      if (group != null) { //if no UpdateActionGroup was configured
        ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UPDATE_POPUP, group);
        popupMenu.getComponent().show(comp, x, y);
      }
    }
  });
  EditSourceOnDoubleClickHandler.install(myTree);
  EditSourceOnEnterKeyHandler.install(myTree);

  myTree.setSelectionRow(0);
}
项目:consulo    文件:ChangesListView.java   
protected void editSourceRegistration() {
  EditSourceOnDoubleClickHandler.install(this);
  EditSourceOnEnterKeyHandler.install(this);
}