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;
}
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);
}
}
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));
}
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);
}
}
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;
}
}
Aggregations