Search in sources :

Example 1 with MenuCreator

use of org.jkiss.dbeaver.ui.MenuCreator in project dbeaver by serge-rider.

the class SelectCRSAction method getMenuCreator.

@Override
public IMenuCreator getMenuCreator() {
    return new MenuCreator(control -> {
        MenuManager menuManager = new MenuManager();
        menuManager.setRemoveAllWhenShown(true);
        menuManager.addMenuListener(manager -> {
            menuManager.add(new SetCRSAction(valueEditor, GisConstants.SRID_4326));
            menuManager.add(new SetCRSAction(valueEditor, GisConstants.SRID_3857));
            menuManager.add(new SetCRSAction(valueEditor, GisConstants.SRID_3395));
            menuManager.add(new SetCRSAction(valueEditor, GisConstants.SRID_SIMPLE));
            menuManager.add(new Separator());
            List<Integer> recentSRIDs = GISEditorUtils.getRecentSRIDs();
            if (!recentSRIDs.isEmpty()) {
                for (Integer recentSRID : recentSRIDs) {
                    menuManager.add(new SetCRSAction(valueEditor, recentSRID));
                }
                menuManager.add(new Separator());
            }
            menuManager.add(new Action(GISMessages.panel_select_crs_action_menu_manager_other) {

                @Override
                public void run() {
                    SelectCRSAction.this.run();
                }
            });
            menuManager.add(new Action(GISMessages.panel_select_crs_action_menu_manager_config) {

                @Override
                public void run() {
                    new GISViewerConfigurationDialog(valueEditor.getEditorControl().getShell()).open();
                }
            });
        });
        return menuManager;
    });
}
Also used : Action(org.eclipse.jface.action.Action) MenuCreator(org.jkiss.dbeaver.ui.MenuCreator) IMenuCreator(org.eclipse.jface.action.IMenuCreator) MenuManager(org.eclipse.jface.action.MenuManager) Separator(org.eclipse.jface.action.Separator)

Example 2 with MenuCreator

use of org.jkiss.dbeaver.ui.MenuCreator in project dbeaver by serge-rider.

the class SelectTilesAction method getMenuCreator.

@Override
public IMenuCreator getMenuCreator() {
    return new MenuCreator(control -> {
        MenuManager menuManager = new MenuManager();
        menuManager.setRemoveAllWhenShown(true);
        menuManager.addMenuListener(manager -> {
            if (valueEditor.getValueSRID() != 0) {
                for (LeafletTilesDescriptor ld : GeometryViewerRegistry.getInstance().getLeafletTiles()) {
                    menuManager.add(new SetTilesAction(valueEditor, ld));
                }
            }
        });
        return menuManager;
    });
}
Also used : MenuCreator(org.jkiss.dbeaver.ui.MenuCreator) IMenuCreator(org.eclipse.jface.action.IMenuCreator) LeafletTilesDescriptor(org.jkiss.dbeaver.ui.gis.registry.LeafletTilesDescriptor) MenuManager(org.eclipse.jface.action.MenuManager)

Aggregations

IMenuCreator (org.eclipse.jface.action.IMenuCreator)2 MenuManager (org.eclipse.jface.action.MenuManager)2 MenuCreator (org.jkiss.dbeaver.ui.MenuCreator)2 Action (org.eclipse.jface.action.Action)1 Separator (org.eclipse.jface.action.Separator)1 LeafletTilesDescriptor (org.jkiss.dbeaver.ui.gis.registry.LeafletTilesDescriptor)1