Search in sources :

Example 1 with RepositoryViewObjectCheckedWidget

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

the class DeployAllDialog method createDialogArea.

/**
 * Create contents of the dialog.
 *
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    mainContainer = (Composite) super.createDialogArea(parent);
    GridLayout mainContainerLayout = (GridLayout) mainContainer.getLayout();
    mainContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    mainContainerLayout.numColumns = 2;
    Label lblNewLabel_selserver = new Label(mainContainer, SWT.NONE);
    lblNewLabel_selserver.setText(Messages.DeployAllDialog_label_selectserver);
    lblNewLabel_selserver.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
    errorLabel = new Label(mainContainer, SWT.NONE);
    errorLabelLayoutData = new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1);
    errorLabelLayoutData.exclude = true;
    errorLabel.setLayoutData(errorLabelLayoutData);
    errorLabel.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_RED));
    comboViewer = new ComboViewer(mainContainer, SWT.DROP_DOWN | SWT.READ_ONLY);
    Combo combo = comboViewer.getCombo();
    GridData data = new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1);
    combo.setLayoutData(data);
    comboViewer.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            MDMServerDef serverDef = (MDMServerDef) element;
            // $NON-NLS-1$ //$NON-NLS-2$;
            return serverDef.getName() + " (" + serverDef.getHost() + ")";
        }
    });
    comboViewer.setContentProvider(new ArrayContentProvider());
    Label emptyLabel = new Label(mainContainer, SWT.NONE);
    GridData emptydata = new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1);
    emptydata.widthHint = 98;
    emptyLabel.setLayoutData(emptydata);
    List<MDMServerDef> allServerDefs = ServerDefService.getAllServerDefs();
    comboViewer.setInput(allServerDefs);
    comboViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            serverDef = (MDMServerDef) ((IStructuredSelection) comboViewer.getSelection()).getFirstElement();
            treeViewer.updateCurrentServerDef(null, serverDef);
            updateErrorMsgArea(treeViewer.isServerOk());
        }
    });
    final Button reconciliationBun = new Button(mainContainer, SWT.CHECK);
    reconciliationBun.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            treeViewer.enableReconciliation(reconciliationBun.getSelection());
        }
    });
    reconciliationBun.setText(Messages.DeployAllDialog_reconciliation);
    reconciliationBun.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
    Composite container = new Composite(mainContainer, SWT.BORDER);
    container.setLayout(new GridLayout(2, false));
    container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
    Label lblNewLabel = new Label(container, SWT.NONE);
    lblNewLabel.setText(Messages.DeployAllDialog_label);
    new Label(container, SWT.NONE);
    List<AbstractDeployCommand> commands = CommandManager.getInstance().getAllDeployCommands();
    treeViewer = new RepositoryViewObjectCheckedWidget(container, initType, commands);
    treeViewer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 3));
    Button selAllButton = new Button(container, SWT.NONE);
    selAllButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            treeViewer.selectAll(true);
        }
    });
    selAllButton.setText(Messages.DeployAllDialog_selectAll);
    Button deselAllBun = new Button(container, SWT.NONE);
    deselAllBun.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
    deselAllBun.setText(Messages.DeployAllDialog_deselectAll);
    deselAllBun.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            treeViewer.selectAll(false);
        }
    });
    Button skipDeployedBun = new Button(container, SWT.NONE);
    skipDeployedBun.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
    skipDeployedBun.setText(Messages.DeployAllDialog_skipDeployed);
    skipDeployedBun.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            treeViewer.skipDeployedObjects();
        }
    });
    initComboSelect();
    return container;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) RepositoryViewObjectCheckedWidget(org.talend.mdm.repository.ui.widgets.RepositoryViewObjectCheckedWidget) GridLayout(org.eclipse.swt.layout.GridLayout) ComboViewer(org.eclipse.jface.viewers.ComboViewer) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) AbstractDeployCommand(org.talend.mdm.repository.core.command.deploy.AbstractDeployCommand) LabelProvider(org.eclipse.jface.viewers.LabelProvider) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Aggregations

ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)1 ComboViewer (org.eclipse.jface.viewers.ComboViewer)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 LabelProvider (org.eclipse.jface.viewers.LabelProvider)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Combo (org.eclipse.swt.widgets.Combo)1 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 AbstractDeployCommand (org.talend.mdm.repository.core.command.deploy.AbstractDeployCommand)1 MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)1 RepositoryViewObjectCheckedWidget (org.talend.mdm.repository.ui.widgets.RepositoryViewObjectCheckedWidget)1