use of org.erlide.runtime.runtimeinfo.RuntimeVersion in project erlide_eclipse by erlang.
the class ErlProject method getRuntimeInfo.
@Override
public RuntimeInfo getRuntimeInfo() {
final RuntimeVersion requiredRuntimeVersion = getProperties().getRequiredRuntimeVersion();
if (requiredRuntimeVersion != cachedRuntimeVersion) {
cachedRuntimeVersion = requiredRuntimeVersion;
cachedRuntimeInfo = RuntimeCore.getRuntimeInfoCatalog().getRuntime(requiredRuntimeVersion, null);
}
return cachedRuntimeInfo;
}
use of org.erlide.runtime.runtimeinfo.RuntimeVersion in project erlide_eclipse by erlang.
the class ErlangProjectPropertyPage method createContents.
@Override
protected Control createContents(final Composite parent) {
final IProject project = getElement().getAdapter(IProject.class);
erlProject = ErlangEngine.getInstance().getModel().getErlangProject(project);
model = erlProject.getProperties();
final Composite composite = new Composite(parent, SWT.NONE);
boolean globalEnable = true;
final ProjectConfigType configType = erlProject.getConfigType();
if (configType != ProjectConfigType.INTERNAL) {
globalEnable = false;
setMessage("Please edit " + configType.getConfigName() + " to change settings for this project");
}
composite.setLayout(new GridLayout(2, false));
{
final Label lblRequiredErlangVersion = new Label(composite, SWT.NONE);
lblRequiredErlangVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblRequiredErlangVersion.setText("Required Erlang version");
}
{
runtimeCombo = new Combo(composite, SWT.NONE);
final GridData gd_combo = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1);
gd_combo.widthHint = 83;
runtimeCombo.setLayoutData(gd_combo);
runtimeCombo.setEnabled(globalEnable);
final RuntimeVersion[] runtimeVersions = ProjectPreferencesConstants.SUPPORTED_VERSIONS;
runtimeCombo.setItems(ListExtensions.map(Arrays.asList(runtimeVersions), new Functions.Function1<RuntimeVersion, String>() {
@Override
public String apply(final RuntimeVersion p) {
return p.toString();
}
}).toArray(new String[] {}));
runtimeCombo.setText(model.getRequiredRuntimeVersion().asMajor().toString());
runtimeCombo.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(final SelectionEvent e) {
model.setRequiredRuntimeVersion(RuntimeVersion.Serializer.parse(runtimeCombo.getText()));
}
@Override
public void widgetDefaultSelected(final SelectionEvent e) {
}
});
}
new Label(composite, SWT.NONE);
new Label(composite, SWT.NONE);
{
final Label lblNewLabel = new Label(composite, SWT.NONE);
lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblNewLabel.setText("Output directory");
}
{
outputText = new Text(composite, SWT.BORDER);
outputText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
outputText.setEnabled(globalEnable);
outputText.setText(model.getOutputDir().toPortableString());
outputText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
model.setOutputDir(new Path(outputText.getText()));
}
});
}
{
final Label lblNewLabel = new Label(composite, SWT.NONE);
lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblNewLabel.setText("Source directories");
}
{
sourcesText = new Text(composite, SWT.BORDER);
sourcesText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
sourcesText.setEnabled(globalEnable);
sourcesText.setText(PathSerializer.packList(model.getSourceDirs()));
sourcesText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
model.setSourceDirs(PathSerializer.unpackList(sourcesText.getText()));
}
});
}
{
final Label lblNewLabel = new Label(composite, SWT.NONE);
lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblNewLabel.setText("Include directories");
}
{
includesText = new Text(composite, SWT.BORDER);
includesText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
includesText.setEnabled(globalEnable);
includesText.setText(PathSerializer.packList(model.getIncludeDirs()));
includesText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
model.setIncludeDirs(PathSerializer.unpackList(includesText.getText()));
}
});
}
{
final Label lblNewLabel = new Label(composite, SWT.NONE);
lblNewLabel.setEnabled(false);
lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblNewLabel.setText("Test directories");
}
{
testsText = new Text(composite, SWT.BORDER);
testsText.setEnabled(globalEnable && false);
testsText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
testsText.setText(PathSerializer.packList(model.getTestDirs()));
testsText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
model.setTestDirs(PathSerializer.unpackList(testsText.getText()));
}
});
}
new Label(composite, SWT.NONE);
new Label(composite, SWT.NONE);
{
final Label lblExternalModules = new Label(composite, SWT.NONE);
lblExternalModules.setVisible(true);
lblExternalModules.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblExternalModules.setText("External modules");
}
{
extModsText = new Text(composite, SWT.BORDER);
extModsText.setEditable(false);
extModsText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
extModsText.setEnabled(globalEnable && SystemConfiguration.getInstance().isDeveloper());
extModsText.setText(model.getExternalModulesFile());
}
{
final Label lblExternalIncludes = new Label(composite, SWT.NONE);
lblExternalIncludes.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblExternalIncludes.setText("External includes");
}
{
extIncsText = new Text(composite, SWT.BORDER);
extIncsText.setEditable(false);
extIncsText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
extIncsText.setEnabled(globalEnable && SystemConfiguration.getInstance().isDeveloper());
extIncsText.setText(model.getExternalIncludesFile());
}
return composite;
}
use of org.erlide.runtime.runtimeinfo.RuntimeVersion in project erlide_eclipse by erlang.
the class RuntimeVersionTest method compare_1a.
@Test
public void compare_1a() {
final RuntimeVersion test1 = RuntimeVersion.Serializer.parse("R13");
final RuntimeVersion test2 = RuntimeVersion.Serializer.parse("R12");
assertThat(test1.compareTo(test2)).isGreaterThan(0);
}
use of org.erlide.runtime.runtimeinfo.RuntimeVersion in project erlide_eclipse by erlang.
the class RuntimeVersionTest method toString_6b.
@Test
public void toString_6b() {
final String expect = "17.1.1_rc-1";
final RuntimeVersion test = RuntimeVersion.Serializer.parse(expect);
assertThat(test.toString()).isEqualTo(expect);
}
use of org.erlide.runtime.runtimeinfo.RuntimeVersion in project erlide_eclipse by erlang.
the class RuntimeVersionTest method compare_2a.
@Test
public void compare_2a() {
final RuntimeVersion test1 = RuntimeVersion.Serializer.parse("R13");
final RuntimeVersion test2 = RuntimeVersion.Serializer.parse("R13A");
assertThat(test1.compareTo(test2)).isLessThan(0);
}
Aggregations