/** * Returns uri for a compilation unit * * @param cu * @return */ public static String toURI(ICompilationUnit cu) { return getFileURI(cu.getResource()); }
public List<HighlightedPositionCore> calculateHighlightedPositions(ICompilationUnit unit, boolean cache) throws JavaModelException, BadPositionCategoryException { if (enabled.get()) { IDocument document = JsonRpcHelpers.toDocument(unit.getBuffer()); ASTNode ast = getASTNode(unit); List<HighlightedPositionCore> positions = calculateHighlightedPositions(document, ast); if (cache) { String uri = JDTUtils.getFileURI(unit.getResource()); this.cache.put(uri, positions); } return ImmutableList.copyOf(positions); } return emptyList(); }
public List<Position> install(ICompilationUnit unit) throws JavaModelException, BadPositionCategoryException { if (enabled.get()) { List<HighlightedPositionCore> positions = calculateHighlightedPositions(unit, false); String uri = JDTUtils.getFileURI(unit.getResource()); this.cache.put(uri, positions); if (!positions.isEmpty()) { IDocument document = JsonRpcHelpers.toDocument(unit.getBuffer()); List<SemanticHighlightingInformation> infos = toInfos(document, positions); VersionedTextDocumentIdentifier textDocument = new VersionedTextDocumentIdentifier(uri, 1); notifyClient(textDocument, infos); } return ImmutableList.copyOf(positions); } return emptyList(); }
for (IProject project : projects) { if (!project.equals(projectsManager.getDefaultProject())) { String uri = JDTUtils.getFileURI(project); connection.publishDiagnostics(new PublishDiagnosticsParams(ResourceUtils.toClientUri(uri), Collections.emptyList()));
public static TestItem constructTestItem(IJavaElement element, TestLevel level, TestKind kind) throws JavaModelException { final String displayName = element.getElementName(); final String fullName = parseTestItemFullName(element, level); final String uri = JDTUtils.getFileURI(element.getResource()); final Range range = parseTestItemRange(element); final String projectName = element.getJavaProject().getProject().getName(); return new TestItem(displayName, fullName, uri, projectName, Collections.emptyList(), range, level, kind); }
String uri = JDTUtils.getFileURI(file); if (JavaCore.isJavaLikeFileName(file.getName())) { ICompilationUnit cu = JDTUtils.resolveCompilationUnit(uri);
private void publishMarkers(IProject project, IMarker[] markers) throws CoreException { Range range = new Range(new Position(0, 0), new Position(0, 0)); List<IMarker> projectMarkers = new ArrayList<>(markers.length); String uri = JDTUtils.getFileURI(project); IFile pom = project.getFile("pom.xml"); List<IMarker> pomMarkers = new ArrayList<>(); for (IMarker marker : markers) { if (!marker.exists() || CheckMissingNaturesListener.MARKER_TYPE.equals(marker.getType())) { continue; } if (IMavenConstants.MARKER_CONFIGURATION_ID.equals(marker.getType())) { pomMarkers.add(marker); } else { projectMarkers.add(marker); } } List<Diagnostic> diagnostics = toDiagnosticArray(range, projectMarkers); String clientUri = ResourceUtils.toClientUri(uri); connection.publishDiagnostics(new PublishDiagnosticsParams(clientUri, diagnostics)); if (pom.exists()) { IDocument document = JsonRpcHelpers.toDocument(pom); diagnostics = toDiagnosticsArray(document, pom.findMarkers(null, true, IResource.DEPTH_ZERO)); List<Diagnostic> diagnosicts2 = toDiagnosticArray(range, pomMarkers); diagnostics.addAll(diagnosicts2); connection.publishDiagnostics(new PublishDiagnosticsParams(ResourceUtils.toClientUri(clientUri + "/pom.xml"), diagnostics)); } }
String uri = JDTUtils.getFileURI(resource); this.connection.publishDiagnostics(new PublishDiagnosticsParams(ResourceUtils.toClientUri(uri), Collections.emptyList())); return false; String uri = JDTUtils.getFileURI(resource); this.connection.publishDiagnostics(new PublishDiagnosticsParams(ResourceUtils.toClientUri(uri), toDiagnosticsArray(document, markers)));