本文整理汇总了Java中com.intellij.ide.IdeEventQueue类的典型用法代码示例。如果您正苦于以下问题:Java IdeEventQueue类的具体用法?Java IdeEventQueue怎么用?Java IdeEventQueue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IdeEventQueue类属于com.intellij.ide包,在下文中一共展示了IdeEventQueue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: replaceIdeEventQueueSafely
import com.intellij.ide.IdeEventQueue; //导入依赖的package包/类
public static void replaceIdeEventQueueSafely() {
if (Toolkit.getDefaultToolkit().getSystemEventQueue() instanceof IdeEventQueue) {
return;
}
if (SwingUtilities.isEventDispatchThread()) {
throw new RuntimeException("must not call under EDT");
}
AWTAutoShutdown.getInstance().notifyThreadBusy(Thread.currentThread());
UIUtil.pump();
// in JDK 1.6 java.awt.EventQueue.push() causes slow painful death of current EDT
// so we have to wait through its agony to termination
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
IdeEventQueue.getInstance();
}
});
SwingUtilities.invokeAndWait(EmptyRunnable.getInstance());
SwingUtilities.invokeAndWait(EmptyRunnable.getInstance());
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:TestRunnerUtil.java
示例2: applyActivationState
import com.intellij.ide.IdeEventQueue; //导入依赖的package包/类
private void applyActivationState() {
boolean wasVisible = isVisible();
boolean hasWork = getPainters().hasPainters() || getComponentCount() > 0;
if (wasVisible != hasWork) {
setVisible(hasWork);
}
IdeEventQueue queue = IdeEventQueue.getInstance();
if (!queue.containsDispatcher(this) && (myPreprocessorActive || isVisible())) {
queue.addDispatcher(this, null);
}
else if (queue.containsDispatcher(this) && !myPreprocessorActive && !isVisible()) {
queue.removeDispatcher(this);
}
if (wasVisible != isVisible()) {
revalidate();
repaint();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:IdeGlassPaneImpl.java
示例3: processHide
import com.intellij.ide.IdeEventQueue; //导入依赖的package包/类
private void processHide(final MouseEvent e) {
IdeEventQueue.getInstance().blockNextEvents(e);
final Component c = e.getComponent();
if (c instanceof BaseLabel) {
final BaseLabel tab = (BaseLabel)c;
if (tab.getContent() != null) {
if (myManager.canCloseContents() && tab.getContent().isCloseable()) {
myManager.removeContent(tab.getContent(), true, true, true);
} else {
if (myManager.getContentCount() == 1) {
hideWindow(e);
}
}
} else {
hideWindow(e);
}
}
else {
hideWindow(e);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ToolWindowContentUi.java
示例4: addNotify
import com.intellij.ide.IdeEventQueue; //导入依赖的package包/类
@Override
public void addNotify() {
super.addNotify();
updateMenuActions();
// Add updater for menus
myActionManager.addTimerListener(1000, new WeakTimerListener(myActionManager, myTimerListener));
UISettingsListener UISettingsListener = new UISettingsListener() {
public void uiSettingsChanged(final UISettings source) {
updateMnemonicsVisibility();
myPresentationFactory.reset();
}
};
UISettings.getInstance().addUISettingsListener(UISettingsListener, myDisposable);
Disposer.register(ApplicationManager.getApplication(), myDisposable);
IdeEventQueue.getInstance().addDispatcher(this, myDisposable);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:IdeMenuBar.java
示例5: performAction
import com.intellij.ide.IdeEventQueue; //导入依赖的package包/类
@Override
public void performAction(@NotNull InputEvent e, @NotNull AnAction action, @NotNull AnActionEvent actionEvent) {
e.consume();
DataContext ctx = actionEvent.getDataContext();
if (action instanceof ActionGroup && !((ActionGroup)action).canBePerformed(ctx)) {
ActionGroup group = (ActionGroup)action;
JBPopupFactory.getInstance()
.createActionGroupPopup(group.getTemplatePresentation().getText(), group, ctx, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false)
.showInBestPositionFor(ctx);
}
else {
action.actionPerformed(actionEvent);
}
if (Registry.is("actionSystem.fixLostTyping")) {
IdeEventQueue.getInstance().doWhenReady(new Runnable() {
@Override
public void run() {
IdeEventQueue.getInstance().getKeyEventDispatcher().resetState();
}
});
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:IdeKeyEventDispatcher.java
示例6: UsabilityHelper
import com.intellij.ide.IdeEventQueue; //导入依赖的package包/类
private UsabilityHelper(Component component, @NotNull Disposable disposable) {
Disposer.register(disposable, this);
myCallbackAlarm = new SingleAlarm(new Runnable() {
@Override
public void run() {
Disposer.dispose(myCallbackAlarm);
myCallbackAlarm = null;
if (myEventToRedispatch != null) {
IdeEventQueue.getInstance().dispatchEvent(myEventToRedispatch);
}
}
}, 50, this);
myComponent = component;
PointerInfo info = MouseInfo.getPointerInfo();
myLastMousePoint = info != null ? info.getLocation() : null;
if (myLastMousePoint != null) {
Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.COMPONENT_EVENT_MASK);
IdeEventQueue.getInstance().addDispatcher(this, this);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ActionMenu.java
示例7: getData
import com.intellij.ide.IdeEventQueue; //导入依赖的package包/类
@Override
public Object getData(String dataId) {
if (dataId == null) return null;
int currentEventCount = IdeEventQueue.getInstance().getEventCount();
if (myEventCount != -1 && myEventCount != currentEventCount) {
LOG.error("cannot share data context between Swing events; initial event count = " + myEventCount + "; current event count = " +
currentEventCount);
return doGetData(dataId);
}
if (ourSafeKeys.contains(dataId)) {
Object answer = myCachedData.get(dataId);
if (answer == null) {
answer = doGetData(dataId);
myCachedData.put(dataId, answer == null ? NullResult.INSTANCE : answer);
}
return answer != NullResult.INSTANCE ? answer : null;
}
else {
return doGetData(dataId);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:DataManagerImpl.java
示例8: key
import com.intellij.ide.IdeEventQueue; //导入依赖的package包/类
private void key(int repeat) {
for (int i = 0; i < repeat; i++) {
IdeEventQueue.getInstance().dispatchEvent(new KeyEvent(myComponent,
KeyEvent.KEY_PRESSED,
Clock.getTime(),
InputEvent.SHIFT_MASK,
KeyEvent.VK_BACK_SPACE,
'\b'));
IdeEventQueue.getInstance().dispatchEvent(new KeyEvent(myComponent,
KeyEvent.KEY_TYPED,
Clock.getTime(),
InputEvent.SHIFT_MASK,
0,
'\b'));
}
IdeEventQueue.getInstance().dispatchEvent(new KeyEvent(myComponent,
KeyEvent.KEY_RELEASED,
Clock.getTime(),
InputEvent.SHIFT_MASK,
KeyEvent.VK_BACK_SPACE,
'\b'));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ModifierKeyDoubleClickHandlerTest.java
示例9: restartAutoUpdate
import com.intellij.ide.IdeEventQueue; //导入依赖的package包/类
protected void restartAutoUpdate(final boolean state) {
if (state && myToolWindow != null) {
if (myAutoUpdateRequest == null) {
myAutoUpdateRequest = new Runnable() {
@Override
public void run() {
updateComponent();
}
};
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
IdeEventQueue.getInstance().addIdleListener(myAutoUpdateRequest, 500);
}
});
}
}
else {
if (myAutoUpdateRequest != null) {
IdeEventQueue.getInstance().removeIdleListener(myAutoUpdateRequest);
myAutoUpdateRequest = null;
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:DockablePopupManager.java
示例10: runBlazeSync
import com.intellij.ide.IdeEventQueue; //导入依赖的package包/类
protected void runBlazeSync(BlazeSyncParams syncParams) {
Project project = getProject();
final BlazeSyncTask syncTask =
new BlazeSyncTask(
project,
BlazeImportSettingsManager.getInstance(project).getImportSettings(),
syncParams);
// We need to run sync off EDT to keep IntelliJ's transaction system happy
// Because the sync task itself wants to run occasional EDT tasks, we'll have
// to keep flushing the event queue.
Future<?> future =
Executors.newSingleThreadExecutor().submit(() -> syncTask.syncProject(context));
while (!future.isDone()) {
IdeEventQueue.getInstance().flushQueue();
try {
Thread.sleep(50);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
开发者ID:bazelbuild,项目名称:intellij,代码行数:23,代码来源:BlazeSyncIntegrationTestCase.java
示例11: applyActivationState
import com.intellij.ide.IdeEventQueue; //导入依赖的package包/类
private void applyActivationState() {
boolean wasVisible = isVisible();
if (wasVisible != myPaintingActive) {
setVisible(myPaintingActive);
}
IdeEventQueue queue = IdeEventQueue.getInstance();
if (!queue.containsDispatcher(this) && (myPreprocessorActive || isVisible())) {
queue.addDispatcher(this, null);
}
else if (queue.containsDispatcher(this) && !myPreprocessorActive && !isVisible()) {
queue.removeDispatcher(this);
}
if (wasVisible != isVisible()) {
revalidate();
repaint();
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:IdeGlassPaneImpl.java
示例12: restartAutoUpdate
import com.intellij.ide.IdeEventQueue; //导入依赖的package包/类
protected void restartAutoUpdate(final boolean state) {
if (state && myToolWindow != null) {
if (myAutoUpdateRequest == null) {
myAutoUpdateRequest = new Runnable() {
@Override
public void run() {
updateComponent();
}
};
IdeEventQueue.getInstance().addIdleListener(myAutoUpdateRequest, 500);
}
}
else {
if (myAutoUpdateRequest != null) {
IdeEventQueue.getInstance().removeIdleListener(myAutoUpdateRequest);
myAutoUpdateRequest = null;
}
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:DockablePopupManager.java
示例13: setAutoMode
import com.intellij.ide.IdeEventQueue; //导入依赖的package包/类
public void setAutoMode(final boolean on) {
final boolean oldState = getState().autoMode;
if (on != oldState) {
getState().autoMode = on;
if (on) {
IdeEventQueue.getInstance().addActivityListener(myActivityListener, myProject);
}
else {
IdeEventQueue.getInstance().removeActivityListener(myActivityListener);
myIdleAlarm.cancelAllRequests();
if (!myTimeTrackingTimer.isRunning()) {
myTimeTrackingTimer.start();
}
}
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:TimeTrackingManager.java
示例14: addNotify
import com.intellij.ide.IdeEventQueue; //导入依赖的package包/类
@Override
public void addNotify() {
super.addNotify();
updateMenuActions();
// Add updater for menus
myActionManager.addTimerListener(1000, new WeakTimerListener(myActionManager, myTimerListener));
UISettingsListener UISettingsListener = new UISettingsListener() {
@Override
public void uiSettingsChanged(final UISettings source) {
updateMnemonicsVisibility();
myPresentationFactory.reset();
}
};
UISettings.getInstance().addUISettingsListener(UISettingsListener, myDisposable);
Disposer.register(ApplicationManager.getApplication(), myDisposable);
IdeEventQueue.getInstance().addDispatcher(this, myDisposable);
}
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:IdeMenuBar.java
示例15: focusLastFocusedComponent
import com.intellij.ide.IdeEventQueue; //导入依赖的package包/类
private void focusLastFocusedComponent(IdeFrame ideFrame) {
final KeyboardFocusManager mgr = KeyboardFocusManager.getCurrentKeyboardFocusManager();
if (mgr.getFocusOwner() == null) {
Component c = getComponent(myLastFocusedAtDeactivation, ideFrame);
if (c == null || !c.isShowing()) {
c = getComponent(myLastFocusedAtDeactivation, ideFrame);
}
final boolean mouseEventAhead = IdeEventQueue.isMouseEventAhead(null);
if (c != null && c.isShowing() && !mouseEventAhead) {
final LayoutFocusTraversalPolicyExt policy = LayoutFocusTraversalPolicyExt.findWindowPolicy(c);
if (policy != null) {
policy.setNoDefaultComponent(true, FocusManagerImpl.this);
}
requestFocus(c, false).doWhenProcessed(() -> {
if (policy != null) {
policy.setNoDefaultComponent(false, FocusManagerImpl.this);
}
});
}
}
myLastFocusedAtDeactivation.remove(ideFrame);
}
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:FocusManagerImpl.java
示例16: watchForEvents
import com.intellij.ide.IdeEventQueue; //导入依赖的package包/类
static void watchForEvents(Application application) {
AtomicBoolean reported = new AtomicBoolean();
IdeEventQueue.getInstance().addPostprocessor(e -> {
if (application.isWriteAccessAllowed() && reported.compareAndSet(false, true)) {
LOG.error("AWT events are not allowed inside write action: " + e);
}
return true;
}, application);
application.addApplicationListener(new ApplicationAdapter() {
@Override
public void afterWriteActionFinished(@Nonnull Object action) {
reported.set(false);
}
});
}
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:NoSwingUnderWriteAction.java
示例17: mouseReleased
import com.intellij.ide.IdeEventQueue; //导入依赖的package包/类
@Override
public void mouseReleased(MouseEvent e) {
if (UIUtil.isCloseClick(e, MouseEvent.MOUSE_RELEASED)) {
final TabInfo info = myTabs.findInfo(e);
if (info != null) {
IdeEventQueue.getInstance().blockNextEvents(e);
if (e.isAltDown() && e.getButton() == MouseEvent.BUTTON1) {//close others
List<TabInfo> allTabInfos = myTabs.getTabs();
for (TabInfo tabInfo : allTabInfos) {
if (tabInfo == info) continue;
FileEditorManagerEx.getInstanceEx(myProject).closeFile((VirtualFile)tabInfo.getObject(), myWindow);
}
}
else {
FileEditorManagerEx.getInstanceEx(myProject).closeFile((VirtualFile)info.getObject(), myWindow);
}
}
}
}
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:EditorTabbedContainer.java
示例18: isOpenInNewWindow
import com.intellij.ide.IdeEventQueue; //导入依赖的package包/类
private static boolean isOpenInNewWindow() {
AWTEvent event = IdeEventQueue.getInstance().getTrueCurrentEvent();
// Shift was used while clicking
if (event instanceof MouseEvent &&
((MouseEvent)event).isShiftDown() &&
(event.getID() == MouseEvent.MOUSE_CLICKED || event.getID() == MouseEvent.MOUSE_PRESSED || event.getID() == MouseEvent.MOUSE_RELEASED)) {
return true;
}
if (event instanceof KeyEvent) {
KeyEvent ke = (KeyEvent)event;
Keymap keymap = KeymapManager.getInstance().getActiveKeymap();
String[] ids = keymap.getActionIds(KeyStroke.getKeyStroke(ke.getKeyCode(), ke.getModifiers()));
return Arrays.asList(ids).contains("OpenElementInNewWindow");
}
return false;
}
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:FileEditorManagerImpl.java
示例19: performAction
import com.intellij.ide.IdeEventQueue; //导入依赖的package包/类
@Override
public void performAction(@Nonnull InputEvent e, @Nonnull AnAction action, @Nonnull AnActionEvent actionEvent) {
e.consume();
DataContext ctx = actionEvent.getDataContext();
if (action instanceof ActionGroup && !((ActionGroup)action).canBePerformed(ctx)) {
ActionGroup group = (ActionGroup)action;
JBPopupFactory.getInstance().createActionGroupPopup(group.getTemplatePresentation().getText(), group, ctx, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false).showInBestPositionFor(ctx);
}
else {
ActionUtil.performActionDumbAware(action, actionEvent);
}
if (Registry.is("actionSystem.fixLostTyping")) {
IdeEventQueue.getInstance().doWhenReady(() -> IdeEventQueue.getInstance().getKeyEventDispatcher().resetState());
}
}
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:IdeKeyEventDispatcher.java
示例20: startBlocking
import com.intellij.ide.IdeEventQueue; //导入依赖的package包/类
public void startBlocking(@Nonnull Runnable init) {
ApplicationManager.getApplication().assertIsDispatchThread();
synchronized (this) {
LOG.assertTrue(!isRunning());
LOG.assertTrue(!myStoppedAlready);
}
enterModality();
init.run();
try {
IdeEventQueue.getInstance().pumpEventsForHierarchy(myDialog.myPanel, event -> {
if (isCancellationEvent(event)) {
cancel();
}
return isStarted() && !isRunning();
});
}
finally {
exitModality();
}
}
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:ProgressWindow.java
注:本文中的com.intellij.ide.IdeEventQueue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论