use of com.reprezen.swagedit.core.utils.SwaggerFileFinder in project KaiZen-OpenAPI-Editor by RepreZen.
the class QuickOutline method handleMultiView.
protected void handleMultiView() {
currentScope = currentScope.next();
SwaggerFileFinder fileFinder = new SwaggerFileFinder(fileContentType);
IEditorInput input = editor.getEditorInput();
IFile currentFile = null;
if (input instanceof IFileEditorInput) {
currentFile = ((IFileEditorInput) input).getFile();
}
Iterable<IFile> files = fileFinder.collectFiles(currentScope, currentFile);
setInfoText(statusMessage());
if (currentScope == Scope.LOCAL) {
treeViewer.setAutoExpandLevel(2);
} else {
treeViewer.setAutoExpandLevel(0);
}
setInput(Model.parseYaml(files, getSchema()));
}
use of com.reprezen.swagedit.core.utils.SwaggerFileFinder in project KaiZen-OpenAPI-Editor by RepreZen.
the class JsonReferenceProposalProvider method getProposals.
/**
* Returns collection of JSON reference proposals.
*
* If the scope is local, it will only return JSON references from within the current document.
*
* If the scope is project, it will return all JSON references from within the current document and from all
* documents inside the same project.
*
* If the scope is workspace, it will return all JSON references from within the current document and from all
* documents inside the same workspace.
*
* @param pointer
* @param document
* @param scope
* @return proposals
*/
public Collection<Proposal> getProposals(JsonPointer pointer, JsonDocument document, Scope scope) {
final ContextType type = contextTypes.get(pointer.toString());
final IFile currentFile = getActiveFile();
final IPath basePath = currentFile.getParent().getFullPath();
final List<Proposal> proposals = Lists.newArrayList();
if (scope == Scope.LOCAL) {
proposals.addAll(type.collectProposals(document, null));
} else if (!type.isLocalOnly()) {
final SwaggerFileFinder fileFinder = new SwaggerFileFinder(fileContentType);
for (IFile file : fileFinder.collectFiles(scope, currentFile)) {
IPath relative = file.equals(currentFile) ? null : file.getFullPath().makeRelativeTo(basePath);
if (file.equals(currentFile)) {
proposals.addAll(type.collectProposals(document, relative));
} else {
proposals.addAll(type.collectProposals(manager.getDocument(file.getLocationURI()), relative));
}
}
}
return proposals;
}
Aggregations