Search in sources :

Example 1 with ImportExchangeOptionsDialog

use of com.amalto.workbench.dialogs.ImportExchangeOptionsDialog in project tmdm-studio-se by Talend.

the class ImportItemsWizard method getExchangeOptionsDialog.

protected ImportExchangeOptionsDialog getExchangeOptionsDialog() {
    FormToolkit toolkit = WidgetFactory.getWidgetFactory();
    ImportExchangeOptionsDialog dlg = new ImportExchangeOptionsDialog(zipBtn.getShell(), toolkit, true, zipFileRepository);
    dlg.create();
    dlg.fillInTable();
    return dlg;
}
Also used : FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) ImportExchangeOptionsDialog(com.amalto.workbench.dialogs.ImportExchangeOptionsDialog)

Example 2 with ImportExchangeOptionsDialog

use of com.amalto.workbench.dialogs.ImportExchangeOptionsDialog 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 3 with ImportExchangeOptionsDialog

use of com.amalto.workbench.dialogs.ImportExchangeOptionsDialog in project tmdm-studio-se by Talend.

the class ImportItemsWizard method exchangeImport.

protected void exchangeImport() {
    ImportExchangeOptionsDialog dlg = getExchangeOptionsDialog();
    dlg.setBlockOnOpen(true);
    if (dlg.open() == Window.OK) {
        zip.getText().setText(zipFileRepository.toString());
        parse();
        checkUpExchangeImport(false);
    }
}
Also used : ImportExchangeOptionsDialog(com.amalto.workbench.dialogs.ImportExchangeOptionsDialog)

Example 4 with ImportExchangeOptionsDialog

use of com.amalto.workbench.dialogs.ImportExchangeOptionsDialog in project tmdm-studio-se by Talend.

the class MDMImportItemsWizardPage method getExchangeOptionsDialog.

protected ImportExchangeOptionsDialog getExchangeOptionsDialog() {
    FormToolkit toolkit = WidgetFactory.getWidgetFactory();
    ImportExchangeOptionsDialog dlg = new ImportExchangeOptionsDialogR(getShell(), toolkit, true, zipFileRepository);
    dlg.setRadioEnable(true);
    dlg.create();
    return dlg;
}
Also used : ImportExchangeOptionsDialogR(org.talend.mdm.repository.ui.dialogs.importexchange.ImportExchangeOptionsDialogR) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) ImportExchangeOptionsDialog(com.amalto.workbench.dialogs.ImportExchangeOptionsDialog)

Aggregations

ImportExchangeOptionsDialog (com.amalto.workbench.dialogs.ImportExchangeOptionsDialog)4 FormToolkit (org.eclipse.ui.forms.widgets.FormToolkit)2 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 ItemState (org.talend.core.model.properties.ItemState)1 WSDataModelItem (org.talend.mdm.repository.model.mdmproperties.WSDataModelItem)1 WSDataModelE (org.talend.mdm.repository.model.mdmserverobject.WSDataModelE)1 ImportExchangeOptionsDialogR (org.talend.mdm.repository.ui.dialogs.importexchange.ImportExchangeOptionsDialogR)1 MDMRepositoryView (org.talend.mdm.repository.ui.navigator.MDMRepositoryView)1