| 1 | /******************************************************************************* | 
| 2 |  * Copyright (c) 2007, 2008 IBM Corporation and others. | 
| 3 |  * All rights reserved. This program and the accompanying materials | 
| 4 |  * are made available under the terms of the Eclipse Public License v1.0 | 
| 5 |  * which accompanies this distribution, and is available at | 
| 6 |  * http://www.eclipse.org/legal/epl-v10.html | 
| 7 |  * | 
| 8 |  * Contributors: | 
| 9 |  *     IBM Corporation - initial API and implementation | 
| 10 |  *******************************************************************************/ | 
| 11 | package org.eclipse.pde.api.tools.internal; | 
| 12 |   | 
| 13 | import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; | 
| 14 | import org.eclipse.core.runtime.preferences.DefaultScope; | 
| 15 | import org.eclipse.core.runtime.preferences.IEclipsePreferences; | 
| 16 | import org.eclipse.pde.api.tools.internal.provisional.ApiPlugin; | 
| 17 | import org.eclipse.pde.api.tools.internal.provisional.problems.IApiProblemTypes; | 
| 18 |   | 
| 19 | /** | 
| 20 |  * Initializes all of the core preferences for the {@link ApiPlugin} | 
| 21 |  *  | 
| 22 |  * @since 1.0.0 | 
| 23 |  */ | 
| 24 | public class ApiPluginPreferenceInitializer extends AbstractPreferenceInitializer { | 
| 25 |         /** | 
| 26 |          * Constructor | 
| 27 |          */ | 
| 28 |         public ApiPluginPreferenceInitializer() { | 
| 29 |         } | 
| 30 |   | 
| 31 |         public void initializeDefaultPreferences() { | 
| 32 |                 IEclipsePreferences node = new DefaultScope().getNode(ApiPlugin.PLUGIN_ID); | 
| 33 |                 if(node == null) { | 
| 34 |                         return; | 
| 35 |                 } | 
| 36 |                  | 
| 37 |                 // usage | 
| 38 |                 node.put(IApiProblemTypes.ILLEGAL_EXTEND, ApiPlugin.VALUE_WARNING); | 
| 39 |                 node.put(IApiProblemTypes.ILLEGAL_IMPLEMENT, ApiPlugin.VALUE_WARNING); | 
| 40 |                 node.put(IApiProblemTypes.ILLEGAL_INSTANTIATE, ApiPlugin.VALUE_WARNING); | 
| 41 |                 node.put(IApiProblemTypes.ILLEGAL_REFERENCE, ApiPlugin.VALUE_WARNING); | 
| 42 |                 node.put(IApiProblemTypes.ILLEGAL_OVERRIDE, ApiPlugin.VALUE_WARNING); | 
| 43 |                 node.put(IApiProblemTypes.LEAK_EXTEND, ApiPlugin.VALUE_WARNING); | 
| 44 |                 node.put(IApiProblemTypes.LEAK_FIELD_DECL, ApiPlugin.VALUE_WARNING); | 
| 45 |                 node.put(IApiProblemTypes.LEAK_IMPLEMENT, ApiPlugin.VALUE_WARNING); | 
| 46 |                 node.put(IApiProblemTypes.LEAK_METHOD_PARAM, ApiPlugin.VALUE_WARNING); | 
| 47 |                 node.put(IApiProblemTypes.LEAK_METHOD_RETURN_TYPE, ApiPlugin.VALUE_WARNING); | 
| 48 |                 node.put(IApiProblemTypes.INVALID_JAVADOC_TAG, ApiPlugin.VALUE_IGNORE); | 
| 49 |                 node.put(IApiProblemTypes.INVALID_REFERENCE_IN_SYSTEM_LIBRARIES, ApiPlugin.VALUE_IGNORE); | 
| 50 |                 node.put(IApiProblemTypes.UNUSED_PROBLEM_FILTERS, ApiPlugin.VALUE_WARNING); | 
| 51 |                  | 
| 52 |                 // compatibilities | 
| 53 |                 for (int i = 0, max = ApiPlugin.AllCompatibilityKeys.length; i < max; i++) { | 
| 54 |                         node.put(ApiPlugin.AllCompatibilityKeys[i], ApiPlugin.VALUE_ERROR); | 
| 55 |                 } | 
| 56 |                 node.put(IApiProblemTypes.REPORT_API_BREAKAGE_WHEN_MAJOR_VERSION_INCREMENTED, ApiPlugin.VALUE_DISABLED); | 
| 57 |   | 
| 58 |                 // version management | 
| 59 |                 node.put(IApiProblemTypes.MISSING_SINCE_TAG, ApiPlugin.VALUE_ERROR); | 
| 60 |                 node.put(IApiProblemTypes.MALFORMED_SINCE_TAG, ApiPlugin.VALUE_ERROR); | 
| 61 |                 node.put(IApiProblemTypes.INVALID_SINCE_TAG_VERSION, ApiPlugin.VALUE_ERROR); | 
| 62 |                 node.put(IApiProblemTypes.INCOMPATIBLE_API_COMPONENT_VERSION, ApiPlugin.VALUE_ERROR); | 
| 63 |                 node.put(IApiProblemTypes.INCOMPATIBLE_API_COMPONENT_VERSION_INCLUDE_INCLUDE_MINOR_WITHOUT_API_CHANGE, ApiPlugin.VALUE_DISABLED); | 
| 64 |                 node.put(IApiProblemTypes.INCOMPATIBLE_API_COMPONENT_VERSION_INCLUDE_INCLUDE_MAJOR_WITHOUT_BREAKING_CHANGE, ApiPlugin.VALUE_DISABLED); | 
| 65 |                  | 
| 66 |                 node.put(IApiProblemTypes.MISSING_DEFAULT_API_BASELINE, ApiPlugin.VALUE_WARNING); | 
| 67 |   | 
| 68 |                 // api component resolution | 
| 69 |                 node.put(IApiProblemTypes.REPORT_RESOLUTION_ERRORS_API_COMPONENT, ApiPlugin.VALUE_WARNING); | 
| 70 |         } | 
| 71 |   | 
| 72 | } |