use of org.erlide.engine.model.erlang.IErlMacroDef in project erlide_eclipse by erlang.
the class SearchPatternFactory method getSearchPatternFromErlElementAndLimitTo.
public ErlangSearchPattern getSearchPatternFromErlElementAndLimitTo(final IErlElement element, final LimitTo limitTo) {
if (element instanceof IErlFunction) {
final IErlFunction function = (IErlFunction) element;
final String withoutExtension = SystemConfiguration.withoutExtension(function.getModuleName());
return new FunctionPattern(withoutExtension, function.getFunctionName(), function.getArity(), limitTo, true, modelUtilService.getModule(function), !function.isExported());
} else if (element instanceof IErlMacroDef) {
final IErlMacroDef m = (IErlMacroDef) element;
final String unquoted = StringUtils.unquote(m.getDefinedName());
return new MacroPattern(unquoted, limitTo);
} else if (element instanceof IErlRecordDef) {
final IErlRecordDef r = (IErlRecordDef) element;
final String unquoted = StringUtils.unquote(r.getDefinedName());
return new RecordPattern(unquoted, limitTo);
} else if (element instanceof IErlFunctionClause) {
final IErlFunctionClause clause = (IErlFunctionClause) element;
return getSearchPatternFromErlElementAndLimitTo((IErlElement) clause.getParent(), limitTo);
} else if (element instanceof IErlAttribute) {
final IErlAttribute a = (IErlAttribute) element;
if (a.getName().startsWith("include")) {
final String s = Util.stringValue(a.getValue());
return new IncludePattern(s, limitTo);
}
}
return null;
}
Aggregations