use of org.netxms.ui.eclipse.jobs.ConsoleJob in project netxms by netxms.
the class WorldMap method placeObject.
/**
* Place object on map at mouse position
*/
private void placeObject() {
final ObjectSelectionDialog dlg = new ObjectSelectionDialog(getSite().getShell(), null, ObjectSelectionDialog.createNodeSelectionFilter(true));
if (dlg.open() == Window.OK) {
final NXCObjectModificationData md = new NXCObjectModificationData(dlg.getSelectedObjects().get(0).getObjectId());
md.setGeolocation(map.getLocationAtPoint(map.getCurrentPoint()));
final NXCSession session = ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().WorldMap_JobTitle, this, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyObject(md);
}
@Override
protected String getErrorMessage() {
return Messages.get().WorldMap_JobError;
}
}.start();
}
}
use of org.netxms.ui.eclipse.jobs.ConsoleJob in project netxms by netxms.
the class GeoLocationHistoryViewer method updateHistory.
/**
* Updates points for historical view
*/
private void updateHistory() {
final NXCSession session = ConsoleSharedData.getSession();
ConsoleJob job = new ConsoleJob(Messages.get().GeoMapViewer_DownloadJob_Title, viewPart, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
final List<GeoLocation> pl = session.getLocationHistory(historyObject.getObjectId(), timePeriod.getPeriodStart(), timePeriod.getPeriodEnd());
runInUIThread(new Runnable() {
@Override
public void run() {
points = pl;
locationTree.removeAll();
for (int i = 0; i < points.size(); i++) locationTree.insert(points.get(i).getLatitude(), points.get(i).getLongitude(), points.get(i));
redraw();
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get().GeoMapViewer_DownloadError;
}
};
job.setUser(false);
job.start();
}
use of org.netxms.ui.eclipse.jobs.ConsoleJob in project netxms by netxms.
the class AbstractGeoMapViewer method loadMissingTiles.
/**
* Load missing tiles in tile set
*
* @param tiles
*/
private void loadMissingTiles(final TileSet tiles) {
ConsoleJob job = new ConsoleJob(Messages.get().GeoMapViewer_LoadMissingJob_Title, viewPart, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
mapLoader.loadMissingTiles(tiles, new Runnable() {
@Override
public void run() {
if (!AbstractGeoMapViewer.this.isDisposed() && (currentTileSet == tiles)) {
AbstractGeoMapViewer.this.redraw();
}
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get().GeoMapViewer_DownloadError;
}
};
job.setUser(false);
job.start();
}
use of org.netxms.ui.eclipse.jobs.ConsoleJob in project netxms by netxms.
the class CreateRack method run.
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
@Override
public void run(IAction action) {
final CreateObjectDialog dlg = new CreateObjectDialog(window.getShell(), Messages.get().CreateRack_Rack);
if (dlg.open() != Window.OK)
return;
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().CreateRack_JobTitle, part, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
NXCObjectCreationData cd = new NXCObjectCreationData(AbstractObject.OBJECT_RACK, dlg.getObjectName(), parentId);
cd.setHeight(42);
session.createObject(cd);
}
@Override
protected String getErrorMessage() {
return String.format(Messages.get().CreateRack_JobError, dlg.getObjectName());
}
}.start();
}
use of org.netxms.ui.eclipse.jobs.ConsoleJob in project netxms by netxms.
the class CreateVpnConnector method run.
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
@Override
public void run(IAction action) {
final CreateObjectDialog dlg = new CreateObjectDialog(window.getShell(), Messages.get().CreateVpnConnector_ObjectType);
if (dlg.open() != Window.OK)
return;
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().CreateVpnConnector_JobName, part, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
NXCObjectCreationData cd = new NXCObjectCreationData(AbstractObject.OBJECT_VPNCONNECTOR, dlg.getObjectName(), parentId);
session.createObject(cd);
}
@Override
protected String getErrorMessage() {
return String.format(Messages.get().CreateVpnConnector_JobError, dlg.getObjectName());
}
}.start();
}
Aggregations