Search in sources :

Example 6 with PropertyDialog

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();
    }
}
Also used : PropertyDialog(org.eclipse.ui.internal.dialogs.PropertyDialog) NetworkMapDCIImage(org.netxms.client.maps.elements.NetworkMapDCIImage) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 7 with PropertyDialog

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

Example 8 with PropertyDialog

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

Example 9 with PropertyDialog

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

Example 10 with PropertyDialog

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

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