X-Git-Url: http://git.phpeclipse.com diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/QueryNode.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/QueryNode.java new file mode 100644 index 0000000..4826003 --- /dev/null +++ b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/view/bookmark/QueryNode.java @@ -0,0 +1,64 @@ +package com.quantum.view.bookmark; + +import com.quantum.sql.metadata.ObjectMetaData; + +public class QueryNode extends TreeNode { + + private String query; + private static final int MAX_SIZE = 30; + + public QueryNode(TreeNode parent, String query) { + super(parent); + this.query = query; + } + + public ObjectMetaData getMetaData() { + return null; //no metadata implementation for now + } + + public String getQuery() { + return this.query; + } + + public String getName() { + String name = this.query.trim(); + boolean trimmed = false; + name = name.replace('\n', ' '); + + if (name.length() > MAX_SIZE) { + name = name.substring(0, MAX_SIZE); + trimmed = true; + } + if (trimmed) { + name += "...->"; //$NON-NLS-1$ + } + return name; + } + + /** + * @see com.quantum.view.bookmark.TreeNode#getChildren() + */ + public Object[] getChildren() { + return BookmarkListNode.EMPTY_ARRAY; + } + + /** + * @see com.quantum.view.bookmark.TreeNode#hasChildren() + */ + public boolean hasChildren() { + return false; + } + + /** + * @see com.quantum.view.bookmark.TreeNode#getImageName() + */ + protected String getImageName() { + return "script.gif"; + } + + /* (non-Javadoc) + * @see com.quantum.view.bookmark.TreeNode#initializeChildren() + */ + protected void initializeChildren() { + } +}