Java Code Examples for com.intellij.util.ui.UIUtil#isControlKeyDown()

The following examples show how to use com.intellij.util.ui.UIUtil#isControlKeyDown() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EditorTabbedContainer.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void dragOutFinished(MouseEvent event, TabInfo source) {
  boolean copy = UIUtil.isControlKeyDown(event) || mySession.getResponse(event) == DockContainer.ContentResponse.ACCEPT_COPY;
  if (!copy) {
    myFile.putUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN, Boolean.TRUE);
    FileEditorManagerEx.getInstanceEx(myProject).closeFile(myFile, myWindow);
  }
  else {
    source.setHidden(false);
  }

  mySession.process(event);
  if (!copy) {
    myFile.putUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN, null);
  }

  myFile = null;
  mySession = null;
}
 
Example 2
Source File: DaemonListeners.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void mouseMoved(@Nonnull EditorMouseEvent e) {
  if (Registry.is("ide.disable.editor.tooltips") || Registry.is("editor.new.mouse.hover.popups")) {
    return;
  }
  Editor editor = e.getEditor();
  if (myProject != editor.getProject()) return;
  if (EditorMouseHoverPopupControl.arePopupsDisabled(editor)) return;

  boolean shown = false;
  try {
    if (e.getArea() == EditorMouseEventArea.EDITING_AREA &&
        !UIUtil.isControlKeyDown(e.getMouseEvent()) &&
        DocumentationManager.getInstance(myProject).getDocInfoHint() == null &&
        EditorUtil.isPointOverText(editor, e.getMouseEvent().getPoint())) {
      LogicalPosition logical = editor.xyToLogicalPosition(e.getMouseEvent().getPoint());
      int offset = editor.logicalPositionToOffset(logical);
      HighlightInfo info = myDaemonCodeAnalyzer.findHighlightByOffset(editor.getDocument(), offset, false);
      if (info == null || info.getDescription() == null || info.getHighlighter() != null && FoldingUtil.isHighlighterFolded(editor, info.getHighlighter())) {
        IdeTooltipManager.getInstance().hideCurrent(e.getMouseEvent());
        return;
      }
      DaemonTooltipUtil.showInfoTooltip(info, editor, offset);
      shown = true;
    }
  }
  finally {
    if (!shown && !TooltipController.getInstance().shouldSurvive(e.getMouseEvent())) {
      DaemonTooltipUtil.cancelTooltips();
    }
  }
}
 
Example 3
Source File: SearchEverywhereUI.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void onMouseClicked(@Nonnull MouseEvent e) {
  boolean multiSelectMode = e.isShiftDown() || UIUtil.isControlKeyDown(e);
  if (e.getButton() == MouseEvent.BUTTON1 && !multiSelectMode) {
    e.consume();
    final int i = myResultsList.locationToIndex(e.getPoint());
    if (i > -1) {
      myResultsList.setSelectedIndex(i);
      elementsSelected(new int[]{i}, e.getModifiers());
    }
  }
}