Search in sources :

Example 1 with XmlMapEditor

use of org.talend.designer.xmlmap.editor.XmlMapEditor in project tdi-studio-se by Talend.

the class MapperUI method createWindow.

public Shell createWindow(final Display display) {
    Shell activeShell = display.getActiveShell();
    int style = SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX | SWT.APPLICATION_MODAL | SWT.RESIZE;
    if (activeShell == null) {
        mapperShell = new Shell(mapperShell, style);
    } else {
        mapperShell = new Shell(activeShell, style);
    }
    mapperShell.addShellListener(new ShellListener() {

        @Override
        public void shellActivated(ShellEvent e) {
        }

        @Override
        public void shellClosed(ShellEvent e) {
            if (editor != null && editor.isDirty() && !closeWithoutPrompt) {
                boolean closeWindow = MessageDialog.openConfirm(mapperShell, "Close without save", Messages.getString("MapperUI.CloseWindow.Message"));
                if (!closeWindow) {
                    e.doit = false;
                } else {
                    prepareClosing(SWT.CANCEL);
                }
            }
        }

        @Override
        public void shellDeactivated(ShellEvent e) {
        }

        @Override
        public void shellDeiconified(ShellEvent e) {
        }

        @Override
        public void shellIconified(ShellEvent e) {
        }
    });
    mapperShell.setMaximized(true);
    mapperShell.setImage(CoreImageProvider.getComponentIcon(mapperComponent.getComponent(), ICON_SIZE.ICON_32));
    IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    String productName = brandingService.getFullProductName();
    mapperShell.setText(productName + " - " + mapperComponent.getComponent().getName() + " - " + //$NON-NLS-1$
    mapperComponent.getUniqueName());
    GridLayout parentLayout = new GridLayout(1, true);
    mapperShell.setLayout(parentLayout);
    // Composite composite = new Composite(mapperShell, SWT.NONE);
    // composite.setBackground(display.getSystemColor(SWT.COLOR_YELLOW));
    mainSashForm = new SashForm(mapperShell, SWT.SMOOTH | SWT.VERTICAL);
    GridData mainSashFormGridData = new GridData(GridData.FILL_BOTH);
    mainSashForm.setLayoutData(mainSashFormGridData);
    datasViewSashForm = new SashForm(mainSashForm, SWT.SMOOTH | SWT.HORIZONTAL | SWT.BORDER);
    editor = new XmlMapEditor(mapperManager);
    editor.createPartControl(datasViewSashForm);
    if (copyOfMapData.getVarTables().isEmpty()) {
        VarTable varTable1 = XmlmapFactory.eINSTANCE.createVarTable();
        varTable1.setName("Var");
        varTable1.setMinimized(true);
        copyOfMapData.getVarTables().add(varTable1);
    }
    editor.setContent(copyOfMapData);
    tabFolderEditors = new TabFolderEditors(mainSashForm, mapperManager, SWT.BORDER);
    // selectFirstInOutTree();
    mainSashForm.setWeights(new int[] { 70, 30 });
    footerComposite = new FooterComposite(mapperShell, this);
    footerComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mapperShell.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            ColorProviderMapper.releaseColors();
            FontProviderMapper.releaseFonts();
            ImageProviderMapper.releaseImages();
        }
    });
    editor.makeDefaultSelection();
    mapperShell.open();
    return mapperShell;
}
Also used : TabFolderEditors(org.talend.designer.xmlmap.ui.tabs.TabFolderEditors) DisposeListener(org.eclipse.swt.events.DisposeListener) FooterComposite(org.talend.designer.xmlmap.ui.footer.FooterComposite) ShellEvent(org.eclipse.swt.events.ShellEvent) IBrandingService(org.talend.core.ui.branding.IBrandingService) DisposeEvent(org.eclipse.swt.events.DisposeEvent) XmlMapEditor(org.talend.designer.xmlmap.editor.XmlMapEditor) VarTable(org.talend.designer.xmlmap.model.emf.xmlmap.VarTable) SashForm(org.eclipse.swt.custom.SashForm) Shell(org.eclipse.swt.widgets.Shell) GridLayout(org.eclipse.swt.layout.GridLayout) ShellListener(org.eclipse.swt.events.ShellListener) GridData(org.eclipse.swt.layout.GridData)

Aggregations

SashForm (org.eclipse.swt.custom.SashForm)1 DisposeEvent (org.eclipse.swt.events.DisposeEvent)1 DisposeListener (org.eclipse.swt.events.DisposeListener)1 ShellEvent (org.eclipse.swt.events.ShellEvent)1 ShellListener (org.eclipse.swt.events.ShellListener)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Shell (org.eclipse.swt.widgets.Shell)1 IBrandingService (org.talend.core.ui.branding.IBrandingService)1 XmlMapEditor (org.talend.designer.xmlmap.editor.XmlMapEditor)1 VarTable (org.talend.designer.xmlmap.model.emf.xmlmap.VarTable)1 FooterComposite (org.talend.designer.xmlmap.ui.footer.FooterComposite)1 TabFolderEditors (org.talend.designer.xmlmap.ui.tabs.TabFolderEditors)1