Search in sources :

Example 6 with InputField

use of org.netxms.client.objecttools.InputField in project netxms by netxms.

the class InputFields method addField.

/**
 * Add new field
 */
private void addField() {
    // $NON-NLS-1$
    InputField f = new InputField("Field" + Integer.toString(fields.size() + 1));
    EditInputFieldDialog dlg = new EditInputFieldDialog(getShell(), true, f);
    if (dlg.open() == Window.OK) {
        if (nameIsUnique(f.getName())) {
            f.setSequence(fields.size());
            fields.add(f);
            viewer.setInput(fields.toArray());
            viewer.setSelection(new StructuredSelection(f));
        }
    }
}
Also used : InputField(org.netxms.client.objecttools.InputField) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) EditInputFieldDialog(org.netxms.ui.eclipse.objecttools.dialogs.EditInputFieldDialog)

Example 7 with InputField

use of org.netxms.client.objecttools.InputField in project netxms by netxms.

the class InputFields method removeField.

/**
 * Remove selected column(s)
 */
@SuppressWarnings("unchecked")
private void removeField() {
    IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
    Iterator<InputField> it = selection.iterator();
    while (it.hasNext()) {
        fields.remove(it.next());
    }
    viewer.setInput(fields.toArray());
}
Also used : InputField(org.netxms.client.objecttools.InputField) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Aggregations

InputField (org.netxms.client.objecttools.InputField)7 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)5 ArrayList (java.util.ArrayList)1 List (java.util.List)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)1 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 Viewer (org.eclipse.jface.viewers.Viewer)1 ViewerComparator (org.eclipse.jface.viewers.ViewerComparator)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 RowData (org.eclipse.swt.layout.RowData)1 RowLayout (org.eclipse.swt.layout.RowLayout)1