Package net.sourceforge.squirrel_sql.fw.completion.util

Examples of net.sourceforge.squirrel_sql.fw.completion.util.CompletionParser


            for (PropertyInfo propertyInfo : lastFoundBuf.getAttributes())
            {
               if(propertyInfo.getHibernatePropertyInfo().getPropertyName().equals(parser.getToken(0)))
               {
                  MappedClassInfo mappedClassInfo = propertyInfo.getMappedClassInfo();
                  CompletionParser simpleAttrFakeParser = new CompletionParser(mappedClassInfo.getClassName() + "." + parser.getAllButFirst());
                  ArrayList<PropertyInfo> matchingAttributes = mappedClassInfo.getQualifiedMatchingAttributes(simpleAttrFakeParser);
                  ret.addAll(matchingAttributes);
               }
            }
         }
View Full Code Here


   {
      // Example for this code:
      // Completion should
      // from Kv k inner join fetch k.positionen as posses where posses.artNr = 'sdfsdf'

      CompletionParser cp = new CompletionParser(token);

      if(2 > cp.size())
      {
         return getMappedClassInfoForNonAliasedToken(cp, matchNameExact, stateless);
      }

      String aliasCandidate = cp.getToken(0);

      // We need this buffer because this method may be called asynchronously to the event dispatch thread
      // What could happen is, that _currentAliasInfos ist changed.

      ArrayList<AliasInfo> buf = _currentAliasInfos;

      for (AliasInfo currentAliasInfo : buf)
      {
         if(currentAliasInfo.getCompareString().equals(aliasCandidate))
         {
            ArrayList<PropertyInfo> matchingAttributes = currentAliasInfo.getQualifiedMatchingAttributes(cp);
            for (PropertyInfo matchingAttribute : matchingAttributes)
            {
               if(matchingAttribute.getHibernatePropertyInfo().getPropertyName().equals(cp.getLastToken()))
               {
                  return matchingAttribute.getMappedClassInfo();
               }
            }
         }
View Full Code Here

   public CompletionCandidates getCompletionCandidates(String textTillCarret)
   {
      init();

      CompletionParser parser = new CompletionParser(textTillCarret, true);
      return _codeCompletionInfos.getInfosStartingWith(parser);

   }
View Full Code Here

   public ArrayList<PropertyInfo> getQualifiedMatchingAttributes(CompletionParser parser)
   {
      if(1 < parser.size() && parser.getToken(0).equals(_alias))
      {
         return _mci.getQualifiedMatchingAttributes(new CompletionParser(_mci.getClassName() + "." + parser.getAllButFirst()));
      }
      else
      {
         return new ArrayList<PropertyInfo>();
      }
View Full Code Here

  }


   CompletionCandidates getCompletionCandidates(String textTillCarret)
   {
      CompletionParser parser = new CompletionParser(textTillCarret);


      ArrayList<CodeCompletionInfo> ret = new ArrayList<CodeCompletionInfo>();

      if(false == parser.isQualified())
      {

         ///////////////////////////////////////////////////////////////////////////////
         // The colums of the last completed table/view that match the tableNamePat
         // will be returned on top of the collection
         ret.addAll( getColumnsFromLastSelectionStartingWith(parser.getStringToParse()) );
         //
         //////////////////////////////////////////////////////////////////////////////

         ret.addAll( Arrays.asList(_codeCompletionInfos.getInfosStartingWith(null, null, parser.getStringToParse())) );
      }
      else // 1 < buf.size()
      {
         String catalog = null;
         int catAndSchemCount = 0;
         if(_codeCompletionInfos.isCatalog(parser.getToken(0)))
         {
            catalog = parser.getToken(0);
            catAndSchemCount = 1;
         }

         String schema = null;
         if(_codeCompletionInfos.isSchema(parser.getToken(0)))
         {
            schema = parser.getToken(0);
            catAndSchemCount = 1;
         }
         else if(_codeCompletionInfos.isSchema(parser.getToken(1)))
         {
            schema = parser.getToken(1);
            catAndSchemCount = 2;
         }

         // Might also be a catalog or a schema name
         String tableNamePat1 = parser.getToken(parser.size() - 2);
         String colNamePat1 = parser.getToken(parser.size() - 1);

         if(0 < catAndSchemCount)
         {
            String tableNamePat2 = parser.getToken(catAndSchemCount);

            if(parser.size() > catAndSchemCount + 1)
            {
               String colNamePat2 = parser.getToken(catAndSchemCount+1);
               ret.addAll( getColumnsForName(catalog, schema, tableNamePat2, colNamePat2, parser.getStringToParsePosition()) );
            }
            else
            {
               ret.addAll(Arrays.asList(_codeCompletionInfos.getInfosStartingWith(catalog, schema, tableNamePat2)));
            }

         }
         else
         {
            ret.addAll( getColumnsForName(null, null, tableNamePat1, colNamePat1, parser.getStringToParsePosition()) );
         }
      }

      CodeCompletionInfo[] ccis = ret.toArray(new CodeCompletionInfo[ret.size()]);

      return new CompletionCandidates(ccis, parser.getReplacementStart(), parser.getStringToReplace());
   }
View Full Code Here

TOP

Related Classes of net.sourceforge.squirrel_sql.fw.completion.util.CompletionParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.