use of org.erlide.runtime.runtimeinfo.RuntimeInfo in project erlide_eclipse by erlang.
the class BackendManager method getByVersion.
@Override
public IOtpRpc getByVersion(final RuntimeVersion version) {
final RuntimeInfo info = BackendCore.getRuntimeInfoCatalog().getRuntime(version, null);
if (info == null) {
return null;
}
final Collection<IBackend> list = getAllBackends();
for (final IBackend b : list) {
if (b.getRuntime().getVersion().equals(version)) {
return b.getOtpRpc();
}
}
for (final IBackend b : list) {
if (b.getRuntime().getVersion().isCompatible(version)) {
return b.getOtpRpc();
}
}
return null;
}
use of org.erlide.runtime.runtimeinfo.RuntimeInfo in project erlide_eclipse by erlang.
the class BackendManager method getBuildBackend.
@SuppressWarnings("null")
@Override
public IBackend getBuildBackend(@NonNull final IErlProject project) {
final RuntimeInfo info = project.getRuntimeInfo();
if (info == null) {
ErlLogger.info("Project %s has no runtime info, using ide", project.getName());
return getIdeBackend();
}
final String version = info.getVersion().asMajor().toString();
IBackend b = buildBackends.get(version);
if (b == null) {
b = factory.createBuildBackend(info);
buildBackends.put(version, b);
addBackend(b);
notifyBackendChange(b, BackendEvent.ADDED, null, null);
}
return b;
}
use of org.erlide.runtime.runtimeinfo.RuntimeInfo in project erlide_eclipse by erlang.
the class ErlangSourcePathComputerDelegate method computeSourceContainers.
@Override
public ISourceContainer[] computeSourceContainers(final ILaunchConfiguration configuration, final IProgressMonitor monitor) throws CoreException {
final List<ISourceContainer> containers = new ArrayList<>();
final IProject[] projects = LaunchUtils.getErlangLaunchConfigurationProjects(configuration);
for (final IProject p : projects) {
containers.add(new ProjectSourceContainer(p, false));
}
if (containers.isEmpty()) {
containers.add(new WorkspaceSourceContainer());
}
final String runtimeName = configuration.getAttribute(ErlRuntimeAttributes.RUNTIME_NAME, "").trim();
final RuntimeInfo info = BackendCore.getRuntimeInfoCatalog().getRuntime(runtimeName);
containers.add(new ErlangOtpSourceContainer(new Path(info.getOtpHome())));
return containers.toArray(new ISourceContainer[containers.size()]);
}
use of org.erlide.runtime.runtimeinfo.RuntimeInfo in project erlide_eclipse by erlang.
the class RuntimeInfoPreferencesSerializer method store.
@Override
public synchronized void store(final RuntimeInfoCatalogData data) {
try {
instanceRootNode.clear();
for (final String node : instanceRootNode.childrenNames()) {
instanceRootNode.node(node).removeNode();
}
for (final RuntimeInfo rt : data.runtimes) {
RuntimeInfoLoader.store(rt, instanceRootNode);
}
if (data.defaultRuntimeName != null) {
instanceRootNode.put(RuntimeInfoPreferencesSerializer.DEFAULT_KEY, data.defaultRuntimeName);
}
if (data.erlideRuntimeName != null) {
instanceRootNode.put(RuntimeInfoPreferencesSerializer.ERLIDE_KEY, data.erlideRuntimeName);
}
instanceRootNode.flush();
} catch (final Exception e) {
ErlLogger.warn(e);
}
}
use of org.erlide.runtime.runtimeinfo.RuntimeInfo in project erlide_eclipse by erlang.
the class RuntimeTab method createControl.
/**
* @wbp.parser.entryPoint
*/
@Override
public void createControl(final Composite parent) {
runtimes = BackendCore.getRuntimeInfoCatalog().getRuntimes();
final Composite comp = new Composite(parent, SWT.NONE);
setControl(comp);
final GridLayout topLayout = new GridLayout();
topLayout.numColumns = 3;
comp.setLayout(topLayout);
final Label runtimeLabel = new Label(comp, SWT.NONE);
runtimeLabel.setText("Runtime");
final List<String> rtl = new ArrayList<>();
for (final RuntimeInfo r : runtimes) {
rtl.add(r.getName());
}
final String[] rts = rtl.toArray(new String[] {});
final RuntimeInfo defaultRuntime = BackendCore.getRuntimeInfoCatalog().getDefaultRuntime();
final int db = defaultRuntime == null ? 0 : Arrays.binarySearch(rts, defaultRuntime.getName());
runtimesCombo = new Combo(comp, SWT.READ_ONLY);
final GridData gd_runtimesCombo = new GridData(174, SWT.DEFAULT);
gd_runtimesCombo.horizontalAlignment = SWT.FILL;
runtimesCombo.setLayoutData(gd_runtimesCombo);
runtimesCombo.addSelectionListener(new SelectionAdapter() {
@SuppressWarnings("synthetic-access")
@Override
public void widgetSelected(final SelectionEvent e) {
updateLaunchConfigurationDialog();
}
});
runtimesCombo.setItems(rts);
runtimesCombo.select(db);
new Label(comp, SWT.NONE);
new Label(comp, SWT.NONE);
lblHoverMouseOver = new Label(comp, SWT.NONE);
lblHoverMouseOver.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblHoverMouseOver.setAlignment(SWT.RIGHT);
lblHoverMouseOver.setFont(SWTResourceManager.getFont("Segoe UI", 7, SWT.NORMAL));
lblHoverMouseOver.setText("hover mouse over fields for more info");
new Label(comp, SWT.NONE);
final Label nodeNameLabel = new Label(comp, SWT.NONE);
nodeNameLabel.setText("Node name");
nameText = new Text(comp, SWT.BORDER);
nameText.setToolTipText("Enter a node name without host for a local node.\r\n\r\nEnter a node name with host to override the local names or to connect to a remote node.\r\n");
final GridData gd_nameText = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_nameText.widthHint = 241;
nameText.setLayoutData(gd_nameText);
nameText.addModifyListener(new ModifyListener() {
@Override
@SuppressWarnings("synthetic-access")
public void modifyText(final ModifyEvent e) {
updateLaunchConfigurationDialog();
}
});
nodeHostLabel = new Label(comp, SWT.NONE);
nodeHostLabel.setText("@");
new Label(comp, SWT.NONE);
longNameButton = new Button(comp, SWT.RADIO);
longNameButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
longNameButton.addSelectionListener(new SelectionAdapter() {
@SuppressWarnings("synthetic-access")
@Override
public void widgetSelected(final SelectionEvent e) {
updateLaunchConfigurationDialog();
}
});
longNameButton.setSelection(true);
longNameButton.setText("long name (-name)");
new Label(comp, SWT.NONE);
shortNameButton = new Button(comp, SWT.RADIO);
shortNameButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
shortNameButton.addSelectionListener(new SelectionAdapter() {
@SuppressWarnings("synthetic-access")
@Override
public void widgetSelected(final SelectionEvent e) {
updateLaunchConfigurationDialog();
}
});
shortNameButton.setText("short name (-sname)");
final Label cookieLabel = new Label(comp, SWT.NONE);
cookieLabel.setToolTipText("Leave empty to use default one");
cookieLabel.setText("Cookie");
cookieText = new Text(comp, SWT.BORDER);
final GridData gd_cookieText = new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1);
gd_cookieText.widthHint = 232;
cookieText.setLayoutData(gd_cookieText);
cookieText.addModifyListener(new ModifyListener() {
@Override
@SuppressWarnings("synthetic-access")
public void modifyText(final ModifyEvent e) {
updateLaunchConfigurationDialog();
}
});
cookieText.setToolTipText("Leave empty to use default one");
startNodeCheckbox = new Button(comp, SWT.CHECK);
startNodeCheckbox.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
startNodeCheckbox.setSelection(true);
startNodeCheckbox.setText("Start the Erlang node if not running already");
startNodeCheckbox.addSelectionListener(new SelectionAdapter() {
@SuppressWarnings("synthetic-access")
@Override
public void widgetSelected(final SelectionEvent e) {
updateLaunchConfigurationDialog();
}
});
final Label workingDirectoryLabel = new Label(comp, SWT.NONE);
workingDirectoryLabel.setText("Working directory");
workingDirText = new Text(comp, SWT.BORDER);
workingDirText.setToolTipText("may be relative to the workspace");
workingDirText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
workingDirText.addModifyListener(new ModifyListener() {
@Override
@SuppressWarnings("synthetic-access")
public void modifyText(final ModifyEvent e) {
updateLaunchConfigurationDialog();
}
});
final Label extraArgumentsLabel = new Label(comp, SWT.NONE);
extraArgumentsLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
extraArgumentsLabel.setText("Extra arguments");
argsText = new Text(comp, SWT.BORDER | SWT.MULTI);
argsText.setToolTipText("as on the command line\nBe careful about proper quoting!");
final GridData gd_argsText = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
gd_argsText.heightHint = 35;
argsText.setLayoutData(gd_argsText);
argsText.addModifyListener(new ModifyListener() {
@Override
@SuppressWarnings("synthetic-access")
public void modifyText(final ModifyEvent e) {
updateLaunchConfigurationDialog();
}
});
new Label(comp, SWT.NONE);
final Label extraArgumentsLabel2 = new Label(comp, SWT.NONE);
extraArgumentsLabel2.setText("(overrides runtime settings)");
extraArgumentsLabel2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
distributedLoadCheck = new Button(comp, SWT.CHECK);
distributedLoadCheck.setText("Load project code on all connected nodes");
distributedLoadCheck.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
new Label(comp, SWT.NONE);
distributedLoadCheck.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(final SelectionEvent e) {
updateLaunchConfigurationDialog();
}
@Override
public void widgetSelected(final SelectionEvent e) {
updateLaunchConfigurationDialog();
}
});
updateLaunchConfigurationDialog();
}
Aggregations