Search in sources :

Example 6 with RepositoryObject

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

the class StatusManagerSettingPage method refreshCheckedTreeView.

private void refreshCheckedTreeView() {
    List<RepositoryNode> nodes = new ArrayList<RepositoryNode>();
    for (TableItem item : itemTable.getItems()) {
        Object data = item.getData();
        if (data instanceof RepositoryObject) {
            nodes.add((RepositoryNode) ((RepositoryObject) data).getRepositoryNode());
        }
    }
    treeViewer.setCheckedElements(nodes.toArray());
// treeViewer.refresh();
}
Also used : RepositoryObject(org.talend.core.model.repository.RepositoryObject) TableItem(org.eclipse.swt.widgets.TableItem) ArrayList(java.util.ArrayList) RepositoryObject(org.talend.core.model.repository.RepositoryObject) 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)

Example 7 with RepositoryObject

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

the class StatusManagerSettingPage method okPressed.

protected void okPressed() {
    if (statusCombo == null) {
        return;
    }
    boolean modified = false;
    String newStatus = null;
    if (getModifiedVersionItems().size() > 0) {
        newStatus = statusHelper.getStatusCode(statusCombo.getText());
    }
    for (RepositoryObject object : getModifiedVersionItems()) {
        if (!isFixedstatus()) {
            newStatus = object.getStatusCode();
        }
        if (object != null && object.getProperty() != null) {
            if (!newStatus.equals(object.getProperty().getOldStatusCode())) {
                isApplied = false;
                modified = true;
                break;
            }
        }
    }
    if (modified) {
        boolean confirm = false;
        if (isFixedstatus()) {
            confirm = //$NON-NLS-1$
            MessageDialog.openConfirm(//$NON-NLS-1$
            getShell(), //$NON-NLS-1$
            Messages.getString("VersionManagementDialog.ConfirmTitle"), //$NON-NLS-1$
            Messages.getString("VersionManagementDialog.ConfirmMessage", newStatus));
            if (confirm) {
                // set all items for new version
                for (RepositoryObject object : getModifiedVersionItems()) {
                    if (techinalButton.getSelection()) {
                        ERepositoryObjectType type = object.getRepositoryNode().getContentType();
                        if (!type.equals(ERepositoryObjectType.DOCUMENTATION) && !type.equals(ERepositoryObjectType.BUSINESS_PROCESS)) {
                            object.setStatusCode(newStatus);
                        }
                    } else {
                        ERepositoryObjectType type = object.getRepositoryNode().getContentType();
                        if (type.equals(ERepositoryObjectType.DOCUMENTATION) || type.equals(ERepositoryObjectType.BUSINESS_PROCESS)) {
                            object.setStatusCode(newStatus);
                        }
                    }
                }
            }
        } else {
            StatusConfirmSettingDialog chanedDialog = new StatusConfirmSettingDialog(getShell(), getModifiedVersionItems(), statusHelper);
            confirm = (chanedDialog.open() == Window.OK);
        }
        if (confirm) {
            updateItemsVersion();
        }
    } else {
        if (!getModifiedVersionItems().isEmpty() && !isApplied) {
            //$NON-NLS-1$
            MessageDialog.openWarning(//$NON-NLS-1$
            getShell(), //$NON-NLS-1$
            Messages.getString("VersionManagementDialog.WarningTitle"), //$NON-NLS-1$
            Messages.getString("VersionManagementDialog.WarningMessages"));
        }
    }
}
Also used : RepositoryObject(org.talend.core.model.repository.RepositoryObject) StatusConfirmSettingDialog(org.talend.repository.ui.dialog.StatusConfirmSettingDialog) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType)

Example 8 with RepositoryObject

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

the class StatusManagerSettingPage method updateItemsVersion.

private void updateItemsVersion() {
    IRunnableWithProgress runnable = new IRunnableWithProgress() {

        @Override
        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            //$NON-NLS-1$
            monitor.beginTask("", getModifiedVersionItems().size() * 100);
            Set<ERepositoryObjectType> types = new HashSet<ERepositoryObjectType>();
            for (RepositoryObject object : getModifiedVersionItems()) {
                // IRepositoryViewObject repositoryObject = object.getRepositoryNode().getObject();
                if (object != null && object.getProperty() != null) {
                    if (object.getStatusCode().equals(object.getProperty().getStatusCode())) {
                        final Item item = object.getProperty().getItem();
                        item.getProperty().setOldStatusCode(object.getStatusCode());
                        // types.add(object.getRepositoryNode().getObjectType());
                        try {
                            // }
                            if (object != null) {
                                // obj.setVersion(object.getNewVersion());
                                FACTORY.save(project, object.getProperty());
                            } else {
                            // FACTORY.save(project, item.getProperty());
                            }
                        } catch (PersistenceException e) {
                            ExceptionHandler.process(e);
                        }
                    }
                }
                monitor.worked(100);
            }
            // RepositoryManager.refresh(types);
            monitor.done();
        }
    };
    // final ProgressMonitorJobsDialog dialog = new ProgressMonitorJobsDialog(null);
    final ProgressMonitorDialog dialog = new ProgressMonitorDialog(null);
    try {
        dialog.run(false, false, runnable);
    } catch (InvocationTargetException e) {
        ExceptionHandler.process(e);
    } catch (InterruptedException e) {
        ExceptionHandler.process(e);
    }
}
Also used : Item(org.talend.core.model.properties.Item) TableItem(org.eclipse.swt.widgets.TableItem) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) RepositoryObject(org.talend.core.model.repository.RepositoryObject) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) PersistenceException(org.talend.commons.exception.PersistenceException) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) HashSet(java.util.HashSet)

Example 9 with RepositoryObject

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

the class OpenExistVersionProcessAction method doRun.

@Override
protected void doRun() {
    ISelection selection = getSelection();
    Object obj = ((IStructuredSelection) selection).getFirstElement();
    RepositoryNode node = (RepositoryNode) obj;
    IPath path = RepositoryNodeUtilities.getPath(node);
    String originalName = node.getObject().getLabel();
    RepositoryObject repositoryObj = new RepositoryObject(node.getObject().getProperty());
    repositoryObj.setRepositoryNode(node.getObject().getRepositoryNode());
    OpenExistVersionProcessWizard wizard = new OpenExistVersionProcessWizard(repositoryObj);
    WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
    dialog.setPageSize(300, 250);
    //$NON-NLS-1$
    dialog.setTitle(Messages.getString("OpenExistVersionProcess.open.dialog"));
    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 : IPath(org.eclipse.core.runtime.IPath) RepositoryObject(org.talend.core.model.repository.RepositoryObject) OpenExistVersionProcessWizard(org.talend.designer.core.ui.wizards.OpenExistVersionProcessWizard) ISelection(org.eclipse.jface.viewers.ISelection) RepositoryObject(org.talend.core.model.repository.RepositoryObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) 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 10 with RepositoryObject

use of org.talend.core.model.repository.RepositoryObject 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)

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