Search in sources :

Example 1 with MDMServerDefItem

use of org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem in project tmdm-studio-se by Talend.

the class ServerExplorer method reInputPassword.

private void reInputPassword() {
    List<IRepositoryViewObject> viewObjects = ServerDefService.getAllServerDefViewObjects();
    for (IRepositoryViewObject viewObj : viewObjects) {
        MDMServerDefItem serverDefItem = getMDMItem(viewObj);
        MDMServerDef serverDef = serverDefItem.getServerDef();
        if (serverDef.getPasswd().equals("")) {
            // $NON-NLS-1$
            MessageDialog.openInformation(null, Messages.ServerExplorer_WarningText, Messages.bind(Messages.Reinput_Password, serverDef.getName()));
            editServerDef(viewObj);
        }
    }
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MDMServerDefItem(org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 2 with MDMServerDefItem

use of org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem in project tmdm-studio-se by Talend.

the class ServerExplorer method createPartControl.

/**
 * Create contents of the view part.
 *
 * @param parent
 */
@Override
public void createPartControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(new FillLayout(SWT.HORIZONTAL));
    treeViewer = new TreeViewer(container, SWT.BORDER);
    treeViewer.setSorter(new ServerSorter());
    tree = treeViewer.getTree();
    tree.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDoubleClick(MouseEvent e) {
            IRepositoryViewObject viewObject = getCurSelectedViewObject();
            String name = null;
            if (viewObject != null) {
                MDMServerDefItem serverDefItem = getMDMItem(viewObject);
                name = serverDefItem.getServerDef().getName();
            }
            editServerDef();
        }
    });
    toolkit.paintBordersFor(tree);
    treeViewer.setContentProvider(new TreeContentProvider());
    treeViewer.setLabelProvider(new ViewerLabelProvider());
    initAdapter();
    initializeToolBar();
    initializeMenu();
    refreshServerDefs();
    reInputPassword();
}
Also used : TreeContentProvider(org.talend.mdm.workbench.serverexplorer.ui.providers.TreeContentProvider) ViewerLabelProvider(org.talend.mdm.workbench.serverexplorer.ui.providers.ViewerLabelProvider) MouseEvent(org.eclipse.swt.events.MouseEvent) Composite(org.eclipse.swt.widgets.Composite) TreeViewer(org.eclipse.jface.viewers.TreeViewer) MouseAdapter(org.eclipse.swt.events.MouseAdapter) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MDMServerDefItem(org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem) FillLayout(org.eclipse.swt.layout.FillLayout) ServerSorter(org.talend.mdm.workbench.serverexplorer.ui.providers.ServerSorter)

Example 3 with MDMServerDefItem

use of org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem in project tmdm-studio-se by Talend.

the class ServerExplorer method getMenuListener.

private IMenuListener getMenuListener() {
    return new IMenuListener() {

        public void menuAboutToShow(IMenuManager manager) {
            ISelection selection = treeViewer.getSelection();
            boolean isEmpty = selection.isEmpty();
            if (isEmpty) {
                manager.add(addServerDefAction);
            } else {
                addAllActions(manager);
                IRepositoryViewObject viewObject = getCurSelectedViewObject();
                if (viewObject != null) {
                    MDMServerDefItem mdmItem = getMDMItem(viewObject);
                    if (mdmItem != null) {
                        MDMServerDef serverDef = mdmItem.getServerDef();
                        manager.add(new Separator());
                        if (serverDef.isEnabled()) {
                            manager.add(toDisableServerAction);
                        } else {
                            manager.add(toEnableServerAction);
                        }
                    }
                }
            }
        }
    };
}
Also used : ISelection(org.eclipse.jface.viewers.ISelection) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MDMServerDefItem(org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuListener(org.eclipse.jface.action.IMenuListener) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef) Separator(org.eclipse.jface.action.Separator)

Example 4 with MDMServerDefItem

use of org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem in project tmdm-studio-se by Talend.

the class ServerDefRepositoryContentHandler method save.

public Resource save(Item item) throws PersistenceException {
    if (item instanceof MDMServerDefItem) {
        Resource resource = xmiResourceManager.getItemResource(item);
        resource.getContents().clear();
        resource.getContents().add(((MDMServerDefItem) item).getServerDef());
        return resource;
    }
    return null;
}
Also used : MDMServerDefItem(org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem) Resource(org.eclipse.emf.ecore.resource.Resource)

Example 5 with MDMServerDefItem

use of org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem in project tmdm-studio-se by Talend.

the class ServerDefRepositoryContentHandler method create.

public Resource create(IProject project, Item item, int classifierID, IPath path) throws PersistenceException {
    if (item instanceof MDMServerDefItem) {
        Resource itemResource = xmiResourceManager.createItemResource(project, item, path, ServerDefService.REPOSITORY_TYPE_SERVER_DEF, false);
        itemResource.getContents().add(((MDMServerDefItem) item).getServerDef());
        return itemResource;
    }
    return null;
}
Also used : MDMServerDefItem(org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem) Resource(org.eclipse.emf.ecore.resource.Resource)

Aggregations

MDMServerDefItem (org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem)15 MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)10 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)9 ArrayList (java.util.ArrayList)2 Resource (org.eclipse.emf.ecore.resource.Resource)2 TreeViewer (org.eclipse.jface.viewers.TreeViewer)2 FillLayout (org.eclipse.swt.layout.FillLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 PersistenceException (org.talend.commons.exception.PersistenceException)2 Item (org.talend.core.model.properties.Item)2 ServerDefDialog (org.talend.mdm.workbench.serverexplorer.ui.dialogs.ServerDefDialog)2 ServerSorter (org.talend.mdm.workbench.serverexplorer.ui.providers.ServerSorter)2 TreeContentProvider (org.talend.mdm.workbench.serverexplorer.ui.providers.TreeContentProvider)2 ViewerLabelProvider (org.talend.mdm.workbench.serverexplorer.ui.providers.ViewerLabelProvider)2 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)2 List (java.util.List)1 Path (org.eclipse.core.runtime.Path)1 IMenuListener (org.eclipse.jface.action.IMenuListener)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 Separator (org.eclipse.jface.action.Separator)1