Java Code Examples for org.eclipse.jface.preference.IPreferenceStore#addPropertyChangeListener()
The following examples show how to use
org.eclipse.jface.preference.IPreferenceStore#addPropertyChangeListener() .
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: PydevPlugin.java From Pydev with Eclipse Public License 1.0 | 6 votes |
/** * @return */ public static ColorCache getColorCache() { PydevPlugin plugin = getDefault(); if (plugin.colorCache == null) { final IPreferenceStore chainedPrefStore = PyDevUiPrefs.getChainedPrefStore(); plugin.colorCache = new ColorCache(chainedPrefStore) { { chainedPrefStore.addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (fNamedColorTable.containsKey(event.getProperty())) { reloadProperty(event.getProperty()); } } }); } }; } return plugin.colorCache; }
Example 2
Source File: FindBarOption.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public FindBarOption(String fieldName, String image, String imageDisabled, String initialText, FindBarDecorator findBarDecorator, boolean initiallyEnabled, String preferencesKey) { this.fieldName = fieldName; this.image = image; this.imageDisabled = imageDisabled; this.initialText = initialText; this.findBarDecorator = new WeakReference<FindBarDecorator>(findBarDecorator); this.initiallyEnabled = initiallyEnabled; this.preferencesKey = preferencesKey; if (preferencesKey != null) { IPreferenceStore preferenceStore = FindBarPlugin.getDefault().getPreferenceStore(); preferenceStore.addPropertyChangeListener(getPropertyChangeListener()); } }
Example 3
Source File: HybridUI.java From thym with Eclipse Public License 1.0 | 6 votes |
public void start(BundleContext context) throws Exception { super.start(context); plugin = this; logger = Platform.getLog(this.getBundle()); IPreferenceStore store = getPreferenceStore(); HybridToolsPreferences.init(store); store.addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { HybridToolsPreferences.getPrefs().loadValues(event); } }); HybridToolsPreferences.getPrefs().loadValues(); ResourcesPlugin.getWorkspace().addResourceChangeListener(projectRestoreListener, IResourceChangeEvent.POST_CHANGE); }
Example 4
Source File: LogDocument.java From LogViewer with Eclipse Public License 2.0 | 6 votes |
public LogDocument(LogFile file, String encoding) throws SecurityException, IllegalArgumentException, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException, PartInitException { super(); if (file.getEncoding() == null) { file.setEncoding(encoding); } this.file = file; this.encoding = file.getEncoding(); this.charset = Charset.forName(file.getEncoding()); IPreferenceStore store = LogViewerPlugin.getDefault().getPreferenceStore(); store.addPropertyChangeListener(new PropertyChangeListener()); backlogLines = store.getInt(ILogViewerConstants.PREF_BACKLOG); setTextStore(new GapTextStore(50, 300, 1f)); setLineTracker(new DefaultLineTracker()); completeInitialization(); reader = new BackgroundReader(file.getType(), file.getPath(), file.getNamePattern(), charset,this); }
Example 5
Source File: AndroidUI.java From thym with Eclipse Public License 1.0 | 6 votes |
public void start(BundleContext context) throws Exception { super.start(context); plugin = this; //We use the HybridUIs pref store as we do not have many preferences. IPreferenceStore store = HybridUI.getDefault().getPreferenceStore(); AndroidPreferences.init(store); store.addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { AndroidPreferences.getPrefs().loadValues(event); } }); AndroidPreferences.getPrefs().loadValues(); }
Example 6
Source File: SyntaxColorerPreviewer.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
public SyntaxColorerPreviewer(Composite parent, final IPreferenceStore preferenceStore) { super(parent, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY); this.preferenceStore = preferenceStore; this.setLayoutData(new GridData(GridData.FILL_BOTH)); Font font= JFaceResources.getTextFont(); this.setFont(font); defBackgroundColor = getEditorBackgroundColor(preferenceStore); this.setBackground(defBackgroundColor); prefListener = new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { try { // Widget may be disposed here defBackgroundColor = getEditorBackgroundColor(preferenceStore); setBackground(defBackgroundColor); updateColors(); } catch (Exception e) {} } }; preferenceStore.addPropertyChangeListener(prefListener); tokenManager = new TokenManager(); }
Example 7
Source File: PairedBracketsPainter.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
public PainterOnOffManager( ISourceViewer isv , PairedBracketsMatcher matcher , IPreferenceStore store , String keyHighlightMatch , String keyColor, String keyColorNoMatch ) { this.isv = isv; this.store = store; this.keyHighlightMatch = keyHighlightMatch; this.keyColor = keyColor; this.keyColorNoMatch = keyColorNoMatch; this.matcher = matcher; store.addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { reReadStore(event); } }); reReadStore(null); }
Example 8
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 9
Source File: XtendPreferenceStoreInitializer.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override public void initialize(IPreferenceStoreAccess preferenceStoreAccess) { this.preferenceStoreAccess = preferenceStoreAccess; IPreferenceStore preferenceStore = org.eclipse.jdt.ui.PreferenceConstants.getPreferenceStore(); preferenceStore.addPropertyChangeListener(this); preferenceStoreAccess.getWritablePreferenceStore().setDefault(PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION, preferenceStore.getBoolean(org.eclipse.jdt.ui.PreferenceConstants.EDITOR_SUB_WORD_NAVIGATION)); }
Example 10
Source File: TLAReconcilingStrategy.java From tlaplus with MIT License | 5 votes |
public TLAReconcilingStrategy() { final IPreferenceStore store = PreferenceStoreHelper.getInstancePreferenceStore(); store.addPropertyChangeListener(this); currentAnnotations = new ArrayList<>(); foldBlockComments = new AtomicBoolean(store.getBoolean(IPreferenceConstants.I_FOLDING_BLOCK_COMMENTS)); foldPlusCalAlgorithm = new AtomicBoolean(store.getBoolean(IPreferenceConstants.I_FOLDING_PCAL_ALGORITHM)); foldTranslatedPlusCalBlock = new AtomicBoolean(store.getBoolean(IPreferenceConstants.I_FOLDING_PCAL_TRANSLATED)); }
Example 11
Source File: TLA2TeXActivator.java From tlaplus with MIT License | 5 votes |
public void start(BundleContext context) throws Exception { super.start(context); plugin = this; final IPreferenceStore preferenceStore = getPreferenceStore(); preferenceStore.addPropertyChangeListener(listener); configureGraphViz(preferenceStore.getString(ITLA2TeXPreferenceConstants.DOT_COMMAND)); }
Example 12
Source File: SpellChecker.java From texlipse with Eclipse Public License 1.0 | 5 votes |
/** * Initialize the spell checker. This method must be called only once. * Preferably from PreferenceInitializer. * * @param prefs the plugin preferences */ public static void initializeDefaults(IPreferenceStore prefs) { String aspell = PathUtils.findEnvFile("aspell", "/usr/bin", "aspell.exe", "C:\\gnu\\aspell"); prefs.setDefault(SPELL_CHECKER_COMMAND, aspell); // -a == ispell compatibility mode, -t == tex mode prefs.setDefault(SPELL_CHECKER_ENV, ""); prefs.setDefault(SPELL_CHECKER_ARGUMENTS, "-a -t --lang=%language --encoding=%encoding"); prefs.addPropertyChangeListener(instance); instance.readSettings(); }
Example 13
Source File: MenuDataStore.java From EasyShell with Eclipse Public License 2.0 | 5 votes |
public MenuDataStore(IPreferenceStore store) { super(store); store.addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(Constants.PREF_MENU)) { loadInternal((String)event.getNewValue()); } } }); load(); }
Example 14
Source File: PythonCompletionProcessor.java From Pydev with Eclipse Public License 1.0 | 5 votes |
/** * @return the auto-activation chars that should be used. */ public static char[] getStaticCompletionProposalAutoActivationCharacters() { if (!listenerToClearAutoActivationAlreadySetup) { //clears the cache when the preferences are changed. IPreferenceStore preferenceStore = PyDevUiPrefs.getPreferenceStore(); preferenceStore.addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { activationChars = null; //clear the cache when it changes } }); listenerToClearAutoActivationAlreadySetup = true; } if (activationChars == null) { //let's cache this if (!PyCodeCompletionPreferences.useAutocomplete()) { activationChars = new char[0]; } else { char[] c = new char[0]; if (PyCodeCompletionPreferences.isToAutocompleteOnDot()) { c = StringUtils.addChar(c, '.'); } if (PyCodeCompletionPreferences.isToAutocompleteOnPar()) { c = StringUtils.addChar(c, '('); } activationChars = c; } } return activationChars; }
Example 15
Source File: SourceView.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override protected void internalCreatePartControl(Composite parent) { IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore(); fViewer= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL, store); fViewerConfiguration= new SimpleJavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING, false); fViewer.configure(fViewerConfiguration); fViewer.setEditable(false); setViewerFont(); JFaceResources.getFontRegistry().addListener(fFontPropertyChangeListener); store.addPropertyChangeListener(fPropertyChangeListener); getViewSite().setSelectionProvider(fViewer); }
Example 16
Source File: FindBarDecorator.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Updates the find bar given the preferences (and registers a listener to update it whenever needed). */ public void installActions() { IPreferenceStore preferenceStore = FindBarPlugin.getDefault().getPreferenceStore(); preferenceStore.addPropertyChangeListener(fFindBarActionOnPropertyChange); fOriginalFindBarAction = textEditor.getAction(ITextEditorActionConstants.FIND); updateFindBarAction(); }
Example 17
Source File: CommonContentAssistProcessor.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * IndexContentAssistProcessor * * @param editor */ public CommonContentAssistProcessor(AbstractThemeableEditor editor) { this.editor = editor; _completionProposalChars = retrieveCAPreference(IPreferenceConstants.COMPLETION_PROPOSAL_ACTIVATION_CHARACTERS); _contextInformationChars = retrieveCAPreference(IPreferenceConstants.CONTEXT_INFORMATION_ACTIVATION_CHARACTERS); _proposalTriggerChars = retrieveCAPreference(IPreferenceConstants.PROPOSAL_TRIGGER_CHARACTERS); IPreferenceStore commonPreferences = CommonEditorPlugin.getDefault().getPreferenceStore(); String filterTypeString = commonPreferences .getString(IPreferenceConstants.CONTENT_ASSIST_USER_AGENT_FILTER_TYPE); _filterType = UserAgentFilterType.get(filterTypeString); commonPreferences.addPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (IPreferenceConstants.CONTENT_ASSIST_USER_AGENT_FILTER_TYPE.equals(event.getProperty())) { _filterType = UserAgentFilterType.get(event.getNewValue().toString()); } } }); if (getPreferenceNodeQualifier() != null) { EclipseUtil.instanceScope().getNode(getPreferenceNodeQualifier()).addPreferenceChangeListener(this); } }
Example 18
Source File: XFindPanel.java From xds-ide with Eclipse Public License 1.0 | 4 votes |
public XFindPanel(final Composite parent, IEditorPart editorPart) { super(parent, SWT.NONE); statusLine = new StatusLine(editorPart.getEditorSite()); setVisible(false); if (editorPart != null) { target = (IFindReplaceTarget) editorPart.getAdapter(IFindReplaceTarget.class); isRegExSupported = (target instanceof IFindReplaceTargetExtension3); } final IPreferenceStore store = XFindPlugin.getDefault().getPreferenceStore(); if (!store.contains(XFIND_PANEL_PLACEMENT)) { store.setDefault(XFIND_PANEL_PLACEMENT, XFIND_PANEL_PLACEMENT_TOP); } if (store.getInt(XFIND_PANEL_PLACEMENT) == XFIND_PANEL_PLACEMENT_BOTTOM) { moveBelow(null); } else { moveAbove(null); } createContents(); loadHistory(store); store.addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent event) { Display.getDefault().syncExec(new Runnable() { @Override public void run() { if (XFIND_PANEL_PLACEMENT.equals(event.getProperty())) { if (store.getInt(XFIND_PANEL_PLACEMENT) == XFIND_PANEL_PLACEMENT_BOTTOM) { moveBelow(null); } else { moveAbove(null); } parent.layout(); } } }); } }); parent.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { saveHistory(store); } }); }
Example 19
Source File: CustomFilters.java From Pydev with Eclipse Public License 1.0 | 4 votes |
public PropertyListener(CustomFilters customFilter) { weakCustomFilter = new WeakReference<CustomFilters>(customFilter); IPreferenceStore prefs = PydevPlugin.getDefault().getPreferenceStore(); prefs.addPropertyChangeListener(this); }
Example 20
Source File: ModelEditor.java From tlaplus with MIT License | 4 votes |
/** * Initialize the editor */ @Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { // TLCUIActivator.getDefault().logDebug("entering ModelEditor#init(IEditorSite site, IEditorInput input)"); super.init(site, input); // grab the input final FileEditorInput finput = getFileEditorInput(); // the file might not exist anymore (e.g. manually removed by the user) if ((finput == null) || !finput.exists()) { throw new PartInitException("Editor input does not exist: " + finput.getName()); } model = TLCModelFactory.getBy(finput.getFile()); int openTabsValue = 0; try { openTabsValue = model.getLaunchConfiguration().getAttribute(IModelConfigurationConstants.EDITOR_OPEN_TABS, 0); } catch (CoreException e) { } final boolean mustShowResultsPage = model.isSnapshot() || parsePotentialAssociatedTLCRunToDetermineWhetherResultsPageMustBeShown(); final IPreferenceStore ips = TLCUIActivator.getDefault().getPreferenceStore(); if (openTabsValue == IModelConfigurationConstants.EDITOR_OPEN_TAB_NONE) { pagesToAdd = mustShowResultsPage ? new BasicFormPage[] { new MainModelPage(this), new ResultPage(this) } : new BasicFormPage[] { new MainModelPage(this) }; } else { final ArrayList<BasicFormPage> editorPages = new ArrayList<>(); editorPages.add(new MainModelPage(this)); if ((openTabsValue & IModelConfigurationConstants.EDITOR_OPEN_TAB_ADVANCED_MODEL) != 0) { editorPages.add(new AdvancedModelPage(this)); } if ((openTabsValue & IModelConfigurationConstants.EDITOR_OPEN_TAB_ADVANCED_TLC) != 0) { editorPages.add(new AdvancedTLCOptionsPage(this)); } if (mustShowResultsPage || ((openTabsValue & IModelConfigurationConstants.EDITOR_OPEN_TAB_RESULTS) != 0)) { editorPages.add(new ResultPage(this)); if (ips.getBoolean(IModelEditorPreferenceConstants.I_MODEL_EDITOR_SHOW_ECE_AS_TAB)) { editorPages.add(new EvaluateConstantExpressionPage(this)); } if (mustShowResultsPage) { final int openTabState = getModel().getOpenTabsValue(); updateOpenTabsState(openTabState | IModelConfigurationConstants.EDITOR_OPEN_TAB_RESULTS); } } pagesToAdd = editorPages.toArray(new BasicFormPage[editorPages.size()]); } ips.addPropertyChangeListener(preferenceChangeListener); // setContentDescription(path.toString()); if (model.isSnapshot()) { final String date = SIMPLE_DATE_FORMAT.format(model.getSnapshotTimeStamp()); this.setPartName(model.getSnapshotFor().getName() + " (" + date + ")"); } else { this.setPartName(model.getName()); } this.setTitleToolTip(model.getFile().getLocation().toOSString()); // add a listener that will update the tlc error view when a model editor // is made visible IPartService service = (IPartService) getSite().getService(IPartService.class); service.addPartListener(ModelEditorPartListener.getDefault()); /* * Install resource change listener on the workspace root to react on any changes in th current spec */ ResourcesPlugin.getWorkspace().addResourceChangeListener(workspaceResourceChangeListener, IResourceChangeEvent.POST_BUILD); // update the spec object of the helper helper.resetSpecNames(); // initial re-validate the pages, which are already loaded UIHelper.runUIAsync(validateRunable); // TLCUIActivator.getDefault().logDebug("leaving ModelEditor#init(IEditorSite site, IEditorInput input)"); // Asynchronously register a PageChangedListener to now cause cyclic part init warnings UIHelper.runUIAsync(new Runnable() { public void run() { addPageChangedListener(pageChangedListener); } }); model.add(modelStateListener); }