类sun.awt.AWTAutoShutdown源码实例Demo

下面列出了怎么用sun.awt.AWTAutoShutdown的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: jdk-1.7-annotated   文件: EventQueue.java
/**
 * 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();
    }
}
 
源代码2 项目: jdk-1.7-annotated   文件: EventQueue.java
/**
 * 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);
}
 
源代码3 项目: jdk-1.7-annotated   文件: EventQueue.java
/**
 * 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);
        }
    }
}
 
源代码4 项目: jdk-1.7-annotated   文件: EventQueue.java
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();
    }
}
 
源代码5 项目: jdk-1.7-annotated   文件: EventQueue.java
/**
 * 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();
        }
    }
}
 
源代码6 项目: jdk-1.7-annotated   文件: EventQueue.java
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();
    }
}
 
源代码7 项目: dragonwell8_jdk   文件: WToolkit.java
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);
}
 
源代码8 项目: TencentKona-8   文件: WToolkit.java
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);
}
 
源代码9 项目: jdk8u60   文件: WToolkit.java
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);
}
 
源代码10 项目: openjdk-jdk8u   文件: WToolkit.java
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);
}
 
源代码11 项目: openjdk-jdk8u-backup   文件: WToolkit.java
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);
}
 
源代码12 项目: openjdk-jdk9   文件: WToolkit.java
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);
}
 
源代码13 项目: jdk8u-jdk   文件: WToolkit.java
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);
}
 
源代码14 项目: hottub   文件: WToolkit.java
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);
}
 
源代码15 项目: openjdk-8-source   文件: WToolkit.java
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);
}
 
源代码16 项目: openjdk-8   文件: WToolkit.java
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);
}
 
源代码17 项目: jdk8u_jdk   文件: WToolkit.java
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);
}
 
源代码18 项目: jdk8u-jdk   文件: WToolkit.java
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);
}
 
源代码19 项目: jdk8u-dev-jdk   文件: WToolkit.java
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);
}
 
源代码20 项目: consulo   文件: DesktopApplicationImpl.java
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);
}
 
 类所在包
 类方法
 同包方法