diff options
Diffstat (limited to 'bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree')
15 files changed, 0 insertions, 980 deletions
diff --git a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/AbstractObservableTree.java b/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/AbstractObservableTree.java deleted file mode 100644 index e1226c9df2b..00000000000 --- a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/AbstractObservableTree.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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 - * Brad Reynolds - bug 164134 - *******************************************************************************/ - -package org.eclipse.core.internal.databinding.observable.tree; - -import org.eclipse.core.databinding.observable.AbstractObservable; -import org.eclipse.core.databinding.observable.Realm; -import org.eclipse.core.databinding.util.Policy; -import org.eclipse.core.internal.databinding.BindingMessages; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.ListenerList; -import org.eclipse.core.runtime.Status; - -/** - * @since 3.3 - * - */ -public abstract class AbstractObservableTree extends AbstractObservable - implements IObservableTree { - - private boolean stale; - - private ListenerList treeListeners = new ListenerList(ListenerList.IDENTITY); - - /** - * @param realm - */ - public AbstractObservableTree(Realm realm) { - super(realm); - } - - public void addChild(TreePath parentPath, Object childElement) { - throw new UnsupportedOperationException(); - } - - public void addTreeChangeListener(ITreeChangeListener listener) { - treeListeners.add(listener); - } - - public int getChildCount(TreePath parentPath) { - return getChildren(parentPath).length; - } - - public boolean hasChildren(TreePath parentPath) { - return getChildCount(parentPath) > 0; - } - - public void insertChild(TreePath parentPath, int index, Object childElement) { - throw new UnsupportedOperationException(); - } - - public boolean isLazy() { - return false; - } - - public boolean isOrdered() { - return false; - } - - public void removeChild(TreePath parentPath, Object childElement) { - throw new UnsupportedOperationException(); - } - - public void removeChild(TreePath parentPath, int index) { - throw new UnsupportedOperationException(); - } - - public void removeTreeChangeListener(ITreeChangeListener listener) { - treeListeners.remove(listener); - } - - public void setChildCount(TreePath parentPath, int count) { - throw new UnsupportedOperationException(); - } - - public void setChildren(TreePath parentPath, Object[] children) { - throw new UnsupportedOperationException(); - } - - public void updateChildren(IChildrenUpdate update) { - TreePath parent = update.getParent(); - Object[] children = getChildren(parent); - for (int i = 0; i < update.getLength(); i++) { - int targetIndex = update.getOffset() + i; - if (targetIndex < children.length) { - update.setChild(children[targetIndex], targetIndex); - } else { - update - .setStatus(new Status( - IStatus.WARNING, - Policy.JFACE_DATABINDING, - IStatus.OK, - BindingMessages - .getString(BindingMessages.INDEX_OUT_OF_RANGE), - null)); - } - } - update.done(); - } - - public void updateChildrenCount(IChildrenCountUpdate update) { - TreePath[] parents = update.getParents(); - for (int i = 0; i < parents.length; i++) { - update.setChildCount(parents[i], getChildCount(parents[i])); - } - update.done(); - } - - public void updateHasChildren(IHasChildrenUpdate update) { - TreePath[] parents = update.getElements(); - for (int i = 0; i < parents.length; i++) { - update.setHasChilren(parents[i], hasChildren(parents[i])); - } - update.done(); - } - - public boolean isStale() { - return stale; - } - - /** - * @param stale - */ - public void setStale(boolean stale) { - this.stale = stale; - if (stale) { - fireStale(); - } - } - - protected void fireTreeChange(TreeDiff diff) { - // fire general change event first - fireChange(); - - Object[] listeners = treeListeners.getListeners(); - TreeChangeEvent event = new TreeChangeEvent(this, diff); - for (int i = 0; i < listeners.length; i++) { - ((ITreeChangeListener) listeners[i]).handleTreeChange(event); - } - } - -} diff --git a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IChildrenCountUpdate.java b/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IChildrenCountUpdate.java deleted file mode 100644 index 331176a99bf..00000000000 --- a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IChildrenCountUpdate.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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.core.internal.databinding.observable.tree; - -/** - * Request monitor used to collect the number of children for an element in a lazy - * observable tree. - * - * @since 3.3 - */ -public interface IChildrenCountUpdate extends IViewerUpdate { - - /** - * Returns the parent elements that children counts have been requested for - * as tree paths. An empty path identifies the root element. - * - * @return parent elements as tree paths - */ - public TreePath[] getParents(); - - /** - * Sets the number of children for the given parent. - * - * @param parentPath - * parent element or empty path for root element - * @param numChildren - * number of children - */ - public void setChildCount(TreePath parentPath, int numChildren); -} diff --git a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IChildrenUpdate.java b/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IChildrenUpdate.java deleted file mode 100644 index 8d4b961e531..00000000000 --- a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IChildrenUpdate.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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.core.internal.databinding.observable.tree; - -/** - * Context sensitive children update request for a parent and subrange of its - * children. - * - * @since 3.3 - */ -public interface IChildrenUpdate extends IViewerUpdate { - - /** - * Returns the parent element that children are being requested for - * as a tree path. An empty path identifies the root element. - * - * @return parent element as a tree path - */ - public TreePath getParent(); - - /** - * Returns the offset at which children have been requested for. This is - * the index of the first child being requested. - * - * @return offset at which children have been requested for - */ - public int getOffset(); - - /** - * Returns the number of children requested. - * - * @return number of children requested - */ - public int getLength(); - - /** - * Sets the child for this request's parent at the given offset. - * - * @param child child - * @param index child offset - * - * TODO: what to do with <code>null</code> - */ - public void setChild(Object child, int index); -} diff --git a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IHasChildrenUpdate.java b/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IHasChildrenUpdate.java deleted file mode 100644 index f3eadd65df9..00000000000 --- a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IHasChildrenUpdate.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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.core.internal.databinding.observable.tree; - -/** - * Context sensitive update request for whether elements have children. - * - * @since 3.3 - */ -public interface IHasChildrenUpdate extends IViewerUpdate { - - /** - * The elements this request is for specified as tree paths. An empty path - * identifies the root element. - * - * @return elements as tree paths - */ - public TreePath[] getElements(); - - /** - * Sets whether the given element has children. - * - * @param element - * tree path to element, or empty for root element - * @param hasChildren - * whether it has children - */ - public void setHasChilren(TreePath element, boolean hasChildren); -} diff --git a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IObservableTree.java b/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IObservableTree.java deleted file mode 100644 index a877452863b..00000000000 --- a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IObservableTree.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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.core.internal.databinding.observable.tree; - -import org.eclipse.core.databinding.observable.IObservable; - -/** - * - * A tree whose changes can be tracked by tree change listeners. If the tree is - * ordered ({@link #isOrdered()}), the order of children for a given tree path - * matters, and tree change notifications will always specify indices. If the - * tree is unordered, the children of a tree path are an unordered set and - * indices in change notifications are not specified. - * - * <p> - * This interface is not intended to be implemented by clients. Clients should - * instead subclass one of the framework classes that implement this interface. - * Note that direct implementers of this interface outside of the framework will - * be broken in future releases when methods are added to this interface. - * </p> - * - * @since 1.1 - */ -public interface IObservableTree extends IObservable { - - /** - * Element that can be returned from synchronous getters if this observable - * tree is lazy. - */ - public final static Object UNKNOWN_ELEMENT = new Object(); - - /** - * @param listener - */ - public void addTreeChangeListener(ITreeChangeListener listener); - - /** - * @param listener - */ - public void removeTreeChangeListener(ITreeChangeListener listener); - - /** - * Returns whether the order of children for a given parent is important. If - * this tree is ordered, tree change notifications will always specify - * indices. - * - * @return true if the order of children for a given parent is important - */ - public boolean isOrdered(); - - /** - * Returns whether this tree is optimized to fetch subsets of children - * lazily and possibly asynchronously. Implies {@link #isOrdered()}. - * - * @return true if this tree - */ - public boolean isLazy(); - - /** - * @param parentPath - * @return the children at the given parent path - */ - public Object[] getChildren(TreePath parentPath); - - /** - * @param parentPath - * @param children - */ - public void setChildren(TreePath parentPath, Object[] children); - - /** - * @param parentPath - * @param childElement - */ - public void addChild(TreePath parentPath, Object childElement); - - /** - * @param parentPath - * @param childElement - */ - public void removeChild(TreePath parentPath, Object childElement); - - /** - * @param parentPath - * @param index - * @param childElement - */ - public void insertChild(TreePath parentPath, int index, Object childElement); - - /** - * @param parentPath - * @param index - */ - public void removeChild(TreePath parentPath, int index); - - /** - * @param parentPath - * @return <code>true</code> if the element at the given path has children - */ - public boolean hasChildren(TreePath parentPath); - - /** - * @param parentPath - * @return the number of children of the element at the given path - */ - public int getChildCount(TreePath parentPath); - - /** - * @param parentPath - * @param count - */ - public void setChildCount(TreePath parentPath, int count); - - /** - * Updates the number of children for the given parent elements in the - * specified request. - * - * @param update specifies counts to update and stores result - */ - public void updateChildrenCount(IChildrenCountUpdate update); - - /** - * Updates children as requested by the update. - * - * @param update specifies children to update and stores result - */ - public void updateChildren(IChildrenUpdate update); - - /** - * Updates whether elements have children. - * - * @param update specifies elements to update and stores result - */ - public void updateHasChildren(IHasChildrenUpdate update); - -} diff --git a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IOrderedTreeProvider.java b/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IOrderedTreeProvider.java deleted file mode 100644 index f60d56110ea..00000000000 --- a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IOrderedTreeProvider.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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.core.internal.databinding.observable.tree; - -import org.eclipse.core.databinding.observable.Realm; -import org.eclipse.core.databinding.observable.list.IObservableList; - -/** - * Objects that implement this interface are capable of describing a tree by - * returning the list of children of any given element in the tree. - * - * @since 3.3 - */ -public interface IOrderedTreeProvider { - /** - * Returns the children of the given element, or null if the element is a - * leaf node. The caller of this method is expected to dispose the result - * list when it is no longer needed. - * - * @param element - * the tree path of the element to query - * @return the children of the given element, or null if the element is a - * leaf node - */ - IObservableList createChildList(TreePath element); - - /** - * @return the realm shared by all child lists - */ - Realm getRealm(); -} diff --git a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/ITreeChangeListener.java b/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/ITreeChangeListener.java deleted file mode 100644 index 8fe9f8f550c..00000000000 --- a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/ITreeChangeListener.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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.core.internal.databinding.observable.tree; - -/** - * @since 3.3 - * - */ -public interface ITreeChangeListener { - /** - * @param event - */ - void handleTreeChange(TreeChangeEvent event); - -} diff --git a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IUnorderedTreeProvider.java b/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IUnorderedTreeProvider.java deleted file mode 100644 index 81941c804cb..00000000000 --- a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IUnorderedTreeProvider.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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.core.internal.databinding.observable.tree; - -import org.eclipse.core.databinding.observable.Realm; -import org.eclipse.core.databinding.observable.set.IObservableSet; - -/** - * @since 1.0 - * - */ -public interface IUnorderedTreeProvider { - /** - * @return the realm for the createChildSet method - */ - public Realm getRealm(); - - /** - * Returns the children of the given element, or null if the element is a leaf node. - * The caller of this method is expected to dispose the result set when it is no - * longer needed. - * - * @param element element to query - * @return the children of the given element, or null if the element is a leaf node - */ - IObservableSet createChildSet(Object element); -} diff --git a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IViewerUpdate.java b/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IViewerUpdate.java deleted file mode 100644 index 26cadab4972..00000000000 --- a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/IViewerUpdate.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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.core.internal.databinding.observable.tree; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; - -/** - * A context sensitive viewer update request. - * - * @since 3.3 - */ -public interface IViewerUpdate extends IProgressMonitor { - - /** - * Sets the status of this request, possibly <code>null</code>. - * When a request fails, the status indicates why the request failed. - * A <code>null</code> status is considered to be successful. - * - * @param status request status - */ - public void setStatus(IStatus status); - - /** - * Returns the status of this request, or <code>null</code>. - * - * @return request status or <code>null</code> - */ - public IStatus getStatus(); - - /** - * Returns the model element corresponding to the given tree path. - * Returns the root element for the empty path. - * - * @param path viewer tree path - * @return corresponding model element - */ - public Object getElement(TreePath path); -} diff --git a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreeChangeEvent.java b/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreeChangeEvent.java deleted file mode 100644 index b5051d5ec53..00000000000 --- a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreeChangeEvent.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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.core.internal.databinding.observable.tree; - -import java.util.EventObject; - -/** - * @since 3.3 - * - */ -public class TreeChangeEvent extends EventObject { - - /** - * - */ - private static final long serialVersionUID = -3198503763995528027L; - /** - * - */ - public TreeDiff diff; - - /** - * @param source - * @param diff - */ - public TreeChangeEvent(IObservableTree source, TreeDiff diff) { - super(source); - this.diff = diff; - } - - /** - * @return the observable tree from which this event originated - */ - public IObservableTree getObservable() { - return (IObservableTree) getSource(); - } - -} diff --git a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreeDiff.java b/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreeDiff.java deleted file mode 100644 index 7c419ea58dd..00000000000 --- a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreeDiff.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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.core.internal.databinding.observable.tree; - -/** - * Describes the difference between two trees as a tree of tree diff nodes. - * - * @since 1.1 - * - */ -public abstract class TreeDiff extends TreeDiffNode { - - /** - * Returns the tree path (possibly empty) of the parent, or - * <code>null</code> if the underlying tree is not lazy and never contains - * duplicate elements. - * - * @return the tree path (possibly empty) of the unchanged parent, or - * <code>null</code> - */ - public abstract TreePath getParentPath(); - - /** - * @param visitor - */ - public void accept(TreeDiffVisitor visitor) { - doAccept(visitor, getParentPath()); - } - -} diff --git a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreeDiffNode.java b/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreeDiffNode.java deleted file mode 100644 index a8b8b8d9a90..00000000000 --- a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreeDiffNode.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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.core.internal.databinding.observable.tree; - -/** - * @since 1.1 - * - */ -public abstract class TreeDiffNode { - - /** - * - */ - public final static int NO_CHANGE = 0x00; - - /** - * - */ - public final static int ADDED = 0x01; - - /** - * - */ - public final static int REMOVED = 0x02; - - /** - * - */ - public final static int REPLACED = 0x03; - - /** - * - */ - public static final TreeDiffNode[] NO_CHILDREN = new TreeDiffNode[0]; - - /** - * - */ - public static final int INDEX_UNKNOWN = -1; - - /** - * @return the change type - */ - public abstract int getChangeType(); - - /** - * @return the element that was removed, or the replaced element - */ - public abstract Object getOldElement(); - - /** - * @return the element that was not changed, added, or the replacement - * element - */ - public abstract Object getNewElement(); - - /** - * @return the index at which the element was added, removed, or replaced - */ - public abstract int getIndex(); - - /** - * Returns the child tree diff objects that describe changes to children. If - * the change type is REMOVED, there will be no children. - * - * @return the nodes representing changes to children - */ - public abstract TreeDiffNode[] getChildren(); - - protected void doAccept(TreeDiffVisitor visitor, TreePath parentPath) { - TreePath currentPath = parentPath.createChildPath(getNewElement()); - boolean recurse = visitor.visit(this, currentPath); - if (recurse) { - TreeDiffNode[] children = getChildren(); - for (int i = 0; i < children.length; i++) { - TreeDiffNode child = children[i]; - child.doAccept(visitor, currentPath); - } - } - } - -} diff --git a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreeDiffVisitor.java b/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreeDiffVisitor.java deleted file mode 100644 index 837464dc953..00000000000 --- a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreeDiffVisitor.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 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.core.internal.databinding.observable.tree; - -/** - * @since 3.3 - * - */ -public abstract class TreeDiffVisitor { - - /** - * Visits the given tree diff. - * - * @param diff - * the diff to visit - * @param currentPath - * the current path (the diff's element is the last segment of - * the path) - * - * @return <code>true</code> if the tree diff's children should be - * visited; <code>false</code> if they should be skipped. - */ - public abstract boolean visit(TreeDiffNode diff, TreePath currentPath); -} diff --git a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreePath.java b/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreePath.java deleted file mode 100644 index 99e987c1d87..00000000000 --- a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/TreePath.java +++ /dev/null @@ -1,183 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2008 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 - * Matthew Hall - bug 118516 - *******************************************************************************/ -package org.eclipse.core.internal.databinding.observable.tree; - -import org.eclipse.core.runtime.Assert; - -/** - * A tree path denotes a model element in a tree viewer. Tree path objects have - * value semantics. A model element is represented by a path of elements in the - * tree from the root element to the leaf element. - * <p> - * Clients may instantiate this class. Not intended to be subclassed. - * </p> - * - * @since 3.2 - */ -public final class TreePath { - - /** - * Constant for representing an empty tree path. - */ - public static final TreePath EMPTY = new TreePath(new Object[0]); - - private Object[] segments; - - private int hash; - - /** - * Constructs a path identifying a leaf node in a tree. - * - * @param segments - * path of elements to a leaf node in a tree, starting with the - * root element - */ - public TreePath(Object[] segments) { - Assert.isNotNull(segments, "Segments array cannot be null"); //$NON-NLS-1$ - this.segments = new Object[segments.length]; - for (int i = 0; i < segments.length; i++) { - Assert.isNotNull(segments[i], "Segments array cannot contain null"); //$NON-NLS-1$ - this.segments[i] = segments[i]; - } - } - - /** - * Returns the element at the specified index in this path. - * - * @param index - * index of element to return - * @return element at the specified index - */ - public Object getSegment(int index) { - return segments[index]; - } - - /** - * Returns the number of elements in this path. - * - * @return the number of elements in this path - */ - public int getSegmentCount() { - return segments.length; - } - - /** - * Returns the first element in this path. - * - * @return the first element in this path - */ - public Object getFirstSegment() { - if (segments.length == 0) { - return null; - } - return segments[0]; - } - - /** - * Returns the last element in this path. - * - * @return the last element in this path - */ - public Object getLastSegment() { - if (segments.length == 0) { - return null; - } - return segments[segments.length - 1]; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object other) { - if (!(other instanceof TreePath)) { - return false; - } - TreePath otherPath = (TreePath) other; - if (segments.length != otherPath.segments.length) { - return false; - } - for (int i = 0; i < segments.length; i++) { - if (!segments[i].equals(otherPath.segments[i])) { - return false; - } - } - return true; - } - - public int hashCode() { - if (hash == 0) { - for (int i = 0; i < segments.length; i++) { - hash += segments[i].hashCode(); - } - } - return hash; - } - - /** - * Returns whether this path starts with the same segments as the given - * path, using the given comparer to compare segments. - * - * @param treePath - * path to compare to - * @return whether the given path is a prefix of this path, or the same as - * this path - */ - public boolean startsWith(TreePath treePath) { - int thisSegmentCount = getSegmentCount(); - int otherSegmentCount = treePath.getSegmentCount(); - if (otherSegmentCount == thisSegmentCount) { - return equals(treePath); - } - if (otherSegmentCount > thisSegmentCount) { - return false; - } - for (int i = 0; i < otherSegmentCount; i++) { - Object otherSegment = treePath.getSegment(i); - if (!otherSegment.equals(segments[i])) { - return false; - } - } - return true; - } - - /** - * Returns a copy of this tree path with one segment removed from the end, - * or <code>null</code> if this tree path has no segments. - * @return a tree path - */ - public TreePath getParentPath() { - int segmentCount = getSegmentCount(); - if (segmentCount <= 1) { - return null; - } - Object[] parentSegments = new Object[segmentCount - 1]; - System.arraycopy(segments, 0, parentSegments, 0, segmentCount - 1); - return new TreePath(parentSegments); - } - - /** - * Returns a copy of this tree path with the given segment added at the end. - * @param newSegment - * @return a tree path - */ - public TreePath createChildPath(Object newSegment) { - int segmentCount = getSegmentCount(); - Object[] childSegments = new Object[segmentCount + 1]; - if(segmentCount>0) { - System.arraycopy(segments, 0, childSegments, 0, segmentCount); - } - childSegments[segmentCount] = newSegment; - return new TreePath(childSegments); - } -} diff --git a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/package.html b/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/package.html deleted file mode 100644 index d720e2b4b32..00000000000 --- a/bundles/org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/observable/tree/package.html +++ /dev/null @@ -1,16 +0,0 @@ -<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> - <meta name="Author" content="IBM"> - <meta name="GENERATOR" content="Mozilla/4.5 [en] (Win98; I) [Netscape]"> - <title>Package-level Javadoc</title> -</head> -<body> -To be written. -<h2> -Package Specification</h2> -<p> -This package provides classes that can be used to ...</p> -</body> -</html> |