Search in sources :

Example 6 with DefaultToolTip

use of org.eclipse.jface.window.DefaultToolTip in project azure-tools-for-java by Microsoft.

the class WebAppDeployDialog method createSlotGroup.

private void createSlotGroup(Composite container) {
    ScrolledComposite scrolledComposite = new ScrolledComposite(container, SWT.V_SCROLL);
    scrolledComposite.setLayout(new FillLayout(SWT.HORIZONTAL));
    GridData gdGrpSlot = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gdGrpSlot.heightHint = 140;
    scrolledComposite.setLayoutData(gdGrpSlot);
    Group grpSlot = new Group(scrolledComposite, SWT.NONE);
    grpSlot.setLayout(new FillLayout(SWT.HORIZONTAL));
    grpSlot.setLayoutData(gdGrpSlot);
    grpSlot.setText("Deployment Slot");
    Composite compositeSlot = new Composite(grpSlot, SWT.NONE);
    compositeSlot.setLayout(new GridLayout(2, false));
    RowLayout rowLayout = new RowLayout();
    rowLayout.marginLeft = 0;
    rowLayout.marginTop = 0;
    rowLayout.marginRight = 0;
    rowLayout.marginBottom = 0;
    Composite compositeSlotCb = new Composite(compositeSlot, SWT.LEFT);
    compositeSlotCb.setLayout(rowLayout);
    btnDeployToSlot = new Button(compositeSlotCb, SWT.CHECK);
    btnDeployToSlot.setSelection(false);
    btnDeployToSlot.setText("Deploy to Slot");
    btnDeployToSlot.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            radioSlotLogic();
            fillSlot();
        }
    });
    DefaultToolTip iconTooltip = new DefaultToolTip(btnDeployToSlot, SWT.NONE, false);
    iconTooltip.setText(DEPLOYMENT_SLOT_HOVER);
    btnDeployToSlot.addFocusListener(new FocusListener() {

        @Override
        public void focusGained(FocusEvent e) {
            iconTooltip.show(new Point(btnDeployToSlot.getSize().x, 0));
        }

        @Override
        public void focusLost(FocusEvent e) {
            iconTooltip.hide();
        }
    });
    new Label(compositeSlot, SWT.NONE);
    btnSlotUseExisting = new Button(compositeSlot, SWT.RADIO);
    btnSlotUseExisting.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            radioSlotLogic();
        }
    });
    btnSlotUseExisting.setSelection(true);
    btnSlotUseExisting.setText("Use existing");
    comboSlot = new Combo(compositeSlot, SWT.READ_ONLY);
    AccessibilityUtils.addAccessibilityNameForUIComponent(comboSlot, "Existing deployment slot");
    comboSlot.setEnabled(false);
    comboSlot.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    comboSlot.setBounds(0, 0, 26, 22);
    comboSlot.addFocusListener(new FocusAdapter() {

        @Override
        public void focusGained(FocusEvent e) {
            cleanError();
        }
    });
    decComboSlot = decorateContorolAndRegister(comboSlot);
    btnSlotCreateNew = new Button(compositeSlot, SWT.RADIO);
    btnSlotCreateNew.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            radioSlotLogic();
        }
    });
    btnSlotCreateNew.setText("Create new");
    textSlotName = new Text(compositeSlot, SWT.BORDER);
    textSlotName.addFocusListener(new FocusAdapter() {

        @Override
        public void focusGained(FocusEvent e) {
            cleanError();
        }
    });
    AccessibilityUtils.addAccessibilityNameForUIComponent(textSlotName, "New depoyment slot");
    textSlotName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    textSlotName.setBounds(0, 0, 64, 19);
    textSlotName.setMessage("Slot Name");
    textSlotName.setText("slot-" + date);
    textSlotName.setEnabled(false);
    decTextSlotName = decorateContorolAndRegister(textSlotName);
    lblSlotConf = new Label(compositeSlot, SWT.NONE);
    lblSlotConf.setEnabled(false);
    GridData gdLblSlotConf = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gdLblSlotConf.horizontalIndent = 20;
    lblSlotConf.setLayoutData(gdLblSlotConf);
    lblSlotConf.setText("Clone settings from");
    comboSlotConf = new Combo(compositeSlot, SWT.READ_ONLY);
    comboSlotConf.setEnabled(false);
    comboSlotConf.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    comboSlotConf.setBounds(0, 0, 26, 22);
    comboSlotConf.addFocusListener(new FocusAdapter() {

        @Override
        public void focusGained(FocusEvent e) {
            cleanError();
        }
    });
    AccessibilityUtils.addAccessibilityNameForUIComponent(comboSlotConf, "Deployment slot configuration source");
    decComboSlotConf = decorateContorolAndRegister(comboSlotConf);
    scrolledComposite.setContent(grpSlot);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setMinSize(grpSlot.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    fillSlot();
    radioSlotLogic();
}
Also used : Group(org.eclipse.swt.widgets.Group) FocusAdapter(org.eclipse.swt.events.FocusAdapter) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) DefaultToolTip(org.eclipse.jface.window.DefaultToolTip) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) Text(org.eclipse.swt.widgets.Text) FillLayout(org.eclipse.swt.layout.FillLayout) Point(org.eclipse.swt.graphics.Point) FocusEvent(org.eclipse.swt.events.FocusEvent) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) RowLayout(org.eclipse.swt.layout.RowLayout) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) FocusListener(org.eclipse.swt.events.FocusListener)

Example 7 with DefaultToolTip

use of org.eclipse.jface.window.DefaultToolTip in project jbosstools-openshift by jbosstools.

the class WebHooksComponent method notifyCopied.

private void notifyCopied(final Text uriText) {
    DefaultToolTip copiedNotification = new DefaultToolTip(uriText, ToolTip.NO_RECREATE, true);
    copiedNotification.setText("Webhook copied to clipboard");
    copiedNotification.setHideDelay(COPIED_NOTIFICATION_SHOW_DURATION);
    copiedNotification.show(uriText.getLocation());
    copiedNotification.deactivate();
}
Also used : DefaultToolTip(org.eclipse.jface.window.DefaultToolTip)

Aggregations

DefaultToolTip (org.eclipse.jface.window.DefaultToolTip)7 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)4 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 Point (org.eclipse.swt.graphics.Point)3 FocusAdapter (org.eclipse.swt.events.FocusAdapter)2 FocusEvent (org.eclipse.swt.events.FocusEvent)2 FillLayout (org.eclipse.swt.layout.FillLayout)2 Button (org.eclipse.swt.widgets.Button)2 Combo (org.eclipse.swt.widgets.Combo)2 Composite (org.eclipse.swt.widgets.Composite)2 Group (org.eclipse.swt.widgets.Group)2 Label (org.eclipse.swt.widgets.Label)2 Binding (org.eclipse.core.databinding.Binding)1 IObservableValue (org.eclipse.core.databinding.observable.value.IObservableValue)1 MultiValidator (org.eclipse.core.databinding.validation.MultiValidator)1 IStatus (org.eclipse.core.runtime.IStatus)1 ObservableListContentProvider (org.eclipse.jface.databinding.viewers.ObservableListContentProvider)1 ComboViewer (org.eclipse.jface.viewers.ComboViewer)1 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 StyledText (org.eclipse.swt.custom.StyledText)1