Search in sources :

Example 36 with RepositoryContext

use of org.talend.core.context.RepositoryContext in project tdi-studio-se by Talend.

the class TabFolderEditors method createStyledText.

private StyledText createStyledText(CTabItem item) {
    StyledText styledText = null;
    RepositoryContext repositoryContext = (RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
    ECodeLanguage language = repositoryContext.getProject().getLanguage();
    IPreferenceStore preferenceStore = CorePlugin.getDefault().getPreferenceStore();
    styledText = new UnnotifiableColorStyledText(tabFolderEditors, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL, preferenceStore, language.getName());
    styledText.setEnabled(false);
    item.setControl(styledText);
    return styledText;
}
Also used : RepositoryContext(org.talend.core.context.RepositoryContext) StyledText(org.eclipse.swt.custom.StyledText) UnnotifiableColorStyledText(org.talend.commons.ui.swt.colorstyledtext.UnnotifiableColorStyledText) UnnotifiableColorStyledText(org.talend.commons.ui.swt.colorstyledtext.UnnotifiableColorStyledText) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) ECodeLanguage(org.talend.core.language.ECodeLanguage)

Example 37 with RepositoryContext

use of org.talend.core.context.RepositoryContext in project tdi-studio-se by Talend.

the class ExpressionBuilderDialog method getExpressionStorePath.

/**
     * yzhang Comment method "getExpressionStorePath".
     * 
     * @return
     */
protected String getExpressionStorePath() {
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    RepositoryContext repositoryContext = (RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
    Project project = repositoryContext.getProject();
    IProject p = root.getProject(project.getTechnicalLabel());
    // put to the temp folder
    String projectPath = p.getLocation().toPortableString() + File.separator + RepositoryConstants.TEMP_DIRECTORY;
    String configurationPath = projectPath + File.separator + ExpressionPersistance.CONFIGURATION_FOLDER_NAME;
    configurationPath = getValidFolderPath(configurationPath, 1);
    File configurationFolder = new File(configurationPath);
    if (!configurationFolder.exists()) {
        configurationFolder.mkdir();
    }
    String expressionPath = configurationPath + File.separator + ExpressionPersistance.EXPRESSION_FOLDER_NAME;
    expressionPath = getValidFolderPath(expressionPath, 1);
    File expressionFolder = new File(expressionPath);
    if (!expressionFolder.exists()) {
        expressionFolder.mkdir();
    }
    String jobName = "";
    if (component != null) {
        jobName = component.getProcess().getName();
    } else {
        jobName = "tXMLMap";
    }
    expressionPath = expressionPath + File.separator + jobName + XmlUtil.FILE_XML_SUFFIX;
    return expressionPath;
}
Also used : IProject(org.eclipse.core.resources.IProject) Project(org.talend.core.model.general.Project) RepositoryContext(org.talend.core.context.RepositoryContext) IWorkspaceRoot(org.eclipse.core.resources.IWorkspaceRoot) File(java.io.File) IProject(org.eclipse.core.resources.IProject)

Example 38 with RepositoryContext

use of org.talend.core.context.RepositoryContext in project tdi-studio-se by Talend.

the class OpenExistVersionProcessWizard method openAnotherVersion.

protected void openAnotherVersion(final RepositoryNode node, final boolean readonly) {
    try {
        if (node.getObject() != null) {
            final Item item = node.getObject().getProperty().getItem();
            final IWorkbenchPage page = getActivePage();
            final RepositoryEditorInput fileEditorInput = getEditorInput(item, readonly, page);
            if (fileEditorInput != null) {
                IEditorPart editorPart = page.findEditor(fileEditorInput);
                if (editorPart == null) {
                    fileEditorInput.setRepositoryNode(node);
                    if (item instanceof ProcessItem) {
                        page.openEditor(fileEditorInput, MultiPageTalendEditor.ID, readonly);
                    } else if (item instanceof BusinessProcessItem) {
                        CorePlugin.getDefault().getDiagramModelService().openBusinessDiagramEditor(page, fileEditorInput);
                    } else {
                        ECodeLanguage lang = ((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getProject().getLanguage();
                        //$NON-NLS-1$ //$NON-NLS-2$
                        String talendEditorID = "org.talend.designer.core.ui.editor.StandAloneTalend" + lang.getCaseName() + "Editor";
                        page.openEditor(fileEditorInput, talendEditorID);
                    }
                } else {
                    page.activate(editorPart);
                }
            } else {
                // TDI-19014:open another version of jobScript
                if (item instanceof JobScriptItem) {
                    IProject fsProject = ResourceUtils.getProject(ProjectManager.getInstance().getCurrentProject());
                    openXtextEditor(node, fsProject, readonly);
                }
            }
        }
    } catch (PartInitException e) {
        MessageBoxExceptionHandler.process(e);
    } catch (SystemException e) {
        MessageBoxExceptionHandler.process(e);
    }
}
Also used : RepositoryContext(org.talend.core.context.RepositoryContext) RepositoryEditorInput(org.talend.core.repository.ui.editor.RepositoryEditorInput) BusinessProcessItem(org.talend.core.model.properties.BusinessProcessItem) JobScriptItem(org.talend.core.model.properties.JobScriptItem) IEditorPart(org.eclipse.ui.IEditorPart) IProject(org.eclipse.core.resources.IProject) Item(org.talend.core.model.properties.Item) JobScriptItem(org.talend.core.model.properties.JobScriptItem) RoutineItem(org.talend.core.model.properties.RoutineItem) SQLPatternItem(org.talend.core.model.properties.SQLPatternItem) BusinessProcessItem(org.talend.core.model.properties.BusinessProcessItem) ProcessItem(org.talend.core.model.properties.ProcessItem) BusinessProcessItem(org.talend.core.model.properties.BusinessProcessItem) ProcessItem(org.talend.core.model.properties.ProcessItem) SystemException(org.talend.commons.exception.SystemException) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException) ECodeLanguage(org.talend.core.language.ECodeLanguage)

Example 39 with RepositoryContext

use of org.talend.core.context.RepositoryContext in project tdi-studio-se by Talend.

the class TabFolderEditors method createStyledText.

private StyledText createStyledText(CTabItem item) {
    StyledText styledText = null;
    if (MapperMain.isStandAloneMode()) {
        styledText = new StyledText(tabFolderEditors, SWT.V_SCROLL | SWT.H_SCROLL);
    } else {
        RepositoryContext repositoryContext = (RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
        ECodeLanguage language = repositoryContext.getProject().getLanguage();
        IPreferenceStore preferenceStore = CorePlugin.getDefault().getPreferenceStore();
        // styledText = new ColorStyledText(tabFolderEditors, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL,
        // colorManager, language.getName());
        styledText = new UnnotifiableColorStyledText(tabFolderEditors, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL, preferenceStore, language.getName());
    }
    styledText.setEnabled(false);
    item.setControl(styledText);
    return styledText;
}
Also used : RepositoryContext(org.talend.core.context.RepositoryContext) StyledText(org.eclipse.swt.custom.StyledText) UnnotifiableColorStyledText(org.talend.commons.ui.swt.colorstyledtext.UnnotifiableColorStyledText) UnnotifiableColorStyledText(org.talend.commons.ui.swt.colorstyledtext.UnnotifiableColorStyledText) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) ECodeLanguage(org.talend.core.language.ECodeLanguage)

Example 40 with RepositoryContext

use of org.talend.core.context.RepositoryContext in project tdi-studio-se by Talend.

the class ProjectSettingManager method saveProject.

public static void saveProject() {
    RepositoryContext repositoryContext = (RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY);
    IProxyRepositoryFactory prf = CorePlugin.getDefault().getProxyRepositoryFactory();
    try {
        prf.saveProject(repositoryContext.getProject());
    } catch (Exception e) {
        ExceptionHandler.process(e);
    }
}
Also used : RepositoryContext(org.talend.core.context.RepositoryContext) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory) PersistenceException(org.talend.commons.exception.PersistenceException)

Aggregations

RepositoryContext (org.talend.core.context.RepositoryContext)53 Context (org.talend.core.context.Context)28 Project (org.talend.core.model.general.Project)18 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)14 PersistenceException (org.talend.commons.exception.PersistenceException)11 User (org.talend.core.model.properties.User)8 ProxyRepositoryFactory (org.talend.core.repository.model.ProxyRepositoryFactory)7 IProject (org.eclipse.core.resources.IProject)6 AnalysisContext (org.talend.dataquality.analysis.AnalysisContext)6 ECodeLanguage (org.talend.core.language.ECodeLanguage)5 IRepositoryFactory (org.talend.core.repository.model.IRepositoryFactory)5 IRepositoryNodeConfiguration (org.talend.mdm.repository.core.IRepositoryNodeConfiguration)5 IRepositoryNodeResourceProvider (org.talend.mdm.repository.core.IRepositoryNodeResourceProvider)5 Property (org.talend.core.model.properties.Property)4 RecycleBinNodeConfiguration (org.talend.mdm.repository.core.impl.recyclebin.RecycleBinNodeConfiguration)4 File (java.io.File)3 IOException (java.io.IOException)3 ResourceBundle (java.util.ResourceBundle)3 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)3 ImageRegistry (org.eclipse.jface.resource.ImageRegistry)3