use of org.eclipse.ui.internal.dialogs.PropertyDialog in project netxms by netxms.
the class DashboardElements method editElement.
/**
* Edit selected element
*/
private void editElement() {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if (selection.size() != 1)
return;
DashboardElement element = (DashboardElement) selection.getFirstElement();
DashboardElementConfig config = (DashboardElementConfig) AdapterManager.getDefault().getAdapter(element, DashboardElementConfig.class);
if (config != null) {
try {
config.setLayout(DashboardElementLayout.createFromXml(element.getLayout()));
PropertyDialog dlg = PropertyDialog.createDialogOn(getShell(), null, config);
if (dlg.open() == Window.CANCEL)
// element creation cancelled
return;
element.setData(config.createXml());
element.setLayout(config.getLayout().createXml());
viewer.update(element, null);
} catch (Exception e) {
MessageDialogHelper.openError(getShell(), Messages.get().DashboardElements_InternalErrorTitle, Messages.get().DashboardElements_InternalErrorText + e.getMessage());
}
} else {
MessageDialogHelper.openError(getShell(), Messages.get().DashboardElements_InternalErrorTitle, Messages.get().DashboardElements_InternalErrorText2);
}
}
use of org.eclipse.ui.internal.dialogs.PropertyDialog in project netxms by netxms.
the class SummaryTableManager method editSummaryTable.
/**
* Edit existing dataset
*/
private void editSummaryTable() {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if (selection.size() != 1)
return;
final DciSummaryTableDescriptor d = (DciSummaryTableDescriptor) selection.getFirstElement();
new ConsoleJob(Messages.get().SummaryTableManager_ReadJobName, this, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
final DciSummaryTable t = session.getDciSummaryTable(d.getId());
runInUIThread(new Runnable() {
@Override
public void run() {
PropertyDialog dlg = PropertyDialog.createDialogOn(getSite().getShell(), null, t);
dlg.getShell().setText(Messages.get().SummaryTableManager_TitleEdit);
dlg.open();
d.updateFromTable(t);
viewer.update(d, null);
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get().SummaryTableManager_ReadJobError;
}
}.start();
}
use of org.eclipse.ui.internal.dialogs.PropertyDialog in project netxms by netxms.
the class RuleEditor method createDialogOn.
/**
* Create a new property dialog.
*
* @param shell the parent shell
* @param propertyPageId the property page id
* @param element the adaptable element
* @return the property dialog
*/
@SuppressWarnings("rawtypes")
private static PropertyDialog createDialogOn(Shell shell, final String propertyPageId, Object element, String name) {
PropertyPageManager pageManager = new PropertyPageManager();
// $NON-NLS-1$
String title = "";
if (element == null) {
return null;
}
// load pages for the selection
// fill the manager with contributions from the matching contributors
PropertyPageContributorManager.getManager().contribute(pageManager, element);
// testing if there are pages in the manager
Iterator pages = pageManager.getElements(PreferenceManager.PRE_ORDER).iterator();
if (!pages.hasNext()) {
MessageDialogHelper.openInformation(shell, WorkbenchMessages.get().PropertyDialog_messageTitle, NLS.bind(WorkbenchMessages.get().PropertyDialog_noPropertyMessage, name));
return null;
}
title = NLS.bind(WorkbenchMessages.get().PropertyDialog_propertyMessage, name);
PropertyDialog propertyDialog = new PropertyDialog(shell, pageManager, new StructuredSelection(element)) {
@Override
protected TreeViewer createTreeViewer(Composite parent) {
TreeViewer viewer = super.createTreeViewer(parent);
viewer.expandAll();
viewer.setAutoExpandLevel(TreeViewer.ALL_LEVELS);
return viewer;
}
};
if (propertyPageId != null) {
propertyDialog.setSelectedNode(propertyPageId);
}
propertyDialog.create();
propertyDialog.getShell().setText(title);
PlatformUI.getWorkbench().getHelpSystem().setHelp(propertyDialog.getShell(), IWorkbenchHelpContextIds.PROPERTY_DIALOG);
return propertyDialog;
}
use of org.eclipse.ui.internal.dialogs.PropertyDialog in project netxms by netxms.
the class RuleEditor method editRule.
/**
* Edit rule
*/
private void editRule(String pageId) {
PropertyDialog dlg = createDialogOn(editor.getSite().getShell(), pageId, this, Messages.get().RuleEditor_Rule + ruleNumber);
if (dlg != null) {
modified = false;
dlg.open();
if (modified) {
if (rule.isDisabled())
headerLabel.setText(rule.getComments() + Messages.get().RuleEditor_DisabledSuffix);
else
headerLabel.setText(rule.getComments());
updateBackground();
condition.replaceClientArea();
action.replaceClientArea();
editor.updateEditorAreaLayout();
editor.setModified(true);
}
}
}
use of org.eclipse.ui.internal.dialogs.PropertyDialog in project netxms by netxms.
the class PredefinedMap method showMapProperties.
/**
* Show properties dialog for map object
*/
private void showMapProperties() {
updateObjectPositions();
PropertyDialog dlg = PropertyDialog.createDialogOn(getSite().getShell(), null, mapObject);
dlg.open();
}
Aggregations