Search in sources :

Example 26 with ECodeLanguage

use of org.talend.core.language.ECodeLanguage in project tdi-studio-se by Talend.

the class ImplicitContextLoadHelper method reloadValuesFromPreferencePage.

/**
     * DOC hcw Comment method "reloadValuesFromPreferencePage".
     * 
     * @param elem
     * @param extraComposite
     */
public static void reloadValuesFromPreferencePage(Element element, ExtraComposite extraComposite) {
    ECodeLanguage language = LanguageManager.getCurrentLanguage();
    //$NON-NLS-1$
    String languagePrefix = language.toString() + "_";
    Map values = loadPreferenceValues();
    List<? extends IElementParameter> elementParameters = element.getElementParameters();
    for (IElementParameter elementParameter : elementParameters) {
        String name = elementParameter.getName();
        if (name.equals(getExtraParameterName(EParameterName.PROPERTY_TYPE))) {
            loadPropertyTypeFromPreference(element, extraComposite, languagePrefix, elementParameter);
        } else {
            Object value = values.get(name);
            if (value != null) {
                elementParameter.setValue(value);
            }
        }
    }
}
Also used : IElementParameter(org.talend.core.model.process.IElementParameter) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) HashMap(java.util.HashMap) Map(java.util.Map) ECodeLanguage(org.talend.core.language.ECodeLanguage)

Example 27 with ECodeLanguage

use of org.talend.core.language.ECodeLanguage in project tdi-studio-se by Talend.

the class ImplicitContextLoadHelper method loadPreferenceValues.

/**
     * DOC hcw Comment method "loadPreferenceValues".
     * 
     * @return
     */
@SuppressWarnings("unchecked")
private static Map loadPreferenceValues() {
    Map values = new HashMap();
    ECodeLanguage language = LanguageManager.getCurrentLanguage();
    //$NON-NLS-1$
    String languagePrefix = language.toString() + "_";
    EParameterName[] params = { EParameterName.IMPLICIT_TCONTEXTLOAD, EParameterName.FROM_FILE_FLAG, EParameterName.FROM_DATABASE_FLAG, EParameterName.PRINT_OPERATIONS, EParameterName.DISABLE_WARNINGS, EParameterName.DISABLE_ERROR, EParameterName.DISABLE_INFO };
    putValuesToMap(values, languagePrefix, params, Boolean.class);
    params = new EParameterName[] { EParameterName.IMPLICIT_TCONTEXTLOAD_FILE, EParameterName.FIELDSEPARATOR, EParameterName.DB_TYPE, EParameterName.LOAD_NEW_VARIABLE, EParameterName.NOT_LOAD_OLD_VARIABLE };
    putValuesToMap(values, languagePrefix, params, String.class);
    String propertyType = (String) getPreferenceValue(languagePrefix, EParameterName.PROPERTY_TYPE, String.class);
    if (!propertyType.equals(EmfComponent.BUILTIN)) {
        params = new EParameterName[] { EParameterName.HOST, EParameterName.PORT, EParameterName.DBNAME, EParameterName.SCHEMA_DB, EParameterName.USER, EParameterName.PASS, EParameterName.DBFILE, EParameterName.DBTABLE, EParameterName.QUERY_CONDITION };
        putValuesToMap(values, languagePrefix, params, String.class);
    }
    return values;
}
Also used : HashMap(java.util.HashMap) EParameterName(org.talend.designer.core.model.components.EParameterName) HashMap(java.util.HashMap) Map(java.util.Map) ECodeLanguage(org.talend.core.language.ECodeLanguage)

Example 28 with ECodeLanguage

use of org.talend.core.language.ECodeLanguage in project tmdm-studio-se by Talend.

the class DeployOnMDMExportWizardPage method packageProcess.

private boolean packageProcess(ExportFileResource p, IProgressMonitor monitor) {
    String label = getProcessName(p);
    monitor.setTaskName(Messages.bind(Messages.DeployOnMDMExportWizardPage_Pacakging, label));
    ECodeLanguage curLanguage = LanguageManager.getCurrentLanguage();
    if (curLanguage == ECodeLanguage.JAVA) {
        reBuildJobZipFile(p);
    }
    setDesValueForJob(p);
    processForEachJob(p);
    monitor.worked(W_PACKAGE_PROCESS);
    return true;
}
Also used : ECodeLanguage(org.talend.core.language.ECodeLanguage)

Example 29 with ECodeLanguage

use of org.talend.core.language.ECodeLanguage in project tesb-studio-se by Talend.

the class AbstractBeanAction method openBeanEditor.

public IEditorPart openBeanEditor(BeanItem beanItem, boolean readOnly) throws SystemException, PartInitException {
    if (beanItem == null) {
        return null;
    }
    ICodeGeneratorService service = (ICodeGeneratorService) GlobalServiceRegister.getDefault().getService(ICodeGeneratorService.class);
    ECodeLanguage lang = ((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getProject().getLanguage();
    ITalendSynchronizer routineSynchronizer = service.createRoutineSynchronizer();
    // check if the related editor is open.
    IWorkbenchPage page = getActivePage();
    IEditorReference[] editorParts = page.getEditorReferences();
    // $NON-NLS-1$ //$NON-NLS-2$
    String talendEditorID = "org.talend.designer.core.ui.editor.StandAloneTalend" + lang.getCaseName() + "Editor";
    boolean found = false;
    IEditorPart talendEditor = null;
    for (IEditorReference reference : editorParts) {
        IEditorPart editor = reference.getEditor(false);
        if (talendEditorID.equals(editor.getSite().getId())) {
            // TextEditor talendEditor = (TextEditor) editor;
            RepositoryEditorInput editorInput = (RepositoryEditorInput) editor.getEditorInput();
            if (editorInput.getItem().equals(beanItem)) {
                page.bringToTop(editor);
                found = true;
                talendEditor = editor;
                break;
            }
        }
    }
    if (!found) {
        routineSynchronizer.syncRoutine(beanItem, true);
        IFile file = routineSynchronizer.getFile(beanItem);
        if (file == null) {
            return null;
        }
        RepositoryEditorInput input = new BeanEditorInput(file, beanItem);
        input.setReadOnly(readOnly);
        // $NON-NLS-1$
        talendEditor = page.openEditor(input, talendEditorID);
    }
    return talendEditor;
}
Also used : ITalendSynchronizer(org.talend.designer.codegen.ITalendSynchronizer) IEditorReference(org.eclipse.ui.IEditorReference) RepositoryEditorInput(org.talend.core.repository.ui.editor.RepositoryEditorInput) IFile(org.eclipse.core.resources.IFile) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart) ICodeGeneratorService(org.talend.designer.codegen.ICodeGeneratorService) ECodeLanguage(org.talend.core.language.ECodeLanguage)

Aggregations

ECodeLanguage (org.talend.core.language.ECodeLanguage)29 RepositoryContext (org.talend.core.context.RepositoryContext)5 HashMap (java.util.HashMap)4 StyledText (org.eclipse.swt.custom.StyledText)4 IEditorPart (org.eclipse.ui.IEditorPart)4 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)4 IElementParameter (org.talend.core.model.process.IElementParameter)4 RepositoryEditorInput (org.talend.core.repository.ui.editor.RepositoryEditorInput)4 IFile (org.eclipse.core.resources.IFile)3 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)3 IEditorReference (org.eclipse.ui.IEditorReference)3 ProxyRepositoryFactory (org.talend.core.repository.model.ProxyRepositoryFactory)3 ITableEntry (org.talend.designer.abstractmap.model.tableentry.ITableEntry)3 ICodeGeneratorService (org.talend.designer.codegen.ICodeGeneratorService)3 HashSet (java.util.HashSet)2 Map (java.util.Map)2 EList (org.eclipse.emf.common.util.EList)2 ComboBoxCellEditor (org.eclipse.jface.viewers.ComboBoxCellEditor)2 UnnotifiableColorStyledText (org.talend.commons.ui.swt.colorstyledtext.UnnotifiableColorStyledText)2 Item (org.talend.core.model.properties.Item)2