cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r442563 [2/3] - in /incubator/cayenne/soc/trunk/cayenne-rop/rop-browser: ./ src/org/apache/cayenne/ropbrowser/ src/org/apache/cayenne/ropbrowser/actions/ src/org/apache/cayenne/ropbrowser/commands/ src/org/apache/cayenne/ropbrowser/figures/...
Date Tue, 12 Sep 2006 11:28:54 GMT
Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/CollectionModelElement.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/CollectionModelElement.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/CollectionModelElement.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/CollectionModelElement.java Tue Sep 12 04:28:51 2006
@@ -22,8 +22,6 @@
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.cayenne.util.PersistentObjectList;
-
 
 /**
  * Class representing a collection of AbstractObjects.
@@ -52,29 +50,23 @@
 		}
 				
 		public int compare(AbstractObject arg0, AbstractObject arg1) {
-			if (arg0 == null) {
+			if (arg0 == null)
 				return -1;
-			}
-			if (arg1 == null) {
+			if (arg1 == null)
 				return 1;
-			}
 			
-			Object value0 = arg0.getPropertyValueRaw(sortName);
-			Object value1 = arg1.getPropertyValueRaw(sortName);
+			Object value0 = arg0.getPropertyValueRaw(this.sortName);
+			Object value1 = arg1.getPropertyValueRaw(this.sortName);
 			
-			if (value0 == null) {
+			if (value0 == null)
 				return -1;
-			}
-			if (value1 == null) {
+			if (value1 == null)
 				return 1;
-			}
 			
-			if (!arg0.getClass().equals(arg1.getClass())) {
-				return value0.toString().compareTo(value1.toString()); 
-			}
-			if (value0 instanceof Comparable) {
+			if (!arg0.getClass().equals(arg1.getClass()))
+				return value0.toString().compareTo(value1.toString());
+			if (value0 instanceof Comparable)
 				return ((Comparable) value0).compareTo(value1);
-			}
 			return value0.toString().compareTo(value1.toString());
 		}
 	}
@@ -113,34 +105,33 @@
 	
 	@Override
 	public void addObject(AbstractObject object) {
-		if (!objects.contains(object)) {
-			objects.add(object);
+		if (!this.objects.contains(object)) {
+			this.objects.add(object);
 			for (Connection conn : getTargetConnections()) {
 				if (conn instanceof RelationshipConnection) {
 					RelationshipConnection relConn = (RelationshipConnection) conn;
 					// notify objectContext about simple property change
-					relConn.getSource().getCurrentObject().getObjectContext().propertyChanged(relConn.getSource().getCurrentObject(), relConn.getRelationship().getName(), null, objects);
+					relConn.getSource().getCurrentObject().getObjectContext().propertyChanged(relConn.getSource().getCurrentObject(), relConn.getRelationship().getName(), null, this.objects);
 				}
 			}
 			object.addPropertyChangeListener(this);
 			getDiagram().createMemberConnections(this, object);
-			firePropertyChange(PROP_TOTAL_RECORDS, null, objects);
-			firePropertyChange(PROP_RECORDS, null, objects);
+			firePropertyChange(PROP_TOTAL_RECORDS, null, this.objects);
+			firePropertyChange(PROP_RECORDS, null, this.objects);
 			validateCurrent();
 		}
 	}
 
 	@Override
 	public boolean contains(AbstractObject object) {
-		if (objects == null) {
+		if (this.objects == null)
 			return false;
-		}
-		return objects.contains(object);
+		return this.objects.contains(object);
 	}
 
 	@Override
 	public AbstractObject getCurrentObject() {
-		return current;
+		return this.current;
 	}
 
 	/**
@@ -149,8 +140,8 @@
 	 * @return an iterator over the objects in order
 	 */
 	public Iterator<AbstractObject> getSortedObjectIterator(String sortAttribute) {
-		if (objects != null) {
-			List<AbstractObject> copyObjects = new ArrayList<AbstractObject>(objects);
+		if (this.objects != null) {
+			List<AbstractObject> copyObjects = new ArrayList<AbstractObject>(this.objects);
 			Collections.sort(copyObjects, new AbstractObjectComparator(sortAttribute));
 			return copyObjects.iterator();
 		}
@@ -159,38 +150,33 @@
 	
 	@Override
 	public Object getPropertyValue(Object id) {
-		if (id.toString().equals(PROP_CURRENT_RECORD)) {
-			return Integer.toString(currentRecord);
-		}
-		if (id.toString().equals(PROP_TOTAL_RECORDS)) {
-			return Integer.toString(objects.size());
-		}
+		if (id.toString().equals(PROP_CURRENT_RECORD))
+			return Integer.toString(this.currentRecord);
+		if (id.toString().equals(PROP_TOTAL_RECORDS))
+			return Integer.toString(this.objects.size());
 		return super.getPropertyValue(id);
 	}
 	
 	@Override
 	public boolean isContextless() {
-		for (AbstractObject object : objects) {
-			if (object.getObjectContext() != null) {
+		for (AbstractObject object : this.objects) {
+			if (object.getObjectContext() != null)
 				return false;
-			}
 		}
 		return !isNull();
 	}
 
 	@Override
 	public boolean isNull() {
-		return (objects == null || objects.isEmpty());
+		return (this.objects == null || this.objects.isEmpty());
 	}
 
 	@Override
 	public boolean isPropertySet(Object id) {
-		if (id.toString().equals(PROP_CURRENT_RECORD)) {
+		if (id.toString().equals(PROP_CURRENT_RECORD))
 			return true;
-		}
-		if (id.toString().equals(PROP_TOTAL_RECORDS)) {
+		if (id.toString().equals(PROP_TOTAL_RECORDS))
 			return true;
-		}
 		return super.isPropertySet(id);
 	}
 	
@@ -199,17 +185,17 @@
 	 * end is reached.
 	 */
 	public void next() {
-		if (objects != null && !objects.isEmpty()) {
-			int oldCurrent = currentRecord;
+		if (this.objects != null && !this.objects.isEmpty()) {
+			int oldCurrent = this.currentRecord;
 			
-			if (currentRecord == objects.size() - 1) {
-				currentRecord = 0;
+			if (this.currentRecord == this.objects.size() - 1) {
+				this.currentRecord = 0;
 			}
 			else {
-				currentRecord++;
+				this.currentRecord++;
 			}
-			current = objects.get(currentRecord);
-			firePropertyChange(PROP_CURRENT_RECORD, new Integer(oldCurrent), new Integer(currentRecord));
+			this.current = this.objects.get(this.currentRecord);
+			firePropertyChange(PROP_CURRENT_RECORD, new Integer(oldCurrent), new Integer(this.currentRecord));
 		}
 	}
 
@@ -218,25 +204,25 @@
 	 * start is reached.
 	 */
 	public void previous() {
-		if (objects != null && !objects.isEmpty()) {
-			int oldCurrent = currentRecord;
+		if (this.objects != null && !this.objects.isEmpty()) {
+			int oldCurrent = this.currentRecord;
 		
-			if (currentRecord == 0) {
-				currentRecord = objects.size() - 1;
+			if (this.currentRecord == 0) {
+				this.currentRecord = this.objects.size() - 1;
 			}
 			else {
-				currentRecord--;
+				this.currentRecord--;
 			}
-			current = objects.get(currentRecord);
-			firePropertyChange(PROP_CURRENT_RECORD, new Integer(oldCurrent), new Integer(currentRecord));
+			this.current = this.objects.get(this.currentRecord);
+			firePropertyChange(PROP_CURRENT_RECORD, new Integer(oldCurrent), new Integer(this.currentRecord));
 		}
 	}
 	
 	@Override
 	public void removeDeletedObjects() {
-		if (objects != null) {
+		if (this.objects != null) {
 			ArrayList<AbstractObject> deleted = new ArrayList<AbstractObject>();
-			for (AbstractObject object : objects) {
+			for (AbstractObject object : this.objects) {
 				if (object.isDeleted()) {
 					deleted.add(object);
 				}
@@ -249,8 +235,8 @@
 
 	@Override
 	public void removeObject(AbstractObject object) {
-		if (objects != null) {
-			if (objects.remove(object)) {
+		if (this.objects != null) {
+			if (this.objects.remove(object)) {
 				for (Connection conn : getSourceConnections()) {
 					if (conn instanceof MemberConnection && conn.getTarget().contains(object)) { // should always be true
 						conn.disconnect();
@@ -258,12 +244,12 @@
 					if (conn instanceof RelationshipConnection) {
 						RelationshipConnection relConn = (RelationshipConnection) conn;
 						// notify objectContext about simple property change
-						relConn.getSource().getCurrentObject().getObjectContext().propertyChanged(relConn.getSource().getCurrentObject(), relConn.getRelationship().getName(), null, objects);
+						relConn.getSource().getCurrentObject().getObjectContext().propertyChanged(relConn.getSource().getCurrentObject(), relConn.getRelationship().getName(), null, this.objects);
 					}
 				}
 				validateCurrent();
-				firePropertyChange(PROP_RECORDS, null, objects);
-				firePropertyChange(PROP_TOTAL_RECORDS, objects.size() + 1, objects.size());
+				firePropertyChange(PROP_RECORDS, null, this.objects);
+				firePropertyChange(PROP_TOTAL_RECORDS, this.objects.size() + 1, this.objects.size());
 			}
 		}
 	}
@@ -271,8 +257,8 @@
 	@Override
 	public void resetPropertyValue(Object id) {
 		if (id.toString().equals(PROP_CURRENT_RECORD)) {
-			currentRecord = 0;
-			this.current = this.objects.get(currentRecord);
+			this.currentRecord = 0;
+			this.current = this.objects.get(this.currentRecord);
 		}
 		else {
 			super.resetPropertyValue(id);
@@ -286,11 +272,11 @@
 	 * If the object is not found in the collection, no change is made.
 	 */
 	public void setCurrentObject(AbstractObject object) {
-		if (objects != null && objects.contains(object)) {
-			int oldCurrent = currentRecord;
-			current = object;
-			currentRecord = objects.indexOf(object);
-			firePropertyChange(PROP_CURRENT_RECORD, new Integer(oldCurrent), new Integer(currentRecord));
+		if (this.objects != null && this.objects.contains(object)) {
+			int oldCurrent = this.currentRecord;
+			this.current = object;
+			this.currentRecord = this.objects.indexOf(object);
+			firePropertyChange(PROP_CURRENT_RECORD, new Integer(oldCurrent), new Integer(this.currentRecord));
 		}
 	}
 
@@ -304,9 +290,8 @@
 	@Override
 	public void setObject(Object value) {
 		
-		if (value == this.objects) {
+		if (value == this.objects)
 			return;
-		}
 		
 		List<AbstractObject> oldObjects = this.objects;
 		this.currentRecord = 0;
@@ -329,7 +314,7 @@
 				this.current = null;
 			}
 			else {
-				this.current = this.objects.get(currentRecord);
+				this.current = this.objects.get(this.currentRecord);
 			}
 		}
 		else {
@@ -338,24 +323,24 @@
 		}
 		
 		// add element as a property listener to each object
-		for (AbstractObject object : objects) {
+		for (AbstractObject object : this.objects) {
 			object.addPropertyChangeListener(this);
 		}
 		
 		if (getCurrentObject() != null) {
-			name = getCurrentObject().getName();
+			this.name = getCurrentObject().getName();
 		}
 		
-		firePropertyChange(PROP_RECORDS, oldObjects, objects);
+		firePropertyChange(PROP_RECORDS, oldObjects, this.objects);
 	}
 	
 	@Override
 	public void setPropertyValue(Object id, Object value) {
 		if (id.toString().equals(PROP_CURRENT_RECORD)) {
-			int oldCurrent = currentRecord;
-			currentRecord = Integer.parseInt(value.toString());
-			this.current = this.objects.get(currentRecord);
-			firePropertyChange(id.toString(), new Integer(oldCurrent), new Integer(currentRecord));
+			int oldCurrent = this.currentRecord;
+			this.currentRecord = Integer.parseInt(value.toString());
+			this.current = this.objects.get(this.currentRecord);
+			firePropertyChange(id.toString(), new Integer(oldCurrent), new Integer(this.currentRecord));
 		}
 		else {
 			super.setPropertyValue(id, value);
@@ -367,15 +352,15 @@
 	 * and that the current record number is correct
 	 */
 	protected void validateCurrent() {
-		if (currentRecord > objects.size() - 1 || !objects.contains(current)) {
-			currentRecord = 0;
-			if (!objects.isEmpty()) {
-				current = objects.get(currentRecord);
+		if (this.currentRecord > this.objects.size() - 1 || !this.objects.contains(this.current)) {
+			this.currentRecord = 0;
+			if (!this.objects.isEmpty()) {
+				this.current = this.objects.get(this.currentRecord);
 			}
 			else {
-				current = null;
+				this.current = null;
 			}
-			firePropertyChange(PROP_CURRENT_RECORD, null, objects);
+			firePropertyChange(PROP_CURRENT_RECORD, null, this.objects);
 		}
 	}
 }

Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/Connection.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/Connection.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/Connection.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/Connection.java Tue Sep 12 04:28:51 2006
@@ -59,7 +59,7 @@
 	 * @return a non-null element
 	 */
 	public ModelElement getSource() {
-		return source;
+		return this.source;
 	}
 	
 	/**
@@ -67,17 +67,17 @@
 	 * @return a non-null element
 	 */
 	public ModelElement getTarget() {
-		return target;
+		return this.target;
 	}
 	
 	/** 
 	 * Connect this connection.
 	 */  
 	public void connect() {
-		if (!connected) {
-			source.addConnection(this);
-			target.addConnection(this);
-			connected = true;
+		if (!this.connected) {
+			this.source.addConnection(this);
+			this.target.addConnection(this);
+			this.connected = true;
 		}
 	}
 
@@ -85,10 +85,10 @@
 	 * Removes the connection from its source and target elements.
 	 */
 	public void disconnect() {
-		if (connected) {
-			source.removeConnection(this);
-			target.removeConnection(this);
-			connected = false;
+		if (this.connected) {
+			this.source.removeConnection(this);
+			this.target.removeConnection(this);
+			this.connected = false;
 		}
 	}
 }

Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/ElementDiagram.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/ElementDiagram.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/ElementDiagram.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/ElementDiagram.java Tue Sep 12 04:28:51 2006
@@ -19,13 +19,9 @@
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
 import java.util.ArrayList;
-import java.util.EventObject;
 import java.util.List;
 
-import org.apache.cayenne.DataChannel;
 import org.apache.cayenne.ObjectContext;
-import org.apache.cayenne.event.EventSubject;
-import org.apache.cayenne.graph.GraphEvent;
 
 /**
  * The root component in the model - a diagram of {@link ModelElement}s and 
@@ -62,7 +58,7 @@
 	public ElementDiagram(ObjectContext context) {
 		this.context = context;
 		
-		autoLayout = true;
+		this.autoLayout = true;
 	}
 	
 	/**
@@ -73,8 +69,8 @@
 	public boolean addElement(ModelElement element) {
 		if (element != null) {
 			element.setDiagram(this);
-			if (!elements.contains(element)) {
-				elements.add(element);
+			if (!this.elements.contains(element)) {
+				this.elements.add(element);
 				createMemberConnections(element);
 				
 				firePropertyChange(PROP_NODE_ADDED, null, element);
@@ -91,10 +87,9 @@
 	 * @throws IllegalArgumentException if the parameter is null
 	 */
 	public synchronized void addPropertyChangeListener(PropertyChangeListener l) {
-		if (l == null) {
+		if (l == null)
 			throw new IllegalArgumentException();
-		}
-		pcsDelegate.addPropertyChangeListener(l);
+		this.pcsDelegate.addPropertyChangeListener(l);
 	}
 	
 	/**
@@ -114,9 +109,9 @@
 	 * {@link ModelElement}s in the diagram back to the database.
 	 */
 	public void commitChanges() {
-		context.commitChanges();
+		this.context.commitChanges();
 		firePropertyChange(PROP_COMMIT, false, true);
-		for (ModelElement element : elements) {
+		for (ModelElement element : this.elements) {
 			element.removeDeletedObjects();
 		}
 	}
@@ -134,7 +129,7 @@
 	 */
 	public void createMemberConnections(CollectionModelElement element, AbstractObject object) {
 		if (element instanceof CollectionModelElement) {
-			for (ModelElement child : elements) {
+			for (ModelElement child : this.elements) {
 				if (child instanceof SingleModelElement) {
 					if (object == child.getCurrentObject()) {
 						MemberConnection connection = new MemberConnection(element, (SingleModelElement) child);
@@ -160,7 +155,7 @@
 			}
 			// make member connections to any single elements with objects
 			// which this collection contains
-			for (ModelElement child : elements) {
+			for (ModelElement child : this.elements) {
 				if (child instanceof SingleModelElement) {
 					if (((CollectionModelElement) element).contains(child.getCurrentObject())) {
 						MemberConnection connection = new MemberConnection((CollectionModelElement) element, (SingleModelElement) child);
@@ -178,7 +173,7 @@
 			}
 			// make member connections to any collections which contain
 			// the object which this element contains
-			for (ModelElement child : elements) {
+			for (ModelElement child : this.elements) {
 				if (child instanceof CollectionModelElement) {
 					if (((CollectionModelElement) child).contains(element.getCurrentObject())) {
 						MemberConnection connection = new MemberConnection((CollectionModelElement) child, (SingleModelElement) element);
@@ -196,8 +191,8 @@
 	 * @param newValue the new value of this property
 	 */
 	protected void firePropertyChange(String property, Object oldValue, Object newValue) {
-		if (pcsDelegate.hasListeners(property)) {
-			pcsDelegate.firePropertyChange(property, oldValue, newValue);
+		if (this.pcsDelegate.hasListeners(property)) {
+			this.pcsDelegate.firePropertyChange(property, oldValue, newValue);
 		}
 	}
 	
@@ -208,24 +203,23 @@
 	 * @see ModelElement#equals(Object)
 	 */
 	public ModelElement getElement(ModelElement newElement) {
-		for (ModelElement element : elements) {
-			if (element.equals(newElement)) {
+		for (ModelElement element : this.elements) {
+			if (element.equals(newElement))
 				return element;
-			}
 		}
 		return null;
 	}
 
 	/** Return a List of Objects in this diagram.  The returned List should not be modified. */
 	public List<ModelElement> getElements() {
-		return elements;
+		return this.elements;
 	}
 
 	/**
 	 * @return the object context which objects in this diagram come from
 	 */
 	public ObjectContext getObjectContext() {
-		return context;
+		return this.context;
 	}
 	
 	/**
@@ -235,10 +229,9 @@
 	 * if the diagram does not contain such an element.
 	 */
 	public SingleModelElement getSingleElementForObject(AbstractObject newObject) {
-		for (ModelElement element : elements) {
-			if (element instanceof SingleModelElement && element.getCurrentObject() == newObject) {
+		for (ModelElement element : this.elements) {
+			if (element instanceof SingleModelElement && element.getCurrentObject() == newObject)
 				return (SingleModelElement) element;
-			}
 		}
 		return null;
 	}
@@ -247,7 +240,7 @@
 	 * @return true if automatic layout is desired, false otherwise
 	 */
 	public boolean isAutoLayoutDesired() {
-		return autoLayout;
+		return this.autoLayout;
 	}
 
 	/**
@@ -257,7 +250,7 @@
 	 */
 	public boolean removeElement(ModelElement element) {
 		if (element != null) {
-			elements.remove(element);
+			this.elements.remove(element);
 			firePropertyChange(PROP_NODE_REMOVED, null, element);
 			return true;
 		}
@@ -270,7 +263,7 @@
 	 */
 	public synchronized void removePropertyChangeListener(PropertyChangeListener l) {
 		if (l != null) {
-			pcsDelegate.removePropertyChangeListener(l);
+			this.pcsDelegate.removePropertyChangeListener(l);
 		}
 	}
 
@@ -278,9 +271,9 @@
 	 * Rollback changes made to objects in the diagram.
 	 */
 	public void rollbackChanges() {
-		context.rollbackChanges();
+		this.context.rollbackChanges();
 		firePropertyChange(PROP_ROLLBACK, false, true);
-		for (ModelElement element : elements) {
+		for (ModelElement element : this.elements) {
 			element.removeDeletedObjects();
 		}
 	}
@@ -289,7 +282,7 @@
 	 * Toggle whether automatic layout is on or off
 	 */
 	public void toggleAutoLayout() {
-		autoLayout = !autoLayout;
-		firePropertyChange(PROP_LAYOUT, !autoLayout, autoLayout);
+		this.autoLayout = !this.autoLayout;
+		firePropertyChange(PROP_LAYOUT, !this.autoLayout, this.autoLayout);
 	}
 }

Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/MemberConnection.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/MemberConnection.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/MemberConnection.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/MemberConnection.java Tue Sep 12 04:28:51 2006
@@ -16,8 +16,6 @@
  */
 package org.apache.cayenne.ropbrowser.model;
 
-import org.apache.cayenne.map.Relationship;
-
 /**
  * A connection between a {@link CollectionModelElement} and a
  * {@link SingleModelElement} representing the fact that the
@@ -40,11 +38,11 @@
 	
 	@Override
 	public CollectionModelElement getSource() {
-		return (CollectionModelElement) source;
+		return (CollectionModelElement) this.source;
 	}
 	
 	@Override
 	public SingleModelElement getTarget() {
-		return (SingleModelElement) target;
+		return (SingleModelElement) this.target;
 	}
 }

Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/ModelElement.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/ModelElement.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/ModelElement.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/ModelElement.java Tue Sep 12 04:28:51 2006
@@ -111,17 +111,16 @@
 	 * @throws IllegalArgumentException if connection is null or source == target
 	 */
 	public void addConnection(Connection conn) {
-		if (conn == null || conn.getSource() == conn.getTarget()) {
+		if (conn == null || conn.getSource() == conn.getTarget())
 			throw new IllegalArgumentException();
-		}
 		if (conn.getSource() == this) {
-			if (!sourceConnections.contains(conn)) {
-				sourceConnections.add(conn);
+			if (!this.sourceConnections.contains(conn)) {
+				this.sourceConnections.add(conn);
 				firePropertyChange(PROP_SOURCE_CONN, null, conn);
 			}
 		} else if (conn.getTarget() == this) {
-			if (!targetConnections.contains(conn)) {
-				targetConnections.add(conn);
+			if (!this.targetConnections.contains(conn)) {
+				this.targetConnections.add(conn);
 				firePropertyChange(PROP_TARGET_CONN, null, conn);
 			}
 		}
@@ -139,10 +138,9 @@
 	 * @throws IllegalArgumentException if the parameter is null
 	 */
 	public synchronized void addPropertyChangeListener(PropertyChangeListener l) {
-		if (l == null) {
+		if (l == null)
 			throw new IllegalArgumentException();
-		}
-		pcsDelegate.addPropertyChangeListener(l);
+		this.pcsDelegate.addPropertyChangeListener(l);
 	}
 
 	/**
@@ -165,8 +163,8 @@
 	 * @param newValue the new value of this property
 	 */
 	protected void firePropertyChange(String property, Object oldValue, Object newValue) {
-		if (pcsDelegate.hasListeners(property)) {
-			pcsDelegate.firePropertyChange(property, oldValue, newValue);
+		if (this.pcsDelegate.hasListeners(property)) {
+			this.pcsDelegate.firePropertyChange(property, oldValue, newValue);
 		}
 	}
 	
@@ -175,7 +173,7 @@
 	 */
 	public Rectangle getBounds()
 	{
-		return bounds;
+		return this.bounds;
 	}
 	
 	/**
@@ -187,7 +185,7 @@
 	 * @return the diagram which contains this element
 	 */
 	public ElementDiagram getDiagram() {
-		return diagram;
+		return this.diagram;
 	}
 
 	/**
@@ -203,7 +201,7 @@
 	 * of the object which it contains
 	 */
 	public String getName() {
-		return name;
+		return this.name;
 	}
 	
 	/**
@@ -213,10 +211,10 @@
 	public IPropertyDescriptor[] getPropertyDescriptors() {
 		
 		if (getCurrentObject() != null) {
-			if (properties == null) {
-				properties = getCurrentObject().getPropertyDescriptors();
+			if (this.properties == null) {
+				this.properties = getCurrentObject().getPropertyDescriptors();
 			}
-			return properties;
+			return this.properties;
 		}
 		return new IPropertyDescriptor[0];
 	}
@@ -225,9 +223,8 @@
 	 * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object) 
 	 */
 	public Object getPropertyValue(Object id) {
-		if (getCurrentObject() != null) {
+		if (getCurrentObject() != null)
 			return getCurrentObject().getPropertyValue(id);
-		}
 		return null;
 	}
 	
@@ -235,14 +232,14 @@
 	 * @return copy of the List of Connections originating at the ModelElement.
 	 */
 	public List<Connection> getSourceConnections() {
-		return new ArrayList<Connection>(sourceConnections);
+		return new ArrayList<Connection>(this.sourceConnections);
 	}
 	
 	/** 
 	 * @return copy of the List of Connections terminating at the ModelElement.
 	 */
 	public List<Connection> getTargetConnections() {
-		return new ArrayList<Connection>(targetConnections);
+		return new ArrayList<Connection>(this.targetConnections);
 	}
 	
 	/**
@@ -258,22 +255,21 @@
 	 * @return true if this element is connected to a root element
 	 */
 	public boolean isConnectedToRoot() {
-		if (isRoot()) {
+		if (isRoot())
 			return true;
-		}
 		// check if we have already visited this element
 		// to avoid infinite loops
-		if (!connectedToRootAlreadyChecked) {
-			connectedToRootAlreadyChecked = true;
+		if (!this.connectedToRootAlreadyChecked) {
+			this.connectedToRootAlreadyChecked = true;
 			for (Connection conn : getTargetConnections()) {
 				if (conn.getSource().isConnectedToRoot()) {
-					connectedToRootAlreadyChecked = false;
+					this.connectedToRootAlreadyChecked = false;
 					return true;
 				}
 			}
 		}
 		
-		connectedToRootAlreadyChecked = false;
+		this.connectedToRootAlreadyChecked = false;
 		return false;
 	}
 
@@ -293,9 +289,8 @@
 	 * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object) 
 	 */
 	public boolean isPropertySet(Object id) {
-		if (getCurrentObject() != null) {
+		if (getCurrentObject() != null)
 			return getCurrentObject().isPropertySet(id);
-		}
 		return false;
 	}
 	
@@ -327,14 +322,13 @@
 	 * upon its role in the connection.
 	 */
 	public void removeConnection(Connection conn) {
-		if (conn == null) {
+		if (conn == null)
 			throw new IllegalArgumentException();
-		}
 		if (conn.getSource() == this) {
-			sourceConnections.remove(conn);
+			this.sourceConnections.remove(conn);
 			firePropertyChange(PROP_SOURCE_CONN, null, conn);
 		} else if (conn.getTarget() == this) {
-			targetConnections.remove(conn);
+			this.targetConnections.remove(conn);
 			firePropertyChange(PROP_TARGET_CONN, null, conn);
 		}
 	}
@@ -345,7 +339,7 @@
 	 */
 	public synchronized void removePropertyChangeListener(PropertyChangeListener l) {
 		if (l != null) {
-			pcsDelegate.removePropertyChangeListener(l);
+			this.pcsDelegate.removePropertyChangeListener(l);
 		}
 	}
 
@@ -379,9 +373,9 @@
 	 * @param newName the name to set this element's name to
 	 */
 	public void setName(String newName) {
-		String oldName = name;
-		name = newName;
-		firePropertyChange(PROP_NAME, oldName, name);
+		String oldName = this.name;
+		this.name = newName;
+		firePropertyChange(PROP_NAME, oldName, this.name);
 	}
 
 	/**

Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/RelationshipConnection.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/RelationshipConnection.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/RelationshipConnection.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/RelationshipConnection.java Tue Sep 12 04:28:51 2006
@@ -44,11 +44,11 @@
 	 * @return the relationship this connection represents
 	 */
 	public Relationship getRelationship() {
-		return relationship;
+		return this.relationship;
 	}
 	
 	@Override
 	public SingleModelElement getSource() {
-		return (SingleModelElement) source;
+		return (SingleModelElement) this.source;
 	}
 }

Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/SingleModelElement.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/SingleModelElement.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/SingleModelElement.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/SingleModelElement.java Tue Sep 12 04:28:51 2006
@@ -16,8 +16,6 @@
  */
 package org.apache.cayenne.ropbrowser.model;
 
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-
 
 /**
  * An element which contains a single {@link AbstractObject}.
@@ -66,16 +64,15 @@
 	 */
 	@Override
 	public boolean equals(Object o) {
-		if (o instanceof SingleModelElement) {
+		if (o instanceof SingleModelElement)
 			return (this.object == ((SingleModelElement) o).getCurrentObject()) &&
 				(this.name.equals(((ModelElement) o).getName()));
-		}
 		return false;
 	}
 	
 	@Override
 	public AbstractObject getCurrentObject() {
-		return object;
+		return this.object;
 	}
 
 	@Override
@@ -85,7 +82,7 @@
 
 	@Override
 	public boolean isNull() {
-		return (object == null);
+		return (this.object == null);
 	}
 
 	@Override
@@ -125,9 +122,8 @@
 	@Override
 	public void setObject(Object value) {
 		
-		if (value == this.object) {
+		if (value == this.object)
 			return;
-		}
 		
 		AbstractObject oldObject = this.object;
 		
@@ -137,11 +133,11 @@
 		
 		this.object = (AbstractObject) value;
 		
-		if (object != null) {
+		if (this.object != null) {
 			this.object.addPropertyChangeListener(this);
-			name = this.object.getName();
+			this.name = this.object.getName();
 		}
 		
-		firePropertyChange(PROP_RECORDS, oldObject, object);
+		firePropertyChange(PROP_RECORDS, oldObject, this.object);
 	}
 }

Copied: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/TypeConverter.java (from r429528, incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/TypeConverter.java)
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/TypeConverter.java?view=diff&rev=442563&p1=incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/TypeConverter.java&r1=429528&p2=incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/TypeConverter.java&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/TypeConverter.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/TypeConverter.java Tue Sep 12 04:28:51 2006
@@ -13,9 +13,8 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.cayenne.ropbrowser;
+package org.apache.cayenne.ropbrowser.model;
 
-import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
@@ -53,9 +52,8 @@
 	}
 	
 	public static Object getValueFromString(Object value, String typeName) throws Exception {
-		if (!(value instanceof String)) {
+		if (!(value instanceof String))
 			return value;
-		}
 		
 		String stringValue = (String) value;
 		

Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Artist.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Artist.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Artist.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Artist.java Tue Sep 12 04:28:51 2006
@@ -24,88 +24,88 @@
     protected List artistPainting;
 
     public Boolean getAlive() {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "alive");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "alive");
         }
         
-        return alive;
+        return this.alive;
     }
     public void setAlive(Boolean alive) {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "alive");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "alive");
         }
         
         Object oldValue = this.alive;
         this.alive = alive;
         
         // notify objectContext about simple property change
-        if(objectContext != null) {
-            objectContext.propertyChanged(this, "alive", oldValue, alive);
+        if(this.objectContext != null) {
+            this.objectContext.propertyChanged(this, "alive", oldValue, alive);
         }
     }
     
     
     public String getArtistName() {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "artistName");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "artistName");
         }
         
-        return artistName;
+        return this.artistName;
     }
     public void setArtistName(String artistName) {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "artistName");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "artistName");
         }
         
         Object oldValue = this.artistName;
         this.artistName = artistName;
         
         // notify objectContext about simple property change
-        if(objectContext != null) {
-            objectContext.propertyChanged(this, "artistName", oldValue, artistName);
+        if(this.objectContext != null) {
+            this.objectContext.propertyChanged(this, "artistName", oldValue, artistName);
         }
     }
     
     
     public Date getDateOfBirth() {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "dateOfBirth");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "dateOfBirth");
         }
         
-        return dateOfBirth;
+        return this.dateOfBirth;
     }
     public void setDateOfBirth(Date dateOfBirth) {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "dateOfBirth");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "dateOfBirth");
         }
         
         Object oldValue = this.dateOfBirth;
         this.dateOfBirth = dateOfBirth;
         
         // notify objectContext about simple property change
-        if(objectContext != null) {
-            objectContext.propertyChanged(this, "dateOfBirth", oldValue, dateOfBirth);
+        if(this.objectContext != null) {
+            this.objectContext.propertyChanged(this, "dateOfBirth", oldValue, dateOfBirth);
         }
     }
     
     
     public List getArtistPainting() {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "artistPainting");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "artistPainting");
         }
         
-        return artistPainting;
+        return this.artistPainting;
     }
     public void addToArtistPainting(Painting object) {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "artistPainting");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "artistPainting");
         }
         
         this.artistPainting.add(object);
     }
     public void removeFromArtistPainting(Painting object) {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "artistPainting");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "artistPainting");
         }
         
         this.artistPainting.remove(object);

Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Gallery.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Gallery.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Gallery.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Gallery.java Tue Sep 12 04:28:51 2006
@@ -19,44 +19,44 @@
     protected List galleryPainting;
 
     public String getGalleryName() {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "galleryName");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "galleryName");
         }
         
-        return galleryName;
+        return this.galleryName;
     }
     public void setGalleryName(String galleryName) {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "galleryName");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "galleryName");
         }
         
         Object oldValue = this.galleryName;
         this.galleryName = galleryName;
         
         // notify objectContext about simple property change
-        if(objectContext != null) {
-            objectContext.propertyChanged(this, "galleryName", oldValue, galleryName);
+        if(this.objectContext != null) {
+            this.objectContext.propertyChanged(this, "galleryName", oldValue, galleryName);
         }
     }
     
     
     public List getGalleryPainting() {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "galleryPainting");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "galleryPainting");
         }
         
-        return galleryPainting;
+        return this.galleryPainting;
     }
     public void addToGalleryPainting(Painting object) {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "galleryPainting");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "galleryPainting");
         }
         
         this.galleryPainting.add(object);
     }
     public void removeFromGalleryPainting(Painting object) {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "galleryPainting");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "galleryPainting");
         }
         
         this.galleryPainting.remove(object);

Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Painting.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Painting.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Painting.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/model/auto/_Painting.java Tue Sep 12 04:28:51 2006
@@ -23,74 +23,74 @@
     protected ValueHolder paintingGallery;
 
     public Double getEstimatedPrice() {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "estimatedPrice");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "estimatedPrice");
         }
         
-        return estimatedPrice;
+        return this.estimatedPrice;
     }
     public void setEstimatedPrice(Double estimatedPrice) {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "estimatedPrice");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "estimatedPrice");
         }
         
         Object oldValue = this.estimatedPrice;
         this.estimatedPrice = estimatedPrice;
         
         // notify objectContext about simple property change
-        if(objectContext != null) {
-            objectContext.propertyChanged(this, "estimatedPrice", oldValue, estimatedPrice);
+        if(this.objectContext != null) {
+            this.objectContext.propertyChanged(this, "estimatedPrice", oldValue, estimatedPrice);
         }
     }
     
     
     public String getPaintingName() {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "paintingName");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "paintingName");
         }
         
-        return paintingName;
+        return this.paintingName;
     }
     public void setPaintingName(String paintingName) {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "paintingName");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "paintingName");
         }
         
         Object oldValue = this.paintingName;
         this.paintingName = paintingName;
         
         // notify objectContext about simple property change
-        if(objectContext != null) {
-            objectContext.propertyChanged(this, "paintingName", oldValue, paintingName);
+        if(this.objectContext != null) {
+            this.objectContext.propertyChanged(this, "paintingName", oldValue, paintingName);
         }
     }
     
     
     public Artist getPaintingArtist() {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "paintingArtist");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "paintingArtist");
         }
         
-        return (Artist) paintingArtist.getValue();
+        return (Artist) this.paintingArtist.getValue();
     }
     public void setPaintingArtist(Artist paintingArtist) {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "paintingArtist");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "paintingArtist");
         }
         
         this.paintingArtist.setValue(paintingArtist);
     }
     
     public Gallery getPaintingGallery() {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "paintingGallery");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "paintingGallery");
         }
         
-        return (Gallery) paintingGallery.getValue();
+        return (Gallery) this.paintingGallery.getValue();
     }
     public void setPaintingGallery(Gallery paintingGallery) {
-        if(objectContext != null) {
-            objectContext.prepareForAccess(this, "paintingGallery");
+        if(this.objectContext != null) {
+            this.objectContext.prepareForAccess(this, "paintingGallery");
         }
         
         this.paintingGallery.setValue(paintingGallery);

Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/CollectionEditPart.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/CollectionEditPart.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/CollectionEditPart.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/CollectionEditPart.java Tue Sep 12 04:28:51 2006
@@ -16,8 +16,6 @@
  */
 package org.apache.cayenne.ropbrowser.parts;
 
-import org.apache.cayenne.ropbrowser.commands.SetNameElementCommand;
-import org.apache.cayenne.ropbrowser.commands.SetNameElementRequest;
 import org.apache.cayenne.ropbrowser.figures.CollectionFigure;
 import org.apache.cayenne.ropbrowser.model.AbstractObject;
 import org.apache.cayenne.ropbrowser.model.CollectionModelElement;
@@ -28,8 +26,6 @@
 import org.eclipse.draw2d.Button;
 import org.eclipse.draw2d.IFigure;
 import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
 
 /**
  * EditPart for the {@link CollectionModelElement} class. Allows

Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ElementDiagramEditPart.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ElementDiagramEditPart.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ElementDiagramEditPart.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ElementDiagramEditPart.java Tue Sep 12 04:28:51 2006
@@ -19,11 +19,9 @@
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.cayenne.ropbrowser.commands.HideElementCommand;
-import org.apache.cayenne.ropbrowser.figures.ElementFigure;
 import org.apache.cayenne.ropbrowser.layout.DelegatingLayoutManager;
 import org.apache.cayenne.ropbrowser.model.ElementDiagram;
 import org.apache.cayenne.ropbrowser.model.ModelElement;
@@ -85,8 +83,8 @@
 		Figure f = new FreeformLayer();
 		f.setBorder(new MarginBorder(3));
 		
-		delegatingLayoutManager = new DelegatingLayoutManager(this);
-		f.setLayoutManager(delegatingLayoutManager);
+		this.delegatingLayoutManager = new DelegatingLayoutManager(this);
+		f.setLayoutManager(this.delegatingLayoutManager);
 		
 		//f.setLayoutManager(new FreeformLayout());
 	
@@ -140,7 +138,7 @@
 			refreshChildren();
 		}
 		else if (ElementDiagram.PROP_LAYOUT.equals(prop)) {
-			getFigure().setLayoutManager(delegatingLayoutManager);
+			getFigure().setLayoutManager(this.delegatingLayoutManager);
 		}
 		else if (ElementDiagram.PROP_COMMIT.equals(prop)) {
 			hideNullObjects();
@@ -200,20 +198,18 @@
 			ModelElement element = (ModelElement) elementEditPart.getModel();
 
 			Rectangle bounds = element.getBounds();
-			if (bounds == null) {
+			if (bounds == null)
 				//TODO handle this better
 				return false;
-			}
 			else {
 				Figure elementFigure = (Figure) elementEditPart.getFigure();
-				if (elementFigure == null) {
+				if (elementFigure == null)
 					return false;
-				}
 				else {
 					if (updateConstraint) {
 						//pass the constraint information to the xy layout
 						//setting the width and height so that the preferred size will be applied
-						delegatingLayoutManager.setXYLayoutConstraint(elementFigure, new Rectangle(bounds.x, bounds.y,
+						this.delegatingLayoutManager.setXYLayoutConstraint(elementFigure, new Rectangle(bounds.x, bounds.y,
 								-1, -1));
 					}
 				}

Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ElementEditPart.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ElementEditPart.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ElementEditPart.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ElementEditPart.java Tue Sep 12 04:28:51 2006
@@ -44,7 +44,6 @@
 import org.eclipse.gef.EditPolicy;
 import org.eclipse.gef.NodeEditPart;
 import org.eclipse.gef.Request;
-import org.eclipse.gef.RequestConstants;
 import org.eclipse.gef.commands.Command;
 import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
 import org.eclipse.swt.widgets.Display;
@@ -144,10 +143,10 @@
 	 * Obtains the anchor used for connections on this EditPart's figure.
 	 */
 	protected ConnectionAnchor getConnectionAnchor() {
-		if (anchor == null) {
-			anchor = new ChopboxAnchor(getFigure());
+		if (this.anchor == null) {
+			this.anchor = new ChopboxAnchor(getFigure());
 		}
-		return anchor;
+		return this.anchor;
 	}
 
 	/**
@@ -207,24 +206,18 @@
 	
 	@Override
 	public Command getCommand(Request request) {
-		if (request.getType().equals(HideAction.HIDE_REQUEST)) {
+		if (request.getType().equals(HideAction.HIDE_REQUEST))
 			return new HideElementCommand(this.getModelCast());
-		}
-		if (request.getType().equals(InsertAction.INSERT_REQUEST)) {
+		if (request.getType().equals(InsertAction.INSERT_REQUEST))
 			return new ObjectInsertCommand(this.getModelCast());
-		}
-		if (request.getType().equals(RemoveAction.REMOVE_REQUEST)) {
+		if (request.getType().equals(RemoveAction.REMOVE_REQUEST))
 			return new RemoveObjectCommand(this.getModelCast());
-		}
-		if (request.getType().equals(ExistingObjectRequest.EXISTING_REQUEST)) {
+		if (request.getType().equals(ExistingObjectRequest.EXISTING_REQUEST))
 			return new ExistingObjectCommand(this.getModelCast(), ((ExistingObjectRequest) request).getSelectedObject());
-		}
-		if (request.getType().equals(DeleteAction.DELETE_REQUEST)) {
+		if (request.getType().equals(DeleteAction.DELETE_REQUEST))
 			return new DeleteObjectCommand(this.getModelCast());
-		}
-		if (request.getType().equals(SetNameElementRequest.SET_NAME_REQUEST)) {
+		if (request.getType().equals(SetNameElementRequest.SET_NAME_REQUEST))
 			return new SetNameElementCommand(this.getModelCast(), ((SetNameElementRequest) request).getName());
-		}
 		return super.getCommand(request); 
 	}
 }

Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ElementEditPartFactory.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ElementEditPartFactory.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ElementEditPartFactory.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/ElementEditPartFactory.java Tue Sep 12 04:28:51 2006
@@ -46,18 +46,14 @@
 	 * @throws RuntimeException if no match was found (programming error)
 	 */
 	private EditPart getPartForElement(Object object) {
-		if (object instanceof ElementDiagram) {
+		if (object instanceof ElementDiagram)
 			return new ElementDiagramEditPart();
-		}
-		if (object instanceof CollectionModelElement) {
+		if (object instanceof CollectionModelElement)
 			return new CollectionEditPart();
-		}
-		if (object instanceof SingleModelElement) {
+		if (object instanceof SingleModelElement)
 			return new SingleEditPart();
-		}
-		if (object instanceof Connection) {
+		if (object instanceof Connection)
 			return new ConnectionEditPart();
-		}
 		throw new RuntimeException(
 				"Can't create part for model element: "
 				+ ((object != null) ? object.getClass().getName() : "null"));

Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/SingleEditPart.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/SingleEditPart.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/SingleEditPart.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/parts/SingleEditPart.java Tue Sep 12 04:28:51 2006
@@ -16,9 +16,7 @@
  */
 package org.apache.cayenne.ropbrowser.parts;
 
-import org.apache.cayenne.ropbrowser.actions.DeleteAction;
 import org.apache.cayenne.ropbrowser.commands.ContractRelationshipCommand;
-import org.apache.cayenne.ropbrowser.commands.DeleteObjectCommand;
 import org.apache.cayenne.ropbrowser.commands.ExpandRelationshipCommand;
 import org.apache.cayenne.ropbrowser.figures.SingleFigure;
 import org.apache.cayenne.ropbrowser.model.Connection;
@@ -30,9 +28,6 @@
 import org.eclipse.draw2d.ButtonModel;
 import org.eclipse.draw2d.IFigure;
 import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
 import org.apache.cayenne.map.Relationship;
 
 /**
@@ -78,9 +73,8 @@
 	public boolean isRelationshipExpanded(Relationship relationship) {
 		for (Connection conn : getModelCast().getSourceConnections()) {
 			if (conn instanceof RelationshipConnection) {
-				if (((RelationshipConnection) conn).getRelationship() == relationship) {
+				if (((RelationshipConnection) conn).getRelationship() == relationship)
 					return true;
-				}
 			}
 		}
 		return false;
@@ -95,9 +89,8 @@
 	protected RelationshipConnection getRelationshipConnection(Relationship relationship) {
 		for (Connection conn : getModelCast().getSourceConnections()) {
 			if (conn instanceof RelationshipConnection) {
-				if (((RelationshipConnection) conn).getRelationship() == relationship) {
+				if (((RelationshipConnection) conn).getRelationship() == relationship)
 					return (RelationshipConnection) conn;
-				}
 			}
 		}
 		return null;

Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionDirectEditPolicy.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionDirectEditPolicy.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionDirectEditPolicy.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionDirectEditPolicy.java Tue Sep 12 04:28:51 2006
@@ -37,7 +37,7 @@
 	
 	@Override
 	protected Command getDirectEditCommand(DirectEditRequest request) {
-		return new PopOutCommand(element);
+		return new PopOutCommand(this.element);
 	}
 
 	@Override

Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionSelectionPolicy.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionSelectionPolicy.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionSelectionPolicy.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/policies/CollectionSelectionPolicy.java Tue Sep 12 04:28:51 2006
@@ -17,7 +17,6 @@
 package org.apache.cayenne.ropbrowser.policies;
 
 import org.apache.cayenne.ropbrowser.commands.NextObjectCommand;
-import org.apache.cayenne.ropbrowser.commands.PopOutCommand;
 import org.apache.cayenne.ropbrowser.model.CollectionModelElement;
 import org.eclipse.gef.Request;
 import org.eclipse.gef.RequestConstants;
@@ -48,9 +47,8 @@
 	
 	@Override
 	public Command getCommand(Request request) {
-		if (request.getType().equals(RequestConstants.REQ_OPEN)) {
-			return new NextObjectCommand(element);
-		}
+		if (request.getType().equals(RequestConstants.REQ_OPEN))
+			return new NextObjectCommand(this.element);
 		return super.getCommand(request);
 	}
 }

Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/views/ControlPanelView.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/views/ControlPanelView.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/views/ControlPanelView.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/views/ControlPanelView.java Tue Sep 12 04:28:51 2006
@@ -16,6 +16,9 @@
  */
 package org.apache.cayenne.ropbrowser.views;
 
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
 import java.util.HashMap;
 import java.util.Iterator;
 
@@ -26,9 +29,9 @@
 import org.apache.cayenne.ropbrowser.wizards.SelectQueryWizard;
 import org.apache.cayenne.ropbrowser.wizards.SelectParametersPage.Operator;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.layout.GridData;
@@ -36,16 +39,15 @@
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
 import org.eclipse.swt.widgets.Group;
 import org.eclipse.ui.IEditorReference;
 import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.forms.widgets.ColumnLayout;
-import org.eclipse.ui.forms.widgets.Form;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
 import org.eclipse.ui.part.ViewPart;
 import org.apache.cayenne.ObjectContext;
+import org.apache.cayenne.QueryResponse;
 import org.apache.cayenne.exp.Expression;
 import org.apache.cayenne.exp.ExpressionFactory;
 import org.apache.cayenne.exp.parser.ASTObjPath;
@@ -53,8 +55,8 @@
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.query.NamedQuery;
 import org.apache.cayenne.query.Query;
+import org.apache.cayenne.query.SQLTemplate;
 import org.apache.cayenne.query.SelectQuery;
-import org.apache.cayenne.util.Util;
 
 /**
  * An Eclipse view for connecting to the Cayenne web service and launching queries
@@ -111,25 +113,31 @@
 	/** whether to use shared session mode */
 	private Button sharedSessionButton;
 	
+	/** button to run a query from a file */
+	private Button fileQueryButton;
+	
+	/** address of the currently selected server */
+	private String currentServer;
+	
 	public ControlPanelView() {
-		connectionManager = ConnectionManager.getInstance();
+		this.connectionManager = ConnectionManager.getInstance();
 	}
 	
 	private void connectToServer() {
 		// connect to the specified server
-		namedQueryCombo.removeAll();
+		this.namedQueryCombo.removeAll();
 		
 		// if this address isn't in the dropdown yet, add it
-		if (serverCombo.indexOf(serverCombo.getText()) == -1) {
-			serverCombo.add(serverCombo.getText());
+		if (this.serverCombo.indexOf(this.serverCombo.getText()) == -1) {
+			this.serverCombo.add(this.serverCombo.getText());
 		}
 		
-		ROPBrowserPlugin.getDefault().getPluginPreferences().setValue(PREF_SERVER, serverCombo.getText());
+		ROPBrowserPlugin.getDefault().getPluginPreferences().setValue(PREF_SERVER, this.serverCombo.getText());
 		
 		ObjectContext currentContext = null;
 		
 		try {
-			currentContext = connectionManager.getNewObjectContext(serverCombo.getText(), sharedSessionButton.getSelection());
+			currentContext = this.connectionManager.getNewObjectContext(this.serverCombo.getText(), this.sharedSessionButton.getSelection());
 		}
 		catch (Exception ex) {
 			ROPBrowserPlugin.getDefault().getLog().log(new Status(Status.ERROR, ROPBrowserPlugin.ID, Status.OK, ex.getMessage(), ex));
@@ -140,18 +148,16 @@
 			EntityResolver entityResolver = currentContext.getEntityResolver();
 			Iterator i = entityResolver.getQueries().iterator();
 			while (i.hasNext()) {
-				namedQueryCombo.add(((Query)i.next()).getName());
+				this.namedQueryCombo.add(((Query)i.next()).getName());
 			}
-			// set the server address as user data for use in running queries
-			namedQueryCombo.setData(serverCombo.getText());
 			
 			// get all the entities in this context for use as select queries
 			i = entityResolver.getObjEntities().iterator();
 			while (i.hasNext()) {
-				selectQueryCombo.add(((ObjEntity)i.next()).getName());
+				this.selectQueryCombo.add(((ObjEntity)i.next()).getName());
 			}
-			// set the server address as user data for use in running queries
-			selectQueryCombo.setData(serverCombo.getText());
+			
+			this.currentServer = this.serverCombo.getText();
 		}
 	}
 	
@@ -169,57 +175,61 @@
 		serverGroup.setText("Server");
 		serverGroup.setLayout(new GridLayout());
 		
-		serverCombo = new Combo(serverGroup, SWT.FLAT | SWT.BORDER);
-		serverCombo.setLayoutData(new GridData(SWT.FILL, SWT.NULL, true, false));
+		this.serverCombo = new Combo(serverGroup, SWT.FLAT | SWT.BORDER);
+		this.serverCombo.setLayoutData(new GridData(SWT.FILL, SWT.NULL, true, false));
 		String defaultServer = ROPBrowserPlugin.getDefault().getPluginPreferences().getString(PREF_SERVER);
 		if (defaultServer != null) {
-			serverCombo.add(defaultServer);
-			serverCombo.setText(defaultServer);
+			this.serverCombo.add(defaultServer);
+			this.serverCombo.setText(defaultServer);
 		}
-		connectButton = new Button(serverGroup, SWT.PUSH);
-		connectButton.setText("Connect");
-		connectButton.addSelectionListener(this);
+		this.connectButton = new Button(serverGroup, SWT.PUSH);
+		this.connectButton.setText("Connect");
+		this.connectButton.addSelectionListener(this);
 		
 		// create the named query section
 		Group namedQueryGroup = new Group(parent, SWT.NULL);
 		namedQueryGroup.setText("Named Query");
 		namedQueryGroup.setLayout(new GridLayout());
 		
-		namedQueryCombo = new Combo(namedQueryGroup, SWT.READ_ONLY | SWT.FLAT | SWT.BORDER);
-		namedQueryCombo.setLayoutData(new GridData(SWT.FILL, SWT.NULL, true, false));
+		this.namedQueryCombo = new Combo(namedQueryGroup, SWT.READ_ONLY | SWT.FLAT | SWT.BORDER);
+		this.namedQueryCombo.setLayoutData(new GridData(SWT.FILL, SWT.NULL, true, false));
 		
-		runNamedQueryButton = new Button(namedQueryGroup, SWT.PUSH);
-		runNamedQueryButton.setText("Run");
-		runNamedQueryButton.addSelectionListener(this);
+		this.runNamedQueryButton = new Button(namedQueryGroup, SWT.PUSH);
+		this.runNamedQueryButton.setText("Run");
+		this.runNamedQueryButton.addSelectionListener(this);
 		
 		// create the select query section
 		Group selectQueryGroup = new Group(parent, SWT.NULL);
 		selectQueryGroup.setText("Select Query");
 		selectQueryGroup.setLayout(new GridLayout());
 		
-		selectQueryCombo = new Combo(selectQueryGroup, SWT.READ_ONLY | SWT.FLAT | SWT.BORDER);
-		selectQueryCombo.setLayoutData(new GridData(SWT.FILL, SWT.NULL, true, false));
+		this.selectQueryCombo = new Combo(selectQueryGroup, SWT.READ_ONLY | SWT.FLAT | SWT.BORDER);
+		this.selectQueryCombo.setLayoutData(new GridData(SWT.FILL, SWT.NULL, true, false));
 		
-		parametersButton =  new Button(selectQueryGroup, SWT.PUSH);
-		parametersButton.setText("Parameters...");
-		parametersButton.addSelectionListener(this);
-		
-		runSelectQueryButton = new Button(selectQueryGroup, SWT.PUSH);
-		runSelectQueryButton.setText("Run");
-		runSelectQueryButton.addSelectionListener(this);
+		this.parametersButton =  new Button(selectQueryGroup, SWT.PUSH);
+		this.parametersButton.setText("Parameters...");
+		this.parametersButton.addSelectionListener(this);
+		
+		this.runSelectQueryButton = new Button(selectQueryGroup, SWT.PUSH);
+		this.runSelectQueryButton.setText("Run");
+		this.runSelectQueryButton.addSelectionListener(this);
 		
 		// create the misc section
 		Group miscGroup = new Group(parent, SWT.NULL);
 		miscGroup.setText("Other Settings");
 		miscGroup.setLayout(new GridLayout());
 		
-		newDiagramButton = new Button(miscGroup, SWT.CHECK);
-		newDiagramButton.setText("Display in new editor");
-		newDiagramButton.setSelection(true);
-		
-		sharedSessionButton = new Button(miscGroup, SWT.CHECK);
-		sharedSessionButton.setText("Shared session");
-		sharedSessionButton.setSelection(true);
+		this.newDiagramButton = new Button(miscGroup, SWT.CHECK);
+		this.newDiagramButton.setText("Display in new editor");
+		this.newDiagramButton.setSelection(true);
+		
+		this.sharedSessionButton = new Button(miscGroup, SWT.CHECK);
+		this.sharedSessionButton.setText("Shared session");
+		this.sharedSessionButton.setSelection(true);
+		
+		this.fileQueryButton = new Button(miscGroup, SWT.PUSH);
+		this.fileQueryButton.setText("Run SQL...");
+		this.fileQueryButton.addSelectionListener(this);
 		
 		parent.pack();
 	}
@@ -234,7 +244,7 @@
 	private void displayInEditor(ObjectContext context, String address, Object matches) {
 		try {
 			ObjectEditor editor;
-			if (newDiagramButton.getSelection()) {
+			if (this.newDiagramButton.getSelection()) {
 				editor = getNewEditor(context, address);
 			}
 			else {
@@ -258,9 +268,8 @@
 		for (IEditorReference editor : getViewSite().getPage().findEditors(null, ObjectEditor.ID, IWorkbenchPage.MATCH_ID)) {
 			try {
 				ObjectEditorInput input = (ObjectEditorInput) editor.getEditorInput();
-				if (input.getServerAddress().equals(address)) {
+				if (input.getServerAddress().equals(address))
 					return (ObjectEditor) editor.getEditor(false);
-				}
 			} catch (PartInitException ex) {
 				ROPBrowserPlugin.getDefault().getLog().log(new Status(Status.ERROR, ROPBrowserPlugin.ID, Status.OK, ex.getMessage(), ex));
 			}
@@ -284,13 +293,13 @@
 	 */
 	private ObjectContext getObjectContext(String address) {
 		ObjectContext context;
-		if (newDiagramButton.getSelection()) {
-			context = this.connectionManager.getNewObjectContext(address, sharedSessionButton.getSelection());
+		if (this.newDiagramButton.getSelection()) {
+			context = this.connectionManager.getNewObjectContext(address, this.sharedSessionButton.getSelection());
 		}
 		else {
 			ObjectEditor existingEditor = getExistingEditor(address);
 			if (existingEditor == null) {
-				context = this.connectionManager.getNewObjectContext(address, sharedSessionButton.getSelection());
+				context = this.connectionManager.getNewObjectContext(address, this.sharedSessionButton.getSelection());
 			}
 			else {
 				context = existingEditor.getDiagram().getObjectContext();
@@ -300,34 +309,46 @@
 	}
 
 	private boolean openParametersWizard() {
-		selectWizard = new SelectQueryWizard(connectionManager.getNewObjectContext((String) selectQueryCombo.getData(), sharedSessionButton.getSelection()), selectQueryCombo.getText(), SelectQueryWizard.RETURN_PARAMS);
-		WizardDialog dialog = new WizardDialog(getViewSite().getShell(), selectWizard);
+		if (this.currentServer == null) return false;
+		
+		this.selectWizard = new SelectQueryWizard(this.connectionManager.getNewObjectContext(this.currentServer, this.sharedSessionButton.getSelection()), this.selectQueryCombo.getText(), SelectQueryWizard.RETURN_PARAMS);
+		WizardDialog dialog = new WizardDialog(getViewSite().getShell(), this.selectWizard);
 		dialog.create();
 		dialog.open();
 		return (dialog.getReturnCode() == WizardDialog.OK);
 	}
 
+	/**
+	 * Run the named query that has been chosen
+	 */
 	private void runNamedQuery() {
-		if (namedQueryCombo.indexOf(namedQueryCombo.getText()) != -1) {
-			ObjectContext context = getObjectContext((String) namedQueryCombo.getData());
-			NamedQuery select = new NamedQuery(namedQueryCombo.getText());
+		if (this.currentServer == null) return;
+		
+		if (this.namedQueryCombo.indexOf(this.namedQueryCombo.getText()) != -1) {
+			ObjectContext context = getObjectContext(this.currentServer);
+			NamedQuery select = new NamedQuery(this.namedQueryCombo.getText());
 			if (context != null) {
 				Object matches = context.performQuery(select);
 			
-				displayInEditor(context, (String) namedQueryCombo.getData(), matches);
+				displayInEditor(context, this.currentServer, matches);
 			}
 		}
 	}
 
+	/**
+	 * Run the select query that has been chosen
+	 */
 	private void runSelectQuery() {
-		if (selectQueryCombo.indexOf(selectQueryCombo.getText()) != -1) {
-			ObjectContext context = getObjectContext((String) selectQueryCombo.getData());
+		if (this.currentServer == null) return;
+		
+		if (this.selectQueryCombo.indexOf(this.selectQueryCombo.getText()) != -1) {
+			ObjectContext context = getObjectContext(this.currentServer);
 			Object matches;
 			// check to see if parameters have been specified for this entity
-			if (selectWizard != null && selectWizard.getEntityName().equals(selectQueryCombo.getText())) {				
+			if (this.selectWizard != null && this.selectWizard.getEntityName().equals(this.selectQueryCombo.getText())) {				
 				Expression qual = null;
-				HashMap<String, Object> paramMap = selectWizard.getParametersPage().getParameterMap();
-				HashMap<String, Operator> operatorMap = selectWizard.getParametersPage().getOperatorMap();
+				HashMap<String, Object> paramMap = this.selectWizard.getParametersPage().getParameterMap();
+				HashMap<String, Operator> operatorMap = this.selectWizard.getParametersPage().getOperatorMap();
 				
 				Iterator<String> paramNames = paramMap.keySet().iterator();
 				while (paramNames.hasNext()) {
@@ -343,13 +364,13 @@
 					}
 				}
 				
-				matches = context.performQuery(new SelectQuery(selectQueryCombo.getText(), qual));
+				matches = context.performQuery(new SelectQuery(this.selectQueryCombo.getText(), qual));
 			}
 			else {
-				matches = context.performQuery(new SelectQuery(selectQueryCombo.getText()));
+				matches = context.performQuery(new SelectQuery(this.selectQueryCombo.getText()));
 			}
 			
-			displayInEditor(context, (String) selectQueryCombo.getData(), matches);
+			displayInEditor(context, (String) this.selectQueryCombo.getData(), matches);
 		}
 	}
 
@@ -360,20 +381,66 @@
 	 * Handle connections to the server and running of queries.
 	 */
 	public void widgetSelected(SelectionEvent e) {
-		if (e.getSource() == connectButton) {
+		if (e.getSource() == this.connectButton) {
 			connectToServer();
 		}
-		else if (e.getSource() == runNamedQueryButton) {
+		else if (e.getSource() == this.runNamedQueryButton) {
 			runNamedQuery();
 		}
-		else if (e.getSource() == parametersButton && selectQueryCombo.indexOf(selectQueryCombo.getText()) != -1) {
+		else if (e.getSource() == this.parametersButton && this.selectQueryCombo.indexOf(this.selectQueryCombo.getText()) != -1) {
 			if (openParametersWizard()) {
 				runSelectQuery();
 			}
 		}
-		else if (e.getSource() == runSelectQueryButton) {
+		else if (e.getSource() == this.runSelectQueryButton) {
 			runSelectQuery();
 		}
+		else if (e.getSource() == this.fileQueryButton) {
+			runFileQuery();
+		}
+	}
+
+	/**
+	 * Run a query from an SQL file
+	 */
+	private void runFileQuery() {
+		
+		if (this.currentServer == null) return;
+		
+		StringBuffer query = new StringBuffer("");
+		FileDialog dialog = new FileDialog(getViewSite().getShell(), SWT.OPEN);
+		String chosen = dialog.open();
+		if (chosen == null)
+			return;
+		try {
+			BufferedReader reader = new BufferedReader(new FileReader(chosen));
+			String line;
+			while ((line = reader.readLine()) != null) {
+				query.append(line);
+			}
+			reader.close();
+		}
+		catch (IOException ex) {
+			ROPBrowserPlugin.getDefault().getLog().log(new Status(Status.ERROR, ROPBrowserPlugin.ID, Status.OK, ex.getMessage(), ex));
+		}
+		
+		if (chosen.startsWith("SELECT")) {
+			MessageDialog mDialog = new MessageDialog(getViewSite().getShell(), "Error", null, "Select queries cannot be run from SQL scripts", MessageDialog.ERROR, new String [] {"OK"}, 0);
+			mDialog.open();
+			return;
+		}
+		
+		ObjectContext context = getObjectContext(this.currentServer);
+		
+		EntitySelectionDialog eDialog = new EntitySelectionDialog(getViewSite().getShell(), context);
+		int result = eDialog.open();
+		if (result == EntitySelectionDialog.CANCEL)
+			return;
+		
+		String entityName = eDialog.getValue();
+		
+		SQLTemplate sqlQuery = new SQLTemplate(entityName, query.toString());
+		context.performGenericQuery(sqlQuery);
 	}
 
 	@Override

Added: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/views/EntitySelectionDialog.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/views/EntitySelectionDialog.java?view=auto&rev=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/views/EntitySelectionDialog.java (added)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/views/EntitySelectionDialog.java Tue Sep 12 04:28:51 2006
@@ -0,0 +1,76 @@
+/*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.cayenne.ropbrowser.views;
+
+import java.util.Iterator;
+
+import org.apache.cayenne.ObjectContext;
+import org.apache.cayenne.map.EntityResolver;
+import org.apache.cayenne.map.ObjEntity;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+public class EntitySelectionDialog extends Dialog implements SelectionListener {
+	
+	private Combo entityCombo;
+	private ObjectContext context;
+	private String value;
+
+	protected EntitySelectionDialog(Shell parentShell, ObjectContext context) {
+		super(parentShell);
+		this.context = context;
+	}
+
+	@Override
+	public Control createDialogArea(Composite parent) {
+		Composite composite = (Composite) super.createDialogArea(parent);
+		
+		getShell().setText("Select entity");
+		
+		this.entityCombo = new Combo(composite, SWT.READ_ONLY | SWT.DROP_DOWN);
+				
+		// get all the queries for this connection
+		EntityResolver entityResolver = this.context.getEntityResolver();
+		Iterator i = entityResolver.getObjEntities().iterator();
+		while (i.hasNext()) {
+			this.entityCombo.add(((ObjEntity)i.next()).getName());
+		}
+		
+		this.entityCombo.setLayoutData(new GridData(SWT.FILL, SWT.NULL, true, false));
+		
+		this.entityCombo.addSelectionListener(this);
+		
+		return composite;
+	}
+
+	public void widgetDefaultSelected(SelectionEvent e) {
+	}
+
+	public void widgetSelected(SelectionEvent e) {
+		this.value = this.entityCombo.getText();
+	}
+
+	public String getValue() {
+		return this.value;
+	}
+}

Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/wizards/SelectObjectPage.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/wizards/SelectObjectPage.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/wizards/SelectObjectPage.java (original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/wizards/SelectObjectPage.java Tue Sep 12 04:28:51 2006
@@ -15,7 +15,6 @@
  */
 package org.apache.cayenne.ropbrowser.wizards;
 
-import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -43,7 +42,6 @@
 import org.apache.cayenne.map.ObjAttribute;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.query.SelectQuery;
-import org.apache.cayenne.util.Util;
 
 /**
  * {@link WizardPage} for {@link SelectQueryWizard} which displays a list of objects
@@ -90,19 +88,19 @@
 		layout.verticalSpacing = 10;
 		GridData fillGrab = new GridData(SWT.FILL, SWT.FILL, true, true);
 
-		objectTable = new Table(base, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL);
-		objectTable.setHeaderVisible(true);
-		objectTable.setLinesVisible(true);
-		objectTable.setLayoutData(fillGrab);
-		objectTable.addSelectionListener(this);
-		objectTable.addControlListener(this);
+		this.objectTable = new Table(base, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL);
+		this.objectTable.setHeaderVisible(true);
+		this.objectTable.setLinesVisible(true);
+		this.objectTable.setLayoutData(fillGrab);
+		this.objectTable.addSelectionListener(this);
+		this.objectTable.addControlListener(this);
 		
 		// get the attributes for this entity
-		EntityResolver entityResolver = context.getEntityResolver();
-		ObjEntity entity = entityResolver.getObjEntity(entityName);
+		EntityResolver entityResolver = this.context.getEntityResolver();
+		ObjEntity entity = entityResolver.getObjEntity(this.entityName);
 		Iterator i = entity.getAttributes().iterator();
 		while (i.hasNext()) {
-			TableColumn column = new TableColumn(objectTable, SWT.NULL);
+			TableColumn column = new TableColumn(this.objectTable, SWT.NULL);
 			ObjAttribute attribute = (ObjAttribute) i.next();
 			column.setText(attribute.getName());
 		}
@@ -119,7 +117,7 @@
 	 * Handle selection of an object in the table.
 	 */
 	public void widgetSelected(SelectionEvent e) {
-		TableItem[] selection = objectTable.getSelection();
+		TableItem[] selection = this.objectTable.getSelection();
 		if (selection != null && selection.length > 0) {
 			((SelectQueryWizard) getWizard()).setSelectedObject((AbstractObject) selection[0].getData());
 		}
@@ -130,13 +128,13 @@
 	 */
 	public void controlResized(ControlEvent e) {		
 		// handle the sizing of the table columns
-		Point size = objectTable.getSize();
-		size.x -= objectTable.getBorderWidth();
-		if (objectTable.getVerticalBar() != null) {
-			size.x -= objectTable.getVerticalBar().getSize().x;
+		Point size = this.objectTable.getSize();
+		size.x -= this.objectTable.getBorderWidth();
+		if (this.objectTable.getVerticalBar() != null) {
+			size.x -= this.objectTable.getVerticalBar().getSize().x;
 		} 
 
-		for (TableColumn col : objectTable.getColumns()) {
+		for (TableColumn col : this.objectTable.getColumns()) {
 			col.setWidth(size.x/3);
 		}
 	}
@@ -148,10 +146,10 @@
 	 * Run the {@link SelectQuery} to fill the table with data
 	 */
 	public void onEnterPage() {
-		objectTable.removeAll();
+		this.objectTable.removeAll();
 			
-		EntityResolver entityResolver = context.getEntityResolver();
-		ObjEntity entity = entityResolver.getObjEntity(entityName);
+		EntityResolver entityResolver = this.context.getEntityResolver();
+		ObjEntity entity = entityResolver.getObjEntity(this.entityName);
 		
 		Expression qual = null;
 		HashMap<String, Object> paramMap = ((SelectQueryWizard) getWizard()).getParametersPage().getParameterMap();
@@ -178,9 +176,9 @@
 		if (matches instanceof List) {
 			for (Object o : (List) matches) {
 				AbstractObject abstractObject = (AbstractObject) o;
-				TableItem item = new TableItem(objectTable, SWT.NULL);
+				TableItem item = new TableItem(this.objectTable, SWT.NULL);
 				int i = 0;
-				for (TableColumn col : objectTable.getColumns()) {
+				for (TableColumn col : this.objectTable.getColumns()) {
 					item.setText(i++, abstractObject.getPropertyValue(col.getText()).toString());
 					item.setData(abstractObject);
 				}
@@ -188,17 +186,17 @@
 		}
 		if (matches instanceof AbstractObject) {
 			AbstractObject abstractObject = (AbstractObject) matches;
-			TableItem item = new TableItem(objectTable, SWT.NULL);
+			TableItem item = new TableItem(this.objectTable, SWT.NULL);
 			int i = 0;
-			for (TableColumn col : objectTable.getColumns()) {
+			for (TableColumn col : this.objectTable.getColumns()) {
 				item.setText(i++, abstractObject.getPropertyValue(col.getText()).toString());
 				item.setData(abstractObject);
 			}
 		}
 		controlResized(null);
-		if (objectTable.getItemCount() > 0) {
-			objectTable.select(0);
-			objectTable.setFocus();
+		if (this.objectTable.getItemCount() > 0) {
+			this.objectTable.select(0);
+			this.objectTable.setFocus();
 			widgetSelected(null);
 		}
 	}



Mime
View raw message