Search in sources :

Example 36 with IDialogSettings

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

the class JavaJobScriptsExportWSWizardPage method restoreWidgetValuesForWS.

protected void restoreWidgetValuesForWS() {
    IDialogSettings settings = getDialogSettings();
    if (settings != null) {
        String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
        if (directoryNames != null && directoryNames.length > 0) {
            String fileName = getDefaultFileNameWithType();
            // destination
            for (int i = 0; i < directoryNames.length; i++) {
                if (directoryNames[i].toLowerCase().endsWith(FileConstants.WAR_FILE_SUFFIX) || directoryNames[i].toLowerCase().endsWith(FileConstants.ZIP_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 {
            setDefaultDestination();
        }
        webXMLButton.setSelection(settings.getBoolean(STORE_WEBXML_ID));
        configFileButton.setSelection(settings.getBoolean(STORE_CONFIGFILE_ID));
        axisLibButton.setSelection(settings.getBoolean(STORE_AXISLIB_ID));
        wsddButton.setSelection(settings.getBoolean(STORE_WSDD_ID));
        wsdlButton.setSelection(settings.getBoolean(STORE_WSDL_ID));
        jobScriptButton.setSelection(settings.getBoolean(STORE_SOURCE_ID));
        contextButton.setSelection(settings.getBoolean(STORE_CONTEXT_ID));
        applyToChildrenButton.setSelection(settings.getBoolean(APPLY_TO_CHILDREN_ID));
        chkButton.setSelection(settings.getBoolean(EXTRACT_ZIP_FILE));
        // TDI-26294:should use getVisible here since the isVisible need the parent's isVisible()
        if (chkButton.getVisible()) {
            zipOption = String.valueOf(chkButton.getSelection());
        } else {
            //$NON-NLS-1$
            zipOption = "false";
        }
    }
    if (getProcessItem() != null && contextCombo != null) {
        try {
            setProcessItem((ProcessItem) ProxyRepositoryFactory.getInstance().getUptodateProperty(getProcessItem().getProperty()).getItem());
        } catch (PersistenceException e) {
            e.printStackTrace();
        }
        List<String> contextNames = ExportJobUtil.getJobContexts(getProcessItem());
        contextCombo.setItems(contextNames.toArray(new String[contextNames.size()]));
        if (contextNames.size() > 0) {
            contextCombo.select(0);
        }
    }
    if (log4jLevelCombo != null) {
        log4jLevelCombo.setItems(Log4jPrefsSettingManager.getLevel());
        if (Log4jPrefsSettingManager.getLevel().length > 0) {
            log4jLevelCombo.select(2);
        }
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) PersistenceException(org.talend.commons.exception.PersistenceException) File(java.io.File)

Example 37 with IDialogSettings

use of org.eclipse.jface.dialogs.IDialogSettings in project translationstudio8 by heartsome.

the class ConversionWizardPage method createConversionOptionsGroup.

/**
	 * 转换选项组
	 * @param contents
	 *            ;
	 */
private void createConversionOptionsGroup(Composite contents) {
    Group options = new Group(contents, SWT.NONE);
    //$NON-NLS-1$
    options.setText(Messages.getString("wizard.ConversionWizardPage.options"));
    options.setLayout(new GridLayout(1, false));
    options.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    /* 如果已经存在,是否要替换 */
    final Button btnReplaceTarget = new Button(options, SWT.CHECK);
    //$NON-NLS-1$
    btnReplaceTarget.setText(Messages.getString("wizard.ConversionWizardPage.btnReplaceTarget"));
    btnReplaceTarget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    btnReplaceTarget.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            isReplaceTarget = btnReplaceTarget.getSelection();
            for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) {
                conversionConfigBean.setReplaceTarget(btnReplaceTarget.getSelection());
            }
            validate();
        }
    });
    final Button btnOpenPreTrans = new Button(options, SWT.CHECK);
    btnOpenPreTrans.setText(Messages.getString("wizard.ConversionWizardPage.btnOpenPreTrans"));
    btnOpenPreTrans.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    btnOpenPreTrans.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            isOpenPreTrans = btnOpenPreTrans.getSelection();
        }
    });
    Composite composite = new Composite(options, SWT.NONE);
    GridLayout gd = new GridLayout(1, false);
    gd.marginWidth = 0;
    gd.marginHeight = 0;
    composite.setLayout(gd);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    Label tgtLangLbl = new Label(composite, SWT.NONE);
    tgtLangLbl.setText(Messages.getString("wizard.ConversionWizardPage.tgtLangLbl"));
    tgtLangViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
    Table tgtLangTable = tgtLangViewer.getTable();
    GridData gdTgtLangTable = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    gdTgtLangTable.heightHint = 80;
    tgtLangTable.setLayoutData(gdTgtLangTable);
    tgtLangViewer.setLabelProvider(new LanguageLabelProvider());
    tgtLangViewer.setContentProvider(new ArrayContentProvider());
    tgtLangViewer.setInput(conversionConfigBeans.get(0).getTgtLangList());
    tgtLangViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection sel = (IStructuredSelection) event.getSelection();
            @SuppressWarnings("unchecked") List<Language> selectedList = sel.toList();
            for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) {
                conversionConfigBean.setHasSelTgtLangList(selectedList);
            }
            validate();
        }
    });
    tgtLangViewer.getTable().select(0);
    IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings();
    btnReplaceTarget.setSelection(dialogSettings.getBoolean(REPLACE_TARGET));
    btnOpenPreTrans.setSelection(dialogSettings.getBoolean(OPEN_PRE_TRANS));
    this.isOpenPreTrans = btnOpenPreTrans.getSelection();
    isReplaceTarget = btnReplaceTarget.getSelection();
    for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) {
        conversionConfigBean.setReplaceTarget(isReplaceTarget);
    }
    validate();
}
Also used : Group(org.eclipse.swt.widgets.Group) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) LanguageLabelProvider(net.heartsome.cat.ts.ui.composite.LanguageLabelProvider) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Label(org.eclipse.swt.widgets.Label) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) ConversionConfigBean(net.heartsome.cat.convert.ui.model.ConversionConfigBean) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) WritableList(org.eclipse.core.databinding.observable.list.WritableList) List(java.util.List) ArrayList(java.util.ArrayList) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 38 with IDialogSettings

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

the class CommonUIPlugin method getPluginDialogSettings.

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 39 with IDialogSettings

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

the class FindReplaceDialog method getDialogSettings.

/**
	 * Retrieves the dialog settings.
	 * 
	 * @return Dialog Settings
	 */
private IDialogSettings getDialogSettings() {
    IDialogSettings dialogSettings;
    IDialogSettings settings = CUBRIDTextEditorPlugin.getDefault().getDialogSettings();
    dialogSettings = settings.getSection(getClass().getName());
    if (dialogSettings == null) {
        dialogSettings = settings.addNewSection(getClass().getName());
    }
    //set default values.
    if (dialogSettings.get("wrap") == null) {
        //$NON-NLS-1$
        dialogSettings.put("wrap", isWrapSearch());
        //$NON-NLS-1$
        dialogSettings.put("casesensitive", isCaseSensitive());
        //$NON-NLS-1$
        dialogSettings.put("wholeword", isWholeWord());
        //$NON-NLS-1$
        dialogSettings.put("incremental", isIncremental());
        //$NON-NLS-1$
        dialogSettings.put("isRegEx", isRegularExpressions());
    }
    return dialogSettings;
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Example 40 with IDialogSettings

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

the class FindReplaceDialog method writeConfiguration.

/**
	 * Stores its current configuration in the dialog store.
	 */
private void writeConfiguration() {
    IDialogSettings s = getDialogSettings();
    //$NON-NLS-1$
    s.put("wrap", isWrapSearch());
    //$NON-NLS-1$
    s.put("casesensitive", isCaseSensitive());
    //$NON-NLS-1$
    s.put("wholeword", isWholeWord());
    //$NON-NLS-1$
    s.put("incremental", isIncremental());
    //$NON-NLS-1$
    s.put("isRegEx", isRegularExpressions());
    List<String> history = getFindHistory();
    //$NON-NLS-1$
    writeHistory(history, s, "findhistory");
    history = getReplaceHistory();
    //$NON-NLS-1$
    writeHistory(history, s, "replacehistory");
}
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