Search in sources :

Example 1 with DialogSettings

use of org.eclipse.jface.dialogs.DialogSettings in project che by eclipse.

the class JavaPlugin method loadDialogSettings.

/**
     * Loads the dialog settings for this plug-in.
     * The default implementation first looks for a standard named file in the
     * plug-in's read/write state area; if no such file exists, the plug-in's
     * install directory is checked to see if one was installed with some default
     * settings; if no file is found in either place, a new empty dialog settings
     * is created. If a problem occurs, an empty settings is silently used.
     * <p>
     * This framework method may be overridden, although this is typically
     * unnecessary.
     * </p>
     */
protected void loadDialogSettings() {
    //$NON-NLS-1$
    dialogSettings = new DialogSettings("Workbench");
    // bug 69387: The instance area should not be created (in the call to
    // #getStateLocation) if -data @none or -data @noDefault was used
    IPath dataLocation = new Path(settingsDir);
    //        if (dataLocation != null) {
    // try r/w state area in the local file system
    String readWritePath = dataLocation.append(FN_DIALOG_SETTINGS).toOSString();
    File settingsFile = new File(readWritePath);
    if (settingsFile.exists()) {
        try {
            dialogSettings.load(readWritePath);
        } catch (IOException e) {
            // load failed so ensure we have an empty settings
            //$NON-NLS-1$
            dialogSettings = new DialogSettings("Workbench");
        }
    //                return;
    }
//        }
//        // otherwise look for bundle specific dialog settings
//        URL dsURL = BundleUtility.find(getBundle(), FN_DIALOG_SETTINGS);
//        if (dsURL == null) {
//            return;
//        }
//
//        InputStream is = null;
//        try {
//            is = dsURL.openStream();
//            BufferedReader reader = new BufferedReader(
//                    new InputStreamReader(is, "utf-8")); //$NON-NLS-1$
//            dialogSettings.load(reader);
//        } catch (IOException e) {
//            // load failed so ensure we have an empty settings
//            dialogSettings = new DialogSettings("Workbench"); //$NON-NLS-1$
//        } finally {
//            try {
//                if (is != null) {
//                    is.close();
//                }
//            } catch (IOException e) {
//                // do nothing
//            }
//        }
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) DialogSettings(org.eclipse.jface.dialogs.DialogSettings) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) IOException(java.io.IOException) File(java.io.File)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 IPath (org.eclipse.core.runtime.IPath)1 Path (org.eclipse.core.runtime.Path)1 DialogSettings (org.eclipse.jface.dialogs.DialogSettings)1 IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)1