use of org.erlide.engine.model.IErlElement in project erlide_eclipse by erlang.
the class ErlideTestUtils method initProjects.
public static void initProjects() throws CoreException {
ErlideTestUtils.projects = Lists.newArrayList();
final IErlModel model = ErlangEngine.getInstance().getModel();
model.open(null);
final List<IErlElement> children = model.getChildren();
for (final IErlElement child : children) {
if (child instanceof IErlProject) {
final IErlProject project = (IErlProject) child;
if (project.getName().startsWith("testproject")) {
ErlideTestUtils.deleteProject(project);
}
}
}
}
use of org.erlide.engine.model.IErlElement in project erlide_eclipse by erlang.
the class ErlModel method create.
public IErlElement create(final IResource resource, final IParent parent) {
if (resource == null) {
return null;
}
final IErlElement e = findElement(resource);
if (e != null) {
return e;
}
final int type = resource.getType();
switch(type) {
case IResource.PROJECT:
return createProject((IProject) resource);
case IResource.FILE:
return createFile((IFile) resource, parent);
case IResource.FOLDER:
return createFolder((IFolder) resource, parent);
case IResource.ROOT:
return createRoot((IWorkspaceRoot) resource);
default:
return null;
}
// TODO should we make Erlidemodelevents and fire them?
}
use of org.erlide.engine.model.IErlElement in project erlide_eclipse by erlang.
the class ErlModel method getErlangProjects.
/**
* @see IErlModel
*/
@Override
public Collection<IErlProject> getErlangProjects() throws ErlModelException {
final Collection<IErlElement> list = getChildrenOfKind(ErlElementKind.PROJECT);
final Collection<IErlProject> result = Lists.newArrayList();
for (final IErlElement e : list) {
result.add((IErlProject) e);
}
return result;
}
use of org.erlide.engine.model.IErlElement in project erlide_eclipse by erlang.
the class ErlModelDeltaManager method mergeDeltas.
IErlElementDelta mergeDeltas(final Collection<IErlElementDelta> deltas) {
synchronized (deltas) {
if (deltas.isEmpty()) {
return null;
}
if (deltas.size() == 1) {
return deltas.iterator().next();
}
final Iterator<IErlElementDelta> iterator = deltas.iterator();
final IErlElement cRoot = ErlangEngine.getInstance().getModel();
final ErlElementDelta rootDelta = new ErlElementDelta(0, 0, cRoot);
boolean insertedTree = false;
while (iterator.hasNext()) {
final ErlElementDelta delta = (ErlElementDelta) iterator.next();
final IErlElement element = delta.getElement();
if (cRoot.equals(element)) {
final IErlElementDelta[] children = delta.getChildren(IErlElementDelta.ALL);
for (final IErlElementDelta element0 : children) {
final ErlElementDelta projectDelta = (ErlElementDelta) element0;
rootDelta.insertDeltaTree(projectDelta.getElement(), projectDelta);
insertedTree = true;
}
final IResourceDelta[] resourceDeltas = delta.getResourceDeltas();
if (resourceDeltas != null) {
for (final IResourceDelta element0 : resourceDeltas) {
rootDelta.addResourceDelta(element0);
insertedTree = true;
}
}
} else {
rootDelta.insertDeltaTree(element, delta);
insertedTree = true;
}
}
if (insertedTree) {
return rootDelta;
}
return null;
}
}
use of org.erlide.engine.model.IErlElement in project erlide_eclipse by erlang.
the class ModelInternalUtils method getIncludeLibPath.
private String getIncludeLibPath(final IErlModule module) {
String s = module.getName();
String prevS = s;
IErlElement e = module;
for (; ; ) {
final IParent p = e.getParent();
if (p instanceof IErlProject) {
break;
}
e = (IErlElement) p;
prevS = s;
s = e.getName() + "/" + s;
}
return prevS;
}
Aggregations