Search in sources :

Example 76 with IHandlerService

use of org.eclipse.ui.handlers.IHandlerService in project netxms by netxms.

the class AbstractNetworkMapView method createActions.

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

        @Override
        public void run() {
            refreshMap();
        }
    };
    actionShowLinkDirection = new Action("Show link direction", Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            labelProvider.setShowLinkDirection(!labelProvider.isShowLinkDirection());
            setChecked(labelProvider.isShowLinkDirection());
            updateObjectPositions();
            saveLayout();
            viewer.refresh();
        }
    };
    actionShowLinkDirection.setChecked(labelProvider.isShowLinkDirection());
    actionShowStatusBackground = new Action(Messages.get().AbstractNetworkMapView_ShowStatusBkgnd, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            labelProvider.setShowStatusBackground(!labelProvider.isShowStatusBackground());
            setChecked(labelProvider.isShowStatusBackground());
            updateObjectPositions();
            saveLayout();
            viewer.refresh();
        }
    };
    actionShowStatusBackground.setChecked(labelProvider.isShowStatusBackground());
    actionShowStatusBackground.setEnabled(labelProvider.getObjectFigureType() == MapObjectDisplayMode.ICON);
    actionShowStatusIcon = new Action(Messages.get().AbstractNetworkMapView_ShowStatusIcon, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            labelProvider.setShowStatusIcons(!labelProvider.isShowStatusIcons());
            setChecked(labelProvider.isShowStatusIcons());
            updateObjectPositions();
            saveLayout();
            viewer.refresh();
        }
    };
    actionShowStatusIcon.setChecked(labelProvider.isShowStatusIcons());
    actionShowStatusIcon.setEnabled(labelProvider.getObjectFigureType() == MapObjectDisplayMode.ICON);
    actionShowStatusFrame = new Action(Messages.get().AbstractNetworkMapView_ShowStatusFrame, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            labelProvider.setShowStatusFrame(!labelProvider.isShowStatusFrame());
            setChecked(labelProvider.isShowStatusFrame());
            updateObjectPositions();
            saveLayout();
            viewer.refresh();
        }
    };
    actionShowStatusFrame.setChecked(labelProvider.isShowStatusFrame());
    actionShowStatusFrame.setEnabled(labelProvider.getObjectFigureType() == MapObjectDisplayMode.ICON);
    actionZoomIn = new Action(Messages.get().AbstractNetworkMapView_ZoomIn, SharedIcons.ZOOM_IN) {

        @Override
        public void run() {
            viewer.zoomIn();
        }
    };
    // $NON-NLS-1$
    actionZoomIn.setId("org.netxms.ui.eclipse.networkmaps.localActions.AbstractMap.ZoomIn");
    // $NON-NLS-1$
    actionZoomIn.setActionDefinitionId("org.netxms.ui.eclipse.networkmaps.localCommands.AbstractMap.ZoomIn");
    handlerService.activateHandler(actionZoomIn.getActionDefinitionId(), new ActionHandler(actionZoomIn));
    actionZoomOut = new Action(Messages.get().AbstractNetworkMapView_ZoomOut, SharedIcons.ZOOM_OUT) {

        @Override
        public void run() {
            viewer.zoomOut();
        }
    };
    // $NON-NLS-1$
    actionZoomOut.setId("org.netxms.ui.eclipse.networkmaps.localActions.AbstractMap.ZoomOut");
    // $NON-NLS-1$
    actionZoomOut.setActionDefinitionId("org.netxms.ui.eclipse.networkmaps.localCommands.AbstractMap.ZoomOut");
    handlerService.activateHandler(actionZoomOut.getActionDefinitionId(), new ActionHandler(actionZoomOut));
    actionZoomFit = new // $NON-NLS-1$
    Action(// $NON-NLS-1$
    Messages.get().AbstractNetworkMapView_ZoomFit, // $NON-NLS-1$
    Activator.getImageDescriptor("icons/fit.png")) {

        @Override
        public void run() {
            viewer.zoomFit();
        }
    };
    // $NON-NLS-1$
    actionZoomFit.setId("org.netxms.ui.eclipse.networkmaps.localActions.AbstractMap.ZoomToFit");
    // $NON-NLS-1$
    actionZoomFit.setActionDefinitionId("org.netxms.ui.eclipse.networkmaps.localCommands.AbstractMap.ZoomToFit");
    handlerService.activateHandler(actionZoomFit.getActionDefinitionId(), new ActionHandler(actionZoomFit));
    actionZoomTo = viewer.createZoomActions(handlerService);
    actionSetAlgorithm = new Action[layoutAlgorithmNames.length];
    for (int i = 0; i < layoutAlgorithmNames.length; i++) {
        final MapLayoutAlgorithm alg = MapLayoutAlgorithm.getByValue(i);
        actionSetAlgorithm[i] = new Action(layoutAlgorithmNames[i], Action.AS_RADIO_BUTTON) {

            @Override
            public void run() {
                setLayoutAlgorithm(alg, true);
                viewer.setInput(mapPage);
            }
        };
        actionSetAlgorithm[i].setChecked(layoutAlgorithm.getValue() == i);
        actionSetAlgorithm[i].setEnabled(automaticLayoutEnabled);
    }
    actionAlwaysFitLayout = new Action(Messages.get().AbstractNetworkMapView_AlwaysFitLayout, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            alwaysFitLayout = actionAlwaysFitLayout.isChecked();
            setLayoutAlgorithm(layoutAlgorithm, true);
            IDialogSettings settings = Activator.getDefault().getDialogSettings();
            // $NON-NLS-1$
            settings.put(viewId + ".alwaysFitLayout", alwaysFitLayout);
        }
    };
    actionAlwaysFitLayout.setChecked(alwaysFitLayout);
    actionSetRouter = new Action[connectionRouterNames.length];
    for (int i = 0; i < connectionRouterNames.length; i++) {
        final int alg = i + 1;
        actionSetRouter[i] = new Action(connectionRouterNames[i], Action.AS_RADIO_BUTTON) {

            @Override
            public void run() {
                setConnectionRouter(alg, true);
            }
        };
        actionSetRouter[i].setChecked(routingAlgorithm == alg);
    }
    actionEnableAutomaticLayout = new Action(Messages.get().AbstractNetworkMapView_EnableAutoLayout, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            if (automaticLayoutEnabled) {
                setManualLayout();
            } else {
                setAutomaticLayout();
            }
            setChecked(automaticLayoutEnabled);
        }
    };
    actionEnableAutomaticLayout.setChecked(automaticLayoutEnabled);
    actionSaveLayout = new Action(Messages.get().AbstractNetworkMapView_SaveLayout) {

        @Override
        public void run() {
            updateObjectPositions();
            saveLayout();
        }
    };
    actionSaveLayout.setImageDescriptor(SharedIcons.SAVE);
    actionSaveLayout.setEnabled(!automaticLayoutEnabled);
    actionOpenDrillDownObject = new Action("Open drill-down object") {

        @Override
        public void run() {
            openDrillDownObject();
        }
    };
    actionOpenDrillDownObject.setEnabled(false);
    actionFiguresIcons = new Action(Messages.get().AbstractNetworkMapView_Icons, Action.AS_RADIO_BUTTON) {

        @Override
        public void run() {
            setObjectDisplayMode(MapObjectDisplayMode.ICON, true);
        }
    };
    actionFiguresSmallLabels = new Action(Messages.get().AbstractNetworkMapView_SmallLabels, Action.AS_RADIO_BUTTON) {

        @Override
        public void run() {
            setObjectDisplayMode(MapObjectDisplayMode.SMALL_LABEL, true);
        }
    };
    actionFiguresLargeLabels = new Action(Messages.get().AbstractNetworkMapView_LargeLabels, Action.AS_RADIO_BUTTON) {

        @Override
        public void run() {
            setObjectDisplayMode(MapObjectDisplayMode.LARGE_LABEL, true);
        }
    };
    actionFiguresStatusIcons = new Action(Messages.get().AbstractNetworkMapView_StatusIcons, Action.AS_RADIO_BUTTON) {

        @Override
        public void run() {
            setObjectDisplayMode(MapObjectDisplayMode.STATUS, true);
        }
    };
    actionFiguresFloorPlan = new Action("Floor plan", Action.AS_RADIO_BUTTON) {

        @Override
        public void run() {
            setObjectDisplayMode(MapObjectDisplayMode.FLOOR_PLAN, true);
        }
    };
    actionShowGrid = new Action(Messages.get().AbstractNetworkMapView_ShowGrid, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            viewer.showGrid(actionShowGrid.isChecked());
        }
    };
    // $NON-NLS-1$
    actionShowGrid.setImageDescriptor(Activator.getImageDescriptor("icons/grid.png"));
    actionShowGrid.setChecked(viewer.isGridVisible());
    // $NON-NLS-1$
    actionShowGrid.setId("org.netxms.ui.eclipse.networkmaps.localActions.AbstractMap.ShowGrid");
    // $NON-NLS-1$
    actionShowGrid.setActionDefinitionId("org.netxms.ui.eclipse.networkmaps.localCommands.AbstractMap.ShowGrid");
    handlerService.activateHandler(actionShowGrid.getActionDefinitionId(), new ActionHandler(actionShowGrid));
    actionSnapToGrid = new Action(Messages.get().AbstractNetworkMapView_SnapToGrid, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            viewer.setSnapToGrid(actionSnapToGrid.isChecked());
        }
    };
    // $NON-NLS-1$
    actionSnapToGrid.setImageDescriptor(Activator.getImageDescriptor("icons/snap_to_grid.png"));
    actionSnapToGrid.setChecked(viewer.isSnapToGrid());
    actionAlignToGrid = new // $NON-NLS-1$
    Action(// $NON-NLS-1$
    Messages.get().AbstractNetworkMapView_AlignToGrid, // $NON-NLS-1$
    Activator.getImageDescriptor("icons/align_to_grid.gif")) {

        @Override
        public void run() {
            viewer.alignToGrid(false);
            updateObjectPositions();
        }
    };
    // $NON-NLS-1$
    actionAlignToGrid.setId("org.netxms.ui.eclipse.networkmaps.localActions.AbstractMap.AlignToGrid");
    // $NON-NLS-1$
    actionAlignToGrid.setActionDefinitionId("org.netxms.ui.eclipse.networkmaps.localCommands.AbstractMap.AlignToGrid");
    handlerService.activateHandler(actionAlignToGrid.getActionDefinitionId(), new ActionHandler(actionAlignToGrid));
    actionShowObjectDetails = new Action(Messages.get().AbstractNetworkMapView_ShowObjDetails) {

        @Override
        public void run() {
            showObjectDetails();
        }
    };
    actionHideLinkLabels = new Action(Messages.get().AbstractNetworkMapView_HideLinkLabels, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            labelProvider.setConnectionLabelsVisible(!actionHideLinkLabels.isChecked());
            viewer.refresh(true);
        }
    };
    // $NON-NLS-1$
    actionHideLinkLabels.setImageDescriptor(Activator.getImageDescriptor("icons/hide_link.png"));
    actionHideLinks = new Action(Messages.get().AbstractNetworkMapView_HideLinks, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            labelProvider.setConnectionsVisible(!actionHideLinks.isChecked());
            viewer.refresh(true);
        }
    };
    // $NON-NLS-1$
    actionHideLinks.setImageDescriptor(Activator.getImageDescriptor("icons/hide_net_link.png"));
    actionSelectAllObjects = new Action(Messages.get().AbstractNetworkMapView_SelectAllObjects) {

        @Override
        public void run() {
            viewer.setSelection(new StructuredSelection(mapPage.getObjectElements()));
        }
    };
    // $NON-NLS-1$
    actionSelectAllObjects.setId("org.netxms.ui.eclipse.networkmaps.localActions.AbstractMap.SelectAllObjects");
    // $NON-NLS-1$
    actionSelectAllObjects.setActionDefinitionId("org.netxms.ui.eclipse.networkmaps.localCommands.AbstractMap.SelectAllObjects");
    handlerService.activateHandler(actionSelectAllObjects.getActionDefinitionId(), new ActionHandler(actionSelectAllObjects));
    actionLockLink = new Action("Locked") {

        @Override
        public void run() {
            changeLinkLock();
        }
    };
}
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) IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) MapLayoutAlgorithm(org.netxms.client.maps.MapLayoutAlgorithm) ActionHandler(org.eclipse.jface.commands.ActionHandler) Point(org.eclipse.draw2d.geometry.Point)

Example 77 with IHandlerService

use of org.eclipse.ui.handlers.IHandlerService in project netxms by netxms.

the class ObjectBrowser method createActions.

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

        @Override
        public void run() {
            objectTree.refresh();
        }
    };
    actionMoveObject = new Action(Messages.get().ObjectBrowser_MoveObject) {

        @Override
        public void run() {
            moveObject(SubtreeType.INFRASTRUCTURE);
        }
    };
    // $NON-NLS-1$
    actionMoveObject.setId("org.netxms.ui.eclipse.objectbrowser.actions.moveObject");
    actionMoveTemplate = new Action(Messages.get().ObjectBrowser_MoveTemplate) {

        @Override
        public void run() {
            moveObject(SubtreeType.TEMPLATES);
        }
    };
    // $NON-NLS-1$
    actionMoveTemplate.setId("org.netxms.ui.eclipse.objectbrowser.actions.moveTemplate");
    actionMoveBusinessService = new Action(Messages.get().ObjectBrowser_MoveService) {

        @Override
        public void run() {
            moveObject(SubtreeType.BUSINESS_SERVICES);
        }
    };
    // $NON-NLS-1$
    actionMoveBusinessService.setId("org.netxms.ui.eclipse.objectbrowser.actions.moveBusinessService");
    actionMoveDashboard = new Action(Messages.get().ObjectBrowser_MoveDashboard) {

        @Override
        public void run() {
            moveObject(SubtreeType.DASHBOARDS);
        }
    };
    // $NON-NLS-1$
    actionMoveDashboard.setId("org.netxms.ui.eclipse.objectbrowser.actions.moveDashboard");
    actionMoveMap = new Action(Messages.get().ObjectBrowser_MoveMap) {

        @Override
        public void run() {
            moveObject(SubtreeType.MAPS);
        }
    };
    // $NON-NLS-1$
    actionMoveMap.setId("org.netxms.ui.eclipse.objectbrowser.actions.moveMap");
    actionMovePolicy = new Action(Messages.get().ObjectBrowser_MovePolicy) {

        @Override
        public void run() {
            moveObject(SubtreeType.POLICIES);
        }
    };
    // $NON-NLS-1$
    actionMovePolicy.setId("org.netxms.ui.eclipse.objectbrowser.actions.movePolicy");
    actionHideUnmanaged = new Action(Messages.get().ObjectBrowser_HideUnmanaged, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            objectTree.setHideUnmanaged(actionHideUnmanaged.isChecked());
        }
    };
    // $NON-NLS-1$
    actionHideUnmanaged.setId("org.netxms.ui.eclipse.objectbrowser.actions.hideUnmanaged");
    actionHideUnmanaged.setChecked(objectTree.isHideUnmanaged());
    actionHideTemplateChecks = new Action(Messages.get().ObjectBrowser_HideCheckTemplates, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            objectTree.setHideTemplateChecks(actionHideTemplateChecks.isChecked());
        }
    };
    // $NON-NLS-1$
    actionHideTemplateChecks.setId("org.netxms.ui.eclipse.objectbrowser.actions.hideTemplateChecks");
    actionHideTemplateChecks.setChecked(objectTree.isHideTemplateChecks());
    actionHideSubInterfaces = new Action(Messages.get().ObjectBrowser_HideSubInterfaces, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            objectTree.setHideSubInterfaces(actionHideSubInterfaces.isChecked());
        }
    };
    // $NON-NLS-1$
    actionHideSubInterfaces.setId("org.netxms.ui.eclipse.objectbrowser.actions.hideSubInterfaces");
    actionHideSubInterfaces.setChecked(objectTree.isHideSubInterfaces());
    actionShowFilter = new Action(Messages.get().ObjectBrowser_ShowFilter, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            objectTree.enableFilter(actionShowFilter.isChecked());
        }
    };
    // $NON-NLS-1$
    actionShowFilter.setId("org.netxms.ui.eclipse.objectbrowser.actions.showFilter");
    actionShowFilter.setChecked(objectTree.isFilterEnabled());
    // $NON-NLS-1$
    actionShowFilter.setActionDefinitionId("org.netxms.ui.eclipse.objectbrowser.commands.show_object_filter");
    final ActionHandler showFilterHandler = new ActionHandler(actionShowFilter);
    handlerService.activateHandler(actionShowFilter.getActionDefinitionId(), showFilterHandler);
    actionShowStatusIndicator = new Action(Messages.get().ObjectBrowser_ShowStatusIndicator, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            objectTree.enableStatusIndicator(actionShowStatusIndicator.isChecked());
        }
    };
    // $NON-NLS-1$
    actionShowStatusIndicator.setId("org.netxms.ui.eclipse.objectbrowser.actions.showStatusIndicator");
    actionShowStatusIndicator.setChecked(objectTree.isStatusIndicatorEnabled());
    // $NON-NLS-1$
    actionShowStatusIndicator.setActionDefinitionId("org.netxms.ui.eclipse.objectbrowser.commands.show_status_indicator");
    final ActionHandler showStatusIndicatorHandler = new ActionHandler(actionShowStatusIndicator);
    handlerService.activateHandler(actionShowStatusIndicator.getActionDefinitionId(), showStatusIndicatorHandler);
    actionRenameObject = new Action(Messages.get().ObjectBrowser_Rename) {

        @Override
        public void run() {
            TreeItem[] selection = objectTree.getTreeControl().getSelection();
            if (selection.length != 1)
                return;
            objectTree.getTreeViewer().editElement(selection[0].getData(), 0);
        }
    };
    // $NON-NLS-1$
    actionRenameObject.setId("org.netxms.ui.eclipse.objectbrowser.actions.rename");
    // $NON-NLS-1$
    actionRenameObject.setActionDefinitionId("org.netxms.ui.eclipse.objectbrowser.commands.rename_object");
    final ActionHandler renameObjectHandler = new ActionHandler(actionRenameObject);
    handlerService.activateHandler(actionRenameObject.getActionDefinitionId(), renameObjectHandler);
}
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 78 with IHandlerService

use of org.eclipse.ui.handlers.IHandlerService in project netxms by netxms.

the class PredefinedMap method createActions.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.netxms.ui.eclipse.networkmaps.views.NetworkMap#createActions()
	 */
@Override
protected void createActions() {
    super.createActions();
    final IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
    actionAddObject = new Action(Messages.get().PredefinedMap_AddObject) {

        @Override
        public void run() {
            addObjectToMap();
        }
    };
    // $NON-NLS-1$
    actionAddObject.setId("org.netxms.ui.eclipse.networkmaps.localActions.PredefinedMap.AddObject");
    // $NON-NLS-1$
    actionAddObject.setActionDefinitionId("org.netxms.ui.eclipse.networkmaps.localCommands.PredefinedMap.AddObject");
    handlerService.activateHandler(actionAddObject.getActionDefinitionId(), new ActionHandler(actionAddObject));
    actionAddDCIContainer = new Action(Messages.get().PredefinedMap_AddDciContainer) {

        @Override
        public void run() {
            addDCIContainerToMap();
        }
    };
    // $NON-NLS-1$
    actionAddDCIContainer.setId("org.netxms.ui.eclipse.networkmaps.localActions.PredefinedMap.AddDCIContainer");
    // $NON-NLS-1$
    actionAddDCIContainer.setActionDefinitionId("org.netxms.ui.eclipse.networkmaps.localCommands.PredefinedMap.AddDCIContainer");
    handlerService.activateHandler(actionAddDCIContainer.getActionDefinitionId(), new ActionHandler(actionAddDCIContainer));
    actionAddDCIImage = new Action(Messages.get().PredefinedMap_AddDciImage) {

        @Override
        public void run() {
            addDCIImageToMap();
        }
    };
    // $NON-NLS-1$
    actionAddDCIImage.setId("org.netxms.ui.eclipse.networkmaps.localActions.PredefinedMap.AddDCIImage");
    // $NON-NLS-1$
    actionAddDCIImage.setActionDefinitionId("org.netxms.ui.eclipse.networkmaps.localCommands.PredefinedMap.AddDCIImage");
    handlerService.activateHandler(actionAddDCIImage.getActionDefinitionId(), new ActionHandler(actionAddDCIImage));
    actionAddGroupBox = new Action(Messages.get().PredefinedMap_GroupBox) {

        @Override
        public void run() {
            addGroupBoxDecoration();
        }
    };
    actionAddImage = new Action(Messages.get().PredefinedMap_Image) {

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

        @Override
        public void run() {
            linkSelectedObjects();
        }
    };
    // $NON-NLS-1$
    actionLinkObjects.setId("org.netxms.ui.eclipse.networkmaps.localActions.PredefinedMap.LinkObjects");
    // $NON-NLS-1$
    actionLinkObjects.setActionDefinitionId("org.netxms.ui.eclipse.networkmaps.localCommands.PredefinedMap.LinkObjects");
    handlerService.activateHandler(actionLinkObjects.getActionDefinitionId(), new ActionHandler(actionLinkObjects));
    actionRemove = new Action(Messages.get().PredefinedMap_RemoveFromMap, SharedIcons.DELETE_OBJECT) {

        @Override
        public void run() {
            removeSelectedElements();
        }
    };
    // $NON-NLS-1$
    actionRemove.setId("org.netxms.ui.eclipse.networkmaps.localActions.PredefinedMap.Remove");
    // $NON-NLS-1$
    actionRemove.setActionDefinitionId("org.netxms.ui.eclipse.networkmaps.localCommands.PredefinedMap.Remove");
    handlerService.activateHandler(actionRemove.getActionDefinitionId(), new ActionHandler(actionRemove));
    actionDCIContainerProperties = new Action(Messages.get().PredefinedMap_Properties) {

        @Override
        public void run() {
            showDCIContainerProperties();
        }
    };
    actionDCIImageProperties = new Action(Messages.get().PredefinedMap_Properties) {

        @Override
        public void run() {
            showDCIImageProperties();
        }
    };
    actionMapProperties = new Action(Messages.get().PredefinedMap_MapProperties) {

        @Override
        public void run() {
            showMapProperties();
        }
    };
    actionLinkProperties = new Action(Messages.get().PredefinedMap_Properties) {

        @Override
        public void run() {
            showLinkProperties();
        }
    };
    actionAddTextBox = new Action("Text box") {

        @Override
        public void run() {
            addTextBoxToMap();
        }
    };
    actionTextBoxProperties = new Action("Text box properties") {

        @Override
        public void run() {
            showTextBoxProperties();
        }
    };
    actionGroupBoxEdit = new Action("Group box properties") {

        @Override
        public void run() {
            editGroupBox();
        }
    };
}
Also used : Action(org.eclipse.jface.action.Action) IHandlerService(org.eclipse.ui.handlers.IHandlerService) ActionHandler(org.eclipse.jface.commands.ActionHandler)

Example 79 with IHandlerService

use of org.eclipse.ui.handlers.IHandlerService in project netxms by netxms.

the class PersistentStorageView method createActions.

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

        @Override
        public void run() {
            refresh();
        }
    };
    actionCreate = new Action("Create new", SharedIcons.ADD_OBJECT) {

        @Override
        public void run() {
            createValue();
        }
    };
    // $NON-NLS-1$
    actionCreate.setActionDefinitionId("org.netxms.ui.eclipse.serverconfig.commands.new_task");
    handlerService.activateHandler(actionCreate.getActionDefinitionId(), new ActionHandler(actionCreate));
    actionEdit = new Action("Set", SharedIcons.EDIT) {

        @Override
        public void run() {
            editValue();
        }
    };
    // $NON-NLS-1$
    actionEdit.setActionDefinitionId("org.netxms.ui.eclipse.serverconfig.commands.edit_task");
    handlerService.activateHandler(actionEdit.getActionDefinitionId(), new ActionHandler(actionEdit));
    actionDelete = new Action("Delete", SharedIcons.DELETE_OBJECT) {

        @Override
        public void run() {
            deleteValue();
        }
    };
}
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 80 with IHandlerService

use of org.eclipse.ui.handlers.IHandlerService in project netxms by netxms.

the class ServerConfigurationEditor method createActions.

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

        @Override
        public void run() {
            refresh();
        }
    };
    actionAdd = new Action(Messages.get().ServerConfigurationEditor_ActionCreate, SharedIcons.ADD_OBJECT) {

        @Override
        public void run() {
            addVariable();
        }
    };
    // $NON-NLS-1$
    actionAdd.setActionDefinitionId("org.netxms.ui.eclipse.serverconfig.commands.add_config_variable");
    handlerService.activateHandler(actionAdd.getActionDefinitionId(), new ActionHandler(actionAdd));
    actionEdit = new Action(Messages.get().ServerConfigurationEditor_ActionEdit, SharedIcons.EDIT) {

        @Override
        public void run() {
            editVariable();
        }
    };
    actionEdit.setEnabled(false);
    actionDelete = new Action(Messages.get().ServerConfigurationEditor_ActionDelete, SharedIcons.DELETE_OBJECT) {

        @Override
        public void run() {
            deleteVariables();
        }
    };
    actionDelete.setEnabled(false);
    actionShowFilter = new Action("Show filter", Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            enableFilter(!initShowFilter);
            actionShowFilter.setChecked(initShowFilter);
        }
    };
    actionShowFilter.setImageDescriptor(SharedIcons.FILTER);
    actionShowFilter.setChecked(initShowFilter);
    // $NON-NLS-1$
    actionShowFilter.setActionDefinitionId("org.netxms.ui.eclipse.serverconfig.commands.show_filter");
    handlerService.activateHandler(actionShowFilter.getActionDefinitionId(), new ActionHandler(actionShowFilter));
    actionDefaultValue = new Action("Set default value") {

        @Override
        public void run() {
            setDefaultValue();
        }
    };
    actionExportToCsv = new ExportToCsvAction(this, viewer, true);
    actionExportAllToCsv = new ExportToCsvAction(this, viewer, false);
}
Also used : ExportToCsvAction(org.netxms.ui.eclipse.actions.ExportToCsvAction) 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) ExportToCsvAction(org.netxms.ui.eclipse.actions.ExportToCsvAction)

Aggregations

IHandlerService (org.eclipse.ui.handlers.IHandlerService)102 ActionHandler (org.eclipse.jface.commands.ActionHandler)44 Action (org.eclipse.jface.action.Action)41 RefreshAction (org.netxms.ui.eclipse.actions.RefreshAction)25 IEvaluationContext (org.eclipse.core.expressions.IEvaluationContext)18 Command (org.eclipse.core.commands.Command)17 ICommandService (org.eclipse.ui.commands.ICommandService)17 ExecutionEvent (org.eclipse.core.commands.ExecutionEvent)15 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)14 AbstractHandler (org.eclipse.core.commands.AbstractHandler)10 ParameterizedCommand (org.eclipse.core.commands.ParameterizedCommand)9 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)9 SelectionEvent (org.eclipse.swt.events.SelectionEvent)9 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)9 IHandler (org.eclipse.core.commands.IHandler)8 EvaluationContext (org.eclipse.core.expressions.EvaluationContext)8 ArrayList (java.util.ArrayList)7 ExecutionException (org.eclipse.core.commands.ExecutionException)7 IAction (org.eclipse.jface.action.IAction)7 IContextService (org.eclipse.ui.contexts.IContextService)7