Examples of SuggestionCompletionEngine


Examples of org.drools.ide.common.client.modeldriven.SuggestionCompletionEngine

    /**
     * Removed the package from the cache, causing it to be loaded the next time.
     */
    public void refreshPackage(String packageName, Command done) {
        SuggestionCompletionEngine sce = cache.get(packageName);
        //No need to remove sce from cache as this makes sce temporarily unavailable during the
        //period between removing sce and putting it back.
/*        if (sce != null) {
            sce.setFactTypeFilter(null);
            cache.remove( packageName );
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.SuggestionCompletionEngine

    /**
     * Returns true is a var name has already been used either by the rule, or
     * as a global.
     */
    public boolean isVariableNameUsed(String name) {
        SuggestionCompletionEngine completions = SuggestionCompletionCache.getInstance().getEngineFromCache( packageName );
        return model.isVariableNameUsed( name ) || completions.isGlobalVariable( name );
    }
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.SuggestionCompletionEngine

    /**
     * Pops up the fact selector.
     */
    protected void showRightPatternSelector(final Widget w) {
        final ListBox box = new ListBox();
        SuggestionCompletionEngine completions = this.getModeller().getSuggestionCompletions();
        String[] facts = completions.getFactTypes();

        box.addItem(constants.Choose());
        for (int i = 0; i < facts.length; i++) {
            box.addItem(facts[i]);
        }
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.SuggestionCompletionEngine

    /**
     * Pops up the fact selector.
     */
    protected void showFactTypeSelector(final Widget w) {
        SuggestionCompletionEngine completions = this.getModeller().getSuggestionCompletions();
        final ListBox box = new ListBox();
        String[] facts = completions.getFactTypes();

        box.addItem( constants.Choose() );

        for ( int i = 0; i < facts.length; i++ ) {
            box.addItem( facts[i] );
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.SuggestionCompletionEngine

        this.model = set;
        this.layout = new DirtyableFlexTable();

        layout.setStyleName( "model-builderInner-Background" ); // NON-NLS

        SuggestionCompletionEngine completions = this.getModeller().getSuggestionCompletions();
        if ( completions.isGlobalVariable( set.variable ) ) {

            List<MethodInfo> infos = completions.getMethodInfosForGlobalVariable( set.variable );
            this.fieldCompletionTexts = new String[infos.size()];
            this.fieldCompletionValues = new String[infos.size()];
            int i = 0;
            for ( MethodInfo info : infos ) {
                this.fieldCompletionTexts[i] = info.getName();
                this.fieldCompletionValues[i] = info.getNameWithParameters();
                i++;
            }

            this.variableClass = (String) completions.getGlobalVariable( set.variable );
        } else {
           
            FactPattern pattern = mod.getModel().getLHSBoundFact( set.variable );
            if ( pattern != null ) {
                List<String> methodList = completions.getMethodNames( pattern.getFactType() );
                fieldCompletionTexts = new String[methodList.size()];
                fieldCompletionValues = new String[methodList.size()];
                int i = 0;
                for ( String methodName : methodList ) {
                    fieldCompletionTexts[i] = methodName;
                    fieldCompletionValues[i] = methodName;
                    i++;
                }
                this.variableClass = pattern.getFactType();
                this.isBoundFact = true;
               
            } else {
                /*
                 *  if the call method is applied on a bound variable created in the rhs
                 */
                ActionInsertFact patternRhs = mod.getModel().getRHSBoundFact( set.variable );
                if ( patternRhs != null ) {
                    List<String> methodList = completions.getMethodNames( patternRhs.factType );
                    fieldCompletionTexts = new String[methodList.size()];
                    fieldCompletionValues = new String[methodList.size()];
                    int i = 0;
                    for ( String methodName : methodList ) {
                        fieldCompletionTexts[i] = methodName;
                        fieldCompletionValues[i] = methodName;
                        i++;
                    }
                    this.variableClass = patternRhs.factType;
                    this.isBoundFact = true;
                }
            }
        }

        if ( readOnly == null ) {
            this.readOnly = !completions.containsFactType( this.variableClass );
        } else {
            this.readOnly = readOnly;
        }

        if ( this.readOnly ) {
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.SuggestionCompletionEngine

        return horiz;
    }

    protected void showAddFieldPopup(Widget w) {

        final SuggestionCompletionEngine completions = this.getModeller().getSuggestionCompletions();

        final FormStylePopup popup = new FormStylePopup( images.newexWiz(),
                                                         constants.ChooseAMethodToInvoke() );
        final ListBox box = new ListBox();
        box.addItem( "..." );

        for ( int i = 0; i < fieldCompletionTexts.length; i++ ) {
            box.addItem( fieldCompletionTexts[i],
                         fieldCompletionValues[i] );
        }

        box.setSelectedIndex( 0 );

        popup.addAttribute( constants.ChooseAMethodToInvoke(),
                            box );
        box.addChangeHandler( new ChangeHandler() {

            public void onChange(ChangeEvent event) {
                model.state = ActionCallMethod.TYPE_DEFINED;

                String methodName = box.getItemText( box.getSelectedIndex() );
                String methodNameWithParams = box.getValue( box.getSelectedIndex() );

                model.methodName = methodName;
                List<String> fieldList = new ArrayList<String>();

                fieldList.addAll( completions.getMethodParams( variableClass,
                                                               methodNameWithParams ) );

                int i = 0;
                for ( String fieldParameter : fieldList ) {
                    model.addFieldValue( new ActionFieldFunction( methodName,
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.SuggestionCompletionEngine

    }

    private Widget valueEditor(final ActionFieldFunction val) {

        SuggestionCompletionEngine completions = this.getModeller().getSuggestionCompletions();

        String type = "";
        if ( completions.isGlobalVariable( this.model.variable ) ) {
            type = completions.getGlobalVariable( this.model.variable );
        } else {
            type = this.getModeller().getModel().getLHSBindingType( this.model.variable );
            if ( type == null ) {
                type = this.getModeller().getModel().getRHSBoundFact( this.model.variable ).factType;
            }
        }

        DropDownData enums = completions.getEnums( type,
                                                   this.model.fieldValues,
                                                   val.field );

        return new MethodParameterValueEditor( val,
                                               enums,
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.SuggestionCompletionEngine

        super( mod );
        this.model = set;
        this.layout = new DirtyableFlexTable();
        this.factType = set.factType;

        SuggestionCompletionEngine completions = this.getModeller().getSuggestionCompletions();
        this.fieldCompletions = completions.getFieldCompletions( FieldAccessorsAndMutators.MUTATOR,
                                                                 set.factType );

        layout.setStyleName( "model-builderInner-Background" ); //NON-NLS

        if ( readOnly == null ) {
            this.readOnly = !completions.containsFactType( set.factType );
        } else {
            this.readOnly = readOnly;
        }

        if ( this.readOnly ) {
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.SuggestionCompletionEngine

                          inner );

    }

    private Widget valueEditor(final ActionFieldValue val) {
        SuggestionCompletionEngine completions = this.getModeller().getSuggestionCompletions();
        DropDownData enums = completions.getEnums( this.factType,
                                                   this.model.fieldValues,
                                                   val.field );

        ActionValueEditor actionValueEditor = new ActionValueEditor( val,
                                                                     enums,
View Full Code Here

Examples of org.drools.ide.common.client.modeldriven.SuggestionCompletionEngine

                                   !this.readOnly );

    }

    protected void showAddFieldPopup(Widget w) {
        final SuggestionCompletionEngine completions = this.getModeller().getSuggestionCompletions();
        final FormStylePopup popup = new FormStylePopup( images.newexWiz(),
                                                         constants.AddAField() );
        final ListBox box = new ListBox();
        box.addItem( "..." );

        for ( int i = 0; i < fieldCompletions.length; i++ ) {
            box.addItem( fieldCompletions[i] );
        }

        box.setSelectedIndex( 0 );

        popup.addAttribute( constants.AddField(),
                            box );
        box.addChangeHandler( new ChangeHandler() {
            public void onChange(ChangeEvent event) {
                String fieldName = box.getItemText( box.getSelectedIndex() );
                String fieldType = completions.getFieldType( model.factType,
                                                             fieldName );
                model.addFieldValue( new ActionFieldValue( fieldName,
                                                           "",
                                                           fieldType ) );
                setModified( true );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.