From 082dae21c3417362209c7f038a50cbae999649d0 Mon Sep 17 00:00:00 2001 From: Alena Laskavaia Date: Mon, 11 Jan 2016 13:38:50 -0500 Subject: codan - deprecating IProblemProfileChangeListener deprecated IProblemProfileChangeListener in favor of eclipse preference event listener mechanism Change-Id: Ie89999f3baeed56a4c13f3ba70a92b59213ae43f --- .../cdt/codan/core/model/IProblemProfile.java | 23 +++++++++++++--------- .../core/model/IProblemProfileChangeListener.java | 10 +++++++--- .../core/model/ProblemProfileChangeEvent.java | 18 ++++++++++------- .../internal/core/model/CodanProblemElement.java | 5 +++-- .../codan/internal/core/model/ProblemProfile.java | 3 +++ 5 files changed, 38 insertions(+), 21 deletions(-) (limited to 'codan') diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java index f719cec3c52..e530d834d90 100644 --- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java +++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 Alena Laskavaia + * Copyright (c) 2009, 2011 Alena Laskavaia * 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 @@ -11,6 +11,7 @@ package org.eclipse.cdt.codan.core.model; import org.eclipse.cdt.codan.internal.core.CheckersRegistry; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; /** * Problem Profile contains tree of categories and problems. For the user @@ -25,12 +26,12 @@ import org.eclipse.cdt.codan.internal.core.CheckersRegistry; * with the same id can exist in the same profile (i.e. two category can have * same problem listed in both, * but they both should point to the same problem instance). - * + * * To obtain read-only profile use method * {@link CheckersRegistry#getResourceProfile}, * {@link CheckersRegistry#getDefaultProfile()} or * {@link CheckersRegistry#getWorkspaceProfile()} - * + * * @noextend This interface is not intended to be extended by clients. * @noimplement This interface is not intended to be implemented by clients. */ @@ -42,7 +43,7 @@ public interface IProblemProfile extends IProblemElement { /** * Find and return problem by id if it contained in this profile - * + * * @param id * - problem id * @return problem instance @@ -51,7 +52,7 @@ public interface IProblemProfile extends IProblemElement { /** * Find and return category by id if it is contained in this profile - * + * * @param id * - category id * @return category instance @@ -61,30 +62,34 @@ public interface IProblemProfile extends IProblemElement { /** * Get all problems defined in this profile (if problem duplicated in a * category tree, it returns only one instance of each) - * + * * @return array of problems defined in profile */ IProblem[] getProblems(); /** * Add a listener for profile changes - * + * * @param listener * @since 2.0 + * @deprecated use {@link IEclipsePreferences} listener instead. */ + @Deprecated public void addProfileChangeListener(IProblemProfileChangeListener listener); /** * Remove a lister for profile changes - * + * * @param listener * @since 2.0 + * @deprecated use {@link IEclipsePreferences} listener instead. */ + @Deprecated public void removeProfileChangeListener(IProblemProfileChangeListener listener); /** * Get an object associated with profile, usually the resource - * + * * @return resource of another object associated with this profile * @since 2.0 */ diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfileChangeListener.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfileChangeListener.java index fc9d8de34b0..2be6ba1521c 100644 --- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfileChangeListener.java +++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfileChangeListener.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 Alena Laskavaia + * Copyright (c) 2009, 2011 Alena Laskavaia * 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 @@ -10,20 +10,24 @@ *******************************************************************************/ package org.eclipse.cdt.codan.core.model; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; + /** * A listener used to receive changes to problem profile *

* Clients may implement this interface. *

- * + * * @since 2.0 + * @deprecated This interface is deprecated, use {@link IEclipsePreferences} listener instead. */ +@Deprecated public interface IProblemProfileChangeListener { /** * Notification that a profile value has changed. * The given event object describes the change details and must not * be null. - * + * * @param event the event details * @see ProblemProfileChangeEvent * @see IProblemProfile#addProfileChangeListener(IProblemProfileChangeListener) diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemProfileChangeEvent.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemProfileChangeEvent.java index 02b0af7f575..982b00a26f1 100644 --- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemProfileChangeEvent.java +++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/ProblemProfileChangeEvent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2011 Alena Laskavaia + * Copyright (c) 2009, 2011 Alena Laskavaia * 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 @@ -12,13 +12,17 @@ package org.eclipse.cdt.codan.core.model; import java.util.EventObject; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; + /** * An event object describing the details of a change to a preference * in the preference store. - * + * * @noextend This class is not intended to be extended by clients. * @since 2.0 + * @deprecated use {@link IEclipsePreferences} change listener event instead. */ +@Deprecated public final class ProblemProfileChangeEvent extends EventObject { /** * All serializable objects should have a stable serialVersionUID @@ -35,7 +39,7 @@ public final class ProblemProfileChangeEvent extends EventObject { /** * Constructor for a new profile change event. The node and the * key must not be null. - * + * * @param profile the profile on which the change occurred * @param resource the resource for which profile changes occurred * @param key the preference key @@ -54,7 +58,7 @@ public final class ProblemProfileChangeEvent extends EventObject { /** * Return the resource on which the change occurred. * Must not be null. - * + * * @return the node */ public Object getResource() { @@ -71,7 +75,7 @@ public final class ProblemProfileChangeEvent extends EventObject { /** * Return the key of the preference which was changed. * Must not be null. - * + * * @return the preference key */ public String getKey() { @@ -82,7 +86,7 @@ public final class ProblemProfileChangeEvent extends EventObject { * Return the new value for the preference encoded as a * String, or null if the * preference was removed. - * + * * @return the new value or null */ public Object getNewValue() { @@ -93,7 +97,7 @@ public final class ProblemProfileChangeEvent extends EventObject { * Return the old value for the preference encoded as a * String, or null if the * preference was removed or if it cannot be determined. - * + * * @return the old value or null */ public Object getOldValue() { diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemElement.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemElement.java index 749e3f35130..6e7121c9f04 100644 --- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemElement.java +++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemElement.java @@ -24,7 +24,7 @@ public class CodanProblemElement implements IProblemElement { /* * (non-Javadoc) - * + * * @see org.eclipse.cdt.codan.core.model.IProblemElement#getProfile() */ @Override @@ -34,7 +34,7 @@ public class CodanProblemElement implements IProblemElement { /* * (non-Javadoc) - * + * * @see org.eclipse.cdt.codan.core.model.IProblemElement#getCategory() */ @Override @@ -90,6 +90,7 @@ public class CodanProblemElement implements IProblemElement { /** * @param problemKey */ + @Deprecated protected void notifyChanged(String key) { if (getProfile() instanceof ProblemProfile) { ((ProblemProfile) getProfile()).fireProfileChangeEvent(key, null, this); diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/ProblemProfile.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/ProblemProfile.java index 3952b465905..dd8abf70a2c 100644 --- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/ProblemProfile.java +++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/ProblemProfile.java @@ -109,6 +109,7 @@ public class ProblemProfile implements IProblemProfile, Cloneable { } @Override + @Deprecated public void addProfileChangeListener(IProblemProfileChangeListener listener) { if (preferenceChangeListeners == null) preferenceChangeListeners = new ListenerList(); @@ -116,6 +117,7 @@ public class ProblemProfile implements IProblemProfile, Cloneable { } @Override + @Deprecated public void removeProfileChangeListener(IProblemProfileChangeListener listener) { if (preferenceChangeListeners == null) return; @@ -127,6 +129,7 @@ public class ProblemProfile implements IProblemProfile, Cloneable { /** * Convenience method for notifying preference change listeners. */ + @Deprecated protected void fireProfileChangeEvent(String key, Object oldValue, Object newValue) { if (preferenceChangeListeners == null) return; -- cgit v1.2.3