Examples of DRLInfo


Examples of org.drools.eclipse.DRLInfo

    }

    private List<DroolsBuildMarker> parseResource(ResourceParser resourceParser) {
        List<DroolsBuildMarker> markers = new ArrayList<DroolsBuildMarker>();
        try {
            DRLInfo drlInfo = resourceParser.parseResource();

            //parser errors
            markParseErrors( markers, drlInfo.getParserErrors() );
            markOtherErrors( markers, drlInfo.getBuilderErrors() );
        } catch ( DroolsParserException e ) {
            // we have an error thrown from DrlParser
            Throwable cause = e.getCause();
            if ( cause instanceof RecognitionException ) {
                RecognitionException recogErr = (RecognitionException) cause;
View Full Code Here

Examples of org.drools.eclipse.DRLInfo

    private DroolsBuildMarker[] parseDRLFile(IFile file,
                                             String content) {
        List markers = new ArrayList();
        try {
            DRLInfo drlInfo =
                    DroolsEclipsePlugin.getDefault().parseResource( file,
                                                                    true );
            //parser errors
            markParseErrors( markers,
                             drlInfo.getParserErrors() );
            markOtherErrors( markers,
                             drlInfo.getBuilderErrors() );
        } catch ( DroolsParserException e ) {
            // we have an error thrown from DrlParser
            Throwable cause = e.getCause();
            if ( cause instanceof RecognitionException ) {
                RecognitionException recogErr = (RecognitionException) cause;
View Full Code Here

Examples of org.drools.eclipse.DRLInfo

        List markers = new ArrayList();
        try {
            SpreadsheetCompiler converter = new SpreadsheetCompiler();
            String drl = converter.compile( file.getContents(),
                                            InputType.XLS );
            DRLInfo drlInfo =
                    DroolsEclipsePlugin.getDefault().parseXLSResource( drl,
                                                                       file );
            // parser errors
            markParseErrors( markers,
                             drlInfo.getParserErrors() );
            markOtherErrors( markers,
                             drlInfo.getBuilderErrors() );
        } catch ( DroolsParserException e ) {
            // we have an error thrown from DrlParser
            Throwable cause = e.getCause();
            if ( cause instanceof RecognitionException ) {
                RecognitionException recogErr = (RecognitionException) cause;
View Full Code Here

Examples of org.drools.eclipse.DRLInfo

        List markers = new ArrayList();
        try {
            SpreadsheetCompiler converter = new SpreadsheetCompiler();
            String drl = converter.compile( file.getContents(),
                                            InputType.CSV );
            DRLInfo drlInfo =
                    DroolsEclipsePlugin.getDefault().parseXLSResource( drl,
                                                                       file );
            // parser errors
            markParseErrors( markers,
                             drlInfo.getParserErrors() );
            markOtherErrors( markers,
                             drlInfo.getBuilderErrors() );
        } catch ( DroolsParserException e ) {
            // we have an error thrown from DrlParser
            Throwable cause = e.getCause();
            if ( cause instanceof RecognitionException ) {
                RecognitionException recogErr = (RecognitionException) cause;
View Full Code Here

Examples of org.drools.eclipse.DRLInfo

            RuleModel model = BRXMLPersistence.getInstance().unmarshal( brl );
            String drl = BRDRLPersistence.getInstance().marshal( model );

            // TODO pass this through DSL converter in case brl is based on dsl

            DRLInfo drlInfo =
                    DroolsEclipsePlugin.getDefault().parseBRLResource( drl,
                                                                       file );
            // parser errors
            markParseErrors( markers,
                             drlInfo.getParserErrors() );
            markOtherErrors( markers,
                             drlInfo.getBuilderErrors() );
        } catch ( DroolsParserException e ) {
            // we have an error thrown from DrlParser
            Throwable cause = e.getCause();
            if ( cause instanceof RecognitionException ) {
                RecognitionException recogErr = (RecognitionException) cause;
View Full Code Here

Examples of org.drools.eclipse.DRLInfo

            GuidedDecisionTable52 dt = GuidedDTXMLPersistence.getInstance().unmarshal( gdst );
            String drl = GuidedDTDRLPersistence.getInstance().marshal( dt );

            // TODO pass this through DSL converter in case brl is based on dsl

            DRLInfo drlInfo =
                    DroolsEclipsePlugin.getDefault().parseGDSTResource( drl,
                                                                        file );
            // parser errors
            markParseErrors( markers,
                             drlInfo.getParserErrors() );
            markOtherErrors( markers,
                             drlInfo.getBuilderErrors() );
        } catch ( DroolsParserException e ) {
            // we have an error thrown from DrlParser
            Throwable cause = e.getCause();
            if ( cause instanceof RecognitionException ) {
                RecognitionException recogErr = (RecognitionException) cause;
View Full Code Here

Examples of org.drools.eclipse.DRLInfo

        if (!(getEditor().getEditorInput() instanceof IFileEditorInput)) {
            return proposals;
        }

        try {
            DRLInfo drlInfo = DroolsEclipsePlugin.getDefault().generateParsedResource(
                "package dummy; \n" + ruleBackText,
                ((IFileEditorInput) getEditor().getEditorInput()).getFile(),
                false,
                false );
View Full Code Here

Examples of org.drools.eclipse.DRLInfo

    return null;
  }
 
  private BaseDescr getDescr(int offset) {
    try {
      DRLInfo info = DroolsEclipsePlugin.getDefault().parseResource(
          editor, true, false);
      return DescrUtil.getDescr(info.getPackageDescr(), offset);
    } catch (DroolsParserException exc) {
      return null;
    }
  }
View Full Code Here

Examples of org.drools.eclipse.DRLInfo

                    && javaProject.isOnClasspath(resource)) {
                IFile file = (IFile) resource;
                if ("drl".equals(resource.getFileExtension())
                            || "dslr".equals(resource.getFileExtension())) {
                    try {
                        DRLInfo drlInfo = DroolsEclipsePlugin.getDefault().parseResource(resource, false);
                        String packageName = drlInfo.getPackageName();
                        Package pkg = ruleSet.getPackage(packageName);
                        if (pkg == null) {
                            pkg = DroolsModelBuilder.addPackage(ruleSet, packageName, 0, 0);
                        }
                        if (drlInfo.getBuilderErrors().length > 0 || drlInfo.getPackageDescr() == null) {
                            return false;
                        }
                        // add rules
                        List rules = drlInfo.getPackageDescr().getRules();
                        for (Iterator iterator = rules.iterator(); iterator.hasNext();) {
                            RuleDescr ruleDescr = (RuleDescr) iterator.next();
                            boolean isQuery = ruleDescr instanceof QueryDescr;
                            String ruleName = ruleDescr.getName();
                            if (!isQuery) {
                                Rule rule = DroolsModelBuilder.addRule(
                                    pkg, ruleName, file, ruleDescr.getStartCharacter(),
                                    ruleDescr.getEndCharacter() - ruleDescr.getStartCharacter() + 1, null);
                                // create link between resource and created rule nodes
                                List droolsElements = (List) resourcesMap.get(file);
                                if (droolsElements == null) {
                                    droolsElements = new ArrayList();
                                    resourcesMap.put(file, droolsElements);
                                }
                                droolsElements.add(rule);
                            } else {
                                Query query = DroolsModelBuilder.addQuery(
                                    pkg, ruleName, file, ruleDescr.getStartCharacter(),
                                    ruleDescr.getEndCharacter() - ruleDescr.getStartCharacter() + 1);
                                // create link between resource and created rule nodes
                                List droolsElements = (List) resourcesMap.get(file);
                                if (droolsElements == null) {
                                    droolsElements = new ArrayList();
                                    resourcesMap.put(file, droolsElements);
                                }
                                droolsElements.add(query);
                            }
                        }
                        // add globals
                        List globals = drlInfo.getPackageDescr().getGlobals();
                        for (Iterator iterator = globals.iterator(); iterator.hasNext();) {
                            GlobalDescr globalDescr = (GlobalDescr) iterator.next();
                            Global global = DroolsModelBuilder.addGlobal(
                                pkg, globalDescr.getIdentifier(), file, globalDescr.getStartCharacter(),
                                globalDescr.getEndCharacter() - globalDescr.getStartCharacter() + 1);
                            // create link between resource and created rule nodes
                            List droolsElements = (List) resourcesMap.get(file);
                            if (droolsElements == null) {
                                droolsElements = new ArrayList();
                                resourcesMap.put(file, droolsElements);
                            }
                            droolsElements.add(global);
                        }
                        // add functions
                        List functions = drlInfo.getPackageDescr().getFunctions();
                        for (Iterator iterator = functions.iterator(); iterator.hasNext();) {
                            FunctionDescr functionDescr = (FunctionDescr) iterator.next();
                            String functionName = functionDescr.getName();
                            Function function = DroolsModelBuilder.addFunction(
                                pkg, functionName, file, functionDescr.getStartCharacter(),
View Full Code Here

Examples of org.drools.eclipse.DRLInfo

    public void setJavaBreakpointProperties() throws CoreException {
        IMarker marker = getMarker();
        int drlLineNumber = getDRLLineNumber();
        if ( marker.exists() ) {
            try {
                DRLInfo drlInfo = DroolsEclipsePlugin.getDefault().parseResource( marker.getResource(), true );

                RuleInfo[] ruleInfos = drlInfo.getRuleInfos();

                StringBuffer rb = new StringBuffer();
                for (int i=0;i<ruleInfos.length; i++) {
                    int line = ruleInfos[i].getConsequenceDrlLineNumber();
                    String ruleid = ruleInfos[i].getClassName()+":"+line;
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.