Search in sources :

Example 21 with RepositoryNode

use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.

the class UseDynamicJobSelectionDialog method setCheckingNodes.

private void setCheckingNodes() {
    final IContentProvider contentProvider = getItemsTreeViewer().getContentProvider();
    final Object input = getItemsTreeViewer().getInput();
    if (contentProvider instanceof ITreeContentProvider && input instanceof ProjectRepositoryNode && getNeedCheckedjobs() != null && getNeedCheckedjobs().length > 0) {
        ITreeContentProvider cnfContentProvider = (ITreeContentProvider) contentProvider;
        List<IRepositoryNode> checkingNodes = new ArrayList<IRepositoryNode>();
        List<String> needCheckedJobIds = new ArrayList(Arrays.asList(getNeedCheckedjobs()));
        final ProjectRepositoryNode root = (ProjectRepositoryNode) input;
        final RepositoryNode rootRepositoryNode = root.getRootRepositoryNode(getSupportType());
        if (rootRepositoryNode == null) {
            return;
        }
        withReferenceProjects(cnfContentProvider, rootRepositoryNode, needCheckedJobIds, checkingNodes);
        // set check for node
        getItemsTreeViewer().setCheckedElements(checkingNodes.toArray());
        // select and will expand the selected node auto
        getItemsTreeViewer().setSelection(new StructuredSelection(checkingNodes), true);
        // let scroll bar on top
        getItemsTreeViewer().setSelection(new StructuredSelection(rootRepositoryNode));
        getItemsTreeViewer().setSelection(StructuredSelection.EMPTY);
    }
}
Also used : ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) IContentProvider(org.eclipse.jface.viewers.IContentProvider) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ArrayList(java.util.ArrayList) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode)

Example 22 with RepositoryNode

use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.

the class CreateSqlpatternAction method doRun.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
protected void doRun() {
    RepositoryNode sqlPatternNode = null;
    if (!isFromSqlPatternComposite) {
        sqlPatternNode = getCurrentRepositoryNode();
    }
    if (isToolbar()) {
        if (sqlPatternNode != null && sqlPatternNode.getContentType() != ERepositoryObjectType.SQLPATTERNS) {
            sqlPatternNode = null;
        }
        if (sqlPatternNode == null) {
            sqlPatternNode = getRepositoryNodeForDefault(ERepositoryObjectType.SQLPATTERNS);
        }
    }
    RepositoryNode node = null;
    IPath path;
    if (this.sqlPatternPath != null) {
        path = new Path(this.sqlPatternPath);
    } else if (isToolbar()) {
        path = RepositoryNodeUtilities.getPath(sqlPatternNode);
    } else {
        ISelection selection = getSelection();
        Object obj = ((IStructuredSelection) selection).getFirstElement();
        node = (RepositoryNode) obj;
        path = RepositoryNodeUtilities.getPath(node);
    }
    NewSqlpatternWizard routineWizard = new NewSqlpatternWizard(path);
    WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), routineWizard);
    if (dlg.open() == Window.OK) {
        try {
            openSQLPatternEditor(routineWizard.getSQLPattern(), false);
        } catch (PartInitException e) {
            MessageBoxExceptionHandler.process(e);
        } catch (SystemException e) {
            MessageBoxExceptionHandler.process(e);
        }
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) SystemException(org.talend.commons.exception.SystemException) NewSqlpatternWizard(org.talend.repository.ui.wizards.sqlpattern.NewSqlpatternWizard) ISelection(org.eclipse.jface.viewers.ISelection) PartInitException(org.eclipse.ui.PartInitException) RepositoryNode(org.talend.repository.model.RepositoryNode) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 23 with RepositoryNode

use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.

the class EditSqlpatternAction method doRun.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
protected void doRun() {
    RepositoryNode node = (RepositoryNode) ((IStructuredSelection) getSelection()).getFirstElement();
    Property property = node.getObject().getProperty();
    Property updatedProperty = null;
    try {
        updatedProperty = ProxyRepositoryFactory.getInstance().getLastVersion(new Project(ProjectManager.getInstance().getProject(property.getItem())), property.getId()).getProperty();
    } catch (PersistenceException e) {
        ExceptionHandler.process(e);
    }
    // update the property of the node repository object
    // node.getObject().setProperty(updatedProperty);
    SQLPatternItem sqlPatternItem = (SQLPatternItem) node.getObject().getProperty().getItem();
    IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
    boolean readonly = factory.getStatus(sqlPatternItem) == ERepositoryStatus.LOCK_BY_OTHER;
    try {
        openSQLPatternEditor(sqlPatternItem, readonly);
    // TDI-21143 : Studio repository view : remove all refresh call to repo view
    // IRepositoryView view = getViewPart();
    // if (view != null) {
    // view.refresh(node);
    // }
    } catch (PartInitException e) {
        MessageBoxExceptionHandler.process(e);
    } catch (SystemException e) {
        MessageBoxExceptionHandler.process(e);
    }
}
Also used : Project(org.talend.core.model.general.Project) SystemException(org.talend.commons.exception.SystemException) PersistenceException(org.talend.commons.exception.PersistenceException) SQLPatternItem(org.talend.core.model.properties.SQLPatternItem) PartInitException(org.eclipse.ui.PartInitException) RepositoryNode(org.talend.repository.model.RepositoryNode) Property(org.talend.core.model.properties.Property) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 24 with RepositoryNode

use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.

the class EditSqlpatternAction method init.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.repository.ui.actions.ITreeContextualAction#init(org.eclipse.jface.viewers.TreeViewer,
     * org.eclipse.jface.viewers.IStructuredSelection)
     */
public void init(TreeViewer viewer, IStructuredSelection selection) {
    boolean canWork = !selection.isEmpty() && selection.size() == 1;
    IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
    if (factory.isUserReadOnlyOnCurrentProject()) {
        canWork = false;
    }
    RepositoryNode node = (RepositoryNode) selection.getFirstElement();
    if (canWork) {
        if (node.getObjectType() != ERepositoryObjectType.SQLPATTERNS || !ProjectManager.getInstance().isInCurrentMainProject(node) || !isLastVersion(node)) {
            canWork = false;
        } else {
            Item item = node.getObject().getProperty().getItem();
            if (item instanceof SQLPatternItem) {
                canWork = !((SQLPatternItem) item).isSystem();
            }
        }
    }
    if (canWork) {
        canWork = (factory.getStatus(node.getObject()) != ERepositoryStatus.DELETED);
    }
    setEnabled(canWork);
}
Also used : Item(org.talend.core.model.properties.Item) SQLPatternItem(org.talend.core.model.properties.SQLPatternItem) SQLPatternItem(org.talend.core.model.properties.SQLPatternItem) RepositoryNode(org.talend.repository.model.RepositoryNode) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 25 with RepositoryNode

use of org.talend.repository.model.RepositoryNode in project tdi-studio-se by Talend.

the class DatabaseTypeFilter method selectNode.

private void selectNode() {
    /*
         * Make sure expand all. Just notice it here, because have been expand before.
         */
    // getRepositoryTreeViewer().expandAll();
    RepositoryNode root = (RepositoryNode) getRepositoryTreeViewer().getInput();
    selectNode(root, this.selectionType, this.selectedNodeName, this.isSelectionId);
}
Also used : RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode)

Aggregations

RepositoryNode (org.talend.repository.model.RepositoryNode)250 IRepositoryNode (org.talend.repository.model.IRepositoryNode)94 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)74 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)44 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)44 ProjectRepositoryNode (org.talend.core.repository.model.ProjectRepositoryNode)42 Item (org.talend.core.model.properties.Item)38 ArrayList (java.util.ArrayList)33 PersistenceException (org.talend.commons.exception.PersistenceException)27 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)27 ProcessItem (org.talend.core.model.properties.ProcessItem)23 RepositoryObject (org.talend.core.model.repository.RepositoryObject)22 ISelection (org.eclipse.jface.viewers.ISelection)20 ConnectionItem (org.talend.core.model.properties.ConnectionItem)20 IProjectRepositoryNode (org.talend.repository.model.nodes.IProjectRepositoryNode)20 List (java.util.List)18 Property (org.talend.core.model.properties.Property)18 DatabaseConnectionItem (org.talend.core.model.properties.DatabaseConnectionItem)17 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)16 WizardDialog (org.eclipse.jface.wizard.WizardDialog)13