List of usage examples for org.eclipse.jface.layout LayoutConstants getMargins
public static final Point getMargins()
From source file:com.bdaum.zoom.ui.internal.preferences.FileExtensionDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite parentComposite = (Composite) super.createDialogArea(parent); Composite contents = new Composite(parentComposite, SWT.NONE); contents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); setTitle(headerTitle);//from w ww . j av a 2 s. c o m setMessage(message); new Label(contents, SWT.LEFT).setText(label); filenameField = new Text(contents, SWT.SINGLE | SWT.BORDER); if (initialValue != null) filenameField.setText(initialValue); filenameField.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent event) { if (event.widget == filenameField) { filename = filenameField.getText().trim(); okButton.setEnabled(validateFileType()); } } }); filenameField.setFocus(); Button browseButton = new Button(contents, SWT.PUSH); browseButton.setText(Messages.getString("FileExtensionDialog.Browse")); //$NON-NLS-1$ browseButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ListDialog dialog = new ZListDialog(getShell(), SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); dialog.setTitle(Messages.getString("FileExtensionDialog.registered_file_types"));//$NON-NLS-1$ dialog.setContentProvider(ArrayContentProvider.getInstance()); dialog.setLabelProvider(ZColumnLabelProvider.getDefaultInstance()); String[] extensions = Program.getExtensions(); List<String> list = new ArrayList<String>(extensions.length); for (String s : extensions) if (s.indexOf(' ') < 0) list.add(s); extensions = list.toArray(new String[list.size()]); dialog.setInput(extensions); dialog.setMessage(Messages.getString("FileExtensionDialog.Select_registered_file_types")); //$NON-NLS-1$ if (dialog.open() == Window.OK) { Object[] result = dialog.getResult(); if (result != null && result.length > 0) { StringBuilder sb = new StringBuilder(filenameField.getText()); for (Object object : result) { if (sb.length() > 0) sb.append(';'); sb.append('*').append(object); } filenameField.setText(sb.toString()); } } } }); Dialog.applyDialogFont(parentComposite); Point defaultMargins = LayoutConstants.getMargins(); GridLayoutFactory.fillDefaults().numColumns(3).margins(defaultMargins.x, defaultMargins.y) .generateLayout(contents); return contents; }
From source file:com.gorillalogic.monkeyconsole.tableview.editors.ArgumentEditorDialog.java
License:Open Source License
@Override protected Control createContents(Composite parent) { Composite contents = new Composite(parent, SWT.NONE); contents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); this.createButtonBar(parent); Composite argsHolder = new Composite(contents, SWT.NONE); FillLayout fillLayout = new FillLayout(); fillLayout.type = SWT.VERTICAL;//from ww w. j a v a2s .c o m argsHolder.setLayout(fillLayout); editors = new HashMap<String, Text>(); for (String name : args.keySet()) { Composite c = new Composite(argsHolder, SWT.NONE); RowLayout rl = new RowLayout(); c.setLayout(rl); Label l = new Label(c, SWT.LEFT); l.setText(name + ":"); l.setLayoutData(new RowData(125, 20)); Text input = new Text(c, SWT.BORDER); input.setText(args.get(name)); input.setLayoutData(new RowData(200, 20)); editors.put(name, input); } Dialog.applyDialogFont(parent); Point defaultMargins = LayoutConstants.getMargins(); GridLayoutFactory.fillDefaults().numColumns(2).margins(defaultMargins.x, defaultMargins.y) .generateLayout(contents); return contents; }
From source file:net.bhl.cdt.ui.dialogs.CreateProjectDialog.java
License:Open Source License
/** * {@inheritDoc}/*from w w w .j a va 2 s. c o m*/ */ @Override protected Control createDialogArea(Composite parent) { Composite contents = new Composite(parent, SWT.NONE); contents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); setTitle("Create new project"); setMessage("Enter the name of the project"); Label name = new Label(contents, SWT.NULL); name.setText("Name:"); txtProjectName = new Text(contents, SWT.SINGLE | SWT.BORDER); txtProjectName.setSize(150, 20); if (projectName != null) { txtProjectName.setText(projectName); } Point defaultMargins = LayoutConstants.getMargins(); GridLayoutFactory.fillDefaults().numColumns(2).margins(defaultMargins.x, defaultMargins.y) .generateLayout(contents); return contents; }
From source file:net.karlmartens.ui.dialog.ConfigureColumnsDialog.java
License:Apache License
protected Control createDialogArea(Composite parent) { final Composite parentComposite = (Composite) super.createDialogArea(parent); final Composite contents = new Composite(parentComposite, SWT.NONE); contents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); setTitle(_headerTitle);//w w w .ja v a 2 s .co m setMessage(_message); _columns = new GridChooser(contents); _columns.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); final GridChooserColumn column = new GridChooserColumn(_columns, SWT.NONE); column.setWidth(100); final int[] originalIndices = new int[_table.getColumnCount()]; int index = 0; for (int i = 0; i < originalIndices.length; i++) { final TableColumn c = _table.getColumn(i); if (!c.isMoveable() || !c.isHideable()) continue; originalIndices[index++] = i; final GridChooserItem item = new GridChooserItem(_columns, SWT.NONE); item.setText(c.getText()); item.setSelected(c.isVisible()); item.setData(c); } _originalIndices = Arrays.copyOf(originalIndices, index); Dialog.applyDialogFont(parentComposite); final Point defaultMargins = LayoutConstants.getMargins(); GridLayoutFactory// .fillDefaults()// .numColumns(1)// .margins(defaultMargins.x, defaultMargins.y)// .generateLayout(contents); return contents; }
From source file:org.eclipse.emf.ecp.emfstorebridge.actions.CreateProjectDialog.java
License:Open Source License
/** * {@inheritDoc}// w ww . j a va 2s. c o m */ @Override protected Control createDialogArea(Composite parent) { Composite contents = new Composite(parent, SWT.NONE); contents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); setTitle("Create new project"); setMessage("Enter the name and the description of the project"); Label name = new Label(contents, SWT.NULL); name.setText("Name:"); txtProjectName = new Text(contents, SWT.SINGLE | SWT.BORDER); txtProjectName.setSize(150, 20); Label desc = new Label(contents, SWT.NULL); desc.setText("Description:"); txtProjectDesc = new Text(contents, SWT.MULTI | SWT.BORDER); txtProjectDesc.setSize(150, 60); Point defaultMargins = LayoutConstants.getMargins(); GridLayoutFactory.fillDefaults().numColumns(2).margins(defaultMargins.x, defaultMargins.y) .generateLayout(contents); return contents; }
From source file:org.eclipse.emf.emfstore.client.ui.views.emfstorebrowser.dialogs.admin.acimport.LdapSourceDialog.java
License:Open Source License
/** * @param parent//from w w w .j av a2 s .c o m * parent composite * @return Control * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ @Override protected Control createDialogArea(Composite parent) { // Set the specific help for this Composite PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, Activator.PLUGIN_ID + ".help_import_ldap"); Composite contents = new Composite(parent, SWT.NONE); contents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); setTitle("LDAP server data"); setMessage("Enter data of server to connect to"); Label name = new Label(contents, SWT.NULL); name.setText("Server name:"); serverName = new Text(contents, SWT.SINGLE | SWT.BORDER); serverName.setSize(350, 20); Label desc = new Label(contents, SWT.NULL); desc.setText("Server base:"); ldapBase = new Text(contents, SWT.SINGLE | SWT.BORDER); ldapBase.setSize(350, 20); Point defaultMargins = LayoutConstants.getMargins(); GridLayoutFactory.fillDefaults().numColumns(2).margins(defaultMargins.x, defaultMargins.y) .generateLayout(contents); return contents; }
From source file:org.eclipse.emf.emfstore.internal.client.ui.dialogs.admin.acimport.LdapSourceDialog.java
License:Open Source License
/** * @param parent//from w w w. ja v a 2s . c o m * parent composite * @return Control * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ @Override protected Control createDialogArea(Composite parent) { // Set the specific help for this Composite PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, Activator.PLUGIN_ID + ".help_import_ldap"); //$NON-NLS-1$ Composite contents = new Composite(parent, SWT.NONE); contents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); setTitle(Messages.LdapSourceDialog_LDAPServerData); setMessage(Messages.LdapSourceDialog_EnterServerData); Label name = new Label(contents, SWT.NULL); name.setText(Messages.LdapSourceDialog_ServerName); serverName = new Text(contents, SWT.SINGLE | SWT.BORDER); serverName.setSize(350, 20); Label desc = new Label(contents, SWT.NULL); desc.setText(Messages.LdapSourceDialog_ServerBase); ldapBase = new Text(contents, SWT.SINGLE | SWT.BORDER); ldapBase.setSize(350, 20); Point defaultMargins = LayoutConstants.getMargins(); GridLayoutFactory.fillDefaults().numColumns(2).margins(defaultMargins.x, defaultMargins.y) .generateLayout(contents); return contents; }
From source file:org.eclipse.emf.emfstore.internal.client.ui.views.emfstorebrowser.views.CreateProjectDialog.java
License:Open Source License
/** * {@inheritDoc}//from w ww . j a v a 2s . c om */ @Override protected Control createDialogArea(Composite parent) { final Composite contents = new Composite(parent, SWT.NONE); contents.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); setTitle(Messages.CreateProjectDialog_CreateNewProject); getShell().setText(Messages.CreateProjectDialog_CreateNewProject); if (labelText != null) { setMessage(labelText); } else { setMessage(Messages.CreateProjectDialog_EnterName); } final Label name = new Label(contents, SWT.NULL); name.setText(Messages.CreateProjectDialog_Name); txtProjectName = new Text(contents, SWT.SINGLE | SWT.BORDER); txtProjectName.setSize(150, 20); final Point defaultMargins = LayoutConstants.getMargins(); GridLayoutFactory.fillDefaults().numColumns(2).margins(defaultMargins.x, defaultMargins.y) .generateLayout(contents); return contents; }
From source file:org.eclipse.equinox.internal.security.ui.storage.TabAdvanced.java
License:Open Source License
public TabAdvanced(TabFolder folder, int index, final Shell shell) { TabItem tab = new TabItem(folder, SWT.NONE, index); tab.setText(SecUIMessages.tabAdvanced); Composite page = new Composite(folder, SWT.NONE); tab.setControl(page);//from w w w .j a va2 s . co m Label cipherLabel = new Label(page, SWT.NONE); cipherLabel.setText(SecUIMessages.selectCipher); cipherSelector = new Combo(page, SWT.READ_ONLY | SWT.DROP_DOWN); GridData gridDataSelector = new GridData(GridData.FILL, GridData.BEGINNING, true, false); cipherSelector.setLayoutData(gridDataSelector); // initialize values eclipseNode = new ConfigurationScope().getNode(PREFERENCES_PLUGIN); defaultCipherAlgorithm = eclipseNode.get(IStorageConstants.CIPHER_KEY, IStorageConstants.DEFAULT_CIPHER); availableCiphers = InternalExchangeUtils.ciphersDetectAvailable(); // fill cipher selector int position = 0; for (Iterator i = availableCiphers.keySet().iterator(); i.hasNext();) { String cipherAlgorithm = (String) i.next(); cipherSelector.add(cipherAlgorithm, position); if (defaultCipherAlgorithm.equals(cipherAlgorithm)) cipherSelector.select(position); position++; } GridLayoutFactory.fillDefaults().margins(LayoutConstants.getMargins()).numColumns(1).generateLayout(page); }
From source file:org.eclipse.jface.snippets.layout.Snippet013GridLayoutFactory.java
License:Open Source License
public static Shell createShell1() { Shell shell = new Shell(Display.getCurrent(), SWT.SHELL_TRIM); // Populate the shell Label text = new Label(shell, SWT.WRAP); text.setText("This is a layout test. This text should wrap in the test. You could call it a text test."); GridDataFactory.generate(text, 2, 1); List theList = new List(shell, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); theList.add("Hello"); theList.add("World"); GridDataFactory.defaultsFor(theList).hint(300, 300).applyTo(theList); Composite buttonBar = new Composite(shell, SWT.NONE); // Populate buttonBar Button add = new Button(buttonBar, SWT.PUSH); add.setText("Add"); Button remove = new Button(buttonBar, SWT.PUSH); remove.setText("Remove"); GridLayoutFactory.fillDefaults().generateLayout(buttonBar); GridLayoutFactory.fillDefaults().numColumns(2).margins(LayoutConstants.getMargins()).generateLayout(shell); return shell; }