當前位置: 首頁>>代碼示例>>Java>>正文


Java UIUtil.isControlKeyDown方法代碼示例

本文整理匯總了Java中com.intellij.util.ui.UIUtil.isControlKeyDown方法的典型用法代碼示例。如果您正苦於以下問題:Java UIUtil.isControlKeyDown方法的具體用法?Java UIUtil.isControlKeyDown怎麽用?Java UIUtil.isControlKeyDown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.util.ui.UIUtil的用法示例。


在下文中一共展示了UIUtil.isControlKeyDown方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: dragOutFinished

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:EditorTabbedContainer.java

示例2: mouseMoved

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
@Override
public void mouseMoved(EditorMouseEvent e) {
  Editor editor = e.getEditor();
  if (myProject != editor.getProject()) return;
  if (editor.getComponent().getClientProperty(EditorImpl.IGNORE_MOUSE_TRACKING) != null) return;

  boolean shown = false;
  try {
    // There is a possible case that cursor is located at soft wrap-introduced virtual space (that is mapped to offset
    // of the document symbol just after soft wrap). We don't want to show any tooltips for it then.
    VisualPosition visual = editor.xyToVisualPosition(e.getMouseEvent().getPoint());
    if (editor.getSoftWrapModel().isInsideOrBeforeSoftWrap(visual)) {
      return;
    }
    LogicalPosition logical = editor.visualToLogicalPosition(visual);
    if (e.getArea() == EditorMouseEventArea.EDITING_AREA && !UIUtil.isControlKeyDown(e.getMouseEvent())) {
      int offset = editor.logicalPositionToOffset(logical);
      if (editor.offsetToLogicalPosition(offset).column != logical.column) return; // we are in virtual space
      HighlightInfo info = myDaemonCodeAnalyzer.findHighlightByOffset(editor.getDocument(), offset, false);
      if (info == null || info.getDescription() == null) return;
      if (IdeTooltipManager.getInstance().hasCurrent()) return;
      DaemonTooltipUtil.showInfoTooltip(info, editor, offset);
      shown = true;
    }
  }
  finally {
    if (!shown && !myTooltipController.shouldSurvive(e.getMouseEvent())) {
      DaemonTooltipUtil.cancelTooltips();
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:32,代碼來源:DaemonListeners.java

示例3: processMouseEvent

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
protected void processMouseEvent(final MouseEvent e) {
  if (e.getID() == MouseEvent.MOUSE_PRESSED) {
    myPressPoint = e.getPoint();
  }
  else if (e.getID() == MouseEvent.MOUSE_RELEASED) {
    if (!myDragStarted) {
      RadComponent component = FormEditingUtil.getRadComponentAt(myEditor.getRootContainer(), e.getX(), e.getY());
      if (component != null) {
        if (UIUtil.isControlKeyDown(e)) {
          component.setSelected(!component.isSelected());
        }
      }
    }
  }
  else if (e.getID() == MouseEvent.MOUSE_DRAGGED) {
    if (!myDragStarted) {
      if ((Math.abs(e.getX() - myPressPoint.getX()) > TREMOR || Math.abs(e.getY() - myPressPoint.getY()) > TREMOR)) {
        ArrayList<InputEvent> eventList = new ArrayList<InputEvent>();
        eventList.add(e);
        myDragGestureRecognizer.setTriggerEvent(e);
        DragGestureEvent dge = new DragGestureEvent(myDragGestureRecognizer,
                                                    UIUtil.isControlKeyDown(e) ? DnDConstants.ACTION_COPY : DnDConstants.ACTION_MOVE,
                                                    myPressPoint, eventList);

        myDragStarted = true;
        myEditor.getDropTargetListener().setUseDragDelta(true);
        dge.startDrag(null,
                      DraggedComponentList.pickupSelection(myEditor, e.getPoint()),
                      myDragSourceListener);
      }
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:34,代碼來源:DragSelectionProcessor.java

示例4: processMousePressed

import com.intellij.util.ui.UIUtil; //導入方法依賴的package包/類
private void processMousePressed(final MouseEvent e){
  if(myCurrentProcessor != null){
    if (myCurrentProcessor.needMousePressed()) {
      myCurrentProcessor.processMouseEvent(e);
      return;
    }
    // Sun sometimes skips mouse released events...
    myCurrentProcessor.cancelOperation();
    myCurrentProcessor = null;
  }

  RadComponent component = null;
  final RadComponent draggerHost = FormEditingUtil.getDraggerHost(myEditor);
  // Try to understand whether we pressed inside dragger area
  if(draggerHost != null){
    final JComponent delegee = draggerHost.getDelegee();
    final Point p = SwingUtilities.convertPoint(delegee, 0, 0, e.getComponent());
    if(
      p.x - MainProcessor.DRAGGER_SIZE <= e.getX() && e.getX() <= p.x &&
      p.y - MainProcessor.DRAGGER_SIZE <= e.getY() && e.getY() <= p.y
    ){
      component = draggerHost;
    }
  }

  // If user clicked not inside dragger then we have find RadComponent at the click point
  if(component == null){
    component = FormEditingUtil.getRadComponentAt(myEditor.getRootContainer(), e.getX(), e.getY());
  }

  if (component == null) {
    return;
  }

  final ComponentItem selectedItem = PaletteToolWindowManager.getInstance(myEditor).getActiveItem(ComponentItem.class);
  if (selectedItem != null) {
    myInsertComponentProcessor.setSticky(UIUtil.isControlKeyDown(e));
    myCurrentProcessor = myInsertComponentProcessor;
    return;
  }

  if (!UIUtil.isControlKeyDown(e) && !e.isShiftDown()) {
    if (!component.isSelected() || FormEditingUtil.getSelectedComponents(myEditor).size() != 1) {
      FormEditingUtil.selectSingleComponent(myEditor, component);
    }
  }

  final Point point = SwingUtilities.convertPoint(e.getComponent(), e.getPoint(), component.getDelegee());
  final int resizeMask = Painter.getResizeMask(component, point.x, point.y);
  LOG.debug("MainProcessor.processMousePressed: resizeMask at (" + point.x + "," + point.y + ") is " + resizeMask);

  if (resizeMask != 0) {
    if (component.getParent() != null) {
      component = component.getParent().getActionTargetComponent(component);
    }
    myCurrentProcessor = new ResizeProcessor(myEditor, component, resizeMask);
  }
  else if (component instanceof RadRootContainer || e.isShiftDown()) {
    myCurrentProcessor = new GroupSelectionProcessor(myEditor, component);
  }
  else if (!e.isShiftDown()) {
    myCurrentProcessor = new DragSelectionProcessor(myEditor);
  }

  updateDragger(e);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:67,代碼來源:MainProcessor.java


注:本文中的com.intellij.util.ui.UIUtil.isControlKeyDown方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。