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:
parent
d310621847
commit
082dae21c3
5 changed files with 38 additions and 21 deletions
|
@ -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
|
* 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
|
||||||
|
@ -11,6 +11,7 @@
|
||||||
package org.eclipse.cdt.codan.core.model;
|
package org.eclipse.cdt.codan.core.model;
|
||||||
|
|
||||||
import org.eclipse.cdt.codan.internal.core.CheckersRegistry;
|
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
|
* 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
|
* with the same id can exist in the same profile (i.e. two category can have
|
||||||
* same problem listed in both,
|
* same problem listed in both,
|
||||||
* but they both should point to the same problem instance).
|
* but they both should point to the same problem instance).
|
||||||
*
|
*
|
||||||
* To obtain read-only profile use method
|
* To obtain read-only profile use method
|
||||||
* {@link CheckersRegistry#getResourceProfile},
|
* {@link CheckersRegistry#getResourceProfile},
|
||||||
* {@link CheckersRegistry#getDefaultProfile()} or
|
* {@link CheckersRegistry#getDefaultProfile()} or
|
||||||
* {@link CheckersRegistry#getWorkspaceProfile()}
|
* {@link CheckersRegistry#getWorkspaceProfile()}
|
||||||
*
|
*
|
||||||
* @noextend This interface is not intended to be extended by clients.
|
* @noextend This interface is not intended to be extended by clients.
|
||||||
* @noimplement This interface is not intended to be implemented 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
|
* Find and return problem by id if it contained in this profile
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* - problem id
|
* - problem id
|
||||||
* @return problem instance
|
* @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
|
* Find and return category by id if it is contained in this profile
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* - category id
|
* - category id
|
||||||
* @return category instance
|
* @return category instance
|
||||||
|
@ -61,30 +62,34 @@ public interface IProblemProfile extends IProblemElement {
|
||||||
/**
|
/**
|
||||||
* Get all problems defined in this profile (if problem duplicated in a
|
* Get all problems defined in this profile (if problem duplicated in a
|
||||||
* category tree, it returns only one instance of each)
|
* category tree, it returns only one instance of each)
|
||||||
*
|
*
|
||||||
* @return array of problems defined in profile
|
* @return array of problems defined in profile
|
||||||
*/
|
*/
|
||||||
IProblem[] getProblems();
|
IProblem[] getProblems();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a listener for profile changes
|
* Add a listener for profile changes
|
||||||
*
|
*
|
||||||
* @param listener
|
* @param listener
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
|
* @deprecated use {@link IEclipsePreferences} listener instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void addProfileChangeListener(IProblemProfileChangeListener listener);
|
public void addProfileChangeListener(IProblemProfileChangeListener listener);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a lister for profile changes
|
* Remove a lister for profile changes
|
||||||
*
|
*
|
||||||
* @param listener
|
* @param listener
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
|
* @deprecated use {@link IEclipsePreferences} listener instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void removeProfileChangeListener(IProblemProfileChangeListener listener);
|
public void removeProfileChangeListener(IProblemProfileChangeListener listener);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an object associated with profile, usually the resource
|
* Get an object associated with profile, usually the resource
|
||||||
*
|
*
|
||||||
* @return resource of another object associated with this profile
|
* @return resource of another object associated with this profile
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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
|
* 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
|
||||||
|
@ -10,20 +10,24 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.codan.core.model;
|
package org.eclipse.cdt.codan.core.model;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A listener used to receive changes to problem profile
|
* A listener used to receive changes to problem profile
|
||||||
* <p>
|
* <p>
|
||||||
* Clients may implement this interface.
|
* Clients may implement this interface.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
|
* @deprecated This interface is deprecated, use {@link IEclipsePreferences} listener instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface IProblemProfileChangeListener {
|
public interface IProblemProfileChangeListener {
|
||||||
/**
|
/**
|
||||||
* Notification that a profile value has changed.
|
* Notification that a profile value has changed.
|
||||||
* The given event object describes the change details and must not
|
* The given event object describes the change details and must not
|
||||||
* be <code>null</code>.
|
* be <code>null</code>.
|
||||||
*
|
*
|
||||||
* @param event the event details
|
* @param event the event details
|
||||||
* @see ProblemProfileChangeEvent
|
* @see ProblemProfileChangeEvent
|
||||||
* @see IProblemProfile#addProfileChangeListener(IProblemProfileChangeListener)
|
* @see IProblemProfile#addProfileChangeListener(IProblemProfileChangeListener)
|
||||||
|
|
|
@ -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
|
* 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
|
||||||
|
@ -12,13 +12,17 @@ package org.eclipse.cdt.codan.core.model;
|
||||||
|
|
||||||
import java.util.EventObject;
|
import java.util.EventObject;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An event object describing the details of a change to a preference
|
* An event object describing the details of a change to a preference
|
||||||
* in the preference store.
|
* in the preference store.
|
||||||
*
|
*
|
||||||
* @noextend This class is not intended to be extended by clients.
|
* @noextend This class is not intended to be extended by clients.
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
|
* @deprecated use {@link IEclipsePreferences} change listener event instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public final class ProblemProfileChangeEvent extends EventObject {
|
public final class ProblemProfileChangeEvent extends EventObject {
|
||||||
/**
|
/**
|
||||||
* All serializable objects should have a stable serialVersionUID
|
* 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
|
* Constructor for a new profile change event. The node and the
|
||||||
* key must not be <code>null</code>.
|
* key must not be <code>null</code>.
|
||||||
*
|
*
|
||||||
* @param profile the profile on which the change occurred
|
* @param profile the profile on which the change occurred
|
||||||
* @param resource the resource for which profile changes occurred
|
* @param resource the resource for which profile changes occurred
|
||||||
* @param key the preference key
|
* @param key the preference key
|
||||||
|
@ -54,7 +58,7 @@ public final class ProblemProfileChangeEvent extends EventObject {
|
||||||
/**
|
/**
|
||||||
* Return the resource on which the change occurred.
|
* Return the resource on which the change occurred.
|
||||||
* Must not be <code>null</code>.
|
* Must not be <code>null</code>.
|
||||||
*
|
*
|
||||||
* @return the node
|
* @return the node
|
||||||
*/
|
*/
|
||||||
public Object getResource() {
|
public Object getResource() {
|
||||||
|
@ -71,7 +75,7 @@ public final class ProblemProfileChangeEvent extends EventObject {
|
||||||
/**
|
/**
|
||||||
* Return the key of the preference which was changed.
|
* Return the key of the preference which was changed.
|
||||||
* Must not be <code>null</code>.
|
* Must not be <code>null</code>.
|
||||||
*
|
*
|
||||||
* @return the preference key
|
* @return the preference key
|
||||||
*/
|
*/
|
||||||
public String getKey() {
|
public String getKey() {
|
||||||
|
@ -82,7 +86,7 @@ public final class ProblemProfileChangeEvent extends EventObject {
|
||||||
* Return the new value for the preference encoded as a
|
* Return the new value for the preference encoded as a
|
||||||
* <code>String</code>, or <code>null</code> if the
|
* <code>String</code>, or <code>null</code> if the
|
||||||
* preference was removed.
|
* preference was removed.
|
||||||
*
|
*
|
||||||
* @return the new value or <code>null</code>
|
* @return the new value or <code>null</code>
|
||||||
*/
|
*/
|
||||||
public Object getNewValue() {
|
public Object getNewValue() {
|
||||||
|
@ -93,7 +97,7 @@ public final class ProblemProfileChangeEvent extends EventObject {
|
||||||
* Return the old value for the preference encoded as a
|
* Return the old value for the preference encoded as a
|
||||||
* <code>String</code>, or <code>null</code> if the
|
* <code>String</code>, or <code>null</code> if the
|
||||||
* preference was removed or if it cannot be determined.
|
* preference was removed or if it cannot be determined.
|
||||||
*
|
*
|
||||||
* @return the old value or <code>null</code>
|
* @return the old value or <code>null</code>
|
||||||
*/
|
*/
|
||||||
public Object getOldValue() {
|
public Object getOldValue() {
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class CodanProblemElement implements IProblemElement {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.IProblemElement#getProfile()
|
* @see org.eclipse.cdt.codan.core.model.IProblemElement#getProfile()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -34,7 +34,7 @@ public class CodanProblemElement implements IProblemElement {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see org.eclipse.cdt.codan.core.model.IProblemElement#getCategory()
|
* @see org.eclipse.cdt.codan.core.model.IProblemElement#getCategory()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -90,6 +90,7 @@ public class CodanProblemElement implements IProblemElement {
|
||||||
/**
|
/**
|
||||||
* @param problemKey
|
* @param problemKey
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
protected void notifyChanged(String key) {
|
protected void notifyChanged(String key) {
|
||||||
if (getProfile() instanceof ProblemProfile) {
|
if (getProfile() instanceof ProblemProfile) {
|
||||||
((ProblemProfile) getProfile()).fireProfileChangeEvent(key, null, this);
|
((ProblemProfile) getProfile()).fireProfileChangeEvent(key, null, this);
|
||||||
|
|
|
@ -109,6 +109,7 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public void addProfileChangeListener(IProblemProfileChangeListener listener) {
|
public void addProfileChangeListener(IProblemProfileChangeListener listener) {
|
||||||
if (preferenceChangeListeners == null)
|
if (preferenceChangeListeners == null)
|
||||||
preferenceChangeListeners = new ListenerList();
|
preferenceChangeListeners = new ListenerList();
|
||||||
|
@ -116,6 +117,7 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public void removeProfileChangeListener(IProblemProfileChangeListener listener) {
|
public void removeProfileChangeListener(IProblemProfileChangeListener listener) {
|
||||||
if (preferenceChangeListeners == null)
|
if (preferenceChangeListeners == null)
|
||||||
return;
|
return;
|
||||||
|
@ -127,6 +129,7 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
|
||||||
/**
|
/**
|
||||||
* Convenience method for notifying preference change listeners.
|
* Convenience method for notifying preference change listeners.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
protected void fireProfileChangeEvent(String key, Object oldValue, Object newValue) {
|
protected void fireProfileChangeEvent(String key, Object oldValue, Object newValue) {
|
||||||
if (preferenceChangeListeners == null)
|
if (preferenceChangeListeners == null)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue