Search in sources :

Example 1 with EditClusterResourceDialog

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

the class ClusterResources method editResource.

/**
 * Edit currently selected resource
 */
private void editResource() {
    IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
    if (selection.size() != 1)
        return;
    ClusterResource r = (ClusterResource) selection.getFirstElement();
    EditClusterResourceDialog dlg = new EditClusterResourceDialog(getShell(), r);
    if (dlg.open() == Window.OK) {
        r.setName(dlg.getName());
        r.setVirtualAddress(dlg.getAddress());
        viewer.update(r, null);
        isModified = true;
    }
}
Also used : EditClusterResourceDialog(org.netxms.ui.eclipse.objectmanager.dialogs.EditClusterResourceDialog) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ClusterResource(org.netxms.client.objects.ClusterResource)

Example 2 with EditClusterResourceDialog

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

the class ClusterResources method addResource.

/**
 * Add new cluster resource
 */
private void addResource() {
    EditClusterResourceDialog dlg = new EditClusterResourceDialog(getShell(), null);
    if (dlg.open() == Window.OK) {
        // Find free resource ID
        long id = 1;
        for (ClusterResource r : resources) {
            if (r.getId() >= id)
                id = r.getId() + 1;
        }
        ClusterResource r = new ClusterResource(id, dlg.getName(), dlg.getAddress());
        resources.add(r);
        viewer.setInput(resources.toArray());
        viewer.setSelection(new StructuredSelection(r));
        isModified = true;
    }
}
Also used : EditClusterResourceDialog(org.netxms.ui.eclipse.objectmanager.dialogs.EditClusterResourceDialog) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ClusterResource(org.netxms.client.objects.ClusterResource)

Aggregations

IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 ClusterResource (org.netxms.client.objects.ClusterResource)2 EditClusterResourceDialog (org.netxms.ui.eclipse.objectmanager.dialogs.EditClusterResourceDialog)2 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1