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


Java ActionCallback.setRejected方法代码示例

本文整理汇总了Java中com.intellij.openapi.util.ActionCallback.setRejected方法的典型用法代码示例。如果您正苦于以下问题:Java ActionCallback.setRejected方法的具体用法?Java ActionCallback.setRejected怎么用?Java ActionCallback.setRejected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.util.ActionCallback的用法示例。


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

示例1: typeCodes

import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
private ActionCallback typeCodes(final PlaybackContext context, final Robot robot, final String codes) {
  final ActionCallback result = new ActionCallback();

  Runnable runnable = new Runnable() {
    public void run() {
      String[] pairs = codes.split(CODE_DELIMITER);
      for (String eachPair : pairs) {
        try {
          String[] splits = eachPair.split(MODIFIER_DELIMITER);
          Integer code = Integer.valueOf(splits[0]);
          Integer modifier = Integer.valueOf(splits[1]);
          type(robot, code.intValue(), modifier.intValue());
        }
        catch (NumberFormatException e) {
          dumpError(context, "Invalid code: " + eachPair);
          result.setRejected();
          return;
        }
      }

      result.setDone();
    }
  };


  if (SwingUtilities.isEventDispatchThread()) {
    ApplicationManager.getApplication().executeOnPooledThread(runnable);
  } else {
    runnable.run();
  }

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:KeyCodeTypeCommand.java

示例2: _restoreFocus

import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
private ActionCallback _restoreFocus() {
  final List<FocusTrackback> stack = getCleanStack();

  if (!stack.contains(this)) return ActionCallback.REJECTED;

  Component toFocus = queryToFocus(stack, this, true);

  final ActionCallback result = new ActionCallback();
  if (toFocus != null) {
    final Component ownerBySwing = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
    if (ownerBySwing != null) {
      final Window ownerBySwingWindow = SwingUtilities.getWindowAncestor(ownerBySwing);
      if (ownerBySwingWindow != null && ownerBySwingWindow == SwingUtilities.getWindowAncestor(toFocus)) {
        if (!UIUtil.isMeaninglessFocusOwner(ownerBySwing)) {
          toFocus = ownerBySwing;
        }
      }
    }

    if (myParentWindow != null) {
      final Window to = UIUtil.getWindow(toFocus);
      if (to != null && UIUtil.findUltimateParent(to) == UIUtil.findUltimateParent(myParentWindow)) {  // IDEADEV-34537
        requestFocus(toFocus);
        result.setDone();
      }
    } else {
      requestFocus(toFocus);
      result.setDone();
    }
  }

  if (!result.isDone()) {
    result.setRejected();
  }

  stack.remove(this);
  dispose();

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:FocusTrackback.java

示例3: select

import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
private void select(ActionCallback callback, K key, UI ui) {
  if (myKey != key) {
    callback.setRejected();
  }
  else {
    V value = myContent.get(key);
    if (value == null && !myContent.containsKey(key)) {
      value = createValue(key, ui);
    }
    for (Component component : getComponents()) {
      component.setVisible(component == value);
    }
    callback.setDone();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:CardLayoutPanel.java

示例4: requestFocus

import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
@NotNull
private ActionCallback requestFocus(@NotNull final Component c) {
  final ActionCallback result = new ActionCallback();
  final Alarm checkerAlarm = new Alarm(result);
  Runnable checker = new Runnable() {
    final long startTime = System.currentTimeMillis();
    @Override
    public void run() {
      if (System.currentTimeMillis() - startTime > 10000) {
        result.setRejected();
        return;
      }
      if (c.isShowing()) {
        final Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner();
        if (owner != null && owner == c) {
          myManager.getFocusManager().requestFocus(new FocusCommand() {
            @Override
            @NotNull
            public ActionCallback run() {
              return ActionCallback.DONE;
            }
          }, myForced).doWhenProcessed(new Runnable() {
            @Override
            public void run() {
              updateToolWindow(c);
            }
          }).notify(result);
        }
        else {
          myManager.getFocusManager().requestFocus(new FocusCommand.ByComponent(c, myToolWindow.getComponent(), new Exception()), myForced)
            .doWhenProcessed(new Runnable() {
              @Override
              public void run() {
                updateToolWindow(c);
              }
            }).notify(result);
        }
      }
      else {
        checkerAlarm.addRequest(this, 100);
      }
    }
  };
  checkerAlarm.addRequest(checker, 0);
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:47,代码来源:RequestFocusInToolWindowCmd.java

示例5: queueSelection

import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
ActionCallback queueSelection(final Configurable configurable) {
  if (myBuilder.isSelectionBeingAdjusted()) {
    return ActionCallback.REJECTED;
  }

  final ActionCallback callback = new ActionCallback();

  myQueuedConfigurable = configurable;
  final Update update = new Update(this) {
    public void run() {
      if (configurable != myQueuedConfigurable) return;

      if (configurable == null) {
        myTree.getSelectionModel().clearSelection();
        myFilter.myContext.fireSelected(null, OptionsTree.this);
      }
      else {
        myBuilder.getReady(this).doWhenDone(new Runnable() {
          @Override
          public void run() {
            if (configurable != myQueuedConfigurable) return;

            final EditorNode editorNode = myConfigurable2Node.get(configurable);
            FilteringTreeStructure.FilteringNode editorUiNode = myBuilder.getVisibleNodeFor(editorNode);
            if (editorUiNode == null) return;

            if (!myBuilder.getSelectedElements().contains(editorUiNode)) {
              myBuilder.select(editorUiNode, new Runnable() {
                public void run() {
                  fireSelected(configurable, callback);
                }
              });
            } else {
              myBuilder.scrollSelectionToVisible(new Runnable() {
                public void run() {
                  fireSelected(configurable, callback);
                }
              }, false);
            }
          }
        });
      }
    }

    @Override
    public void setRejected() {
      super.setRejected();
      callback.setRejected();
    }
  };
  mySelection.queue(update);
  return callback;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:54,代码来源:OptionsTree.java

示例6: show

import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
public void show(boolean restoreBounds) {
  myFocusedCallback = new ActionCallback();

  if (myProject != null) {
    IdeFocusManager.getInstance(myProject).typeAheadUntil(myFocusedCallback);
  }

  final Window frame = getFrame();

  if (myStatusBar != null) {
    myStatusBar.install((IdeFrame)frame);
  }

  myFocusTrackback = new FocusTrackback(this, IdeFocusManager.findInstance().getFocusOwner(), true);

  if (frame instanceof JFrame) {
    ((JFrame)frame).setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
  } else {
    ((JDialog)frame).setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
  }
  final WindowAdapter focusListener = new WindowAdapter() {
    public void windowOpened(WindowEvent e) {
      IdeFocusManager fm = IdeFocusManager.getInstance(myProject);
      JComponent toFocus = myPreferedFocus;
      if (toFocus == null) {
        toFocus = fm.getFocusTargetFor(myComponent);
      }

      if (toFocus != null) {
        fm.requestFocus(toFocus, true).notify(myFocusedCallback);
      } else {
        myFocusedCallback.setRejected();
      }
    }
  };
  frame.addWindowListener(focusListener);
  Disposer.register(this, new Disposable() {
    @Override
    public void dispose() {
      frame.removeWindowListener(focusListener);
    }
  });
  if (myCloseOnEsc) addCloseOnEsc((RootPaneContainer)frame);
  ((RootPaneContainer)frame).getContentPane().add(myComponent, BorderLayout.CENTER);
  if (frame instanceof JFrame) {
    ((JFrame)frame).setTitle(myTitle);
  } else {
    ((JDialog)frame).setTitle(myTitle);
  }
  if (myImageWasChanged) {
    frame.setIconImage(myImage);
  }
  else {
    AppUIUtil.updateWindowIcon(myFrame);
  }

  if (restoreBounds) {
    loadFrameState();
  }

  myFocusWatcher = new FocusWatcher() {
    protected void focusLostImpl(final FocusEvent e) {
      myFocusTrackback.consume();
    }
  };
  myFocusWatcher.install(myComponent);
  myShown = true;
  frame.setVisible(true);

  if (UIUtil.isUnderAlloyLookAndFeel() && frame instanceof JFrame) {
    //please ask [kb] before remove it
    ((JFrame)frame).setMaximizedBounds(null);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:75,代码来源:FrameWrapper.java

示例7: perform

import com.intellij.openapi.util.ActionCallback; //导入方法依赖的package包/类
@Override
public ActionCallback perform(List<LibraryOrderEntry> orderEntriesContainingFile) {
  final ActionCallback callback = new ActionCallback();
  Task task = new Task.Backgroundable(myProject, "Downloading Sources", true) {
    @Override
    public void run(@NotNull final ProgressIndicator indicator) {
      final byte[] bytes;
      try {
        LOG.info("Downloading sources JAR: " + myUrl);
        indicator.checkCanceled();
        bytes = HttpRequests.request(myUrl).readBytes(indicator);
      }
      catch (IOException e) {
        LOG.warn(e);
        ApplicationManager.getApplication().invokeLater(new Runnable() {
          @Override
          public void run() {
            new Notification(myMessageGroupId,
                             "Downloading failed",
                             "Failed to download sources: " + myUrl,
                             NotificationType.ERROR)
              .notify(getProject());

            callback.setDone();
          }
        });
        return;
      }

      ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
          AccessToken accessToken = WriteAction.start();
          try {
            storeFile(bytes);
          }
          finally {
            accessToken.finish();
            callback.setDone();
          }
        }
      });
    }

    @Override
    public void onCancel() {
      callback.setRejected();
    }
  };

  task.queue();

  return callback;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:55,代码来源:AbstractAttachSourceProvider.java


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