Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlena Laskavaia2016-03-16 11:52:37 -0400
committerGerrit Code Review @ Eclipse.org2016-03-17 15:12:14 -0400
commit26d87d7b746f0d394e7f75832d0a309efc53d186 (patch)
tree81fb4552acd9bd789e80a79e983394a359d06b03 /codan/org.eclipse.cdt.codan.core
parent7856453f3073ab05cd791f75decbe179998964b4 (diff)
downloadorg.eclipse.cdt-26d87d7b746f0d394e7f75832d0a309efc53d186.tar.gz
org.eclipse.cdt-26d87d7b746f0d394e7f75832d0a309efc53d186.tar.xz
org.eclipse.cdt-26d87d7b746f0d394e7f75832d0a309efc53d186.zip
removing API for custom preference listeners in codan
- this is replaced by eclipse preference listeners framework Change-Id: Ia39041c79c643912c883d7fdf507aeb252f13ddc
Diffstat (limited to 'codan/org.eclipse.cdt.codan.core')
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfile.java21
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfileChangeListener.java37
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java20
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblemElement.java10
-rw-r--r--codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/ProblemProfile.java51
5 files changed, 8 insertions, 131 deletions
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 56b7cb695e..dc75846996 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
@@ -11,7 +11,6 @@
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
@@ -68,26 +67,6 @@ public interface IProblemProfile extends IProblemElement {
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
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
deleted file mode 100644
index 9f406dec08..0000000000
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/model/IProblemProfileChangeListener.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2016 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alena Laskavaia - initial API and implementation
- *******************************************************************************/
-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)
- * @see IProblemProfile#removeProfileChangeListener(IProblemProfileChangeListener)
- */
- public void profileChange(ProblemProfileChangeEvent event);
-} \ No newline at end of file
diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java
index a00d1a373e..ddb976e29d 100644
--- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java
+++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/internal/core/model/CodanProblem.java
@@ -14,7 +14,6 @@ import org.eclipse.cdt.codan.core.model.CodanSeverity;
import org.eclipse.cdt.codan.core.model.IProblemMultiple;
import org.eclipse.cdt.codan.core.model.IProblemReporter;
import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
-import org.eclipse.cdt.codan.core.model.ProblemProfileChangeEvent;
import org.eclipse.cdt.codan.core.param.IProblemPreference;
import org.eclipse.cdt.codan.internal.core.CheckersRegistry;
@@ -84,19 +83,17 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
throw new NullPointerException();
checkSet();
this.severity = sev;
- notifyChanged(ProblemProfileChangeEvent.PROBLEM_KEY);
}
@Override
public void setEnabled(boolean checked) {
checkSet();
this.enabled = checked;
- notifyChanged(ProblemProfileChangeEvent.PROBLEM_KEY);
}
/*
* (non-Javadoc)
- *
+ *
* @see java.lang.Object#clone()
*/
@Override
@@ -114,7 +111,6 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
if (value == null)
throw new NullPointerException();
rootPreference = value;
- notifyChanged(ProblemProfileChangeEvent.PROBLEM_PREF_KEY);
}
@Override
@@ -124,7 +120,7 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.cdt.codan.core.model.IProblem#getMessagePattern()
*/
@Override
@@ -144,7 +140,7 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.cdt.codan.core.model.IProblem#getDescription()
*/
@Override
@@ -154,7 +150,7 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.cdt.codan.core.model.IProblemWorkingCopy#setDescription(java
* .lang.String)
@@ -167,7 +163,7 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.cdt.codan.core.model.IProblem#getMarkerType()
*/
@Override
@@ -177,7 +173,7 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
/**
* Sets the marker id for the problem.
- *
+ *
* @param markerType
*/
public void setMarkerType(String markerType) {
@@ -187,7 +183,7 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.cdt.codan.core.model.IProblemMultiple#isMultiple()
*/
@Override
@@ -197,7 +193,7 @@ public class CodanProblem extends CodanProblemElement implements IProblemWorking
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.cdt.codan.core.model.IProblemMultiple#isOriginal()
*/
@Override
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 d0b0cf165a..f43a81dcf7 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
@@ -86,14 +86,4 @@ public class CodanProblemElement implements IProblemElement {
protected boolean isFrozen() {
return frozen;
}
-
- /**
- * @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 21e533e5fc..d7b609a5d8 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
@@ -16,11 +16,6 @@ import java.util.Collection;
import org.eclipse.cdt.codan.core.model.IProblem;
import org.eclipse.cdt.codan.core.model.IProblemCategory;
import org.eclipse.cdt.codan.core.model.IProblemProfile;
-import org.eclipse.cdt.codan.core.model.IProblemProfileChangeListener;
-import org.eclipse.cdt.codan.core.model.ProblemProfileChangeEvent;
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.core.runtime.SafeRunner;
/**
* @author Alena
@@ -28,7 +23,6 @@ import org.eclipse.core.runtime.SafeRunner;
public class ProblemProfile implements IProblemProfile, Cloneable {
private CodanProblemCategory rootCategory;
private Object resource;
- private ListenerList preferenceChangeListeners;
/**
* @param resource
@@ -109,51 +103,6 @@ public class ProblemProfile implements IProblemProfile, Cloneable {
}
@Override
- @Deprecated
- public void addProfileChangeListener(IProblemProfileChangeListener listener) {
- if (preferenceChangeListeners == null)
- preferenceChangeListeners = new ListenerList();
- preferenceChangeListeners.add(listener);
- }
-
- @Override
- @Deprecated
- public void removeProfileChangeListener(IProblemProfileChangeListener listener) {
- if (preferenceChangeListeners == null)
- return;
- preferenceChangeListeners.remove(listener);
- if (preferenceChangeListeners.isEmpty())
- preferenceChangeListeners = null;
- }
-
- /**
- * Convenience method for notifying preference change listeners.
- */
- @Deprecated
- protected void fireProfileChangeEvent(String key, Object oldValue, Object newValue) {
- if (preferenceChangeListeners == null)
- return;
- Object[] listeners = preferenceChangeListeners.getListeners();
- final ProblemProfileChangeEvent event =
- new ProblemProfileChangeEvent(this, this.resource, key, oldValue, newValue);
- for (int i = 0; i < listeners.length; i++) {
- final IProblemProfileChangeListener listener = (IProblemProfileChangeListener) listeners[i];
- ISafeRunnable job = new ISafeRunnable() {
- @Override
- public void handleException(Throwable exception) {
- // already logged in Platform#run()
- }
-
- @Override
- public void run() throws Exception {
- listener.profileChange(event);
- }
- };
- SafeRunner.run(job);
- }
- }
-
- @Override
public Object getResource() {
return resource;
}

Back to the top