use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class ErlangNodeLaunchShortcut method getProjectNames.
private List<String> getProjectNames(final Collection<IErlProject> projects) {
final List<String> result = Lists.newArrayListWithCapacity(projects.size());
for (final IErlProject project : projects) {
String name = project.getName();
if (name.startsWith("org.erlide.")) {
name = name.substring("org.erlide.".length());
}
result.add(name.replaceAll("\\.", ""));
}
return result;
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class ErlangNodeLaunchShortcut method launch.
@Override
public void launch(final IEditorPart editor, final String mode) {
ErlLogger.debug("** Launch :: " + editor.getTitle());
if (editor instanceof AbstractErlangEditor) {
final AbstractErlangEditor erlangEditor = (AbstractErlangEditor) editor;
final IErlProject project = erlangEditor.getProject();
if (project != null) {
try {
doLaunch(mode, Lists.newArrayList(project));
} catch (final CoreException e) {
final IWorkbench workbench = PlatformUI.getWorkbench();
final Shell shell = workbench.getActiveWorkbenchWindow().getShell();
MessageDialog.openError(shell, "Error", e.getStatus().getMessage());
}
}
}
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class CoverMainTab method initializeFrom.
@Override
public void initializeFrom(final ILaunchConfiguration config) {
try {
final String projectName = config.getAttribute(ICoverAttributes.PROJECT, "");
projectMBr.setText(projectName);
if (projectName != null && !projectName.isEmpty()) {
final IErlProject p = ErlangEngine.getInstance().getModel().getErlangProject(ResourcesPlugin.getWorkspace().getRoot().getProject(projectName));
if (p != null) {
moduleDialog.setElements(createModuleArray(p));
}
}
} catch (final CoreException e) {
projectMBr.setText("");
}
try {
moduleBr.setText(config.getAttribute(ICoverAttributes.MODULE, ""));
} catch (final CoreException e) {
moduleBr.setText("");
}
try {
fileBr.setText(config.getAttribute(ICoverAttributes.FILE, ""));
} catch (final CoreException e) {
fileBr.setText("");
}
try {
final String type = config.getAttribute(ICoverAttributes.TYPE, LaunchType.MODULE.toString());
final LaunchType typeT = LaunchType.valueOf(type);
switch(typeT) {
case MODULE:
singleRadio.setSelection(true);
projectMBr.setEnabled(true);
moduleBr.setEnabled(true);
fileBr.setEnabled(false);
break;
case ALL:
allRadio.setSelection(true);
projectMBr.setEnabled(false);
moduleBr.setEnabled(false);
fileBr.setEnabled(true);
break;
default:
singleRadio.setSelection(true);
projectMBr.setEnabled(true);
moduleBr.setEnabled(true);
fileBr.setEnabled(false);
break;
}
} catch (final CoreException e) {
singleRadio.setSelection(true);
}
String combo;
try {
combo = config.getAttribute(ICoverAttributes.COMBO, FrameworkType.EUNIT.getRepr());
final int idx = testCombo.indexOf(combo);
testCombo.select(idx);
} catch (final CoreException e) {
testCombo.select(0);
}
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class CoverMainTab method createModuleGroup.
private void createModuleGroup(final Composite comp) {
final ElementListSelectionDialog projectDialog = new ElementListSelectionDialog(getShell(), new ProjectLabelProvider());
final Object[] elements = createProjectArray();
projectDialog.setElements(elements);
projectDialog.setTitle("Select project");
projectDialog.setMessage("Select Erlang project: ");
moduleDialog = new ElementListSelectionDialog(getShell(), new ProjectLabelProvider());
moduleDialog.setElements(new Object[0]);
moduleDialog.setTitle("Select module");
moduleDialog.setMessage("Select Erlang module: ");
projectMBr = browserWithLabel(comp, "Project:", projectDialog);
projectMBr.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
updateLaunchConfigurationDialog();
final String projectName = projectMBr.getText();
if (projectName != null && !projectName.isEmpty()) {
final IErlProject p = ErlangEngine.getInstance().getModel().getErlangProject(ResourcesPlugin.getWorkspace().getRoot().getProject(projectName));
if (p != null) {
moduleDialog.setElements(createModuleArray(p));
}
}
}
});
moduleBr = browserWithLabel(comp, "Module:", moduleDialog);
moduleBr.addModifyListener(basicModifyListener);
}
use of org.erlide.engine.model.root.IErlProject in project erlide_eclipse by erlang.
the class SearchCoreUtil method addProjectToScope.
static void addProjectToScope(final IProject project, final ErlSearchScope result) throws CoreException {
if (project == null) {
return;
}
final IErlProject erlProject = ErlangEngine.getInstance().getModel().getErlangProject(project);
if (erlProject != null) {
final Collection<IPath> sourcePaths = erlProject.getProperties().getSourceDirs();
for (final IPath path : sourcePaths) {
final IFolder folder = project.getFolder(path);
SearchCoreUtil.addFolderToScope(folder, result);
}
}
}
Aggregations