Search in sources :

Example 46 with RefreshAction

use of org.netxms.ui.eclipse.actions.RefreshAction in project netxms by netxms.

the class BrowserView method createActions.

/**
 * Create actions
 */
private void createActions() {
    actionBack = new Action(Messages.get().BrowserView_Back, SharedIcons.NAV_BACKWARD) {

        @Override
        public void run() {
            browser.back();
        }
    };
    actionForward = new Action(Messages.get().BrowserView_Forward, SharedIcons.NAV_FORWARD) {

        @Override
        public void run() {
            browser.forward();
        }
    };
    actionStop = new // $NON-NLS-1$
    Action(// $NON-NLS-1$
    Messages.get().BrowserView_Stop, // $NON-NLS-1$
    Activator.getImageDescriptor("icons/stop.png")) {

        @Override
        public void run() {
            browser.stop();
        }
    };
    actionReload = new RefreshAction(this) {

        @Override
        public void run() {
            browser.refresh();
        }
    };
}
Also used : Action(org.eclipse.jface.action.Action) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction)

Example 47 with RefreshAction

use of org.netxms.ui.eclipse.actions.RefreshAction in project netxms by netxms.

the class ScreenshotView method createActions.

/**
 * Create actions
 */
private void createActions() {
    final IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
    actionRefresh = new RefreshAction(this) {

        @Override
        public void run() {
            refresh();
        }
    };
    actionSave = new Action(Messages.get().ScreenshotView_Save, SharedIcons.SAVE) {

        @Override
        public void run() {
            saveImage();
        }
    };
    // $NON-NLS-1$
    actionSave.setActionDefinitionId("org.netxms.ui.eclipse.agentmanager.commands.save_screenshot");
    handlerService.activateHandler(actionSave.getActionDefinitionId(), new ActionHandler(actionSave));
    actionSave.setEnabled(false);
}
Also used : Action(org.eclipse.jface.action.Action) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) IHandlerService(org.eclipse.ui.handlers.IHandlerService) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) ActionHandler(org.eclipse.jface.commands.ActionHandler)

Example 48 with RefreshAction

use of org.netxms.ui.eclipse.actions.RefreshAction in project netxms by netxms.

the class TableToolResults method createActions.

/**
 * Create actions
 */
private void createActions() {
    actionRefresh = new RefreshAction(this) {

        @Override
        public void run() {
            refreshTable();
        }
    };
    actionExportToCsv = new ExportToCsvAction(this, viewer, true);
    actionExportAllToCsv = new ExportToCsvAction(this, viewer, false);
}
Also used : RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) ExportToCsvAction(org.netxms.ui.eclipse.actions.ExportToCsvAction)

Example 49 with RefreshAction

use of org.netxms.ui.eclipse.actions.RefreshAction in project netxms by netxms.

the class ObjectToolsEditor method createActions.

/**
 * Create actions
 */
private void createActions() {
    final IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
    actionShowFilter = new Action("Show filter", Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            enableFilter(!initShowFilter);
            actionShowFilter.setChecked(initShowFilter);
        }
    };
    actionShowFilter.setChecked(initShowFilter);
    // $NON-NLS-1$
    actionShowFilter.setActionDefinitionId("org.netxms.ui.eclipse.objecttools.commands.showFilter");
    handlerService.activateHandler(actionShowFilter.getActionDefinitionId(), new ActionHandler(actionShowFilter));
    actionRefresh = new RefreshAction() {

        @Override
        public void run() {
            refreshToolList();
        }
    };
    actionNew = new Action(Messages.get().ObjectToolsEditor_New) {

        @Override
        public void run() {
            createTool();
        }
    };
    actionNew.setImageDescriptor(SharedIcons.ADD_OBJECT);
    actionEdit = new PropertyDialogAction(getSite(), viewer) {

        @Override
        public void run() {
            IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
            if (selection.size() != 1)
                return;
            final long toolId = ((ObjectTool) selection.getFirstElement()).getId();
            // If there will be error, adapter factory will show error message to user
            if (Platform.getAdapterManager().getAdapter(selection.getFirstElement(), ObjectToolDetails.class) == null)
                return;
            super.run();
            ObjectToolDetails details = ObjectToolsAdapterFactory.getDetailsFromCache(toolId);
            if ((details != null) && details.isModified()) {
                saveObjectTool(details);
            }
        }
    };
    actionEdit.setImageDescriptor(SharedIcons.EDIT);
    actionDelete = new Action(Messages.get().ObjectToolsEditor_Delete) {

        @Override
        public void run() {
            deleteTools();
        }
    };
    actionDelete.setImageDescriptor(SharedIcons.DELETE_OBJECT);
    actionDisable = new Action(Messages.get().ObjectToolsEditor_Disable) {

        @Override
        public void run() {
            setSelectedDisabled();
        }
    };
    actionEnable = new Action(Messages.get().ObjectToolsEditor_Enable) {

        @Override
        public void run() {
            setSelectedEnabled();
        }
    };
    actionClone = new Action(Messages.get().ObjectToolsEditor_Clone) {

        @Override
        public void run() {
            cloneTool();
        }
    };
}
Also used : PropertyDialogAction(org.eclipse.ui.dialogs.PropertyDialogAction) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) Action(org.eclipse.jface.action.Action) IHandlerService(org.eclipse.ui.handlers.IHandlerService) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ActionHandler(org.eclipse.jface.commands.ActionHandler) ObjectToolDetails(org.netxms.client.objecttools.ObjectToolDetails) PropertyDialogAction(org.eclipse.ui.dialogs.PropertyDialogAction)

Example 50 with RefreshAction

use of org.netxms.ui.eclipse.actions.RefreshAction in project netxms by netxms.

the class HistoricalGraphView method createActions.

/**
 * Create actions
 */
private void createActions() {
    actionRefresh = new RefreshAction(this) {

        @Override
        public void run() {
            updateChart();
        }
    };
    actionProperties = new Action(Messages.get().HistoricalGraphView_Properties) {

        @Override
        public void run() {
            PropertyDialog dlg = PropertyDialog.createDialogOn(getSite().getShell(), null, settings);
            if (dlg != null) {
                dlg.open();
                configureGraphFromSettings();
                refreshMenuSelection();
            }
        }
    };
    actionAutoRefresh = new Action(Messages.get().HistoricalGraphView_Autorefresh) {

        @Override
        public void run() {
            settings.setAutoRefresh(!settings.isAutoRefresh());
            setChecked(settings.isAutoRefresh());
            refreshController.setInterval(settings.isAutoRefresh() ? settings.getRefreshRate() : -1);
        }
    };
    actionAutoRefresh.setChecked(settings.isAutoRefresh());
    actionLogScale = new Action(Messages.get().HistoricalGraphView_LogScale) {

        @Override
        public void run() {
            try {
                chart.setLogScaleEnabled(!settings.isLogScale());
                settings.setLogScale(!settings.isLogScale());
            } catch (IllegalStateException e) {
                MessageDialogHelper.openError(getSite().getShell(), Messages.get().HistoricalGraphView_Error, String.format(Messages.get().HistoricalGraphView_LogScaleSwitchError, e.getLocalizedMessage()));
                // $NON-NLS-1$
                Activator.logError("Cannot change log scale mode", e);
            }
            setChecked(settings.isLogScale());
        }
    };
    actionLogScale.setChecked(settings.isLogScale());
    actionZoomIn = new Action(Messages.get().HistoricalGraphView_ZoomIn) {

        @Override
        public void run() {
            chart.zoomIn();
        }
    };
    actionZoomIn.setImageDescriptor(SharedIcons.ZOOM_IN);
    actionZoomOut = new Action(Messages.get().HistoricalGraphView_ZoomOut) {

        @Override
        public void run() {
            chart.zoomOut();
        }
    };
    actionZoomOut.setImageDescriptor(SharedIcons.ZOOM_OUT);
    actionAdjustX = createAction(ActionType.ADJUST_X, chart);
    actionAdjustY = createAction(ActionType.ADJUST_Y, chart);
    actionAdjustBoth = createAction(ActionType.ADJUST_BOTH, chart);
    actionShowLegend = new Action(Messages.get().HistoricalGraphView_ShowLegend) {

        @Override
        public void run() {
            settings.setShowLegend(actionShowLegend.isChecked());
            chart.setLegendVisible(settings.isShowLegend());
        }
    };
    actionShowLegend.setChecked(settings.isShowLegend());
    actionExtendedLegend = new Action(Messages.get().HistoricalGraphView_ExtendedLegend) {

        @Override
        public void run() {
            settings.setExtendedLegend(actionExtendedLegend.isChecked());
            chart.setExtendedLegend(settings.isExtendedLegend());
        }
    };
    actionExtendedLegend.setChecked(settings.isExtendedLegend());
    actionLegendLeft = new Action(Messages.get().HistoricalGraphView_PlaceOnLeft, Action.AS_RADIO_BUTTON) {

        @Override
        public void run() {
            settings.setLegendPosition(GraphSettings.POSITION_LEFT);
            chart.setLegendPosition(settings.getLegendPosition());
        }
    };
    actionLegendLeft.setChecked(settings.getLegendPosition() == GraphSettings.POSITION_LEFT);
    actionLegendRight = new Action(Messages.get().HistoricalGraphView_PlaceOnRight, Action.AS_RADIO_BUTTON) {

        @Override
        public void run() {
            settings.setLegendPosition(GraphSettings.POSITION_RIGHT);
            chart.setLegendPosition(settings.getLegendPosition());
        }
    };
    actionLegendRight.setChecked(settings.getLegendPosition() == GraphSettings.POSITION_RIGHT);
    actionLegendTop = new Action(Messages.get().HistoricalGraphView_PlaceOnTop, Action.AS_RADIO_BUTTON) {

        @Override
        public void run() {
            settings.setLegendPosition(GraphSettings.POSITION_TOP);
            chart.setLegendPosition(settings.getLegendPosition());
        }
    };
    actionLegendTop.setChecked(settings.getLegendPosition() == GraphSettings.POSITION_TOP);
    actionLegendBottom = new Action(Messages.get().HistoricalGraphView_PlaceOnBottom, Action.AS_RADIO_BUTTON) {

        @Override
        public void run() {
            settings.setLegendPosition(GraphSettings.POSITION_BOTTOM);
            chart.setLegendPosition(settings.getLegendPosition());
        }
    };
    actionLegendBottom.setChecked(settings.getLegendPosition() == GraphSettings.POSITION_BOTTOM);
    actionSave = new Action(Messages.get().HistoricalGraphView_Save, SharedIcons.SAVE) {

        @Override
        public void run() {
            String initalName = settings.getName().compareTo("noname") == 0 ? settings.getTitle() : settings.getName();
            saveGraph(initalName, null, false, false);
        }
    };
    // TODO: add check that graph uses only one node as source
    actionSaveAsTemplate = new Action("Save as template", SharedIcons.SAVE_AS) {

        @Override
        public void run() {
            String initalName = settings.getName().compareTo("noname") == 0 ? settings.getTitle() : settings.getName();
            saveGraph(initalName, null, false, true);
        }
    };
    actionStacked = new Action(Messages.get().HistoricalGraphView_Stacked, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            settings.setStacked(actionStacked.isChecked());
            configureGraphFromSettings();
        }
    };
    actionStacked.setChecked(settings.isStacked());
    actionTranslucent = new Action(Messages.get().HistoricalGraphView_Translucent, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            settings.setTranslucent(actionTranslucent.isChecked());
            configureGraphFromSettings();
        }
    };
    actionTranslucent.setChecked(settings.isTranslucent());
    actionAreaChart = new Action("Area chart", Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            settings.setArea(actionAreaChart.isChecked());
            configureGraphFromSettings();
        }
    };
    actionAreaChart.setChecked(settings.isArea());
    presetActions = createPresetActions(new PresetHandler() {

        @Override
        public void onPresetSelected(int units, int range) {
            settings.setTimeUnits(units);
            settings.setTimeRange(range);
            updateChart();
        }
    });
    actionSaveAsImage = new Action("Save as image", SharedIcons.SAVE_AS_IMAGE) {

        @Override
        public void run() {
            chart.saveAsImage();
        }
    };
}
Also used : RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) Action(org.eclipse.jface.action.Action) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) PropertyDialog(org.eclipse.ui.internal.dialogs.PropertyDialog)

Aggregations

RefreshAction (org.netxms.ui.eclipse.actions.RefreshAction)55 Action (org.eclipse.jface.action.Action)44 IHandlerService (org.eclipse.ui.handlers.IHandlerService)25 ActionHandler (org.eclipse.jface.commands.ActionHandler)23 ExportToCsvAction (org.netxms.ui.eclipse.actions.ExportToCsvAction)17 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 ActionHandler (org.eclipse.ui.commands.ActionHandler)2 PropertyDialogAction (org.eclipse.ui.dialogs.PropertyDialogAction)2 IOException (java.io.IOException)1 Iterator (java.util.Iterator)1 Point (org.eclipse.draw2d.geometry.Point)1 IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 SWTException (org.eclipse.swt.SWTException)1 PropertyDialog (org.eclipse.ui.internal.dialogs.PropertyDialog)1 LibraryImage (org.netxms.client.LibraryImage)1 NXCException (org.netxms.client.NXCException)1 ServerAction (org.netxms.client.ServerAction)1 GraphSettings (org.netxms.client.datacollection.GraphSettings)1 MapLayoutAlgorithm (org.netxms.client.maps.MapLayoutAlgorithm)1