Search in sources :

Example 71 with IDialogSettings

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

the class OverviewSection method storeTreeExpansionState.

/**
     * Stores the tree expansion state of given tree items.
     * 
     * @param items The tree items
     */
private void storeTreeExpansionState(TreeItem[] items) {
    IDialogSettings settings = getDialogSettings();
    for (TreeItem item : items) {
        if (item.getItems().length > 0) {
            settings.put(item.getText(), item.getExpanded());
            storeTreeExpansionState(item.getItems());
        }
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) TreeItem(org.eclipse.swt.widgets.TreeItem)

Example 72 with IDialogSettings

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

the class OverviewSection method restoreTreeExpansionState.

/**
     * Restores the tree expansion state of given tree items.
     * 
     * @param items The tree items
     */
private void restoreTreeExpansionState(TreeItem[] items) {
    IDialogSettings settings = getDialogSettings();
    for (TreeItem item : items) {
        if (item.getItems().length > 0) {
            boolean expanded = settings.getBoolean(item.getText());
            item.setExpanded(expanded);
        }
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) TreeItem(org.eclipse.swt.widgets.TreeItem)

Example 73 with IDialogSettings

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

the class JavaJobScriptsExportWSWizardPage method restoreWidgetValuesForOSGI.

protected void restoreWidgetValuesForOSGI() {
    IDialogSettings settings = getDialogSettings();
    if (settings != null) {
        String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
        if (directoryNames != null && directoryNames.length > 0) {
            String fileName = getDefaultFileNameWithType();
            for (int i = 0; i < directoryNames.length; i++) {
                if (directoryNames[i].toLowerCase().endsWith(FileConstants.JAR_FILE_SUFFIX)) {
                    //$NON-NLS-1$
                    directoryNames[i] = (directoryNames[i].charAt(0) + "").toUpperCase() + directoryNames[i].substring(1);
                    addDestinationItem(directoryNames[i]);
                }
            }
            File dest = new File(new File(directoryNames[0]).getParentFile(), fileName);
            setDestinationValue(dest.getAbsolutePath());
        } else {
            setDefaultDestinationForOSGI();
        }
    } else {
        setDefaultDestinationForOSGI();
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) File(java.io.File)

Example 74 with IDialogSettings

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

the class JavaJobScriptsExportWSWizardPage method internalSaveWidgetValues.

@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];
        }
        String destinationValue = getDestinationValue();
        directoryNames = addToHistory(directoryNames, destinationValue);
        // String[] directoryNames = new String[1];
        // String destinationValue = getDestinationValue();
        // if (destinationValue != null) {
        // destinationValue = destinationValue.substring(0, destinationValue.lastIndexOf(File.separator));
        // }
        // directoryNames[0] = destinationValue;
        settings.put(STORE_EXPORTTYPE_ID, getCurrentExportType1().toString());
        settings.put(STORE_DESTINATION_NAMES_ID, directoryNames);
        if (getCurrentExportType1().equals(JobExportType.OSGI)) {
            return;
        }
        if (contextButton != null) {
            settings.put(STORE_CONTEXT_ID, contextButton.getSelection());
        }
        if (jobScriptButton != null && !jobScriptButton.isDisposed()) {
            settings.put(STORE_SOURCE_ID, jobScriptButton.getSelection());
        }
        if (applyToChildrenButton != null) {
            settings.put(APPLY_TO_CHILDREN_ID, applyToChildrenButton.getSelection());
        }
        if (jobItemButton != null && !jobItemButton.isDisposed()) {
            settings.put(STORE_JOB_ID, jobItemButton.getSelection());
        }
        if (log4jLevelCombo != null && !log4jLevelCombo.isDisposed()) {
            settings.put(LOG4J_LEVEL_ID, log4jLevelCombo.getText());
        }
        if (getCurrentExportType1().equals(JobExportType.POJO)) {
            settings.put(STORE_SHELL_LAUNCHER_ID, shellLauncherButton.getSelection());
            settings.put(EXTRACT_ZIP_FILE, chkButton.getSelection());
            return;
        } else if (getCurrentExportType1().equals(JobExportType.WSZIP)) {
            settings.put(STORE_WEBXML_ID, webXMLButton.getSelection());
            settings.put(STORE_CONFIGFILE_ID, configFileButton.getSelection());
            settings.put(STORE_AXISLIB_ID, axisLibButton.getSelection());
            settings.put(STORE_WSDD_ID, wsddButton.getSelection());
            settings.put(STORE_WSDL_ID, wsdlButton.getSelection());
            settings.put(EXTRACT_ZIP_FILE, chkButton.getSelection());
        }
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Example 75 with IDialogSettings

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

the class ImportProjectsAction method run.

public void run() {
    ExternalProjectImportWizard processWizard = new TalendExternalProjectImportWizard();
    // Set the "Copy projects into workspace" value default as true:
    IDialogSettings dialogSettings = processWizard.getDialogSettings();
    if (dialogSettings.get(STORE_COPY_PROJECT) == null) {
        dialogSettings.put(STORE_COPY_PROJECT, true);
    }
    Shell activeShell = Display.getCurrent().getActiveShell();
    WizardDialog dialog = new WizardDialog(activeShell, processWizard);
    processWizard.setWindowTitle(ACTION_TITLE);
    dialog.create();
    dialog.open();
}
Also used : ExternalProjectImportWizard(org.eclipse.ui.wizards.datatransfer.ExternalProjectImportWizard) TalendExternalProjectImportWizard(org.talend.repository.ui.wizards.newproject.copyfromeclipse.TalendExternalProjectImportWizard) Shell(org.eclipse.swt.widgets.Shell) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) WizardDialog(org.eclipse.jface.wizard.WizardDialog) TalendExternalProjectImportWizard(org.talend.repository.ui.wizards.newproject.copyfromeclipse.TalendExternalProjectImportWizard)

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