Search in sources :

Example 1 with EditColumnDialog

use of org.netxms.ui.eclipse.datacollection.dialogs.EditColumnDialog in project netxms by netxms.

the class TableColumns method editColumn.

/**
 * Edit selected threshold
 */
private void editColumn() {
    final IStructuredSelection selection = (IStructuredSelection) columnList.getSelection();
    if (selection.size() == 1) {
        final ColumnDefinition column = (ColumnDefinition) selection.getFirstElement();
        EditColumnDialog dlg = new EditColumnDialog(getShell(), column);
        if (dlg.open() == Window.OK) {
            columnList.update(column, null);
        }
    }
}
Also used : IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) EditColumnDialog(org.netxms.ui.eclipse.datacollection.dialogs.EditColumnDialog) ColumnDefinition(org.netxms.client.datacollection.ColumnDefinition)

Example 2 with EditColumnDialog

use of org.netxms.ui.eclipse.datacollection.dialogs.EditColumnDialog in project netxms by netxms.

the class TableColumns method addColumn.

/**
 * Add new threshold
 */
private void addColumn() {
    final InputDialog idlg = new InputDialog(getShell(), Messages.get().TableColumns_NewColumn, Messages.get().TableColumns_ColumnName, "", new // $NON-NLS-1$
    IInputValidator() {

        @Override
        public String isValid(String newText) {
            if (newText.trim().isEmpty())
                return Messages.get().TableColumns_WarningText;
            return null;
        }
    });
    if (idlg.open() == Window.OK) {
        final ColumnDefinition column = new ColumnDefinition(idlg.getValue(), idlg.getValue());
        final EditColumnDialog dlg = new EditColumnDialog(getShell(), column);
        if (dlg.open() == Window.OK) {
            columns.add(column);
            columnList.setInput(columns.toArray());
            columnList.setSelection(new StructuredSelection(column));
        }
    }
}
Also used : InputDialog(org.eclipse.jface.dialogs.InputDialog) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) EditColumnDialog(org.netxms.ui.eclipse.datacollection.dialogs.EditColumnDialog) ColumnDefinition(org.netxms.client.datacollection.ColumnDefinition)

Aggregations

IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 ColumnDefinition (org.netxms.client.datacollection.ColumnDefinition)2 EditColumnDialog (org.netxms.ui.eclipse.datacollection.dialogs.EditColumnDialog)2 InputDialog (org.eclipse.jface.dialogs.InputDialog)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1