use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class SearchTest method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
ErlideTestUtils.initProjects();
// We set up projects here, it's quite costly
final String name1 = "testproject1";
final IErlProject erlProject1 = ErlideTestUtils.createErlProject(name1);
final String name2 = "testproject2";
final IErlProject erlProject2 = ErlideTestUtils.createErlProject(name2);
SearchTest.projects = new IErlProject[] { erlProject1, erlProject2 };
}
use of org.erlide.engine.model.root.IErlProject 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.root.IErlProject 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.root.IErlProject in project erlide_eclipse by erlang.
the class CreateHeaderQuickFix method run.
@Override
public void run() {
final ModelUtilService svc = ErlangEngine.getInstance().getModelUtilService();
final String name = getQuickFix().getArgs().get(0);
final IErlProject project = svc.getProject(module);
final Iterator<IPath> iterator = project.getProperties().getIncludeDirs().iterator();
final IPath inc;
if (!iterator.hasNext()) {
inc = module.getResource().getParent().getProjectRelativePath();
} else {
inc = iterator.next();
// if there are multiple include dirs, let user move file manually
}
final IProject wproject = project.getWorkspaceProject();
final IFolder folder = wproject.getFolder(inc);
final IFile header = folder.getFile(name);
try (final EmptyInputStream source = new EmptyInputStream()) {
header.create(source, true, null);
folder.refreshLocal(IResource.DEPTH_ONE, null);
final IFile fileToOpen = header;
final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IDE.openEditor(page, fileToOpen);
} catch (final CoreException e) {
ErlLogger.error(e);
} catch (final IOException e) {
ErlLogger.error(e);
}
}
use of org.erlide.engine.model.root.IErlProject 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);
}
}
Aggregations