下面列出了怎么用sun.awt.AWTAutoShutdown的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* Posts a 1.1-style event to the <code>EventQueue</code>.
* If there is an existing event on the queue with the same ID
* and event source, the source <code>Component</code>'s
* <code>coalesceEvents</code> method will be called.
*
* @param theEvent an instance of <code>java.awt.AWTEvent</code>,
* or a subclass of it
*/
private final void postEventPrivate(AWTEvent theEvent) {
theEvent.isPosted = true;
pushPopLock.lock();
try {
if (nextQueue != null) {
// Forward the event to the top of EventQueue stack
nextQueue.postEventPrivate(theEvent);
return;
}
if (dispatchThread == null) {
if (theEvent.getSource() == AWTAutoShutdown.getInstance()) {
return;
} else {
initDispatchThread();
}
}
postEvent(theEvent, getPriority(theEvent));
} finally {
pushPopLock.unlock();
}
}
/**
* Removes an event from the <code>EventQueue</code> and
* returns it. This method will block until an event has
* been posted by another thread.
* @return the next <code>AWTEvent</code>
* @exception InterruptedException
* if any thread has interrupted this thread
*/
public AWTEvent getNextEvent() throws InterruptedException {
do {
/*
* SunToolkit.flushPendingEvents must be called outside
* of the synchronized block to avoid deadlock when
* event queues are nested with push()/pop().
*/
SunToolkit.flushPendingEvents(appContext);
pushPopLock.lock();
try {
AWTEvent event = getNextEventPrivate();
if (event != null) {
return event;
}
AWTAutoShutdown.getInstance().notifyThreadFree(dispatchThread);
pushPopCond.await();
} finally {
pushPopLock.unlock();
}
} while(true);
}
/**
* Called from dispatchEvent() under a correct AccessControlContext
*/
private void dispatchEventImpl(final AWTEvent event, final Object src) {
event.isPosted = true;
if (event instanceof ActiveEvent) {
// This could become the sole method of dispatching in time.
setCurrentEventAndMostRecentTimeImpl(event);
((ActiveEvent)event).dispatch();
} else if (src instanceof Component) {
((Component)src).dispatchEvent(event);
event.dispatched();
} else if (src instanceof MenuComponent) {
((MenuComponent)src).dispatchEvent(event);
} else if (src instanceof TrayIcon) {
((TrayIcon)src).dispatchEvent(event);
} else if (src instanceof AWTAutoShutdown) {
if (noEvents()) {
dispatchThread.stopDispatching();
}
} else {
if (eventLog.isLoggable(PlatformLogger.FINE)) {
eventLog.fine("Unable to dispatch event: " + event);
}
}
}
final void initDispatchThread() {
pushPopLock.lock();
try {
if (dispatchThread == null && !threadGroup.isDestroyed() && !appContext.isDisposed()) {
dispatchThread = AccessController.doPrivileged(
new PrivilegedAction<EventDispatchThread>() {
public EventDispatchThread run() {
EventDispatchThread t =
new EventDispatchThread(threadGroup,
name,
EventQueue.this);
t.setContextClassLoader(classLoader);
t.setPriority(Thread.NORM_PRIORITY + 1);
t.setDaemon(false);
AWTAutoShutdown.getInstance().notifyThreadBusy(t);
return t;
}
}
);
dispatchThread.start();
}
} finally {
pushPopLock.unlock();
}
}
/**
* Posts the event to the internal Queue of specified priority,
* coalescing as appropriate.
*
* @param theEvent an instance of <code>java.awt.AWTEvent</code>,
* or a subclass of it
* @param priority the desired priority of the event
*/
private void postEvent(AWTEvent theEvent, int priority) {
if (coalesceEvent(theEvent, priority)) {
return;
}
EventQueueItem newItem = new EventQueueItem(theEvent);
cacheEQItem(newItem);
boolean notifyID = (theEvent.getID() == this.waitForID);
if (queues[priority].head == null) {
boolean shouldNotify = noEvents();
queues[priority].head = queues[priority].tail = newItem;
if (shouldNotify) {
if (theEvent.getSource() != AWTAutoShutdown.getInstance()) {
AWTAutoShutdown.getInstance().notifyThreadBusy(dispatchThread);
}
pushPopCond.signalAll();
} else if (notifyID) {
pushPopCond.signalAll();
}
} else {
// The event was not coalesced or has non-Component source.
// Insert it at the end of the appropriate Queue.
queues[priority].tail.next = newItem;
queues[priority].tail = newItem;
if (notifyID) {
pushPopCond.signalAll();
}
}
}
final boolean detachDispatchThread(EventDispatchThread edt, boolean forceDetach) {
/*
* This synchronized block is to secure that the event dispatch
* thread won't die in the middle of posting a new event to the
* associated event queue. It is important because we notify
* that the event dispatch thread is busy after posting a new event
* to its queue, so the EventQueue.dispatchThread reference must
* be valid at that point.
*/
pushPopLock.lock();
try {
if (edt == dispatchThread) {
/*
* Don't detach the thread if any events are pending. Not
* sure if it's a possible scenario, though.
*
* Fix for 4648733. Check both the associated java event
* queue and the PostEventQueue.
*/
if (!forceDetach && (peekEvent() != null) || !SunToolkit.isPostEventQueueEmpty()) {
return false;
}
dispatchThread = null;
}
AWTAutoShutdown.getInstance().notifyThreadFree(edt);
return true;
} finally {
pushPopLock.unlock();
}
}
public WToolkit() {
// Startup toolkit threads
if (PerformanceLogger.loggingEnabled()) {
PerformanceLogger.setTime("WToolkit construction");
}
sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());
/*
* Fix for 4701990.
* AWTAutoShutdown state must be changed before the toolkit thread
* starts to avoid race condition.
*/
AWTAutoShutdown.notifyToolkitThreadBusy();
// Find a root TG and attach Appkit thread to it
ThreadGroup rootTG = AccessController.doPrivileged(
(PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
if (!startToolkitThread(this, rootTG)) {
Thread toolkitThread = new Thread(rootTG, this, "AWT-Windows");
toolkitThread.setDaemon(true);
toolkitThread.start();
}
try {
synchronized(this) {
while(!inited) {
wait();
}
}
} catch (InterruptedException x) {
// swallow the exception
}
// Enabled "live resizing" by default. It remains controlled
// by the native system though.
setDynamicLayout(true);
areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
//set system property if not yet assigned
System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
public WToolkit() {
// Startup toolkit threads
if (PerformanceLogger.loggingEnabled()) {
PerformanceLogger.setTime("WToolkit construction");
}
sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());
/*
* Fix for 4701990.
* AWTAutoShutdown state must be changed before the toolkit thread
* starts to avoid race condition.
*/
AWTAutoShutdown.notifyToolkitThreadBusy();
// Find a root TG and attach Appkit thread to it
ThreadGroup rootTG = AccessController.doPrivileged(
(PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
if (!startToolkitThread(this, rootTG)) {
Thread toolkitThread = new Thread(rootTG, this, "AWT-Windows");
toolkitThread.setDaemon(true);
toolkitThread.start();
}
try {
synchronized(this) {
while(!inited) {
wait();
}
}
} catch (InterruptedException x) {
// swallow the exception
}
// Enabled "live resizing" by default. It remains controlled
// by the native system though.
setDynamicLayout(true);
areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
//set system property if not yet assigned
System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
public WToolkit() {
// Startup toolkit threads
if (PerformanceLogger.loggingEnabled()) {
PerformanceLogger.setTime("WToolkit construction");
}
sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());
/*
* Fix for 4701990.
* AWTAutoShutdown state must be changed before the toolkit thread
* starts to avoid race condition.
*/
AWTAutoShutdown.notifyToolkitThreadBusy();
// Find a root TG and attach Appkit thread to it
ThreadGroup rootTG = AccessController.doPrivileged(
(PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
if (!startToolkitThread(this, rootTG)) {
Thread toolkitThread = new Thread(rootTG, this, "AWT-Windows");
toolkitThread.setDaemon(true);
toolkitThread.start();
}
try {
synchronized(this) {
while(!inited) {
wait();
}
}
} catch (InterruptedException x) {
// swallow the exception
}
// Enabled "live resizing" by default. It remains controlled
// by the native system though.
setDynamicLayout(true);
areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
//set system property if not yet assigned
System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
public WToolkit() {
// Startup toolkit threads
if (PerformanceLogger.loggingEnabled()) {
PerformanceLogger.setTime("WToolkit construction");
}
sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());
/*
* Fix for 4701990.
* AWTAutoShutdown state must be changed before the toolkit thread
* starts to avoid race condition.
*/
AWTAutoShutdown.notifyToolkitThreadBusy();
// Find a root TG and attach Appkit thread to it
ThreadGroup rootTG = AccessController.doPrivileged(
(PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
if (!startToolkitThread(this, rootTG)) {
Thread toolkitThread = new Thread(rootTG, this, "AWT-Windows");
toolkitThread.setDaemon(true);
toolkitThread.start();
}
try {
synchronized(this) {
while(!inited) {
wait();
}
}
} catch (InterruptedException x) {
// swallow the exception
}
// Enabled "live resizing" by default. It remains controlled
// by the native system though.
setDynamicLayout(true);
areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
//set system property if not yet assigned
System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
public WToolkit() {
// Startup toolkit threads
if (PerformanceLogger.loggingEnabled()) {
PerformanceLogger.setTime("WToolkit construction");
}
sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());
/*
* Fix for 4701990.
* AWTAutoShutdown state must be changed before the toolkit thread
* starts to avoid race condition.
*/
AWTAutoShutdown.notifyToolkitThreadBusy();
// Find a root TG and attach Appkit thread to it
ThreadGroup rootTG = AccessController.doPrivileged(
(PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
if (!startToolkitThread(this, rootTG)) {
Thread toolkitThread = new Thread(rootTG, this, "AWT-Windows");
toolkitThread.setDaemon(true);
toolkitThread.start();
}
try {
synchronized(this) {
while(!inited) {
wait();
}
}
} catch (InterruptedException x) {
// swallow the exception
}
// Enabled "live resizing" by default. It remains controlled
// by the native system though.
setDynamicLayout(true);
areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
//set system property if not yet assigned
System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
public WToolkit() {
// Startup toolkit threads
if (PerformanceLogger.loggingEnabled()) {
PerformanceLogger.setTime("WToolkit construction");
}
sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());
/*
* Fix for 4701990.
* AWTAutoShutdown state must be changed before the toolkit thread
* starts to avoid race condition.
*/
AWTAutoShutdown.notifyToolkitThreadBusy();
// Find a root TG and attach toolkit thread to it
ThreadGroup rootTG = AccessController.doPrivileged(
(PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
if (!startToolkitThread(this, rootTG)) {
String name = "AWT-Windows";
Thread toolkitThread = new Thread(rootTG, this, name, 0, false);
toolkitThread.setDaemon(true);
toolkitThread.start();
}
try {
synchronized(this) {
while(!inited) {
wait();
}
}
} catch (InterruptedException x) {
// swallow the exception
}
// Enabled "live resizing" by default. It remains controlled
// by the native system though.
setDynamicLayout(true);
areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
//set system property if not yet assigned
System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
public WToolkit() {
// Startup toolkit threads
if (PerformanceLogger.loggingEnabled()) {
PerformanceLogger.setTime("WToolkit construction");
}
sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());
/*
* Fix for 4701990.
* AWTAutoShutdown state must be changed before the toolkit thread
* starts to avoid race condition.
*/
AWTAutoShutdown.notifyToolkitThreadBusy();
// Find a root TG and attach Appkit thread to it
ThreadGroup rootTG = AccessController.doPrivileged(
(PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
if (!startToolkitThread(this, rootTG)) {
Thread toolkitThread = new Thread(rootTG, this, "AWT-Windows");
toolkitThread.setDaemon(true);
toolkitThread.start();
}
try {
synchronized(this) {
while(!inited) {
wait();
}
}
} catch (InterruptedException x) {
// swallow the exception
}
// Enabled "live resizing" by default. It remains controlled
// by the native system though.
setDynamicLayout(true);
areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
//set system property if not yet assigned
System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
public WToolkit() {
// Startup toolkit threads
if (PerformanceLogger.loggingEnabled()) {
PerformanceLogger.setTime("WToolkit construction");
}
sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());
/*
* Fix for 4701990.
* AWTAutoShutdown state must be changed before the toolkit thread
* starts to avoid race condition.
*/
AWTAutoShutdown.notifyToolkitThreadBusy();
// Find a root TG and attach Appkit thread to it
ThreadGroup rootTG = AccessController.doPrivileged(
(PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
if (!startToolkitThread(this, rootTG)) {
Thread toolkitThread = new Thread(rootTG, this, "AWT-Windows");
toolkitThread.setDaemon(true);
toolkitThread.start();
}
try {
synchronized(this) {
while(!inited) {
wait();
}
}
} catch (InterruptedException x) {
// swallow the exception
}
// Enabled "live resizing" by default. It remains controlled
// by the native system though.
setDynamicLayout(true);
areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
//set system property if not yet assigned
System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
public WToolkit() {
// Startup toolkit threads
if (PerformanceLogger.loggingEnabled()) {
PerformanceLogger.setTime("WToolkit construction");
}
sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());
/*
* Fix for 4701990.
* AWTAutoShutdown state must be changed before the toolkit thread
* starts to avoid race condition.
*/
AWTAutoShutdown.notifyToolkitThreadBusy();
if (!startToolkitThread(this)) {
Thread toolkitThread = new Thread(this, "AWT-Windows");
toolkitThread.setDaemon(true);
toolkitThread.start();
}
try {
synchronized(this) {
while(!inited) {
wait();
}
}
} catch (InterruptedException x) {
// swallow the exception
}
SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);
// Enabled "live resizing" by default. It remains controlled
// by the native system though.
setDynamicLayout(true);
areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
//set system property if not yet assigned
System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
public WToolkit() {
// Startup toolkit threads
if (PerformanceLogger.loggingEnabled()) {
PerformanceLogger.setTime("WToolkit construction");
}
sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());
/*
* Fix for 4701990.
* AWTAutoShutdown state must be changed before the toolkit thread
* starts to avoid race condition.
*/
AWTAutoShutdown.notifyToolkitThreadBusy();
if (!startToolkitThread(this)) {
Thread toolkitThread = new Thread(this, "AWT-Windows");
toolkitThread.setDaemon(true);
toolkitThread.start();
}
try {
synchronized(this) {
while(!inited) {
wait();
}
}
} catch (InterruptedException x) {
// swallow the exception
}
SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);
// Enabled "live resizing" by default. It remains controlled
// by the native system though.
setDynamicLayout(true);
areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
//set system property if not yet assigned
System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
public WToolkit() {
// Startup toolkit threads
if (PerformanceLogger.loggingEnabled()) {
PerformanceLogger.setTime("WToolkit construction");
}
sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());
/*
* Fix for 4701990.
* AWTAutoShutdown state must be changed before the toolkit thread
* starts to avoid race condition.
*/
AWTAutoShutdown.notifyToolkitThreadBusy();
// Find a root TG and attach Appkit thread to it
ThreadGroup rootTG = AccessController.doPrivileged(
(PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
if (!startToolkitThread(this, rootTG)) {
Thread toolkitThread = new Thread(rootTG, this, "AWT-Windows");
toolkitThread.setDaemon(true);
toolkitThread.start();
}
try {
synchronized(this) {
while(!inited) {
wait();
}
}
} catch (InterruptedException x) {
// swallow the exception
}
// Enabled "live resizing" by default. It remains controlled
// by the native system though.
setDynamicLayout(true);
areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
//set system property if not yet assigned
System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
public WToolkit() {
// Startup toolkit threads
if (PerformanceLogger.loggingEnabled()) {
PerformanceLogger.setTime("WToolkit construction");
}
sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());
/*
* Fix for 4701990.
* AWTAutoShutdown state must be changed before the toolkit thread
* starts to avoid race condition.
*/
AWTAutoShutdown.notifyToolkitThreadBusy();
// Find a root TG and attach Appkit thread to it
ThreadGroup rootTG = AccessController.doPrivileged(
(PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
if (!startToolkitThread(this, rootTG)) {
Thread toolkitThread = new Thread(rootTG, this, "AWT-Windows");
toolkitThread.setDaemon(true);
toolkitThread.start();
}
try {
synchronized(this) {
while(!inited) {
wait();
}
}
} catch (InterruptedException x) {
// swallow the exception
}
// Enabled "live resizing" by default. It remains controlled
// by the native system though.
setDynamicLayout(true);
areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
//set system property if not yet assigned
System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
public WToolkit() {
// Startup toolkit threads
if (PerformanceLogger.loggingEnabled()) {
PerformanceLogger.setTime("WToolkit construction");
}
sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());
/*
* Fix for 4701990.
* AWTAutoShutdown state must be changed before the toolkit thread
* starts to avoid race condition.
*/
AWTAutoShutdown.notifyToolkitThreadBusy();
// Find a root TG and attach Appkit thread to it
ThreadGroup rootTG = AccessController.doPrivileged(
(PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
if (!startToolkitThread(this, rootTG)) {
Thread toolkitThread = new Thread(rootTG, this, "AWT-Windows");
toolkitThread.setDaemon(true);
toolkitThread.start();
}
try {
synchronized(this) {
while(!inited) {
wait();
}
}
} catch (InterruptedException x) {
// swallow the exception
}
// Enabled "live resizing" by default. It remains controlled
// by the native system though.
setDynamicLayout(true);
areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
//set system property if not yet assigned
System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
public DesktopApplicationImpl(boolean isHeadless, @Nonnull Ref<? extends StartupProgress> splashRef) {
super(splashRef);
ApplicationManager.setApplication(this);
AWTExceptionHandler.register(); // do not crash AWT on exceptions
myIsInternal = ApplicationProperties.isInternal();
String debugDisposer = System.getProperty("idea.disposer.debug");
consulo.disposer.Disposer.setDebugMode((myIsInternal || "on".equals(debugDisposer)) && !"off".equals(debugDisposer));
myHeadlessMode = isHeadless;
myDoNotSave = isHeadless;
myGatherStatistics = LOG.isDebugEnabled() || isInternal();
if (!isHeadless) {
consulo.disposer.Disposer.register(this, Disposable.newDisposable(), "ui");
StartupUtil.addExternalInstanceListener(commandLineArgs -> {
LOG.info("ApplicationImpl.externalInstanceListener invocation");
CommandLineProcessor.processExternalCommandLine(commandLineArgs, null).doWhenDone(project -> {
final IdeFrame frame = WindowManager.getInstance().getIdeFrame(project);
if (frame != null) AppIcon.getInstance().requestFocus(frame);
});
});
WindowsCommandLineProcessor.LISTENER = (currentDirectory, commandLine) -> {
LOG.info("Received external Windows command line: current directory " + currentDirectory + ", command line " + commandLine);
invokeLater(() -> {
final List<String> args = StringUtil.splitHonorQuotes(commandLine, ' ');
args.remove(0); // process name
CommandLineProcessor.processExternalCommandLine(CommandLineArgs.parse(ArrayUtil.toStringArray(args)), currentDirectory);
});
};
}
Thread edt = UIUtil.invokeAndWaitIfNeeded(() -> {
// instantiate AppDelayQueue which starts "Periodic task thread" which we'll mark busy to prevent this EDT to die
// that thread was chosen because we know for sure it's running
AppScheduledExecutorService service = (AppScheduledExecutorService)AppExecutorUtil.getAppScheduledExecutorService();
Thread thread = service.getPeriodicTasksThread();
AWTAutoShutdown.getInstance().notifyThreadBusy(thread); // needed for EDT not to exit suddenly
consulo.disposer.Disposer.register(this, () -> {
AWTAutoShutdown.getInstance().notifyThreadFree(thread); // allow for EDT to exit - needed for Upsource
});
return Thread.currentThread();
});
NoSwingUnderWriteAction.watchForEvents(this);
}