void fix(IDocument document) { getFixes(); if (!Common.isEmptyArray(mFixes)) { try { for (int i = 0; i < mFixes.length; i++) { INILine line = mFixes[i].getLine(); if (line == null) { mFixes[i].setPosition(new Position(0, 0)); } else { mFixes[i].setPosition(line.getParent().getChildPosition(line)); } } Arrays.sort(mFixes, cReversePositionComparator); for (int i = 0; i < mFixes.length; i++) { Position position = mFixes[i].getPosition(); document.replace(position.offset, position.length, mFixes[i].getText()); } } catch (BadLocationException e) { e.printStackTrace(); } } }
private void populateDataModelForAnnotation(SimpleMarkerAnnotation annotation) { // grab the local resolutions first IMarker marker = annotation.getMarker(); if (!fResMap.containsKey(marker)) { ArrayList<IMarkerResolution> resolutions = new ArrayList<>(5); IMarkerResolution[] localResolutions = fGenerator.getResolutions(marker); resolutions.addAll(Arrays.asList(localResolutions)); // grab the contributed resolutions IMarkerResolution[] contributedResolutions = IDE.getMarkerHelpRegistry().getResolutions(marker); for (int i = 0; i < contributedResolutions.length; i++) { IMarkerResolution resolution = contributedResolutions[i]; // only add contributed marker resolutions if they don't come from PDE if (!(resolution instanceof AbstractPDEMarkerResolution) && !resolutions.contains(contributedResolutions[i])) resolutions.add(contributedResolutions[i]); } if (resolutions.size() > 0) { fResMap.put(marker, resolutions.toArray(new IMarkerResolution[resolutions.size()])); } } }