Search in sources :

Example 16 with IErlModule

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

the class IErlFolderTest method findInclude.

// IErlModule findInclude(String includeName, String includePath)
// throws ErlModelException;
@Test
public void findInclude() throws Exception {
    final IErlModule include = ErlideTestUtils.createInclude(project, "yy.hrl", "-define(ME, yy).\n");
    final IErlModule module2 = ErlideTestUtils.createInclude(project, "zz.erl", "-module(zz).\n");
    final String moduleName = include.getModuleName();
    final String name = include.getName();
    final String filePath = include.getFilePath();
    final IErlModule findInclude = srcFolder.findInclude(moduleName, null);
    final IErlModule findInclude2 = includeFolder.findInclude(moduleName, null);
    final IErlModule findInclude3 = includeFolder.findInclude(null, filePath);
    final IErlModule findInclude4 = includeFolder.findInclude(name, null);
    final IErlModule findInclude5 = includeFolder.findInclude("xxaa", filePath);
    final IErlModule findInclude6 = includeFolder.findInclude("zz.erl", null);
    final IErlModule findInclude7 = includeFolder.findInclude("zz", null);
    assertNull(findInclude);
    assertEquals(include, findInclude2);
    assertEquals(include, findInclude3);
    assertEquals(include, findInclude4);
    assertEquals(include, findInclude5);
    assertEquals(module2, findInclude6);
    assertNull(findInclude7);
}
Also used : IErlModule(org.erlide.engine.model.root.IErlModule) Test(org.junit.Test)

Example 17 with IErlModule

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

the class ErlangEditor method setSelection.

public void setSelection(final IErlElement element) {
    if (element == null || element instanceof IErlModule) {
        return;
    }
    if (element instanceof ISourceReference) {
        final ISourceReference reference = (ISourceReference) element;
        // set highlight range
        setSelection(reference, true);
        if (myOutlinePage != null) {
            myOutlinePage.select(reference);
        }
    }
}
Also used : IErlModule(org.erlide.engine.model.root.IErlModule) ISourceReference(org.erlide.engine.model.erlang.ISourceReference)

Example 18 with IErlModule

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

the class ErlangSourceViewerConfiguration method getReconciler.

@Override
public IReconciler getReconciler(final ISourceViewer sourceViewer) {
    final ErlReconcilingStrategy strategy = new ErlReconcilingStrategy(null);
    final IErlModule module = null;
    final String path = null;
    final ErlReconciler reconciler = new ErlReconciler(strategy, true, true, path, module, null);
    reconciler.setProgressMonitor(new NullProgressMonitor());
    reconciler.setIsAllowedToModifyDocument(false);
    reconciler.setDelay(500);
    return reconciler;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ErlReconcilingStrategy(org.erlide.ui.editors.internal.reconciling.ErlReconcilingStrategy) IErlModule(org.erlide.engine.model.root.IErlModule) ErlReconciler(org.erlide.ui.editors.internal.reconciling.ErlReconciler)

Example 19 with IErlModule

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

the class ErlangQuickFixCollector method getFixes.

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) {
        return getFixesForProject((IProject) resource, marker);
    }
    if (resource instanceof IFile) {
        module = model.findModule((IFile) resource);
        if (module != null) {
            return getFixesForModule(module, marker);
        }
    }
    return new IMarkerResolution[0];
}
Also used : IFile(org.eclipse.core.resources.IFile) IErlModel(org.erlide.engine.model.root.IErlModel) IMarkerResolution(org.eclipse.ui.IMarkerResolution) IErlModule(org.erlide.engine.model.root.IErlModule) IResource(org.eclipse.core.resources.IResource) IProject(org.eclipse.core.resources.IProject)

Example 20 with IErlModule

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

the class ClearCacheAction method resetCacheForEditor.

public static void resetCacheForEditor(final ErlangEditor erlangEditor) {
    final IErlModule module = erlangEditor.getModule();
    if (module == null) {
        return;
    }
    for (final String suffix : ClearCacheAction.suffixes) {
        final String cacheFileOSPath = ErlangEngine.getInstance().getStateDir() + module.getScannerName() + suffix;
        final File cacheFile = new File(cacheFileOSPath);
        cacheFile.delete();
    }
    erlangEditor.resetAndCacheScannerAndParser();
}
Also used : IErlModule(org.erlide.engine.model.root.IErlModule) File(java.io.File)

Aggregations

IErlModule (org.erlide.engine.model.root.IErlModule)191 Test (org.junit.Test)66 IErlProject (org.erlide.engine.model.root.IErlProject)57 IErlElement (org.erlide.engine.model.IErlElement)35 IFile (org.eclipse.core.resources.IFile)26 IErlElementLocator (org.erlide.engine.model.root.IErlElementLocator)26 ErlModelException (org.erlide.engine.model.ErlModelException)22 IPath (org.eclipse.core.runtime.IPath)21 ErlProject (org.erlide.engine.internal.model.root.ErlProject)21 File (java.io.File)20 IErlModel (org.erlide.engine.model.root.IErlModel)18 Path (org.eclipse.core.runtime.Path)17 IProject (org.eclipse.core.resources.IProject)16 IResource (org.eclipse.core.resources.IResource)14 ArrayList (java.util.ArrayList)13 CoreException (org.eclipse.core.runtime.CoreException)10 IEditorPart (org.eclipse.ui.IEditorPart)10 IParent (org.erlide.engine.model.IParent)10 OtpErlangObject (com.ericsson.otp.erlang.OtpErlangObject)9 OtpErlangString (com.ericsson.otp.erlang.OtpErlangString)9