1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

Bug 333494 - Codan sometimes stops working after upgrade.

This commit is contained in:
Sergey Prigogin 2011-05-27 03:33:00 +00:00
parent f05366610d
commit 2641a77126
2 changed files with 12 additions and 35 deletions

View file

@ -31,7 +31,7 @@ public class CodanUIActivator extends AbstractUIPlugin {
public static final String PLUGIN_ID = "org.eclipse.cdt.codan.ui"; //$NON-NLS-1$
// The shared instance
private static CodanUIActivator plugin;
private IPreferenceStore preferenceCoreStore;
private IPreferenceStore corePreferenceStore;
/**
* The constructor
@ -39,25 +39,13 @@ public class CodanUIActivator extends AbstractUIPlugin {
public CodanUIActivator() {
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
* )
*/
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
* )
*/
@Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
@ -118,16 +106,16 @@ public class CodanUIActivator extends AbstractUIPlugin {
* @return
*/
public IPreferenceStore getCorePreferenceStore() {
if (preferenceCoreStore == null) {
preferenceCoreStore = new ScopedPreferenceStore(new InstanceScope(), CodanCorePlugin.PLUGIN_ID);
if (corePreferenceStore == null) {
corePreferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, CodanCorePlugin.PLUGIN_ID);
}
return preferenceCoreStore;
return corePreferenceStore;
}
public IPreferenceStore getPreferenceStore(IProject project) {
ProjectScope ps = new ProjectScope(project);
ScopedPreferenceStore scoped = new ScopedPreferenceStore(ps, PLUGIN_ID);
scoped.setSearchContexts(new IScopeContext[] { ps, new InstanceScope() });
ScopedPreferenceStore scoped = new ScopedPreferenceStore(ps, CodanCorePlugin.PLUGIN_ID);
scoped.setSearchContexts(new IScopeContext[] { ps, InstanceScope.INSTANCE });
return scoped;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010 Alena Laskavaia and others.
* Copyright (c) 2011 Alena Laskavaia and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
*
* Contributors:
* Alena Laskavaia - initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.codan.internal.ui.preferences;
@ -25,20 +26,10 @@ import org.eclipse.ui.IWorkbenchPropertyPage;
public class BuildPropertyPage extends FieldEditorPreferencePage implements IWorkbenchPropertyPage {
private IAdaptable element;
/**
*
*/
public BuildPropertyPage() {
setPreferenceStore(CodanUIActivator.getDefault().getPreferenceStore());
setPreferenceStore(CodanUIActivator.getDefault().getCorePreferenceStore());
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
* ()
*/
@Override
protected void createFieldEditors() {
addField(new LabelFieldEditor("Set launch method for checkers, you can override this by editing individual problem settings",
@ -87,9 +78,7 @@ public class BuildPropertyPage extends FieldEditorPreferencePage implements IWor
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime
* .IAdaptable)
* @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
*/
public void setElement(IAdaptable element) {
this.element = element;