use of org.eclipse.ui.internal.dialogs.PropertyDialog in project netxms by netxms.
the class PredefinedMap method showDCIImageProperties.
/**
* Show DCI Image properties
*/
private void showDCIImageProperties() {
updateObjectPositions();
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if ((selection.size() != 1) || !(selection.getFirstElement() instanceof NetworkMapDCIImage))
return;
NetworkMapDCIImage container = (NetworkMapDCIImage) selection.getFirstElement();
PropertyDialog dlg = PropertyDialog.createDialogOn(getSite().getShell(), null, container);
if (dlg != null) {
if (dlg.open() == PropertyDialog.OK)
saveMap();
}
}
use of org.eclipse.ui.internal.dialogs.PropertyDialog in project netxms by netxms.
the class PredefinedMap method addTextBoxToMap.
/**
* Add text box element
*/
private void addTextBoxToMap() {
NetworkMapTextBox textBox = new NetworkMapTextBox(mapPage.createElementId());
PropertyDialog dlg = PropertyDialog.createDialogOn(getSite().getShell(), null, textBox);
if (dlg.open() != Window.OK)
return;
mapPage.addElement(textBox);
saveMap();
}
use of org.eclipse.ui.internal.dialogs.PropertyDialog in project netxms by netxms.
the class PredefinedMap method addDCIContainerToMap.
/**
* Add DCI container to map
*/
private void addDCIContainerToMap() {
NetworkMapDCIContainer dciContainer = new NetworkMapDCIContainer(mapPage.createElementId());
// runn property page
PropertyDialog dlg = PropertyDialog.createDialogOn(getSite().getShell(), null, dciContainer);
if (dlg != null) {
if (dlg.open() == Window.OK) {
mapPage.addElement(dciContainer);
saveMap();
addDciToRequestList();
}
}
}
use of org.eclipse.ui.internal.dialogs.PropertyDialog in project netxms by netxms.
the class PredefinedGraphTree method editPredefinedGraph.
/**
* Edit predefined graph
*/
private void editPredefinedGraph() {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if (selection.size() != 1)
return;
GraphSettings settings = (GraphSettings) selection.getFirstElement();
PropertyDialog dlg = PropertyDialog.createDialogOn(getSite().getShell(), null, settings);
if (dlg != null) {
if (dlg.open() == Window.OK) {
final GraphSettings newSettings = settings;
try {
new ConsoleJob(Messages.get().PredefinedGraphTree_UpdateJobName, null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.saveGraph(newSettings, true);
runInUIThread(new Runnable() {
@Override
public void run() {
viewer.update(newSettings, null);
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get().PredefinedGraphTree_UpdateJobError;
}
}.start();
} catch (Exception e) {
// $NON-NLS-1$ //$NON-NLS-2$
MessageDialogHelper.openError(getSite().getShell(), "Internal Error", String.format("Unexpected exception: %s", e.getLocalizedMessage()));
}
}
}
}
use of org.eclipse.ui.internal.dialogs.PropertyDialog in project netxms by netxms.
the class TemplateGraphView method editTemplateGraph.
/**
* Edit template graph
*/
private void editTemplateGraph() {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if (selection.size() != 1)
return;
GraphSettings settings = (GraphSettings) selection.getFirstElement();
PropertyDialog dlg = PropertyDialog.createDialogOn(getSite().getShell(), null, settings);
final GraphSettings newSettings = settings;
if (dlg != null) {
if (dlg.open() == Window.OK) {
try {
new ConsoleJob("Update template graph", null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.saveGraph(newSettings, true);
}
@Override
protected String getErrorMessage() {
return "Cannot update predefined graph";
}
}.start();
} catch (Exception e) {
// $NON-NLS-1$ //$NON-NLS-2$
MessageDialogHelper.openError(getSite().getShell(), "Internal Error", String.format("Unexpected exception: %s", e.getLocalizedMessage()));
}
}
settings.setName(newSettings.getName());
settings.getAccessList().clear();
settings.getAccessList().addAll(newSettings.getAccessList());
viewer.update(settings, null);
}
}
Aggregations