List of usage examples for org.eclipse.jface.dialogs IDialogConstants VERTICAL_SPACING
int VERTICAL_SPACING
To view the source code for org.eclipse.jface.dialogs IDialogConstants VERTICAL_SPACING.
Click Source Link
From source file:nl.utwente.ce.imageexport.ExceptionErrorDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); createMessageArea(composite);//from w w w .j a v a 2 s . co m createSupportArea(parent); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.numColumns = 2; composite.setLayout(layout); GridData childData = new GridData(GridData.FILL_BOTH); childData.horizontalSpan = 2; childData.grabExcessVerticalSpace = false; composite.setLayoutData(childData); composite.setFont(parent.getFont()); return composite; }
From source file:org.apache.directory.studio.connection.ui.dialogs.PasswordDialog.java
License:Apache License
/** * {@inheritDoc}//from w w w. j a va 2 s . co m */ @Override protected Control createDialogArea(Composite parent) { // Composite Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout); GridData compositeGridData = new GridData(SWT.FILL, SWT.FILL, true, true); compositeGridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); composite.setLayoutData(compositeGridData); // Message if (message != null) { Label messageLabel = BaseWidgetUtils.createWrappedLabel(composite, message, 1); GridData messageLabelGridData = new GridData(SWT.FILL, SWT.CENTER, true, true); messageLabelGridData.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); messageLabel.setLayoutData(messageLabelGridData); } // Password Text passwordText = BaseWidgetUtils.createText(composite, value, 1); passwordText.setEchoChar('\u2022'); // Show Password Checkbox showPasswordCheckbox = BaseWidgetUtils.createCheckbox(composite, Messages.getString("PasswordDialog.ShowPassword"), 1); //$NON-NLS-1$ showPasswordCheckbox.addSelectionListener(showPasswordCheckboxListener); // Setting focus passwordText.setFocus(); applyDialogFont(composite); return composite; }
From source file:org.apache.directory.studio.connection.ui.dialogs.ResetPasswordDialog.java
License:Apache License
/** * {@inheritDoc}/*from w ww. jav a 2s. c om*/ */ @Override protected Control createDialogArea(Composite parent) { // Composite Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout); GridData compositeGridData = new GridData(SWT.FILL, SWT.FILL, true, true); compositeGridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); composite.setLayoutData(compositeGridData); // Message if (message != null) { Label messageLabel = BaseWidgetUtils.createWrappedLabel(composite, message, 1); GridData messageLabelGridData = new GridData(SWT.FILL, SWT.CENTER, true, true, 2, 1); messageLabelGridData.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); messageLabel.setLayoutData(messageLabelGridData); } // Current Password Group Group currentPasswordGroup = BaseWidgetUtils.createGroup(composite, Messages.getString("ResetPasswordDialog.CurrentPassword"), 1); //$NON-NLS-1$ currentPasswordGroup.setLayout(new GridLayout(2, false)); // Current Password Text BaseWidgetUtils.createLabel(currentPasswordGroup, Messages.getString("ResetPasswordDialog.CurrentPasswordColon"), 1); //$NON-NLS-1$ currentPasswordText = BaseWidgetUtils.createText(currentPasswordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$ currentPasswordText.setEchoChar('\u2022'); currentPasswordText.addModifyListener(event -> validate()); // Show Current Password Checkbox BaseWidgetUtils.createLabel(currentPasswordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$ showCurrentPasswordCheckbox = BaseWidgetUtils.createCheckbox(currentPasswordGroup, Messages.getString("ResetPasswordDialog.ShowPassword"), 1); //$NON-NLS-1$ showCurrentPasswordCheckbox.addSelectionListener(new SelectionAdapter() { /** * {@inheritDoc} */ @Override public void widgetSelected(SelectionEvent event) { if (showCurrentPasswordCheckbox.getSelection()) { currentPasswordText.setEchoChar('\0'); } else { currentPasswordText.setEchoChar('\u2022'); } } }); // New Password Group Group newPasswordGroup = BaseWidgetUtils.createGroup(composite, Messages.getString("ResetPasswordDialog.NewPassword"), 1); //$NON-NLS-1$ newPasswordGroup.setLayout(new GridLayout(2, false)); // New Password Text BaseWidgetUtils.createLabel(newPasswordGroup, Messages.getString("ResetPasswordDialog.NewPasswordColon"), //$NON-NLS-1$ 1); newPasswordText = BaseWidgetUtils.createText(newPasswordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$ newPasswordText.setEchoChar('\u2022'); newPasswordText.addModifyListener(event -> validate()); // Show New Password Checkbox BaseWidgetUtils.createLabel(newPasswordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$ showNewPasswordCheckbox = BaseWidgetUtils.createCheckbox(newPasswordGroup, Messages.getString("ResetPasswordDialog.ShowPassword"), 1); //$NON-NLS-1$ showNewPasswordCheckbox.addSelectionListener(new SelectionAdapter() { /** * {@inheritDoc} */ @Override public void widgetSelected(SelectionEvent event) { if (showNewPasswordCheckbox.getSelection()) { newPasswordText.setEchoChar('\0'); } else { newPasswordText.setEchoChar('\u2022'); } } }); // Verify Text BaseWidgetUtils.createLabel(newPasswordGroup, Messages.getString("ResetPasswordDialog.VerifyNewPasswordColon"), 1); //$NON-NLS-1$ verifyNewPasswordText = BaseWidgetUtils.createText(newPasswordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$ verifyNewPasswordText.setEchoChar('\u2022'); verifyNewPasswordText.addModifyListener(event -> validate()); // Show Verify New Password Checkbox BaseWidgetUtils.createLabel(newPasswordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$ showVerifyNewPasswordCheckbox = BaseWidgetUtils.createCheckbox(newPasswordGroup, Messages.getString("ResetPasswordDialog.ShowPassword"), 1); //$NON-NLS-1$ showVerifyNewPasswordCheckbox.addSelectionListener(new SelectionAdapter() { /** * {@inheritDoc} */ @Override public void widgetSelected(SelectionEvent event) { if (showVerifyNewPasswordCheckbox.getSelection()) { verifyNewPasswordText.setEchoChar('\0'); } else { verifyNewPasswordText.setEchoChar('\u2022'); } } }); // Setting focus currentPasswordGroup.setFocus(); applyDialogFont(composite); return composite; }
From source file:org.apache.directory.studio.connection.ui.dialogs.SetupPasswordDialog.java
License:Apache License
/** * {@inheritDoc}//ww w . j a v a 2s .c o m */ @Override protected Control createDialogArea(Composite parent) { // Composite Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout); GridData compositeGridData = new GridData(SWT.FILL, SWT.FILL, true, true); compositeGridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); composite.setLayoutData(compositeGridData); // Message if (message != null) { Label messageLabel = BaseWidgetUtils.createWrappedLabel(composite, message, 1); GridData messageLabelGridData = new GridData(SWT.FILL, SWT.CENTER, true, true); messageLabelGridData.widthHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); messageLabel.setLayoutData(messageLabelGridData); } // Password Group Group passwordGroup = BaseWidgetUtils.createGroup(composite, Messages.getString("SetupPasswordDialog.Password"), 1); //$NON-NLS-1$ passwordGroup.setLayout(new GridLayout(2, false)); // Password Text BaseWidgetUtils.createLabel(passwordGroup, Messages.getString("SetupPasswordDialog.PasswordColon"), 1); //$NON-NLS-1$ passwordText = BaseWidgetUtils.createText(passwordGroup, value, 1); passwordText.setEchoChar('\u2022'); passwordText.addModifyListener(event -> validate()); // Show Password Checkbox BaseWidgetUtils.createLabel(passwordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$ showPasswordCheckbox = BaseWidgetUtils.createCheckbox(passwordGroup, Messages.getString("SetupPasswordDialog.ShowPassword"), 1); //$NON-NLS-1$ showPasswordCheckbox.addSelectionListener(new SelectionAdapter() { /** * {@inheritDoc} */ @Override public void widgetSelected(SelectionEvent event) { if (showPasswordCheckbox.getSelection()) { passwordText.setEchoChar('\0'); } else { passwordText.setEchoChar('\u2022'); } } }); // Verify Text BaseWidgetUtils.createLabel(passwordGroup, Messages.getString("SetupPasswordDialog.VerifyPasswordColon"), //$NON-NLS-1$ 1); verifyPasswordText = BaseWidgetUtils.createText(passwordGroup, value, 1); verifyPasswordText.setEchoChar('\u2022'); verifyPasswordText.addModifyListener(event -> validate()); // Show Verify Password Checkbox BaseWidgetUtils.createLabel(passwordGroup, StringUtils.EMPTY, 1); //$NON-NLS-1$ showVerifyPasswordCheckbox = BaseWidgetUtils.createCheckbox(passwordGroup, Messages.getString("SetupPasswordDialog.ShowPassword"), 1); //$NON-NLS-1$ showVerifyPasswordCheckbox.addSelectionListener(new SelectionAdapter() { /** * {@inheritDoc} */ @Override public void widgetSelected(SelectionEvent event) { if (showVerifyPasswordCheckbox.getSelection()) { verifyPasswordText.setEchoChar('\0'); } else { verifyPasswordText.setEchoChar('\u2022'); } } }); // Setting focus passwordText.setFocus(); applyDialogFont(composite); return composite; }
From source file:org.apache.directory.studio.valueeditors.image.ImageDialog.java
License:Apache License
/** * Creates a tab item composite./* w ww . j a v a 2s . c o m*/ * * @return a tab item composite */ private Composite createTabItemComposite() { Composite composite = new Composite(tabFolder, SWT.NONE); GridLayout compositeLayout = new GridLayout(1, false); compositeLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); compositeLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); compositeLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); compositeLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(compositeLayout); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); return composite; }
From source file:org.apache.directory.studio.valueeditors.password.PasswordDialog.java
License:Apache License
/** * Creates the current password tab.//w ww . j a va 2 s. c om */ private void createCurrentPasswordTab() { // Current password composite currentPasswordComposite = new Composite(tabFolder, SWT.NONE); GridLayout currentLayout = new GridLayout(2, false); currentLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); currentLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); currentLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); currentLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); currentPasswordComposite.setLayout(currentLayout); currentPasswordComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); // Current password text BaseWidgetUtils.createLabel(currentPasswordComposite, Messages.getString("PasswordDialog.CurrentPassword") + ":", 1); //$NON-NLS-1$//$NON-NLS-2$ currentPasswordText = BaseWidgetUtils.createReadonlyText(currentPasswordComposite, "", 1); //$NON-NLS-1$ // Current password details composite new Label(currentPasswordComposite, SWT.NONE); Composite currentPasswordDetailsComposite = BaseWidgetUtils.createColumnContainer(currentPasswordComposite, 2, 1); // Current password hash method label BaseWidgetUtils.createLabel(currentPasswordDetailsComposite, Messages.getString("PasswordDialog.HashMethod"), 1); //$NON-NLS-1$ currentPasswordHashMethodText = BaseWidgetUtils.createLabeledText(currentPasswordDetailsComposite, "", 1); //$NON-NLS-1$ // Current password hex label BaseWidgetUtils.createLabel(currentPasswordDetailsComposite, Messages.getString("PasswordDialog.PasswordHex"), 1); //$NON-NLS-1$ currentPasswordValueHexText = BaseWidgetUtils.createLabeledText(currentPasswordDetailsComposite, "", 1); //$NON-NLS-1$ // Current password salt hex label BaseWidgetUtils.createLabel(currentPasswordDetailsComposite, Messages.getString("PasswordDialog.SaltHex"), //$NON-NLS-1$ 1); currentPasswordSaltHexText = BaseWidgetUtils.createLabeledText(currentPasswordDetailsComposite, "", 1); //$NON-NLS-1$ // Show current password details button showCurrentPasswordDetailsButton = BaseWidgetUtils.createCheckbox(currentPasswordDetailsComposite, Messages.getString("PasswordDialog.ShowCurrentPasswordDetails"), 2); //$NON-NLS-1$ // Verify password text BaseWidgetUtils.createLabel(currentPasswordComposite, Messages.getString("PasswordDialog.VerifyPassword"), //$NON-NLS-1$ 1); testPasswordText = BaseWidgetUtils.createText(currentPasswordComposite, "", 1); //$NON-NLS-1$ // Verify password details composite new Label(currentPasswordComposite, SWT.NONE); Composite testPasswordDetailsComposite = BaseWidgetUtils.createColumnContainer(currentPasswordComposite, 2, 1); // Bind DN label BaseWidgetUtils.createLabel(testPasswordDetailsComposite, Messages.getString("PasswordDialog.BindDn"), 1); //$NON-NLS-1$ testBindDnText = BaseWidgetUtils.createLabeledText(testPasswordDetailsComposite, "", 1); //$NON-NLS-1$ // Show verify password details button showTestPasswordDetailsButton = BaseWidgetUtils.createCheckbox(testPasswordDetailsComposite, Messages.getString("PasswordDialog.ShowTestPasswordDetails"), 2); //$NON-NLS-1$ // Verify password buttons composite new Label(currentPasswordComposite, SWT.NONE); Composite verifyPasswordButtonsComposite = BaseWidgetUtils.createColumnContainer(currentPasswordComposite, 2, 1); // Verify button verifyPasswordButton = BaseWidgetUtils.createButton(verifyPasswordButtonsComposite, Messages.getString("PasswordDialog.Verify"), 1); //$NON-NLS-1$ verifyPasswordButton.setEnabled(false); // Bind button bindPasswordButton = BaseWidgetUtils.createButton(verifyPasswordButtonsComposite, Messages.getString("PasswordDialog.Bind"), 1); //$NON-NLS-1$ bindPasswordButton.setEnabled(false); // Current password tab currentPasswordTab = new TabItem(tabFolder, SWT.NONE); currentPasswordTab.setText(Messages.getString("PasswordDialog.CurrentPassword")); //$NON-NLS-1$ currentPasswordTab.setControl(currentPasswordComposite); }
From source file:org.apache.directory.studio.valueeditors.password.PasswordDialog.java
License:Apache License
/** * Creates the new password tab.//from ww w . j av a2 s . c o m */ private void createNewPasswordTab() { // New password composite newPasswordComposite = new Composite(tabFolder, SWT.NONE); GridLayout newLayout = new GridLayout(2, false); newLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); newLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); newLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); newLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); newPasswordComposite.setLayout(newLayout); // New password text BaseWidgetUtils.createLabel(newPasswordComposite, Messages.getString("PasswordDialog.EnterNewPassword"), 1); //$NON-NLS-1$ newPasswordText = BaseWidgetUtils.createText(newPasswordComposite, "", 1); //$NON-NLS-1$ // Confirm new password text BaseWidgetUtils.createLabel(newPasswordComposite, Messages.getString("PasswordDialog.ConfirmNewPassword"), //$NON-NLS-1$ 1); confirmNewPasswordText = BaseWidgetUtils.createText(newPasswordComposite, "", 1); //$NON-NLS-1$ // New password hashing method combo BaseWidgetUtils.createLabel(newPasswordComposite, Messages.getString("PasswordDialog.SelectHashMethod"), 1); //$NON-NLS-1$ newPasswordHashMethodComboViewer = new ComboViewer(newPasswordComposite); newPasswordHashMethodComboViewer.setContentProvider(new ArrayContentProvider()); newPasswordHashMethodComboViewer.setLabelProvider(new LabelProvider() { public String getText(Object element) { String hashMethod = getHashMethodName(element); if (!"".equals(hashMethod)) { return hashMethod; } return super.getText(element); } }); newPasswordHashMethodComboViewer.setInput(HASH_METHODS); newPasswordHashMethodComboViewer.getControl() .setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); // New password preview text BaseWidgetUtils.createLabel(newPasswordComposite, Messages.getString("PasswordDialog.PasswordPreview"), 1); //$NON-NLS-1$ newPasswordPreviewText = BaseWidgetUtils.createReadonlyText(newPasswordComposite, "", 1); //$NON-NLS-1$ // New salt button newSaltButton = BaseWidgetUtils.createButton(newPasswordComposite, Messages.getString("PasswordDialog.NewSalt"), 1); //$NON-NLS-1$ newSaltButton.setLayoutData(new GridData()); newSaltButton.setEnabled(false); // New password preview details composite Composite newPasswordPreviewDetailsComposite = BaseWidgetUtils.createColumnContainer(newPasswordComposite, 2, 1); // New password preview hex label BaseWidgetUtils.createLabel(newPasswordPreviewDetailsComposite, Messages.getString("PasswordDialog.PasswordHex"), 1); //$NON-NLS-1$ newPasswordPreviewValueHexText = BaseWidgetUtils.createLabeledText(newPasswordPreviewDetailsComposite, ":", //$NON-NLS-1$ 1); // New password preview salt hex label BaseWidgetUtils.createLabel(newPasswordPreviewDetailsComposite, Messages.getString("PasswordDialog.SaltHex"), 1); //$NON-NLS-1$ newPasswordPreviewSaltHexText = BaseWidgetUtils.createLabeledText(newPasswordPreviewDetailsComposite, "", //$NON-NLS-1$ 1); // Show new password details button showNewPasswordDetailsButton = BaseWidgetUtils.createCheckbox(newPasswordPreviewDetailsComposite, Messages.getString("PasswordDialog.ShowNewPasswordDetails"), 2); //$NON-NLS-1$ // New password tab newPasswordTab = new TabItem(tabFolder, SWT.NONE); newPasswordTab.setText(Messages.getString("PasswordDialog.NewPassword")); //$NON-NLS-1$ newPasswordTab.setControl(newPasswordComposite); }
From source file:org.apache.sling.ide.eclipse.ui.views.MVPEditor.java
License:Apache License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); // now add the node type dropbox-combo Composite header = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0;//from w w w . j a v a2 s . c om layout.marginWidth = 0; layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.numColumns = 3; header.setLayout(layout); Label label = new Label(header, SWT.WRAP); label.setText("Modify property " + property.getName() + ":"); GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); label.setLayoutData(data); label.setFont(parent.getFont()); ToolBar buttonBar = new ToolBar(header, SWT.NONE); ToolItem invisible = new ToolItem(buttonBar, SWT.NONE); ToolItem plus = new ToolItem(buttonBar, SWT.NONE); plus.setImage(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_ADD) .createImage()); plus.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { plus(); } }); final ToolItem minus = new ToolItem(buttonBar, SWT.NONE); minus.setImage(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE) .createImage()); minus.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { minus(); } }); minus.setEnabled(false); Composite tableParent = new Composite(composite, SWT.NONE); final GridData layoutData = new GridData(GridData.FILL_BOTH); layoutData.heightHint = 150; tableParent.setLayoutData(layoutData); TableColumnLayout tableLayout = new TableColumnLayout(); tableParent.setLayout(tableLayout); viewer = new TableViewer(tableParent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); viewer.getTable().setLinesVisible(true); viewer.getTable().setHeaderVisible(true); // accessing property here directly, instead of going via (JcrProperty)inputElement; String[] rawLines = property.getValuesAsString(); // convert raw lines to Line objects for easier editing management for (int i = 0; i < rawLines.length; i++) { lines.add(new Line(rawLines[i])); } viewer.setContentProvider(new IStructuredContentProvider() { @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } @Override public void dispose() { } @Override public Object[] getElements(Object inputElement) { return lines.toArray(); } }); TableViewerColumn column0 = new TableViewerColumn(viewer, SWT.NONE); column0.getColumn().setText("Type"); column0.getColumn().setResizable(true); column0.getColumn().setWidth(100); tableLayout.setColumnData(column0.getColumn(), new ColumnWeightData(20, 100)); column0.setLabelProvider(new CellLabelProvider() { @Override public void update(ViewerCell cell) { try { cell.setText(property.getTypeAsString()); cell.setForeground(greyColor); } catch (Exception e) { cell.setText("n/a"); cell.setForeground(greyColor); } } }); TableViewerColumn column1 = new TableViewerColumn(viewer, SWT.NONE); column1.getColumn().setText("Value"); column1.getColumn().setResizable(true); column1.getColumn().setWidth(200); tableLayout.setColumnData(column1.getColumn(), new ColumnWeightData(80, 200)); column1.setLabelProvider(new CellLabelProvider() { @Override public void update(ViewerCell cell) { Line line = (Line) cell.getElement(); cell.setText(line.getValue()); } }); column1.setEditingSupport(new EditingSupport(viewer) { @Override protected void setValue(Object element, Object value) { Line line = (Line) element; line.setValue(String.valueOf(value)); // trigger a refresh: viewer.setInput(property); } @Override protected Object getValue(Object element) { final Line line = (Line) element; final String value = line.getValue(); System.out.println("Value=" + value); return value; } @Override protected CellEditor getCellEditor(Object element) { return new TextCellEditor(viewer.getTable()); } @Override protected boolean canEdit(Object element) { // all values are editable return true; } }); viewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { final ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection iss = (IStructuredSelection) selection; if (iss.isEmpty()) { minus.setEnabled(false); } else { minus.setEnabled(true); } } else { minus.setEnabled(false); } } }); viewer.setInput(property); return composite; }
From source file:org.bonitasoft.studio.connectors.ui.preferences.DBConnectorsPreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { setPreferenceStore(BonitaStudioPreferencesPlugin.getDefault().getPreferenceStore()); final Composite titleComposite = new Composite(parent, SWT.NONE); titleComposite.setLayout(new GridLayout(2, false)); titleComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create()); final Label imageLabel = new Label(titleComposite, SWT.NONE); imageLabel.setImage(Pics.getImage(PicsConstants.preferenceAdvanced)); final Label title = new Label(titleComposite, SWT.NONE); title.setText(Messages.BonitaPreferenceDialog_DBConnectors); title.setFont(BonitaStudioFontRegistry.getPreferenceTitleFont()); final Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.marginHeight = layout.marginWidth = 0; layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); composite.setLayout(layout);/*from w w w .j a va 2 s . c om*/ composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); final Composite booleanEditorComposite = new Composite(composite, SWT.NONE); booleanEditorComposite.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, false).create()); booleanEditorComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).create()); BooleanFieldEditor editor = new CheckBoxFieldEditor(BonitaPreferenceConstants.ALWAYS_USE_SCRIPTING_MODE, Messages.alwaysUseScriptingModeOutputPref, booleanEditorComposite); addField(editor); final Label label = new Label(composite, SWT.WRAP); label.setText(Messages.BonitaPreferencePage_DBConnectors_Description); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = 150; data.horizontalSpan = 2; label.setLayoutData(data); label.setLayoutData(data); createDBConnectorsList(composite); createDriverManager(composite); initialize(); checkState(); return composite; }
From source file:org.codehaus.groovy.eclipse.dsl.inferencing.suggestions.ui.AbstractDialogue.java
License:Apache License
protected Control createDialogArea(Composite parent) { invalidValues = new HashMap<IDialogueControlDescriptor, SetValue>(); DialogueDescriptor descriptor = getDialogueDescriptor(); setTitle(descriptor.getTitle());//from w w w . j a v a 2 s . c o m setMessage(descriptor.getMessage()); String iconLocation = descriptor.getIconLocation(); if (iconLocation != null && iconLocation.length() > 0) { setTitleImage(GroovyDSLCoreActivator.getImageDescriptor(iconLocation).createImage()); } Composite composite = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().margins(getDefaultCompositeHMargin(), getDefaultCompositeVMargin()) .spacing(convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING), convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING)) .applyTo(composite); Dialog.applyDialogFont(composite); GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); createCommandArea(composite); return composite; }