Search in sources :

Example 1 with EditInputFieldDialog

use of org.netxms.ui.eclipse.objecttools.dialogs.EditInputFieldDialog in project netxms by netxms.

the class InputFields method editField.

/**
 * Edit column
 */
private void editField() {
    IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
    if (selection.size() != 1)
        return;
    EditInputFieldDialog dlg = new EditInputFieldDialog(getShell(), false, (InputField) selection.getFirstElement());
    if (dlg.open() == Window.OK) {
        viewer.update(selection.getFirstElement(), null);
    }
}
Also used : IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) EditInputFieldDialog(org.netxms.ui.eclipse.objecttools.dialogs.EditInputFieldDialog)

Example 2 with EditInputFieldDialog

use of org.netxms.ui.eclipse.objecttools.dialogs.EditInputFieldDialog 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)

Aggregations

IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 EditInputFieldDialog (org.netxms.ui.eclipse.objecttools.dialogs.EditInputFieldDialog)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 InputField (org.netxms.client.objecttools.InputField)1