Search in sources :

Example 6 with SelectServerDefDialog

use of org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog in project tmdm-studio-se by Talend.

the class OpenObjectAction method openServerDialog.

/**
 * return a decrypted server def
 *
 * @param serverObject
 * @return a decrypted server def
 */
public MDMServerDef openServerDialog(MDMServerDef serverObject) {
    SelectServerDefDialog dlg = new SelectServerDefDialog(getShell());
    dlg.create();
    dlg.setSelectServer(serverObject);
    if (dlg.open() == IDialogConstants.OK_ID) {
        MDMServerDef serverDef = dlg.getSelectedServerDef();
        return serverDef;
    }
    return null;
}
Also used : SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 7 with SelectServerDefDialog

use of org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog in project tmdm-studio-se by Talend.

the class DeployToLastServerAction method doRun.

@Override
protected void doRun() {
    boolean checkMissingJar = MissingJarService.getInstance().checkMissingJar(true);
    if (!checkMissingJar) {
        return;
    }
    List<IRepositoryViewObject> viewObjs = getSelectedRepositoryViewObject();
    if (exAdapter != null) {
        viewObjs = exAdapter.showDependencyConfigDialog(viewObjs);
        if (viewObjs == null) {
            return;
        }
        // TO add match rule object
        viewObjs = getSelectedRepositoryViewObject(viewObjs);
        filterMatchRuleObjs(viewObjs);
    }
    LockedDirtyObjectDialog lockDirtyDialog = new LockedDirtyObjectDialog(getShell(), Messages.AbstractDeployAction_promptToSaveEditors, viewObjs);
    if (lockDirtyDialog.needShowDialog() && lockDirtyDialog.open() == IDialogConstants.CANCEL_ID) {
        return;
    }
    lockDirtyDialog.saveDirtyObjects();
    // 
    MDMServerDef currentServerDef = getLastServer(viewObjs);
    // handle last server is null case
    boolean isLostedServer = false;
    if (currentServerDef == null) {
        isLostedServer = true;
        boolean isDeployToAnother = MessageDialog.openQuestion(getShell(), null, Messages.DeployToLastServerAction_askReselectServerMsg);
        if (isDeployToAnother) {
            SelectServerDefDialog dialog = new SelectServerDefDialog(getShell());
            if (dialog.open() == IDialogConstants.OK_ID) {
                currentServerDef = dialog.getSelectedServerDef();
            } else {
                return;
            }
        } else {
            return;
        }
    }
    // check last server
    if (!currentServerDef.isEnabled()) {
        MessageDialog.openWarning(Display.getDefault().getActiveShell(), null, Messages.DeployService_CanNotDeployToDisabledServer);
        return;
    }
    // deploy
    IStatus status = deploy(currentServerDef, viewObjs, ICommand.CMD_MODIFY);
    if (status.getSeverity() != IStatus.CANCEL) {
        if (status.isMultiStatus()) {
            showDeployStatus(status);
        }
        if (isLostedServer) {
            updateLastServer(status, new NullProgressMonitor());
        }
        DeployService.getInstance().updateChangedStatus(status, false);
        for (IRepositoryViewObject viewObject : viewObjs) {
            commonViewer.refresh(viewObject);
        }
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IStatus(org.eclipse.core.runtime.IStatus) LockedDirtyObjectDialog(org.talend.mdm.repository.ui.dialogs.lock.LockedDirtyObjectDialog) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 8 with SelectServerDefDialog

use of org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog 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 9 with SelectServerDefDialog

use of org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog in project tmdm-studio-se by Talend.

the class BrowseViewAction method doRun.

@Override
protected void doRun() {
    Object obj = getSelectedObject().get(0);
    if (obj instanceof IRepositoryViewObject) {
        IRepositoryViewObject viewObject = (IRepositoryViewObject) obj;
        WSViewItem item = (WSViewItem) viewObject.getProperty().getItem();
        WSViewE wsView = item.getWsView();
        MDMServerDef lastServerDef = RepositoryResourceUtil.getLastServerDef(item);
        SelectServerDefDialog dlg = new SelectServerDefDialog(getShell());
        dlg.create();
        dlg.setSelectServer(lastServerDef);
        if (dlg.open() == IDialogConstants.OK_ID) {
            ViewBrowserInput input = new ViewBrowserInput(viewObject);
            input.setServerDef(dlg.getSelectedServerDef());
            if (page == null) {
                page = commonViewer.getCommonNavigator().getSite().getWorkbenchWindow().getActivePage();
            }
            try {
                IEditorPart oldEditor = page.findEditor(input);
                if (oldEditor != null) {
                    page.closeEditor(oldEditor, false);
                }
                page.openEditor(input, XObjectBrowser2.EDITOR_ID);
            } catch (PartInitException e) {
                log.error(e.getMessage(), e);
            }
        }
    }
}
Also used : WSViewItem(org.talend.mdm.repository.model.mdmproperties.WSViewItem) ViewBrowserInput(org.talend.mdm.repository.ui.editors.ViewBrowserInput) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) WSViewE(org.talend.mdm.repository.model.mdmserverobject.WSViewE) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 10 with SelectServerDefDialog

use of org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog in project tmdm-studio-se by Talend.

the class MDMEventManagerAction method getServerDef.

private MDMServerDef getServerDef() {
    if (mdmServerDef != null) {
        return mdmServerDef;
    }
    SelectServerDefDialog dlg = new SelectServerDefDialog(getShell());
    dlg.create();
    if (dlg.open() == IDialogConstants.OK_ID) {
        return dlg.getSelectedServerDef();
    }
    return null;
}
Also used : SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog)

Aggregations

SelectServerDefDialog (org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog)17 MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)15 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)10 IStatus (org.eclipse.core.runtime.IStatus)5 XtentisException (com.amalto.workbench.utils.XtentisException)3 TMDMService (com.amalto.workbench.webservices.TMDMService)3 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)3 LockedDirtyObjectDialog (org.talend.mdm.repository.ui.dialogs.lock.LockedDirtyObjectDialog)3 WSPing (com.amalto.workbench.webservices.WSPing)2 File (java.io.File)2 WebServiceException (javax.xml.ws.WebServiceException)2 MultiStatus (org.eclipse.core.runtime.MultiStatus)2 FileDialog (org.eclipse.swt.widgets.FileDialog)2 CommandManager (org.talend.mdm.repository.core.command.CommandManager)2 ICommand (org.talend.mdm.repository.core.command.ICommand)2 AbstractDeployCommand (org.talend.mdm.repository.core.command.deploy.AbstractDeployCommand)2 IDataContentProcess (org.talend.mdm.repository.core.datacontent.IDataContentProcess)2 DataClusterService (org.talend.mdm.repository.core.service.DataClusterService)2 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1