Search in sources :

Example 11 with RepositoryObject

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

the class AutoUpdateRelationsMigrationTask method unloadObject.

@Override
public void unloadObject(IRepositoryViewObject object) {
    if (object instanceof RepositoryObject) {
        RepositoryObject obj = (RepositoryObject) object;
        obj.unload();
    }
}
Also used : RepositoryObject(org.talend.core.model.repository.RepositoryObject)

Example 12 with RepositoryObject

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

the class BuildRecycleBinIndexMigrationTask method unloadObject.

@Override
public void unloadObject(IRepositoryViewObject object) {
    if (object instanceof RepositoryObject) {
        RepositoryObject obj = (RepositoryObject) object;
        obj.unload();
    }
}
Also used : RepositoryObject(org.talend.core.model.repository.RepositoryObject)

Example 13 with RepositoryObject

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

the class StatusConfirmSettingDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    TableViewer viewer = new TableViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.minimumHeight = 200;
    data.heightHint = 200;
    data.minimumWidth = 350;
    data.widthHint = 350;
    viewer.getControl().setLayoutData(data);
    final Table table = viewer.getTable();
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    TableColumn column = new TableColumn(table, SWT.NONE);
    //$NON-NLS-1$
    column.setText(Messages.getString("VersionManagementDialog.Items"));
    column.setWidth(140);
    column = new TableColumn(table, SWT.NONE);
    //$NON-NLS-1$
    column.setText(Messages.getString("StatusManagementDialog.Status"));
    column.setWidth(120);
    column = new TableColumn(table, SWT.NONE);
    //$NON-NLS-1$
    column.setText(Messages.getString("StatusManagementDialog.NewStatus"));
    column.setWidth(90);
    viewer.setContentProvider(ArrayContentProvider.getInstance());
    viewer.setLabelProvider(new ITableLabelProvider() {

        public Image getColumnImage(Object element, int columnIndex) {
            RepositoryObject object = (RepositoryObject) element;
            if (columnIndex == 0) {
                ERepositoryObjectType itemType = object.getRepositoryObjectType();
                return getItemsImage(CoreImageProvider.getIcon(itemType));
            }
            return null;
        }

        public String getColumnText(Object element, int columnIndex) {
            RepositoryObject object = (RepositoryObject) element;
            switch(columnIndex) {
                case 0:
                    return object.getLabel();
                case 1:
                    return statusHelper.getStatusLabel(object.getProperty().getOldStatusCode());
                case 2:
                    if (object.getStatusCode().equals(object.getProperty().getOldStatusCode())) {
                        //$NON-NLS-1$
                        return "-";
                    }
                    return statusHelper.getStatusLabel(object.getStatusCode());
                default:
            }
            return null;
        }

        public void addListener(ILabelProviderListener listener) {
        }

        public void dispose() {
        }

        public boolean isLabelProperty(Object element, String property) {
            return false;
        }

        public void removeListener(ILabelProviderListener listener) {
        }
    });
    viewer.setInput(modifiedVersionItems);
    for (TableItem item : table.getItems()) {
        RepositoryObject object = (RepositoryObject) item.getData();
        // if (!object.getOldVersion().equals(object.getNewVersion())) {
        item.setForeground(2, Display.getDefault().getSystemColor(SWT.COLOR_RED));
    // }
    }
    return composite;
}
Also used : Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) RepositoryObject(org.talend.core.model.repository.RepositoryObject) TableItem(org.eclipse.swt.widgets.TableItem) IImage(org.talend.commons.ui.runtime.image.IImage) Image(org.eclipse.swt.graphics.Image) EImage(org.talend.commons.ui.runtime.image.EImage) TableColumn(org.eclipse.swt.widgets.TableColumn) ITableLabelProvider(org.eclipse.jface.viewers.ITableLabelProvider) ILabelProviderListener(org.eclipse.jface.viewers.ILabelProviderListener) GridData(org.eclipse.swt.layout.GridData) RepositoryObject(org.talend.core.model.repository.RepositoryObject) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 14 with RepositoryObject

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

the class OpenDiagramAction method doRun.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
protected void doRun() {
    ISelection selection = getSelectedObject();
    if (selection == null) {
        return;
    }
    Object obj = ((IStructuredSelection) selection).getFirstElement();
    if (obj instanceof RepositoryNode) {
        RepositoryNode repositoryNode = (RepositoryNode) obj;
        IRepositoryViewObject repositoryObject = repositoryNode.getObject();
        Property updatedProperty = null;
        if (repositoryObject instanceof RepositoryObject) {
            RepositoryViewObject abstractRepositoryObject = new RepositoryViewObject(repositoryObject.getProperty());
            updatedProperty = abstractRepositoryObject.getProperty();
        } else if (repositoryObject instanceof RepositoryViewObject) {
            updatedProperty = repositoryObject.getProperty();
        }
        if (updatedProperty != null) {
            BusinessProcessItem businessProcessItem = (BusinessProcessItem) updatedProperty.getItem();
            DiagramResourceManager diagramResourceManager = new DiagramResourceManager(getActivePage(), new NullProgressMonitor());
            IFile file = diagramResourceManager.createDiagramFile();
            diagramResourceManager.updateResource(businessProcessItem, file);
            IEditorPart part = diagramResourceManager.openEditor(businessProcessItem, file, false);
            if (part instanceof BusinessDiagramEditor) {
                ((BusinessDiagramEditor) part).setLastVersion(true);
            }
        // TDI-21143 : Studio repository view : remove all refresh call to repo view
        // IRepositoryView view = getViewPart();
        // if (view != null) {
        // view.refresh(repositoryNode);
        // }
        }
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IFile(org.eclipse.core.resources.IFile) RepositoryObject(org.talend.core.model.repository.RepositoryObject) BusinessDiagramEditor(org.talend.designer.business.model.business.diagram.part.BusinessDiagramEditor) BusinessProcessItem(org.talend.core.model.properties.BusinessProcessItem) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IEditorPart(org.eclipse.ui.IEditorPart) RepositoryNode(org.talend.repository.model.RepositoryNode) ISelection(org.eclipse.jface.viewers.ISelection) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RepositoryObject(org.talend.core.model.repository.RepositoryObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RepositoryViewObject(org.talend.core.model.repository.RepositoryViewObject) Property(org.talend.core.model.properties.Property) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RepositoryViewObject(org.talend.core.model.repository.RepositoryViewObject)

Example 15 with RepositoryObject

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

the class ExportItemWizardPage method exportDependenciesSelected.

/**
     * DOC qwei Comment method "exportDependenciesSelected".
     */
private void exportDependenciesSelected() {
    final Collection<Item> selectedItems = getSelectedItems();
    // addTreeCheckedSelection();
    IRunnableWithProgress runnable = new IRunnableWithProgress() {

        @Override
        public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            //$NON-NLS-1$
            monitor.beginTask("Dependencies", 100);
            //
            final List<IRepositoryViewObject> repositoryObjects = new ArrayList<IRepositoryViewObject>();
            ProcessUtils.clearFakeProcesses();
            RepositoryNodeUtilities.checkItemDependencies(selectedItems, repositoryObjects, false, true);
            monitor.worked(60);
            for (IRepositoryViewObject repositoryObject : repositoryObjects) {
                RepositoryNode repositoryNode = RepositoryNodeUtilities.getRepositoryNode(repositoryObject, monitor);
                if (repositoryNode != null) {
                    checkedDependency.add(repositoryNode);
                } else {
                    implicitDependences.add(repositoryObject);
                }
                // check relateion ship for job -->map -->structure
                for (IExtendedRepositoryNodeHandler nodeHandler : RepositoryContentManager.getExtendedNodeHandler()) {
                    List nodesAndDependencies = nodeHandler.getRepositoryNodeAndDependencies(repositoryObject);
                    if (!nodesAndDependencies.isEmpty()) {
                        checkedDependency.addAll(nodesAndDependencies);
                    }
                }
            }
            // check relateion ship for map -->structure
            for (Item item : selectedItems) {
                for (IExtendedRepositoryNodeHandler nodeHandler : RepositoryContentManager.getExtendedNodeHandler()) {
                    List nodesAndDependencies = nodeHandler.getRepositoryNodeAndDependencies(new RepositoryObject(item.getProperty()));
                    if (!nodesAndDependencies.isEmpty()) {
                        checkedDependency.addAll(nodesAndDependencies);
                    }
                }
            }
            monitor.worked(90);
            ProcessUtils.clearFakeProcesses();
            monitor.done();
        }
    };
    // final ProgressMonitorJobsDialog dialog = new ProgressMonitorJobsDialog(getShell());
    final ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
    try {
        dialog.run(true, true, runnable);
    } catch (InvocationTargetException e) {
    //
    } catch (InterruptedException e) {
    //
    }
}
Also used : MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) RepositoryObject(org.talend.core.model.repository.RepositoryObject) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) ArrayList(java.util.ArrayList) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IProjectRepositoryNode(org.talend.repository.model.nodes.IProjectRepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) Item(org.talend.core.model.properties.Item) TreeItem(org.eclipse.swt.widgets.TreeItem) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IExtendedRepositoryNodeHandler(org.talend.core.model.repository.IExtendedRepositoryNodeHandler) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

RepositoryObject (org.talend.core.model.repository.RepositoryObject)22 RepositoryNode (org.talend.repository.model.RepositoryNode)10 IRepositoryNode (org.talend.repository.model.IRepositoryNode)9 Property (org.talend.core.model.properties.Property)6 TableItem (org.eclipse.swt.widgets.TableItem)5 IPath (org.eclipse.core.runtime.IPath)4 IEditorPart (org.eclipse.ui.IEditorPart)4 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)4 ProjectRepositoryNode (org.talend.core.repository.model.ProjectRepositoryNode)4 IProjectRepositoryNode (org.talend.repository.model.nodes.IProjectRepositoryNode)4 ArrayList (java.util.ArrayList)3 ISelection (org.eclipse.jface.viewers.ISelection)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 WizardDialog (org.eclipse.jface.wizard.WizardDialog)3 GridData (org.eclipse.swt.layout.GridData)3 Item (org.talend.core.model.properties.Item)3 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)3 IUIRefresher (org.talend.core.services.IUIRefresher)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 List (java.util.List)2