Package org.erlide.engine.model.erlang

Examples of org.erlide.engine.model.erlang.IErlModule


            switch (type) {
            case FUNCTION:
                img = Activator.getImageDescriptor(Images.FUNCTION).createImage();
                break;
            case MODULE:
                IErlModule m;
                try {
                    m = ErlangEngine.getInstance().getModel()
                            .findModule(statsEl.getLabel());
                } catch (final ErlModelException e) {
                    ErlLogger.error(e);
View Full Code Here


    }

    public SearchPatternData tryErlangTextSelection(final SearchPatternData initData0,
            final IEditorPart activePart) throws ErlModelException {
        final AbstractErlangEditor erlangEditor = (AbstractErlangEditor) activePart;
        final IErlModule module = erlangEditor.getModule();
        SearchPatternData initData = initData0;
        if (module != null) {
            final ISelection ssel = erlangEditor.getSite().getSelectionProvider()
                    .getSelection();
            final ITextSelection textSel = (ITextSelection) ssel;
            final int offset = textSel.getOffset();
            OpenResult res;
            try {
                res = ErlangEngine
                        .getInstance()
                        .getService(OpenService.class)
                        .open(module.getScannerName(),
                                offset,
                                ErlangEngine.getInstance().getModelUtilService()
                                        .getImportsAsList(module),
                                "",
                                ErlangEngine.getInstance().getModel()
                                        .getPathVars(module.getCorrespondingResource()));
            } catch (final RpcException e) {
                res = null;
            }
            ErlLogger.debug("searchPage(open) " + res);
            initData = determineInitValuesFrom(module, offset, res);
View Full Code Here

    }

    public IMarkerResolution[] getFixes(final IMarker marker) {
        final IResource resource = marker.getResource();
        final IErlModel model = ErlangEngine.getInstance().getModel();
        IErlModule module;

        if (resource == null) {
            return new IMarkerResolution[0];
        }
        if (resource instanceof IProject) {
View Full Code Here

    protected void showMatch(final Match match, final int offset, final int length,
            final boolean activate) throws PartInitException {
        final Object element = match.getElement();
        if (element instanceof ErlangSearchElement) {
            final ErlangSearchElement ese = (ErlangSearchElement) element;
            final IErlModule module = ese.getModule();
            final IEditorPart editor = EditorUtility.openInEditor(module);
            if (offset != 0) {
                if (editor instanceof ErlangEditor) {
                    final AbstractErlangEditor ee = (AbstractErlangEditor) editor;
                    ee.selectAndReveal(offset, length);
View Full Code Here

        final List<String> margs = getQuickFix().getArgs();
        final String moduleName = margs.get(0);

        final IErlModel svc = ErlangEngine.getInstance().getModel();

        IErlModule newModule;
        newModule = svc.findModule(moduleName);
        if (newModule != null) {
            MessageDialog.openInformation(null, "Rename module quickfix",
                    "A module with name '" + moduleName + "' already exists.");
            newModule.dispose();
            return;
        }

        final IFile file = (IFile) marker.getResource();
        final IErlModule oldModule = svc.findModule(file);
        if (oldModule == null) {
            return;
        }

        String in = Util.getInputStreamAsString(file.getContents(), file.getCharset());
View Full Code Here

    public static boolean openExternalFunction(final String moduleName,
            final ErlangFunction function, final String modulePath,
            final IErlModule module, final IErlProject project,
            final IErlElementLocator.Scope scope) throws CoreException {
        final IErlElementLocator model = ErlangEngine.getInstance().getModel();
        final IErlModule module2 = ErlangEngine.getInstance().getModelFindService()
                .findModule(model, project, moduleName, modulePath, scope);
        if (module2 != null) {
            final IEditorPart editor = EditorUtility.openInEditor(module2);
            return openFunctionInEditor(function, editor);
        }
View Full Code Here

     * Activate editor and select erlang function
     */
    public static boolean openFunctionInEditor(final ErlangFunction erlangFunction,
            final IEditorPart editor) throws CoreException {
        final AbstractErlangEditor erlangEditor = (AbstractErlangEditor) editor;
        final IErlModule module = erlangEditor.getModule();
        if (module == null) {
            return false;
        }
        module.open(null);
        final IErlFunction function = module.findFunction(erlangFunction);
        if (function == null) {
            return false;
        }
        EditorUtility.revealInEditor(editor, function);
        return true;
View Full Code Here

    }

    public static boolean openTypeInEditor(final String typeName, final IEditorPart editor)
            throws CoreException {
        final AbstractErlangEditor erlangEditor = (AbstractErlangEditor) editor;
        final IErlModule module = erlangEditor.getModule();
        if (module == null) {
            return false;
        }
        module.open(null);
        final IErlTypespec typespec = ErlangEngine.getInstance().getModelFindService()
                .findTypespec(module, typeName);
        if (typespec == null) {
            return false;
        }
View Full Code Here

            throws CoreException {
        if (editorInput instanceof IFileEditorInput) {
            final IFileEditorInput input = (IFileEditorInput) editorInput;
            final IFile file = input.getFile();
            final IErlModel model = ErlangEngine.getInstance().getModel();
            IErlModule module = model.findModule(file);
            if (module != null) {
                return module;
            }
            final String path = file.getLocation().toPortableString();
            module = model.getModuleFromFile(model, file.getName(), path,
                    file.getCharset(), path);
            module.setResource(file);
            return module;
        }
        if (editorInput instanceof ErlangExternalEditorInput) {
            final ErlangExternalEditorInput erlangExternalEditorInput = (ErlangExternalEditorInput) editorInput;
            return erlangExternalEditorInput.getModule();
        }
        final String path = getPathForInput(editorInput);
        if (path == null) {
            return null;
        }
        final IErlElementLocator model = ErlangEngine.getInstance().getModel();
        final IErlModule module = ErlangEngine
                .getInstance()
                .getModelFindService()
                .findModule(model, null, null, path,
                        IErlElementLocator.Scope.ALL_PROJECTS);
        if (module != null) {
View Full Code Here

        openMFA(module, function, ErlangFunction.ANY_ARITY);
    }

    public static void openModule(final String moduleName) throws CoreException {
        final IErlElementLocator model = ErlangEngine.getInstance().getModel();
        final IErlModule module = ErlangEngine
                .getInstance()
                .getModelFindService()
                .findModule(model, null, moduleName, null,
                        IErlElementLocator.Scope.ALL_PROJECTS);
        if (module != null) {
View Full Code Here

TOP

Related Classes of org.erlide.engine.model.erlang.IErlModule

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.