Search in sources :

Example 16 with RefreshAction

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

the class ImageLibrary method createActions.

/**
 * Create actions
 */
private void createActions() {
    actionNew = new Action(Messages.get().ImageLibrary_ActionUpload) {

        @Override
        public void run() {
            final ImagePropertiesDialog dialog = new ImagePropertiesDialog(getSite().getShell(), knownCategories, imageLibrary, false);
            final GalleryItem[] selection = gallery.getSelection();
            if (selection.length > 0) {
                LibraryImage image = (LibraryImage) selection[0].getData();
                dialog.setDefaultCategory(image.getCategory());
            }
            if (dialog.open() == Dialog.OK) {
                uploadNewImage(dialog.getName(), dialog.getCategory(), dialog.getFileName());
            }
        }
    };
    actionNew.setImageDescriptor(SharedIcons.ADD_OBJECT);
    actionEdit = new Action(Messages.get().ImageLibrary_ActionEdit) {

        @Override
        public void run() {
            final GalleryItem[] selection = gallery.getSelection();
            if (selection.length == 1) {
                final ImagePropertiesDialog dialog = new ImagePropertiesDialog(getSite().getShell(), knownCategories, imageLibrary, true);
                LibraryImage image = (LibraryImage) selection[0].getData();
                dialog.setName(image.getName());
                dialog.setDefaultCategory(image.getCategory());
                if (dialog.open() == Dialog.OK) {
                    editImage(selection[0], dialog.getName(), dialog.getCategory(), dialog.getFileName());
                }
            }
        }
    };
    actionEdit.setImageDescriptor(SharedIcons.EDIT);
    actionDelete = new Action(Messages.get().ImageLibrary_ActionDelete) {

        @Override
        public void run() {
            deleteImage();
        }
    };
    actionDelete.setImageDescriptor(SharedIcons.DELETE_OBJECT);
    actionRefresh = new RefreshAction(this) {

        @Override
        public void run() {
            try {
                refreshImages();
            } catch (Exception e) {
                // $NON-NLS-1$
                Activator.logError("ImageLibrary view: Exception in refresh action", e);
            }
        }
    };
    actionZoomIn = new Action(Messages.get().ImageLibrary_ActionZoomIn) {

        @Override
        public void run() {
            final DefaultGalleryGroupRenderer groupRenderer = (DefaultGalleryGroupRenderer) gallery.getGroupRenderer();
            if (currentIconSize < MAX_GRID_ICON_SIZE) {
                currentIconSize += 16;
                groupRenderer.setItemHeight(currentIconSize);
                groupRenderer.setItemWidth(currentIconSize);
            }
        }
    };
    actionZoomIn.setImageDescriptor(SharedIcons.ZOOM_IN);
    actionZoomOut = new Action(Messages.get().ImageLibrary_ActionZoomOut) {

        @Override
        public void run() {
            final DefaultGalleryGroupRenderer groupRenderer = (DefaultGalleryGroupRenderer) gallery.getGroupRenderer();
            if (currentIconSize > MIN_GRID_ICON_SIZE) {
                currentIconSize -= 16;
                groupRenderer.setItemHeight(currentIconSize);
                groupRenderer.setItemWidth(currentIconSize);
            }
        }
    };
    actionZoomOut.setImageDescriptor(SharedIcons.ZOOM_OUT);
}
Also used : RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) Action(org.eclipse.jface.action.Action) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) DefaultGalleryGroupRenderer(org.netxms.nebula.widgets.gallery.DefaultGalleryGroupRenderer) ImagePropertiesDialog(org.netxms.ui.eclipse.imagelibrary.dialogs.ImagePropertiesDialog) LibraryImage(org.netxms.client.LibraryImage) SWTException(org.eclipse.swt.SWTException) IOException(java.io.IOException) NXCException(org.netxms.client.NXCException)

Example 17 with RefreshAction

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

the class ScriptExecutor method createActions.

/**
 * Create actions
 */
private void createActions() {
    final IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
    actionSave = new Action(Messages.get().ScriptExecutor_Save, SharedIcons.SAVE) {

        @Override
        public void run() {
            intermediateSave(false);
        }
    };
    // $NON-NLS-1$
    actionSave.setActionDefinitionId("org.netxms.ui.eclipse.nxsl.commands.save");
    handlerService.activateHandler(actionSave.getActionDefinitionId(), new ActionHandler(actionSave));
    actionSaveAs = new Action(Messages.get().ScriptExecutor_SaveAs, SharedIcons.SAVE_AS) {

        @Override
        public void run() {
            createNewScript(false);
        }
    };
    // $NON-NLS-1$
    actionSaveAs.setActionDefinitionId("org.netxms.ui.eclipse.nxsl.commands.save_as");
    handlerService.activateHandler(actionSaveAs.getActionDefinitionId(), new ActionHandler(actionSaveAs));
    actionClear = new Action(Messages.get().ScriptExecutor_Clear, SharedIcons.CLEAR) {

        @Override
        public void run() {
            if (modified) {
                if (saveIfRequired(false))
                    return;
            }
            scriptCombo.deselectAll();
            scriptCombo.clearSelection();
            // $NON-NLS-1$
            scriptEditor.setText("");
            output.clear();
            form.setText(Messages.get().ScriptExecutor_Noname);
        }
    };
    actionClearOutput = new Action(Messages.get().ScriptExecutor_ClearOutput, SharedIcons.CLEAR_LOG) {

        @Override
        public void run() {
            output.clear();
        }
    };
    // $NON-NLS-1$
    actionClearOutput.setActionDefinitionId("org.netxms.ui.eclipse.nxsl.commands.clear_output");
    handlerService.activateHandler(actionClearOutput.getActionDefinitionId(), new ActionHandler(actionClearOutput));
    actionReload = new RefreshAction(this) {

        @Override
        public void run() {
            if (modified) {
                if (saveIfRequired(false))
                    return;
            }
            updateScriptList(null);
            getScriptContent();
            output.clear();
        }
    };
    actionReload.setText(Messages.get().ScriptExecutor_Reload);
    actionExecute = new Action(Messages.get().ScriptExecutor_Execute, SharedIcons.EXECUTE) {

        @Override
        public void run() {
            executeScript();
        }
    };
    // $NON-NLS-1$
    actionExecute.setActionDefinitionId("org.netxms.ui.eclipse.nxsl.commands.execute_script");
    handlerService.activateHandler(actionExecute.getActionDefinitionId(), new ActionHandler(actionExecute));
}
Also used : 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) ActionHandler(org.eclipse.jface.commands.ActionHandler)

Example 18 with RefreshAction

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

the class ScriptLibrary method createActions.

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

        @Override
        public void run() {
            refreshScriptList();
        }
    };
    actionNew = new // $NON-NLS-1$
    Action(// $NON-NLS-1$
    Messages.get().ScriptLibrary_New, // $NON-NLS-1$
    Activator.getImageDescriptor("icons/new.png")) {

        @Override
        public void run() {
            createNewScript();
        }
    };
    actionEdit = new // $NON-NLS-1$
    Action(// $NON-NLS-1$
    Messages.get().ScriptLibrary_Edit, // $NON-NLS-1$
    Activator.getImageDescriptor("icons/edit.png")) {

        @Override
        public void run() {
            editScript();
        }
    };
    actionEdit.setEnabled(false);
    actionRename = new Action(Messages.get().ScriptLibrary_Rename) {

        @Override
        public void run() {
            renameScript();
        }
    };
    actionRename.setEnabled(false);
    actionDelete = new // $NON-NLS-1$
    Action(// $NON-NLS-1$
    Messages.get().ScriptLibrary_Delete, // $NON-NLS-1$
    Activator.getImageDescriptor("icons/delete.png")) {

        @Override
        public void run() {
            deleteScript();
        }
    };
    actionDelete.setEnabled(false);
    actionCopyName = new Action("Copy name", SharedIcons.COPY) {

        @Override
        public void run() {
            copyNameToClipboard();
        }
    };
    actionCopyName.setActionDefinitionId("org.netxms.ui.eclipse.nxsl.commands.CopyNameToClipboard");
    handlerService.activateHandler(actionCopyName.getActionDefinitionId(), new ActionHandler(actionCopyName));
}
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.ui.commands.ActionHandler)

Example 19 with RefreshAction

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

the class HistoricalDataView method createActions.

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

        @Override
        public void run() {
            refreshData();
        }
    };
    actionSelectRange = new Action(Messages.get().HistoricalDataView_SelectDataRange) {

        @Override
        public void run() {
            selectRange();
        }
    };
    actionDeleteDciEntry = new Action("Delete entry") {

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

Example 20 with RefreshAction

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

the class PredefinedGraphTree method createActions.

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

        @Override
        public void run() {
            reloadGraphList();
        }
    };
    actionDelete = new Action(Messages.get().PredefinedGraphTree_Delete, SharedIcons.DELETE_OBJECT) {

        @Override
        public void run() {
            deletePredefinedGraph();
        }
    };
    actionOpen = new Action() {

        @SuppressWarnings("rawtypes")
        @Override
        public void run() {
            IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
            Iterator it = selection.iterator();
            while (it.hasNext()) {
                Object o = it.next();
                if (o instanceof GraphSettings) {
                    showPredefinedGraph((GraphSettings) o);
                }
            }
        }
    };
    actionOpen.setText(Messages.get().PredefinedGraphTree_Open);
    actionProperties = new Action(Messages.get().PredefinedGraphTree_Properties) {

        @Override
        public void run() {
            editPredefinedGraph();
        }
    };
    actionShowFilter = new Action(Messages.get().PredefinedGraphTree_ShowFilter, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            enableFilter(!initShowFilter);
            actionShowFilter.setChecked(initShowFilter);
        }
    };
    // $NON-NLS-1$
    actionShowFilter.setId("org.netxms.ui.eclipse.perfview.actions.showFilter");
    actionShowFilter.setChecked(initShowFilter);
    // $NON-NLS-1$
    actionShowFilter.setActionDefinitionId("org.netxms.ui.eclipse.perfview.commands.show_graph_filter");
    final ActionHandler showFilterHandler = new ActionHandler(actionShowFilter);
    handlerService.activateHandler(actionShowFilter.getActionDefinitionId(), showFilterHandler);
}
Also used : 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) GraphSettings(org.netxms.client.datacollection.GraphSettings) Iterator(java.util.Iterator) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ActionHandler(org.eclipse.jface.commands.ActionHandler)

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