Search in sources :

Example 41 with RepositoryNode

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

the class ImportDemoItemAction method init.

@Override
public void init(TreeViewer viewer, IStructuredSelection selection) {
    toolbarAction = false;
    boolean canWork = false;
    IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
    if (selection.size() == 1) {
        if (selection.getFirstElement() instanceof RepositoryNode) {
            RepositoryNode repositoryNode = (RepositoryNode) selection.getFirstElement();
            if (factory.isUserReadOnlyOnCurrentProject() || !ProjectManager.getInstance().isInCurrentMainProject(repositoryNode)) {
                setEnabled(false);
                return;
            }
            if (repositoryNode.getType().equals(ENodeType.SYSTEM_FOLDER) || repositoryNode.getType().equals(ENodeType.SIMPLE_FOLDER)) {
                canWork = true;
            }
            if (repositoryNode.getContentType() == ERepositoryObjectType.REFERENCED_PROJECTS) {
                canWork = false;
            }
            if (repositoryNode.getContentType() == ERepositoryObjectType.SVN_ROOT) {
                canWork = false;
            }
            if (repositoryNode.getObject() != null && repositoryNode.getObject().getRepositoryStatus() == ERepositoryStatus.DELETED) {
                canWork = false;
            }
        }
    }
    setEnabled(canWork);
}
Also used : RepositoryNode(org.talend.repository.model.RepositoryNode) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 42 with RepositoryNode

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

the class DetecteViewImpactAction method doRun.

@Override
protected void doRun() {
    RepositoryNode node = getCurrentRepositoryNode();
    if (node == null) {
        return;
    }
    IStructuredSelection selection = new StructuredSelection(node);
    // try to check via extension point first.
    UpdateManagerProviderDetector.INSTANCE.updateForRepository(selection, true);
}
Also used : StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) RepositoryNode(org.talend.repository.model.RepositoryNode)

Example 43 with RepositoryNode

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

the class AbstractSection method setInput.

@Override
public void setInput(IWorkbenchPart part, ISelection selection) {
    super.setInput(part, selection);
    Assert.isTrue(selection instanceof IStructuredSelection);
    Object input = ((IStructuredSelection) selection).getFirstElement();
    if (!(input instanceof RepositoryNode)) {
        if (input instanceof IAdaptable) {
            // see ProcessPart.getAdapter()
            IAdaptable adaptable = (IAdaptable) input;
            input = adaptable.getAdapter(RepositoryNode.class);
        }
    }
    Assert.isTrue(input instanceof RepositoryNode);
    repositoryNode = (RepositoryNode) input;
    repositoryObject = repositoryNode.getObject();
    if (repositoryObject == null) {
        repositoryObject = new EmptyRepositoryObject();
        enableControls(false);
        showControls(false);
        return;
    }
    manageLock();
    ERepositoryObjectType type = repositoryObject.getRepositoryObjectType();
    showControls(type != ERepositoryObjectType.METADATA_CON_TABLE);
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) EmptyRepositoryObject(org.talend.core.model.repository.EmptyRepositoryObject) EmptyRepositoryObject(org.talend.core.model.repository.EmptyRepositoryObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) RepositoryNode(org.talend.repository.model.RepositoryNode) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType)

Example 44 with RepositoryNode

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

the class OpenAnotherVersionResourceAction method doRun.

@Override
protected void doRun() {
    final IRepositoryNode node = (RepositoryNode) ((IStructuredSelection) getSelection()).getFirstElement();
    IPath path = RepositoryNodeUtilities.getPath(node);
    String originalName = node.getObject().getLabel();
    RepositoryObject repositoryObj = new RepositoryObject(node.getObject().getProperty());
    repositoryObj.setRepositoryNode(node.getObject().getRepositoryNode());
    OpenAnotherVersionResrouceWizard wizard = new OpenAnotherVersionResrouceWizard(repositoryObj);
    WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
    dialog.setPageSize(300, 250);
    //$NON-NLS-1$
    dialog.setTitle("Open another version");
    if (dialog.open() == Dialog.OK) {
        refresh(node);
        // refresh the corresponding editor's name
        IEditorPart part = getCorrespondingEditor(node);
        if (part != null && part instanceof IUIRefresher) {
            ((IUIRefresher) part).refreshName();
        } else {
            processRoutineRenameOperation(originalName, node, path);
        }
    }
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) IPath(org.eclipse.core.runtime.IPath) RepositoryObject(org.talend.core.model.repository.RepositoryObject) OpenAnotherVersionResrouceWizard(org.talend.designer.camel.resource.ui.wizards.OpenAnotherVersionResrouceWizard) IEditorPart(org.eclipse.ui.IEditorPart) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) WizardDialog(org.eclipse.jface.wizard.WizardDialog) IUIRefresher(org.talend.core.services.IUIRefresher)

Example 45 with RepositoryNode

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

the class RouteResourcesButtonPart method buttonSelected.

@Override
protected void buttonSelected(SelectionEvent e) {
    try {
        Class<?> dialogClass = Platform.getBundle("org.talend.camel.designer").loadClass("org.talend.camel.designer.dialog.RouteResourceSelectionDialog");
        Dialog dialog = (Dialog) dialogClass.getConstructor(Shell.class).newInstance(getShell());
        if (dialog.open() == Dialog.OK) {
            RepositoryNode resourceNode = (RepositoryNode) dialogClass.getMethod("getResult").invoke(dialog);
            if (resourceNode != null) {
                listener.routeResourceNodeSelected(resourceNode);
            }
        }
    } catch (Exception e1) {
        ExceptionHandler.process(new IllegalStateException("Can't load RouteResourceSelectionDialog from specific bundle", e1));
    }
}
Also used : Dialog(org.eclipse.jface.dialogs.Dialog) RepositoryNode(org.talend.repository.model.RepositoryNode)

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