Search in sources :

Example 6 with IDialogSettings

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

the class TermBaseSearchDialog method readDialogSettings.

private void readDialogSettings() {
    IDialogSettings ids = getDialogSettings();
    btnIsCaseSensitive.setSelection(ids.getBoolean("net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.caseSensitive"));
    //	btnIsCaseSensitive.setSelection(preferenceStore.getBoolean(TBPreferenceConstants.TB_CASE_SENSITIVE));
    btnIsIgnoreMark.setSelection(!ids.getBoolean("net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.ignoreMark"));
    btnApplyRegularExpression.setSelection(ids.getBoolean("net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.regEx"));
    try {
        spiMatchQuality.setSelection(ids.getInt("net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.matchQuality"));
    } catch (NumberFormatException e) {
        spiMatchQuality.setSelection(100);
    }
    String[] arrSearchHistory = ids.getArray("net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.searchHistory");
    if (arrSearchHistory != null) {
        lstSearchHistory.clear();
        for (int i = 0; i < arrSearchHistory.length; i++) {
            lstSearchHistory.add(arrSearchHistory[i]);
        }
    }
    String selTM = ids.get("net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.selTM");
    int selIndex = 0;
    if (selTM != null) {
        for (int i = 0; i < cmbDatabase.getItemCount(); i++) {
            if (selTM.equals(cmbDatabase.getItem(i))) {
                selIndex = i;
                break;
            }
        }
    }
    cmbDatabase.select(selIndex);
    String[] arrTarget = ids.getArray("net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.selTgt");
    List<String> lstSelItem = new ArrayList<String>();
    if (arrTarget != null) {
        for (int i = 0; i < menu.getItemCount(); i++) {
            MenuItem item = menu.getItem(i);
            for (String target : arrTarget) {
                if (item.getText().equals(target)) {
                    item.setSelection(true);
                    break;
                }
            }
            if (item.getSelection()) {
                lstSelItem.add(item.getText());
            }
        }
    }
    // 重设表格列宽
    int totalWidth = 0;
    List<GridColumn> lstShowColumn = new ArrayList<GridColumn>();
    for (int index = 0; index < grid.getColumnCount(); index++) {
        GridColumn column = grid.getColumn(index);
        if (column.getWidth() > 0) {
            totalWidth += column.getWidth();
        }
        if (column.getWidth() > 0 || lstSelItem.indexOf(column.getText()) >= 0) {
            lstShowColumn.add(column);
        }
    }
    int width = (totalWidth + 100) / lstShowColumn.size();
    for (GridColumn column : lstShowColumn) {
        column.setWidth(width);
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) ArrayList(java.util.ArrayList) MenuItem(org.eclipse.swt.widgets.MenuItem) GridColumn(org.eclipse.nebula.widgets.grid.GridColumn) Point(org.eclipse.swt.graphics.Point)

Example 7 with IDialogSettings

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

the class ConversionWizard method performFinish.

@Override
public boolean performFinish() {
    IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings();
    dialogSettings.put(ConversionWizardPage.REPLACE_TARGET, page.isReplaceTarget());
    dialogSettings.put(ConversionWizardPage.OPEN_PRE_TRANS, page.isOpenPreTrans());
    return true;
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Example 8 with IDialogSettings

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

the class ExportProjectWizardPage method internalSaveWidgetValues.

/**
	 * Hook method for saving widget values for restoration by the next instance of this class.
	 */
protected void internalSaveWidgetValues() {
    super.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_CREATE_STRUCTURE_ID, true);
        settings.put(STORE_COMPRESS_CONTENTS_ID, true);
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Example 9 with IDialogSettings

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

the class ExportProjectWizardPage 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() {
    super.restoreWidgetValues();
    IDialogSettings settings = getDialogSettings();
    if (settings != null) {
        String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
        if (directoryNames == null || directoryNames.length == 0) {
            // ie.- no settings stored
            return;
        }
        // destination
        setDestinationValue(directoryNames[0]);
    //			for (int i = 0; i < directoryNames.length; i++) {
    //				addDestinationItem(directoryNames[i]);
    //			}
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Example 10 with IDialogSettings

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

the class ImportProjectWizardPage method saveWidgetValues.

/**
	 * Since Finish was pressed, write widget values to the dialog store so that
	 * they will persist into the next invocation of this wizard page.
	 * 
	 * Method declared public only for use of tests.
	 */
public void saveWidgetValues() {
    IDialogSettings settings = getDialogSettings();
    if (settings != null) {
        settings.put(STORE_COPY_PROJECT_ID, true);
        settings.put(STORE_ARCHIVE_SELECTED, 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