Search in sources :

Example 6 with Widget

use of org.eclipse.swt.widgets.Widget in project tdi-studio-se by Talend.

the class GenerateDocAsHTMLWizardPage method handleEvent.

@Override
public void handleEvent(Event e) {
    super.handleEvent(e);
    Widget source = e.widget;
    if (source instanceof Combo) {
        String destination = ((Combo) source).getText();
        if (getDialogSettings() != null) {
            IDialogSettings section = getDialogSettings().getSection(DESTINATION_FILE);
            if (section == null) {
                section = getDialogSettings().addNewSection(DESTINATION_FILE);
            }
            section.put(DESTINATION_FILE, destination);
        }
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) Widget(org.eclipse.swt.widgets.Widget) Combo(org.eclipse.swt.widgets.Combo)

Example 7 with Widget

use of org.eclipse.swt.widgets.Widget in project tdi-studio-se by Talend.

the class JavaJobScriptsExportWSWizardPage method handleEvent.

@Override
public void handleEvent(Event e) {
    super.handleEvent(e);
    Widget source = e.widget;
    if (source instanceof Combo) {
        String destination = ((Combo) source).getText();
        if (getDialogSettings() != null) {
            IDialogSettings section = getDialogSettings().getSection(DESTINATION_FILE);
            if (section == null) {
                section = getDialogSettings().addNewSection(DESTINATION_FILE);
            }
            section.put(DESTINATION_FILE, destination);
        }
        if (destination != null) {
            if (!destination.endsWith(getOutputSuffix())) {
                destination += getOutputSuffix();
            }
        }
    }
}
Also used : IDialogSettings(org.eclipse.jface.dialogs.IDialogSettings) Widget(org.eclipse.swt.widgets.Widget) Combo(org.eclipse.swt.widgets.Combo)

Example 8 with Widget

use of org.eclipse.swt.widgets.Widget in project tesb-studio-se by Talend.

the class JavaCamelJobScriptsExportWSWizardPage method createUnzipOptionGroup.

@Override
protected void createUnzipOptionGroup(Composite parent) {
    // options group
    Group optionsGroup = new Group(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    optionsGroup.setLayout(layout);
    optionsGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
    //$NON-NLS-1$
    optionsGroup.setText(Messages.getString("JavaJobScriptsExportWSWizardPage.BuildType"));
    optionsGroup.setLayout(new GridLayout(2, false));
    Label label = new Label(optionsGroup, SWT.NONE);
    //$NON-NLS-1$
    label.setText(Messages.getString("JavaJobScriptsExportWSWizardPage.BuildLabel"));
    exportTypeCombo = new Combo(optionsGroup, SWT.PUSH);
    // TESB-5328
    exportTypeCombo.add(EXPORTTYPE_KAR);
    if (PluginChecker.isTIS()) {
        exportTypeCombo.add(EXPORTTYPE_SPRING_BOOT);
    }
    // exportTypeCombo.setEnabled(false); // only can export kar file
    exportTypeCombo.setText(EXPORTTYPE_KAR);
    exportTypeCombo.addSelectionListener(new SelectionAdapter() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
             */
        @Override
        public void widgetSelected(SelectionEvent e) {
            Widget source = e.widget;
            if (source instanceof Combo) {
                String destination = ((Combo) source).getText();
                boolean isMS = destination.equals(EXPORTTYPE_SPRING_BOOT);
                if (isMS) {
                    contextButton.setEnabled(true);
                    exportAsZipButton.setEnabled(true);
                } else {
                    contextButton.setEnabled(false);
                    exportAsZipButton.setEnabled(false);
                }
                String destinationValue = getDestinationValue();
                if (isMS) {
                    if (exportAsZip || isAddMavenScript()) {
                        destinationValue = destinationValue.substring(0, destinationValue.lastIndexOf(".")) + FileConstants.ZIP_FILE_SUFFIX;
                    } else {
                        destinationValue = destinationValue.substring(0, destinationValue.lastIndexOf(".")) + FileConstants.JAR_FILE_SUFFIX;
                    }
                } else {
                    destinationValue = destinationValue.substring(0, destinationValue.lastIndexOf(".")) + getOutputSuffix();
                }
                setDestinationValue(destinationValue);
            }
        }
    });
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Widget(org.eclipse.swt.widgets.Widget) Combo(org.eclipse.swt.widgets.Combo)

Example 9 with Widget

use of org.eclipse.swt.widgets.Widget in project bndtools by bndtools.

the class BundleTree method createButtons.

private void createButtons(Composite parent) {
    GridLayout gridLayout = new GridLayout(3, false);
    gridLayout.marginWidth = 0;
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(gridLayout);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.grabExcessHorizontalSpace = true;
    composite.setLayoutData(gridData);
    showAll = new Button(composite, SWT.CHECK);
    showAll.setText(Messages.showAllPackages);
    showAll.setFont(getFont());
    showAll.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            Widget widget = event.widget;
            if (widget == showAll) {
                bundleTreeViewerProvider.setShowAll(!bundleTreeViewerProvider.isShowAll());
                infoTreeViewerProvider.setShowAll(!infoTreeViewerProvider.isShowAll());
                if (bundleTreeViewer.getInput() != null || infoViewer.getInput() != null) {
                    bundleTreeViewer.setSelection(null, false);
                    infoViewer.setSelection(null, false);
                    boolean showInfoView = showInfoView(bundleTreeViewer.getInput());
                    if (showInfoView) {
                        sashForm.setMaximizedControl(null);
                    } else {
                        sashForm.setMaximizedControl(bundleTreeViewerComposite);
                    }
                    bundleTreeViewer.refresh();
                    infoViewer.refresh();
                    sashForm.redraw();
                }
            }
        }
    });
    gridData = new GridData(SWT.END, SWT.CENTER, true, true);
    Label label = new Label(composite, SWT.NONE);
    label.setText(Messages.releaseOption);
    label.setLayoutData(gridData);
    options = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
    options.setItems(new String[] { Messages.updateVersionsAndRelease, Messages.updateVersions, Messages.release });
    options.add(Messages.comboSelectText, 0);
    options.select(0);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Widget(org.eclipse.swt.widgets.Widget) Label(org.eclipse.swt.widgets.Label) CCombo(org.eclipse.swt.custom.CCombo) Combo(org.eclipse.swt.widgets.Combo)

Example 10 with Widget

use of org.eclipse.swt.widgets.Widget in project translationstudio8 by heartsome.

the class MenuItemProviders method getNatEventData.

/**
	 * Walk up the MenuItems (in case they are nested) and find the parent {@link Menu}
	 *
	 * @param selectionEvent
	 *            on the {@link MenuItem}
	 * @return data associated with the parent {@link Menu}
	 */
public static NatEventData getNatEventData(SelectionEvent selectionEvent) {
    Widget widget = selectionEvent.widget;
    if (widget == null || !(widget instanceof MenuItem)) {
        return null;
    }
    MenuItem menuItem = (MenuItem) widget;
    Menu parentMenu = menuItem.getParent();
    Object data = null;
    while (parentMenu != null) {
        if (parentMenu.getData() == null) {
            parentMenu = parentMenu.getParentMenu();
        } else {
            data = parentMenu.getData();
            break;
        }
    }
    return data != null ? (NatEventData) data : null;
}
Also used : Widget(org.eclipse.swt.widgets.Widget) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu)

Aggregations

Widget (org.eclipse.swt.widgets.Widget)15 Combo (org.eclipse.swt.widgets.Combo)5 IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)3 Point (org.eclipse.swt.graphics.Point)3 GridData (org.eclipse.swt.layout.GridData)3 Composite (org.eclipse.swt.widgets.Composite)3 Menu (org.eclipse.swt.widgets.Menu)3 ToolItem (org.eclipse.swt.widgets.ToolItem)3 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 Rectangle (org.eclipse.swt.graphics.Rectangle)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Button (org.eclipse.swt.widgets.Button)2 Control (org.eclipse.swt.widgets.Control)2 Label (org.eclipse.swt.widgets.Label)2 TreeItem (org.eclipse.swt.widgets.TreeItem)2 ExecutionEvent (org.eclipse.core.commands.ExecutionEvent)1 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)1 MenuManager (org.eclipse.jface.action.MenuManager)1 ColumnViewerEditorActivationEvent (org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent)1