use of org.erlide.engine.model.root.IErlProject 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;
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class DialyzerPreferencePage method doLinkActivated.
void doLinkActivated(final Link widget) {
if (isProjectPreferencePage()) {
openWorkspacePreferences(null);
} else {
final List<IProject> erlProjects = new ArrayList<>();
final Set<IProject> projectsWithSpecifics = new HashSet<>();
final IErlModel model = ErlangEngine.getInstance().getModel();
try {
for (final IErlProject ep : model.getErlangProjects()) {
final IProject p = ep.getWorkspaceProject();
if (hasProjectSpecificOptions(p)) {
projectsWithSpecifics.add(p);
}
erlProjects.add(p);
}
} catch (final ErlModelException e) {
}
final ProjectSelectionDialog dialog = new ProjectSelectionDialog(getShell(), erlProjects, projectsWithSpecifics);
if (dialog.open() == Window.OK) {
final IProject res = (IProject) dialog.getFirstResult();
openProjectProperties(res);
}
}
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class CoverMainTab method createControl.
@Override
public void createControl(final Composite parent) {
final ScrolledComposite scrolled = new ScrolledComposite(parent, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
final Composite comp = new Composite(scrolled, SWT.NONE);
scrolled.setContent(comp);
scrolled.setExpandVertical(true);
scrolled.setExpandHorizontal(true);
scrolled.setMinSize(760, 300);
setControl(scrolled);
final GridLayout mainLayout = new GridLayout();
mainLayout.numColumns = 3;
mainLayout.verticalSpacing = 15;
mainLayout.horizontalSpacing = 20;
mainLayout.marginHeight = 15;
mainLayout.marginHeight = 15;
comp.setLayout(mainLayout);
final GridData gData = new GridData();
gData.horizontalAlignment = GridData.FILL;
gData.horizontalSpan = 3;
singleRadio = new Button(comp, SWT.RADIO);
singleRadio.setText("Run tests for a single module");
singleRadio.setLayoutData(gData);
singleRadio.addSelectionListener(radioSelectionListener);
createModuleGroup(comp);
allRadio = new Button(comp, SWT.RADIO);
allRadio.setText("Run all tests in specific project");
allRadio.setLayoutData(gData);
allRadio.addSelectionListener(radioSelectionListener);
createAllTestsGroup(comp);
final Label testLabel = new Label(comp, SWT.NONE);
testLabel.setText("Testing framework: ");
testCombo = new Combo(comp, SWT.NONE);
testCombo.setItems(new String[] { FrameworkType.EUNIT.getRepr() });
testCombo.addModifyListener(basicModifyListener);
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.root.IErlProject in project erlide_eclipse by erlang.
the class CoverMainTab method createProjectArray.
private Object[] createProjectArray() {
Object[] array;
try {
final List<ProjectElement> res = new LinkedList<>();
final Collection<IErlProject> projects = ErlangEngine.getInstance().getModel().getErlangProjects();
for (final IErlProject p : projects) {
final ProjectElement elem = new ProjectElement(p.getName(), PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(IDE.SharedImages.IMG_OBJ_PROJECT).createImage());
res.add(elem);
}
array = res.toArray();
} catch (final ErlModelException e) {
array = new Object[0];
ErlLogger.error(e);
}
return array;
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class MarkerUtils method findResourceForFileName.
private static IResource findResourceForFileName(final IResource resource, final Entry<String, List<OtpErlangTuple>> entry, final String fileName) {
IResource res = resource;
if (!ResourceUtil.samePath(resource.getLocation().toString(), fileName)) {
final IProject project = resource.getProject();
res = ResourceUtil.findResourceByLocation(project, fileName);
if (res == null) {
try {
final IErlElementLocator model = ErlangEngine.getInstance().getModel();
final IErlProject erlProject = model.findProject(project);
if (erlProject != null) {
final IErlModule includeFile = model.findIncludeFromProject(erlProject, fileName, fileName, IErlElementLocator.Scope.REFERENCED_PROJECTS);
if (includeFile == null) {
res = resource;
} else {
res = includeFile.getResource();
}
} else {
res = resource;
}
} catch (final Exception e) {
ErlLogger.warn(e);
}
}
}
return res;
}
Aggregations