this.edocView = edocView;
}
@Override
public void changing(final LocationEvent event) {
ErlBrowserInformationControlInput input = null;
if (control != null) {
final BrowserInformationControlInput input2 = control.getInput();
if (input2 instanceof ErlBrowserInformationControlInput) {
input = (ErlBrowserInformationControlInput) input2;
}
} else if (edocView != null) {
input = edocView.getInput();
}
if (input != null) {
final AbstractErlangEditor editor = input.getEditor();
String moduleName = "";
final Object inputElement = input.getInputElement();
if (inputElement instanceof ExternalCallOpenResult) {
final ExternalCallOpenResult or = (ExternalCallOpenResult) inputElement;
moduleName = or.getMod();
}
final ErlangFunctionCall functionCall = HoverUtil.eventToErlangFunctionCall(
moduleName, event);
if (functionCall != null) {
final IErlProject project = ErlangEngine.getInstance()
.getModelUtilService().getProject(editor.getModule());
if (project == null) {
return;
}
final IOtpRpc backend = BackendCore.getBuildBackend(project);
final String stateDir = ErlideUIPlugin.getDefault().getStateLocation()
.toString();
final OtpErlangTuple otpDoc = (OtpErlangTuple) ErlangEngine.getInstance()
.getService(OtpDocService.class)
.getOtpDoc(backend, functionCall, stateDir);
if (Util.isOk(otpDoc)) {
final String docStr = Util.stringValue(otpDoc.elementAt(1));
final StringBuffer result = new StringBuffer(docStr);
String docPath = "";
String anchor = "";
if (otpDoc.arity() > 4) {
docPath = Util.stringValue(otpDoc.elementAt(3));
anchor = Util.stringValue(otpDoc.elementAt(4));
}
if (result.length() > 0) {
final String html = HoverUtil.getHTMLAndReplaceJSLinks(result);
final Object element = OpenResult.build(otpDoc.elementAt(2));
input = new ErlBrowserInformationControlInput(input, editor,
element, html, 20, HoverUtil.getDocumentationURL(docPath,
anchor));
}
}
}