use of org.netxms.client.ObjectUrl in project netxms by netxms.
the class ExternalResources method editUrl.
/**
* Edit selected URL
*/
private void editUrl() {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if (selection.size() != 1)
return;
ObjectUrl url = (ObjectUrl) selection.getFirstElement();
ObjectUrlEditDialog dlg = new ObjectUrlEditDialog(getShell(), url.getUrl(), url.getDescription());
if (dlg.open() != Window.OK)
return;
int index = urls.indexOf(url);
urls.set(index, new ObjectUrl(url.getId(), dlg.getUrl(), dlg.getDescription()));
viewer.refresh();
viewer.setSelection(new StructuredSelection(urls.get(index)));
modified = true;
}
use of org.netxms.client.ObjectUrl in project netxms by netxms.
the class ExternalResources method deleteUrl.
/**
* Delete selected URLs
*/
private void deleteUrl() {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if (selection.isEmpty())
return;
for (Object o : selection.toList()) urls.remove(o);
for (int i = 0; i < urls.size(); i++) {
ObjectUrl u = urls.get(i);
urls.set(i, new ObjectUrl(i, u.getUrl(), u.getDescription()));
}
viewer.refresh();
modified = true;
}
use of org.netxms.client.ObjectUrl in project netxms by netxms.
the class ExternalResources method applyChanges.
/**
* Apply changes
*
* @param isApply true if update operation caused by "Apply" button
*/
protected void applyChanges(final boolean isApply) {
if (!modified)
// Nothing to apply
return;
if (isApply)
setValid(false);
final NXCObjectModificationData md = new NXCObjectModificationData(object.getObjectId());
md.setUrls(new ArrayList<ObjectUrl>(urls));
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().CustomAttributes_JobName, null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
modified = false;
}
@Override
protected String getErrorMessage() {
return "Cannot update object's URL list";
}
@Override
protected void jobFinalize() {
if (isApply) {
runInUIThread(new Runnable() {
@Override
public void run() {
ExternalResources.this.setValid(true);
}
});
}
}
}.start();
}
Aggregations