当前位置: 首页>>代码示例>>Java>>正文


Java DoubleClickListener类代码示例

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


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

示例1: installEditAction

import com.intellij.ui.DoubleClickListener; //导入依赖的package包/类
public static Disposable installEditAction(final JTree tree, String actionName) {
  final DoubleClickListener listener = new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent e) {
      if (tree.getPathForLocation(e.getX(), e.getY()) == null) return false;
      DataContext dataContext = DataManager.getInstance().getDataContext(tree);
      GotoFrameSourceAction.doAction(dataContext);
      return true;
    }
  };
  listener.installOn(tree);

  final AnAction action = ActionManager.getInstance().getAction(actionName);
  action.registerCustomShortcutSet(CommonShortcuts.getEditSource(), tree);

  return new Disposable() {
    public void dispose() {
      listener.uninstall(tree);
      action.unregisterCustomShortcutSet(tree);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:DebuggerAction.java

示例2: createCenterPanel

import com.intellij.ui.DoubleClickListener; //导入依赖的package包/类
@Override
protected JComponent createCenterPanel() {
  final DefaultListModel model = new DefaultListModel ();
  for (PsiField member : myFields) {
    model.addElement(member);
  }
  myList = new JBList(model);
  myList.setCellRenderer(new MyListCellRenderer());
  new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent e) {
      if (myList.getSelectedValues().length > 0) {
        doOKAction();
        return true;
      }
      return false;
    }
  }.installOn(myList);

  myList.setPreferredSize(JBUI.size(300, 400));
  return myList;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:SimpleFieldChooser.java

示例3: createTargetVariableChooser

import com.intellij.ui.DoubleClickListener; //导入依赖的package包/类
@Override
protected JList createTargetVariableChooser() {
  final JList variableChooser = super.createTargetVariableChooser();
  new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent e) {
      Point point = e.getPoint();
      int index = variableChooser.locationToIndex(point);
      if (index == -1) return false;
      if (!variableChooser.getCellBounds(index, index).contains(point)) return false;
      doRefactorAction();
      return true;
    }
  }.installOn(variableChooser);
  return variableChooser;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ConvertToInstanceMethodDialog.java

示例4: showDialog

import com.intellij.ui.DoubleClickListener; //导入依赖的package包/类
private static Sdk showDialog(final Project project, String title, final Component parent, Sdk jdkToSelect) {
  final JdkChooserPanel jdkChooserPanel = new JdkChooserPanel(project);
  jdkChooserPanel.fillList(null, null);
  final MyDialog dialog = jdkChooserPanel.new MyDialog(parent);
  if (title != null) {
    dialog.setTitle(title);
  }
  if (jdkToSelect != null) {
    jdkChooserPanel.selectJdk(jdkToSelect);
  }
  else {
    ScrollingUtil.ensureSelectionExists(jdkChooserPanel.myList);
  }
  new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent e) {
      dialog.clickDefaultButton();
      return true;
    }
  }.installOn(jdkChooserPanel.myList);
  return dialog.showAndGet() ? jdkChooserPanel.getChosenJdk() : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:JdkChooserPanel.java

示例5: ChooseActionsDialog

import com.intellij.ui.DoubleClickListener; //导入依赖的package包/类
public ChooseActionsDialog(Component parent, Keymap keymap, QuickList[] quicklists) {
  super(parent, true);
  myKeymap = keymap;
  myQuicklists = quicklists;

  myActionsTree = new ActionsTree();
  myActionsTree.reset(keymap, quicklists);
  myActionsTree.getTree().getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);

  new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent e) {
      doOKAction();
      return true;
    }
  }.installOn(myActionsTree.getTree());


  myTreeExpansionMonitor = TreeExpansionMonitor.install(myActionsTree.getTree());

  setTitle("Add Actions to Quick List");
  init();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ChooseActionsDialog.java

示例6: createCenterPanel

import com.intellij.ui.DoubleClickListener; //导入依赖的package包/类
@Nullable
@Override
protected JComponent createCenterPanel() {
  myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  myList.setCellRenderer(new FileTypeRenderer());

  new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent e) {
      doOKAction();
      return true;
    }
  }.installOn(myList);

  CCLanguageManager manager = CCUtils.getStudyLanguageManager(myCourse);
  if (manager != null) {
    String extension = manager.getDefaultTaskFileExtension();
    ScrollingUtil.selectItem(myList, FileTypeManager.getInstance().getFileTypeByExtension(extension != null ? extension : "txt"));
  }
  return myPanel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:CreateTaskFileDialog.java

示例7: createCenterPanel

import com.intellij.ui.DoubleClickListener; //导入依赖的package包/类
@Override
protected JComponent createCenterPanel() {
  final DefaultListModel model = new DefaultListModel ();
  for (PsiField member : myFields) {
    model.addElement(member);
  }
  myList = new JBList(model);
  myList.setCellRenderer(new MyListCellRenderer());
  new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent e) {
      if (myList.getSelectedValues().length > 0) {
        doOKAction();
        return true;
      }
      return false;
    }
  }.installOn(myList);

  myList.setPreferredSize(new Dimension(300, 400));
  return myList;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:SimpleFieldChooser.java

示例8: showDialog

import com.intellij.ui.DoubleClickListener; //导入依赖的package包/类
private static Sdk showDialog(final Project project, String title, final Component parent, Sdk jdkToSelect) {
  final JdkChooserPanel jdkChooserPanel = new JdkChooserPanel(project);
  jdkChooserPanel.fillList(null, null);
  final MyDialog dialog = jdkChooserPanel.new MyDialog(parent);
  if (title != null) {
    dialog.setTitle(title);
  }
  if (jdkToSelect != null) {
    jdkChooserPanel.selectJdk(jdkToSelect);
  } else {
    ListScrollingUtil.ensureSelectionExists(jdkChooserPanel.myList);
  }
  new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent e) {
      dialog.clickDefaultButton();
      return true;
    }
  }.installOn(jdkChooserPanel.myList);
  dialog.show();
  return dialog.isOK() ? jdkChooserPanel.getChosenJdk() : null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:JdkChooserPanel.java

示例9: createCenterPanel

import com.intellij.ui.DoubleClickListener; //导入依赖的package包/类
@Nullable
	@Override
	protected JComponent createCenterPanel() {
		JPanel panel = new JPanel(new BorderLayout());
		new DoubleClickListener() {
			@Override
			protected boolean onDoubleClick(MouseEvent e) {
				if (tree.getPathForLocation(e.getX(), e.getY()) != null) {
					doOKAction();
					return true;
				}
				return false;
			}
		}.installOn(tree);

		TreeUtil.installActions(tree);
		JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(tree);
//		scrollPane.setPreferredSize(new Dimension(350, 450));
		panel.add(scrollPane, BorderLayout.CENTER);

		return panel;
	}
 
开发者ID:antlr,项目名称:intellij-plugin-v4,代码行数:23,代码来源:LiteralChooser.java

示例10: createCenterPanel

import com.intellij.ui.DoubleClickListener; //导入依赖的package包/类
@Override
protected JComponent createCenterPanel() {
  myTitleLabel.setText(FileTypesBundle.message("filetype.chooser.prompt", myFileName));

  myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  myList.setCellRenderer(new FileTypeRenderer());

  new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent e) {
      doOKAction();
      return true;
    }
  }.installOn(myList);

  myList.getSelectionModel().addListSelectionListener(e -> updateButtonsState());

  ScrollingUtil.selectItem(myList, PlainTextFileType.INSTANCE);

  return myPanel;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:FileTypeChooser.java

示例11: createCenterPanel

import com.intellij.ui.DoubleClickListener; //导入依赖的package包/类
protected JComponent createCenterPanel() {
  final JPanel _panel1 = new JPanel(new BorderLayout());

  JPanel _panel2 = new JPanel(new BorderLayout());
  _panel2.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
  //"Debug libraries are missig from JDK home.\nIn order for debugger to start, the libraries should be installed.\nPlease visit http://java.sun.com/products/jpda"
  JLabel label1 = new JLabel(DebuggerBundle.message("label.get.jpda.dialog.prompt"));
  //label1.setForeground(Color.black);
  JLabel label2 = new JLabel(JPDA_URL);
  new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent e) {
      BrowserUtil.browse(JPDA_URL);
      return true;
    }
  }.installOn(label2);
  label2.setForeground(JBColor.BLUE.darker());
  label2.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  _panel2.add(new JLabel(DebuggerBundle.message("label.get.jpda.dialog.error.description")), BorderLayout.NORTH);
  _panel2.add(label1, BorderLayout.WEST);
  _panel2.add(label2, BorderLayout.EAST);
  _panel1.add(_panel2, BorderLayout.NORTH);

  JPanel content = new JPanel(new GridLayout(2, 1, 10, 10));

  _panel1.add(content, BorderLayout.CENTER);
  return _panel1;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:GetJPDADialog.java

示例12: install

import com.intellij.ui.DoubleClickListener; //导入依赖的package包/类
public static void install(final TreeTable treeTable) {
  new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent e) {
      if (ModalityState.current().dominates(ModalityState.NON_MODAL)) return false;
      if (treeTable.getTree().getPathForLocation(e.getX(), e.getY()) == null) return false;
      DataContext dataContext = DataManager.getInstance().getDataContext(treeTable);
      Project project = CommonDataKeys.PROJECT.getData(dataContext);
      if (project == null) return false;
      OpenSourceUtil.openSourcesFrom(dataContext, true);
      return true;
    }
  }.installOn(treeTable);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:EditSourceOnDoubleClickHandler.java

示例13: StatisticsPanel

import com.intellij.ui.DoubleClickListener; //导入依赖的package包/类
public StatisticsPanel(final Project project, final TestFrameworkRunningModel model) {
  myProject = project;
  myTableModel = new StatisticsTableModel();
  myStatisticsTableView.setModelAndUpdateColumns(myTableModel);
  myFrameworkRunningModel = model;

  final Runnable gotoSuiteOrParentAction = createGotoSuiteOrParentAction();
  new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent e) {
      gotoSuiteOrParentAction.run();
      return true;
    }
  }.installOn(myStatisticsTableView);

  // Fire selection changed and move focus on SHIFT+ENTER
  final KeyStroke shiftEnterKey = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_MASK);
  SMRunnerUtil.registerAsAction(shiftEnterKey, "select-test-proxy-in-test-view",
                          new Runnable() {
                            public void run() {
                              showSelectedProxyInTestsTree();
                            }
                          },
                          myStatisticsTableView);

  // Expand selected or go to parent on ENTER
  final KeyStroke enterKey = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
  SMRunnerUtil.registerAsAction(enterKey, "go-to-selected-suite-or-parent",
                          gotoSuiteOrParentAction,
                          myStatisticsTableView);
  // Contex menu in Table
  PopupHandler.installPopupHandler(myStatisticsTableView, IdeActions.GROUP_TESTTREE_POPUP, ActionPlaces.TESTTREE_VIEW_POPUP);
  // set this statistic tab as dataprovider for test's table view
  DataManager.registerDataProvider(myStatisticsTableView, this);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:StatisticsPanel.java

示例14: OpenOrAttachDialog

import com.intellij.ui.DoubleClickListener; //导入依赖的package包/类
protected OpenOrAttachDialog(Project project, boolean hideReplace, final String title) {
  super(project);
  myHideReplace = hideReplace;
  setTitle(title);
  init();
  ClickListener listener = new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent event) {
      doOKAction();
      return true;
    }
  };
  listener.installOn(myCurrentWindowButton);
  listener.installOn(myOpenInNewWindowButton);

  final String mode = PropertiesComponent.getInstance().getValue(MODE_PROPERTY);
  if (MODE_NEW.equals(mode)) {
    myOpenInNewWindowButton.setSelected(true);
  }
  else if (mode == null || MODE_REPLACE.equals(mode) || hideReplace) {
    myCurrentWindowButton.setSelected(true);
    myAddCheckbox.setSelected(false);
  }
  else {
    myCurrentWindowButton.setSelected(true);
    myAddCheckbox.setSelected(true);
  }
  if (hideReplace) {
    myAddCheckbox.setVisible(false);
  }
  myAddCheckbox.setEnabled(myCurrentWindowButton.isSelected());
  final ActionListener listener1 = new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      myAddCheckbox.setEnabled(myCurrentWindowButton.isSelected());
    }
  };
  myCurrentWindowButton.addActionListener(listener1);
  myOpenInNewWindowButton.addActionListener(listener1);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:OpenOrAttachDialog.java

示例15: ChooseClassDialog

import com.intellij.ui.DoubleClickListener; //导入依赖的package包/类
public ChooseClassDialog(Module module, String title, boolean includeAll, String... classes) {
  super(module.getProject());

  new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent e) {
      if (myList.getSelectedValue() != null) {
        close(OK_EXIT_CODE);
        return true;
      }
      return false;
    }
  }.installOn(myList);

  DefaultListModel model = new DefaultListModel();
  findClasses(module, includeAll, model, classes);
  myList.setModel(model);
  myList.setCellRenderer(new DefaultPsiElementCellRenderer());

  ListSelectionModel selectionModel = myList.getSelectionModel();
  selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  selectionModel.addListSelectionListener(this);

  new ListSpeedSearch(myList) {
    @Override
    protected boolean isMatchingElement(Object element, String pattern) {
      PsiClass psiClass = (PsiClass)element;
      return compare(psiClass.getName(), pattern) || compare(psiClass.getQualifiedName(), pattern);
    }
  };

  setTitle(title);
  setOKActionEnabled(false);

  init();

  Dimension size = myComponent.getPreferredSize();
  size.height = myList.getPreferredSize().height + 20;
  myComponent.setPreferredSize(size);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:ChooseClassDialog.java


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