Search in sources :

Example 1 with CustomizeColorsAction

use of org.jkiss.dbeaver.ui.controls.resultset.colors.CustomizeColorsAction in project dbeaver by serge-rider.

the class ResultSetViewer method fillColumnViewMenu.

private void fillColumnViewMenu(IMenuManager viewMenu, @NotNull DBDAttributeBinding attr, @Nullable ResultSetRow row, ResultSetValueController valueController) {
    final DBPDataSource dataSource = getDataSource();
    if (dataSource == null) {
        return;
    }
    List<? extends DBDAttributeTransformerDescriptor> transformers = dataSource.getContainer().getPlatform().getValueHandlerRegistry().findTransformers(dataSource, attr, null);
    if (!CommonUtils.isEmpty(transformers)) {
        MenuManager transformersMenu = new MenuManager(NLS.bind(ResultSetMessages.controls_resultset_viewer_action_view_column_type, attr.getName()));
        transformersMenu.setRemoveAllWhenShown(true);
        transformersMenu.addMenuListener(manager12 -> fillAttributeTransformersMenu(manager12, attr));
        viewMenu.add(transformersMenu);
    }
    if (model.isSingleSource()) {
        viewMenu.add(new TransformerSettingsAction());
    }
    viewMenu.add(new TransformComplexTypesToggleAction());
    if (attr.getDataKind() == DBPDataKind.BINARY || attr.getDataKind() == DBPDataKind.CONTENT) {
        MenuManager binaryFormatMenu = new MenuManager("Binary format");
        binaryFormatMenu.setRemoveAllWhenShown(true);
        binaryFormatMenu.addMenuListener(manager12 -> fillBinaryFormatMenu(manager12, attr));
        viewMenu.add(binaryFormatMenu);
    }
    viewMenu.add(new Separator());
    if (model.getDocumentAttribute() == null) {
        if (valueController != null) {
            viewMenu.add(new SetRowColorAction(this, attr, valueController.getValue()));
            if (getModel().hasColorMapping(attr)) {
                viewMenu.add(new ResetRowColorAction(this, attr, valueController.getValue()));
            }
        }
        viewMenu.add(new CustomizeColorsAction(this, attr, row));
        // if (getModel().getSingleSource() != null && getModel().hasColorMapping(getModel().getSingleSource())) {
        // viewMenu.add(new ResetAllColorAction());
        // }
        viewMenu.add(new ColorizeDataTypesToggleAction());
        viewMenu.add(new Separator());
    }
    viewMenu.add(new DataFormatsPreferencesAction());
    viewMenu.add(new Separator());
    viewMenu.add(new ToggleSelectionStatAction(ResultSetPreferences.RESULT_SET_SHOW_SEL_ROWS, "Show selected row count"));
    viewMenu.add(new ToggleSelectionStatAction(ResultSetPreferences.RESULT_SET_SHOW_SEL_COLUMNS, "Show selected column count"));
    viewMenu.add(new ToggleSelectionStatAction(ResultSetPreferences.RESULT_SET_SHOW_SEL_CELLS, "Show selected cell count"));
    viewMenu.add(new Separator());
    viewMenu.add(ActionUtils.makeCommandContribution(site, ResultSetHandlerMain.CMD_ZOOM_IN));
    viewMenu.add(ActionUtils.makeCommandContribution(site, ResultSetHandlerMain.CMD_ZOOM_OUT));
}
Also used : CustomizeColorsAction(org.jkiss.dbeaver.ui.controls.resultset.colors.CustomizeColorsAction) ResetRowColorAction(org.jkiss.dbeaver.ui.controls.resultset.colors.ResetRowColorAction) SetRowColorAction(org.jkiss.dbeaver.ui.controls.resultset.colors.SetRowColorAction)

Example 2 with CustomizeColorsAction

use of org.jkiss.dbeaver.ui.controls.resultset.colors.CustomizeColorsAction in project dbeaver by dbeaver.

the class ResultSetViewer method fillColumnViewMenu.

private void fillColumnViewMenu(IMenuManager viewMenu, @NotNull DBDAttributeBinding attr, @Nullable ResultSetRow row, ResultSetValueController valueController) {
    final DBPDataSource dataSource = getDataSource();
    if (dataSource == null) {
        return;
    }
    List<? extends DBDAttributeTransformerDescriptor> transformers = dataSource.getContainer().getPlatform().getValueHandlerRegistry().findTransformers(dataSource, attr, null);
    if (!CommonUtils.isEmpty(transformers)) {
        MenuManager transformersMenu = new MenuManager(NLS.bind(ResultSetMessages.controls_resultset_viewer_action_view_column_type, attr.getName()));
        transformersMenu.setRemoveAllWhenShown(true);
        transformersMenu.addMenuListener(manager12 -> fillAttributeTransformersMenu(manager12, attr));
        viewMenu.add(transformersMenu);
    }
    if (model.isSingleSource()) {
        viewMenu.add(new TransformerSettingsAction());
    }
    viewMenu.add(new TransformComplexTypesToggleAction());
    if (attr.getDataKind() == DBPDataKind.BINARY || attr.getDataKind() == DBPDataKind.CONTENT) {
        MenuManager binaryFormatMenu = new MenuManager("Binary format");
        binaryFormatMenu.setRemoveAllWhenShown(true);
        binaryFormatMenu.addMenuListener(manager12 -> fillBinaryFormatMenu(manager12, attr));
        viewMenu.add(binaryFormatMenu);
    }
    viewMenu.add(new Separator());
    if (model.getDocumentAttribute() == null) {
        if (valueController != null) {
            viewMenu.add(new SetRowColorAction(this, attr, valueController.getValue()));
            if (getModel().hasColorMapping(attr)) {
                viewMenu.add(new ResetRowColorAction(this, attr, valueController.getValue()));
            }
        }
        viewMenu.add(new CustomizeColorsAction(this, attr, row));
        // if (getModel().getSingleSource() != null && getModel().hasColorMapping(getModel().getSingleSource())) {
        // viewMenu.add(new ResetAllColorAction());
        // }
        viewMenu.add(new ColorizeDataTypesToggleAction());
        viewMenu.add(new Separator());
    }
    viewMenu.add(new DataFormatsPreferencesAction());
    viewMenu.add(new Separator());
    viewMenu.add(new ToggleSelectionStatAction(ResultSetPreferences.RESULT_SET_SHOW_SEL_ROWS, "Show selected row count"));
    viewMenu.add(new ToggleSelectionStatAction(ResultSetPreferences.RESULT_SET_SHOW_SEL_COLUMNS, "Show selected column count"));
    viewMenu.add(new ToggleSelectionStatAction(ResultSetPreferences.RESULT_SET_SHOW_SEL_CELLS, "Show selected cell count"));
    viewMenu.add(new Separator());
    viewMenu.add(ActionUtils.makeCommandContribution(site, ResultSetHandlerMain.CMD_ZOOM_IN));
    viewMenu.add(ActionUtils.makeCommandContribution(site, ResultSetHandlerMain.CMD_ZOOM_OUT));
}
Also used : CustomizeColorsAction(org.jkiss.dbeaver.ui.controls.resultset.colors.CustomizeColorsAction) ResetRowColorAction(org.jkiss.dbeaver.ui.controls.resultset.colors.ResetRowColorAction) SetRowColorAction(org.jkiss.dbeaver.ui.controls.resultset.colors.SetRowColorAction)

Aggregations

CustomizeColorsAction (org.jkiss.dbeaver.ui.controls.resultset.colors.CustomizeColorsAction)2 ResetRowColorAction (org.jkiss.dbeaver.ui.controls.resultset.colors.ResetRowColorAction)2 SetRowColorAction (org.jkiss.dbeaver.ui.controls.resultset.colors.SetRowColorAction)2