use of org.erlide.engine.model.erlang.IErlFunction in project erlide_eclipse by erlang.
the class ErlangCompletionService method addFunctionsFromModule.
boolean addFunctionsFromModule(final int offset, final String prefix, final boolean arityOnly, final List<CompletionData> proposals, final IErlModule m) {
boolean result = false;
try {
m.open(null);
for (final IErlElement e : m.getChildren()) {
if (e instanceof IErlFunction) {
final IErlFunction f = (IErlFunction) e;
if (f.isExported()) {
addFunctionCompletion(offset, prefix, proposals, f, arityOnly);
result = true;
}
}
}
} catch (final ErlModelException e) {
ErlLogger.error(e);
}
return result;
}
use of org.erlide.engine.model.erlang.IErlFunction in project erlide_eclipse by erlang.
the class ErlParser method checkForComment.
private void checkForComment(final List<IErlMember> all, final int i) {
final IErlMember m = all.get(i);
if (m instanceof IErlFunction) {
final IErlFunction function = (IErlFunction) m;
final LinkedList<IErlComment> comments = Lists.newLinkedList();
int j = considerPrevious(i, all, comments, function);
j = considerPrevious(j, all, comments, function);
j = considerPrevious(j, all, comments, function);
if (!comments.isEmpty()) {
function.setComments(comments);
}
}
}
use of org.erlide.engine.model.erlang.IErlFunction in project erlide_eclipse by erlang.
the class CreateTracePatternHandler method execute.
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
final ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getSelection();
if (selection instanceof ITreeSelection) {
final Object firstElement = ((ITreeSelection) selection).getFirstElement();
if (firstElement instanceof IErlFunction) {
final IErlFunction function = (IErlFunction) firstElement;
final TracePattern tracePattern = new TracePattern(true);
tracePattern.setFunctionName(function.getFunctionName());
tracePattern.setModuleName(ErlangEngine.getInstance().getModelUtilService().getModule(function).getModuleName());
tracePattern.setArity(function.getArity());
tracePattern.setLocal(true);
tracePattern.setEnabled(true);
TraceBackend.getInstance().addTracePattern(tracePattern);
}
}
return null;
}
use of org.erlide.engine.model.erlang.IErlFunction in project erlide_eclipse by erlang.
the class RemoveTracePatternHandler method execute.
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
final ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getSelection();
if (selection instanceof ITreeSelection) {
final Object firstElement = ((ITreeSelection) selection).getFirstElement();
if (firstElement instanceof IErlFunction) {
final IErlFunction function = (IErlFunction) firstElement;
final TracePattern tracePattern = new TracePattern(true);
tracePattern.setFunctionName(function.getFunctionName());
tracePattern.setModuleName(ErlangEngine.getInstance().getModelUtilService().getModule(function).getModuleName());
tracePattern.setArity(function.getArity());
TraceBackend.getInstance().removeTracePattern(tracePattern);
}
}
return null;
}
use of org.erlide.engine.model.erlang.IErlFunction in project erlide_eclipse by erlang.
the class OpenUtils method findExternalCallOrType.
private IErlElement findExternalCallOrType(final IErlModule module, final OpenResult res, final IErlProject project, final IErlElement element, final IErlElementLocator.Scope scope) throws CoreException {
final IErlElementLocator model = ErlangEngine.getInstance().getModel();
if (isTypeDefOrRecordDef(element, res)) {
return modelFindService.findTypeDef(model, project, module, res.getName(), res.getFun(), res.getPath(), scope);
}
final IErlFunction result = modelFindService.findFunction(model, project, module, res.getName(), res.getPath(), res.getFunction(), scope);
if (result != null) {
return result;
}
return modelFindService.findFunction(model, project, module, res.getName(), res.getPath(), new ErlangFunction(res.getFun(), ErlangFunction.ANY_ARITY), scope);
}
Aggregations