Ignore:
Timestamp:
02/23/06 20:42:33 (19 years ago)
Author:
boris
Message:
  • implement code completion based in renaming imports (hah, this one was easy !)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/org.modelica.mdt.ui/src/org/modelica/mdt/ui/editor/ModelicaCompletionProcessor.java

    r365 r369  
    403403            {
    404404            case QUALIFIED:
    405                 computeCompPropsFromPackage(imp.getImportedPackage(),
     405                computeCompPropsFromPackage(imp.getImportedPackage(), null,
    406406                        prefix, offset, proposals);
    407407                break;
     
    409409                break;
    410410            case RENAMING:
     411                computeCompPropsFromPackage(imp.getImportedPackage(),
     412                        imp.getAlias(), prefix, offset, proposals);             
    411413                break;
    412414            }
     
    414416    }
    415417
     418    /**
     419     * Compute proposals based on an imported package. This method
     420     * bases the computation on package, packages alias if available,
     421     * the prefix before current cursor position.
     422     *
     423     * Proposals are added to provided list 'proposals' list. Given offset
     424     * is used to create completion propopal object with correct replacement
     425     * data. 
     426     *
     427     * @param importedPackage the package that is imported
     428     * @param packageAlias package's alias or null if package have no alias
     429     * @param prefix the prefix before current cursor position
     430     * @param offset the current cursor position in the document
     431     * @param proposals the computed proposals will be added to this list
     432     */
    416433    private void computeCompPropsFromPackage(IModelicaClass importedPackage,
     434            String packageAlias,
    417435            String prefix, int offset,
    418436            Collection<ICompletionProposal> proposals)
     
    425443         */
    426444        int firstDot = prefix.indexOf('.');
    427         String packageName = importedPackage.getElementName();
    428            
     445        String packageName;
     446       
     447        if (packageAlias != null)
     448        {
     449            packageName = packageAlias;
     450        }
     451        else
     452        {
     453            packageName = importedPackage.getElementName();
     454        }
     455
    429456        if (firstDot == -1)
    430457        {
Note: See TracChangeset for help on using the changeset viewer.