Search in sources :

Example 6 with ShellEvent

use of org.eclipse.swt.events.ShellEvent 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)

Example 7 with ShellEvent

use of org.eclipse.swt.events.ShellEvent in project cubrid-manager by CUBRID.

the class TuneModeResultWindow method open.

public void open() {
    shell = new Shell(SWT.RESIZE | SWT.DIALOG_TRIM | SWT.MAX | SWT.MIN);
    shell.setLayout(new GridLayout());
    shell.setLayoutData(new GridData(GridData.FILL_BOTH));
    shell.setText(Messages.lblTuneModeResult);
    shell.setImage(CommonUIPlugin.getImage("icons/queryeditor/tune_mode.png"));
    shell.setSize(800, 600);
    shell.setMaximized(true);
    tuneModeResult = new TuneModeResultComposite(shell, SWT.NONE);
    tuneModeResult.setLayout(new GridLayout());
    tuneModeResult.setLayoutData(new GridData(GridData.FILL_BOTH));
    tuneModeResult.initialize();
    DatabaseInfo databaseInfo = (editor == null || editor.getSelectedDatabase() == null) ? null : editor.getSelectedDatabase().getDatabaseInfo();
    tuneModeResult.setDatabaseInfo(databaseInfo);
    shell.addShellListener(new ShellListener() {

        public void shellIconified(ShellEvent e) {
            editor.hideTuneModeResult();
        }

        public void shellDeiconified(ShellEvent e) {
        }

        public void shellDeactivated(ShellEvent e) {
        }

        public void shellClosed(ShellEvent e) {
            disposed = true;
            if (tuneModeResult != null && !tuneModeResult.isDisposed()) {
                tuneModeResult.dispose();
                tuneModeResult = null;
            }
            if (shell != null && !shell.isDisposed()) {
                shell.dispose();
                shell.close();
            }
        }

        public void shellActivated(ShellEvent e) {
        }
    });
    shell.open();
}
Also used : Shell(org.eclipse.swt.widgets.Shell) GridLayout(org.eclipse.swt.layout.GridLayout) DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) ShellListener(org.eclipse.swt.events.ShellListener) GridData(org.eclipse.swt.layout.GridData) ShellEvent(org.eclipse.swt.events.ShellEvent)

Example 8 with ShellEvent

use of org.eclipse.swt.events.ShellEvent in project bndtools by bndtools.

the class JpmDependencyWizardPage method createControl.

@Override
@SuppressWarnings("unused")
public void createControl(Composite parent) {
    // CREATE CONTROLS
    Composite container = new Composite(parent, SWT.NULL);
    setControl(container);
    Label lblDirect = new Label(container, SWT.NONE);
    lblDirect.setFont(JFaceResources.getBannerFont());
    lblDirect.setText("Direct Dependencies:");
    Table tblDirect = new Table(container, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL);
    viewerDirect = new TableViewer(tblDirect);
    viewerDirect.setContentProvider(ArrayContentProvider.getInstance());
    viewerDirect.setLabelProvider(new ResourceDescriptorLabelProvider());
    createHelpLabel(container, "The above dependencies will be added to the project and, if necessary, to the JPM4J local index.");
    Label separator = new Label(container, SWT.SEPARATOR | SWT.HORIZONTAL);
    Label lblIndirect = new Label(container, SWT.NONE);
    lblIndirect.setFont(JFaceResources.getBannerFont());
    lblIndirect.setText("Transitive Dependencies:");
    Composite cmpIndirect = new Composite(container, SWT.NONE);
    Table tblIndirect = new Table(cmpIndirect, SWT.CHECK | SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL);
    viewerIndirect = new CheckboxTableViewer(tblIndirect);
    viewerIndirect.setContentProvider(ArrayContentProvider.getInstance());
    viewerIndirect.setLabelProvider(new ResourceDescriptorLabelProvider());
    Button btnSelectAll = new Button(cmpIndirect, SWT.PUSH);
    btnSelectAll.setText("All");
    Button btnSelectNone = new Button(cmpIndirect, SWT.PUSH);
    btnSelectNone.setText("None");
    new Label(cmpIndirect, SWT.NONE);
    createHelpLabel(container, "The above dependencies will be added to the JPM4J local index. Checked dependencies will also be added directly to the project.");
    // LISTENERS
    // Query JPM and show results *after* dialog is shown. This ensures progress is visible in the dialog's
    // progress bar
    getContainer().getShell().addShellListener(new ShellAdapter() {

        @Override
        public void shellActivated(ShellEvent e) {
            runQuery();
        }
    });
    viewerIndirect.addCheckStateListener(new ICheckStateListener() {

        @Override
        public void checkStateChanged(CheckStateChangedEvent ev) {
            if (selectedIndirectResources == null)
                selectedIndirectResources = new HashSet<ResourceDescriptor>();
            ResourceDescriptor resource = (ResourceDescriptor) ev.getElement();
            if (ev.getChecked())
                selectedIndirectResources.add(resource);
            else
                selectedIndirectResources.remove(resource);
        }
    });
    btnSelectAll.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            selectedIndirectResources.addAll(indirectResources);
            updateSelectedCheckboxes();
        }
    });
    btnSelectNone.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            selectedIndirectResources.clear();
            updateSelectedCheckboxes();
        }
    });
    viewerDirect.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            ISelection sel = event.getSelection();
            if (sel.isEmpty())
                selection = (ResourceDescriptor) ((IStructuredSelection) viewerIndirect.getSelection()).getFirstElement();
            else
                selection = (ResourceDescriptor) ((IStructuredSelection) sel).getFirstElement();
            getContainer().updateMessage();
        }
    });
    viewerIndirect.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            ISelection sel = event.getSelection();
            if (sel.isEmpty())
                selection = (ResourceDescriptor) ((IStructuredSelection) viewerDirect.getSelection()).getFirstElement();
            else
                selection = (ResourceDescriptor) ((IStructuredSelection) sel).getFirstElement();
            getContainer().updateMessage();
        }
    });
    // LAYOUT
    GridLayout layout;
    GridData gd;
    layout = new GridLayout(1, true);
    container.setLayout(layout);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    gd.heightHint = 30;
    tblDirect.setLayoutData(gd);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    separator.setLayoutData(gd);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    cmpIndirect.setLayoutData(gd);
    layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = 2;
    layout.verticalSpacing = 2;
    cmpIndirect.setLayout(layout);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 3);
    gd.heightHint = 100;
    tblIndirect.setLayoutData(gd);
    gd = new GridData(SWT.FILL, SWT.FILL, false, false);
    btnSelectAll.setLayoutData(gd);
    gd = new GridData(SWT.FILL, SWT.FILL, false, false);
    btnSelectNone.setLayoutData(gd);
}
Also used : ShellAdapter(org.eclipse.swt.events.ShellAdapter) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer) ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Label(org.eclipse.swt.widgets.Label) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ISelection(org.eclipse.jface.viewers.ISelection) GridData(org.eclipse.swt.layout.GridData) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) CheckboxTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer) ResourceDescriptor(aQute.bnd.service.repository.SearchableRepository.ResourceDescriptor)

Example 9 with ShellEvent

use of org.eclipse.swt.events.ShellEvent in project translationstudio8 by heartsome.

the class TermDbManagerDialog method configureShell.

@Override
protected void configureShell(Shell newShell) {
    super.configureShell(newShell);
    newShell.setText(Messages.getString("dialog.TermDbManagerDialog.title"));
    newShell.addShellListener(new ShellAdapter() {

        public void shellActivated(ShellEvent e) {
            if (lastShellSize == null) {
                lastShellSize = getShell().getSize();
            }
        }
    });
}
Also used : ShellAdapter(org.eclipse.swt.events.ShellAdapter) ShellEvent(org.eclipse.swt.events.ShellEvent)

Example 10 with ShellEvent

use of org.eclipse.swt.events.ShellEvent in project translationstudio8 by heartsome.

the class ColumnStyleEditorDialog method initComponents.

@Override
protected void initComponents(final Shell shell) {
    shell.setLayout(new GridLayout());
    shell.setText("Customize style");
    // Closing the window is the same as canceling the form
    shell.addShellListener(new ShellAdapter() {

        @Override
        public void shellClosed(ShellEvent e) {
            doFormCancel(shell);
        }
    });
    // Tabs panel
    Composite tabPanel = new Composite(shell, SWT.NONE);
    tabPanel.setLayout(new GridLayout());
    GridData fillGridData = new GridData();
    fillGridData.grabExcessHorizontalSpace = true;
    fillGridData.horizontalAlignment = GridData.FILL;
    tabPanel.setLayoutData(fillGridData);
    CTabFolder tabFolder = new CTabFolder(tabPanel, SWT.BORDER);
    tabFolder.setLayout(new GridLayout());
    tabFolder.setLayoutData(fillGridData);
    CTabItem columnTab = new CTabItem(tabFolder, SWT.NONE);
    columnTab.setText("Column");
    columnTab.setImage(GUIHelper.getImage("column"));
    columnTab.setControl(createColumnPanel(tabFolder));
    try {
        cellStyleEditorPanel.edit(columnStyle);
        borderStyleEditorPanel.edit(columnStyle.getAttributeValue(CellStyleAttributes.BORDER_STYLE));
    } catch (Exception e) {
        e.printStackTrace(System.err);
    }
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ShellAdapter(org.eclipse.swt.events.ShellAdapter) CTabFolder(org.eclipse.swt.custom.CTabFolder) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) ShellEvent(org.eclipse.swt.events.ShellEvent) CTabItem(org.eclipse.swt.custom.CTabItem)

Aggregations

ShellEvent (org.eclipse.swt.events.ShellEvent)12 ShellAdapter (org.eclipse.swt.events.ShellAdapter)9 GridData (org.eclipse.swt.layout.GridData)5 GridLayout (org.eclipse.swt.layout.GridLayout)5 Shell (org.eclipse.swt.widgets.Shell)5 ShellListener (org.eclipse.swt.events.ShellListener)3 Composite (org.eclipse.swt.widgets.Composite)3 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 IBrandingService (org.talend.core.ui.branding.IBrandingService)2 ResourceDescriptor (aQute.bnd.service.repository.SearchableRepository.ResourceDescriptor)1 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)1 InteractionFigure (edu.cmu.cs.hcii.cogtool.view.InteractionFigure)1 CheckStateChangedEvent (org.eclipse.jface.viewers.CheckStateChangedEvent)1 CheckboxTableViewer (org.eclipse.jface.viewers.CheckboxTableViewer)1 ICheckStateListener (org.eclipse.jface.viewers.ICheckStateListener)1 ISelection (org.eclipse.jface.viewers.ISelection)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1