Search in sources :

Example 16 with RepositoryContext

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

the class AddContextCommentValueMigrationTaskTest method beforeAllTests.

@BeforeClass
public static void beforeAllTests() throws PersistenceException, LoginException, CoreException {
    createTempProject();
    Context ctx = CoreRuntimePlugin.getInstance().getContext();
    RepositoryContext repositoryContext = (RepositoryContext) ctx.getProperty(Context.REPOSITORY_CONTEXT_KEY);
    originalProject = repositoryContext.getProject();
    repositoryContext.setProject(sampleProject);
}
Also used : Context(org.talend.core.context.Context) RepositoryContext(org.talend.core.context.RepositoryContext) RepositoryContext(org.talend.core.context.RepositoryContext) BeforeClass(org.junit.BeforeClass)

Example 17 with RepositoryContext

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

the class FixUnevenItemContextParametersMigrationTaskTest method beforeAllTests.

@BeforeClass
public static void beforeAllTests() throws PersistenceException, LoginException, CoreException {
    createTempProject();
    Context ctx = CoreRuntimePlugin.getInstance().getContext();
    RepositoryContext repositoryContext = (RepositoryContext) ctx.getProperty(Context.REPOSITORY_CONTEXT_KEY);
    originalProject = repositoryContext.getProject();
    repositoryContext.setProject(sampleProject);
}
Also used : Context(org.talend.core.context.Context) RepositoryContext(org.talend.core.context.RepositoryContext) RepositoryContext(org.talend.core.context.RepositoryContext) BeforeClass(org.junit.BeforeClass)

Example 18 with RepositoryContext

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

the class FixUnevenItemContextParametersMigrationTaskTest method afterAllTests.

@AfterClass
public static void afterAllTests() throws PersistenceException, CoreException {
    removeTempProject();
    Context ctx = CoreRuntimePlugin.getInstance().getContext();
    RepositoryContext repositoryContext = (RepositoryContext) ctx.getProperty(Context.REPOSITORY_CONTEXT_KEY);
    repositoryContext.setProject(originalProject);
    originalProject = null;
    sampleProject = null;
}
Also used : Context(org.talend.core.context.Context) RepositoryContext(org.talend.core.context.RepositoryContext) RepositoryContext(org.talend.core.context.RepositoryContext) AfterClass(org.junit.AfterClass)

Example 19 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 20 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)

Aggregations

RepositoryContext (org.talend.core.context.RepositoryContext)31 Context (org.talend.core.context.Context)17 Project (org.talend.core.model.general.Project)12 PersistenceException (org.talend.commons.exception.PersistenceException)8 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)7 IProject (org.eclipse.core.resources.IProject)5 ECodeLanguage (org.talend.core.language.ECodeLanguage)5 File (java.io.File)3 CoreException (org.eclipse.core.runtime.CoreException)3 BeforeClass (org.junit.BeforeClass)3 ProcessItem (org.talend.core.model.properties.ProcessItem)3 ProxyRepositoryFactory (org.talend.core.repository.model.ProxyRepositoryFactory)3 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 HashMap (java.util.HashMap)2 List (java.util.List)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)2