use of org.netxms.ui.eclipse.agentmanager.dialogs.SaveStoredConfigDialog in project netxms by netxms.
the class ServerStoredAgentConfigEditorView method onSelectionChange.
/**
* @param event
*/
private void onSelectionChange(SelectionChangedEvent event) {
if (reselection) {
reselection = false;
return;
}
if (modified) {
SaveStoredConfigDialog dlg = new SaveStoredConfigDialog(getSite().getShell());
int rc = dlg.open();
if (rc == SaveStoredConfigDialog.SAVE_ID) {
intermediateSave();
modified = false;
firePropertyChange(PROP_DIRTY);
actionSave.setEnabled(false);
return;
}
if (rc == SaveStoredConfigDialog.CANCEL) {
reselection = true;
configList.setSelection(previousSelection);
return;
}
}
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
previousSelection = selection;
if (selection == null)
return;
final ConfigListElement element = (ConfigListElement) selection.getFirstElement();
new ConsoleJob(Messages.get().ServerStoredAgentConfigEditorView_JobTitle_GetContent, this, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
if (element != null) {
content = session.getConfigContent(element.getId());
runInUIThread(new Runnable() {
@Override
public void run() {
updateContent();
}
});
}
}
@Override
protected String getErrorMessage() {
return Messages.get().ServerStoredAgentConfigEditorView_JobError_GetContent;
}
}.start();
}
use of org.netxms.ui.eclipse.agentmanager.dialogs.SaveStoredConfigDialog in project netxms by netxms.
the class ServerStoredAgentConfigEditorView method promptToSaveOnClose.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.ISaveablePart2#promptToSaveOnClose()
*/
@Override
public int promptToSaveOnClose() {
SaveStoredConfigDialog dlg = new SaveStoredConfigDialog(getSite().getShell());
int rc = dlg.open();
modified = (rc != SaveStoredConfigDialog.SAVE_ID);
return (rc == IDialogConstants.CANCEL_ID) ? CANCEL : ((rc == SaveConfigDialog.DISCARD_ID) ? NO : YES);
}
Aggregations