public PositionRef getStartPosition() { return position.getBegin(); }
public ErrorDescriptionNode(ErrorDescription ed, Map<ErrorDescription, List<FixDescription>> errors2Fixes) { super(new FixChildren(ed, errors2Fixes.get(ed))); this.ed = ed; int line = -1; try { line = ed.getRange().getBegin().getLine(); } catch (IOException ex) { Exceptions.printStackTrace(ex); } setDisplayName((line != (-1) ? (line + ":") : "") + ed.getDescription()); setIconBaseWithExtension("org/netbeans/modules/java/hints/analyzer/ui/warning-glyph.gif"); }
public static boolean openSource(PositionBounds position) { CloneableEditorSupport editorSupport = position.getBegin().getCloneableEditorSupport(); editorSupport.edit(); JEditorPane[] panes = editorSupport.getOpenedPanes(); if (panes != null) { JumpList.checkAddEntry(); JEditorPane pane = panes[0]; pane.setCaretPosition(position.getBegin().getOffset()); Container container = pane; while (container != null && !(container instanceof TopComponent)) { container = container.getParent(); } if (container != null) { ((TopComponent) container).requestActive(); } } return false; }
@Override public Lookup getLookup() { Object composite = null; if (bounds!=null) { composite = ElementGripFactory.getDefault().get(parentFile, bounds.getBegin().getOffset()); } if (composite==null) { composite = parentFile; } return Lookups.fixed(composite, diff); }
public Lookup getLookup() { Object composite = ElementGripFactory.getDefault().get(parentFile, bounds.getBegin().getOffset()); if (composite==null) composite = parentFile; return Lookups.fixed(composite, diff); }
public Lookup getLookup() { Object composite = ElementGripFactory.getDefault().get(parentFile, bounds.getBegin().getOffset()); if (composite==null) composite = parentFile; return Lookups.fixed(composite, diff); }
public Lookup getLookup() { Object composite = ElementGripFactory.getDefault().get(parentFile, bounds.getBegin().getOffset()); if (composite == null) { composite = parentFile; } return Lookups.singleton(composite); }
public void actionPerformed(ActionEvent e) { Node node = getNextMeaningfullNode(); comp.nodesForNext.add(0, node); FixDescription fd = node.getLookup().lookup(FixDescription.class); assert fd != null; try { comp.getExplorerManager().setSelectedNodes(new Node[]{node}); } catch (PropertyVetoException ex) { Exceptions.printStackTrace(ex); } ErrorDescription ed = fd.getErrors(); UiUtils.open(ed.getFile(), ed.getRange().getBegin().getOffset()); fireEnabledChanged(); }
@Override public void addError(CsmErrorInfo info) { if (interrupter.cancelled()) { return; } PositionBounds pb = createPositionBounds(dao, info.getStartOffset(), info.getEndOffset()); ErrorDescription desc = null; if( pb != null ) { try { desc = ErrorDescriptionFactory.createErrorDescription( getSeverity(info), info.getMessage(), doc, pb.getBegin().getPosition(), pb.getEnd().getPosition()); } catch (IOException ioe) { Exceptions.printStackTrace(ioe); } descriptions.add(desc); if (TRACE_ANNOTATIONS) System.err.printf("\tadded to a bag %s\n", desc.toString()); } else { if (TRACE_ANNOTATIONS) System.err.printf("\tCan't create PositionBounds for %s\n", info); } } @Override
public void open() { try { PositionRef pos = ed.getRange().getBegin(); int line = pos.getLine(); int column = pos.getColumn(); Line l = pos.getCloneableEditorSupport().getLineSet().getCurrent(line); l.show(Line.SHOW_GOTO, column); } catch (IOException ex) { Exceptions.printStackTrace(ex); } }
public FixNode(ErrorDescription ed, FixDescription fix) { super(Children.LEAF, Lookups.fixed(new OpenCookieImpl(ed), fix)); this.fix = fix; int line = -1; try { line = ed.getRange().getBegin().getLine(); } catch (IOException ex) { Exceptions.printStackTrace(ex); } setDisplayName((line != (-1) ? (line + ":") : "") + fix.getText() + "(" + ed.getDescription() + ")"); setIconBaseWithExtension("org/netbeans/modules/java/hints/analyzer/ui/suggestion.png"); fix.addChangeListener(this); }
UiUtils.open(ed.getFile(), ed.getRange().getBegin().getOffset()); fireEnabledChanged();
Modifications modification = new Modifications(); for (Occurrences.OccurrenceItem item : items) { Modifications.Difference difference = new Modifications.Difference(Modifications.Difference.Kind.CHANGE, item.getChangePosition().getBegin(), item.getChangePosition().getEnd(), item.getOldValue(), item.getNewValue(), item.getRenamePackageMessage()); modification.addDifference(item.getFacesConfig(), difference); refactoringElements.add(refactoring, new DiffElement.ChangeFQCNElement(difference, item, modification));
Modifications.Difference.Kind.CHANGE, position.getBegin(), position.getEnd(), oldFQN, newFQN, item.getChangeMessage()); modification.addDifference(item.getFacesConfig(), difference);
severityToTaskListString(hint.getSeverity()), hint.getDescription(), hint.getRange().getBegin().getLine()+1); tasks.add(task); } catch (IOException ioe) {
public static void renamePackage(AbstractRefactoring refactoring, RefactoringElementsBag refactoringElements, FileObject folder, String oldFQPN, String newFQPN, boolean recursive){ Project project = FileOwnerQuery.getOwner(folder); if (project != null) { List <Occurrences.OccurrenceItem> items = Occurrences.getPackageOccurrences(project, oldFQPN, newFQPN, recursive); Modifications modification = new Modifications(); for (Occurrences.OccurrenceItem item : items) { Modifications.Difference difference = new Modifications.Difference( Modifications.Difference.Kind.CHANGE, item.getChangePosition().getBegin(), item.getChangePosition().getEnd(), item.getOldValue(), item.getNewValue(), item.getRenamePackageMessage()); modification.addDifference(item.getFacesConfig(), difference); refactoringElements.add(refactoring, new DiffElement.ChangeFQCNElement(difference, item, modification)); } } }