Search in sources :

Example 6 with IHelpResource

use of org.eclipse.help.IHelpResource in project dbeaver by serge-rider.

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) MalformedURLException(java.net.MalformedURLException) PartInitException(org.eclipse.ui.PartInitException)

Example 7 with IHelpResource

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

the class CreatePatternAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
public void run() {
    if (folder.exists()) {
        PatternParameter parameter = new PatternParameter();
        FolderProvider folderProvider = new FolderProvider();
        folderProvider.setFolderResource(folder);
        parameter.setFolderProvider(folderProvider);
        CreatePatternWizard fileWizard;
        if (this.expression != null && this.lanuage != null) {
            fileWizard = (CreatePatternWizard) WizardFactory.createPatternWizard(type, parameter, expression, lanuage);
        } else {
            fileWizard = (CreatePatternWizard) WizardFactory.createPatternWizard(type, parameter);
        }
        fileWizard.setPurpose(purpose);
        IContext context = HelpSystem.getContext(HelpPlugin.getDefault().getPatternHelpContextID());
        IHelpResource[] relatedTopics = context.getRelatedTopics();
        String href = relatedTopics[0].getHref();
        switch(type) {
            case SQL_LIKE:
                href = relatedTopics[1].getHref();
                break;
            default:
                break;
        }
        WizardDialog dialog = new OpeningHelpWizardDialog(Display.getDefault().getActiveShell(), fileWizard, href);
        fileWizard.setWindowTitle(getText());
        if (WizardDialog.OK == dialog.open())
            ProxyRepositoryManager.getInstance().save();
    }
}
Also used : FolderProvider(org.talend.cwm.management.api.FolderProvider) IContext(org.eclipse.help.IContext) CreatePatternWizard(org.talend.dataprofiler.core.pattern.CreatePatternWizard) IHelpResource(org.eclipse.help.IHelpResource) OpeningHelpWizardDialog(org.talend.dataprofiler.core.ui.utils.OpeningHelpWizardDialog) PatternParameter(org.talend.dq.analysis.parameters.PatternParameter) OpeningHelpWizardDialog(org.talend.dataprofiler.core.ui.utils.OpeningHelpWizardDialog) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 8 with IHelpResource

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

the class ExportPatternsAction method run.

@Override
public void run() {
    Wizard wizard = isForExchange ? new ExportForExchangeWizard(folder.getFullPath().toString()) : new ExportPatternsWizard(node, isForExchange);
    WizardDialog dialog = null;
    // MOD hcheng 2009-07-07,for 8122.Add an help file in the "Export patterns for Talend exchange wizard".
    if (isForExchange) {
        IContext context = HelpSystem.getContext(HelpPlugin.getDefault().getPatternHelpContextID());
        IHelpResource[] relatedTopics = context.getRelatedTopics();
        String href = relatedTopics[3].getHref();
        dialog = new OpeningHelpWizardDialog(null, wizard, href);
    } else {
        // MOD yyi 2009-08-20,for 8689.Add help in "export pattern" wizard.
        IContext context = HelpSystem.getContext(HelpPlugin.getDefault().getPatternHelpContextID());
        IHelpResource[] relatedTopics = context.getRelatedTopics();
        String href = relatedTopics[4].getHref();
        dialog = new OpeningHelpWizardDialog(null, wizard, href);
    }
    wizard.setWindowTitle(getText());
    if (WizardDialog.OK == dialog.open()) {
        try {
            folder.refreshLocal(IResource.DEPTH_INFINITE, null);
        } catch (CoreException e) {
            log.error(e, e);
        }
    }
}
Also used : ExportPatternsWizard(org.talend.dataprofiler.core.pattern.ExportPatternsWizard) IContext(org.eclipse.help.IContext) CoreException(org.eclipse.core.runtime.CoreException) ExportForExchangeWizard(org.talend.dataprofiler.core.ui.imex.ExportForExchangeWizard) IHelpResource(org.eclipse.help.IHelpResource) OpeningHelpWizardDialog(org.talend.dataprofiler.core.ui.utils.OpeningHelpWizardDialog) Wizard(org.eclipse.jface.wizard.Wizard) ExportPatternsWizard(org.talend.dataprofiler.core.pattern.ExportPatternsWizard) ExportForExchangeWizard(org.talend.dataprofiler.core.ui.imex.ExportForExchangeWizard) OpeningHelpWizardDialog(org.talend.dataprofiler.core.ui.utils.OpeningHelpWizardDialog) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

IHelpResource (org.eclipse.help.IHelpResource)8 IContext (org.eclipse.help.IContext)6 WizardDialog (org.eclipse.jface.wizard.WizardDialog)4 OpeningHelpWizardDialog (org.talend.dataprofiler.core.ui.utils.OpeningHelpWizardDialog)4 MalformedURLException (java.net.MalformedURLException)2 PartInitException (org.eclipse.ui.PartInitException)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