1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-21 21:52:10 +02:00

codan - deprecating IProblemProfileChangeListener

deprecated IProblemProfileChangeListener in favor of eclipse preference
event listener mechanism

Change-Id: Ie89999f3baeed56a4c13f3ba70a92b59213ae43f
This commit is contained in:
Alena Laskavaia 2016-01-11 13:38:50 -05:00 committed by Gerrit Code Review @ Eclipse.org
parent d310621847
commit 082dae21c3
5 changed files with 38 additions and 21 deletions

View file

@ -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
*/

View file

@ -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
* <p>
* Clients may implement this interface.
* </p>
*
*
* @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 <code>null</code>.
*
*
* @param event the event details
* @see ProblemProfileChangeEvent
* @see IProblemProfile#addProfileChangeListener(IProblemProfileChangeListener)

View file

@ -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 <code>null</code>.
*
*
* @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 <code>null</code>.
*
*
* @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 <code>null</code>.
*
*
* @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
* <code>String</code>, or <code>null</code> if the
* preference was removed.
*
*
* @return the new value or <code>null</code>
*/
public Object getNewValue() {
@ -93,7 +97,7 @@ public final class ProblemProfileChangeEvent extends EventObject {
* Return the old value for the preference encoded as a
* <code>String</code>, or <code>null</code> if the
* preference was removed or if it cannot be determined.
*
*
* @return the old value or <code>null</code>
*/
public Object getOldValue() {

View file

@ -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);

View file

@ -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;