List of usage examples for org.eclipse.jface.layout LayoutConstants getSpacing
public static final Point getSpacing()
From source file:cn.dockerfoundry.ide.eclipse.server.ui.internal.wizards.MappedURLsWizardPage.java
License:Open Source License
public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(2).spacing(10, LayoutConstants.getSpacing().y) .applyTo(composite);//from w w w . j a v a2s . c om Label label = new Label(composite, SWT.NONE); label.setText(Messages.MappedURLsWizardPage_LABEL_APP_URI); GridDataFactory.fillDefaults().span(2, 1).applyTo(label); Table table = new Table(composite, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER); GridDataFactory.fillDefaults().grab(true, true).applyTo(table); viewer = new TableViewer(table); viewer.setContentProvider(new URIsContentProvider()); viewer.setInput(urls); viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); removeButton.setEnabled(!selection.isEmpty()); editButton.setEnabled(!selection.isEmpty() && selection instanceof IStructuredSelection && ((IStructuredSelection) selection).toArray().length == 1); } }); Composite buttonComposite = new Composite(composite, SWT.NONE); GridLayoutFactory.fillDefaults().margins(0, 0).applyTo(buttonComposite); GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.FILL).applyTo(buttonComposite); addButton = new Button(buttonComposite, SWT.PUSH); addButton.setText(Messages.COMMONTXT_ADD); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(false, false).applyTo(addButton); addButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ApplicationURLWizard wizard = new ApplicationURLWizard(cloudServer, null); WizardDialog dialog = new WizardDialog(addButton.getShell(), wizard); if (dialog.open() == Dialog.OK) { String newURI = wizard.getUrl(); urls.add(newURI); update(); } } }); editButton = new Button(buttonComposite, SWT.PUSH); editButton.setText(Messages.COMMONTXT_EDIT); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(false, false).applyTo(editButton); editButton.setEnabled(false); editButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection selection = (IStructuredSelection) viewer.getSelection(); String url = (String) selection.getFirstElement(); ApplicationURLWizard wizard = new ApplicationURLWizard(cloudServer, url); WizardDialog dialog = new WizardDialog(addButton.getShell(), wizard); if (dialog.open() == Dialog.OK) { String newURI = wizard.getUrl(); urls.remove(url); urls.add(newURI); update(); } } }); removeButton = new Button(buttonComposite, SWT.PUSH); removeButton.setText(Messages.COMMONTXT_REMOVE); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(false, false).applyTo(addButton); removeButton.setEnabled(false); removeButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection selection = (IStructuredSelection) viewer.getSelection(); Object[] selectedURLs = selection.toArray(); for (Object selectedURL : selectedURLs) { urls.remove(selectedURL); update(); } } }); Dialog.applyDialogFont(composite); setControl(composite); }
From source file:com.aptana.ide.ui.secureftp.dialogs.CommonFTPConnectionPointPropertyDialog.java
License:Open Source License
@Override protected void createPasswordSection(Composite parent) { keyAuthComposite = new Composite(parent, SWT.NONE); keyAuthComposite.setLayoutData(GridDataFactory.fillDefaults().span(3, 1).grab(true, false).create()); makeVisible(keyAuthComposite, false); keyAuthComposite.setLayout(/* ww w . j a v a 2 s .co m*/ GridLayoutFactory.fillDefaults().spacing(LayoutConstants.getSpacing().x, 0).numColumns(2).create()); /* row 1 */ Label label = new Label(keyAuthComposite, SWT.NONE); label.setLayoutData(GridDataFactory.swtDefaults() .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(IDialogConstants.LABEL_WIDTH), SWT.DEFAULT) .create()); keyAuthButton = new Button(keyAuthComposite, SWT.CHECK); keyAuthButton.setLayoutData(GridDataFactory.fillDefaults().create()); keyAuthButton.setText("Use &Public Key Authentication"); /* row 2 */ label = new Label(keyAuthComposite, SWT.NONE); label.setLayoutData(GridDataFactory.swtDefaults() .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(IDialogConstants.LABEL_WIDTH), SWT.DEFAULT) .create()); keyPathLabel = new Label(keyAuthComposite, SWT.NONE); keyPathLabel.setLayoutData(GridDataFactory.fillDefaults().create()); keyPathLabel.setFont(smallFont); keyPathLabel.setText("No Private Key selected"); super.createPasswordSection(parent); updateKeyAuth(); /* -- */ keyAuthButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { changeKeyAuthentication(); } }); }
From source file:com.aptana.ui.secureftp.internal.CommonFTPConnectionPropertyComposite.java
License:Open Source License
@Override protected void createPasswordSection(Composite parent) { keyAuthComposite = new Composite(parent, SWT.NONE); keyAuthComposite.setLayoutData(GridDataFactory.fillDefaults().span(3, 1).grab(true, false).create()); makeVisible(keyAuthComposite, false); keyAuthComposite.setLayout(/*from w w w . ja v a 2 s . c o m*/ GridLayoutFactory.fillDefaults().spacing(LayoutConstants.getSpacing().x, 0).numColumns(2).create()); /* row 1 */ Label label = new Label(keyAuthComposite, SWT.NONE); label.setLayoutData(GridDataFactory.swtDefaults() .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(IDialogConstants.LABEL_WIDTH), SWT.DEFAULT) .create()); keyAuthButton = new Button(keyAuthComposite, SWT.CHECK); keyAuthButton.setLayoutData(GridDataFactory.fillDefaults().create()); keyAuthButton.setText(Messages.CommonFTPConnectionPointPropertyDialog_UsePublicKeyAuthentication); /* row 2 */ label = new Label(keyAuthComposite, SWT.NONE); label.setLayoutData(GridDataFactory.swtDefaults() .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(IDialogConstants.LABEL_WIDTH), SWT.DEFAULT) .create()); keyPathLabel = new Label(keyAuthComposite, SWT.NONE); keyPathLabel.setLayoutData(GridDataFactory.fillDefaults().create()); keyPathLabel.setFont(smallFont); keyPathLabel.setText(Messages.CommonFTPConnectionPointPropertyDialog_NoPrivateKeySelected); super.createPasswordSection(parent); updateKeyAuth(); /* -- */ keyAuthButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { changeKeyAuthentication(); validate(); } }); }
From source file:com.cisco.yangide.ext.model.editor.preferences.ModelEditorPreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { Composite pageArea = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(3).spacing(LayoutConstants.getSpacing().x, 3).applyTo(pageArea); Label label = new Label(pageArea, SWT.NONE); label.setText("Diagram Editor Font: "); GridDataFactory.swtDefaults().align(SWT.BEGINNING, SWT.TOP).span(1, 3).applyTo(label); preview = new Label(pageArea, SWT.BORDER | SWT.SHADOW_NONE); GridDataFactory.fillDefaults().grab(true, false).span(1, 2).applyTo(preview); Button editBtn = new Button(pageArea, SWT.PUSH); GridDataFactory.fillDefaults().hint(100, SWT.DEFAULT).applyTo(editBtn); editBtn.setText("Edit..."); editBtn.addSelectionListener(new SelectionAdapter() { @Override/* w w w . j a v a2s. c o m*/ public void widgetSelected(SelectionEvent e) { FontDialog dialog = new FontDialog(getShell()); dialog.setFontList(fontData); FontData fd = dialog.open(); if (fd != null) { fontData = new FontData[] { fd }; update(); } } }); Button systemBtn = new Button(pageArea, SWT.PUSH); GridDataFactory.fillDefaults().hint(100, SWT.DEFAULT).applyTo(systemBtn); systemBtn.setText("Use System Font"); systemBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { fontData = JFaceResources.getDefaultFont().getFontData(); update(); } }); Composite note = createNoteComposite(JFaceResources.getDialogFont(), pageArea, "Note: ", "Changing the font does not update open editors."); GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(note); Dialog.applyDialogFont(pageArea); load(); return pageArea; }
From source file:net.tourbook.photo.internal.preferences.PrefPagePhotoDirectory.java
License:Open Source License
private void createUI_10_Colors(final Composite parent) { final Group colorGroup = new Group(parent, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(colorGroup); GridLayoutFactory.fillDefaults()// .margins(5, 5).spacing(30, LayoutConstants.getSpacing().y).numColumns(2).applyTo(colorGroup); colorGroup.setText(Messages.PrefPage_Photo_Viewer_Group_Colors); {/*from ww w. j a v a 2s. co m*/ final Composite containerLeft = new Composite(colorGroup, SWT.NONE); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).applyTo(containerLeft); { // color: foreground addField(new ColorFieldEditor(IPhotoPreferences.PHOTO_VIEWER_COLOR_FOREGROUND, Messages.PrefPage_Photo_Viewer_Label_ForgroundColor, containerLeft)); // color: background addField(new ColorFieldEditor(IPhotoPreferences.PHOTO_VIEWER_COLOR_BACKGROUND, Messages.PrefPage_Photo_Viewer_Label_BackgroundColor, containerLeft)); // color: selection forground addField(new ColorFieldEditor(IPhotoPreferences.PHOTO_VIEWER_COLOR_SELECTION_FOREGROUND, Messages.PrefPage_Photo_Viewer_Label_SelectionForegroundColor, containerLeft)); } final Composite containerFileFolder = new Composite(colorGroup, SWT.NONE); { /* * checkbox: show file/folder number */ final BooleanFieldEditor2 chkEditorIsShowFileFolder = new BooleanFieldEditor2( IPhotoPreferences.PHOTO_VIEWER_IS_SHOW_FILE_FOLDER, Messages.PrefPage_Photo_Viewer_Checkbox_ShowNumbersInFolderView, containerFileFolder); addField(chkEditorIsShowFileFolder); _chkIsShowFileFolder = chkEditorIsShowFileFolder.getChangeControl(containerFileFolder); GridDataFactory.fillDefaults()// .span(2, 1).applyTo(_chkIsShowFileFolder); _chkIsShowFileFolder.setToolTipText(// Messages.PrefPage_Photo_Viewer_Checkbox_ShowNumbersInFolderView_Tooltip); _chkIsShowFileFolder.addSelectionListener(_viewerUISelectionListener); { /* * color: folder */ _colorEditorFolder = new ColorFieldEditor(IPhotoPreferences.PHOTO_VIEWER_COLOR_FOLDER, Messages.PrefPage_Photo_Viewer_Label_FolderColor, containerFileFolder); addField(_colorEditorFolder); // indent label _lblFolderColor = _colorEditorFolder.getLabelControl(containerFileFolder); GridData gd = (GridData) _lblFolderColor.getLayoutData(); gd.horizontalIndent = 16; /* * color: file */ _colorEditorFile = new ColorFieldEditor(IPhotoPreferences.PHOTO_VIEWER_COLOR_FILE, Messages.PrefPage_Photo_Viewer_Label_FileColor, containerFileFolder); addField(_colorEditorFile); // indent label _lblFileColor = _colorEditorFile.getLabelControl(containerFileFolder); gd = (GridData) _lblFileColor.getLayoutData(); gd.horizontalIndent = 16; } } } }
From source file:net.tourbook.preferences.PrefPageAppearanceView.java
License:Open Source License
private void createUI10Colors(final Composite parent) { final Group colorGroup = new Group(parent, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(colorGroup); GridLayoutFactory.fillDefaults()// .margins(5, 5).spacing(30, LayoutConstants.getSpacing().y).numColumns(2).applyTo(colorGroup); colorGroup.setText(Messages.pref_view_layout_label_color_group); {//ww w . j a va 2s . co m final Composite containerDefaultView = new Composite(colorGroup, SWT.NONE); { // color: tag category addField(new ColorFieldEditor(ITourbookPreferences.VIEW_LAYOUT_COLOR_CATEGORY, Messages.pref_view_layout_label_category, containerDefaultView)); // color: tag addField(new ColorFieldEditor(ITourbookPreferences.VIEW_LAYOUT_COLOR_TITLE, // Messages.pref_view_layout_label_title, containerDefaultView)); // color: sub tag (year) addField(new ColorFieldEditor(ITourbookPreferences.VIEW_LAYOUT_COLOR_SUB, Messages.pref_view_layout_label_sub, containerDefaultView)); // color: sub sub tag (month) addField(new ColorFieldEditor(ITourbookPreferences.VIEW_LAYOUT_COLOR_SUB_SUB, Messages.pref_view_layout_label_sub_sub, containerDefaultView)); } final Composite containerSegmenter = new Composite(colorGroup, SWT.NONE); GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(containerSegmenter); GridLayoutFactory.fillDefaults().numColumns(2).applyTo(containerSegmenter); { // color: up addField(new ColorFieldEditor(ITourbookPreferences.VIEW_LAYOUT_COLOR_BG_SEGMENTER_UP, Messages.pref_view_layout_label_segmenter_up, containerSegmenter)); // color: down addField(new ColorFieldEditor(ITourbookPreferences.VIEW_LAYOUT_COLOR_BG_SEGMENTER_DOWN, Messages.pref_view_layout_label_segmenter_down, containerSegmenter)); // show lines final BooleanFieldEditor2 editorLines = new BooleanFieldEditor2( ITourbookPreferences.VIEW_LAYOUT_DISPLAY_LINES, Messages.pref_view_layout_display_lines, containerSegmenter); addField(editorLines); final GridLayout gl = (GridLayout) containerSegmenter.getLayout(); gl.numColumns = 2; final Button editorLinesControl = editorLines.getChangeControl(containerSegmenter); GridDataFactory.fillDefaults().span(2, 1).indent(0, 10).applyTo(editorLinesControl); editorLinesControl.setToolTipText(Messages.pref_view_layout_display_lines_Tooltip); } } }
From source file:net.tourbook.preferences.PrefPageMap3Color.java
License:Open Source License
private Composite createUI(final Composite parent) { final Composite container = new Composite(parent, SWT.NONE); GridDataFactory.fillDefaults().grab(true, true).applyTo(container); GridLayoutFactory.fillDefaults()// .spacing(LayoutConstants.getSpacing().x, 2).numColumns(2).applyTo(container); // container.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW)); {//from www . ja v a 2 s.co m createUI_10_Title(container); createUI_20_ColorViewer_Container(container); createUI_30_Actions(container); createUI_40_Options(container); } return container; }
From source file:net.tourbook.preferences.PrefPageViewColors.java
License:Open Source License
private void createUI10Colors(final Composite parent) { final Group colorGroup = new Group(parent, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(colorGroup); GridLayoutFactory.fillDefaults()// .margins(5, 5).spacing(30, LayoutConstants.getSpacing().y).numColumns(2).applyTo(colorGroup); colorGroup.setText(Messages.pref_view_layout_label_color_group); {/*from w w w . j a v a 2 s .c o m*/ final Composite containerDefaultView = new Composite(colorGroup, SWT.NONE); { // color: tag category addField(new ColorFieldEditor(ITourbookPreferences.VIEW_LAYOUT_COLOR_CATEGORY, Messages.pref_view_layout_label_category, containerDefaultView)); // color: tag addField(new ColorFieldEditor(ITourbookPreferences.VIEW_LAYOUT_COLOR_TITLE, // Messages.pref_view_layout_label_title, containerDefaultView)); // color: sub tag (year) addField(new ColorFieldEditor(ITourbookPreferences.VIEW_LAYOUT_COLOR_SUB, Messages.pref_view_layout_label_sub, containerDefaultView)); // color: sub sub tag (month) addField(new ColorFieldEditor(ITourbookPreferences.VIEW_LAYOUT_COLOR_SUB_SUB, Messages.pref_view_layout_label_sub_sub, containerDefaultView)); } final Composite containerSegmenter = new Composite(colorGroup, SWT.NONE); GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).applyTo(containerSegmenter); GridLayoutFactory.fillDefaults().numColumns(2).applyTo(containerSegmenter); { // show lines final BooleanFieldEditor2 editorLines = new BooleanFieldEditor2( ITourbookPreferences.VIEW_LAYOUT_DISPLAY_LINES, Messages.pref_view_layout_display_lines, containerSegmenter); addField(editorLines); final GridLayout gl = (GridLayout) containerSegmenter.getLayout(); gl.numColumns = 2; final Button editorLinesControl = editorLines.getChangeControl(containerSegmenter); GridDataFactory.fillDefaults().span(2, 1).indent(0, 10).applyTo(editorLinesControl); editorLinesControl.setToolTipText(Messages.pref_view_layout_display_lines_Tooltip); } } }
From source file:net.tourbook.preferences.PrefPageViews.java
License:Open Source License
private void createUI_30_ViewTooltip(final Composite parent) { final Group group = new Group(parent, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(group); group.setText(Messages.PrefPage_ViewTooltip_Group); GridLayoutFactory.swtDefaults().applyTo(group); {/*from ww w . ja v a2s . c om*/ final Label label = new Label(group, SWT.WRAP); label.setText(Messages.PrefPage_ViewTooltip_Label_Info); GridDataFactory.fillDefaults().span(6, 1).hint(400, SWT.DEFAULT).applyTo(label); final Composite container = new Composite(group, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).indent(0, 5).applyTo(container); GridLayoutFactory.fillDefaults().spacing(20, LayoutConstants.getSpacing().y).numColumns(6) .applyTo(container); { createUI_31_ToolTip_TourImport(container); createUI_33_ToolTip_TourBook(container); createUI_35_ToolTip_CollateTour(container); createUI_37_ToolTip_Tagging(container); createUI_39_ToolTip_TourCatalog(container); } createUI39ToolTipActions(group); } }
From source file:net.tourbook.tour.filter.TimeDuration.java
License:Open Source License
/** * @param parent//from w w w . j av a 2 s. co m * @param isShowUnit */ public TimeDuration(final Composite parent, final boolean isShowUnit) { int numColumns = 0; final Composite container = new Composite(parent, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(container); { { /* * Spinner: Hour */ _spinHours = new Spinner(container, SWT.BORDER); _spinHours.setMinimum(-1); _spinHours.setMaximum(24); _spinHours.addSelectionListener(_selectionListener); _spinHours.addMouseWheelListener(_mouseWheelListener); GridDataFactory.fillDefaults()// .align(SWT.BEGINNING, SWT.CENTER).applyTo(_spinHours); numColumns++; } { /* * Spinner: Minute */ _spinMinutes = new Spinner(container, SWT.BORDER); _spinMinutes.setMinimum(-1); _spinMinutes.setMaximum(60); _spinMinutes.addSelectionListener(_selectionListener); _spinMinutes.addMouseWheelListener(_mouseWheelListener); GridDataFactory.fillDefaults()// .align(SWT.BEGINNING, SWT.CENTER).applyTo(_spinMinutes); numColumns++; } { /* * Spinner: Second */ _spinSeconds = new Spinner(container, SWT.BORDER); _spinSeconds.setMinimum(-1); _spinSeconds.setMaximum(60); _spinSeconds.addSelectionListener(_selectionListener); _spinSeconds.addMouseWheelListener(_mouseWheelListener); GridDataFactory.fillDefaults()// .align(SWT.BEGINNING, SWT.CENTER).applyTo(_spinSeconds); numColumns++; } { /* * Label: Unit */ if (isShowUnit) { final Label label = new Label(container, SWT.NONE); label.setText(Messages.App_Unit_HHMMSS); GridDataFactory.fillDefaults()// .align(SWT.FILL, SWT.CENTER).indent(LayoutConstants.getSpacing().x, 0).applyTo(label); numColumns++; } } } GridLayoutFactory.fillDefaults()// .numColumns(numColumns).spacing(0, 0).applyTo(container); }