Search in sources :

Example 1 with IContext

use of org.eclipse.help.IContext in project tdq-studio-se by Talend.

the class ExpressionEditDialog method showHelp.

/**
 * DOC yyi Comment method "showHelp".
 */
protected void showHelp() {
    IContext context = HelpSystem.getContext(HelpPlugin.getDefault().getExpressionEditContextID());
    if (null != context && 0 < context.getRelatedTopics().length) {
        openTray(new HelpTray());
        ReusableHelpPart helpPart = ((HelpTray) getTray()).getHelpPart();
        helpPart.showURL(context.getRelatedTopics()[0].getHref());
    }
}
Also used : HelpTray(org.eclipse.help.ui.internal.views.HelpTray) IContext(org.eclipse.help.IContext) ReusableHelpPart(org.eclipse.help.ui.internal.views.ReusableHelpPart)

Example 2 with IContext

use of org.eclipse.help.IContext 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 3 with IContext

use of org.eclipse.help.IContext in project statecharts by Yakindu.

the class AbstractUserHelpDocumentationProvider method parseHelp.

private String parseHelp(String contextId) throws Exception {
    ContextFileProvider provider = new ContextFileProvider();
    IContext context = provider.getContext(contextId, Locale.getDefault().toString());
    IHelpResource[] relatedTopics = context.getRelatedTopics();
    Assert.isTrue(relatedTopics != null);
    // We assume that there is only one topic registered
    IHelpResource helpResource = relatedTopics[0];
    String href = helpResource.getHref().substring(1);
    URL url = new URL("platform:/plugin/" + href);
    return convertStreamToString(url.openConnection().getInputStream());
}
Also used : ContextFileProvider(org.eclipse.help.internal.context.ContextFileProvider) IContext(org.eclipse.help.IContext) IHelpResource(org.eclipse.help.IHelpResource) URL(java.net.URL)

Example 4 with IContext

use of org.eclipse.help.IContext in project tdq-studio-se by Talend.

the class NewWizardSelectionPage method addListeners.

protected void addListeners() {
    typeTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            AnalysisTypeNode node = (AnalysisTypeNode) ((IStructuredSelection) event.getSelection()).getFirstElement();
            if (node == null) {
                return;
            }
            AnalysisTypeNode parent = (AnalysisTypeNode) node.getParent();
            IContext context = HelpSystem.getContext(HelpPlugin.getDefault().getAnalysisHelpContextID());
            IHelpResource[] relatedTopics = context.getRelatedTopics();
            String href = null;
            String currentLiteral = node.getLiteral();
            if (AnalysisLabelParameter.FUNCTIONAL_DEPENDENCY_ANALYSIS.equals(currentLiteral)) {
                currentLiteral = AnalysisType.TABLE_FUNCTIONAL_DEPENDENCY.getLiteral();
            } else if (AnalysisLabelParameter.CONNECTION_OVERVIEW_ANALYSIS.equals(currentLiteral)) {
                currentLiteral = AnalysisType.CONNECTION.getLiteral();
            } else if (AnalysisLabelParameter.CATALOG_OVERVIEW_ANALYSIS.equals(currentLiteral)) {
                currentLiteral = AnalysisType.CATALOG.getLiteral();
            } else if (AnalysisLabelParameter.SCHEMA_OVERVIEW_ANALYSIS.equals(currentLiteral)) {
                currentLiteral = AnalysisType.SCHEMA.getLiteral();
            }
            AnalysisType currentType = AnalysisType.get(currentLiteral);
            if (parent == null) {
                setPageComplete(false);
                // MOD hcheng 2009-06-05 add help in analysis wizard
                switch(currentType) {
                    case CONNECTION:
                        href = relatedTopics[0].getHref();
                        break;
                    case COLUMNS_COMPARISON:
                        href = relatedTopics[4].getHref();
                        break;
                    case TABLE:
                        href = relatedTopics[6].getHref();
                        break;
                    case MULTIPLE_COLUMN:
                        href = relatedTopics[11].getHref();
                        break;
                    case COLUMN_CORRELATION:
                        href = relatedTopics[18].getHref();
                        break;
                    default:
                }
            } else {
                AnalysisParameter parameter = null;
                AnalysisType parentType = AnalysisType.get(parent.getLiteral());
                FolderProvider folderProvider = getCurrentFolderProvider() == null ? ((CreateNewAnalysisWizard) getWizard()).getCurrentFolderProvider() : getCurrentFolderProvider();
                switch(parentType) {
                    case COLUMN_CORRELATION:
                        AnalysisParameter correlationColumnParam = new AnalysisLabelParameter();
                        ((AnalysisLabelParameter) correlationColumnParam).setCategoryLabel(node.getName());
                        correlationColumnParam.setFolderProvider(folderProvider);
                        parameter = correlationColumnParam;
                        if (AnalysisLabelParameter.NUMBERIC_CORRELATION.equals(currentLiteral)) {
                            href = relatedTopics[19].getHref();
                        } else if (AnalysisLabelParameter.DATE_CORRELATION.equals(currentLiteral)) {
                            href = relatedTopics[20].getHref();
                        } else if (AnalysisLabelParameter.NOMINAL_CORRELATION.equals(currentLiteral)) {
                            href = relatedTopics[21].getHref();
                        } else {
                            href = relatedTopics[18].getHref();
                        }
                        break;
                    case MULTIPLE_COLUMN:
                        AnalysisParameter multipleColumnParam = new AnalysisLabelParameter();
                        ((AnalysisLabelParameter) multipleColumnParam).setCategoryLabel(node.getName());
                        multipleColumnParam.setFolderProvider(folderProvider);
                        parameter = multipleColumnParam;
                        if (AnalysisLabelParameter.SEMANTIC_DISCOVERY_ANALYSIS.equals(currentLiteral)) {
                            href = relatedTopics[12].getHref();
                        } else if (AnalysisLabelParameter.BASIC_COLUMN_ANALYSIS.equals(currentLiteral)) {
                            href = relatedTopics[13].getHref();
                        } else if (AnalysisLabelParameter.NOMINAL_VALUES_ANALYSIS.equals(currentLiteral)) {
                            href = relatedTopics[14].getHref();
                        } else if (AnalysisLabelParameter.PATTERN_FREQUENCY_ANALYSIS.equals(currentLiteral)) {
                            href = relatedTopics[15].getHref();
                        } else if (AnalysisLabelParameter.DISCRETE_DATA_ANALYSIS.equals(currentLiteral)) {
                            href = relatedTopics[16].getHref();
                        } else if (AnalysisLabelParameter.SUMMARY_STATISTICS_ANALYSIS.equals(currentLiteral)) {
                            href = relatedTopics[17].getHref();
                        } else {
                            href = relatedTopics[13].getHref();
                        }
                        break;
                    case COLUMNS_COMPARISON:
                        AnalysisParameter anaParam = new AnalysisParameter();
                        anaParam.setFolderProvider(folderProvider);
                        parameter = anaParam;
                        href = relatedTopics[5].getHref();
                        break;
                    case CONNECTION:
                        switch(currentType) {
                            case CONNECTION:
                            default:
                                AnalysisFilterParameter connParam = new AnalysisFilterParameter();
                                connParam.setFolderProvider(folderProvider);
                                parameter = connParam;
                                href = relatedTopics[1].getHref();
                                parentType = currentType;
                                break;
                            case CATALOG:
                                PackagesAnalyisParameter catalogParam = new PackagesAnalyisParameter();
                                catalogParam.setFolderProvider(folderProvider);
                                parameter = catalogParam;
                                href = relatedTopics[2].getHref();
                                parentType = currentType;
                                break;
                            case SCHEMA:
                                PackagesAnalyisParameter schemaParam = new PackagesAnalyisParameter();
                                schemaParam.setFolderProvider(folderProvider);
                                parameter = schemaParam;
                                href = relatedTopics[3].getHref();
                                parentType = currentType;
                                break;
                        }
                        break;
                    case TABLE:
                        switch(currentType) {
                            case MATCH_ANALYSIS:
                                parameter = new AnalysisParameter();
                                parameter.setFolderProvider(folderProvider);
                                href = relatedTopics[8].getHref();
                                parentType = currentType;
                                break;
                            case COLUMN_SET:
                                AnalysisParameter corrParam = new AnalysisParameter();
                                corrParam.setFolderProvider(folderProvider);
                                parameter = corrParam;
                                href = relatedTopics[10].getHref();
                                parentType = currentType;
                                break;
                            case TABLE_FUNCTIONAL_DEPENDENCY:
                                FuncationDependencyParameter funcationDependency = new FuncationDependencyParameter();
                                funcationDependency.setFolderProvider(folderProvider);
                                parameter = funcationDependency;
                                href = relatedTopics[9].getHref();
                                parentType = currentType;
                                break;
                            default:
                                NamedColumnSetAnalysisParameter tableParam = new NamedColumnSetAnalysisParameter();
                                tableParam.setFolderProvider(folderProvider);
                                parameter = tableParam;
                                href = relatedTopics[7].getHref();
                                break;
                        }
                        break;
                    default:
                        parameter = new AnalysisParameter();
                }
                selectedWizard = WizardFactory.createAnalysisWizard(parentType, parameter);
                setPageComplete(true);
            }
            // MOD by hcheng,0007483: Add help in analysis wizard
            OpeningHelpWizardDialog dialog = (OpeningHelpWizardDialog) getWizard().getContainer();
            dialog.setHref(href);
            dialog.showHelp();
        }
    });
    typeTreeViewer.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            AnalysisTypeNode node = (AnalysisTypeNode) ((IStructuredSelection) event.getSelection()).getFirstElement();
            if (node.getParent() == null) {
                typeTreeViewer.expandToLevel(node, 1);
            } else {
                advanceToNextPageOrFinish();
            }
        }
    });
}
Also used : AnalysisType(org.talend.dataquality.analysis.AnalysisType) AnalysisTypeNode(org.talend.dataprofiler.core.model.nodes.analysis.AnalysisTypeNode) IContext(org.eclipse.help.IContext) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) OpeningHelpWizardDialog(org.talend.dataprofiler.core.ui.utils.OpeningHelpWizardDialog) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) NamedColumnSetAnalysisParameter(org.talend.dq.analysis.parameters.NamedColumnSetAnalysisParameter) FuncationDependencyParameter(org.talend.dq.analysis.parameters.FuncationDependencyParameter) FolderProvider(org.talend.cwm.management.api.FolderProvider) PackagesAnalyisParameter(org.talend.dq.analysis.parameters.PackagesAnalyisParameter) NamedColumnSetAnalysisParameter(org.talend.dq.analysis.parameters.NamedColumnSetAnalysisParameter) AnalysisParameter(org.talend.dq.analysis.parameters.AnalysisParameter) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) AnalysisFilterParameter(org.talend.dq.analysis.parameters.AnalysisFilterParameter) AnalysisLabelParameter(org.talend.dq.analysis.parameters.AnalysisLabelParameter)

Example 5 with IContext

use of org.eclipse.help.IContext in project tdq-studio-se by Talend.

the class ImportPatternsAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
public void run() {
    ImportPatternsWizard wizard = new ImportPatternsWizard(folder, type);
    IContext context = HelpSystem.getContext(HelpPlugin.getDefault().getPatternHelpContextID());
    IHelpResource[] relatedTopics = context.getRelatedTopics();
    String href = relatedTopics[2].getHref();
    WizardDialog dialog = new OpeningHelpWizardDialog(null, wizard, href);
    wizard.setWindowTitle(getText());
    if (WizardDialog.OK == dialog.open()) {
        if (this.node != null) {
            CorePlugin.getDefault().refreshDQView(this.node);
        }
    }
}
Also used : IContext(org.eclipse.help.IContext) IHelpResource(org.eclipse.help.IHelpResource) OpeningHelpWizardDialog(org.talend.dataprofiler.core.ui.utils.OpeningHelpWizardDialog) ImportPatternsWizard(org.talend.dataprofiler.core.pattern.ImportPatternsWizard) OpeningHelpWizardDialog(org.talend.dataprofiler.core.ui.utils.OpeningHelpWizardDialog) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

IContext (org.eclipse.help.IContext)12 IHelpResource (org.eclipse.help.IHelpResource)8 OpeningHelpWizardDialog (org.talend.dataprofiler.core.ui.utils.OpeningHelpWizardDialog)5 WizardDialog (org.eclipse.jface.wizard.WizardDialog)4 FolderProvider (org.talend.cwm.management.api.FolderProvider)3 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)2 IWorkbenchHelpSystem (org.eclipse.ui.help.IWorkbenchHelpSystem)2 IHelpContextIdProvider (org.jkiss.dbeaver.ui.IHelpContextIdProvider)2 HALEContextProvider (eu.esdihumboldt.hale.ui.HALEContextProvider)1 ContextImpl (eu.esdihumboldt.hale.ui.common.help.internal.ContextImpl)1 ContextWrapper (eu.esdihumboldt.hale.ui.common.help.internal.ContextWrapper)1 ProjectService (eu.esdihumboldt.hale.ui.service.project.ProjectService)1 HaleWizardDialog (eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog)1 Pair (eu.esdihumboldt.util.Pair)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1