Search in sources :

Example 1 with RuntimeVersion

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;
}
Also used : RuntimeVersion(org.erlide.runtime.runtimeinfo.RuntimeVersion)

Example 2 with RuntimeVersion

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;
}
Also used : Path(org.eclipse.core.runtime.Path) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) RuntimeVersion(org.erlide.runtime.runtimeinfo.RuntimeVersion) Combo(org.eclipse.swt.widgets.Combo) Text(org.eclipse.swt.widgets.Text) IProject(org.eclipse.core.resources.IProject) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ProjectConfigType(org.erlide.engine.model.root.ProjectConfigType) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 3 with RuntimeVersion

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);
}
Also used : RuntimeVersion(org.erlide.runtime.runtimeinfo.RuntimeVersion) Test(org.junit.Test)

Example 4 with RuntimeVersion

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);
}
Also used : RuntimeVersion(org.erlide.runtime.runtimeinfo.RuntimeVersion) Test(org.junit.Test)

Example 5 with RuntimeVersion

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);
}
Also used : RuntimeVersion(org.erlide.runtime.runtimeinfo.RuntimeVersion) Test(org.junit.Test)

Aggregations

RuntimeVersion (org.erlide.runtime.runtimeinfo.RuntimeVersion)33 Test (org.junit.Test)29 IProject (org.eclipse.core.resources.IProject)1 CoreException (org.eclipse.core.runtime.CoreException)1 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)1 Path (org.eclipse.core.runtime.Path)1 ILaunchConfigurationType (org.eclipse.debug.core.ILaunchConfigurationType)1 ILaunchConfigurationWorkingCopy (org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)1 ILaunchManager (org.eclipse.debug.core.ILaunchManager)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Combo (org.eclipse.swt.widgets.Combo)1 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1 Text (org.eclipse.swt.widgets.Text)1 Pair (org.eclipse.xtext.xbase.lib.Pair)1