org.eclipse.ui.preferences.ScopedPreferenceStore Java Examples
The following examples show how to use
org.eclipse.ui.preferences.ScopedPreferenceStore.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BonitaLanguagePreferencePage.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public boolean performOk() { boolean ok = super.performOk(); try { ((ScopedPreferenceStore) getPreferenceStore()).save(); } catch (IOException e) { BonitaStudioLog.error(e); } if (newLocale != null && !newLocale.isEmpty()) { changeLocale(newLocale); if (MessageDialog.openQuestion(getShell(), Messages.bind(Messages.restartQuestion_title, new Object[] { bonitaStudioModuleName }), Messages.bind(Messages.restartQuestion_msg, new Object[] { bonitaStudioModuleName }))) { PlatformUI.getWorkbench().restart(); } } return ok; }
Example #2
Source File: UIUtil.java From birt with Eclipse Public License 1.0 | 6 votes |
public static Color getEclipseEditorBackground( ) { ScopedPreferenceStore preferenceStore = new ScopedPreferenceStore( InstanceScope.INSTANCE, "org.eclipse.ui.editors" );//$NON-NLS-1$ Color color = null; if ( preferenceStore != null ) { color = preferenceStore.getBoolean( AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT ) ? null : createColor( preferenceStore, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, Display.getCurrent( ) ); } if ( color == null ) { color = Display.getDefault( ) .getSystemColor( SWT.COLOR_LIST_BACKGROUND ); } return color; }
Example #3
Source File: UIUtil.java From birt with Eclipse Public License 1.0 | 6 votes |
public static Color getEclipseEditorForeground( ) { ScopedPreferenceStore preferenceStore = new ScopedPreferenceStore( InstanceScope.INSTANCE, "org.eclipse.ui.editors" );//$NON-NLS-1$ Color color = null; if ( preferenceStore != null ) { color = preferenceStore.getBoolean( AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT ) ? null : createColor( preferenceStore, AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND, Display.getCurrent( ) ); } if ( color == null ) { color = Display.getDefault( ) .getSystemColor( SWT.COLOR_LIST_FOREGROUND ); } return color; }
Example #4
Source File: PlottingFactory.java From dawnsci with Eclipse Public License 1.0 | 6 votes |
/** * Reads the extension points for the plotting systems registered and returns * a plotting system based on the users current preferences. * * @return */ @SuppressWarnings("unchecked") public static <T> IPlottingSystem<T> createPlottingSystem() throws Exception { final ScopedPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE,"org.dawb.workbench.ui"); String plotType = store.getString("org.dawb.plotting.system.choice"); if (plotType.isEmpty()) plotType = System.getProperty("org.dawb.plotting.system.choice");// For Geoff et. al. can override. if (plotType==null) plotType = "org.dawb.workbench.editors.plotting.lightWeightPlottingSystem"; // That is usually around IPlottingSystem<T> system = createPlottingSystem(plotType); if (system!=null) return system; IConfigurationElement[] systems = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.dawnsci.plotting.api.plottingClass"); if (systems.length == 0) { return null; } IPlottingSystem<T> ifnotfound = (IPlottingSystem<T>)systems[0].createExecutableExtension("class"); store.setValue("org.dawb.plotting.system.choice", systems[0].getAttribute("id")); return ifnotfound; }
Example #5
Source File: XtextBuilder.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
public BuilderPreferences () { IPreferenceStore preferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID); String schedulingRuleName = preferenceStore.getString(PREF_SCHEDULING_RULE); if (schedulingRuleName.isEmpty()) { schedulingOption = SchedulingOption.WORKSPACE; } else { schedulingOption = SchedulingOption.valueOf(schedulingRuleName); } preferenceStore.addPropertyChangeListener(e -> { if (PREF_SCHEDULING_RULE.equals(e.getProperty())) { schedulingOption = SchedulingOption.valueOf(e.getNewValue().toString()); } }); }
Example #6
Source File: AllCleanRule.java From wildwebdeveloper with Eclipse Public License 2.0 | 6 votes |
@Override protected void starting(Description description) { super.starting(description); IIntroPart intro = PlatformUI.getWorkbench().getIntroManager().getIntro(); if (intro != null) { PlatformUI.getWorkbench().getIntroManager().closeIntro(intro); } IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); for (IViewReference ref : activePage.getViewReferences()) { activePage.hideView(ref); } ScopedPreferenceStore prefs = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.lsp4e"); prefs.putValue("org.eclipse.wildwebdeveloper.angular.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.jsts.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.css.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.html.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.json.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.xml.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.yaml.file.logging.enabled", Boolean.toString(true)); clearProjects(); }
Example #7
Source File: DartboardLanguageServerStreamProvider.java From dartboard with Eclipse Public License 2.0 | 6 votes |
public DartboardLanguageServerStreamProvider() { ScopedPreferenceStore globalPreferences = DartPreferences.getPreferenceStore(); List<String> commands = new ArrayList<>(); String dartLocation; if (globalPreferences.getBoolean(GlobalConstants.P_FLUTTER_ENABLED)) { String flutterSDK = globalPreferences.getString(GlobalConstants.P_SDK_LOCATION_FLUTTER); dartLocation = flutterSDK + "/bin/cache/dart-sdk"; //$NON-NLS-1$ } else { dartLocation = globalPreferences.getString(GlobalConstants.P_SDK_LOCATION_DART); } commands.add(dartLocation + "/bin/dart"); //$NON-NLS-1$ commands.add(dartLocation + "/bin/snapshots/analysis_server.dart.snapshot"); //$NON-NLS-1$ setWorkingDirectory(System.getProperty("user.dir")); //$NON-NLS-1$ setCommands(commands); commands.add("--lsp"); //$NON-NLS-1$ }
Example #8
Source File: TestLanguageServers.java From wildwebdeveloper with Eclipse Public License 2.0 | 6 votes |
@Before public void setUpProject() throws Exception { ScopedPreferenceStore prefs = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.lsp4e"); prefs.putValue("org.eclipse.wildwebdeveloper.angular.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.jsts.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.css.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.html.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.json.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.xml.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.yaml.file.logging.enabled", Boolean.toString(true)); this.project = ResourcesPlugin.getWorkspace().getRoot().getProject(getClass().getName() + System.nanoTime()); project.create(null); project.open(null); IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); for (IViewReference ref : activePage.getViewReferences()) { activePage.hideView(ref); } }
Example #9
Source File: TestTypeScript.java From wildwebdeveloper with Eclipse Public License 2.0 | 6 votes |
@Before public void setUpProject() throws Exception { ScopedPreferenceStore prefs = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.lsp4e"); prefs.putValue("org.eclipse.wildwebdeveloper.angular.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.jsts.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.css.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.html.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.json.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.xml.file.logging.enabled", Boolean.toString(true)); prefs.putValue("org.eclipse.wildwebdeveloper.yaml.file.logging.enabled", Boolean.toString(true)); this.project = ResourcesPlugin.getWorkspace().getRoot().getProject(getClass().getName() + System.nanoTime()); project.create(null); project.open(null); IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); for (IViewReference ref : activePage.getViewReferences()) { activePage.hideView(ref); } }
Example #10
Source File: CppcheclipsePlugin.java From cppcheclipse with Apache License 2.0 | 5 votes |
public static IPersistentPreferenceStore getProjectPreferenceStore(IProject project) { // Create an overlay preference store and fill it with properties ProjectScope ps = new ProjectScope(project); ScopedPreferenceStore scoped = new ScopedPreferenceStore(ps, getId()); PreferenceInitializer.initializePropertiesDefault(scoped); return scoped; }
Example #11
Source File: TroubleshootingPreferencePage.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * GeneralPreferencePage */ public TroubleshootingPreferencePage() { super(GRID); IPreferenceStore preferenceStore = new ScopedPreferenceStore(EclipseUtil.instanceScope(), CorePlugin .getDefault().getBundle().getSymbolicName()); setPreferenceStore(preferenceStore); setDescription(Messages.TroubleshootingPreferencePage_TroubleshootingPageHeader); }
Example #12
Source File: TSPreferenceInitializer.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
@Override public void initializeDefaultPreferences() { // 设置 colors 首选项页的初始值 IPreferenceStore store = Activator.getDefault().getPreferenceStore(); PreferenceConverter.setDefault(store, IColorPreferenceConstant.TAG_FG_COLOR, new RGB(234, 234, 234)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.TAG_BG_COLOR, new RGB(223, 112, 0)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.WRONG_TAG_COLOR, new RGB(255, 0, 0)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.DIFFERENCE_FG_COLOR, new RGB(255, 0, 0)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.DIFFERENCE_BG_COLOR, new RGB(244, 244, 159)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.PT_COLOR, new RGB(255, 0, 0)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.QT_COLOR, new RGB(255, 204, 204)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.MT_COLOR, new RGB(171, 217, 198)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH101_COLOR, new RGB(255, 255, 204)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH100_COLOR, new RGB(37, 168, 204)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH90_COLOR, new RGB(79, 185, 214)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH80_COLOR, new RGB(114, 199, 222)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH70_COLOR, new RGB(155, 215, 231)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH0_COLOR, new RGB(198, 240, 251)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.HIGHLIGHTED_TERM_COLOR, new RGB(170, 255, 85)); // 设置 net.heartsome.cat.common.core 插件中的语言代码初始值 IPreferenceStore corePreferenceStore = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, CoreActivator .getDefault().getBundle().getSymbolicName()); corePreferenceStore.setDefault(IPreferenceConstants.LANGUAGECODE, LocaleService.getLanguageConfigAsString()); // 设置选择路径对话框的初始值 PlatformUI.getPreferenceStore() .setDefault(IPreferenceConstants.LAST_DIRECTORY, System.getProperty("user.home")); ColorConfigLoader.init(); }
Example #13
Source File: Repository.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void updateCurrentRepositoryPreference() { CommonRepositoryPlugin.getDefault().getPreferenceStore().setValue( RepositoryPreferenceConstant.CURRENT_REPOSITORY, getName()); try { ((ScopedPreferenceStore) CommonRepositoryPlugin.getDefault().getPreferenceStore()).save(); } catch (final IOException e) { BonitaStudioLog.error(e); } }
Example #14
Source File: AngularLanguageServer.java From wildwebdeveloper with Eclipse Public License 2.0 | 5 votes |
public AngularLanguageServer() { ScopedPreferenceStore scopedPreferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.lsp4e"); this.isLoggingToFileEnabled = scopedPreferenceStore.getBoolean(LOG_TO_FILE_ANGULAR_LS_PREFERENCE); this.isLoggingToConsoleEnabled = scopedPreferenceStore.getBoolean(LOG_TO_CONSOLE_ANGULAR_LS_PREFERENCE); List<String> commands = new ArrayList<>(); commands.add(InitializeLaunchConfigurations.getNodeJsLocation()); try { URL url = FileLocator.toFileURL(getClass().getResource("/node_modules/@angular/language-server/index.js")); commands.add(new java.io.File(url.getPath()).getAbsolutePath()); File nodeModules = new File(url.getPath()).getParentFile().getParentFile().getParentFile(); commands.add("--ngProbeLocations"); commands.add(new File(nodeModules, "@angular/language-service").getAbsolutePath()); commands.add("--tsProbeLocations"); commands.add(new File(nodeModules, "typescript").getAbsolutePath()); commands.add("--stdio"); if (isLoggingToFileEnabled) { commands.add("--logFile"); commands.add(Platform.getLogFileLocation().removeLastSegments(1) .append("angular-language-server.log").toFile() .getAbsolutePath()); } commands.add("--logVerbosity"); commands.add("terse"); setCommands(commands); setWorkingDirectory(System.getProperty("user.dir")); } catch (IOException e) { Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.getDefault().getBundle().getSymbolicName(), e.getMessage(), e)); } }
Example #15
Source File: TSPreferenceInitializer.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
@Override public void initializeDefaultPreferences() { // 设置 colors 首选项页的初始值 IPreferenceStore store = Activator.getDefault().getPreferenceStore(); PreferenceConverter.setDefault(store, IColorPreferenceConstant.TAG_FG_COLOR, new RGB(234, 234, 234)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.TAG_BG_COLOR, new RGB(223, 112, 0)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.WRONG_TAG_COLOR, new RGB(255, 0, 0)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.DIFFERENCE_FG_COLOR, new RGB(255, 0, 0)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.DIFFERENCE_BG_COLOR, new RGB(244, 244, 159)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.PT_COLOR, new RGB(255, 0, 0)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.QT_COLOR, new RGB(255, 204, 204)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.MT_COLOR, new RGB(171, 217, 198)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH101_COLOR, new RGB(255, 255, 204)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH100_COLOR, new RGB(37, 168, 204)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH90_COLOR, new RGB(79, 185, 214)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH80_COLOR, new RGB(114, 199, 222)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH70_COLOR, new RGB(155, 215, 231)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH0_COLOR, new RGB(198, 240, 251)); PreferenceConverter.setDefault(store, IColorPreferenceConstant.HIGHLIGHTED_TERM_COLOR, new RGB(170, 255, 85)); // 设置 net.heartsome.cat.common.core 插件中的语言代码初始值 IPreferenceStore corePreferenceStore = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, CoreActivator .getDefault().getBundle().getSymbolicName()); corePreferenceStore.setDefault(IPreferenceConstants.LANGUAGECODE, LocaleService.getLanguageConfigAsString()); // 设置选择路径对话框的初始值 PlatformUI.getPreferenceStore() .setDefault(IPreferenceConstants.LAST_DIRECTORY, System.getProperty("user.home")); ColorConfigLoader.init(); }
Example #16
Source File: PlotImageServiceMock.java From dawnsci with Eclipse Public License 1.0 | 5 votes |
/** * Modified from fable * @param thumbnail * @return * @throws Exception */ public Image createImageSWT(final IDataset thumbnail, ImageServiceBean bean) throws Exception { final ScopedPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.dawnsci.plotting"); if (bean==null) { bean = new ImageServiceBean(); bean.setPalette(ImageServiceMock.makeJetPalette()); bean.setOrigin(ImageOrigin.forLabel(store.getString(PlottingConstants.ORIGIN_PREF))); } bean.setImage(thumbnail); final IImageService service = new ImageServiceMock(); return service.getImage(bean); }
Example #17
Source File: ImageServiceMock.java From dawnsci with Eclipse Public License 1.0 | 5 votes |
@Override public ImageServiceBean createBeanFromPreferences() { ImageServiceBean imageServiceBean = new ImageServiceBean(); if (Platform.getPreferencesService() != null) { // Normally IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.dawnsci.plotting"); imageServiceBean.setOrigin(ImageOrigin.forLabel(store.getString(BasePlottingConstants.ORIGIN_PREF))); imageServiceBean.setHistogramType(HistoType.forLabel(store.getString(BasePlottingConstants.HISTO_PREF))); imageServiceBean.setMinimumCutBound(HistogramBound.fromString(store.getString(BasePlottingConstants.MIN_CUT))); imageServiceBean.setMaximumCutBound(HistogramBound.fromString(store.getString(BasePlottingConstants.MAX_CUT))); imageServiceBean.setNanBound(HistogramBound.fromString(store.getString(BasePlottingConstants.NAN_CUT))); imageServiceBean.setLo(store.getDouble(BasePlottingConstants.HISTO_LO)); imageServiceBean.setHi(store.getDouble(BasePlottingConstants.HISTO_HI)); try { imageServiceBean.setPalette(makeJetPalette()); } catch (Exception e) { // Ignored } } else { // Hard code something imageServiceBean.setOrigin(ImageOrigin.TOP_LEFT); imageServiceBean.setHistogramType(HistoType.OUTLIER_VALUES); imageServiceBean.setMinimumCutBound(HistogramBound.DEFAULT_MINIMUM); imageServiceBean.setMaximumCutBound(HistogramBound.DEFAULT_MAXIMUM); imageServiceBean.setNanBound(HistogramBound.DEFAULT_NAN); imageServiceBean.setLo(00.01); imageServiceBean.setHi(99.99); imageServiceBean.setPalette(makeJetPalette()); } return imageServiceBean; }
Example #18
Source File: MendeleyClient.java From slr-toolkit with Eclipse Public License 1.0 | 5 votes |
/** * This methods updates the Preference store when a new token is obtained */ private void updatePreferenceStore() { store.setValue(PreferenceConstants.P_TOKEN, access_token); store.setValue(PreferenceConstants.P_REFRESH_TOKEN, refresh_token); store.setValue(PreferenceConstants.P_EXPIRE_DATE, expires_at.getTimeInMillis()); store.setValue(PreferenceConstants.P_MENDELEY, "mendeley_on"); try { if(store instanceof ScopedPreferenceStore) { ((ScopedPreferenceStore) store).save(); } } catch (IOException e) { e.printStackTrace(); } }
Example #19
Source File: DebugUIPreferencesPDETest.java From eclipse-extras with Eclipse Public License 1.0 | 5 votes |
@Test public void testPreferenceStoreType() { DebugUIPreferences debugUIPreferences = new DebugUIPreferences(); IPreferenceStore preferenceStore = debugUIPreferences.getPreferenceStore(); assertThat( preferenceStore ).isInstanceOf( ScopedPreferenceStore.class ); }
Example #20
Source File: TypeScriptDocumentProvider.java From typescript.java with MIT License | 5 votes |
private static IPreferenceStore createProjectSpecificPreferenceStore(IProject project) { List<IPreferenceStore> stores = new ArrayList<IPreferenceStore>(); if (project != null) { stores.add(new EclipsePreferencesAdapter(new ProjectScope(project), TypeScriptUIPlugin.PLUGIN_ID)); stores.add(new EclipsePreferencesAdapter(new ProjectScope(project), TypeScriptCorePlugin.PLUGIN_ID)); } stores.add(new ScopedPreferenceStore(InstanceScope.INSTANCE, TypeScriptUIPlugin.PLUGIN_ID)); stores.add(new ScopedPreferenceStore(InstanceScope.INSTANCE, TypeScriptCorePlugin.PLUGIN_ID)); stores.add(new ScopedPreferenceStore(DefaultScope.INSTANCE, TypeScriptUIPlugin.PLUGIN_ID)); stores.add(new ScopedPreferenceStore(DefaultScope.INSTANCE, TypeScriptCorePlugin.PLUGIN_ID)); return new ChainedPreferenceStore(stores.toArray(new IPreferenceStore[stores.size()])); }
Example #21
Source File: TypeScriptMainPreferencePage.java From typescript.java with MIT License | 5 votes |
public TypeScriptMainPreferencePage() { super(GRID); IScopeContext scope = DefaultScope.INSTANCE; setPreferenceStore(new ScopedPreferenceStore(scope, TypeScriptCorePlugin.PLUGIN_ID)); // setDescription(Messages.js_debug_pref_page_desc); setImageDescriptor(TypeScriptUIImageResource.getImageDescriptor(TypeScriptUIImageResource.IMG_LOGO)); }
Example #22
Source File: PreferenceStoreHelper.java From tlaplus with MIT License | 5 votes |
/** * Retrieves preference store with the project scope * @return a store instance */ public static IPreferenceStore getProjectPreferenceStore(IProject project) { ProjectScope scope = new ProjectScope(project); ScopedPreferenceStore store = new ScopedPreferenceStore(scope, Activator.PLUGIN_ID /*Activator.getDefault().getBundle().getSymbolicName()*/); return store; }
Example #23
Source File: AbstractValidPreferencePage.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
/** * Instantiates a new valid preference page for a given Xtext language. * * @param languageName * the language name * @param fileExtensions * the file extensions */ @Inject public AbstractValidPreferencePage(@Named(Constants.LANGUAGE_NAME) final String languageName, @Named(Constants.FILE_EXTENSIONS) final String fileExtensions) { super(); this.languageName = languageName; this.fileExtensions = fileExtensions; preferences = new ScopedPreferenceStore(InstanceScope.INSTANCE, getPreferenceStoreName()); setPreferenceStore(preferences); }
Example #24
Source File: LineSeparatorConversionTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
private void testSeparator(String separator) throws Exception { IProject project = workbenchTestHelper.getProject(); ScopedPreferenceStore projectPreferenceStore = new ScopedPreferenceStore(new ProjectScope(project), Platform.PI_RUNTIME); projectPreferenceStore.setValue(Platform.PREF_LINE_SEPARATOR, separator); workbenchTestHelper.createFile("Foo.xtend", "class Foo {}"); waitForBuild(); IFile compiledFile = project.getFile("xtend-gen/Foo.java"); workbenchTestHelper.getFiles().add(compiledFile); String contents = WorkbenchTestHelper.getContentsAsString(compiledFile); List<String> expectedLines = ImmutableList.of("@SuppressWarnings(\"all\")", "public class Foo {", "}", ""); String expectedContent = Joiner.on(separator).join(expectedLines); assertEquals(expectedContent, contents); }
Example #25
Source File: TestDebug.java From wildwebdeveloper with Eclipse Public License 2.0 | 5 votes |
@Before public void setUpLaunch() throws DebugException { this.launchManager = DebugPlugin.getDefault().getLaunchManager(); removeAllLaunches(); ScopedPreferenceStore prefs = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.debug.ui"); prefs.setValue("org.eclipse.debug.ui.switch_perspective_on_suspend", MessageDialogWithToggle.ALWAYS); }
Example #26
Source File: FindbugsPlugin.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
public static boolean isProjectSettingsEnabled(IProject project) { // fast path: read from session, if available Boolean enabled; try { enabled = (Boolean) project.getSessionProperty(SESSION_PROPERTY_SETTINGS_ON); } catch (CoreException e) { enabled = null; } if (enabled != null) { return enabled.booleanValue(); } // legacy support: before 1.3.8, there was ONLY project preferences in // .fbprefs // so check if the file is there... IFile file = getUserPreferencesFile(project); boolean projectPropsEnabled = file.isAccessible(); if (projectPropsEnabled) { ScopedPreferenceStore store = new ScopedPreferenceStore(new ProjectScope(project), PLUGIN_ID); // so if the file is there, we can check if after 1.3.8 the flag is // set // to use workspace properties instead projectPropsEnabled = !store.contains(FindBugsConstants.PROJECT_PROPS_DISABLED) || !store.getBoolean(FindBugsConstants.PROJECT_PROPS_DISABLED); } // remember in the session to speedup access, don't touch the store setProjectSettingsEnabled(project, null, projectPropsEnabled); return projectPropsEnabled; }
Example #27
Source File: FindbugsPropertyPage.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
private void initPreferencesStore(IProject currProject) { workspaceStore = new ScopedPreferenceStore(new InstanceScope(), FindbugsPlugin.PLUGIN_ID); if (currProject != null) { projectStore = new ScopedPreferenceStore(new ProjectScope(currProject), FindbugsPlugin.PLUGIN_ID); projectPropsInitiallyEnabled = FindbugsPlugin.isProjectSettingsEnabled(currProject); if (!projectPropsInitiallyEnabled) { // use workspace properties instead currProject = null; } setPreferenceStore(projectStore); } else { setPreferenceStore(workspaceStore); } loadPreferences(currProject); }
Example #28
Source File: PreferenceStoreProvider.java From SparkBuilderGenerator with MIT License | 5 votes |
public PreferenceStoreWrapper providePreferenceStore() { IPreferenceStore[] preferenceStores = new IPreferenceStore[2]; preferenceStores[0] = Activator.getDefault().getPreferenceStore(); ScopedPreferenceStore jdtCorePreferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.jdt.core"); if (currentJavaProject.isPresent()) { // if we are in a project add to search scope jdtCorePreferenceStore.setSearchContexts(new IScopeContext[] { new ProjectScope(currentJavaProject.get().getProject()), InstanceScope.INSTANCE }); } preferenceStores[1] = jdtCorePreferenceStore; return new PreferenceStoreWrapper(new ChainedPreferenceStore(preferenceStores)); }
Example #29
Source File: UnicodeEscapeTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
private IProject getProject(String encoding) throws CoreException { IProject project = workbenchTestHelper.getProject(); ScopedPreferenceStore projectPreferenceStore = new ScopedPreferenceStore(new ProjectScope(project), Platform.PI_RUNTIME); projectPreferenceStore.setValue(Platform.PREF_LINE_SEPARATOR, "\n"); project.setDefaultCharset(encoding, null); return project; }
Example #30
Source File: PreferenceConstants.java From uml2solidity with Eclipse Public License 1.0 | 5 votes |
public static IPreferenceStore getPreferenceStore(IProject project) { if (project != null) { IPreferenceStore store = new ScopedPreferenceStore(new ProjectScope(project), Activator.PLUGIN_ID); if(store.getBoolean(PreferenceConstants.COMPILER_PROJECT_SETTINGS)|| store.getBoolean(PreferenceConstants.BUILDER_PROJECT_SETTINGS)) return store; } return new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID);//Activator.PLUGIN_ID); }