public List<RuleBasicContentInfo> getImports() { List<RuleBasicContentInfo> imports = new ArrayList<RuleBasicContentInfo>(); for (Integer key : contents.keySet()) { RuleBasicContentInfo info = contents.get(key); if (info.getType().equals(DRLContentTypeEnum.IMPORT)) imports.add(info); } return imports; }
public List<RuleBasicContentInfo> getImports() { List<RuleBasicContentInfo> imports = new ArrayList<RuleBasicContentInfo>(); for (Integer key : contents.keySet()) { RuleBasicContentInfo info = contents.get(key); if (info.getType().equals(DRLContentTypeEnum.IMPORT)) imports.add(info); } return imports; }
@Override protected AssistantOption fixImports(RuleBasicContentInfo contentInfo) { if (contentInfo==null) return null; if (!contentInfo.getType().equals(DRLContentTypeEnum.RULE_LHS_LINE) && !contentInfo.getType().equals(DRLContentTypeEnum.RULE_RHS_LINE)) return null; List<RuleBasicContentInfo> imports = ((DRLRuleRefactorInfo)ruleRefactorInfo).getImports(); FixImport.execute(contentInfo, imports); return null; }
@Override protected AssistantOption fixImports(RuleBasicContentInfo contentInfo) { if (contentInfo==null) return null; if (!contentInfo.getType().equals(DRLContentTypeEnum.RULE_LHS_LINE) && !contentInfo.getType().equals(DRLContentTypeEnum.RULE_RHS_LINE)) return null; List<RuleBasicContentInfo> imports = ((DRLRuleRefactorInfo)ruleRefactorInfo).getImports(); FixImport.execute(contentInfo, imports); return null; }
public RuleBasicContentInfo getContentAt(int offset) { if (contents.containsKey(offset)) return contents.get(offset); int previousKey = 0; for (Integer key : contents.keySet()) { if (key > offset) { RuleBasicContentInfo info = contents.get(previousKey); if ((previousKey + info.getContentLength()) >= offset) { if (info.getType().equals(DRLContentTypeEnum.RULE)) return searchInsideTheRule(offset, (RuleDRLContentInfo) info); return info; } return null; } previousKey = key; } RuleBasicContentInfo info = contents.get(previousKey); if (info.getType().equals(DRLContentTypeEnum.RULE)) return searchInsideTheRule(offset, (RuleDRLContentInfo) info); return (info.getContentLength() + previousKey > offset)?info:null; }
public RuleBasicContentInfo getContentAt(int offset) { if (contents.containsKey(offset)) return contents.get(offset); int previousKey = 0; for (Integer key : contents.keySet()) { if (key > offset) { RuleBasicContentInfo info = contents.get(previousKey); if ((previousKey + info.getContentLength()) >= offset) { if (info.getType().equals(DRLContentTypeEnum.RULE)) return searchInsideTheRule(offset, (RuleDRLContentInfo) info); return info; } return null; } previousKey = key; } RuleBasicContentInfo info = contents.get(previousKey); if (info.getType().equals(DRLContentTypeEnum.RULE)) return searchInsideTheRule(offset, (RuleDRLContentInfo) info); return (info.getContentLength() + previousKey > offset)?info:null; }
@Override protected AssistantOption renameVariable(RuleBasicContentInfo contentInfo) { if (contentInfo==null) return null; if (!contentInfo.getType().equals(DRLContentTypeEnum.RULE_LHS_LINE) && !contentInfo.getType().equals(DRLContentTypeEnum.RULE_RHS_LINE)) return null; String variable; if ((variable = VariableRename.isPossible(contentInfo, offset-contentInfo.getOffset()))!=null) return new RenameAssistantOption("rename variable", variable, contentInfo, contentInfo.getOffset()); return null; }
@Override protected AssistantOption renameVariable(RuleBasicContentInfo contentInfo) { if (contentInfo==null) return null; if (!contentInfo.getType().equals(DRLContentTypeEnum.RULE_LHS_LINE) && !contentInfo.getType().equals(DRLContentTypeEnum.RULE_RHS_LINE)) return null; String variable; if ((variable = VariableRename.isPossible(contentInfo, offset-contentInfo.getOffset()))!=null) return new RenameAssistantOption("rename variable", variable, contentInfo, contentInfo.getOffset()); return null; }
@Override protected AssistantOption bindVariable(RuleBasicContentInfo contentInfo) { if (contentInfo==null) return null; if (!contentInfo.getType().equals(DRLContentTypeEnum.RULE_LHS_LINE)) return null; String response = VariableBinding.execute(contentInfo, offset-contentInfo.getOffset()); if (response.equals(contentInfo.getContent())) return null; return new ReplaceAssistantOption("assign to variable", response, contentInfo.getOffset(), contentInfo.getContentLength(), offset); }
@Override protected AssistantOption bindVariable(RuleBasicContentInfo contentInfo) { if (contentInfo==null) return null; if (!contentInfo.getType().equals(DRLContentTypeEnum.RULE_LHS_LINE)) return null; String response = VariableBinding.execute(contentInfo, offset-contentInfo.getOffset()); if (response.equals(contentInfo.getContent())) return null; return new ReplaceAssistantOption("assign to variable", response, contentInfo.getOffset(), contentInfo.getContentLength(), offset); }