Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ListenerList.java')
-rw-r--r--plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ListenerList.java81
1 files changed, 0 insertions, 81 deletions
diff --git a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ListenerList.java b/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ListenerList.java
deleted file mode 100644
index db72ea550..000000000
--- a/plugins/org.eclipse.wst.common.frameworks.ui/wtp_ui/org/eclipse/wst/common/frameworks/internal/ui/ListenerList.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.common.frameworks.internal.ui;
-
-import java.awt.event.ActionListener;
-
-public class ListenerList {
- private final static ActionListener[] NULL_ARRAY = new ActionListener[0];
- protected transient ActionListener[] listenerList = NULL_ARRAY;
-
- /**
- * Add the listener as a listener of the specified type.
- *
- * @param t
- * the type of the listener to be added
- * @param l
- * the listener to be added
- */
- public synchronized void add(ActionListener l) {
- if (l == null)
- return;
- if (listenerList == NULL_ARRAY) {
- // if this is the first listener added,
- // initialize the lists
- listenerList = new ActionListener[]{l};
- } else {
- // Otherwise copy the array and add the new listener
- int i = listenerList.length;
- ActionListener[] tmp = new ActionListener[i + 1];
- System.arraycopy(listenerList, 0, tmp, 0, i);
-
- tmp[i + 1] = l;
-
- listenerList = tmp;
- }
- }
-
- /**
- * Return the total number of listeners for this listenerlist
- */
- public int getListenerCount() {
- return listenerList.length;
- }
-
- public ActionListener[] getListenerList() {
- return listenerList;
- }
-
- public synchronized void remove(ActionListener l) {
- if (l == null)
- return;
- int index = -1;
- for (int i = listenerList.length - 1; i >= 0; i -= 1) {
- if (listenerList[i].equals(l)) {
- index = i;
- break;
- }
- }
- if (index != -1) {
- ActionListener[] tmp = new ActionListener[listenerList.length - 1];
- // Copy the list up to index
- System.arraycopy(listenerList, 0, tmp, 0, index);
- // Copy from two past the index, up to
- // the end of tmp (which is two elements
- // shorter than the old list)
- if (index < tmp.length)
- System.arraycopy(listenerList, index + 1, tmp, index, tmp.length - index);
- // set the listener array to the new array or null
- listenerList = (tmp.length == 0) ? NULL_ARRAY : tmp;
- }
- }
-} \ No newline at end of file

Back to the top