Search in sources :

Example 1 with MDMRepositoryView

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

the class MDMImportItemsWizardPage method exchangeImport.

protected void exchangeImport() {
    ImportExchangeOptionsDialog dlg = getExchangeOptionsDialog();
    dlg.setBlockOnOpen(true);
    if (dlg.open() == Window.OK) {
        File directory = new File(zipFileRepository.toString());
        File[] files = directory.listFiles(new FileFilter() {

            public boolean accept(File pathname) {
                // $NON-NLS-1$
                return pathname.getName().endsWith(".xsd");
            }
        });
        if (null != files && files.length > 0) {
            try {
                MDMRepositoryView view = MDMRepositoryView.show();
                for (File file : files) {
                    final String label = file.getName().substring(0, file.getName().lastIndexOf('.'));
                    final WSDataModelItem item = MdmpropertiesFactory.eINSTANCE.createWSDataModelItem();
                    ItemState itemState = PropertiesFactory.eINSTANCE.createItemState();
                    item.setState(itemState);
                    WSDataModelE dataModel = MdmserverobjectFactory.eINSTANCE.createWSDataModelE();
                    dataModel.setName(label);
                    InputStream stream = null;
                    try {
                        stream = new FileInputStream(file);
                        dataModel.setXsdSchema(IOUtils.toString(stream));
                        item.setWsDataModel(dataModel);
                    } catch (Exception e) {
                        log.error(e.getMessage());
                    }
                    IOUtils.closeQuietly(stream);
                    // $NON-NLS-1$
                    item.getState().setPath("");
                    RepositoryResourceUtil.createItem(item, label);
                    view.refreshRootNode(IServerObjectRepositoryType.TYPE_DATAMODEL);
                }
            } catch (Exception ex) {
                log.error(ex.getMessage());
            }
            WizardDialog dialog = (WizardDialog) getWizard().getContainer();
            dialog.close();
        } else {
            MessageDialog.openWarning(getShell(), null, Messages.NO_XSD_RESOURCE);
        }
    }
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) WSDataModelE(org.talend.mdm.repository.model.mdmserverobject.WSDataModelE) ImportExchangeOptionsDialog(com.amalto.workbench.dialogs.ImportExchangeOptionsDialog) FileInputStream(java.io.FileInputStream) WSDataModelItem(org.talend.mdm.repository.model.mdmproperties.WSDataModelItem) ItemState(org.talend.core.model.properties.ItemState) FileFilter(java.io.FileFilter) MDMRepositoryView(org.talend.mdm.repository.ui.navigator.MDMRepositoryView) File(java.io.File) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 2 with MDMRepositoryView

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

the class AbstractShowViewAction method showRepositoryView.

protected MDMRepositoryView showRepositoryView() throws PartInitException {
    IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    MDMRepositoryView findView = (MDMRepositoryView) activePage.findView(MDMRepositoryView.VIEW_ID);
    if (findView == null)
        findView = (MDMRepositoryView) activePage.showView(MDMRepositoryView.VIEW_ID);
    activePage.activate(findView);
    findView.setFocus();
    return findView;
}
Also used : IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) MDMRepositoryView(org.talend.mdm.repository.ui.navigator.MDMRepositoryView)

Example 3 with MDMRepositoryView

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

the class DeployAllLinkAction method doRun.

protected void doRun(IIntroSite site, Properties params) {
    IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    MDMRepositoryView findView = (MDMRepositoryView) activePage.findView(MDMRepositoryView.VIEW_ID);
    try {
        if (findView == null)
            findView = (MDMRepositoryView) activePage.showView(MDMRepositoryView.VIEW_ID);
        findView.setFocus();
        DeployAllAction deployAllAction = findView.getDeployAllAction();
        deployAllAction.runWithType(null);
    } catch (PartInitException e) {
        log.error(e.getMessage(), e);
    }
}
Also used : DeployAllAction(org.talend.mdm.repository.ui.actions.DeployAllAction) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException) MDMRepositoryView(org.talend.mdm.repository.ui.navigator.MDMRepositoryView)

Example 4 with MDMRepositoryView

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

the class ViewMainPage2 method deployAndRefresh.

private void deployAndRefresh() {
    DeployService deployService = DeployService.getInstance();
    if (!deployService.isAutoDeploy()) {
        autoDeployProcess(deployService);
        // refresh after deploy
        MDMRepositoryView view = MDMRepositoryView.show();
        if (view != null) {
            view.refreshRootNode(IServerObjectRepositoryType.TYPE_TRANSFORMERV2);
        }
    }
}
Also used : DeployService(org.talend.mdm.repository.core.service.DeployService) MDMRepositoryView(org.talend.mdm.repository.ui.navigator.MDMRepositoryView)

Example 5 with MDMRepositoryView

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

the class TransformerMainPage2 method deployAndRefresh.

private void deployAndRefresh() {
    DeployService deployService = DeployService.getInstance();
    if (!deployService.isAutoDeploy()) {
        editor2.autoDeployProcess(deployService);
        // refresh after deploy
        MDMRepositoryView view = MDMRepositoryView.show();
        if (view != null) {
            view.refreshRootNode(IServerObjectRepositoryType.TYPE_TRANSFORMERV2);
        }
    }
}
Also used : DeployService(org.talend.mdm.repository.core.service.DeployService) MDMRepositoryView(org.talend.mdm.repository.ui.navigator.MDMRepositoryView)

Aggregations

MDMRepositoryView (org.talend.mdm.repository.ui.navigator.MDMRepositoryView)6 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)2 PartInitException (org.eclipse.ui.PartInitException)2 DeployService (org.talend.mdm.repository.core.service.DeployService)2 ImportExchangeOptionsDialog (com.amalto.workbench.dialogs.ImportExchangeOptionsDialog)1 File (java.io.File)1 FileFilter (java.io.FileFilter)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 CommonViewer (org.eclipse.ui.navigator.CommonViewer)1 ItemState (org.talend.core.model.properties.ItemState)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 WSDataModelItem (org.talend.mdm.repository.model.mdmproperties.WSDataModelItem)1 WSDataModelE (org.talend.mdm.repository.model.mdmserverobject.WSDataModelE)1 DeployAllAction (org.talend.mdm.repository.ui.actions.DeployAllAction)1 NewDataModelAction (org.talend.mdm.repository.ui.actions.datamodel.NewDataModelAction)1