Java Code Examples for java.awt.desktop.OpenFilesHandler

The following are top voted examples for showing how to use java.awt.desktop.OpenFilesHandler. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: openjdk-jdk10   File: _AppEventHandler.java   Source Code and License 5 votes vote down vote up
void performUsing(final OpenFilesHandler handler, final _NativeEvent event) {
    // create file list from fileNames
    final List<String> fileNameList = event.get(0);
    final ArrayList<File> files = new ArrayList<File>(fileNameList.size());
    for (final String fileName : fileNameList) files.add(new File(fileName));

    // populate the properties map
    final String searchTerm = event.get(1);
    handler.openFiles(new OpenFilesEvent(files, searchTerm));
}
 
Example 2
Project: openjdk9   File: _AppEventHandler.java   Source Code and License 5 votes vote down vote up
void performUsing(final OpenFilesHandler handler, final _NativeEvent event) {
    // create file list from fileNames
    final List<String> fileNameList = event.get(0);
    final ArrayList<File> files = new ArrayList<File>(fileNameList.size());
    for (final String fileName : fileNameList) files.add(new File(fileName));

    // populate the properties map
    final String searchTerm = event.get(1);
    handler.openFiles(new OpenFilesEvent(files, searchTerm));
}
 
Example 3
Project: openjdk-jdk10   File: Desktop.java   Source Code and License 3 votes vote down vote up
/**
 * Installs the handler which is notified when the application is asked to
 * open a list of files.
 *
 * @implNote Please note that for Mac OS, notifications
 * are only sent if the Java app is a bundled application,
 * with a {@code CFBundleDocumentTypes} array present in its
 * Info.plist. See the
 * <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">
 * Info.plist Key Reference</a> for more information about adding a
 * {@code CFBundleDocumentTypes} key to your app's Info.plist.
 *
 * @param openFileHandler handler
 *
 * @throws SecurityException if a security manager exists and its
 * {@link java.lang.SecurityManager#checkRead(java.lang.String)}
 * method denies read access to the files, or it denies the
 * {@code RuntimePermission("canProcessApplicationEvents")}
 * permission, or the calling thread is not allowed to create a
 * subprocess
 * @throws UnsupportedOperationException if the current platform
 * does not support the {@link Desktop.Action#APP_OPEN_FILE} action
 * @since 9
 */
public void setOpenFileHandler(final OpenFilesHandler openFileHandler) {
    checkEventsProcessingPermission();
    checkExec();
    checkRead();
    checkActionSupport(Action.APP_OPEN_FILE);
    peer.setOpenFileHandler(openFileHandler);
}
 
Example 4
Project: openjdk9   File: Desktop.java   Source Code and License 3 votes vote down vote up
/**
 * Installs the handler which is notified when the application is asked to
 * open a list of files.
 *
 * @implNote Please note that for Mac OS, notifications
 * are only sent if the Java app is a bundled application,
 * with a {@code CFBundleDocumentTypes} array present in its
 * Info.plist. See the
 * <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">
 * Info.plist Key Reference</a> for more information about adding a
 * {@code CFBundleDocumentTypes} key to your app's Info.plist.
 *
 * @param openFileHandler handler
 *
 * @throws SecurityException if a security manager exists and its
 * {@link java.lang.SecurityManager#checkRead(java.lang.String)}
 * method denies read access to the files, or it denies the
 * {@code AWTPermission("showWindowWithoutWarningBanner")}
 * permission, or the calling thread is not allowed to create a
 * subprocess
 * @throws UnsupportedOperationException if the current platform
 * does not support the {@link Desktop.Action#APP_OPEN_FILE} action
 * @since 9
 */
public void setOpenFileHandler(final OpenFilesHandler openFileHandler) {
    checkAWTPermission();
    checkExec();
    checkRead();
    checkActionSupport(Action.APP_OPEN_FILE);
    peer.setOpenFileHandler(openFileHandler);
}
 
Example 5
Project: openjdk-jdk10   File: DesktopPeer.java   Source Code and License 2 votes vote down vote up
/**
 * Installs the handler which is notified when the application is asked to
 * open a list of files.
 *
 * @param openFileHandler handler
 *
 */
default void setOpenFileHandler(final OpenFilesHandler openFileHandler) {
}
 
Example 6
Project: openjdk-jdk10   File: Application.java   Source Code and License 2 votes vote down vote up
/**
 * Installs the handler which is notified when the application is asked to open a list of files.
 * The {@link OpenFilesHandler#openFiles(OpenFilesEvent)} notifications are only sent if the Java app is a bundled application, with a {@code CFBundleDocumentTypes} array present in it's Info.plist.
 * See the <a href="http://developer.apple.com/mac/library/documentation/General/Reference/InfoPlistKeyReference">Info.plist Key Reference</a> for more information about adding a {@code CFBundleDocumentTypes} key to your app's Info.plist.
 *
 * @param openFileHandler
 * @since Java for Mac OS X 10.6 Update 3
 * @since Java for Mac OS X 10.5 Update 8
 */
public void setOpenFileHandler(final OpenFilesHandler openFileHandler) {
    eventHandler.openFilesDispatcher.setHandler(openFileHandler);
}
 
Example 7
Project: openjdk9   File: DesktopPeer.java   Source Code and License 2 votes vote down vote up
/**
 * Installs the handler which is notified when the application is asked to
 * open a list of files.
 *
 * @param openFileHandler handler
 *
 */
default void setOpenFileHandler(final OpenFilesHandler openFileHandler) {
}