Package org.erlide.engine.model.erlang

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


    public boolean isShownInEditor(final Match match, final IEditorPart editor) {
        final ErlangSearchElement ese = (ErlangSearchElement) match.getElement();
        final IFile file = ResourceUtil.getFileFromLocation(ese.getModuleName());
        if (editor instanceof ErlangEditor) {
            final AbstractErlangEditor erlangEditor = (AbstractErlangEditor) editor;
            final IErlModule module = erlangEditor.getModule();
            if (module != null) {
                if (file != null) {
                    return file.equals(module.getResource());
                }
                return ese.getModuleName().equals(module.getFilePath());
            }
        }
        return false;
    }
View Full Code Here


        final ErlangEditor editor = (ErlangEditor) editorPart;
        if (editor.getViewer() != viewer) {
            return false;
        }

        final IErlModule module = editor.getModule();

        final int offset = invocationContext.getOffset();
        final ErlToken token = module.getScanner().getTokenAt(offset);
        if (token == null || token.getKind() != ErlToken.KIND_STRING) {
            return false;
        }
        final IDocument doc = viewer.getDocument();
        String text;
View Full Code Here

     * Method declared on SelectionChangedAction.
     */
    @Override
    public void run(final ITextSelection selection) {
        try {
            final IErlModule module = fEditor.getModule();
            if (module == null) {
                return;
            }
            final ISelection sel = getSelection();
            final ITextSelection textSel = (ITextSelection) sel;
            final int offset = textSel.getOffset();
            final OpenResult res = ErlangEngine
                    .getInstance()
                    .getService(OpenService.class)
                    .open(module.getScannerName(),
                            offset,
                            ErlangEngine.getInstance().getModelUtilService()
                                    .getImportsAsList(module),
                            "",
                            ErlangEngine.getInstance().getModel()
                                    .getPathVars(module.getCorrespondingResource()));
            ErlLogger.debug("find " + res);
            final ErlangSearchPattern ref = SearchUtil
                    .getSearchPatternFromOpenResultAndLimitTo(res, module, offset,
                            getLimitTo(), true);
            if (ref != null) {
View Full Code Here

            kind = ErlElementKind.MODULE;
        } else if (element instanceof ErlangSearchElement) {
            final ErlangSearchElement ese = (ErlangSearchElement) element;
            kind = ese.getKind();
            if (kind == ErlElementKind.FUNCTION) {
                final IErlModule module = ese.getModule();
                try {
                    module.open(null);
                } catch (final ErlModelException e) {
                }
                final IErlFunction function = module.findFunction(new ErlangFunction(ese
                        .getName(), ese.getArity()));
                if (function != null && function.isExported()) {
                    kind = ErlElementKind.EXPORTFUNCTION;
                }
            }
View Full Code Here

            // given
            // an erlang module in an erlang project
            final String projectName = "testproject";
            erlProject = createTmpErlProject(projectName);
            final String moduleName = "test.erl";
            final IErlModule erlModule = createModule(erlProject, moduleName,
                    "-module(test).\n-export([f/0]).\n-f() ->\n    atom_to_list(\"hej\").\n");
            IMarker[] markers = erlProject.getWorkspaceProject().findMarkers(
                    DialyzerMarkerUtils.DIALYZE_WARNING_MARKER, true,
                    IResource.DEPTH_INFINITE);
            assertEquals(0, markers.length);
            // when
            // putting a dialyzer warning on it
            final int lineNumber = 3;
            final String message = "test message";
            final IErlElementLocator model = ErlangEngine.getInstance().getModel();
            DialyzerMarkerUtils.addDialyzerWarningMarker(model, erlModule.getResource()
                    .getLocation().toPortableString(), lineNumber, message);
            // then
            // there should be a marker with proper file name and the proper
            // line number
            markers = erlProject.getWorkspaceProject().findMarkers(
View Full Code Here

            // given
            // a project with two erlang modules, one of them selected
            final String projectName = "testproject";
            erlProject = createTmpErlProject(projectName);
            assertNotNull(erlProject);
            final IErlModule a = createModule(erlProject, "a.erl",
                    "-module(a).\n-export([t/0]).\nt() ->\n    p(a).\np(L) ->\n    lists:reverse(L).\n");
            assertNotNull(a);
            final IErlModule b = createModule(erlProject, "b.erl",
                    "-module(b).\n-export([t/0]).\nt() ->\n    p(a).\np(L) ->\n    lists:reverse(L).\n");
            assertNotNull(b);
            invokeBuilderOn(erlProject);
            // when
            // collecting files to dialyze
View Full Code Here

            // a project with two erlang modules, one of them with an erlang
            // error, preventing it from generating a beam-file
            final String projectName = "testproject";
            erlProject = createTmpErlProject(projectName);
            assertNotNull(erlProject);
            final IErlModule a = createModule(erlProject, "a.erl",
                    "-module(a).\n-export([t/0]).\nt() ->\n    p(a).\np(L) ->\n    lists:reverse(L).\n");
            assertNotNull(a);
            final IErlModule b = createModule(erlProject, "b.erl",
                    "-module(b).\n-export([t/0]).\nt() ->\n    p(a).\np(L) ->\n    fel som tusan.\n");
            assertNotNull(b);
            invokeBuilderOn(erlProject);
            // when
            // collecting files to dialyze
View Full Code Here

    @Override
    public void problemsChanged(final IResource[] changedResources,
            final boolean isMarkerChange) {
        if (isMarkerChange) {
            final IErlModule module = fErlangEditor.getModule();
            if (module != null) {
                final IResource resource = module.getResource();
                for (int i = 0; i < changedResources.length; i++) {
                    if (changedResources[i].equals(resource)) {
                        updateEditorImage(module);
                    }
                }
View Full Code Here

        text = new Text(control, SWT.READ_ONLY | SWT.MULTI | SWT.H_SCROLL);
        text.setFont(SWTResourceManager.getFont("Courier New", 10, SWT.NONE));

        final IAdaptable element = getElement();
        final IFile file = (IFile) element.getAdapter(IFile.class);
        final IErlModule module = ErlangEngine.getInstance().getModel().findModule(file);
        final String value = ErlangEngine.getInstance().getModelUtilService()
                .getModuleInfo(module);
        text.setText(value);

        return control;
View Full Code Here

    }

    @Override
    public IReconciler getReconciler(final ISourceViewer sourceViewer) {
        final ErlReconcilingStrategy strategy = new ErlReconcilingStrategy(editor);
        final IErlModule module = editor != null ? editor.getModule() : null;
        final String path = module != null ? module.getFilePath() : null;
        reconciler = new ErlReconciler(strategy, true, true, path, module, getEditor());
        reconciler.setProgressMonitor(new NullProgressMonitor());
        reconciler.setIsAllowedToModifyDocument(false);
        reconciler.setDelay(500);
        return reconciler;
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.