/*
 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
 */
package com.sun.glass.ui.x11;

import com.sun.glass.ui.Application;
import com.sun.glass.ui.CommonDialogs.ExtensionFilter;

import java.security.AccessController;
import java.security.PrivilegedAction;

/**
 * X11 platform implementation class for CommonDialogs.
 *
 * @author Dmitry Cherepanov
 */
final class X11CommonDialogs {
    static {
        AccessController.doPrivileged(new PrivilegedAction() {
            public Object run() {
                Application.loadNativeLibrary();
                return null;
            }
        });
    }

    private static native String[] _showFileChooser(String folder, String title, int type,
						    boolean multipleMode, ExtensionFilter[] extensionFilters);

    private static native String _showFolderChooser();

    static String[] showFileChooser_impl(String folder, String title, int type,
                                         boolean multipleMode, ExtensionFilter[] extensionFilters) {
        return _showFileChooser(folder, title, type, multipleMode, extensionFilters);
    }

    static String showFolderChooser_impl() {
        return _showFolderChooser();
    }
}
