Search in sources :

Example 1 with ClusterNetworkEditDialog

use of org.netxms.ui.eclipse.objectmanager.dialogs.ClusterNetworkEditDialog in project netxms by netxms.

the class ClusterNetworks method editNetwork.

/**
 * Edit currently selected network
 */
private void editNetwork() {
    IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
    if (selection.size() != 1)
        return;
    InetAddressEx n = (InetAddressEx) selection.getFirstElement();
    ClusterNetworkEditDialog dlg = new ClusterNetworkEditDialog(getShell(), n.getAddress(), n.maskFromBits());
    if (dlg.open() == Window.OK) {
        n.setAddress(dlg.getAddress());
        n.setMask(InetAddressEx.bitsInMask(dlg.getMask()));
        viewer.update(n, null);
        isModified = true;
    }
}
Also used : ClusterNetworkEditDialog(org.netxms.ui.eclipse.objectmanager.dialogs.ClusterNetworkEditDialog) InetAddressEx(org.netxms.base.InetAddressEx) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 2 with ClusterNetworkEditDialog

use of org.netxms.ui.eclipse.objectmanager.dialogs.ClusterNetworkEditDialog in project netxms by netxms.

the class ClusterNetworks method addNetwork.

/**
 * Add new cluster network
 */
private void addNetwork() {
    ClusterNetworkEditDialog dlg = new ClusterNetworkEditDialog(getShell(), null, null);
    if (dlg.open() == Window.OK) {
        InetAddressEx n = new InetAddressEx(dlg.getAddress(), dlg.getMask());
        networks.add(n);
        viewer.setInput(networks.toArray());
        viewer.setSelection(new StructuredSelection(n));
        isModified = true;
    }
}
Also used : ClusterNetworkEditDialog(org.netxms.ui.eclipse.objectmanager.dialogs.ClusterNetworkEditDialog) InetAddressEx(org.netxms.base.InetAddressEx) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Aggregations

IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 InetAddressEx (org.netxms.base.InetAddressEx)2 ClusterNetworkEditDialog (org.netxms.ui.eclipse.objectmanager.dialogs.ClusterNetworkEditDialog)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1