Search in sources :

Example 11 with IDialogSettings

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

the class WizardFileSystemResourceExportPage2 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) {
            // ie.- no settings stored
            return;
        }
        // destination
        setDestinationValue(directoryNames[0]);
        // options
        if (null != overwriteExistingFilesCheckbox) {
            overwriteExistingFilesCheckbox.setSelection(settings.getBoolean(STORE_OVERWRITE_EXISTING_FILES_ID));
        }
        tmCheck.setSelection(settings.getBoolean(SELECT_TM_EXPORTED));
        tbCheck.setSelection(settings.getBoolean(SELECT_TB_EXPORTED));
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Example 12 with IDialogSettings

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

the class ExportDocxDialog method initRtfPath.

private void initRtfPath() {
    IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings();
    String strRtfPath = dialogSettings.get(STORE_DOCX_PATH);
    if (strRtfPath != null && !strRtfPath.trim().equals("")) {
        docxPathTxt.setText(strRtfPath);
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Example 13 with IDialogSettings

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

the class ImportDocxDialog method initRtfPath.

private void initRtfPath() {
    IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings();
    String strRtfPath = dialogSettings.get(STORE_DOCX_PATH);
    if (strRtfPath != null && !strRtfPath.trim().equals("")) {
        docxPathTxt.setText(strRtfPath);
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings)

Example 14 with IDialogSettings

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

the class ConcordanceSearchDialog method readDialogSettings.

private void readDialogSettings() {
    IDialogSettings ids = getDialogSettings();
    String[] arrSearchHistory = ids.getArray("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.searchHistory");
    if (arrSearchHistory != null) {
        lstSearchHistory.clear();
        for (int i = 0; i < arrSearchHistory.length; i++) {
            lstSearchHistory.add(arrSearchHistory[i]);
        }
    }
    btnIsCaseSensitive.setSelection(ids.getBoolean("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.caseSensitive"));
    btnIsIgnoreMark.setSelection(!ids.getBoolean("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.ignoreMark"));
    btnApplyRegularExpression.setSelection(ids.getBoolean("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.regEx"));
    String selTB = ids.get("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.selTB");
    int selIndex = 0;
    if (selTB != null) {
        for (int i = 0; i < cmbDatabase.getItemCount(); i++) {
            if (selTB.equals(cmbDatabase.getItem(i))) {
                selIndex = i;
                break;
            }
        }
    }
    cmbDatabase.select(selIndex);
    String[] arrTarget = ids.getArray("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.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());
            }
        }
    }
    List<IColumn> lstShowColumn = new ArrayList<IColumn>();
    boolean blnIsResetWidth = false;
    for (int index = 1; index < tableModel.getColumnCount(); index++) {
        IColumn column = tableModel.getColumn(index);
        int width = jTable.getTableViewState().getColumnWidth(column);
        if (lstSelItem.indexOf(column.getHeaderLabel()) != -1 && width == 0) {
            jTable.getTableViewState().setColumnVisible(column, true);
            jTable.updateColumnList();
            jTable.redraw();
            lstShowColumn.add(column);
            blnIsResetWidth = true;
        } else if (width > 0) {
            lstShowColumn.add(column);
        }
    }
    if (blnIsResetWidth) {
        int width = totalWidth / lstShowColumn.size() + 1;
        for (int colNum = 1; colNum < jTable.getColumnCount(); colNum++) {
            jTable.getTableViewState().setColumnWidth(jTable.getColumn(colNum), width);
        }
    }
    cmpExpandableFilter.setExpanded(ids.getBoolean("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.isExpandFilter"));
    try {
        cmbSrcOrTgt.select(ids.getInt("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.selSrcOrTgt"));
    } catch (NumberFormatException e) {
        cmbSrcOrTgt.select(1);
    }
    try {
        cmbContain.select(ids.getInt("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.contain"));
    } catch (NumberFormatException e) {
        cmbContain.select(1);
    }
    String[] arrFilterHistory = ids.getArray("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.filterHistory");
    if (arrFilterHistory != null) {
        lstFilterHistory.clear();
        for (int i = 0; i < arrFilterHistory.length; i++) {
            lstFilterHistory.add(arrFilterHistory[i]);
        }
    }
    layoutExpandable();
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) IColumn(de.jaret.util.ui.table.model.IColumn) ArrayList(java.util.ArrayList) MenuItem(org.eclipse.swt.widgets.MenuItem) Point(org.eclipse.swt.graphics.Point)

Example 15 with IDialogSettings

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

the class ConcordanceSearchDialog method getDialogSettings.

private IDialogSettings getDialogSettings() {
    IDialogSettings settings = Activator.getDefault().getDialogSettings();
    IDialogSettings fDialogSettings = settings.getSection(getClass().getName());
    if (fDialogSettings == null)
        fDialogSettings = settings.addNewSection(getClass().getName());
    return fDialogSettings;
}
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