Search in sources :

Example 61 with IDialogSettings

use of org.eclipse.jface.dialogs.IDialogSettings in project cubrid-manager by CUBRID.

the class LoadDatabaseDialog method initial.

/**
	 * 
	 * Initial data
	 * 
	 */
private void initial() {
    IDialogSettings dialogSettings = CubridManagerUIPlugin.getPluginDialogSettings();
    filteredFilePath = dialogSettings.get(KEY_LOAD_SCHEMA_FILE + database.getId());
    if (filteredFilePath == null || filteredFilePath.trim().length() == 0) {
        filteredFilePath = database.getDatabaseInfo().getDbDir();
    }
    databaseNameText.setText(database.getLabel());
    userNameText.setText(database.getUserName());
    dbDir = database.getDatabaseInfo().getDbDir();
    if (dbUnloadInfoList == null || dbUnloadInfoList.isEmpty()) {
        selectLoadFileFromListButton.setSelection(false);
        databaseCombo.setEnabled(false);
        selectUnloadFileFromSysButton.setSelection(true);
    } else {
        int index = 0;
        for (int i = 0; i < dbUnloadInfoList.size(); i++) {
            DbUnloadInfo dbUnloadInfo = dbUnloadInfoList.get(i);
            databaseCombo.add(dbUnloadInfo.getDbName());
            if (dbUnloadInfo.getDbName().equals(database.getLabel())) {
                index = i;
            }
        }
        databaseCombo.select(index);
        setTableModel(databaseCombo.getText());
        selectUnloadFileFromSysButton.setSelection(false);
        selectLoadFileFromListButton.setSelection(true);
        setBtnStatusInList(true);
        setBtnStatusInSys(false);
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) DbUnloadInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DbUnloadInfo)

Example 62 with IDialogSettings

use of org.eclipse.jface.dialogs.IDialogSettings in project cubrid-manager by CUBRID.

the class CubridQueryUIPlugin method getPluginDialogSettings.

/**
	 * 
	 * Get this plugin dialog settings
	 * 
	 * @return IDialogSettings
	 */
public static IDialogSettings getPluginDialogSettings() {
    IDialogSettings dialogSettings = getDefault().getDialogSettings();
    IDialogSettings pliginDialogSettings = dialogSettings.getSection(PLUGIN_ID);
    if (pliginDialogSettings == null) {
        return dialogSettings.addNewSection(PLUGIN_ID);
    }
    return pliginDialogSettings;
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Example 63 with IDialogSettings

use of org.eclipse.jface.dialogs.IDialogSettings in project tdi-studio-se by Talend.

the class GenerateDocAsHTMLWizardPage method restoreWidgetValues.

/**
     * Hook method for restoring widget values to the values that they held last time this wizard was used to
     * completion.
     */
// protected void restoreWidgetValues() {
// IDialogSettings settings = getDialogSettings();
// if (settings != null) {
// String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
// if (directoryNames != null) {
// // destination
// setDestinationValue(directoryNames[0]);
// for (int i = 0; i < directoryNames.length; i++) {
// addDestinationItem(directoryNames[i]);
// }
// }
// }
// }
@Override
protected void restoreWidgetValues() {
    IDialogSettings settings = getDialogSettings();
    if (settings != null) {
        String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
        boolean destinationValid = false;
        if (directoryNames != null) {
            // destination
            boolean isFirstValid = false;
            //$NON-NLS-1$
            String filterName = ".zip";
            //$NON-NLS-1$
            String userDir = System.getProperty("user.dir");
            IPath path = new Path(userDir).append(getDefaultFileName() + getOutputSuffix());
            for (String directoryName : directoryNames) {
                addDestinationItem(directoryName);
                if (directoryName.substring(directoryName.lastIndexOf('.')).equalsIgnoreCase(filterName) && path.toOSString().equals(directoryName)) {
                    if (!isFirstValid) {
                        setDestinationValue(directoryName);
                        isFirstValid = true;
                    }
                    destinationValid = true;
                }
            }
        }
        if (!destinationValid || directoryNames == null) {
            setDefaultDestination();
        }
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) ArchiveFileExportOperationFullPath(org.talend.core.ui.export.ArchiveFileExportOperationFullPath) IPath(org.eclipse.core.runtime.IPath) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Example 64 with IDialogSettings

use of org.eclipse.jface.dialogs.IDialogSettings in project tdi-studio-se by Talend.

the class GenerateDocAsHTMLWizardPage method internalSaveWidgetValues.

/**
     * Hook method for saving widget values for restoration by the next instance of this class.
     */
@Override
protected void internalSaveWidgetValues() {
    // update directory names history
    IDialogSettings settings = getDialogSettings();
    if (settings != null) {
        String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
        if (directoryNames == null) {
            directoryNames = new String[0];
        }
        directoryNames = addToHistory(directoryNames, getDestinationValue());
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Example 65 with IDialogSettings

use of org.eclipse.jface.dialogs.IDialogSettings in project tdi-studio-se by Talend.

the class ToggleOrientationAction method refreshCheckState.

/**
     * Refreshes the check state.
     */
private void refreshCheckState() {
    IDialogSettings settings = Activator.getDefault().getDialogSettings(DIALOG_SETTINGS_NAME);
    String key = sashForm.getClass().getCanonicalName();
    String orientationString = settings.get(key);
    if ((orientationString != null && Orientation.valueOf(orientationString) == orientation) || (orientationString == null && orientation == Orientation.AUTOMATIC)) {
        setChecked(true);
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Aggregations

IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)81 File (java.io.File)9 ArrayList (java.util.ArrayList)6 PersistenceException (org.talend.commons.exception.PersistenceException)6 Point (org.eclipse.swt.graphics.Point)5 Path (org.eclipse.core.runtime.Path)4 MenuItem (org.eclipse.swt.widgets.MenuItem)4 IPath (org.eclipse.core.runtime.IPath)3 SelectionEvent (org.eclipse.swt.events.SelectionEvent)3 GridData (org.eclipse.swt.layout.GridData)3 Combo (org.eclipse.swt.widgets.Combo)3 Composite (org.eclipse.swt.widgets.Composite)3 FileDialog (org.eclipse.swt.widgets.FileDialog)3 Widget (org.eclipse.swt.widgets.Widget)3 LocalFile (org.eclipse.core.internal.filesystem.local.LocalFile)2 IFile (org.eclipse.core.resources.IFile)2 CoreException (org.eclipse.core.runtime.CoreException)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 IJobChangeEvent (org.eclipse.core.runtime.jobs.IJobChangeEvent)2 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)2