Search in sources :

Example 1 with CreatePatternWizard

use of org.talend.dataprofiler.core.pattern.CreatePatternWizard 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)

Aggregations

IContext (org.eclipse.help.IContext)1 IHelpResource (org.eclipse.help.IHelpResource)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 FolderProvider (org.talend.cwm.management.api.FolderProvider)1 CreatePatternWizard (org.talend.dataprofiler.core.pattern.CreatePatternWizard)1 OpeningHelpWizardDialog (org.talend.dataprofiler.core.ui.utils.OpeningHelpWizardDialog)1 PatternParameter (org.talend.dq.analysis.parameters.PatternParameter)1