Search in sources :

Example 21 with IErlModel

use of org.erlide.engine.model.root.IErlModel in project erlide_eclipse by erlang.

the class ParsingTest method setUp.

/**
 * @throws java.lang.Exception
 */
@Before
public void setUp() throws Exception {
    final IErlModel model = ErlangEngine.getInstance().getModel();
    module = model.getModuleFromText(model, "testing", "", null);
}
Also used : IErlModel(org.erlide.engine.model.root.IErlModel) Before(org.junit.Before)

Example 22 with IErlModel

use of org.erlide.engine.model.root.IErlModel in project erlide_eclipse by erlang.

the class DefaultErlangFoldingStructureProvider method install.

@Override
public void install(final ITextEditor editor, final ProjectionViewer viewer) {
    if (editor instanceof ErlangEditor) {
        fFirstTimeInitialCollapse = true;
        fEditor = editor;
        fViewer = viewer;
        fViewer.addProjectionListener(this);
        final IErlModel mdl = ErlangEngine.getInstance().getModel();
        mdl.addModelChangeListener(this);
    }
}
Also used : IErlModel(org.erlide.engine.model.root.IErlModel) ErlangEditor(org.erlide.ui.editors.erl.ErlangEditor)

Example 23 with IErlModel

use of org.erlide.engine.model.root.IErlModel in project erlide_eclipse by erlang.

the class DebugTab method getModulesFromAddModulesDialog.

public static List<IErlModule> getModulesFromAddModulesDialog(final Shell shell) {
    final List<IErlModule> result = Lists.newArrayList();
    final AddInterpretedModulesSelectionDialog dialog = new AddInterpretedModulesSelectionDialog(shell);
    final int resultCode = dialog.open();
    if (resultCode != IDialogConstants.OK_ID) {
        return result;
    }
    final Object[] dialogResult = dialog.getResult();
    if (dialogResult == null || dialogResult.length == 0) {
        return result;
    }
    final IErlModel model = ErlangEngine.getInstance().getModel();
    for (final Object o : dialogResult) {
        if (o instanceof IFile) {
            final IFile file = (IFile) o;
            result.add(model.findModule(file));
        }
    }
    return result;
}
Also used : IFile(org.eclipse.core.resources.IFile) AddInterpretedModulesSelectionDialog(org.erlide.ui.dialogs.AddInterpretedModulesSelectionDialog) IErlModel(org.erlide.engine.model.root.IErlModel) IErlModule(org.erlide.engine.model.root.IErlModule)

Example 24 with IErlModel

use of org.erlide.engine.model.root.IErlModel in project erlide_eclipse by erlang.

the class SearchCoreUtil method getProjectsScope.

public static ErlSearchScope getProjectsScope(final Collection<IProject> projects, final boolean addExternals, final boolean addOtp) throws CoreException {
    final ErlSearchScope result = new ErlSearchScope();
    final Set<String> externalModulePaths = new HashSet<>();
    final IErlModel model = ErlangEngine.getInstance().getModel();
    for (final IProject project : projects) {
        SearchCoreUtil.addProjectToScope(project, result);
        if (NatureUtil.hasErlangNature(project)) {
            final IErlProject erlProject = model.getErlangProject(project);
            SearchCoreUtil.addExternalModules(erlProject, result, externalModulePaths, addExternals, addOtp);
        }
    }
    return result;
}
Also used : IErlProject(org.erlide.engine.model.root.IErlProject) IErlModel(org.erlide.engine.model.root.IErlModel) ErlSearchScope(org.erlide.engine.services.search.ErlSearchScope) IProject(org.eclipse.core.resources.IProject) HashSet(java.util.HashSet)

Example 25 with IErlModel

use of org.erlide.engine.model.root.IErlModel in project erlide_eclipse by erlang.

the class ErlExternalReferenceEntryList method buildStructure.

@Override
public boolean buildStructure(final IProgressMonitor pm) throws ErlModelException {
    // TODO some code duplication within this function
    // ErlLogger.debug("ErlExternalReferenceEntryList.buildStructure %s",
    // getName());
    final IErlProject project = ErlangEngine.getInstance().getModelUtilService().getProject(this);
    final ErlModelCache cache = ErlModelCache.getDefault();
    List<ExternalTreeEntry> externalModuleTree = cache.getExternalTree(externalModules);
    List<ExternalTreeEntry> externalIncludeTree = cache.getExternalTree(externalIncludes);
    if (externalModuleTree == null || externalIncludeTree == null) {
        final OtpErlangList pathVars = ErlangEngine.getInstance().getModel().getPathVars();
        final IOtpRpc backend = OtpRpcFactory.getOtpRpcForProject(project);
        if (externalModuleTree == null && !externalModules.isEmpty()) {
            if (pm != null) {
                pm.worked(1);
            }
            externalModuleTree = ErlangEngine.getInstance().getOpenService().getExternalModuleTree(backend, externalModules, pathVars);
        }
        if (externalIncludeTree == null && !externalIncludes.isEmpty()) {
            if (pm != null) {
                pm.worked(1);
            }
            externalIncludeTree = ErlangEngine.getInstance().getOpenService().getExternalModuleTree(backend, externalIncludes, pathVars);
        }
    }
    setChildren(null);
    final IErlModel model = ErlangEngine.getInstance().getModel();
    if (externalModuleTree != null && !externalModuleTree.isEmpty()) {
        addExternalEntries(pm, externalModuleTree, model, "modules", null, false);
        cache.putExternalTree(externalModules, project, externalModuleTree);
    }
    if (externalIncludeTree != null && !externalIncludeTree.isEmpty() || !projectIncludes.isEmpty()) {
        addExternalEntries(pm, externalIncludeTree, model, "includes", projectIncludes, true);
        if (externalIncludeTree != null) {
            cache.putExternalTree(externalIncludes, project, externalIncludeTree);
        }
    }
    return true;
}
Also used : IErlProject(org.erlide.engine.model.root.IErlProject) IErlModel(org.erlide.engine.model.root.IErlModel) OtpErlangList(com.ericsson.otp.erlang.OtpErlangList) ErlModelCache(org.erlide.engine.internal.model.cache.ErlModelCache) ExternalTreeEntry(org.erlide.engine.services.search.ExternalTreeEntry) IOtpRpc(org.erlide.runtime.rpc.IOtpRpc)

Aggregations

IErlModel (org.erlide.engine.model.root.IErlModel)36 IErlModule (org.erlide.engine.model.root.IErlModule)18 IErlProject (org.erlide.engine.model.root.IErlProject)13 IFile (org.eclipse.core.resources.IFile)11 ErlModelException (org.erlide.engine.model.ErlModelException)11 IProject (org.eclipse.core.resources.IProject)10 CoreException (org.eclipse.core.runtime.CoreException)8 IErlElement (org.erlide.engine.model.IErlElement)8 IResource (org.eclipse.core.resources.IResource)7 IPath (org.eclipse.core.runtime.IPath)5 OtpErlangList (com.ericsson.otp.erlang.OtpErlangList)4 OtpErlangObject (com.ericsson.otp.erlang.OtpErlangObject)3 OtpErlangString (com.ericsson.otp.erlang.OtpErlangString)3 ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)3 IBackend (org.erlide.backend.api.IBackend)3 OpenResult (org.erlide.engine.services.search.OpenResult)3 File (java.io.File)2 IOException (java.io.IOException)2 IContainer (org.eclipse.core.resources.IContainer)2