Search in sources :

Example 11 with ShellEvent

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

the class NatCombo method createDropdownControl.

private void createDropdownControl() {
    dropdownShell = new Shell(getShell(), SWT.MODELESS);
    dropdownShell.setLayout(new FillLayout());
    dropdownList = new List(dropdownShell, SWT.V_SCROLL | HorizontalAlignmentEnum.getSWTStyle(cellStyle));
    dropdownList.setBackground(cellStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR));
    dropdownList.setForeground(cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR));
    dropdownList.setFont(cellStyle.getAttributeValue(CellStyleAttributes.FONT));
    dropdownShell.addShellListener(new ShellAdapter() {

        @Override
        public void shellClosed(ShellEvent event) {
            text.forceFocus();
        }
    });
    dropdownList.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            if (dropdownList.getSelectionCount() > 0) {
                text.setText(dropdownList.getSelection()[0]);
            }
        }
    });
    setItems(items);
    dropdownList.setSelection(new String[] { text.getText() });
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ShellAdapter(org.eclipse.swt.events.ShellAdapter) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ShellEvent(org.eclipse.swt.events.ShellEvent) List(org.eclipse.swt.widgets.List) FillLayout(org.eclipse.swt.layout.FillLayout)

Example 12 with ShellEvent

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

the class FindReplaceDialog method createContents.

/**
	 * Create contents.
	 * 
	 * @param parent of Composite.
	 * @return the contents of dialog.
	 */
protected Control createContents(Composite parent) {
    Control result = super.createContents(parent);
    readConfiguration();
    this.getShell().addShellListener(new ShellAdapter() {

        public void shellDeactivated(ShellEvent event) {
            FindReplaceDialog.this.updateButtons();
        }

        public void shellActivated(ShellEvent event) {
            FindReplaceDialog.this.updateButtons();
        }
    });
    getShell().setText(Messages.findReplaceDialogTitle);
    setSelectedText();
    return result;
}
Also used : Control(org.eclipse.swt.widgets.Control) ShellAdapter(org.eclipse.swt.events.ShellAdapter) ShellEvent(org.eclipse.swt.events.ShellEvent)

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