Search in sources :

Example 1 with IndicatorSelectDialog

use of org.talend.dataprofiler.core.ui.grid.IndicatorSelectDialog in project tdq-studio-se by Talend.

the class AnalysisColumnTreeViewer method openIndicatorSelectDialog.

/**
 * Open the dialog for select indicator
 *
 * @param shell
 * @return The array of ModelElementIndicator which selected by user if user click ok button. If cancel button be
 * clicked then the size of return array will be zero. If have a Where Clause is error will return null
 */
public ModelElementIndicator[] openIndicatorSelectDialog(Shell shell) {
    List<Object[]> previewData = masterPage.getSampleTable().getExistPreviewData();
    final IndicatorSelectDialog dialog = new IndicatorSelectDialog(shell, DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.indicatorSelection"), masterPage.getCurrentModelElementIndicators(), // $NON-NLS-1$
    previewData);
    dialog.setLimitNumber(this.masterPage.getPreviewLimit());
    dialog.create();
    if (!DQPreferenceManager.isBlockWeb()) {
        dialog.getShell().addShellListener(new ShellAdapter() {

            @Override
            public void shellActivated(ShellEvent e) {
                dialog.getShell().setFocus();
                IContext context = HelpSystem.getContext(HelpPlugin.getDefault().getIndicatorSelectorHelpContextID());
                PlatformUI.getWorkbench().getHelpSystem().displayHelp(context);
            }
        });
        dialog.getShell().addHelpListener(new HelpListener() {

            public void helpRequested(HelpEvent e) {
                IContext context = HelpSystem.getContext(HelpPlugin.getDefault().getIndicatorSelectorHelpContextID());
                PlatformUI.getWorkbench().getHelpSystem().displayHelp(context);
            }
        });
    }
    if (dialog.open() == Window.OK) {
        isGridPreviewColumnMoved = dialog.isGridPreviewColumnMoved();
        ModelElementIndicator[] result = dialog.getResult();
        for (ModelElementIndicator modelElementIndicator : result) {
            modelElementIndicator.storeTempIndicator();
        }
        return result;
    } else {
        ModelElementIndicator[] result = dialog.getResult();
        for (ModelElementIndicator modelElementIndicator : result) {
            modelElementIndicator.getTempIndicator().clear();
        }
        return null;
    }
}
Also used : HelpEvent(org.eclipse.swt.events.HelpEvent) HelpListener(org.eclipse.swt.events.HelpListener) ShellAdapter(org.eclipse.swt.events.ShellAdapter) IContext(org.eclipse.help.IContext) IndicatorSelectDialog(org.talend.dataprofiler.core.ui.grid.IndicatorSelectDialog) ShellEvent(org.eclipse.swt.events.ShellEvent) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 2 with IndicatorSelectDialog

use of org.talend.dataprofiler.core.ui.grid.IndicatorSelectDialog in project tdq-studio-se by Talend.

the class SelectIndicatorsHandler method execute.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
     */
public Object execute(ExecutionEvent event) throws ExecutionException {
    Shell activeShell = HandlerUtil.getActiveShell(event);
    if (null != activeShell) {
        // MOD sizhaoliu TDQ-6075 Enable keyboard shortcut to select all the indicators
        boolean select;
        if (event.getCommand().getId().equals("org.talend.dataprofiler.core.selectAllIndicators")) {
            // $NON-NLS-1$
            select = true;
        } else if (event.getCommand().getId().equals("org.talend.dataprofiler.core.deselectAllIndicators")) {
            // $NON-NLS-1$
            select = false;
        } else {
            return null;
        }
        Object dialog = activeShell.getData();
        if (dialog instanceof IndicatorSelectDialog) {
            ((IndicatorSelectDialog) dialog).selectAllIndicators(select);
        }
    }
    return null;
}
Also used : Shell(org.eclipse.swt.widgets.Shell) IndicatorSelectDialog(org.talend.dataprofiler.core.ui.grid.IndicatorSelectDialog)

Aggregations

IndicatorSelectDialog (org.talend.dataprofiler.core.ui.grid.IndicatorSelectDialog)2 IContext (org.eclipse.help.IContext)1 HelpEvent (org.eclipse.swt.events.HelpEvent)1 HelpListener (org.eclipse.swt.events.HelpListener)1 ShellAdapter (org.eclipse.swt.events.ShellAdapter)1 ShellEvent (org.eclipse.swt.events.ShellEvent)1 Shell (org.eclipse.swt.widgets.Shell)1 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)1