Search in sources :

Example 1 with TableFolderNode

use of org.talend.sqlbuilder.dbstructure.nodes.TableFolderNode in project tdi-studio-se by Talend.

the class SQLCompletionProcessor method getProposalsByNode2.

/**
     * DOC dev Comment method "getProposalsByNode2".
     * 
     * @param documentOffset
     * @param lastPart
     * @param node
     * @return
     */
//$NON-NLS-1$
@SuppressWarnings("unchecked")
private ICompletionProposal[] getProposalsByNode2(int documentOffset, String lastPart, INode node) {
    String[] proposalsString = dictionary.matchTablePrefix(lastPart.toLowerCase());
    ArrayList propList = new ArrayList();
    for (int i = 0; i < proposalsString.length; i++) {
        ArrayList ls = dictionary.getTableObjectList(proposalsString[i]);
        for (int j = 0; j < ls.size(); j++) {
            TableNode tbNode = (TableNode) ls.get(j);
            Image tmpImage = null;
            TableFolderNode totn = (TableFolderNode) tbNode.getParent();
            INode catSchema = (INode) totn.getParent();
            if (catSchema == node) {
                if (tbNode.isView()) {
                    tmpImage = viewImage;
                } else if (tbNode.isTable()) {
                    tmpImage = tableImage;
                }
                ICompletionProposal cmp = new ExtendedCompletionProposal(proposalsString[i], documentOffset - lastPart.length(), lastPart.length(), proposalsString[i].length(), tmpImage, proposalsString[i], tbNode);
                propList.add(cmp);
            }
        }
    }
    ICompletionProposal[] res = new ICompletionProposal[propList.size()];
    System.arraycopy(propList.toArray(), 0, res, 0, propList.size());
    return res;
}
Also used : INode(org.talend.sqlbuilder.dbstructure.nodes.INode) ICompletionProposal(org.eclipse.jface.text.contentassist.ICompletionProposal) ArrayList(java.util.ArrayList) TableNode(org.talend.sqlbuilder.dbstructure.nodes.TableNode) Image(org.eclipse.swt.graphics.Image) Point(org.eclipse.swt.graphics.Point) TableFolderNode(org.talend.sqlbuilder.dbstructure.nodes.TableFolderNode)

Aggregations

ArrayList (java.util.ArrayList)1 ICompletionProposal (org.eclipse.jface.text.contentassist.ICompletionProposal)1 Image (org.eclipse.swt.graphics.Image)1 Point (org.eclipse.swt.graphics.Point)1 INode (org.talend.sqlbuilder.dbstructure.nodes.INode)1 TableFolderNode (org.talend.sqlbuilder.dbstructure.nodes.TableFolderNode)1 TableNode (org.talend.sqlbuilder.dbstructure.nodes.TableNode)1