Search in sources :

Example 1 with MDMRepositoryLabelProvider

use of org.talend.mdm.repository.ui.navigator.MDMRepositoryLabelProvider in project tmdm-studio-se by Talend.

the class RepositoryViewObjectCheckedWidget method installColumns.

private void installColumns() {
    treeViewer.getTree().setHeaderVisible(true);
    // 
    TreeViewerColumn nameColumn = new TreeViewerColumn(treeViewer, SWT.NONE);
    nameColumn.getColumn().setWidth(320);
    nameColumn.getColumn().setText(Messages.ConsistencyConflict_name);
    ILabelDecorator labelDecorator = RepositoryPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator();
    DecoratingStyledCellLabelProvider consistencyLabelProvider = new DecoratingStyledCellLabelProvider(new MDMRepositoryLabelProvider(), labelDecorator, null);
    nameColumn.setLabelProvider(consistencyLabelProvider);
    // compare result
    TreeViewerColumn resultColumn = new TreeViewerColumn(treeViewer, SWT.NONE);
    resultColumn.getColumn().setWidth(120);
    resultColumn.getColumn().setText(Messages.ConsistencyConflict_compareResult);
    resultColumn.setLabelProvider(new CompareResultColumnProvider());
    // 
    localTimeColumn = new TreeViewerColumn(treeViewer, SWT.NONE);
    localTimeColumn.getColumn().setText(Messages.ConsistencyConflict_retrievalTimestamp);
    localTimeColumn.setLabelProvider(new TimeStampColumnProvider(true));
    // 
    serverTimeColumn = new TreeViewerColumn(treeViewer, SWT.NONE);
    serverTimeColumn.getColumn().setText(Messages.ConsistencyConflict_serverTimestamp);
    serverTimeColumn.setLabelProvider(new TimeStampColumnProvider(false));
    // 
    showTimeStampColumns(false);
}
Also used : ILabelDecorator(org.eclipse.jface.viewers.ILabelDecorator) MDMRepositoryLabelProvider(org.talend.mdm.repository.ui.navigator.MDMRepositoryLabelProvider) DecoratingStyledCellLabelProvider(org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider) TreeViewerColumn(org.eclipse.jface.viewers.TreeViewerColumn)

Example 2 with MDMRepositoryLabelProvider

use of org.talend.mdm.repository.ui.navigator.MDMRepositoryLabelProvider in project tmdm-studio-se by Talend.

the class ConsistencyConflictDialog method installColumns.

private void installColumns() {
    treeViewer.getTree().setHeaderVisible(true);
    nameColumn = new TreeViewerColumn(treeViewer, SWT.NONE);
    nameColumn.getColumn().setWidth(320);
    nameColumn.getColumn().setText(Messages.ConsistencyConflict_name);
    ILabelDecorator labelDecorator = RepositoryPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator();
    DecoratingStyledCellLabelProvider consistencyLabelProvider = new DecoratingStyledCellLabelProvider(new MDMRepositoryLabelProvider(), labelDecorator, null) {

        @Override
        public Color getBackground(Object element) {
            IRepositoryViewObject viewObj = (IRepositoryViewObject) element;
            return getBackgroundColor(viewObj);
        }
    };
    nameColumn.setLabelProvider(consistencyLabelProvider);
    resultColumn = new TreeViewerColumn(treeViewer, SWT.NONE);
    resultColumn.getColumn().setWidth(120);
    resultColumn.getColumn().setText(Messages.ConsistencyConflict_compareResult);
    resultColumn.setLabelProvider(new CompareResultColumnProvider());
    // 
    operationColumn = new TreeViewerColumn(treeViewer, SWT.NONE);
    operationColumn.getColumn().setWidth(120);
    operationColumn.getColumn().setText(Messages.ConsistencyConflictDialog_Operation);
    operationColumn.setLabelProvider(new OperationProvider());
    // 
    localTimeColumn = new TreeViewerColumn(treeViewer, SWT.NONE);
    localTimeColumn.getColumn().setText(Messages.ConsistencyConflict_retrievalTimestamp);
    localTimeColumn.setLabelProvider(new TimeStampColumnProvider(true));
    // 
    serverTimeColumn = new TreeViewerColumn(treeViewer, SWT.NONE);
    serverTimeColumn.getColumn().setText(Messages.ConsistencyConflict_serverTimestamp);
    serverTimeColumn.setLabelProvider(new TimeStampColumnProvider(false));
    // 
    showTimeStampColumns(false);
}
Also used : ILabelDecorator(org.eclipse.jface.viewers.ILabelDecorator) MDMRepositoryLabelProvider(org.talend.mdm.repository.ui.navigator.MDMRepositoryLabelProvider) DecoratingStyledCellLabelProvider(org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject) TreeViewerColumn(org.eclipse.jface.viewers.TreeViewerColumn)

Example 3 with MDMRepositoryLabelProvider

use of org.talend.mdm.repository.ui.navigator.MDMRepositoryLabelProvider in project tmdm-studio-se by Talend.

the class RepositoryViewFilterDialog method createDialogArea.

/**
 * Create contents of the dialog.
 *
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    GridLayout gl_container = new GridLayout(1, false);
    gl_container.marginRight = 5;
    container.setLayout(gl_container);
    Group nameGroup = new Group(container, SWT.NONE);
    nameGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    GridLayout gl_nameGroup = new GridLayout(1, false);
    nameGroup.setLayout(gl_nameGroup);
    nameGroup.setText(Messages.RepositoryViewFilterDialog_groupNamePattern);
    enableNameFilterBun = new Button(nameGroup, SWT.CHECK);
    enableNameFilterBun.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            namePatternTxt.setEnabled(enableNameFilterBun.getSelection());
        }
    });
    enableNameFilterBun.setText(Messages.RepositoryViewFilterDialog_enableNameFilter);
    namePatternTxt = new Text(nameGroup, SWT.BORDER);
    namePatternTxt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    namePatternTxt.setSize(440, 18);
    objectgroup = new Group(container, SWT.NONE);
    objectgroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    objectgroup.setText(Messages.RepositoryViewFilterDialog_groupServerObject);
    objectgroup.setLayout(new GridLayout(1, false));
    enableServerObjFilterBun = new Button(objectgroup, SWT.CHECK);
    enableServerObjFilterBun.setSize(183, 16);
    enableServerObjFilterBun.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            enableServerObjFilterComposite(enableServerObjFilterBun.getSelection());
        }
    });
    enableServerObjFilterBun.setText(Messages.RepositoryViewFilterDialog_enableServerObjFilter);
    serverObjViewer = CheckboxTableViewer.newCheckList(objectgroup, SWT.BORDER | SWT.FULL_SELECTION);
    table = serverObjViewer.getTable();
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    table.setSize(441, 121);
    enableAllBun = new Button(objectgroup, SWT.CHECK);
    enableAllBun.setSize(171, 16);
    enableAllBun.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            boolean selected = enableAllBun.getSelection();
            enableAllBun.setSelection(selected);
            serverObjViewer.setAllChecked(selected);
            if (selected)
                enabledConfigs.addAll(allConfigs);
            else
                enabledConfigs.clear();
        }
    });
    enableAllBun.setText(Messages.RepositoryViewFilterDialog_enableAllServerObject);
    // 
    serverObjViewer.addCheckStateListener(new ICheckStateListener() {

        public void checkStateChanged(CheckStateChangedEvent event) {
            IRepositoryViewObject config = (IRepositoryViewObject) event.getElement();
            if (event.getChecked())
                enabledConfigs.add(config);
            else
                enabledConfigs.remove(config);
            solveProcTriCase();
            enableAllBun.setSelection(enabledConfigs.size() == allConfigs.size());
        }
    });
    serverObjViewer.setLabelProvider(new MDMRepositoryLabelProvider());
    serverObjViewer.setContentProvider(new ArrayContentProvider());
    Group lastServerGroup = new Group(container, SWT.NONE);
    lastServerGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    lastServerGroup.setLayout(new GridLayout(3, false));
    lastServerGroup.setText(Messages.RepositoryViewFilterDialog_groupLastServer);
    enableLastServerFilterBun = new Button(lastServerGroup, SWT.CHECK);
    enableLastServerFilterBun.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    enableLastServerFilterBun.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            enableLastServerFilterComposite(enableLastServerFilterBun.getSelection());
        }
    });
    enableLastServerFilterBun.setText(Messages.RepositoryViewFilterDialog_enableLastServerFilter);
    enableLastServerFilterBun.setSelection(false);
    new Label(lastServerGroup, SWT.NONE);
    lastServerLabel = new Label(lastServerGroup, SWT.NONE);
    lastServerLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    lastServerLabel.setText(Messages.RepositoryViewFilterDialog_lblLastServer);
    serverNameTxt = new Text(lastServerGroup, SWT.BORDER | SWT.READ_ONLY);
    serverNameTxt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    selServerBun = new Button(lastServerGroup, SWT.NONE);
    selServerBun.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            SelectServerDefDialog dlg = new SelectServerDefDialog(getShell());
            if (dlg.open() == IDialogConstants.OK_ID) {
                MDMServerDef def = dlg.getSelectedServerDef();
                serverNameTxt.setText(def.getName());
            }
        }
    });
    selServerBun.setText(Messages.RepositoryViewFilterDialog_btnSelectServer);
    // 
    getShell().setText(Messages.RepositoryViewFilterDialog_title);
    // 
    initServerObjectFilter();
    return container;
}
Also used : Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) MDMRepositoryLabelProvider(org.talend.mdm.repository.ui.navigator.MDMRepositoryLabelProvider) ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 4 with MDMRepositoryLabelProvider

use of org.talend.mdm.repository.ui.navigator.MDMRepositoryLabelProvider in project tmdm-studio-se by Talend.

the class LockedObjectDialog method createDialogArea.

/**
 * Create contents of the dialog.
 *
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) container.getLayout();
    gridLayout.marginHeight = 5;
    titleLabel = new Label(container, SWT.WRAP);
    GridData gd_titleLabel = new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1);
    gd_titleLabel.heightHint = 40;
    gd_titleLabel.verticalIndent = 5;
    titleLabel.setLayoutData(gd_titleLabel);
    if (mutliObjAlertMsg != null) {
        if (canContinueRestOperation()) {
            titleLabel.setText(mutliObjAlertMsg);
        } else {
            titleLabel.setText(singleObjAlertMsg);
        }
    }
    treeViewer = new TreeViewer(container, SWT.BORDER);
    Tree tree = treeViewer.getTree();
    GridData gd_tree = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_tree.verticalIndent = 5;
    tree.setLayoutData(gd_tree);
    treeViewer.setContentProvider(new TreeContentProvider());
    ILabelDecorator labelDecorator = RepositoryPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator();
    DecoratingLabelProvider labelProvider = new DecoratingLabelProvider(new MDMRepositoryLabelProvider(), labelDecorator);
    treeViewer.setLabelProvider(labelProvider);
    // init input
    treeViewer.setInput(lockedObjs);
    return container;
}
Also used : ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) ILabelDecorator(org.eclipse.jface.viewers.ILabelDecorator) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) MDMRepositoryLabelProvider(org.talend.mdm.repository.ui.navigator.MDMRepositoryLabelProvider) TreeViewer(org.eclipse.jface.viewers.TreeViewer) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) Tree(org.eclipse.swt.widgets.Tree) DecoratingLabelProvider(org.eclipse.jface.viewers.DecoratingLabelProvider)

Aggregations

MDMRepositoryLabelProvider (org.talend.mdm.repository.ui.navigator.MDMRepositoryLabelProvider)4 ILabelDecorator (org.eclipse.jface.viewers.ILabelDecorator)3 DecoratingStyledCellLabelProvider (org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider)2 TreeViewerColumn (org.eclipse.jface.viewers.TreeViewerColumn)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 Label (org.eclipse.swt.widgets.Label)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)1 CheckStateChangedEvent (org.eclipse.jface.viewers.CheckStateChangedEvent)1 DecoratingLabelProvider (org.eclipse.jface.viewers.DecoratingLabelProvider)1 ICheckStateListener (org.eclipse.jface.viewers.ICheckStateListener)1 ITreeContentProvider (org.eclipse.jface.viewers.ITreeContentProvider)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Button (org.eclipse.swt.widgets.Button)1 Group (org.eclipse.swt.widgets.Group)1 Text (org.eclipse.swt.widgets.Text)1