Search in sources :

Example 1 with PropertyDialog

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);
    }
}
Also used : PropertyDialog(org.eclipse.ui.internal.dialogs.PropertyDialog) DashboardElementConfig(org.netxms.ui.eclipse.dashboard.widgets.internal.DashboardElementConfig) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) DashboardElement(org.netxms.client.dashboards.DashboardElement)

Example 2 with PropertyDialog

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();
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) DciSummaryTable(org.netxms.client.datacollection.DciSummaryTable) PropertyDialog(org.eclipse.ui.internal.dialogs.PropertyDialog) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ConsoleJob(org.netxms.ui.eclipse.jobs.ConsoleJob) DciSummaryTableDescriptor(org.netxms.client.datacollection.DciSummaryTableDescriptor) PartInitException(org.eclipse.ui.PartInitException)

Example 3 with PropertyDialog

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;
}
Also used : PropertyDialog(org.eclipse.ui.internal.dialogs.PropertyDialog) Composite(org.eclipse.swt.widgets.Composite) TreeViewer(org.eclipse.jface.viewers.TreeViewer) Iterator(java.util.Iterator) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) PropertyPageManager(org.eclipse.ui.internal.dialogs.PropertyPageManager)

Example 4 with 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);
        }
    }
}
Also used : PropertyDialog(org.eclipse.ui.internal.dialogs.PropertyDialog)

Example 5 with PropertyDialog

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();
}
Also used : PropertyDialog(org.eclipse.ui.internal.dialogs.PropertyDialog)

Aggregations

PropertyDialog (org.eclipse.ui.internal.dialogs.PropertyDialog)24 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)10 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)5 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)5 PartInitException (org.eclipse.ui.PartInitException)4 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)3 DashboardElementConfig (org.netxms.ui.eclipse.dashboard.widgets.internal.DashboardElementConfig)3 DciSummaryTable (org.netxms.client.datacollection.DciSummaryTable)2 DciSummaryTableDescriptor (org.netxms.client.datacollection.DciSummaryTableDescriptor)2 GraphSettings (org.netxms.client.datacollection.GraphSettings)2 NetworkMapDCIContainer (org.netxms.client.maps.elements.NetworkMapDCIContainer)2 NetworkMapDCIImage (org.netxms.client.maps.elements.NetworkMapDCIImage)2 NetworkMapTextBox (org.netxms.client.maps.elements.NetworkMapTextBox)2 AlarmCategoryEditor (org.netxms.ui.eclipse.alarmviewer.editors.AlarmCategoryEditor)2 PropertyEditor (com.centurylink.mdw.plugin.designer.properties.editor.PropertyEditor)1 ValueChangeListener (com.centurylink.mdw.plugin.designer.properties.editor.ValueChangeListener)1 ExtensionModulesUpdater (com.centurylink.mdw.plugin.project.assembly.ExtensionModulesUpdater)1 ProjectUpdater (com.centurylink.mdw.plugin.project.assembly.ProjectUpdater)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 HashMap (java.util.HashMap)1