Search in sources :

Example 16 with RuntimeInfo

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

the class RuntimePreferencePage method sortByDirectory.

/**
 * Sorts by VM location.
 */
protected void sortByDirectory() {
    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.getOtpHome().compareToIgnoreCase(right.getOtpHome());
            }
            return super.compare(viewer, e1, e2);
        }

        @Override
        public boolean isSorterProperty(final Object element, final String property) {
            return true;
        }
    });
    fSortColumn = 2;
}
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)

Example 17 with RuntimeInfo

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

the class RuntimePreferencePage method performOk.

@Override
public boolean performOk() {
    if (defaultRuntime == null || defaultRuntime == RuntimeInfo.NO_RUNTIME_INFO) {
        defaultRuntime = (RuntimeInfo) fRuntimeList.getElementAt(0);
    }
    if (erlideRuntime == null) {
        erlideRuntime = defaultRuntime;
    }
    boolean restart = false;
    final RuntimeInfo oldDefault = catalog.getDefaultRuntime();
    if (oldDefault != RuntimeInfo.NO_RUNTIME_INFO && !defaultRuntime.equals(oldDefault)) {
        restart = RestartDialog.openQuestion(getShell());
    }
    catalog.setRuntimes(runtimes, defaultRuntime.getName(), erlideRuntime.getName());
    final RuntimeInfoPreferencesSerializer serializer = new RuntimeInfoPreferencesSerializer();
    serializer.store(new RuntimeInfoCatalogData(runtimes, defaultRuntime.getName(), erlideRuntime.getName()));
    // save column widths
    final IDialogSettings settings = ErlideUIPlugin.getDefault().getDialogSettings();
    saveColumnSettings(settings, RuntimePreferencePage.RUNTIMES_PREFERENCE_PAGE);
    if (restart) {
        new UIJob("restart") {

            @Override
            public IStatus runInUIThread(final IProgressMonitor monitor) {
                PlatformUI.getWorkbench().restart();
                return Status.OK_STATUS;
            }
        }.schedule(100);
    }
    return super.performOk();
}
Also used : RuntimeInfoPreferencesSerializer(org.erlide.backend.runtimeinfo.RuntimeInfoPreferencesSerializer) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IStatus(org.eclipse.core.runtime.IStatus) RuntimeInfo(org.erlide.runtime.runtimeinfo.RuntimeInfo) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) RuntimeInfoCatalogData(org.erlide.runtime.runtimeinfo.RuntimeInfoCatalogData) UIJob(org.eclipse.ui.progress.UIJob)

Example 18 with RuntimeInfo

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

the class RuntimePreferencePage method removeSelectedRuntimes.

protected void removeSelectedRuntimes() {
    final IStructuredSelection selection = (IStructuredSelection) fRuntimeList.getSelection();
    final RuntimeInfo[] vms = new RuntimeInfo[selection.size()];
    final Iterator<?> iter = selection.iterator();
    int i = 0;
    while (iter.hasNext()) {
        vms[i] = (RuntimeInfo) iter.next();
        i++;
    }
    removeRuntimes(vms);
}
Also used : RuntimeInfo(org.erlide.runtime.runtimeinfo.RuntimeInfo) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Point(org.eclipse.swt.graphics.Point)

Example 19 with RuntimeInfo

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

the class RuntimePreferencePage method checkValid.

void checkValid() {
    final RuntimeInfo def = getCheckedRuntime();
    if (def == null && !getRuntimes().isEmpty()) {
        setValid(false);
        setErrorMessage("Please select a default runtime.");
    } else {
        setValid(true);
        setErrorMessage(null);
    }
}
Also used : RuntimeInfo(org.erlide.runtime.runtimeinfo.RuntimeInfo)

Example 20 with RuntimeInfo

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

the class ErlProjectPropertyPage method createContents.

@Override
protected Control createContents(final Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new FillLayout(SWT.HORIZONTAL));
    final TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
    // /////////////////////////////////////
    final TabItem sourceTab = new TabItem(tabFolder, SWT.NONE);
    sourceTab.setText("Source");
    final Composite sourceComposite = new Composite(tabFolder, SWT.NONE);
    sourceComposite.setLayout(new FormLayout());
    sourceComposite.setBounds(0, 0, 443, 305);
    sourceTab.setControl(sourceComposite);
    Label lblSourceFoldersIn;
    FormData formData_2;
    {
        lblSourceFoldersIn = new Label(sourceComposite, SWT.NONE);
        {
            formData_2 = new FormData();
            formData_2.right = new FormAttachment(100);
            formData_2.left = new FormAttachment(0, 8);
            lblSourceFoldersIn.setLayoutData(formData_2);
        }
        lblSourceFoldersIn.setText("Source folders in the project:");
    }
    Button btnFolder;
    FormData formData_5;
    {
        btnFolder = new Button(sourceComposite, SWT.NONE);
        formData_2.bottom = new FormAttachment(btnFolder, -6);
        {
            formData_5 = new FormData();
            formData_5.right = new FormAttachment(100);
            formData_5.width = 84;
            btnFolder.setLayoutData(formData_5);
        }
        btnFolder.setText("Add folder...");
    }
    Button btnSource;
    {
        btnSource = new Button(sourceComposite, SWT.NONE);
        formData_5.bottom = new FormAttachment(btnSource, -6);
        btnSource.setEnabled(false);
        {
            final FormData formData = new FormData();
            formData.right = new FormAttachment(100);
            formData.top = new FormAttachment(0, 62);
            formData.width = 84;
            btnSource.setLayoutData(formData);
        }
        btnSource.setText("Link source...");
    }
    Button btnEdit;
    FormData formData_4;
    {
        btnEdit = new Button(sourceComposite, SWT.NONE);
        {
            formData_4 = new FormData();
            formData_4.right = new FormAttachment(100);
            formData_4.width = 84;
            btnEdit.setLayoutData(formData_4);
        }
        btnEdit.setText("Edit...");
    }
    Button btnRemove;
    {
        btnRemove = new Button(sourceComposite, SWT.NONE);
        formData_4.bottom = new FormAttachment(btnRemove, -6);
        {
            final FormData formData = new FormData();
            formData.right = new FormAttachment(100);
            formData.width = 84;
            formData.top = new FormAttachment(0, 134);
            btnRemove.setLayoutData(formData);
        }
        btnRemove.setText("Remove");
    }
    Button btnAllowOutputFolders;
    FormData formData_6;
    {
        btnAllowOutputFolders = new Button(sourceComposite, SWT.CHECK);
        {
            formData_6 = new FormData();
            formData_6.left = new FormAttachment(0, 10);
            btnAllowOutputFolders.setLayoutData(formData_6);
        }
        btnAllowOutputFolders.setText("Allow output folders for source folders");
    }
    Text output_text;
    FormData formData_3;
    {
        output_text = new Text(sourceComposite, SWT.BORDER);
        formData_6.bottom = new FormAttachment(output_text, -6);
        {
            formData_3 = new FormData();
            formData_3.left = new FormAttachment(0, 10);
            output_text.setLayoutData(formData_3);
        }
    }
    Button btnBrowse;
    {
        btnBrowse = new Button(sourceComposite, SWT.NONE);
        formData_3.right = new FormAttachment(btnBrowse, -6);
        formData_3.top = new FormAttachment(0, 268);
        {
            final FormData formData = new FormData();
            formData.right = new FormAttachment(100);
            formData.width = 84;
            formData.bottom = new FormAttachment(output_text, 0, SWT.BOTTOM);
            btnBrowse.setLayoutData(formData);
        }
        btnBrowse.setText("Browse...");
    }
    {
        final TreeViewer treeViewer = new TreeViewer(sourceComposite, SWT.BORDER);
        final Tree sources_tree = treeViewer.getTree();
        {
            final FormData formData = new FormData();
            formData.left = new FormAttachment(0, 10);
            formData.right = new FormAttachment(btnSource, -6);
            formData.top = new FormAttachment(lblSourceFoldersIn, 6);
            formData.bottom = new FormAttachment(btnAllowOutputFolders, -6);
            sources_tree.setLayoutData(formData);
        }
    }
    final Button btnWhenCleaningDelete = new Button(sourceComposite, SWT.CHECK);
    final FormData fd_btnWhenCleaningDelete = new FormData();
    fd_btnWhenCleaningDelete.top = new FormAttachment(output_text, 6);
    fd_btnWhenCleaningDelete.left = new FormAttachment(lblSourceFoldersIn, 0, SWT.LEFT);
    btnWhenCleaningDelete.setLayoutData(fd_btnWhenCleaningDelete);
    btnWhenCleaningDelete.setText("When cleaning, delete the whole output directory (faster)");
    sourceComposite.setTabList(new Control[] { btnFolder, btnSource, btnEdit, btnRemove, btnAllowOutputFolders, output_text, btnBrowse });
    final TabItem includeTab = new TabItem(tabFolder, SWT.NONE);
    includeTab.setText("Include");
    final Composite includeComposite = new Composite(tabFolder, SWT.NONE);
    includeComposite.setLayout(new FormLayout());
    includeComposite.setBounds(0, 0, 443, 305);
    includeTab.setControl(includeComposite);
    final Label lblFoldersWithInclude = new Label(includeComposite, SWT.NONE);
    {
        final FormData formData = new FormData();
        formData.right = new FormAttachment(100, -10);
        formData.top = new FormAttachment(0, 10);
        formData.left = new FormAttachment(0, 10);
        lblFoldersWithInclude.setLayoutData(formData);
    }
    lblFoldersWithInclude.setText("Folders with include files:");
    final Button btnAddFolder = new Button(includeComposite, SWT.NONE);
    {
        final FormData formData = new FormData();
        formData.top = new FormAttachment(lblFoldersWithInclude, 9);
        formData.right = new FormAttachment(lblFoldersWithInclude, 0, SWT.RIGHT);
        btnAddFolder.setLayoutData(formData);
    }
    btnAddFolder.setText("Add folder...");
    final Button btnEdit_1 = new Button(includeComposite, SWT.NONE);
    FormData formData_1;
    {
        formData_1 = new FormData();
        formData_1.right = new FormAttachment(lblFoldersWithInclude, 0, SWT.RIGHT);
        formData_1.width = 77;
        btnEdit_1.setLayoutData(formData_1);
    }
    btnEdit_1.setText("Edit...");
    final Button btnRemove_1 = new Button(includeComposite, SWT.NONE);
    formData_1.bottom = new FormAttachment(100, -216);
    {
        final FormData formData_7 = new FormData();
        formData_7.top = new FormAttachment(btnEdit_1, 7);
        formData_7.right = new FormAttachment(lblFoldersWithInclude, 0, SWT.RIGHT);
        formData_7.width = 77;
        btnRemove_1.setLayoutData(formData_7);
    }
    btnRemove_1.setText("Remove");
    {
        final ListViewer listViewer = new ListViewer(includeComposite, SWT.BORDER);
        final org.eclipse.swt.widgets.List includes_list = listViewer.getList();
        {
            final FormData formData = new FormData();
            formData.right = new FormAttachment(btnAddFolder, -6);
            formData.left = new FormAttachment(0, 10);
            formData.bottom = new FormAttachment(100, -10);
            formData.top = new FormAttachment(lblFoldersWithInclude, 6);
            includes_list.setLayoutData(formData);
        }
    }
    final TabItem projectsTab = new TabItem(tabFolder, SWT.NONE);
    projectsTab.setText("Projects");
    final Composite dependenciesComposite = new Composite(tabFolder, SWT.NONE);
    dependenciesComposite.setLayout(new FormLayout());
    projectsTab.setControl(dependenciesComposite);
    final Label lblProjectsOnThe = new Label(dependenciesComposite, SWT.NONE);
    {
        final FormData formData = new FormData();
        formData.right = new FormAttachment(100, -10);
        formData.top = new FormAttachment(0, 10);
        formData.left = new FormAttachment(0, 10);
        lblProjectsOnThe.setLayoutData(formData);
    }
    lblProjectsOnThe.setText("Required projects on the build path:");
    final Button button = new Button(dependenciesComposite, SWT.NONE);
    {
        final FormData formData = new FormData();
        formData.top = new FormAttachment(lblProjectsOnThe, 6);
        formData.right = new FormAttachment(lblProjectsOnThe, 0, SWT.RIGHT);
        button.setLayoutData(formData);
    }
    button.setText("New Button");
    final Button button_1 = new Button(dependenciesComposite, SWT.NONE);
    FormData formData_8;
    {
        formData_8 = new FormData();
        formData_8.right = new FormAttachment(lblProjectsOnThe, 0, SWT.RIGHT);
        button_1.setLayoutData(formData_8);
    }
    button_1.setText("New Button");
    final Button button_2 = new Button(dependenciesComposite, SWT.NONE);
    formData_8.bottom = new FormAttachment(button_2, -6);
    {
        final FormData formData = new FormData();
        formData.top = new FormAttachment(0, 110);
        formData.right = new FormAttachment(lblProjectsOnThe, 0, SWT.RIGHT);
        button_2.setLayoutData(formData);
    }
    button_2.setText("New Button");
    {
        final ListViewer listViewer = new ListViewer(dependenciesComposite, SWT.BORDER);
        final org.eclipse.swt.widgets.List projects_list = listViewer.getList();
        {
            final FormData formData = new FormData();
            formData.right = new FormAttachment(button, -6);
            formData.left = new FormAttachment(0, 10);
            formData.bottom = new FormAttachment(100, -6);
            formData.top = new FormAttachment(lblProjectsOnThe, 6);
            projects_list.setLayoutData(formData);
        }
    }
    final Collection<RuntimeInfo> rs = BackendCore.getRuntimeInfoCatalog().getRuntimes();
    final List<String[]> vv = new ArrayList<>();
    for (final RuntimeInfo ri : rs) {
        vv.add(new String[] { ri.getName(), ri.getName() });
    }
    @SuppressWarnings("unused") final String[][] values = vv.toArray(new String[][] {});
    final TabItem librariesTab = new TabItem(tabFolder, SWT.NONE);
    librariesTab.setText("Libraries");
    final Composite librariesComposite = new Composite(tabFolder, SWT.NONE);
    librariesComposite.setLayout(new FormLayout());
    librariesTab.setControl(librariesComposite);
    final Label lblExternalLibrariesRequired = new Label(librariesComposite, SWT.NONE);
    {
        final FormData formData = new FormData();
        formData.right = new FormAttachment(100, -10);
        formData.top = new FormAttachment(0, 10);
        formData.left = new FormAttachment(0, 10);
        lblExternalLibrariesRequired.setLayoutData(formData);
    }
    lblExternalLibrariesRequired.setText("External libraries required on build path:");
    final Button button_3 = new Button(librariesComposite, SWT.NONE);
    {
        final FormData formData = new FormData();
        formData.top = new FormAttachment(lblExternalLibrariesRequired, 6);
        formData.right = new FormAttachment(100, -10);
        button_3.setLayoutData(formData);
    }
    button_3.setText("New Button");
    final Button button_4 = new Button(librariesComposite, SWT.NONE);
    {
        final FormData formData = new FormData();
        formData.top = new FormAttachment(button_3, 6);
        formData.right = new FormAttachment(lblExternalLibrariesRequired, 0, SWT.RIGHT);
        button_4.setLayoutData(formData);
    }
    button_4.setText("New Button");
    final Button button_5 = new Button(librariesComposite, SWT.NONE);
    FormData formData_9;
    {
        formData_9 = new FormData();
        formData_9.right = new FormAttachment(lblExternalLibrariesRequired, 0, SWT.RIGHT);
        button_5.setLayoutData(formData_9);
    }
    button_5.setText("New Button");
    final Button button_6 = new Button(librariesComposite, SWT.NONE);
    formData_9.bottom = new FormAttachment(100, -226);
    {
        final FormData formData = new FormData();
        formData.top = new FormAttachment(button_5, 6);
        formData.right = new FormAttachment(lblExternalLibrariesRequired, 0, SWT.RIGHT);
        button_6.setLayoutData(formData);
    }
    button_6.setText("New Button");
    {
        final TreeViewer treeViewer = new TreeViewer(librariesComposite, SWT.BORDER);
        final Tree libraries_tree = treeViewer.getTree();
        {
            final FormData formData = new FormData();
            formData.right = new FormAttachment(button_3, -6);
            formData.left = new FormAttachment(0, 10);
            formData.top = new FormAttachment(lblExternalLibrariesRequired, 4);
            formData.bottom = new FormAttachment(100, -10);
            libraries_tree.setLayoutData(formData);
        }
    }
    final TabItem orderTab = new TabItem(tabFolder, SWT.NONE);
    orderTab.setText("Codepath order");
    final Composite codepathComposite = new Composite(tabFolder, SWT.NONE);
    codepathComposite.setLayout(new FormLayout());
    orderTab.setControl(codepathComposite);
    final Label lblOrderOfThe = new Label(codepathComposite, SWT.NONE);
    {
        final FormData formData = new FormData();
        formData.right = new FormAttachment(100, -10);
        formData.top = new FormAttachment(0, 10);
        formData.left = new FormAttachment(0, 10);
        lblOrderOfThe.setLayoutData(formData);
    }
    lblOrderOfThe.setText("Order of the dependencies on runtime code path:");
    final Button button_7 = new Button(codepathComposite, SWT.NONE);
    {
        final FormData formData = new FormData();
        formData.top = new FormAttachment(lblOrderOfThe, 6);
        formData.right = new FormAttachment(lblOrderOfThe, 0, SWT.RIGHT);
        button_7.setLayoutData(formData);
    }
    button_7.setText("New Button");
    final Button button_8 = new Button(codepathComposite, SWT.NONE);
    {
        final FormData formData = new FormData();
        formData.top = new FormAttachment(button_7, 6);
        formData.right = new FormAttachment(lblOrderOfThe, 0, SWT.RIGHT);
        button_8.setLayoutData(formData);
    }
    button_8.setText("New Button");
    {
        final ListViewer listViewer = new ListViewer(codepathComposite, SWT.BORDER);
        final org.eclipse.swt.widgets.List codepath_list = listViewer.getList();
        {
            final FormData formData = new FormData();
            formData.right = new FormAttachment(button_7, -6);
            formData.left = new FormAttachment(0, 10);
            formData.bottom = new FormAttachment(100, -10);
            formData.top = new FormAttachment(lblOrderOfThe, 6);
            codepath_list.setLayoutData(formData);
        }
    }
    final TabItem tbtmPreprocessor = new TabItem(tabFolder, SWT.NONE);
    tbtmPreprocessor.setText("Preprocessor");
    final Composite composite_1 = new Composite(tabFolder, SWT.NONE);
    composite_1.setLayout(new FormLayout());
    tbtmPreprocessor.setControl(composite_1);
    final Label lblMacrosDefinedFor = new Label(composite_1, SWT.NONE);
    {
        final FormData formData = new FormData();
        formData.top = new FormAttachment(0, 10);
        formData.left = new FormAttachment(0, 10);
        lblMacrosDefinedFor.setLayoutData(formData);
    }
    lblMacrosDefinedFor.setText("Macros defined for this project");
    final Button button_9 = new Button(composite_1, SWT.NONE);
    {
        final FormData formData_10 = new FormData();
        formData_10.top = new FormAttachment(0, 31);
        formData_10.right = new FormAttachment(100, -10);
        button_9.setLayoutData(formData_10);
    }
    button_9.setText("New Button");
    final Button button_10 = new Button(composite_1, SWT.NONE);
    FormData formData_12;
    {
        formData_12 = new FormData();
        formData_12.right = new FormAttachment(button_9, 0, SWT.RIGHT);
        button_10.setLayoutData(formData_12);
    }
    button_10.setText("New Button");
    final Button button_11 = new Button(composite_1, SWT.NONE);
    formData_12.bottom = new FormAttachment(100, -262);
    {
        final FormData formData_11 = new FormData();
        formData_11.top = new FormAttachment(button_10, 6);
        formData_11.right = new FormAttachment(button_9, 0, SWT.RIGHT);
        button_11.setLayoutData(formData_11);
    }
    button_11.setText("New Button");
    {
        final ListViewer listViewer = new ListViewer(composite_1, SWT.BORDER);
        final org.eclipse.swt.widgets.List macros_list = listViewer.getList();
        {
            final FormData formData = new FormData();
            formData.right = new FormAttachment(button_9, -6);
            formData.left = new FormAttachment(0, 10);
            formData.bottom = new FormAttachment(100, -10);
            formData.top = new FormAttachment(lblMacrosDefinedFor, 6);
            macros_list.setLayoutData(formData);
        }
    }
    return composite;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ListViewer(org.eclipse.jface.viewers.ListViewer) Composite(org.eclipse.swt.widgets.Composite) RuntimeInfo(org.erlide.runtime.runtimeinfo.RuntimeInfo) TreeViewer(org.eclipse.jface.viewers.TreeViewer) TabFolder(org.eclipse.swt.widgets.TabFolder) Label(org.eclipse.swt.widgets.Label) ArrayList(java.util.ArrayList) Text(org.eclipse.swt.widgets.Text) FillLayout(org.eclipse.swt.layout.FillLayout) TabItem(org.eclipse.swt.widgets.TabItem) Button(org.eclipse.swt.widgets.Button) Tree(org.eclipse.swt.widgets.Tree) ArrayList(java.util.ArrayList) List(java.util.List) FormAttachment(org.eclipse.swt.layout.FormAttachment)

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