Search in sources :

Example 66 with IDialogSettings

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

the class GenerateDocAsHTMLWizardPage method handleDestinationBrowseButtonPressed.

/**
     * Open an appropriate destination browser so that the user can specify a source to import from.
     */
@Override
protected void handleDestinationBrowseButtonPressed() {
    FileDialog dialog = new FileDialog(getContainer().getShell(), SWT.SAVE);
    //$NON-NLS-1$ //$NON-NLS-2$
    dialog.setFilterExtensions(new String[] { "*.zip", "*.*" });
    //$NON-NLS-1$
    dialog.setText("");
    dialog.setFileName(getDefaultFileName());
    String currentSourceString = getDestinationValue();
    int lastSeparatorIndex = currentSourceString.lastIndexOf(File.separator);
    if (lastSeparatorIndex != -1) {
        dialog.setFilterPath(currentSourceString.substring(0, lastSeparatorIndex));
    }
    String selectedFileName = dialog.open();
    if (selectedFileName != null) {
        setErrorMessage(null);
        setDestinationValue(selectedFileName);
        if (getDialogSettings() != null) {
            IDialogSettings section = getDialogSettings().getSection(DESTINATION_FILE);
            if (section == null) {
                section = getDialogSettings().addNewSection(DESTINATION_FILE);
            }
            section.put(DESTINATION_FILE, selectedFileName);
        }
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) FileDialog(org.eclipse.swt.widgets.FileDialog)

Example 67 with IDialogSettings

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

the class ExportItemWizard method addPages.

@Override
public void addPages() {
    super.addPages();
    mainPage = new ExportItemWizardPage(getWindowTitle(), selection, baseViewId);
    addPage(mainPage);
    AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
    IDialogSettings workbenchSettings = plugin.getDialogSettings();
    //$NON-NLS-1$
    IDialogSettings section = workbenchSettings.getSection("ExportItemWizard");
    if (section == null) {
        //$NON-NLS-1$
        section = workbenchSettings.addNewSection("ExportItemWizard");
    }
    setDialogSettings(section);
}
Also used : AbstractUIPlugin(org.eclipse.ui.plugin.AbstractUIPlugin) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Example 68 with IDialogSettings

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

the class JavaPublishOnSpagoExportWizardPage method internalSaveWidgetValues.

/**
     * Hook method for saving widget values for restoration by the next instance of this class.
     */
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());
        settings.put(STORE_DESTINATION_NAMES_ID, directoryNames);
        settings.put(STORE_SHELL_LAUNCHER_ID, true);
        settings.put(STORE_SYSTEM_ROUTINE_ID, true);
        settings.put(STORE_USER_ROUTINE_ID, true);
        settings.put(STORE_MODEL_ID, true);
        settings.put(STORE_JOB_ID, true);
        settings.put(STORE_SOURCE_ID, false);
        settings.put(STORE_CONTEXT_ID, contextButton.getSelection());
    // settings.put(STORE_GENERATECODE_ID, genCodeButton.getSelection());
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Example 69 with IDialogSettings

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

the class JavaSpagicDeployWizardPage 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());
        settings.put(STORE_DESTINATION_NAMES_ID, directoryNames);
        settings.put(STORE_SHELL_LAUNCHER_ID, shellLauncherButton.getSelection());
        settings.put(STORE_SYSTEM_ROUTINE_ID, systemRoutineButton.getSelection());
        settings.put(STORE_USER_ROUTINE_ID, userRoutineButton.getSelection());
        settings.put(STORE_MODEL_ID, modelButton.getSelection());
        settings.put(STORE_JOB_ID, jobItemButton.getSelection());
        settings.put(STORE_SOURCE_ID, jobScriptButton.getSelection());
        settings.put(STORE_CONTEXT_ID, contextButton.getSelection());
        settings.put(APPLY_TO_CHILDREN_ID, applyToChildrenButton.getSelection());
    // settings.put(STORE_GENERATECODE_ID, genCodeButton.getSelection());
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Example 70 with IDialogSettings

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

the class JavaSpagicDeployWizardPage method restoreWidgetValues.

/**
     * Hook method for restoring widget values to the values that they held last time this wizard was used to
     * completion.
     */
@Override
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 (String directoryName : directoryNames) {
                addDestinationItem(directoryName);
            }
        }
        shellLauncherButton.setSelection(settings.getBoolean(STORE_SHELL_LAUNCHER_ID));
        systemRoutineButton.setSelection(settings.getBoolean(STORE_SYSTEM_ROUTINE_ID));
        userRoutineButton.setSelection(settings.getBoolean(STORE_USER_ROUTINE_ID));
        modelButton.setSelection(settings.getBoolean(STORE_MODEL_ID));
        jobItemButton.setSelection(settings.getBoolean(STORE_JOB_ID));
        jobScriptButton.setSelection(settings.getBoolean(STORE_SOURCE_ID));
        contextButton.setSelection(settings.getBoolean(STORE_CONTEXT_ID));
        applyToChildrenButton.setSelection(settings.getBoolean(APPLY_TO_CHILDREN_ID));
    // genCodeButton.setSelection(settings.getBoolean(STORE_GENERATECODE_ID));
    }
    launcherCombo.setItems(getManager().getLauncher());
    if (getManager().getLauncher().length > 0) {
        launcherCombo.select(0);
    }
    if (process.length > 0) {
        try {
            process[0].setProcess((ProcessItem) ProxyRepositoryFactory.getInstance().getUptodateProperty(process[0].getItem().getProperty()).getItem());
        } catch (PersistenceException e) {
            e.printStackTrace();
        }
        List<String> contextNames = getManager().getJobContextsComboValue((ProcessItem) process[0].getItem());
        contextCombo.setItems(contextNames.toArray(new String[contextNames.size()]));
        if (contextNames.size() > 0) {
            contextCombo.select(0);
        }
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) PersistenceException(org.talend.commons.exception.PersistenceException)

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