List of usage examples for org.eclipse.jface.preference PreferenceStore PreferenceStore
public PreferenceStore()
From source file:net.sf.eclipsensis.settings.PreferenceStoreWrapper.java
License:Open Source License
/** * @param preferenceStore/*from w w w. j ava2 s . c o m*/ */ public PreferenceStoreWrapper(IPreferenceStore preferenceStore) { mParentStore = preferenceStore; mInternalStore = new PreferenceStore(); mParentStore.addPropertyChangeListener(mPropertyChangeListener); }
From source file:net.sf.eclipsensis.wizard.settings.dialogs.AbstractNSISInstallItemDialog.java
License:Open Source License
public AbstractNSISInstallItemDialog(NSISWizard wizard, INSISInstallElement item) { super(wizard.getShell()); mWizard = wizard;//from www . java 2s . com mItem = item; mStore = new PreferenceStore(); setTitle(EclipseNSISPlugin.getFormattedString("wizard.installitem.dialog.title.format", //$NON-NLS-1$ new String[] { NSISInstallElementFactory.getTypeName(mItem.getType()) })); Common.beanToStore(mItem, mStore, getProperties()); }
From source file:net.sf.solareclipse.ui.preferences.OverlayPreferenceStore.java
License:Open Source License
public OverlayPreferenceStore(IPreferenceStore parent, PreferenceDescriptor[] overlayKeys) { this.parent = parent; this.keys = overlayKeys; store = new PreferenceStore(); }
From source file:net.sourceforge.eclipsetrader.core.CorePlugin.java
License:Open Source License
/** * Log4j configurator//from w w w. j ava 2s. com */ public void configureLogging() { try { PreferenceStore preferences = new PreferenceStore(); // Set the default values from extension registry IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionPoint extensionPoint = registry .getExtensionPoint(CorePlugin.LOGGER_PREFERENCES_EXTENSION_POINT); IConfigurationElement[] members = extensionPoint.getConfigurationElements(); for (int i = 0; i < members.length; i++) { IConfigurationElement element = members[i]; if (element.getName().equals("logger")) //$NON-NLS-1$ { if (element.getAttribute("defaultValue") != null) //$NON-NLS-1$ { String[] item = element.getAttribute("name").split(";"); //$NON-NLS-1$ //$NON-NLS-2$ for (int x = 0; x < item.length; x++) preferences.setDefault("log4j.logger." + item[x], element.getAttribute("defaultValue")); //$NON-NLS-1$ //$NON-NLS-2$ } } } // Set the default values from the bundle's properties file try { URL url = CorePlugin.getDefault().getBundle().getResource("log4j.properties"); //$NON-NLS-1$ Properties properties = new Properties(); properties.load(url.openStream()); for (Iterator iter = properties.keySet().iterator(); iter.hasNext();) { String key = (String) iter.next(); preferences.setDefault(key, (String) properties.get(key)); } // Read the values from the user's configuration File file = CorePlugin.getDefault().getStateLocation().append("log4j.properties").toFile(); //$NON-NLS-1$ if (file.exists()) preferences.load(new FileInputStream(file)); } catch (Exception e) { CorePlugin.logException(e); } // Configure log4j Properties properties = new Properties(); String[] names = preferences.preferenceNames(); for (int i = 0; i < names.length; i++) properties.put(names[i], preferences.getString(names[i])); PropertyConfigurator.configure(properties); } catch (Exception e) { BasicConfigurator.configure(); logException(e); } }
From source file:net.sourceforge.texlipse.editor.TexSourceViewerConfiguration.java
License:Open Source License
/** * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getReconciler(org.eclipse.jface.text.source.ISourceViewer) *//*w w w .j a va 2 s . c o m*/ @Override public IReconciler getReconciler(ISourceViewer sourceViewer) { if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED)) return null; if (!TexlipsePlugin.getDefault().getPreferenceStore() .getBoolean(TexlipseProperties.ECLIPSE_BUILDIN_SPELLCHECKER)) return null; //Set TeXlipse spelling Engine as default PreferenceStore store = new PreferenceStore(); store.setValue(SpellingService.PREFERENCE_SPELLING_ENGINE, "net.sourceforge.texlipse.LaTeXSpellEngine"); store.setValue(SpellingService.PREFERENCE_SPELLING_ENABLED, true); SpellingService spellingService = new SpellingService(store); if (spellingService.getActiveSpellingEngineDescriptor(store) == null) return null; IReconcilingStrategy strategy = new TeXSpellingReconcileStrategy(sourceViewer, spellingService); MonoReconciler reconciler = new MonoReconciler(strategy, true); reconciler.setDelay(500); reconciler.setProgressMonitor(new NullProgressMonitor()); return reconciler; }
From source file:org.apache.felix.sigil.eclipse.internal.model.repository.RepositoryConfiguration.java
License:Apache License
public IRepositoryModel newRepositoryElement(IRepositoryType type) { String id = UUID.randomUUID().toString(); PreferenceStore prefs = new PreferenceStore(); RepositoryModel element = new RepositoryModel(id, "", type, prefs); prefs.setFilename(makeFileName(element)); prefs.setValue("id", id); return element; }
From source file:org.apache.felix.sigil.eclipse.internal.model.repository.RepositoryConfiguration.java
License:Apache License
private static RepositoryModel loadRepository(String id, String key, RepositoryType type, IPreferenceStore prefs) {//from ww w . j a va 2s.c o m String name = type.isDynamic() ? prefs.getString(key + NAME) : type.getType(); PreferenceStore repPrefs = new PreferenceStore(); RepositoryModel element = new RepositoryModel(id, name, type, repPrefs); String loc = prefs.getString(key + LOC); if (loc == null || loc.trim().length() == 0) { loc = makeFileName(element); } repPrefs.setFilename(loc); if (new File(loc).exists()) { try { repPrefs.load(); } catch (IOException e) { SigilCore.error("Failed to load properties for repository " + key, e); } } repPrefs.setValue("id", id); return element; }
From source file:org.apache.felix.sigil.eclipse.internal.model.repository.RepositoryPreferences.java
License:Apache License
public PreferenceStore toPreferenceStore(final IRepositoryModel model) { PreferenceStore store = new PreferenceStore(); store.setFilename(makeFileName(model)); for (Map.Entry<Object, Object> e : model.getProperties().entrySet()) { store.setValue((String) e.getKey(), (String) e.getValue()); }/* w ww. ja va 2s .c o m*/ store.setValue("provider", model.getType().getProvider()); store.addPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { model.getProperties().setProperty(event.getProperty(), event.getNewValue().toString()); } }); return store; }
From source file:org.apache.opennlp.corpus_server.caseditor.DefaultCasDocumentProvider.java
License:Apache License
@Override public IPreferenceStore getSessionPreferenceStore(Object element) { // lookup one, and if it does not exist create a new one, and put it! IPreferenceStore store = sessionPreferenceStores.get(getTypeSystemId((CorpusServerCasEditorInput) element)); if (store == null) { store = new PreferenceStore(); sessionPreferenceStores.put(getTypeSystemId((CorpusServerCasEditorInput) element), store); }/*from ww w.j ava 2 s . c o m*/ return store; }
From source file:org.apache.opennlp.corpus_server.caseditor.DefaultCasDocumentProvider.java
License:Apache License
@Override public IPreferenceStore getTypeSystemPreferenceStore(Object element) { PreferenceStore tsStore = tsPreferenceStores.get(element); if (tsStore == null) { IPreferenceStore store = CorpusServerPlugin.getDefault().getPreferenceStore(); String tsStoreString = store.getString(getTypeSystemId((CorpusServerCasEditorInput) element)); tsStore = new PreferenceStore(); if (tsStoreString.length() != 0) { InputStream tsStoreIn = new ByteArrayInputStream(tsStoreString.getBytes(Charset.forName("UTF-8"))); try { tsStore.load(tsStoreIn); } catch (IOException e) { e.printStackTrace();/*from w ww. jav a 2 s . co m*/ } } tsPreferenceStores.put(element, tsStore); } return tsStore; }