Package org.locationtech.udig.project.ui.tool

Examples of org.locationtech.udig.project.ui.tool.IToolManager


     * custom delete action that is willing to delete a layer.
     */
    private void setGlobalActions() {
        IActionBars actionBars = getViewSite().getActionBars();

        IToolManager toolManager = ApplicationGIS.getToolManager();
        toolManager.contributeGlobalActions(this, actionBars);
        toolManager.registerActionsWithPart(this);

        IKeyBindingService keyBindings = getSite().getKeyBindingService();
        IAction delAction = getDeleteAction();
        actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), delAction);
        keyBindings.registerAction(delAction);
View Full Code Here


      build.append( shortcut );
      build.append(")");
      return build.toString();
  }
    public ModalTool getMapTool() {
        IToolManager tools = ApplicationGIS.getToolManager();
        ModalTool tool = (ModalTool) tools.findTool(getId());
        return tool;
    }
View Full Code Here

     * hook up a custom delete action that is willing to delete a layer.
     */
    private void setGlobalActions() {
        IActionBars actionBars = getViewSite().getActionBars();
       
        IToolManager toolManager = ApplicationGIS.getToolManager();
        toolManager.contributeGlobalActions(this, actionBars);
        toolManager.registerActionsWithPart(this);
       
        IKeyBindingService keyBindings = getSite().getKeyBindingService();
        IAction delAction = getDeleteAction();
        actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), delAction);
        keyBindings.registerAction(delAction);
View Full Code Here

    }

    @Override
    public void init( IConfigurationElement element ) {
        Cursor editCursor=null;
        IToolManager toolManager = ApplicationGIS.getToolManager();
       
        /*
         * Vitalus: The modern tool cursor approach is used - the order of finding the
         * default cursor:
         * 1) Try to find default cursor from "toolCursorId" attribute
         * 2) Try to find child configuration element "cursor"
         * 3) Set default system arrow cursor
         */
        String cursorId = element.getAttribute("toolCursorId"); //$NON-NLS-1$
        if(cursorId != null){
            editCursor = toolManager.findToolCursor(cursorId);
        }
        if(editCursor == null){
            IConfigurationElement[] cursorElement = element.getChildren("cursor"); //$NON-NLS-1$
            editCursor = new CursorProxy(cursorElement[0]).getCursor();
        }
       
        if( editCursor==null ){
            editCursor=Display.getDefault().getSystemCursor(SWT.CURSOR_ARROW);
        }

        //Must be configured in "org.locationtech.udig.tool.default" plugin
        Cursor selectionCursor = toolManager.findToolCursor("boxSelectionCursor"); //$NON-NLS-1$
        handler=new EditToolHandler(selectionCursor, editCursor);
        initRequiredActivators();
        EditToolConfigurationHelper editToolConfigurationHelper = new EditToolConfigurationHelper(getHandler().getBehaviours());
        initEventBehaviours(editToolConfigurationHelper);
        initEnablementBehaviours(handler.getEnablementBehaviours());
View Full Code Here

        if (menu == null) {
            final MenuManager contextMenu = new MenuManager();
            contextMenu.setRemoveAllWhenShown(true);
            contextMenu.addMenuListener(new IMenuListener(){
                public void menuAboutToShow( IMenuManager mgr ) {
                    IToolManager tm = ApplicationGIS.getToolManager();

                    contextMenu.add(new Separator());
                    contextMenu.add(tm.getBACKWARD_HISTORYAction());
                    contextMenu.add(tm.getFORWARD_HISTORYAction());
                    contextMenu.add(new Separator());
                    /*
                     * Gets contributions from active modal tool if possible
                     */
//                    tm.contributeActiveModalTool(contextMenu);
View Full Code Here

        if (menu == null) {
            final MenuManager contextMenu = new MenuManager();
            contextMenu.setRemoveAllWhenShown(true);
            contextMenu.addMenuListener(new IMenuListener(){
                public void menuAboutToShow( IMenuManager mgr ) {
                    IToolManager tm = ApplicationGIS.getToolManager();
                   
                    contextMenu.add(tm.getENTERAction());
                    contextMenu.add(new Separator());
                   
                    contextMenu.add(tm.getZOOMTOSELECTEDAction());
                    contextMenu.add(new Separator());
                    contextMenu.add(tm.getBACKWARD_HISTORYAction());
                    contextMenu.add(tm.getFORWARD_HISTORYAction());
                    contextMenu.add(new Separator());
                    // contextMenu.add(tm.createCUTAction(MapEditor.this));
                    contextMenu.add(tm.getCOPYAction(MapEditor.this));
                    contextMenu.add(tm.getPASTEAction(MapEditor.this));
                    contextMenu.add(tm.getDELETEAction());

                    /*
                     * Gets contributions from active modal tool if possible
                     */
                    tm.contributeActiveModalTool(contextMenu);

                    contextMenu.add(new Separator());
                    contextMenu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
                    if (getMap().getEditManager().getEditFeature() != null) {
                        contextMenu.add(ProjectUIPlugin.getDefault().getFeatureEditProcessor()
View Full Code Here

                String prefConstant = IToolManager.P_TOOL_MANAGER;
                String xpid = IToolManager.XPID;
                String idField = IToolManager.ATTR_ID;
                String classField = IToolManager.ATTR_CLASS;
               
                IToolManager result = (IToolManager) UiPlugin.lookupConfigurationObject(
                        IToolManager.class, ProjectUIPlugin.getDefault().getPreferenceStore(),
                        ProjectUIPlugin.ID,
                        prefConstant, xpid, idField, classField);
                if (result != null) {
                    toolManager = result;
View Full Code Here

  @Override
  public void setActiveEditor(IEditorPart targetEditor) {
      super.setActiveEditor(targetEditor);
     
        IToolManager toolManager = ApplicationGIS.getToolManager();
        toolManager.contributeGlobalActions(targetEditor, getActionBars());
        toolManager.registerActionsWithPart(targetEditor);
        getActionBars().updateActionBars();
  }
View Full Code Here

    private void setGlobalActions() {
        IActionBars actionBars = getViewSite().getActionBars();
       
        // register with the tool manager so the projects view will pass keybindings
        // over to the editor
        IToolManager toolManager = ApplicationGIS.getToolManager();
        toolManager.contributeGlobalActions(this, actionBars);
        toolManager.registerActionsWithPart(this);
       
        // except for the delete key we want that one for us
        IKeyBindingService keyBindings = getSite().getKeyBindingService();

        actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), delAction );
View Full Code Here

     * @param domain The domain (ie MapEditor or MapPart) for which we are tacking tools
     * @return PaletteRoot suitable for use with a PaletteView
     */
    public static PaletteRoot createPalette() {
        PaletteRoot root = new PaletteRoot();
        IToolManager toolManager = ApplicationGIS.getToolManager();

        List<PaletteContainer> categories = new ArrayList<PaletteContainer>();

        // Normal GEF Tools (SelectionTool etc...)
        // PaletteContainer controlGroup = createControlGroup(root);
        // categories.add(controlGroup);
        PaletteToolbar navigation = new PaletteToolbar("Navigation");
//        navigation.setInitialState(PaletteDrawer.INITIAL_STATE_OPEN);
//        navigation.setDrawerType(ToolEntry.PALETTE_TYPE_TOOL);
        navigation.setUserModificationPermission(PaletteContainer.PERMISSION_NO_MODIFICATION);
//        navigation.setShowDefaultIcon(false);
       
        for( ModalToolCategory category : toolManager.getModalToolCategories() ) {

            // Simple PaletteDrawer (no icon for the tool category at this time)
            String shortcut = shortcut(category.getName());
            String name = fixLabel(category.getName());
           
            PaletteContainer container;
            if( category.getId().equals("org.locationtech.udig.tool.category.zoom") ||
                    category.getId().equals("org.locationtech.udig.tool.category.pan")){
                container = navigation;
            }
            else {
                PaletteDrawer drawer = new PaletteDrawer(name);
                drawer.setId( category.getId() );
                if( category == toolManager.getActiveCategory()){
                    drawer.setInitialState(PaletteDrawer.INITIAL_STATE_OPEN);
                }
                else {
                    drawer.setInitialState(PaletteDrawer.INITIAL_STATE_CLOSED);
                }
View Full Code Here

TOP

Related Classes of org.locationtech.udig.project.ui.tool.IToolManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.