use of org.erlide.engine.model.ErlModelException in project erlide_eclipse by erlang.
the class AddRefacHandler method getBinPath.
// gets original binary path
private String getBinPath(final String callbackModule) {
String path;
try {
if (ErlangEngine.getInstance().getModel().findModule(callbackModule) == null) {
return null;
}
final IErlProject project = ErlangEngine.getInstance().getModelUtilService().getProject(ErlangEngine.getInstance().getModel().findModule(callbackModule));
path = project.getWorkspaceProject().getLocation().append(project.getProperties().getOutputDir()).append(callbackModule + ".beam").toOSString();
return path;
} catch (final ErlModelException e) {
return null;
}
}
use of org.erlide.engine.model.ErlModelException in project erlide_eclipse by erlang.
the class UserAdhocRefactoring method load.
/**
* Loading user's callback module
*
* @return
*/
public boolean load() {
String callbackPath;
try {
if (ErlangEngine.getInstance().getModel().findModule(refac.getCallbackModule()) == null) {
return false;
}
final IErlProject project = ErlangEngine.getInstance().getModelUtilService().getProject(ErlangEngine.getInstance().getModel().findModule(refac.getCallbackModule()));
callbackPath = project.getWorkspaceProject().getLocation().append(project.getProperties().getOutputDir()).toString();
} catch (final ErlModelException e) {
return false;
}
final RpcResult res = WranglerBackendManager.getRefactoringBackend().callWithoutParser("load_callback_mod_eclipse", "ss", refac.getCallbackModule(), callbackPath);
if (!res.isOk()) {
return false;
}
return true;
}
use of org.erlide.engine.model.ErlModelException in project erlide_eclipse by erlang.
the class ErlangMainTab method createControl.
/**
* @wbp.parser.entryPoint
*/
@Override
public void createControl(final Composite parent) {
final Composite comp = new Composite(parent, SWT.NONE);
setControl(comp);
final GridLayout topLayout = new GridLayout();
comp.setLayout(topLayout);
createProjectsGroup(comp);
createStartGroup(comp);
Collection<IErlProject> projects;
try {
projects = ErlangEngine.getInstance().getModel().getErlangProjects();
final List<String> ps = new ArrayList<>();
for (final IErlProject p : projects) {
ps.add(p.getName());
}
} catch (final ErlModelException e) {
ErlLogger.warn(e);
}
}
use of org.erlide.engine.model.ErlModelException in project erlide_eclipse by erlang.
the class ErlangExternalsContentProvider method getChildren.
@Override
public Object[] getChildren(final Object parentElement0) {
Object parentElement = parentElement0;
try {
if (parentElement instanceof IProject) {
final IProject project = (IProject) parentElement;
if (project.isOpen()) {
parentElement = ErlangEngine.getInstance().getModel().findProject(project);
}
}
if (parentElement instanceof IErlModule) {
return erlangFileContentProvider.getChildren(parentElement);
}
if (parentElement instanceof IParent) {
if (parentElement instanceof IOpenable) {
final IOpenable openable = (IOpenable) parentElement;
openable.open(null);
}
final IParent parent = (IParent) parentElement;
final Collection<IErlElement> children = parent.getChildrenOfKind(ErlElementKind.EXTERNAL_ROOT, ErlElementKind.EXTERNAL_APP, ErlElementKind.EXTERNAL_FOLDER);
return children.toArray();
}
} catch (final ErlModelException e) {
}
return ErlangExternalsContentProvider.NO_CHILDREN;
}
use of org.erlide.engine.model.ErlModelException in project erlide_eclipse by erlang.
the class ErlangFileContentProvider method getChildren.
/**
* Return the model elements for a *.erl IFile or NO_CHILDREN for otherwise.
*/
@Override
public Object[] getChildren(final Object parentElement0) {
Object parentElement = parentElement0;
try {
if (parentElement instanceof IFile) {
parentElement = ErlangEngine.getInstance().getModel().findModule((IFile) parentElement);
}
if (parentElement instanceof IOpenable) {
final IOpenable openable = (IOpenable) parentElement;
openable.open(null);
}
if (parentElement instanceof IParent) {
final IParent parent = (IParent) parentElement;
final Collection<IErlElement> children = parent.getChildren();
return children.toArray();
}
} catch (final ErlModelException e) {
ErlLogger.warn(e);
}
return ErlangFileContentProvider.NO_CHILDREN;
}
Aggregations