Examples of DSLMappingEntry


Examples of org.drools.compiler.lang.dsl.DSLMappingEntry

            public void widgetDefaultSelected(SelectionEvent e) {
                populate();
            }

            private void populate() {
                DSLMappingEntry selected = getCurrentSelected();
                exprText.setText( selected.getMappingKey() );
                mappingText.setText( selected.getMappingValue() );
                objText.setText( selected.getMetaData().getMetaData() == null ? "" : selected.getMetaData().getMetaData() );
            }

        } );

        //double click support
View Full Code Here

Examples of org.drools.compiler.lang.dsl.DSLMappingEntry

        } );
    }

    private void showEditPopup() {
        DSLMappingEntry selected = getCurrentSelected();
        if (selected != null) {
            MappingEditor editor = new MappingEditor( getSite().getShell() );
            editor.create();
            editor.getShell().setText( "Edit language mapping" );
            editor.setTitle( "Edit an existing language mapping item." );
            editor.setTitleImage( getTitleImage() );

            editor.setNLMappingItem( selected );

            editor.open();
            if ( !editor.isCancelled() ) {
                refreshModel();
                makeDirty();
                exprText.setText(selected.getMappingKey());
                mappingText.setText(selected.getMappingValue());
                objText.setText(selected.getMetaData().getMetaData() == null ? "" : selected.getMetaData().getMetaData());
            }
        }
    }
View Full Code Here

Examples of org.drools.compiler.lang.dsl.DSLMappingEntry

        add.addSelectionListener( new SelectionAdapter() {

            // Add an item, should pop up the editor
            public void widgetSelected(SelectionEvent e) {

                DSLMappingEntry newItem = new AntlrDSLMappingEntry();

                MappingEditor editor = new MappingEditor( getSite().getShell() );//shell);
                editor.create();
                editor.getShell().setText( "New language mapping" );
                editor.setTitle( "Create a new language element mapping." );
View Full Code Here

Examples of org.drools.compiler.lang.dsl.DSLMappingEntry

        copy.addSelectionListener( new SelectionAdapter() {

            // Add an item, should pop up the editor
            public void widgetSelected(SelectionEvent e) {

                DSLMappingEntry curr = getCurrentSelected();
                if (curr != null) {
                    DSLMappingEntry newItem = new AntlrDSLMappingEntry( curr.getSection(),
                                                                          curr.getMetaData(),
                                                                          curr.getMappingKey(),
                                                                          curr.getMappingValue(),
                                                                          null,
                                                                          null);
View Full Code Here

Examples of org.drools.compiler.lang.dsl.DSLMappingEntry

    }

    public String getColumnText(Object element,
                                int columnIndex) {
        String result = "";
        DSLMappingEntry item = (DSLMappingEntry) element;
        switch (columnIndex) {
            case 0
                result = item.getMappingKey();
                break;
            case 1 :
                result = item.getMappingValue();
                break;
            case 2 :
                result = item.getMetaData().getMetaData();
                break;
            case 3 :
                result = item.getSection().getSymbol();
                break;
            default :
                break;
        }
        return result;
View Full Code Here

Examples of org.drools.compiler.lang.dsl.DSLMappingEntry

            assertTrue( this.file.getErrors().isEmpty() );

            assertEquals( 1,
                          this.file.getMapping().getEntries().size() );

            DSLMappingEntry entry = (DSLMappingEntry) this.file.getMapping().getEntries().get( 0 );

            assertEquals( DSLMappingEntry.CONDITION,
                          entry.getSection() );
            assertEquals( DSLMappingEntry.EMPTY_METADATA,
                          entry.getMetaData() );
            assertEquals( lookbehind + "ATTRIBUTE\\s+\"(.*?)\"\\s+IS\\s+IN\\s+[(.*?)](?=\\W|$)",
                          entry.getKeyPattern().toString() );
            //Attribute( {attr} in ({list}) )
            assertEquals( "Attribute( {attr} in ({list}) )",
                          entry.getValuePattern() );

        } catch ( final IOException e ) {
            e.printStackTrace();
            fail( "Should not raise exception " );
        }
View Full Code Here

Examples of org.drools.compiler.lang.dsl.DSLMappingEntry

            assertTrue( this.file.getErrors().isEmpty() );

            assertEquals( 1,
                          this.file.getMapping().getEntries().size() );

            DSLMappingEntry entry = (DSLMappingEntry) this.file.getMapping().getEntries().get( 0 );

            assertEquals( DSLMappingEntry.CONDITION,
                          entry.getSection() );
            assertEquals( DSLMappingEntry.EMPTY_METADATA,
                          entry.getMetaData() );
           
            assertEquals( lookbehind + "ATTRIBUTE\\s+\"(.*?)\"\\s+IS\\s+IN\\s+\\[(.*?)\\](?=\\W|$)",
                          entry.getKeyPattern().toString() );
            //Attribute( {attr} in ({list}) )
            assertEquals( "Attribute( {attr} in ({list}) )",
                          entry.getValuePattern() );

        } catch ( final IOException e ) {
            e.printStackTrace();
            fail( "Should not raise exception " );
        }
View Full Code Here

Examples of org.drools.compiler.lang.dsl.DSLMappingEntry

            assertTrue( this.file.getErrors().isEmpty() );

            assertEquals( 1,
                          this.file.getMapping().getEntries().size() );

            DSLMappingEntry entry = (DSLMappingEntry) this.file.getMapping().getEntries().get( 0 );

            assertEquals( DSLMappingEntry.CONDITION,
                          entry.getSection() );
            assertEquals( DSLMappingEntry.EMPTY_METADATA,
                          entry.getMetaData() );
            assertEquals( lookbehind + "something:\\=(.*?)$",
                          entry.getKeyPattern().toString() );
            assertEquals( "Attribute( something == \"{value}\" )",
                          entry.getValuePattern() );

        } catch ( final IOException e ) {
            e.printStackTrace();
            fail( "Should not raise exception " );
        }
View Full Code Here

Examples of org.drools.compiler.lang.dsl.DSLMappingEntry

            assertTrue( this.file.getErrors().isEmpty() );

            assertEquals( 1,
                          this.file.getMapping().getEntries().size() );

            DSLMappingEntry entry = (DSLMappingEntry) this.file.getMapping().getEntries().get( 0 );

            assertEquals( DSLMappingEntry.CONDITION,
                          entry.getSection() );
            assertEquals( DSLMappingEntry.EMPTY_METADATA,
                          entry.getMetaData() );
            assertEquals( "ATTRIBUTE \"{attr}\" IS IN \\[{list}\\]",
                          entry.getMappingKey() );
            assertEquals( "Attribute( {attr} in ({list}) )",
                          entry.getMappingValue() );

        } catch ( final IOException e ) {
            e.printStackTrace();
            fail( "Should not raise exception " );
        }
View Full Code Here

Examples of org.drools.compiler.lang.dsl.DSLMappingEntry

            assertTrue( this.file.getErrors().isEmpty() );

            assertEquals( 1,
                          this.file.getMapping().getEntries().size() );

            DSLMappingEntry entry = (DSLMappingEntry) this.file.getMapping().getEntries().get( 0 );

            assertEquals( DSLMappingEntry.CONSEQUENCE,
                          entry.getSection() );
            assertEquals( "$policy",
                          entry.getMetaData().toString() );
            assertEquals( "Add surcharge {surcharge} to Policy",
                          entry.getMappingKey() );
            assertEquals( "modify(policy) \\{price = {surcharge}\\}",
                          entry.getMappingValue() );
           
            String input = "rule x\nwhen\nthen\nAdd surcharge 300 to Policy\nend\n";
            String expected = "rule x\nwhen\nthen\nmodify(policy) {price = 300}\nend\n";
           
            DefaultExpander de = new DefaultExpander();
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.