Search in sources :

Example 1 with ELibraryInstallStatus

use of org.talend.core.model.general.ModuleNeeded.ELibraryInstallStatus in project tdi-studio-se by Talend.

the class JSONFileStep1Form method setVisible.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.swt.widgets.Control#setVisible(boolean)
     */
@Override
public void setVisible(boolean visible) {
    super.setVisible(visible);
    if (isReadOnly() != readOnly) {
        adaptFormToReadOnly();
    }
    if (super.isVisible()) {
        String JSONFilePath = getConnection().getJSONFilePath();
        // Fields to the Group Delimited File Settings
        if (getConnection().getEncoding() != null && !getConnection().getEncoding().equals("")) {
            //$NON-NLS-1$
            encodingCombo.setText(getConnection().getEncoding());
            isModifing = false;
            fileFieldJSON.setText(JSONFilePath);
        } else {
            encodingCombo.select(0);
        }
        if (isContextMode()) {
            ContextType contextType = ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection(), connectionItem.getConnection().getContextName());
            JSONFilePath = TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType, JSONFilePath));
        }
        if (!creation) {
            updateTreeNodes(JSONFilePath);
            JSONWizard wizard = ((JSONWizard) getPage().getWizard());
            if (wizard.getTreeRootNode() == null) {
                wizard.setTreeRootNode(treeNode);
            }
        }
        if (LanguageManager.getCurrentLanguage() == ECodeLanguage.PERL && GlobalServiceRegister.getDefault().isServiceRegistered(ILibrariesService.class)) {
            ILibrariesService moduleService = (ILibrariesService) GlobalServiceRegister.getDefault().getService(ILibrariesService.class);
            try {
                ELibraryInstallStatus status = moduleService.getLibraryStatus("JSON::LibJSON");
                if (status != ELibraryInstallStatus.INSTALLED) {
                    new ErrorDialogWidthDetailArea(getShell(), PID, "The Perl Module" + " JSON::LibJSON " + "is not installed", "For more information, check out Talend's Wiki website at http\\://talendforge.org/wiki/doku.php.");
                    log.error("The Perl Module" + " JSON::LibJSONL " + "is not installed");
                }
            } catch (BusinessException e) {
                new ErrorDialogWidthDetailArea(getShell(), PID, "The Perl Module" + " JSON::LibJSON " + "is not installed", "For more information, check out Talend's Wiki website at http\\://talendforge.org/wiki/doku.php.");
                log.error("The Perl Module" + " JSON::LibJSONL " + "is not installed");
            }
        }
        adaptFormToEditable();
    }
}
Also used : ContextType(org.talend.designer.core.model.utils.emf.talendfile.ContextType) BusinessException(org.talend.commons.exception.BusinessException) ILibrariesService(org.talend.core.model.general.ILibrariesService) ErrorDialogWidthDetailArea(org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea) ELibraryInstallStatus(org.talend.core.model.general.ModuleNeeded.ELibraryInstallStatus)

Aggregations

BusinessException (org.talend.commons.exception.BusinessException)1 ErrorDialogWidthDetailArea (org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea)1 ILibrariesService (org.talend.core.model.general.ILibrariesService)1 ELibraryInstallStatus (org.talend.core.model.general.ModuleNeeded.ELibraryInstallStatus)1 ContextType (org.talend.designer.core.model.utils.emf.talendfile.ContextType)1