use of org.erlide.wrangler.refactoring.util.ErlRange in project erlide_eclipse by erlang.
the class ErlMemberSelection method getSelectionRange.
@Override
public IErlRange getSelectionRange() {
IErlRange range;
range = new ErlRange(getStartLine(), getStartCol(), getEndLine(), getEndCol(), member.getSourceRange().getOffset(), member.getSourceRange().getLength());
return range;
}
use of org.erlide.wrangler.refactoring.util.ErlRange in project erlide_eclipse by erlang.
the class ErlTextMemberSelection method getMemberRange.
@Override
public IErlRange getMemberRange() {
if (getErlElement() instanceof IErlMember) {
IErlRange range = null;
final IErlMember member = (IErlMember) getErlElement();
int sL;
int sC;
int eL;
int eC;
sL = member.getLineStart() + 1;
eL = member.getLineEnd() + 1;
sC = WranglerUtils.calculateColumnFromOffset(member.getSourceRange().getOffset(), sL - 1, document);
eC = WranglerUtils.calculateColumnFromOffset(member.getSourceRange().getOffset() + member.getSourceRange().getLength(), eL - 1, document);
range = new ErlRange(sL, sC, eL, eC, member.getSourceRange().getOffset(), member.getSourceRange().getLength());
return range;
}
return getSelectionRange();
}
use of org.erlide.wrangler.refactoring.util.ErlRange in project erlide_eclipse by erlang.
the class GeneraliseFunctionRefactoring method createPositionList.
/**
* Returns IErlRange, OtpErlangTuple pairs, which are represents the same
* position in a module
*
* @param thePositions
* @return
*/
protected HashMap<IErlRange, OtpErlangTuple> createPositionList(final OtpErlangList thePositions) {
try {
final HashMap<IErlRange, OtpErlangTuple> ret = new HashMap<>();
final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters.getWranglerSelection();
for (final OtpErlangObject o : thePositions) {
// {{sl, sc}, {el,ec}}
final OtpErlangTuple pos = (OtpErlangTuple) o;
ret.put(new ErlRange(new Range(pos), sel.getDocument()), pos);
}
return ret;
} catch (final OtpErlangException e) {
ErlLogger.error(e);
return null;
}
}
Aggregations