Search in sources :

Example 16 with IRepositoryView

use of org.talend.repository.ui.views.IRepositoryView in project tdi-studio-se by Talend.

the class ExportItemAction method doRun.

@Override
protected void doRun() {
    if (toolbarAction) {
        this.setWorkbenchPart(null);
    }
    IRepositoryView repositoryView = getViewPart();
    if (repositoryView != null && repositoryView.getViewer() instanceof TreeViewer) {
        ((TreeViewer) repositoryView.getViewer()).getTree().setFocus();
    }
    ExportItemWizard wizard = new ExportItemWizard((repositoryView != null ? repositoryView.getViewSite().getId() : null));
    IWorkbench workbench = getWorkbench();
    wizard.setWindowTitle(EXPORT_ITEM);
    if (!toolbarAction) {
        wizard.init(workbench, (IStructuredSelection) this.getSelection());
    } else {
        if (repositoryView != null) {
            IStructuredSelection selection = (IStructuredSelection) repositoryView.getViewer().getSelection();
            wizard.init(workbench, selection);
        }
    }
    Shell activeShell = Display.getCurrent().getActiveShell();
    WizardDialog dialog = new WizardDialog(activeShell, wizard);
    dialog.open();
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) Shell(org.eclipse.swt.widgets.Shell) TreeViewer(org.eclipse.jface.viewers.TreeViewer) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IRepositoryView(org.talend.repository.ui.views.IRepositoryView) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 17 with IRepositoryView

use of org.talend.repository.ui.views.IRepositoryView in project tdi-studio-se by Talend.

the class ExpandAllAction method doRun.

@Override
protected void doRun() {
    IRepositoryView view = getViewPart();
    ISelection selection = getSelection();
    if (selection == null) {
        return;
    }
    Object objNode = ((IStructuredSelection) selection).getFirstElement();
    if (view != null) {
        if (objNode != null) {
            RepositoryNode node = (RepositoryNode) objNode;
            if ((node.getProperties(EProperties.CONTENT_TYPE) != null) && (node.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.SVN_ROOT)) {
                view.expand(node);
                view.getViewer().refresh();
                return;
            }
        }
        Set<ERepositoryObjectType> types = new HashSet<ERepositoryObjectType>();
        for (Object obj : ((IStructuredSelection) selection).toArray()) {
            expand(view, (RepositoryNode) obj, !view.getExpandedState(obj));
            types.add(((RepositoryNode) obj).getContentType());
        }
    // TDI-21143 : Studio repository view : remove all refresh call to repo view
    // for (ERepositoryObjectType type : types) {
    // view.refresh(type);
    // }
    }
}
Also used : ISelection(org.eclipse.jface.viewers.ISelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IRepositoryView(org.talend.repository.ui.views.IRepositoryView) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) HashSet(java.util.HashSet)

Example 18 with IRepositoryView

use of org.talend.repository.ui.views.IRepositoryView in project tdi-studio-se by Talend.

the class TalendWizardArchiveFileResourceExportPage2 method saveDirtyEditors.

@Override
protected boolean saveDirtyEditors() {
    boolean result = false;
    IRepositoryView repView = RepositoryManagerHelper.findRepositoryView();
    if (repView instanceof RepoViewCommonNavigator) {
        ((RepoViewCommonNavigator) repView).setShouldCheckRepositoryDirty(false);
        result = super.saveDirtyEditors();
        ((RepoViewCommonNavigator) repView).setShouldCheckRepositoryDirty(true);
    } else {
        return super.saveDirtyEditors();
    }
    return result;
}
Also used : RepoViewCommonNavigator(org.talend.repository.navigator.RepoViewCommonNavigator) IRepositoryView(org.talend.repository.ui.views.IRepositoryView)

Example 19 with IRepositoryView

use of org.talend.repository.ui.views.IRepositoryView in project tesb-studio-se by Talend.

the class CreateESBAction method selectRootObject.

private void selectRootObject(Properties params) {
    IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (null == workbenchWindow) {
        return;
    }
    IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
    if (null == workbenchPage) {
        return;
    }
    IPerspectiveDescriptor currentPerspective = workbenchPage.getPerspective();
    if (!IBrandingConfiguration.PERSPECTIVE_DI_ID.equals(currentPerspective.getId())) {
        // show Integration perspective
        try {
            workbenchWindow.getWorkbench().showPerspective(IBrandingConfiguration.PERSPECTIVE_DI_ID, workbenchWindow);
            workbenchPage = workbenchWindow.getActivePage();
        } catch (WorkbenchException e) {
            ExceptionHandler.process(e);
            return;
        }
    }
    IRepositoryView view = RepositoryManagerHelper.getRepositoryView();
    if (view != null) {
        Object type = params.get("type");
        if (ESBRepositoryNodeType.SERVICES.name().equals(type)) {
            RepositoryNode servicesNode = ((ProjectRepositoryNode) view.getRoot()).getRootRepositoryNode(ESBRepositoryNodeType.SERVICES);
            if (servicesNode != null) {
                setWorkbenchPart(view);
                final StructuredViewer viewer = view.getViewer();
                if (viewer instanceof TreeViewer) {
                    ((TreeViewer) viewer).expandToLevel(servicesNode, 1);
                }
                viewer.setSelection(new StructuredSelection(servicesNode));
            }
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) TreeViewer(org.eclipse.jface.viewers.TreeViewer) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IPerspectiveDescriptor(org.eclipse.ui.IPerspectiveDescriptor) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) StructuredViewer(org.eclipse.jface.viewers.StructuredViewer) WorkbenchException(org.eclipse.ui.WorkbenchException) IRepositoryView(org.talend.repository.ui.views.IRepositoryView) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode)

Example 20 with IRepositoryView

use of org.talend.repository.ui.views.IRepositoryView in project tesb-studio-se by Talend.

the class CreateCamelBean method selectRootObject.

private void selectRootObject(Properties params) {
    IRepositoryView view = RepositoryManagerHelper.getRepositoryView();
    if (view != null) {
        Object type = params.get("type");
        if (CamelRepositoryNodeType.repositoryBeansType.name().equals(type)) {
            IRepositoryNode processNode = ((ProjectRepositoryNode) view.getRoot()).getRootRepositoryNode(ERepositoryObjectType.PROCESS);
            if (processNode != null) {
                setWorkbenchPart(view);
                final StructuredViewer viewer = view.getViewer();
                if (viewer instanceof TreeViewer) {
                    ((TreeViewer) viewer).expandToLevel(processNode, 1);
                }
                viewer.setSelection(new StructuredSelection(processNode));
            }
        }
    }
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) TreeViewer(org.eclipse.jface.viewers.TreeViewer) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) StructuredViewer(org.eclipse.jface.viewers.StructuredViewer) IRepositoryView(org.talend.repository.ui.views.IRepositoryView)

Aggregations

IRepositoryView (org.talend.repository.ui.views.IRepositoryView)20 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)11 RepositoryNode (org.talend.repository.model.RepositoryNode)9 TreeViewer (org.eclipse.jface.viewers.TreeViewer)7 IRepositoryNode (org.talend.repository.model.IRepositoryNode)7 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)6 IPerspectiveDescriptor (org.eclipse.ui.IPerspectiveDescriptor)5 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)5 ProjectRepositoryNode (org.talend.core.repository.model.ProjectRepositoryNode)5 ISelection (org.eclipse.jface.viewers.ISelection)4 StructuredViewer (org.eclipse.jface.viewers.StructuredViewer)4 Shell (org.eclipse.swt.widgets.Shell)4 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)4 WorkbenchException (org.eclipse.ui.WorkbenchException)4 WizardDialog (org.eclipse.jface.wizard.WizardDialog)3 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)3 ArrayList (java.util.ArrayList)2 ConnectionItem (org.talend.core.model.properties.ConnectionItem)2 RoutineItem (org.talend.core.model.properties.RoutineItem)2 File (java.io.File)1