Search in sources :

Example 96 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project translationstudio8 by heartsome.

the class NewProjectWizard method initProjectConfig.

/**
	 * 构建项目配置信息
	 * @param project
	 *            ;
	 * @throws CoreException
	 */
private void initProjectConfig(final IProject project, IProgressMonitor monitor) {
    if (monitor == null) {
        monitor = new NullProgressMonitor();
    }
    final IProgressMonitor sMonitor = monitor;
    sMonitor.beginTask(Messages.getString("wizard.NewProjectWizard.task2"), 3);
    sMonitor.worked(1);
    Display.getDefault().asyncExec(new Runnable() {

        public void run() {
            ProjectInfoBean bean = new ProjectInfoBean();
            bean.setProjectName(project.getName());
            bean.setMapField(firstPage.getFieldMap());
            bean.setMapAttr(firstPage.getAttributeMap());
            bean.setSourceLang(secondPage.getSrcLanguage());
            bean.setTargetLang(secondPage.getTargetlanguage());
            for (AbstractNewProjectWizardPage extensionPage : extensionPages) {
                if (extensionPage.getPageType().equals("TM")) {
                    bean.setTmDb(extensionPage.getSelectedDatabase());
                } else if (extensionPage.getPageType().equals("TB")) {
                    bean.setTbDb(extensionPage.getSelectedDatabase());
                }
            }
            sMonitor.worked(1);
            ProjectConfiger projCfg = ProjectConfigerFactory.getProjectConfiger(project);
            sMonitor.worked(1);
            projCfg.updateProjectConfig(bean);
            // 记住当前语言信息
            IPreferenceStore ps = Activator.getDefault().getPreferenceStore();
            ps.setValue(IPreferenceConstants.NEW_PROJECT_SRC_LANG, bean.getSourceLang().getCode());
            List<Language> targetLangList = bean.getTargetLang();
            StringBuffer bf = new StringBuffer();
            for (Language lang : targetLangList) {
                bf.append(lang.getCode());
                bf.append(",");
            }
            ps.setValue(IPreferenceConstants.NEW_PROJECT_TGT_LANG, bf.substring(0, bf.lastIndexOf(",")));
            if (sMonitor.isCanceled()) {
                try {
                    project.delete(true, sMonitor);
                } catch (CoreException e) {
                    logger.error("", e);
                }
                throw new OperationCanceledException();
            }
        }
    });
    sMonitor.done();
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) AbstractNewProjectWizardPage(net.heartsome.cat.ts.ui.extensionpoint.AbstractNewProjectWizardPage) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ProjectInfoBean(net.heartsome.cat.common.bean.ProjectInfoBean) Language(net.heartsome.cat.common.locale.Language) CoreException(org.eclipse.core.runtime.CoreException) ProjectConfiger(net.heartsome.cat.ts.core.file.ProjectConfiger) ISafeRunnable(org.eclipse.core.runtime.ISafeRunnable) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) ArrayList(java.util.ArrayList) List(java.util.List) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 97 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project jop by jop-devel.

the class JOPizer method buildToolChain.

private void buildToolChain(IProgressMonitor monitor) throws CoreException {
    IPreferenceStore prefs = JOPUIPlugin.getDefault().getPreferenceStore();
    String jopHome = prefs.getString(IJOPLaunchConfigurationConstants.ATTR_JOP_HOME);
    AntRunner antRunner = new AntRunner();
    antRunner.setBuildFileLocation(jopHome + IPath.SEPARATOR + "build.xml");
    antRunner.setExecutionTargets(new String[] { "directories", "tools", "classes" });
    try {
        antRunner.run(monitor);
    } catch (CoreException e) {
        // TODO only for demo since i don't have quartus etc installed
        e.printStackTrace();
    }
}
Also used : AntRunner(org.eclipse.ant.core.AntRunner) CoreException(org.eclipse.core.runtime.CoreException) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 98 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project jop by jop-devel.

the class JOPizer method getClassesClasspathEntry.

private IClasspathEntry getClassesClasspathEntry() throws JavaModelException {
    IPreferenceStore prefs = JOPUIPlugin.getDefault().getPreferenceStore();
    String jopHome = prefs.getString(IJOPLaunchConfigurationConstants.ATTR_JOP_HOME);
    IPath jopClasses = new Path(jopHome).append(new Path("java/target/dist/lib/classes.zip"));
    IClasspathEntry[] entries = currentProject.getRawClasspath();
    for (IClasspathEntry entry : entries) {
        if (entry.getPath().equals(jopClasses)) {
            return entry;
        }
    }
    return null;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) IClasspathEntry(org.eclipse.jdt.core.IClasspathEntry) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 99 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project dbeaver by serge-rider.

the class DBeaverPreferencesInitializer method initializeDefaultPreferences.

@Override
public void initializeDefaultPreferences() {
    boolean isWindows = RuntimeUtils.isPlatformWindows();
    // Init default preferences
    DBPPreferenceStore store = new BundlePreferenceStore(DBeaverActivator.getInstance().getBundle());
    // Resources
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.DEFAULT_RESOURCE_ENCODING, GeneralUtils.UTF8_ENCODING);
    // Agent
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.AGENT_ENABLED, true);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.AGENT_LONG_OPERATION_NOTIFY, isWindows);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.AGENT_LONG_OPERATION_TIMEOUT, 30);
    // Navigator
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.NAVIGATOR_EXPAND_ON_CONNECT, false);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.NAVIGATOR_SORT_ALPHABETICALLY, false);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.NAVIGATOR_SORT_FOLDERS_FIRST, true);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.NAVIGATOR_SYNC_EDITOR_DATASOURCE, false);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.NAVIGATOR_REFRESH_EDITORS_ON_OPEN, false);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.NAVIGATOR_GROUP_BY_DRIVER, false);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.NAVIGATOR_EDITOR_FULL_NAME, false);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.NAVIGATOR_CONNECTION_DOUBLE_CLICK, NavigatorViewBase.DoubleClickBehavior.SQL_EDITOR.name());
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.NAVIGATOR_SHOW_SQL_PREVIEW, true);
    // Common
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.KEEP_STATEMENT_OPEN, false);
    // SQL execution
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.SCRIPT_COMMIT_TYPE, SQLScriptCommitType.NO_COMMIT.name());
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.SCRIPT_COMMIT_LINES, 1000);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.SCRIPT_ERROR_HANDLING, SQLScriptErrorHandling.STOP_ROLLBACK.name());
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.SCRIPT_FETCH_RESULT_SETS, true);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.SCRIPT_DELETE_EMPTY, true);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.SCRIPT_AUTO_FOLDERS, false);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.SCRIPT_TITLE_PATTERN, SQLEditor.DEFAULT_PATTERN);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.STATEMENT_INVALIDATE_BEFORE_EXECUTE, false);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.STATEMENT_TIMEOUT, 0);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.READ_EXPENSIVE_PROPERTIES, false);
    // Disable separate connection by default. Otherwise many people don't understand what happens (data editor and SQL editor have different contexts)
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.EDITOR_SEPARATE_CONNECTION, false);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.EDITOR_CONNECT_ON_ACTIVATE, true);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.EDITOR_CONNECT_ON_EXECUTE, false);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.RS_EDIT_USE_ALL_COLUMNS, false);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.RS_EDIT_MAX_TEXT_SIZE, 10 * 1000000);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.RS_EDIT_LONG_AS_LOB, true);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.RS_EDIT_AUTO_UPDATE_VALUE, true);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.RS_COMMIT_ON_EDIT_APPLY, false);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.RS_COMMIT_ON_CONTENT_APPLY, false);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.TEXT_EDIT_UNDO_LEVEL, 200);
    {
        // SQL prefs
        PrefUtils.setDefaultPreferenceValue(store, SQLPreferenceConstants.AUTO_SAVE_ON_CLOSE, false);
        PrefUtils.setDefaultPreferenceValue(store, SQLPreferenceConstants.AUTO_SAVE_ON_EXECUTE, false);
        PrefUtils.setDefaultPreferenceValue(store, SQLPreferenceConstants.ENABLE_AUTO_ACTIVATION, true);
        PrefUtils.setDefaultPreferenceValue(store, SQLPreferenceConstants.ENABLE_KEYSTROKE_ACTIVATION, true);
        PrefUtils.setDefaultPreferenceValue(store, SQLPreferenceConstants.AUTO_ACTIVATION_DELAY, 0);
        PrefUtils.setDefaultPreferenceValue(store, SQLPreferenceConstants.INSERT_SINGLE_PROPOSALS_AUTO, true);
        PrefUtils.setDefaultPreferenceValue(store, SQLPreferenceConstants.PROPOSAL_INSERT_CASE, SQLPreferenceConstants.PROPOSAL_CASE_DEFAULT);
        PrefUtils.setDefaultPreferenceValue(store, SQLPreferenceConstants.HIDE_DUPLICATE_PROPOSALS, false);
        PrefUtils.setDefaultPreferenceValue(store, SQLPreferenceConstants.PROPOSAL_SHORT_NAME, false);
        PrefUtils.setDefaultPreferenceValue(store, SQLPreferenceConstants.INSERT_SPACE_AFTER_PROPOSALS, false);
        PrefUtils.setDefaultPreferenceValue(store, SQLPreferenceConstants.SQLEDITOR_CLOSE_SINGLE_QUOTES, true);
        PrefUtils.setDefaultPreferenceValue(store, SQLPreferenceConstants.SQLEDITOR_CLOSE_DOUBLE_QUOTES, true);
        PrefUtils.setDefaultPreferenceValue(store, SQLPreferenceConstants.SQLEDITOR_CLOSE_BRACKETS, true);
        PrefUtils.setDefaultPreferenceValue(store, SQLPreferenceConstants.SQLEDITOR_CLOSE_COMMENTS, true);
        PrefUtils.setDefaultPreferenceValue(store, SQLPreferenceConstants.SQLEDITOR_CLOSE_BEGIN_END, true);
        PrefUtils.setDefaultPreferenceValue(store, SQLPreferenceConstants.SQL_FORMAT_KEYWORD_CASE_AUTO, true);
        PrefUtils.setDefaultPreferenceValue(store, SQLPreferenceConstants.SQL_FORMAT_EXTRACT_FROM_SOURCE, true);
    }
    PrefUtils.setDefaultPreferenceValue(store, SQLPreferenceConstants.RESET_CURSOR_ON_EXECUTE, false);
    PrefUtils.setDefaultPreferenceValue(store, SQLPreferenceConstants.BEEP_ON_QUERY_END, false);
    PrefUtils.setDefaultPreferenceValue(store, SQLPreferenceConstants.REFRESH_DEFAULTS_AFTER_EXECUTE, false);
    // Text editor default preferences
    PrefUtils.setDefaultPreferenceValue(store, AbstractTextEditor.PREFERENCE_TEXT_DRAG_AND_DROP_ENABLED, true);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.HEX_FONT_NAME, HexEditControl.DEFAULT_FONT_NAME);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.HEX_FONT_SIZE, 10);
    // General UI
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.UI_AUTO_UPDATE_CHECK, true);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.UI_KEEP_DATABASE_EDITORS, true);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.UI_PROXY_HOST, "");
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.UI_PROXY_PORT, 1080);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.UI_PROXY_USER, "");
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.UI_PROXY_PASSWORD, "");
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.UI_DRIVERS_VERSION_UPDATE, false);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.UI_DRIVERS_HOME, "");
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.UI_DRIVERS_SOURCES, "http://dbeaver.jkiss.org/files/jdbc/");
    // ResultSet
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.RESULT_SET_AUTO_FETCH_NEXT_SEGMENT, true);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.RESULT_SET_READ_METADATA, true);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.RESULT_SET_READ_REFERENCES, true);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.RESULT_SET_MAX_ROWS, 200);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.RESULT_SET_CANCEL_TIMEOUT, 5000);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.RESULT_SET_BINARY_EDITOR_TYPE, IValueController.EditType.EDITOR);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.RESULT_SET_ORDER_SERVER_SIDE, true);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.RESULT_SET_SHOW_ODD_ROWS, true);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.RESULT_SET_SHOW_CELL_ICONS, true);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.RESULT_SET_DOUBLE_CLICK, Spreadsheet.DoubleClickBehavior.INLINE_EDITOR.name());
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.RESULT_SET_AUTO_SWITCH_MODE, false);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.RESULT_SET_SHOW_DESCRIPTION, false);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.RESULT_TEXT_MAX_COLUMN_SIZE, 255);
    PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.RESULT_TEXT_VALUE_FORMAT, DBDDisplayFormat.EDIT.name());
    // QM
    PrefUtils.setDefaultPreferenceValue(store, QMConstants.PROP_HISTORY_DAYS, 90);
    PrefUtils.setDefaultPreferenceValue(store, QMConstants.PROP_ENTRIES_PER_PAGE, 200);
    PrefUtils.setDefaultPreferenceValue(store, QMConstants.PROP_OBJECT_TYPES, QMObjectType.toString(Arrays.asList(QMObjectType.txn, QMObjectType.query)));
    PrefUtils.setDefaultPreferenceValue(store, QMConstants.PROP_QUERY_TYPES, DBCExecutionPurpose.USER + "," + DBCExecutionPurpose.USER_FILTERED + "," + DBCExecutionPurpose.USER_SCRIPT);
    PrefUtils.setDefaultPreferenceValue(store, QMConstants.PROP_STORE_LOG_FILE, false);
    PrefUtils.setDefaultPreferenceValue(store, QMConstants.PROP_LOG_DIRECTORY, GeneralUtils.getMetadataFolder().getAbsolutePath());
    // Data formats
    DataFormatterProfile.initDefaultPreferences(store, Locale.getDefault());
    // SQL editor preferences
    {
        IPreferenceStore editorStore = EditorsPlugin.getDefault().getPreferenceStore();
        editorStore.setDefault(SQLPreferenceConstants.MATCHING_BRACKETS, true);
        editorStore.setDefault(SQLPreferenceConstants.MATCHING_BRACKETS_COLOR, "128,128,128");
    }
}
Also used : BundlePreferenceStore(org.jkiss.dbeaver.model.impl.preferences.BundlePreferenceStore) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 100 with IPreferenceStore

use of org.eclipse.jface.preference.IPreferenceStore in project dbeaver by serge-rider.

the class ERDPreferencePage method createContents.

@Override
protected Control createContents(Composite parent) {
    IPreferenceStore store = ERDActivator.getDefault().getPreferenceStore();
    Composite composite = UIUtils.createPlaceholder(parent, 2, 5);
    createContentsGroup(store, composite);
    createVisibilityGroup(store, composite);
    createStyleGroup(store, composite);
    createGridGroup(store, composite);
    createPrintGroup(store, composite);
    return composite;
}
Also used : IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Aggregations

IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)161 ArrayList (java.util.ArrayList)31 Hashtable (java.util.Hashtable)19 Before (org.junit.Before)17 List (java.util.List)14 IElementParameter (org.talend.core.model.process.IElementParameter)12 FontData (org.eclipse.swt.graphics.FontData)11 ElementParameter (org.talend.designer.core.model.components.ElementParameter)11 InvocationTargetException (java.lang.reflect.InvocationTargetException)10 Font (org.eclipse.swt.graphics.Font)10 Composite (org.eclipse.swt.widgets.Composite)9 File (java.io.File)7 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)7 StyledText (org.eclipse.swt.custom.StyledText)7 SelectionEvent (org.eclipse.swt.events.SelectionEvent)7 Point (org.eclipse.swt.graphics.Point)7 GridLayout (org.eclipse.swt.layout.GridLayout)7 Node (org.talend.designer.core.ui.editor.nodes.Node)7 GridData (org.eclipse.swt.layout.GridData)6 IOException (java.io.IOException)5