Search in sources :

Example 1 with IHelpResource

use of org.eclipse.help.IHelpResource 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 2 with IHelpResource

use of org.eclipse.help.IHelpResource 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)

Example 3 with IHelpResource

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

the class CreateUDIAction method run.

@Override
public void run() {
    if (this.folder == null) {
        this.folder = ResourceManager.getUDIFolder();
    }
    UDIndicatorParameter parameter = new UDIndicatorParameter();
    FolderProvider folderProvider = new FolderProvider();
    folderProvider.setFolderResource(folder);
    parameter.setFolderProvider(folderProvider);
    NewUDIndicatorWizard fileWizard = WizardFactory.createNewUDIWizard(parameter);
    fileWizard.setWindowTitle(getText());
    IContext context = HelpSystem.getContext(HelpPlugin.getDefault().getUDIndicatorHelpContextID());
    IHelpResource[] relatedTopics = context.getRelatedTopics();
    String href = relatedTopics[0].getHref();
    WizardDialog dialog = new OpeningHelpWizardDialog(null, fileWizard, href);
    if (WizardDialog.OK == dialog.open()) {
        ProxyRepositoryManager.getInstance().save();
    }
}
Also used : FolderProvider(org.talend.cwm.management.api.FolderProvider) IContext(org.eclipse.help.IContext) NewUDIndicatorWizard(org.talend.dataprofiler.core.ui.wizard.indicator.NewUDIndicatorWizard) IHelpResource(org.eclipse.help.IHelpResource) OpeningHelpWizardDialog(org.talend.dataprofiler.core.ui.utils.OpeningHelpWizardDialog) OpeningHelpWizardDialog(org.talend.dataprofiler.core.ui.utils.OpeningHelpWizardDialog) WizardDialog(org.eclipse.jface.wizard.WizardDialog) UDIndicatorParameter(org.talend.dq.analysis.parameters.UDIndicatorParameter)

Example 4 with IHelpResource

use of org.eclipse.help.IHelpResource in project dbeaver by dbeaver.

the class BaseObjectEditPage method performHelp.

@Override
public void performHelp() {
    if (this instanceof IHelpContextIdProvider) {
        IWorkbenchHelpSystem helpSystem = UIUtils.getActiveWorkbenchWindow().getWorkbench().getHelpSystem();
        if (helpSystem != null) {
            String helpContextId = ((IHelpContextIdProvider) this).getHelpContextId();
            IContext helpContext = new IContext() {

                @Override
                public IHelpResource[] getRelatedTopics() {
                    return new IHelpResource[] { new IHelpResource() {

                        @Override
                        public String getHref() {
                            return helpContextId;
                        }

                        @Override
                        public String getLabel() {
                            return helpContextId;
                        }
                    } };
                }

                @Override
                public String getText() {
                    return helpContextId;
                }
            };
            helpSystem.displayHelp(helpContext);
        }
    }
}
Also used : IHelpContextIdProvider(org.jkiss.dbeaver.ui.IHelpContextIdProvider) IWorkbenchHelpSystem(org.eclipse.ui.help.IWorkbenchHelpSystem) IContext(org.eclipse.help.IContext) IHelpResource(org.eclipse.help.IHelpResource)

Example 5 with IHelpResource

use of org.eclipse.help.IHelpResource in project dbeaver by dbeaver.

the class GitHubWikiHelpUI method displayContext.

@Override
public void displayContext(IContext context, int x, int y) {
    try {
        IHelpResource[] relatedTopics = context.getRelatedTopics();
        if (relatedTopics == null || relatedTopics.length == 0) {
            return;
        }
        IHelpResource relatedTopic = relatedTopics[0];
        String topicRef = relatedTopic.getHref();
        // Cut plugin ID from href
        while (topicRef.startsWith("/")) {
            topicRef = topicRef.substring(1);
        }
        int divPos = topicRef.indexOf('/');
        if (divPos != -1) {
            topicRef = topicRef.substring(divPos + 1);
        }
        showHelpPage(GITHUB_HELP_ROOT + topicRef);
    } catch (Exception e) {
        log.error(e);
    }
}
Also used : IHelpResource(org.eclipse.help.IHelpResource)

Aggregations

IHelpResource (org.eclipse.help.IHelpResource)10 IContext (org.eclipse.help.IContext)8 WizardDialog (org.eclipse.jface.wizard.WizardDialog)4 OpeningHelpWizardDialog (org.talend.dataprofiler.core.ui.utils.OpeningHelpWizardDialog)4 IWorkbenchHelpSystem (org.eclipse.ui.help.IWorkbenchHelpSystem)2 IHelpContextIdProvider (org.jkiss.dbeaver.ui.IHelpContextIdProvider)2 FolderProvider (org.talend.cwm.management.api.FolderProvider)2 ContextImpl (eu.esdihumboldt.hale.ui.common.help.internal.ContextImpl)1 ContextWrapper (eu.esdihumboldt.hale.ui.common.help.internal.ContextWrapper)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 Set (java.util.Set)1 CoreException (org.eclipse.core.runtime.CoreException)1 ContextFileProvider (org.eclipse.help.internal.context.ContextFileProvider)1 ISelection (org.eclipse.jface.viewers.ISelection)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 Wizard (org.eclipse.jface.wizard.Wizard)1 CreatePatternWizard (org.talend.dataprofiler.core.pattern.CreatePatternWizard)1