use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class ErlangCompletionService method addCompletions.
List<CompletionData> addCompletions(final IOtpRpc backend, final Set<CompletionFlag> flags, final int offset, final String prefix, final String moduleOrRecord, final int pos, final List<String> fieldsSoFar, final boolean inString) throws CoreException {
final List<CompletionData> result = new ArrayList<>();
final IErlProject aProject = project;
if (aProject == null) {
return result;
}
addSorted(prefix, result, addDeclaredFunctionsCompletions(flags, offset, prefix));
if (flags.contains(CompletionFlag.VARIABLES)) {
addSorted(prefix, result, getVariables(backend, offset, prefix));
}
if (flags.contains(CompletionFlag.IMPORTED_FUNCTIONS)) {
addSorted(prefix, result, getImportedFunctions(backend, offset, prefix));
}
if (flags.contains(CompletionFlag.AUTO_IMPORTED_FUNCTIONS)) {
addSorted(prefix, result, getAutoImportedFunctions(backend, offset, prefix));
}
if (flags.contains(CompletionFlag.MODULES)) {
addSorted(prefix, result, getModules(backend, offset, prefix, CompletionFlag.MODULES, inString));
}
if (flags.contains(CompletionFlag.INCLUDES)) {
addSorted(prefix, result, getModules(backend, offset, prefix, CompletionFlag.INCLUDES, inString));
}
if (flags.contains(CompletionFlag.INCLUDE_LIBS)) {
addSorted(prefix, result, getModules(backend, offset, prefix, CompletionFlag.INCLUDE_LIBS, inString));
}
if (flags.contains(CompletionFlag.RECORD_DEFS)) {
addSorted(prefix, result, getMacroOrRecordCompletions(offset, prefix, ErlElementKind.RECORD_DEF));
}
if (flags.contains(CompletionFlag.RECORD_FIELDS)) {
addSorted(prefix, result, getRecordFieldCompletions(moduleOrRecord, offset, prefix, pos, fieldsSoFar));
}
if (flags.contains(CompletionFlag.MACRO_DEFS)) {
addSorted(prefix, result, getMacroOrRecordCompletions(offset, prefix, ErlElementKind.MACRO_DEF));
}
if (flags.contains(CompletionFlag.EXTERNAL_FUNCTIONS)) {
addSorted(prefix, result, getExternalCallCompletions(backend, moduleOrRecord, offset, prefix, flags.contains(CompletionFlag.ARITY_ONLY)));
}
if (flags.contains(CompletionFlag.TYPES)) {
addSorted(prefix, result, getTypeCompletions(backend, moduleOrRecord, offset, prefix));
}
return result;
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class ErlFolder method isSourcePathParent.
@Override
public boolean isSourcePathParent() {
final IProject project = folder.getProject();
final IErlProject erlProject = modelUtilService.getProject(this);
final Collection<IPath> sourcePaths = erlProject.getProperties().getSourceDirs();
final IPath path = folder.getFullPath();
for (final IPath i : sourcePaths) {
if (path.isPrefixOf(project.getFolder(i).getFullPath())) {
return true;
}
}
return false;
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class ErlideTestUtils method createErlProject.
public static IErlProject createErlProject(final IProject project) throws CoreException {
final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
final IErlProject erlProject = ErlangEngine.getInstance().getModel().findProject(project);
erlProject.getBuilderProperties().setBuilderTool(BuilderTool.INTERNAL);
final ErlangProjectProperties prefs = erlProject.getProperties();
final List<IPath> srcDirs = new ArrayList<>();
srcDirs.add(new Path("src"));
prefs.setSourceDirs(srcDirs);
ErlideTestUtils.buildPaths(root, project, srcDirs);
final List<IPath> includeDirs = new ArrayList<>();
includeDirs.add(new Path("include"));
ErlideTestUtils.buildPaths(root, project, includeDirs);
prefs.setIncludeDirs(includeDirs);
final IPath ebinDir = new Path("ebin");
ErlideTestUtils.buildPaths(root, project, Lists.newArrayList(ebinDir));
prefs.setOutputDir(ebinDir);
ErlideTestUtils.projects.add(erlProject);
return erlProject;
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class ErlideTestUtils method initProjects.
public static void initProjects() throws CoreException {
ErlideTestUtils.projects = Lists.newArrayList();
final IErlModel model = ErlangEngine.getInstance().getModel();
model.open(null);
final List<IErlElement> children = model.getChildren();
for (final IErlElement child : children) {
if (child instanceof IErlProject) {
final IErlProject project = (IErlProject) child;
if (project.getName().startsWith("testproject")) {
ErlideTestUtils.deleteProject(project);
}
}
}
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class ErlModel method tryFindModule.
private IErlModule tryFindModule(final Collection<IErlProject> projects, final String moduleName, final String modulePath, final List<IErlModule> allModules, final Set<String> paths, final boolean externalModules) throws ErlModelException {
IErlModule module;
for (final IErlProject project : projects) {
final Collection<IErlModule> modules = Lists.newArrayList();
final Collection<IErlModule> modulesOrExternals = externalModules ? project.getExternalModules() : project.getModules();
ErlModel.getAllModulesAux(modulesOrExternals, modules, paths);
allModules.addAll(modules);
module = findModule(modules, moduleName, modulePath);
if (module != null) {
return module;
}
}
return null;
}
Aggregations