本文整理汇总了Java中com.intellij.ide.IdeEventQueue类的典型用法代码示例。如果您正苦于以下问题:Java IdeEventQueue类的具体用法?Java IdeEventQueue怎么用?Java IdeEventQueue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IdeEventQueue类属于com.intellij.ide包,在下文中一共展示了IdeEventQueue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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();
}
}
示例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);
}
}
示例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);
}
示例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();
}
});
}
}
示例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);
}
}
示例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);
}
}
示例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'));
}
示例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;
}
}
}
示例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();
}
}
}
示例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();
}
}
示例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;
}
}
}
示例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();
}
}
}
}
示例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);
}
示例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);
}