コード例 #1
0
 public boolean canToggleLineBreakpoints(IWorkbenchPart part, ISelection selection) {
   if (part instanceof IEditorPart && selection instanceof ITextSelection) {
     IEditorPart editor = (IEditorPart) part;
     IResource resource = (IResource) editor.getEditorInput().getAdapter(IResource.class);
     ITextSelection textSelection = (ITextSelection) selection;
     int lineNumber = textSelection.getStartLine();
     try {
       DRLInfo drlInfo = DroolsEclipsePlugin.getDefault().parseResource(resource, false);
       if (drlInfo != null) {
         RuleInfo ruleInfo = drlInfo.getRuleInfo(lineNumber);
         if (ruleInfo != null) {
           if (ruleInfo.getConsequenceDrlLineNumber() <= lineNumber) {
             return true;
           }
         }
         FunctionInfo functionInfo = drlInfo.getFunctionInfo(lineNumber);
         if (functionInfo != null) {
           if (functionInfo.getDrlLineNumber() <= lineNumber) {
             return true;
           }
         }
       }
     } catch (Throwable t) {
       DroolsEclipsePlugin.log(t);
     }
   }
   return false;
 }
コード例 #2
0
 public String getSourceName(Object object) throws CoreException {
   if (object instanceof MVELStackFrame) {
     MVELStackFrame frame = (MVELStackFrame) object;
     RuleInfo ruleInfo = frame.getExecutingRuleInfo();
     if (ruleInfo != null) {
       String sourcePath = ruleInfo.getSourcePathName();
       return sourcePath;
     }
     FunctionInfo functionInfo = frame.getExecutingFunctionInfo();
     if (functionInfo != null) {
       return functionInfo.getSourcePathName();
     }
   }
   return super.getSourceName(object);
 }