diff options
author | nhauge | 2008-07-23 19:07:00 +0000 |
---|---|---|
committer | nhauge | 2008-07-23 19:07:00 +0000 |
commit | 31b7c00871612639dbd987d16d9613765148a8d5 (patch) | |
tree | 5c4be62bd5141a6f67a6a90e0b545d190bd8dc65 /jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model | |
parent | d61c64d0068f65d818960c5f158c86340a07ead9 (diff) | |
download | webtools.dali-31b7c00871612639dbd987d16d9613765148a8d5.tar.gz webtools.dali-31b7c00871612639dbd987d16d9613765148a8d5.tar.xz webtools.dali-31b7c00871612639dbd987d16d9613765148a8d5.zip |
This commit was manufactured by cvs2svn to create tag 'v200807230000'.v200807230000
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model')
25 files changed, 0 insertions, 2170 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/Model.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/Model.java deleted file mode 100644 index 33f2fd2afd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/Model.java +++ /dev/null @@ -1,195 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model; - -import org.eclipse.jpt.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.utility.model.listener.StateChangeListener; -import org.eclipse.jpt.utility.model.listener.TreeChangeListener; - -/** - * Interface to be implemented by models that notify listeners of - * changes to bound properties, collections, lists, and/or trees. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface Model { - - // ********** state change ********** - - /** - * Add a listener that listens to all state change events. - * The same listener may be added more than once and will be called - * as many times as it is added. The listener cannot be null. - */ - void addStateChangeListener(StateChangeListener listener); - - /** - * Remove the specified state change listener. If the listener - * was added more than once, it will be notified one less time - * after being removed. An exception will be thrown if the - * listener is null or if the listener was never added. - */ - void removeStateChangeListener(StateChangeListener listener); - - - // ********** property change ********** - - /** - * Add a listener that listens to all property change events, - * regardless of the property name associated with that event. - * The same listener may be added more than once and will be called - * as many times as it is added. The listener cannot be null. - */ - void addPropertyChangeListener(PropertyChangeListener listener); - - /** - * Add a listener that listens to all property change events with - * the specified property name. - * The same listener may be added more than once and will be called - * as many times as it is added. The listener cannot be null. - */ - void addPropertyChangeListener(String propertyName, PropertyChangeListener listener); - - /** - * Remove a listener that listens to all property change events, - * regardless of the property name associated with that event. - * If the listener was added more than once, it will be notified one less - * time after being removed. An exception will be thrown if the - * listener is null or if the listener was never added. - */ - void removePropertyChangeListener(PropertyChangeListener listener); - - /** - * Remove a listener that listens to all property change events, - * with the specified property name. - * If the listener was added more than once, it will be notified one less - * time after being removed. An exception will be thrown if the - * listener is null or if the listener was never added. - */ - void removePropertyChangeListener(String propertyName, PropertyChangeListener listener); - - - // ********** collection change ********** - - /** - * Add a listener that listens to all collection change events, - * regardless of the collection name associated with that event. - * The same listener may be added more than once and will be called - * as many times as it is added. The listener cannot be null. - */ - void addCollectionChangeListener(CollectionChangeListener listener); - - /** - * Add a listener that listens to all collection change events with - * the specified collection name. - * The same listener may be added more than once and will be called - * as many times as it is added. The listener cannot be null. - */ - void addCollectionChangeListener(String collectionName, CollectionChangeListener listener); - - /** - * Remove a listener that listens to all collection change events, - * regardless of the collection name associated with that event. - * If the listener was added more than once, it will be notified one less - * time after being removed. An exception will be thrown if the - * listener is null or if the listener was never added. - */ - void removeCollectionChangeListener(CollectionChangeListener listener); - - /** - * Remove a listener that listens to all collection change events, - * with the specified collection name. - * If the listener was added more than once, it will be notified one less - * time after being removed. An exception will be thrown if the - * listener is null or if the listener was never added. - */ - void removeCollectionChangeListener(String collectionName, CollectionChangeListener listener); - - - // ********** list change ********** - - /** - * Add a listener that listens to all list change events, - * regardless of the list name associated with that event. - * The same listener may be added more than once and will be called - * as many times as it is added. The listener cannot be null. - */ - void addListChangeListener(ListChangeListener listener); - - /** - * Add a listener that listens to all list change events with - * the specified list name. - * The same listener may be added more than once and will be called - * as many times as it is added. The listener cannot be null. - */ - void addListChangeListener(String listName, ListChangeListener listener); - - /** - * Remove a listener that listens to all list change events, - * regardless of the list name associated with that event. - * If the listener was added more than once, it will be notified one less - * time after being removed. An exception will be thrown if the - * listener is null or if the listener was never added. - */ - void removeListChangeListener(ListChangeListener listener); - - /** - * Remove a listener that listens to all list change events, - * with the specified list name. - * If the listener was added more than once, it will be notified one less - * time after being removed. An exception will be thrown if the - * listener is null or if the listener was never added. - */ - void removeListChangeListener(String listName, ListChangeListener listener); - - - // ********** tree change ********** - - /** - * Add a listener that listens to all tree change events, - * regardless of the tree name associated with that event. - * The same listener may be added more than once and will be called - * as many times as it is added. The listener cannot be null. - */ - void addTreeChangeListener(TreeChangeListener listener); - - /** - * Add a listener that listens to all tree change events with - * the specified tree name. - * The same listener may be added more than once and will be called - * as many times as it is added. The listener cannot be null. - */ - void addTreeChangeListener(String treeName, TreeChangeListener listener); - - /** - * Remove a listener that listens to all tree change events, - * regardless of the tree name associated with that event. - * If the listener was added more than once, it will be notified one less - * time after being removed. An exception will be thrown if the - * listener is null or if the listener was never added. - */ - void removeTreeChangeListener(TreeChangeListener listener); - - /** - * Remove a listener that listens to all tree change events, - * with the specified tree name. - * If the listener was added more than once, it will be notified one less - * time after being removed. An exception will be thrown if the - * listener is null or if the listener was never added. - */ - void removeTreeChangeListener(String treeName, TreeChangeListener listener); - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/event/ChangeEvent.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/event/ChangeEvent.java deleted file mode 100644 index a794045b7a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/event/ChangeEvent.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.event; - -import java.util.EventObject; - -import org.eclipse.jpt.utility.internal.StringTools; -import org.eclipse.jpt.utility.model.Model; - -/** - * Abstract class for all the change events that can be fired by models. - * - * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public abstract class ChangeEvent extends EventObject { - - private static final long serialVersionUID = 1L; - - - /** - * Construct a new change event. - * - * @param source The object on which the event initially occurred. - */ - protected ChangeEvent(Model source) { - super(source); - } - - /** - * Covariant override. - */ - @Override - public Model getSource() { - return (Model) super.getSource(); - } - - /** - * Return the name of the aspect of the source that changed. - * May be null if inappropriate. - */ - public abstract String getAspectName(); - - /** - * Return a copy of the event with the specified source - * replacing the current source. - */ - public abstract ChangeEvent cloneWithSource(Model newSource); - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.getAspectName()); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/event/CollectionChangeEvent.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/event/CollectionChangeEvent.java deleted file mode 100644 index fbbad13412..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/event/CollectionChangeEvent.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.event; - -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; - -import org.eclipse.jpt.utility.model.Model; - -/** - * A "collection change" event gets delivered whenever a model changes a "bound" - * or "constrained" collection. A CollectionChangeEvent is sent as an - * argument to the CollectionChangeListener. - * - * Normally a CollectionChangeEvent is accompanied by the collection name and - * the items that were added to or removed from the changed collection. - * - * Design options: - * - create a collection to wrap a single added or removed item - * (this is the option we implemented below and in collaborating code) - * since there is no way to optimize downstream code for - * single items, we take another performance hit by building - * a collection each time (@see Collections#singleton(Object)) - * and forcing downstream code to use an iterator every time - * - * - fire a separate event for each item added or removed - * eliminates any potential for optimizations to downstream code - * - * - add protocol to support both single items and collections - * adds conditional logic to downstream code - * - * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public class CollectionChangeEvent extends ChangeEvent { - - /** Name of the collection that changed. */ - private final String collectionName; - - /** The items that were added to or removed from the collection. May be empty, if not known. */ - private final Collection<?> items; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a new collection change event. - * - * @param source The object on which the event initially occurred. - * @param collectionName The programmatic name of the collection that was changed. - * @param items The items that were added to or removed from the collection. - */ - public CollectionChangeEvent(Model source, String collectionName, Collection<?> items) { - super(source); - if ((collectionName == null) || (items == null)) { - throw new NullPointerException(); - } - this.collectionName = collectionName; - this.items = Collections.unmodifiableCollection(items); - } - - /** - * Construct a new collection change event. - * - * @param source The object on which the event initially occurred. - * @param collectionName The programmatic name of the collection that was changed. - */ - public CollectionChangeEvent(Model source, String collectionName) { - this(source, collectionName, Collections.emptySet()); - } - - - // ********** standard state ********** - - /** - * Return the programmatic name of the collection that was changed. - */ - public String getCollectionName() { - return this.collectionName; - } - - @Override - public String getAspectName() { - return this.collectionName; - } - - /** - * Return an iterator on the items that were added to or - * removed from the collection. - * May be empty if inappropriate or unknown. - */ - public Iterator<?> items() { - return this.items.iterator(); - } - - /** - * Return the number of items that were added to or - * removed from the collection. - * May be 0 if inappropriate or unknown. - */ - public int itemsSize() { - return this.items.size(); - } - - - // ********** cloning ********** - - /** - * Return a copy of the event with the specified source - * replacing the current source. - */ - @Override - public CollectionChangeEvent cloneWithSource(Model newSource) { - return new CollectionChangeEvent(newSource, this.collectionName, this.items); - } - - /** - * Return a copy of the event with the specified source and collection name - * replacing the current source and collection name. - */ - public CollectionChangeEvent cloneWithSource(Model newSource, String newCollectionName) { - return new CollectionChangeEvent(newSource, newCollectionName, this.items); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/event/ListChangeEvent.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/event/ListChangeEvent.java deleted file mode 100644 index c1eff08e04..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/event/ListChangeEvent.java +++ /dev/null @@ -1,263 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.event; - -import java.util.Collections; -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.utility.model.Model; - -/** - * A "list change" event gets delivered whenever a model changes a "bound" - * or "constrained" list. A ListChangeEvent is sent as an - * argument to the ListChangeListener. - * - * Normally a ListChangeEvent is accompanied by the list name, - * the items that were added to or removed from the changed list, - * and the index of where the items are or were in the list. - * - * Design options: - * - create a list to wrap a single added or removed item - * (this is the option we implemented below and in collaborating code) - * since there is no way to optimize downstream code for - * single items, we take another performance hit by building - * a list each time (@see Collections#singletonList(Object)) - * and forcing downstream code to use a list iterator every time - * - * - fire a separate event for each item added or removed - * eliminates any potential for optimizations to downstream code - * - * - add protocol to support both single items and collections - * adds conditional logic to downstream code - * - * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public class ListChangeEvent extends ChangeEvent { - - /** - * Name of the list that changed. - */ - private final String listName; - - /** - * The index at which the items were added, removed, or replaced. - * In the case of "moved" items, this will be the "target" index. - * May be -1, if not known. - */ - private final int index; - - /** - * The items that were added to or removed from the list. In the case of - * "replaced" items, these are the new items in the list. - * In the case of "moved" items, this will be empty. - * May be empty, if not known. - */ - private final List<?> items; - - /** - * The items in the list that were replaced by the items listed above, - * in #items. May be empty, if not known. - */ - private final List<?> replacedItems; - - /** - * In the case of "moved" items, this will be the "source" index. - * May be -1, if not known. - */ - private final int sourceIndex; - - /** - * In the case of "moved" items, this will be the number of items moved. - * May be -1, if not known. - */ - private final int moveLength; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - protected ListChangeEvent(Model source, String listName, int index, List<?> items, List<?> replacedItems, int sourceIndex, int moveLength) { - super(source); - if ((listName == null) || (items == null) || (replacedItems == null)) { - throw new NullPointerException(); - } - this.listName = listName; - this.index = index; - this.items = Collections.unmodifiableList(items); - this.replacedItems = Collections.unmodifiableList(replacedItems); - this.sourceIndex = sourceIndex; - this.moveLength = moveLength; - } - - /** - * Construct a new list change event for a list of replaced items. - * - * @param source The object on which the event initially occurred. - * @param listName The programmatic name of the list that was changed. - * @param index The index at which the items in the list were replaced. - * @param items The new items in the list. - * @param replacedItems The items in the list that were replaced. - */ - public ListChangeEvent(Model source, String listName, int index, List<?> items, List<?> replacedItems) { - this(source, listName, index, items, replacedItems, -1, -1); - } - - /** - * Construct a new list change event for a list of added or removed items. - * - * @param source The object on which the event initially occurred. - * @param listName The programmatic name of the list that was changed. - * @param index The index at which the items were added to or removed from the list. - * @param items The items that were added to or removed from the list. - */ - public ListChangeEvent(Model source, String listName, int index, List<?> items) { - this(source, listName, index, items, Collections.emptyList(), -1, -1); - } - - /** - * Construct a new list change event for a list of moved items. - * - * @param source The object on which the event initially occurred. - * @param listName The programmatic name of the list that was changed. - * @param targetIndex The index to which the items were moved. - * @param sourceIndex The index from which the items were moved. - */ - public ListChangeEvent(Model source, String listName, int targetIndex, int sourceIndex, int length) { - this(source, listName, targetIndex, Collections.emptyList(), Collections.emptyList(), sourceIndex, length); - } - - /** - * Construct a new list change event. - * - * @param source The object on which the event initially occurred. - * @param listName The programmatic name of the list that was changed. - */ - public ListChangeEvent(Model source, String listName) { - this(source, listName, -1, Collections.emptyList(), Collections.emptyList(), -1, -1); - } - - - // ********** standard state ********** - - /** - * Return the programmatic name of the list that was changed. - */ - public String getListName() { - return this.listName; - } - - @Override - public String getAspectName() { - return this.listName; - } - - /** - * Return the index at which the items were added to, removed from, - * or replaced in the list. - * In the case of "moved" items, this will be the "target" index. - * May be -1 if inappropriate or unknown. - */ - public int getIndex() { - return this.index; - } - - /** - * Return a list iterator on the items that were added to or - * removed from the list. In the case of "replaced" items, these - * are the new items in the list. - * May be empty if inappropriate or unknown. - */ - public ListIterator<?> items() { - return this.items.listIterator(); - } - - /** - * Return the number of items that were added to, - * removed from, or replaced in the list. - * May be 0 if inappropriate or unknown. - */ - public int itemsSize() { - return this.items.size(); - } - - - // ********** replace ********** - - /** - * Return a list iterator on the items in the list that were replaced. - * May be empty if inappropriate or unknown. - */ - public ListIterator<?> replacedItems() { - return this.replacedItems.listIterator(); - } - - - // ********** move ********** - - /** - * In the case of "moved" items, this will be the "target" index. - * May be -1 if inappropriate or unknown. - */ - public int getTargetIndex() { - return this.index; - } - - /** - * In the case of "moved" items, this will be the "source" index. - * May be -1 if inappropriate or unknown. - */ - public int getSourceIndex() { - return this.sourceIndex; - } - - /** - * In the case of "moved" items, this will be the number of items moved. - * May be -1 if inappropriate or unknown. - */ - public int getMoveLength() { - return this.moveLength; - } - - - // ********** cloning ********** - - /** - * Return a copy of the event with the specified source - * replacing the current source. - */ - @Override - public ListChangeEvent cloneWithSource(Model newSource) { - return new ListChangeEvent(newSource, this.listName, this.index, this.items, this.replacedItems, this.sourceIndex, this.moveLength); - } - - /** - * Return a copy of the event with the specified source and list name - * replacing the current source and list name. - */ - public ListChangeEvent cloneWithSource(Model newSource, String newListName) { - return new ListChangeEvent(newSource, newListName, this.index, this.items, this.replacedItems, this.sourceIndex, this.moveLength); - } - - /** - * Return a copy of the event with the specified source and list name - * replacing the current source and list name and displacing - * the index by the specified amount. - */ - public ListChangeEvent cloneWithSource(Model newSource, String newListName, int offset) { - return new ListChangeEvent(newSource, newListName, this.index + offset, this.items, this.replacedItems, this.sourceIndex + offset, this.moveLength); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/event/PropertyChangeEvent.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/event/PropertyChangeEvent.java deleted file mode 100644 index ee2fa2f8b2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/event/PropertyChangeEvent.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.event; - -import org.eclipse.jpt.utility.model.Model; - -/** - * A "property change" event gets delivered whenever a model changes a "bound" - * or "constrained" property. A PropertyChangeEvent is sent as an - * argument to the PropertyChangeListener. - * - * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public class PropertyChangeEvent extends ChangeEvent { - - /** Name of the property that changed. */ - private final String propertyName; - - /** The property's old value, before the change. */ - private final Object oldValue; - - /** The property's new value, after the change. */ - private final Object newValue; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a new property change event. - * - * @param source The object on which the event initially occurred. - * @param propertyName The programmatic name of the property that was changed. - * @param oldValue The old value of the property. - * @param newValue The new value of the property. - */ - public PropertyChangeEvent(Model source, String propertyName, Object oldValue, Object newValue) { - super(source); - if (propertyName == null) { - throw new NullPointerException(); - } - this.propertyName = propertyName; - this.oldValue = oldValue; - this.newValue = newValue; - } - - - // ********** standard state ********** - - /** - * Return the programmatic name of the property that was changed. - */ - public String getPropertyName() { - return this.propertyName; - } - - @Override - public String getAspectName() { - return this.propertyName; - } - - /** - * Return the old value of the property. - */ - public Object getOldValue() { - return this.oldValue; - } - - /** - * Return the new value of the property. - */ - public Object getNewValue() { - return this.newValue; - } - - - // ********** cloning ********** - - @Override - public PropertyChangeEvent cloneWithSource(Model newSource) { - return new PropertyChangeEvent(newSource, this.propertyName, this.oldValue, this.newValue); - } - - /** - * Return a copy of the event with the specified source - * replacing the current source and the property name. - */ - public PropertyChangeEvent cloneWithSource(Model newSource, String newPropertyName) { - return new PropertyChangeEvent(newSource, newPropertyName, this.oldValue, this.newValue); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/event/StateChangeEvent.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/event/StateChangeEvent.java deleted file mode 100644 index 52e3690e69..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/event/StateChangeEvent.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.event; - -import org.eclipse.jpt.utility.model.Model; - -/** - * A generic "state change" event gets delivered whenever a model changes to - * such extent that it cannot be delineated all aspects of it that have changed. - * A StateChangeEvent is sent as an argument to the StateChangeListener. - * - * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public class StateChangeEvent extends ChangeEvent { - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a new state change event. - * - * @param source The object on which the event initially occurred. - */ - public StateChangeEvent(Model source) { - super(source); - } - - - // ********** standard state ********** - - @Override - public String getAspectName() { - return null; // the point of the event is that the name is unknown... - } - - - // ********** cloning ********** - - @Override - public StateChangeEvent cloneWithSource(Model newSource) { - return new StateChangeEvent(newSource); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/event/TreeChangeEvent.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/event/TreeChangeEvent.java deleted file mode 100644 index 2272020490..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/event/TreeChangeEvent.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.event; - -import org.eclipse.jpt.utility.model.Model; - -/** - * A "tree change" event gets delivered whenever a model changes a "bound" - * or "constrained" tree. A TreeChangeEvent is sent as an - * argument to the TreeChangeListener. - * - * Normally a TreeChangeEvent is accompanied by the tree name and a path - * to the part of the tree that was changed. - * - * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public class TreeChangeEvent extends ChangeEvent { - - /** Name of the tree that changed. */ - private final String treeName; - - /** - * Path to the parent of the part of the tree that was changed. - * May be empty, if not known or if the entire tree changed. - */ - protected final Object[] path; - - private static final Object[] EMPTY_PATH = new Object[0]; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a new tree change event. - * - * @param source The object on which the event initially occurred. - * @param treeName The programmatic name of the tree that was changed. - * @param path The path to the part of the tree that was changed. - */ - public TreeChangeEvent(Model source, String treeName, Object[] path) { - super(source); - if ((treeName == null) || (path == null)) { - throw new NullPointerException(); - } - this.treeName = treeName; - this.path = path; - } - - /** - * Construct a new tree change event. - * - * @param source The object on which the event initially occurred. - * @param treeName The programmatic name of the tree that was changed. - */ - public TreeChangeEvent(Model source, String treeName) { - this(source, treeName, EMPTY_PATH); - } - - - // ********** standard state ********** - - /** - * Return the programmatic name of the tree that was changed. - */ - public String getTreeName() { - return this.treeName; - } - - @Override - public String getAspectName() { - return this.treeName; - } - - /** - * Return the path to the part of the tree that was changed. - * May be empty, if not known. - */ - public Object[] getPath() { - return this.path; - } - - - // ********** cloning ********** - - @Override - public TreeChangeEvent cloneWithSource(Model newSource) { - return new TreeChangeEvent(newSource, this.treeName, this.path); - } - - /** - * Return a copy of the event with the specified source - * replacing the current source and the tree name. - */ - public TreeChangeEvent cloneWithSource(Model newSource, String newTreeName) { - return new TreeChangeEvent(newSource, newTreeName, this.path); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/ChangeListener.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/ChangeListener.java deleted file mode 100644 index d29a7a7de2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/ChangeListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.listener; - -import java.util.EventListener; - -/** - * Marker interface. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ChangeListener extends EventListener { - // nothing for now -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/CollectionChangeAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/CollectionChangeAdapter.java deleted file mode 100644 index 88b1359e16..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/CollectionChangeAdapter.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.listener; - -import org.eclipse.jpt.utility.model.event.CollectionChangeEvent; - -/** - * Convenience implementation of CollectionChangeListener. - * - * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public class CollectionChangeAdapter implements CollectionChangeListener { - - /** - * Default constructor. - */ - public CollectionChangeAdapter() { - super(); - } - - public void itemsAdded(CollectionChangeEvent event) { - // do nothing - } - - public void itemsRemoved(CollectionChangeEvent event) { - // do nothing - } - - public void collectionCleared(CollectionChangeEvent event) { - // do nothing - } - - public void collectionChanged(CollectionChangeEvent event) { - // do nothing - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/CollectionChangeListener.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/CollectionChangeListener.java deleted file mode 100644 index 210388b923..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/CollectionChangeListener.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.listener; - -import org.eclipse.jpt.utility.model.event.CollectionChangeEvent; - -/** - * A "collection change" event gets fired whenever a model changes a "bound" - * collection. You can register a CollectionChangeListener with a source - * model so as to be notified of any bound collection updates. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface CollectionChangeListener extends ChangeListener { - - /** - * This method gets called when items are added to a bound collection. - * - * @param event A CollectionChangeEvent describing the event source, - * the collection that changed, and the items that were added. - */ - void itemsAdded(CollectionChangeEvent event); - - /** - * This method gets called when items are removed from a bound collection. - * - * @param event A CollectionChangeEvent describing the event source, - * the collection that changed, and the items that were removed. - */ - void itemsRemoved(CollectionChangeEvent event); - - /** - * This method gets called when a bound collection is cleared. - * - * @param event A CollectionChangeEvent describing the event source - * and the collection that changed. - */ - void collectionCleared(CollectionChangeEvent event); - - /** - * This method gets called when a bound collection is changed in a manner - * that is not easily characterized by the other methods in this interface. - * - * @param event A CollectionChangeEvent describing the event source - * and the collection that changed. - */ - void collectionChanged(CollectionChangeEvent event); - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/ListChangeAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/ListChangeAdapter.java deleted file mode 100644 index 052abc5cf4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/ListChangeAdapter.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.listener; - -import org.eclipse.jpt.utility.model.event.ListChangeEvent; - -/** - * Convenience implementation of ListChangeListener. - * - * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public class ListChangeAdapter implements ListChangeListener { - - /** - * Default constructor. - */ - public ListChangeAdapter() { - super(); - } - - public void itemsAdded(ListChangeEvent event) { - // do nothing - } - - public void itemsRemoved(ListChangeEvent event) { - // do nothing - } - - public void itemsReplaced(ListChangeEvent event) { - // do nothing - } - - public void itemsMoved(ListChangeEvent event) { - // do nothing - } - - public void listCleared(ListChangeEvent event) { - // do nothing - } - - public void listChanged(ListChangeEvent event) { - // do nothing - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/ListChangeListener.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/ListChangeListener.java deleted file mode 100644 index 74eab3a002..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/ListChangeListener.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.listener; - -import org.eclipse.jpt.utility.model.event.ListChangeEvent; - -/** - * A "list change" event gets fired whenever a model changes a "bound" - * list. You can register a ListChangeListener with a source - * model so as to be notified of any bound list updates. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ListChangeListener extends ChangeListener { - - /** - * This method gets called when items are added to a bound list. - * - * @param event A ListChangeEvent describing the event source, - * the list that changed, the items that were added, and the index - * at which the items were added. - */ - void itemsAdded(ListChangeEvent event); - - /** - * This method gets called when items are removed from a bound list. - * - * @param event A ListChangeEvent describing the event source, - * the list that changed, the items that were removed, and the index - * at which the items were removed. - */ - void itemsRemoved(ListChangeEvent event); - - /** - * This method gets called when items in a bound list are replaced. - * - * @param event A ListChangeEvent describing the event source, - * the list that changed, the items that were added, the items that were - * replaced, and the index at which the items were replaced. - */ - void itemsReplaced(ListChangeEvent event); - - /** - * This method gets called when items in a bound list are moved. - * - * @param event A ListChangeEvent describing the event source, - * the list that changed, and the indices of where items were moved - * from and to. - */ - void itemsMoved(ListChangeEvent event); - - /** - * This method gets called when a bound list is cleared. - * - * @param event A ListChangeEvent object describing the event source - * and the list that changed. - */ - void listCleared(ListChangeEvent event); - - /** - * This method gets called when a bound list is changed in a manner - * that is not easily characterized by the other methods in this interface. - * - * @param event A ListChangeEvent object describing the event source - * and the list that changed. - */ - void listChanged(ListChangeEvent event); - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/MultiMethodReflectiveChangeListener.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/MultiMethodReflectiveChangeListener.java deleted file mode 100644 index 8fb5b6d2d7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/MultiMethodReflectiveChangeListener.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.listener; - -import java.lang.reflect.Method; - -import org.eclipse.jpt.utility.internal.ClassTools; -import org.eclipse.jpt.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.utility.model.event.TreeChangeEvent; - -/** - * This class is used by ReflectiveChangeListener when the requested listener - * needs to implement multiple methods (i.e. CollectionChangeListener, - * ListChangeListener, or TreeChangeListener). - */ -class MultiMethodReflectiveChangeListener - extends ReflectiveChangeListener - implements CollectionChangeListener, ListChangeListener, TreeChangeListener -{ - /** the methods we will invoke on the target object */ - private final Method addMethod; - private final Method removeMethod; - private final Method replaceMethod; // this can be null - private final Method moveMethod; // this can be null - private final Method clearMethod; - private final Method changeMethod; - - - /** - * The "replace" and "move" methods are optional. - */ - MultiMethodReflectiveChangeListener(Object target, Method addMethod, Method removeMethod, Method replaceMethod, Method moveMethod, Method clearMethod, Method changeMethod) { - super(target); - this.addMethod = addMethod; - this.removeMethod = removeMethod; - this.replaceMethod = replaceMethod; - this.moveMethod = moveMethod; - this.clearMethod = clearMethod; - this.changeMethod = changeMethod; - } - - /** - * No "replace" or "move" methods. - */ - MultiMethodReflectiveChangeListener(Object target, Method addMethod, Method removeMethod, Method clearMethod, Method changeMethod) { - this(target, addMethod, removeMethod, null, null, clearMethod, changeMethod); - } - - - // ********** CollectionChangeListener implementation ********** - - private void invoke(Method method, CollectionChangeEvent event) { - if (method.getParameterTypes().length == 0) { - ClassTools.executeMethod(method, this.target, EMPTY_COLLECTION_CHANGE_EVENT_ARRAY); - } else { - ClassTools.executeMethod(method, this.target, new CollectionChangeEvent[] {event}); - } - } - - public void itemsAdded(CollectionChangeEvent event) { - this.invoke(this.addMethod, event); - } - - public void itemsRemoved(CollectionChangeEvent event) { - this.invoke(this.removeMethod, event); - } - - public void collectionCleared(CollectionChangeEvent event) { - this.invoke(this.clearMethod, event); - } - - public void collectionChanged(CollectionChangeEvent event) { - this.invoke(this.changeMethod, event); - } - - - // ********** ListChangeListener implementation ********** - - private void invoke(Method method, ListChangeEvent event) { - if (method.getParameterTypes().length == 0) { - ClassTools.executeMethod(method, this.target, EMPTY_LIST_CHANGE_EVENT_ARRAY); - } else { - ClassTools.executeMethod(method, this.target, new ListChangeEvent[] {event}); - } - } - - public void itemsAdded(ListChangeEvent event) { - this.invoke(this.addMethod, event); - } - - public void itemsRemoved(ListChangeEvent event) { - this.invoke(this.removeMethod, event); - } - - public void itemsReplaced(ListChangeEvent event) { - this.invoke(this.replaceMethod, event); - } - - public void itemsMoved(ListChangeEvent event) { - this.invoke(this.moveMethod, event); - } - - public void listCleared(ListChangeEvent event) { - this.invoke(this.clearMethod, event); - } - - public void listChanged(ListChangeEvent event) { - this.invoke(this.changeMethod, event); - } - - - // ********** TreeChangeListener implementation ********** - - private void invoke(Method method, TreeChangeEvent event) { - if (method.getParameterTypes().length == 0) { - ClassTools.executeMethod(method, this.target, EMPTY_TREE_CHANGE_EVENT_ARRAY); - } else { - ClassTools.executeMethod(method, this.target, new TreeChangeEvent[] {event}); - } - } - - public void nodeAdded(TreeChangeEvent event) { - this.invoke(this.addMethod, event); - } - - public void nodeRemoved(TreeChangeEvent event) { - this.invoke(this.removeMethod, event); - } - - public void treeCleared(TreeChangeEvent event) { - this.invoke(this.clearMethod, event); - } - - public void treeChanged(TreeChangeEvent event) { - this.invoke(this.changeMethod, event); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/PropertyChangeListener.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/PropertyChangeListener.java deleted file mode 100644 index f76bed7d39..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/PropertyChangeListener.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.listener; - -import org.eclipse.jpt.utility.model.event.PropertyChangeEvent; - -/** - * A "property change" event gets fired whenever a model changes a "bound" - * property. You can register a PropertyChangeListener with a source - * model so as to be notified of any bound property updates. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface PropertyChangeListener extends ChangeListener { - - /** - * This method gets called when a model has changed a bound property. - * - * @param event A StateChangeEvent describing the event source - * and the property's old and new values. - */ - void propertyChanged(PropertyChangeEvent event); - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/ReflectiveChangeListener.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/ReflectiveChangeListener.java deleted file mode 100644 index a4f81ee657..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/ReflectiveChangeListener.java +++ /dev/null @@ -1,313 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.listener; - -import java.lang.reflect.Method; - -import org.eclipse.jpt.utility.internal.ClassTools; -import org.eclipse.jpt.utility.model.event.ChangeEvent; -import org.eclipse.jpt.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.utility.model.event.TreeChangeEvent; - -/** - * This factory builds listeners that reflectively forward ChangeEvents. - * If you are worried about having too many little classes that have to be - * loaded and maintained by the class loader, you can use one of these. - * Of course, this comes with the additional overhead of reflection.... - * Also note that the validity of the method name is not checked at compile - * time, but at runtime; although we *do* check the method as soon as the - * listener is instantiated. - * - * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public abstract class ReflectiveChangeListener { - - /** the target object on which we will invoke the method */ - protected final Object target; - - - protected static final Class<StateChangeEvent> STATE_CHANGE_EVENT_CLASS = StateChangeEvent.class; - @SuppressWarnings("unchecked") - protected static final Class<StateChangeEvent>[] STATE_CHANGE_EVENT_CLASS_ARRAY = new Class[] {STATE_CHANGE_EVENT_CLASS}; - protected static final StateChangeEvent[] EMPTY_STATE_CHANGE_EVENT_ARRAY = new StateChangeEvent[0]; - - protected static final Class<PropertyChangeEvent> PROPERTY_CHANGE_EVENT_CLASS = PropertyChangeEvent.class; - @SuppressWarnings("unchecked") - protected static final Class<PropertyChangeEvent>[] PROPERTY_CHANGE_EVENT_CLASS_ARRAY = new Class[] {PROPERTY_CHANGE_EVENT_CLASS}; - protected static final PropertyChangeEvent[] EMPTY_PROPERTY_CHANGE_EVENT_ARRAY = new PropertyChangeEvent[0]; - - protected static final Class<CollectionChangeEvent> COLLECTION_CHANGE_EVENT_CLASS = CollectionChangeEvent.class; - @SuppressWarnings("unchecked") - protected static final Class<CollectionChangeEvent>[] COLLECTION_CHANGE_EVENT_CLASS_ARRAY = new Class[] {COLLECTION_CHANGE_EVENT_CLASS}; - protected static final CollectionChangeEvent[] EMPTY_COLLECTION_CHANGE_EVENT_ARRAY = new CollectionChangeEvent[0]; - - protected static final Class<ListChangeEvent> LIST_CHANGE_EVENT_CLASS = ListChangeEvent.class; - @SuppressWarnings("unchecked") - protected static final Class<ListChangeEvent>[] LIST_CHANGE_EVENT_CLASS_ARRAY = new Class[] {LIST_CHANGE_EVENT_CLASS}; - protected static final ListChangeEvent[] EMPTY_LIST_CHANGE_EVENT_ARRAY = new ListChangeEvent[0]; - - protected static final Class<TreeChangeEvent> TREE_CHANGE_EVENT_CLASS = TreeChangeEvent.class; - @SuppressWarnings("unchecked") - protected static final Class<TreeChangeEvent>[] TREE_CHANGE_EVENT_CLASS_ARRAY = new Class[] {TREE_CHANGE_EVENT_CLASS}; - protected static final TreeChangeEvent[] EMPTY_TREE_CHANGE_EVENT_ARRAY = new TreeChangeEvent[0]; - - - - // ********** helper methods ********** - - /** - * Find and return a method implemented by the target that can be invoked - * reflectively when a change event occurs. - */ - private static Method findChangeListenerMethod(Object target, String methodName, Class<? extends ChangeEvent>[] eventClassArray) { - Method method; - try { - method = ClassTools.method(target, methodName, eventClassArray); - } catch (NoSuchMethodException ex1) { - try { - method = ClassTools.method(target, methodName); - } catch (NoSuchMethodException ex2) { - throw new RuntimeException(ex2); // "checked" exceptions bite - } - } - return method; - } - - /** - * Check whether the specified method is suitable for being invoked when a - * change event has occurred. Throw an exception if it is not suitable. - */ - private static void checkChangeListenerMethod(Method method, Class<? extends ChangeEvent> eventClass) { - Class<?>[] parmTypes = method.getParameterTypes(); - int parmTypesLength = parmTypes.length; - if (parmTypesLength == 0) { - return; - } - if ((parmTypesLength == 1) && parmTypes[0].isAssignableFrom(eventClass)) { - return; - } - throw new IllegalArgumentException(method.toString()); - } - - - // ********** factory methods: StateChangeListener ********** - - /** - * Construct a state change listener that will invoke the specified method - * on the specified target. - */ - public static StateChangeListener buildStateChangeListener(Object target, Method method) { - checkChangeListenerMethod(method, STATE_CHANGE_EVENT_CLASS); - return new SingleMethodReflectiveChangeListener(target, method); - } - - /** - * Construct a state change listener that will invoke the specified method - * on the specified target. If a single-argument method with the specified - * name and appropriate argument is found, it will be invoked; otherwise, - * a zero-argument method with the specified name will be invoked. - */ - public static StateChangeListener buildStateChangeListener(Object target, String methodName) { - return buildStateChangeListener(target, findChangeListenerMethod(target, methodName, STATE_CHANGE_EVENT_CLASS_ARRAY)); - } - - - // ********** factory methods: PropertyChangeListener ********** - - /** - * Construct a property change listener that will invoke the specified method - * on the specified target. - */ - public static PropertyChangeListener buildPropertyChangeListener(Object target, Method method) { - checkChangeListenerMethod(method, PROPERTY_CHANGE_EVENT_CLASS); - return new SingleMethodReflectiveChangeListener(target, method); - } - - /** - * Construct a property change listener that will invoke the specified method - * on the specified target. If a single-argument method with the specified - * name and appropriate argument is found, it will be invoked; otherwise, - * a zero-argument method with the specified name will be invoked. - */ - public static PropertyChangeListener buildPropertyChangeListener(Object target, String methodName) { - return buildPropertyChangeListener(target, findChangeListenerMethod(target, methodName, PROPERTY_CHANGE_EVENT_CLASS_ARRAY)); - } - - - // ********** factory methods: CollectionChangeListener ********** - - /** - * Construct a collection change listener that will invoke the specified methods - * on the specified target. - */ - public static CollectionChangeListener buildCollectionChangeListener(Object target, Method addMethod, Method removeMethod, Method clearMethod, Method changeMethod) { - checkChangeListenerMethod(addMethod, COLLECTION_CHANGE_EVENT_CLASS); - checkChangeListenerMethod(removeMethod, COLLECTION_CHANGE_EVENT_CLASS); - checkChangeListenerMethod(clearMethod, COLLECTION_CHANGE_EVENT_CLASS); - checkChangeListenerMethod(changeMethod, COLLECTION_CHANGE_EVENT_CLASS); - return new MultiMethodReflectiveChangeListener(target, addMethod, removeMethod, clearMethod, changeMethod); - } - - /** - * Construct a collection change listener that will invoke the specified method - * on the specified target for any change event. - */ - public static CollectionChangeListener buildCollectionChangeListener(Object target, Method method) { - return buildCollectionChangeListener(target, method, method, method, method); - } - - /** - * Construct a collection change listener that will invoke the specified methods - * on the specified target for change events. If a single-argument method - * with the specified name and appropriate argument is found, it will be invoked; - * otherwise, a zero-argument method with the specified name will be invoked. - */ - public static CollectionChangeListener buildCollectionChangeListener(Object target, String addMethodName, String removeMethodName, String clearMethodName, String changeMethodName) { - return buildCollectionChangeListener( - target, - findChangeListenerMethod(target, addMethodName, COLLECTION_CHANGE_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, removeMethodName, COLLECTION_CHANGE_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, clearMethodName, COLLECTION_CHANGE_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, changeMethodName, COLLECTION_CHANGE_EVENT_CLASS_ARRAY) - ); - } - - /** - * Construct a collection change listener that will invoke the specified method - * on the specified target for any change event. If a single-argument method - * with the specified name and appropriate argument is found, it will be invoked; - * otherwise, a zero-argument method with the specified name will be invoked. - */ - public static CollectionChangeListener buildCollectionChangeListener(Object target, String methodName) { - return buildCollectionChangeListener(target, findChangeListenerMethod(target, methodName, COLLECTION_CHANGE_EVENT_CLASS_ARRAY)); - } - - - // ********** factory methods: ListChangeListener ********** - - /** - * Construct a list change listener that will invoke the specified methods - * on the specified target. - */ - public static ListChangeListener buildListChangeListener(Object target, Method addMethod, Method removeMethod, Method replaceMethod, Method moveMethod, Method clearMethod, Method changeMethod) { - checkChangeListenerMethod(addMethod, LIST_CHANGE_EVENT_CLASS); - checkChangeListenerMethod(removeMethod, LIST_CHANGE_EVENT_CLASS); - checkChangeListenerMethod(replaceMethod, LIST_CHANGE_EVENT_CLASS); - checkChangeListenerMethod(moveMethod, LIST_CHANGE_EVENT_CLASS); - checkChangeListenerMethod(clearMethod, LIST_CHANGE_EVENT_CLASS); - checkChangeListenerMethod(changeMethod, LIST_CHANGE_EVENT_CLASS); - return new MultiMethodReflectiveChangeListener(target, addMethod, removeMethod, replaceMethod, moveMethod, clearMethod, changeMethod); - } - - /** - * Construct a list change listener that will invoke the specified method - * on the specified target for any change event. - */ - public static ListChangeListener buildListChangeListener(Object target, Method method) { - return buildListChangeListener(target, method, method, method, method, method, method); - } - - /** - * Construct a list change listener that will invoke the specified methods - * on the specified target for change events. If a single-argument method - * with the specified name and appropriate argument is found, it will be invoked; - * otherwise, a zero-argument method with the specified name will be invoked. - */ - public static ListChangeListener buildListChangeListener(Object target, String addMethodName, String removeMethodName, String replaceMethodName, String moveMethodName, String clearMethodName, String changeMethodName) { - return buildListChangeListener( - target, - findChangeListenerMethod(target, addMethodName, LIST_CHANGE_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, removeMethodName, LIST_CHANGE_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, replaceMethodName, LIST_CHANGE_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, moveMethodName, LIST_CHANGE_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, clearMethodName, LIST_CHANGE_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, changeMethodName, LIST_CHANGE_EVENT_CLASS_ARRAY) - ); - } - - /** - * Construct a list change listener that will invoke the specified method - * on the specified target for any change event. If a single-argument method - * with the specified name and appropriate argument is found, it will be invoked; - * otherwise, a zero-argument method with the specified name will be invoked. - */ - public static ListChangeListener buildListChangeListener(Object target, String methodName) { - return buildListChangeListener(target, findChangeListenerMethod(target, methodName, LIST_CHANGE_EVENT_CLASS_ARRAY)); - } - - - // ********** factory methods: TreeChangeListener ********** - - /** - * Construct a tree change listener that will invoke the specified methods - * on the specified target. - */ - public static TreeChangeListener buildTreeChangeListener(Object target, Method addMethod, Method removeMethod, Method clearMethod, Method changeMethod) { - checkChangeListenerMethod(addMethod, TREE_CHANGE_EVENT_CLASS); - checkChangeListenerMethod(removeMethod, TREE_CHANGE_EVENT_CLASS); - checkChangeListenerMethod(clearMethod, TREE_CHANGE_EVENT_CLASS); - checkChangeListenerMethod(changeMethod, TREE_CHANGE_EVENT_CLASS); - return new MultiMethodReflectiveChangeListener(target, addMethod, removeMethod, clearMethod, changeMethod); - } - - /** - * Construct a tree change listener that will invoke the specified method - * on the specified target for any change event. - */ - public static TreeChangeListener buildTreeChangeListener(Object target, Method method) { - return buildTreeChangeListener(target, method, method, method, method); - } - - /** - * Construct a tree change listener that will invoke the specified methods - * on the specified target for change events. If a single-argument method - * with the specified name and appropriate argument is found, it will be invoked; - * otherwise, a zero-argument method with the specified name will be invoked. - */ - public static TreeChangeListener buildTreeChangeListener(Object target, String addMethodName, String removeMethodName, String clearMethodName, String changeMethodName) { - return buildTreeChangeListener( - target, - findChangeListenerMethod(target, addMethodName, TREE_CHANGE_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, removeMethodName, TREE_CHANGE_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, clearMethodName, TREE_CHANGE_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, changeMethodName, TREE_CHANGE_EVENT_CLASS_ARRAY) - ); - } - - /** - * Construct a tree change listener that will invoke the specified method - * on the specified target for any change event. If a single-argument method - * with the specified name and appropriate argument is found, it will be invoked; - * otherwise, a zero-argument method with the specified name will be invoked. - */ - public static TreeChangeListener buildTreeChangeListener(Object target, String methodName) { - return buildTreeChangeListener(target, findChangeListenerMethod(target, methodName, TREE_CHANGE_EVENT_CLASS_ARRAY)); - } - - - // ********** constructor ********** - - /** - * Construct a listener that will invoke the specified method - * on the specified target. - */ - protected ReflectiveChangeListener(Object target) { - super(); - this.target = target; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/SingleMethodReflectiveChangeListener.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/SingleMethodReflectiveChangeListener.java deleted file mode 100644 index b7cc753aa2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/SingleMethodReflectiveChangeListener.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.listener; - -import java.lang.reflect.Method; - -import org.eclipse.jpt.utility.internal.ClassTools; -import org.eclipse.jpt.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.utility.model.event.StateChangeEvent; - -/** - * This class is used by ReflectiveChangeListener when the requested listener - * need only implement a single method (i.e. StateChangeListener or - * PropertyChangeListener). - */ -class SingleMethodReflectiveChangeListener - extends ReflectiveChangeListener - implements StateChangeListener, PropertyChangeListener -{ - - /** the method we will invoke on the target object */ - private final Method method; - /** cache the number of arguments */ - private final boolean methodIsZeroArgument; - - SingleMethodReflectiveChangeListener(Object target, Method method) { - super(target); - this.method = method; - this.methodIsZeroArgument = method.getParameterTypes().length == 0; - } - - - // ********** StateChangeListener implementation ********** - - public void stateChanged(StateChangeEvent event) { - if (this.methodIsZeroArgument) { - ClassTools.executeMethod(this.method, this.target, EMPTY_STATE_CHANGE_EVENT_ARRAY); - } else { - ClassTools.executeMethod(this.method, this.target, new StateChangeEvent[] {event}); - } - } - - - // ********** PropertyChangeListener implementation ********** - - public void propertyChanged(PropertyChangeEvent event) { - if (this.methodIsZeroArgument) { - ClassTools.executeMethod(this.method, this.target, EMPTY_PROPERTY_CHANGE_EVENT_ARRAY); - } else { - ClassTools.executeMethod(this.method, this.target, new PropertyChangeEvent[] {event}); - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/StateChangeListener.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/StateChangeListener.java deleted file mode 100644 index 1ce6ba5d69..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/StateChangeListener.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.listener; - -import org.eclipse.jpt.utility.model.event.StateChangeEvent; - -/** - * A generic "state change" event gets delivered whenever a model changes to - * such extent that it cannot be delineated all aspects of it that have changed. - * You can register a StateChangeListener with a source model so as to be notified - * of any such changes. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface StateChangeListener extends ChangeListener { - - /** - * This method gets called when a model has changed in some general fashion. - * - * @param event A StateChangeEvent describing the event source. - */ - void stateChanged(StateChangeEvent event); - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/TreeChangeAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/TreeChangeAdapter.java deleted file mode 100644 index 3b46202fd1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/TreeChangeAdapter.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.listener; - -import org.eclipse.jpt.utility.model.event.TreeChangeEvent; - -/** - * Convenience implementation of TreeChangeListener. - * - * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public class TreeChangeAdapter implements TreeChangeListener { - - /** - * Default constructor. - */ - public TreeChangeAdapter() { - super(); - } - - public void nodeAdded(TreeChangeEvent event) { - // do nothing - } - - public void nodeRemoved(TreeChangeEvent event) { - // do nothing - } - - public void treeCleared(TreeChangeEvent event) { - // do nothing - } - - public void treeChanged(TreeChangeEvent event) { - // do nothing - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/TreeChangeListener.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/TreeChangeListener.java deleted file mode 100644 index 7591f9df78..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/listener/TreeChangeListener.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.listener; - -import org.eclipse.jpt.utility.model.event.TreeChangeEvent; - -/** - * A "tree change" event gets fired whenever a model changes a "bound" - * tree. You can register a TreeChangeListener with a source - * model so as to be notified of any bound tree updates. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface TreeChangeListener extends ChangeListener { - - /** - * This method gets called when a node is added to a bound tree. - * - * @param event A TreeChangeEvent describing the event source, - * the tree that changed, and the path to the node that was added. - */ - void nodeAdded(TreeChangeEvent event); - - /** - * This method gets called when a node is removed from a bound tree. - * - * @param event A TreeChangeEvent describing the event source, - * the tree that changed, and the path to the node that was removed. - */ - void nodeRemoved(TreeChangeEvent event); - - /** - * This method gets called when a bound tree is cleared. - * - * @param event A TreeChangeEvent describing the event source, - * the tree that changed, and an empty path. - */ - void treeCleared(TreeChangeEvent event); - - /** - * This method gets called when a portion of a bound tree is changed in - * a manner that is not easily characterized by the other methods in this - * interface. - * - * @param event A TreeChangeEvent describing the event source, - * the tree that changed, and the path to the branch of the - * tree that changed. - */ - void treeChanged(TreeChangeEvent event); - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/value/CollectionValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/value/CollectionValueModel.java deleted file mode 100644 index dfa8377b3e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/value/CollectionValueModel.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.value; - -import java.util.Iterator; - -import org.eclipse.jpt.utility.model.Model; - -/** - * Interface used to abstract collection accessing and - * change notification and make it more pluggable. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface CollectionValueModel<E> - extends Model, Iterable<E> -{ - - /** - * Return the collection's values. - */ - Iterator<E> iterator(); - String VALUES = "values"; - - /** - * Return the size of the collection value. - */ - int size(); - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/value/ListValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/value/ListValueModel.java deleted file mode 100644 index 013504fbbb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/value/ListValueModel.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.value; - -import java.util.Iterator; -import java.util.ListIterator; - -import org.eclipse.jpt.utility.model.Model; - -/** - * Interface used to abstract list accessing and - * change notification and make it more pluggable. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ListValueModel<E> - extends Model, Iterable<E> -{ - /** - * Return the list's values. - */ - Iterator<E> iterator(); - String LIST_VALUES = "list values"; - - /** - * Return the list's values. - */ - ListIterator<E> listIterator(); - - /** - * Return the size of the list. - */ - int size(); - - /** - * Return the item at the specified index of the list. - */ - E get(int index); - - /** - * Return the list's values. - */ - Object[] toArray(); - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/value/PropertyValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/value/PropertyValueModel.java deleted file mode 100644 index 82ee3c0096..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/value/PropertyValueModel.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.value; - -import org.eclipse.jpt.utility.model.Model; - -/** - * Interface used to abstract property accessing and - * change notification and make it more pluggable. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface PropertyValueModel<T> - extends Model -{ - - /** - * Return the property's value. - */ - T getValue(); - String VALUE = "value"; - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/value/TreeNodeValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/value/TreeNodeValueModel.java deleted file mode 100644 index a6bcea8cdf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/value/TreeNodeValueModel.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.value; - -/** - * Extend WritablePropertyValueModel to better support TreeModelAdapter. - * - * Implementors of this interface should fire a "state change" event - * whenever the node's internal state changes in a way that the - * tree listeners should be notified. - * - * Implementors of this interface should also fire a "value property change" - * event whenever the node's value changes. Typically, only nodes that - * hold "primitive" data will fire this event. - * - * @see org.eclipse.jpt.utility.internal.model.value.AbstractTreeNodeValueModel - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface TreeNodeValueModel<T> - extends WritablePropertyValueModel<T> -{ - - /** - * Return the node's parent node; null if the node - * is the root. - */ - TreeNodeValueModel<T> parent(); - - /** - * Return the path to the node. - */ - TreeNodeValueModel<T>[] path(); - - /** - * Return a list value model of the node's child nodes. - */ - ListValueModel<TreeNodeValueModel<T>> childrenModel(); - - /** - * Return the node's child at the specified index. - */ - TreeNodeValueModel<T> child(int index); - - /** - * Return the size of the node's list of children. - */ - int childrenSize(); - - /** - * Return the index in the node's list of children of the specified child. - */ - int indexOfChild(TreeNodeValueModel<T> child); - - /** - * Return whether the node is a leaf (i.e. it has no children) - */ - boolean isLeaf(); - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/value/TreeValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/value/TreeValueModel.java deleted file mode 100644 index a76542525a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/value/TreeValueModel.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.value; - -import java.util.Iterator; - -import org.eclipse.jpt.utility.model.Model; - -/** - * Interface used to abstract tree accessing and - * change notification and make it more pluggable. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface TreeValueModel<E> - extends Model -{ - /** - * Return the tree's nodes. - */ - Iterator<E> nodes(); - String NODES = "nodes"; - -} diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/value/WritablePropertyValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/value/WritablePropertyValueModel.java deleted file mode 100644 index c2ddacebe4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/model/value/WritablePropertyValueModel.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. 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: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.utility.model.value; - -/** - * Extend ValueModel to allow the setting of the property's value. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface WritablePropertyValueModel<T> - extends PropertyValueModel<T> -{ - - /** - * Set the value and fire a property change notification. - * @see PropertyValueModel#VALUE - */ - void setValue(T value); - -} |