Package org.erlide.ui.internal

Examples of org.erlide.ui.internal.ErlBrowserInformationControlInput


    public void setInfo(final Object info) {
        String edocHtml = null;
        if (info instanceof String) {
            edocHtml = (String) info;
        } else if (info instanceof ErlBrowserInformationControlInput) {
            final ErlBrowserInformationControlInput myInput = (ErlBrowserInformationControlInput) info;
            setInput(myInput);
            edocHtml = myInput.getHtml();
        }
        fBrowser.setText(edocHtml);
    }
View Full Code Here


        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));
                    }
                }
            }
View Full Code Here

    @Override
    public String getHoverInfo(final ITextViewer textViewer, final IRegion hoverRegion) {
        if (isHoverDisabled()) {
            return null;
        }
        final ErlBrowserInformationControlInput input = (ErlBrowserInformationControlInput) getHoverInfo2(
                textViewer, hoverRegion);
        return input == null ? "" : input.getHtml();
    }
View Full Code Here

        } catch (final Exception e) {
            ErlLogger.warn(e);
            return null;
        }
        final String strResult = HoverUtil.getHTMLAndReplaceJSLinks(result);
        return new ErlBrowserInformationControlInput(null, editor, element, strResult,
                20, HoverUtil.getDocumentationURL(docPath, anchor));
    }
View Full Code Here

    /*
     * @see org.eclipse.jface.action.Action#run()
     */
    @Override
    public void run() {
        ErlBrowserInformationControlInput input = null;
        if (fInfoControl != null) {
            input = (ErlBrowserInformationControlInput) fInfoControl.getInput();
            fInfoControl.notifyDelayedInputChange(null);
            fInfoControl.dispose();
        } else if (edocView != null) {
            input = edocView.getInput();
        }
        if (input != null) {
            // TODO: add hover location to editor navigation history?
            try {
                final Object element = input.getInputElement();
                if (element instanceof IErlElement) {
                    EditorUtility.openElementInEditor(element, true);
                } else if (element instanceof OpenResult) {
                    final OpenResult or = (OpenResult) element;
                    try {
                        final AbstractErlangEditor editor = input.getEditor();
                        new OpenUtils().openOpenResult(editor, editor.getModule(), -1,
                                null, or, null);
                    } catch (final Exception e) {
                        ErlLogger.error(e);
                    }
View Full Code Here

TOP

Related Classes of org.erlide.ui.internal.ErlBrowserInformationControlInput

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.