Search in sources :

Example 11 with RuntimeInfo

use of org.erlide.runtime.runtimeinfo.RuntimeInfo in project erlide_eclipse by erlang.

the class RuntimePreferencePage method removeRuntimes.

public void removeRuntimes(final RuntimeInfo[] vms) {
    final IStructuredSelection prev = (IStructuredSelection) getSelection();
    if (runtimes.size() == 1) {
        setMessage("You can't delete the last runtime definition", IMessageProvider.INFORMATION);
        return;
    }
    for (final RuntimeInfo element : vms) {
        runtimes.remove(element);
    }
    fRuntimeList.refresh();
    final IStructuredSelection curr = (IStructuredSelection) getSelection();
    if (!curr.equals(prev)) {
        final List<RuntimeInfo> installs = getRuntimes();
        if (curr.size() == 0 && installs.size() == 1) {
            // pick a default VM automatically
            setSelection(new StructuredSelection(installs.get(0)));
        } else {
            fireSelectionChanged();
        }
    }
    selectSingle();
}
Also used : RuntimeInfo(org.erlide.runtime.runtimeinfo.RuntimeInfo) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 12 with RuntimeInfo

use of org.erlide.runtime.runtimeinfo.RuntimeInfo in project erlide_eclipse by erlang.

the class IErlProjectTest method getRuntimeInfo.

// RuntimeInfo getRuntimeInfo();
@Test
public void getRuntimeInfo() throws Exception {
    final IErlProject aProject = ErlModelTestBase.projects[0];
    final RuntimeInfo info = aProject.getRuntimeInfo();
    // final String expected = ResourcesPlugin.getWorkspace().getRoot()
    // .getLocation().toString();
    assertNotNull(info);
// The working dir might be relative to the project and can also be "."
// We need to convert it to a canonical absolute path in order to be
// able to compare it with a value.
// This is not very portable across OSs
}
Also used : IErlProject(org.erlide.engine.model.root.IErlProject) RuntimeInfo(org.erlide.runtime.runtimeinfo.RuntimeInfo) Test(org.junit.Test)

Example 13 with RuntimeInfo

use of org.erlide.runtime.runtimeinfo.RuntimeInfo in project erlide_eclipse by erlang.

the class BackendData method asLaunchConfiguration.

public ILaunchConfiguration asLaunchConfiguration() {
    final ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
    final ILaunchConfigurationType type = manager.getLaunchConfigurationType(IErlangLaunchDelegateConstants.CONFIGURATION_TYPE_INTERNAL);
    ILaunchConfigurationWorkingCopy workingCopy;
    try {
        final RuntimeInfo info = getRuntimeInfo();
        final String name = getNodeName();
        workingCopy = type.newInstance(null, name);
        if (info.getVersion().isReleaseCompatible(new RuntimeVersion(17))) {
            workingCopy.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, Charsets.UTF_8.name());
        } else {
            workingCopy.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, Charsets.ISO_8859_1.name());
        }
        workingCopy.setAttribute(DebugPlugin.ATTR_PROCESS_FACTORY_ID, "org.erlide.backend.ertsProcessFactory");
        workingCopy.setAttribute(ErlRuntimeAttributes.NODE_NAME, getNodeName());
        workingCopy.setAttribute(ErlRuntimeAttributes.RUNTIME_NAME, info.getName());
        workingCopy.setAttribute(ErlRuntimeAttributes.COOKIE, getCookie());
        // workingCopy.setAttribute(ErlLaunchAttributes.CONSOLE,
        // !options.contains(BackendOptions.NO_CONSOLE));
        workingCopy.setAttribute(ErlRuntimeAttributes.USE_LONG_NAME, hasLongName());
        workingCopy.setAttribute(ErlRuntimeAttributes.INTERNAL, isInternal());
        return workingCopy;
    } catch (final CoreException e) {
        ErlLogger.error(e);
        return null;
    }
}
Also used : RuntimeInfo(org.erlide.runtime.runtimeinfo.RuntimeInfo) CoreException(org.eclipse.core.runtime.CoreException) ILaunchConfigurationType(org.eclipse.debug.core.ILaunchConfigurationType) RuntimeVersion(org.erlide.runtime.runtimeinfo.RuntimeVersion) ILaunchManager(org.eclipse.debug.core.ILaunchManager) ILaunchConfigurationWorkingCopy(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)

Example 14 with RuntimeInfo

use of org.erlide.runtime.runtimeinfo.RuntimeInfo in project erlide_eclipse by erlang.

the class RuntimePreferencePage method editRuntime.

protected void editRuntime() {
    final IStructuredSelection selection = (IStructuredSelection) fRuntimeList.getSelection();
    final RuntimeInfo vm = (RuntimeInfo) selection.getFirstElement();
    if (vm == null) {
        return;
    }
    final AddRuntimeDialog dialog = new AddRuntimeDialog(this, getShell(), vm);
    dialog.setTitle(RuntimePreferenceMessages.edit_title);
    if (dialog.open() != Window.OK) {
        return;
    }
    removeRuntimes(new RuntimeInfo[] { vm });
    catalog.removeRuntime(vm.getName());
    fRuntimeList.refresh();
}
Also used : RuntimeInfo(org.erlide.runtime.runtimeinfo.RuntimeInfo) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 15 with RuntimeInfo

use of org.erlide.runtime.runtimeinfo.RuntimeInfo in project erlide_eclipse by erlang.

the class RuntimePreferencePage method sortByName.

/**
 * Sorts by VM name.
 */
protected void sortByName() {
    fRuntimeList.setComparator(new ViewerComparator() {

        @Override
        public int compare(final Viewer viewer, final Object e1, final Object e2) {
            if (e1 instanceof RuntimeInfo && e2 instanceof RuntimeInfo) {
                final RuntimeInfo left = (RuntimeInfo) e1;
                final RuntimeInfo right = (RuntimeInfo) e2;
                return left.getName().compareToIgnoreCase(right.getName());
            }
            return super.compare(viewer, e1, e2);
        }

        @Override
        public boolean isSorterProperty(final Object element, final String property) {
            return true;
        }
    });
    fSortColumn = 1;
}
Also used : RuntimeInfo(org.erlide.runtime.runtimeinfo.RuntimeInfo) ViewerComparator(org.eclipse.jface.viewers.ViewerComparator) CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer) Viewer(org.eclipse.jface.viewers.Viewer)

Aggregations

RuntimeInfo (org.erlide.runtime.runtimeinfo.RuntimeInfo)29 ArrayList (java.util.ArrayList)5 BackendData (org.erlide.backend.api.BackendData)5 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 IBackend (org.erlide.backend.api.IBackend)4 CheckboxTableViewer (org.eclipse.jface.viewers.CheckboxTableViewer)3 Composite (org.eclipse.swt.widgets.Composite)3 Label (org.eclipse.swt.widgets.Label)3 RuntimeInfoCatalogData (org.erlide.runtime.runtimeinfo.RuntimeInfoCatalogData)3 Viewer (org.eclipse.jface.viewers.Viewer)2 ViewerComparator (org.eclipse.jface.viewers.ViewerComparator)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Button (org.eclipse.swt.widgets.Button)2 Text (org.eclipse.swt.widgets.Text)2 List (java.util.List)1 IProject (org.eclipse.core.resources.IProject)1 CoreException (org.eclipse.core.runtime.CoreException)1