use of org.erlide.engine.model.root.IErlModel in project erlide_eclipse by erlang.
the class ParserDB method create.
public static void create() {
final Runnable x = new Runnable() {
@Override
public void run() {
ParserDB.running = true;
try {
ParserDB.db = new ParserDB();
// out = new PrintStream(
// new File("/home/qvladum/parserDB.txt"));
ParserDB.out = System.out;
final IErlModel model = ErlangEngine.getInstance().getModel();
final Collection<SourcePathProvider> sourcePathProviders = SourcePathUtils.getSourcePathProviders();
final long time = System.currentTimeMillis();
ParserDB.db.run(model, sourcePathProviders, false);
System.out.println(" took " + (System.currentTimeMillis() - time) / 1000);
} catch (final Exception e) {
ErlLogger.error(e);
}
ParserDB.running = false;
}
};
if (!ParserDB.running) {
new Thread(x).start();
}
}
use of org.erlide.engine.model.root.IErlModel in project erlide_eclipse by erlang.
the class ErlProjectTest method findFunctionInExternalFilesTest.
@Test
public void findFunctionInExternalFilesTest() throws Exception {
// given
// a module with calls to the lists module
final IErlProject project = ErlProjectTest.projects[0];
final IErlModule moduleE = ErlideTestUtils.createModule(project, "e.erl", "-module(e).\n-export([f/0]).\nf() ->\n lists:reverse([1, 0]),\n lists:reverse([1, 0], [2]).\n");
final ScannerService scanner = moduleE.getScanner();
try {
moduleE.open(null);
// when
// looking for lists:reverse/2 and lists:reverse/1
final IErlModel model = ErlangEngine.getInstance().getModel();
final OpenResult res = ErlangEngine.getInstance().getOpenService().open(moduleE.getScannerName(), 49, ErlangEngine.getInstance().getModelUtilService().getImportsAsList(moduleE), project.getProperties().getExternalModules(), model.getPathVars());
final IErlFunction function = ErlangEngine.getInstance().getModelFindService().findFunction(model, project, moduleE, res.getName(), res.getPath(), res.getFunction(), IErlElementLocator.Scope.PROJECT_ONLY);
assertNotNull(function);
final IErlElement module = model.findModuleFromProject(project, function.getModuleName(), res.getPath(), IErlElementLocator.Scope.PROJECT_ONLY);
// then
// the function should be returned and the module, in External Files
assertNotNull(module);
assertEquals(function.getParent(), module);
assertEquals(ErlangEngine.getInstance().getModelUtilService().getProject(function), project);
} finally {
scanner.dispose();
}
}
use of org.erlide.engine.model.root.IErlModel in project erlide_eclipse by erlang.
the class ErlangDebugTarget method getProjectDirs.
private OtpErlangList getProjectDirs(final IProject project) {
final IErlModel model = ErlangEngine.getInstance().getModel();
final ErlangProjectProperties properties = model.findProject(project).getProperties();
final String ebin = properties.getOutputDir().toPortableString();
final Collection<IPath> srcs = properties.getSourceDirs();
try {
return (OtpErlangList) OtpErlang.format("[{ebin_dir, ~s}, {src_dirs, ~ls}]", ebin, srcs);
} catch (final OtpParserException e) {
ErlLogger.warn(e);
} catch (final SignatureException e) {
ErlLogger.warn(e);
}
return new OtpErlangList();
}
use of org.erlide.engine.model.root.IErlModel in project erlide_eclipse by erlang.
the class ErlangQuickFixCollector method getFixes.
public IMarkerResolution[] getFixes(final IMarker marker) {
final IResource resource = marker.getResource();
final IErlModel model = ErlangEngine.getInstance().getModel();
IErlModule module;
if (resource == null) {
return new IMarkerResolution[0];
}
if (resource instanceof IProject) {
return getFixesForProject((IProject) resource, marker);
}
if (resource instanceof IFile) {
module = model.findModule((IFile) resource);
if (module != null) {
return getFixesForModule(module, marker);
}
}
return new IMarkerResolution[0];
}
use of org.erlide.engine.model.root.IErlModel in project erlide_eclipse by erlang.
the class MarkerQuickFixExecutor method setMarker.
@Override
public void setMarker(final IMarker marker) {
super.setMarker(marker);
final IErlModel model = ErlangEngine.getInstance().getModel();
module = model.findModule((IFile) marker.getResource());
}
Aggregations