Search in sources :

Example 21 with AppContext

use of sun.awt.AppContext in project jdk8u_jdk by JetBrains.

the class AppContextCreator method resetAppContext.

/*
     * reset classloader's AppContext and ThreadGroup
     * This method is for subclass PluginClassLoader to
     * reset superclass's AppContext and ThreadGroup but do
     * not dispose the AppContext. PluginClassLoader does not
     * use UsageCount to decide whether to dispose AppContext
     *
     * @return previous AppContext
     */
protected AppContext resetAppContext() {
    AppContext tempAppContext = null;
    synchronized (threadGroupSynchronizer) {
        // Store app context in temp variable
        tempAppContext = appContext;
        usageCount = 0;
        appContext = null;
        threadGroup = null;
    }
    return tempAppContext;
}
Also used : AppContext(sun.awt.AppContext)

Example 22 with AppContext

use of sun.awt.AppContext in project jdk8u_jdk by JetBrains.

the class SunClipboard method propertyChange.

public void propertyChange(PropertyChangeEvent evt) {
    if (AppContext.DISPOSED_PROPERTY_NAME.equals(evt.getPropertyName()) && Boolean.TRUE.equals(evt.getNewValue())) {
        final AppContext disposedContext = (AppContext) evt.getSource();
        lostOwnershipLater(disposedContext);
    }
}
Also used : AppContext(sun.awt.AppContext)

Example 23 with AppContext

use of sun.awt.AppContext in project jdk8u_jdk by JetBrains.

the class SunClipboard method lostOwnershipLater.

/**
     * Clears the clipboard state (contents, owner and contents context) and
     * notifies the current owner that ownership is lost. Does nothing if the
     * argument is not <code>null</code> and is not equal to the current
     * contents context.
     *
     * @param disposedContext the AppContext that is disposed or
     *        <code>null</code> if the ownership is lost because another
     *        application acquired ownership.
     */
protected void lostOwnershipLater(final AppContext disposedContext) {
    final AppContext context = this.contentsContext;
    if (context == null) {
        return;
    }
    SunToolkit.postEvent(context, new PeerEvent(this, () -> lostOwnershipNow(disposedContext), PeerEvent.PRIORITY_EVENT));
}
Also used : PeerEvent(sun.awt.PeerEvent) AppContext(sun.awt.AppContext)

Example 24 with AppContext

use of sun.awt.AppContext in project jdk8u_jdk by JetBrains.

the class SunClipboard method lostOwnershipNow.

protected void lostOwnershipNow(final AppContext disposedContext) {
    final SunClipboard sunClipboard = SunClipboard.this;
    ClipboardOwner owner = null;
    Transferable contents = null;
    synchronized (sunClipboard) {
        final AppContext context = sunClipboard.contentsContext;
        if (context == null) {
            return;
        }
        if (disposedContext == null || context == disposedContext) {
            owner = sunClipboard.owner;
            contents = sunClipboard.contents;
            sunClipboard.contentsContext = null;
            sunClipboard.owner = null;
            sunClipboard.contents = null;
            sunClipboard.clearNativeContext();
            context.removePropertyChangeListener(AppContext.DISPOSED_PROPERTY_NAME, sunClipboard);
        } else {
            return;
        }
    }
    if (owner != null) {
        owner.lostOwnership(sunClipboard, contents);
    }
}
Also used : AppContext(sun.awt.AppContext) Transferable(java.awt.datatransfer.Transferable) ClipboardOwner(java.awt.datatransfer.ClipboardOwner)

Example 25 with AppContext

use of sun.awt.AppContext in project jdk8u_jdk by JetBrains.

the class SunClipboard method removeFlavorListener.

public synchronized void removeFlavorListener(FlavorListener listener) {
    if (listener == null) {
        return;
    }
    AppContext appContext = AppContext.getAppContext();
    EventListenerAggregate contextFlavorListeners = (EventListenerAggregate) appContext.get(CLIPBOARD_FLAVOR_LISTENER_KEY);
    if (contextFlavorListeners == null) {
        //else we throw NullPointerException, but it is forbidden
        return;
    }
    if (contextFlavorListeners.remove(listener) && --numberOfFlavorListeners == 0) {
        unregisterClipboardViewerChecked();
        currentFormats = null;
    }
}
Also used : EventListenerAggregate(sun.awt.EventListenerAggregate) AppContext(sun.awt.AppContext)

Aggregations

AppContext (sun.awt.AppContext)74 HashMap (java.util.HashMap)3 Hashtable (java.util.Hashtable)3 Locale (java.util.Locale)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 EventListenerAggregate (sun.awt.EventListenerAggregate)3 FlavorListener (java.awt.datatransfer.FlavorListener)2 WeakReference (java.lang.ref.WeakReference)2 Map (java.util.Map)2 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)2 LookAndFeel (javax.swing.LookAndFeel)2 MetalLookAndFeel (javax.swing.plaf.metal.MetalLookAndFeel)2 MetalTheme (javax.swing.plaf.metal.MetalTheme)2 ValueNamePair (org.compiere.util.ValueNamePair)2 PeerEvent (sun.awt.PeerEvent)2 AccumulativeRunnable (sun.swing.AccumulativeRunnable)2 Container (java.awt.Container)1 EventQueue (java.awt.EventQueue)1 Font (java.awt.Font)1 Rectangle (java.awt.Rectangle)1