Search in sources :

Example 1 with CompositeViewersSelectionProvider

use of com.amalto.workbench.utils.CompositeViewersSelectionProvider in project tmdm-studio-se by Talend.

the class DataModelMainPage method hookSelectionProvider.

private void hookSelectionProvider() {
    selectionProvider = new CompositeViewersSelectionProvider(new Viewer[] { viewer, typesViewer });
    getSite().setSelectionProvider(selectionProvider);
}
Also used : TreeViewer(org.eclipse.jface.viewers.TreeViewer) Viewer(org.eclipse.jface.viewers.Viewer) CompositeViewersSelectionProvider(com.amalto.workbench.utils.CompositeViewersSelectionProvider)

Example 2 with CompositeViewersSelectionProvider

use of com.amalto.workbench.utils.CompositeViewersSelectionProvider in project tmdm-studio-se by Talend.

the class XSDEditor2 method createPages.

@Override
protected void createPages() {
    super.createPages();
    XSDEditorInput2 editorInput = (XSDEditorInput2) getEditorInput();
    TreeObject treeObject = editorInput.getTreeObject();
    IRepositoryViewEditorInput xobjectEditorinput = new XObjectEditorInput2(editorInput.getViewObject(), treeObject, treeObject.getDisplayName());
    xobjectEditorinput.setReadOnly(editorInput.isReadOnly());
    IFile xsdFile = null;
    try {
        xsdFile = getXSDFile(treeObject);
    } catch (Exception e) {
        log.error(e.getMessage(), e);
    }
    dMainPage = new DataModelMainPage2(treeObject);
    dMainPage.addPropertyListener(this);
    try {
        MODEL_PAGE_INDEX = addPage(dMainPage, xobjectEditorinput);
    } catch (PartInitException e) {
        log.error(e.getMessage(), e);
    }
    // Add ER Editor
    if (isEE()) {
        exAdapter.addPage(xsdFile, editorInput.isReadOnly());
    }
    // add repository view object in selectionprovider
    // ContainerCacheService.get(editorInput.getInputItem().getProperty());
    IRepositoryViewObject repositoryViewObj = editorInput.getViewObject();
    CompositeViewersSelectionProvider selectionProvider = (CompositeViewersSelectionProvider) dMainPage.getSelectionProvider();
    selectionProvider.setRepositoryViewObj(repositoryViewObj);
    // 
    // add XSDSelectionListener
    XSDSelectionListener xsdListener = new XSDSelectionListener(this, dMainPage);
    dMainPage.getTypesViewer().addSelectionChangedListener(xsdListener);
    dMainPage.getElementsViewer().addSelectionChangedListener(xsdListener);
    // 
    setXObject(treeObject);
    // 
    folder = (CTabFolder) dMainPage.getMainControl().getParent();
    // $NON-NLS-1$
    folder.getItem(MODEL_PAGE_INDEX).setText(treeObject.getDisplayName() + " " + Util.getRevision(treeObject));
    folder.getItem(SOURCE_PAGE_INDEX).setText(Messages.XSDEditor2_schemaSource);
    // default use
    activePage(xsdFile);
}
Also used : IFile(org.eclipse.core.resources.IFile) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) XSDSelectionListener(com.amalto.workbench.editors.xsdeditor.XSDSelectionListener) TreeObject(com.amalto.workbench.models.TreeObject) PartInitException(org.eclipse.ui.PartInitException) CompositeViewersSelectionProvider(com.amalto.workbench.utils.CompositeViewersSelectionProvider) CoreException(org.eclipse.core.runtime.CoreException) PartInitException(org.eclipse.ui.PartInitException) LoginException(org.talend.commons.exception.LoginException) PersistenceException(org.talend.commons.exception.PersistenceException)

Aggregations

CompositeViewersSelectionProvider (com.amalto.workbench.utils.CompositeViewersSelectionProvider)2 XSDSelectionListener (com.amalto.workbench.editors.xsdeditor.XSDSelectionListener)1 TreeObject (com.amalto.workbench.models.TreeObject)1 IFile (org.eclipse.core.resources.IFile)1 CoreException (org.eclipse.core.runtime.CoreException)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1 Viewer (org.eclipse.jface.viewers.Viewer)1 PartInitException (org.eclipse.ui.PartInitException)1 LoginException (org.talend.commons.exception.LoginException)1 PersistenceException (org.talend.commons.exception.PersistenceException)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1