1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 17:55:39 +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$ public static final String PLUGIN_ID = "org.eclipse.cdt.codan.ui"; //$NON-NLS-1$
// The shared instance // The shared instance
private static CodanUIActivator plugin; private static CodanUIActivator plugin;
private IPreferenceStore preferenceCoreStore; private IPreferenceStore corePreferenceStore;
/** /**
* The constructor * The constructor
@ -39,25 +39,13 @@ public class CodanUIActivator extends AbstractUIPlugin {
public CodanUIActivator() { public CodanUIActivator() {
} }
/* @Override
* (non-Javadoc)
*
* @see
* org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
* )
*/
public void start(BundleContext context) throws Exception { public void start(BundleContext context) throws Exception {
super.start(context); super.start(context);
plugin = this; plugin = this;
} }
/* @Override
* (non-Javadoc)
*
* @see
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
* )
*/
public void stop(BundleContext context) throws Exception { public void stop(BundleContext context) throws Exception {
plugin = null; plugin = null;
super.stop(context); super.stop(context);
@ -118,16 +106,16 @@ public class CodanUIActivator extends AbstractUIPlugin {
* @return * @return
*/ */
public IPreferenceStore getCorePreferenceStore() { public IPreferenceStore getCorePreferenceStore() {
if (preferenceCoreStore == null) { if (corePreferenceStore == null) {
preferenceCoreStore = new ScopedPreferenceStore(new InstanceScope(), CodanCorePlugin.PLUGIN_ID); corePreferenceStore = new ScopedPreferenceStore(InstanceScope.INSTANCE, CodanCorePlugin.PLUGIN_ID);
} }
return preferenceCoreStore; return corePreferenceStore;
} }
public IPreferenceStore getPreferenceStore(IProject project) { public IPreferenceStore getPreferenceStore(IProject project) {
ProjectScope ps = new ProjectScope(project); ProjectScope ps = new ProjectScope(project);
ScopedPreferenceStore scoped = new ScopedPreferenceStore(ps, PLUGIN_ID); ScopedPreferenceStore scoped = new ScopedPreferenceStore(ps, CodanCorePlugin.PLUGIN_ID);
scoped.setSearchContexts(new IScopeContext[] { ps, new InstanceScope() }); scoped.setSearchContexts(new IScopeContext[] { ps, InstanceScope.INSTANCE });
return scoped; 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 * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* Alena Laskavaia - initial API and implementation * Alena Laskavaia - initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.codan.internal.ui.preferences; package org.eclipse.cdt.codan.internal.ui.preferences;
@ -25,20 +26,10 @@ import org.eclipse.ui.IWorkbenchPropertyPage;
public class BuildPropertyPage extends FieldEditorPreferencePage implements IWorkbenchPropertyPage { public class BuildPropertyPage extends FieldEditorPreferencePage implements IWorkbenchPropertyPage {
private IAdaptable element; private IAdaptable element;
/**
*
*/
public BuildPropertyPage() { public BuildPropertyPage() {
setPreferenceStore(CodanUIActivator.getDefault().getPreferenceStore()); setPreferenceStore(CodanUIActivator.getDefault().getCorePreferenceStore());
} }
/*
* (non-Javadoc)
*
* @see
* org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors
* ()
*/
@Override @Override
protected void createFieldEditors() { protected void createFieldEditors() {
addField(new LabelFieldEditor("Set launch method for checkers, you can override this by editing individual problem settings", 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) * (non-Javadoc)
* *
* @see * @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
* org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime
* .IAdaptable)
*/ */
public void setElement(IAdaptable element) { public void setElement(IAdaptable element) {
this.element = element; this.element = element;