List of usage examples for org.eclipse.jface.dialogs IDialogConstants MINIMUM_MESSAGE_AREA_WIDTH
int MINIMUM_MESSAGE_AREA_WIDTH
To view the source code for org.eclipse.jface.dialogs IDialogConstants MINIMUM_MESSAGE_AREA_WIDTH.
Click Source Link
From source file:org.apache.directory.studio.ldapbrowser.common.dialogs.SelectEntryDialog.java
License:Apache License
/** * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) *//* w w w . j a v a 2 s . c om*/ protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); GridData gd = new GridData(GridData.FILL_BOTH); gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); gd.heightHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); composite.setLayoutData(gd); // create configuration browserConfiguration = new BrowserConfiguration(); // create main widget browserWidget = new BrowserWidget(browserConfiguration, null); browserWidget.createWidget(composite); browserWidget.setInput(new IEntry[] { rootEntry }); // create actions and context menu (and register global actions) browserActionGroup = new BrowserActionGroup(browserWidget, browserConfiguration); browserActionGroup.fillToolBar(browserWidget.getToolBarManager()); browserActionGroup.fillMenu(browserWidget.getMenuManager()); browserActionGroup.fillContextMenu(browserWidget.getContextMenuManager()); browserActionGroup.activateGlobalActionHandlers(); // create the listener browserUniversalListener = new BrowserUniversalListener(browserWidget); browserWidget.getViewer().addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { if (!event.getSelection().isEmpty()) { Object o = ((IStructuredSelection) event.getSelection()).getFirstElement(); if (o instanceof IEntry) { initialEntry = (IEntry) o; } else if (o instanceof ISearchResult) { initialEntry = ((ISearchResult) o).getEntry(); } } } }); browserWidget.getViewer().expandToLevel(2); if (initialEntry != null) { IEntry entry = this.initialEntry; browserWidget.getViewer().reveal(entry); browserWidget.getViewer().refresh(entry, true); browserWidget.getViewer().setSelection(new StructuredSelection(entry), true); browserWidget.getViewer().setSelection(new StructuredSelection(entry), true); } applyDialogFont(composite); browserWidget.setFocus(); return composite; }
From source file:org.apache.directory.studio.ldapbrowser.common.dialogs.TextDialog.java
License:Apache License
protected void createText(Composite composite, String value, boolean wrap) { if (wrap) {/*from ww w . ja v a2 s. co m*/ text = new Text(composite, defaultTextStyle | SWT.WRAP); } else { text = new Text(composite, defaultTextStyle); } text.setText(value); gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH * 2); gd.heightHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); text.setLayoutData(gd); applyDialogFont(composite); }
From source file:org.apache.directory.studio.ldapbrowser.common.widgets.browser.BrowserSorterDialog.java
License:Apache License
/** * {@inheritDoc}//from w w w. j ava2 s . c o m */ protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); GridData gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL); gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); composite.setLayoutData(gd); createGroupEntriesGroup(composite); createSortEntriesGroup(composite); createSortSearchesGroup(composite); createSortBookmarksGroup(composite); createSortLimitGroup(composite); applyDialogFont(composite); return composite; }
From source file:org.apache.directory.studio.ldapbrowser.common.widgets.entryeditor.EntryEditorWidgetSorterDialog.java
License:Apache License
/** * {@inheritDoc}// www. j av a 2 s.co m */ protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); Group group = BaseWidgetUtils.createGroup(composite, Messages.getString("EntryEditorWidgetSorterDialog.GroupAttributes"), 1); //$NON-NLS-1$ GridData gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL); gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); group.setLayoutData(gd); objectClassAndMustAttributesFirstButton = BaseWidgetUtils.createCheckbox(group, Messages.getString("EntryEditorWidgetSorterDialog.ObjectClassAndMustAttributesFirst"), 1); //$NON-NLS-1$ objectClassAndMustAttributesFirstButton.setSelection(preferences.isObjectClassAndMustAttributesFirst()); operationalAttributesLastButton = BaseWidgetUtils.createCheckbox(group, Messages.getString("EntryEditorWidgetSorterDialog.OperationalAttributesLast"), 1); //$NON-NLS-1$ operationalAttributesLastButton.setSelection(preferences.isOperationalAttributesLast()); Group sortingGroup = BaseWidgetUtils.createGroup(composite, Messages.getString("EntryEditorWidgetSorterDialog.SortAttributes"), 1); //$NON-NLS-1$ Composite sortByComposite = BaseWidgetUtils.createColumnContainer(sortingGroup, 4, 1); BaseWidgetUtils.createLabel(sortByComposite, Messages.getString("EntryEditorWidgetSorterDialog.SortBy"), 1); //$NON-NLS-1$ sortByCombo = BaseWidgetUtils.createReadonlyCombo(sortByComposite, new String[] { SORT_BY_NONE, SORT_BY_ATTRIBUTE, SORT_BY_VALUE }, 0, 1); sortByCombo.select(preferences.getDefaultSortBy() == BrowserCoreConstants.SORT_BY_VALUE ? 2 : preferences.getDefaultSortBy() == BrowserCoreConstants.SORT_BY_ATTRIBUTE_DESCRIPTION ? 1 : 0); sortByCombo.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { sortAcendingButton.setEnabled(sortByCombo.getSelectionIndex() != 0); sortDescendingButton.setEnabled(sortByCombo.getSelectionIndex() != 0); } }); sortAcendingButton = BaseWidgetUtils.createRadiobutton(sortByComposite, Messages.getString("EntryEditorWidgetSorterDialog.Ascending"), 1); //$NON-NLS-1$ sortAcendingButton .setSelection(preferences.getDefaultSortOrder() == BrowserCoreConstants.SORT_ORDER_ASCENDING); sortAcendingButton.setEnabled(sortByCombo.getSelectionIndex() != 0); sortDescendingButton = BaseWidgetUtils.createRadiobutton(sortByComposite, Messages.getString("EntryEditorWidgetSorterDialog.Descending"), 1); //$NON-NLS-1$ sortDescendingButton .setSelection(preferences.getDefaultSortOrder() == BrowserCoreConstants.SORT_ORDER_DESCENDING); sortDescendingButton.setEnabled(sortByCombo.getSelectionIndex() != 0); BaseWidgetUtils.createSpacer(composite, 2); BaseWidgetUtils.createLabel(composite, Messages.getString("EntryEditorWidgetSorterDialog.SortTableHint"), //$NON-NLS-1$ 1); applyDialogFont(composite); return composite; }
From source file:org.apache.directory.studio.ldapbrowser.ui.dialogs.EncoderDecoderDialog.java
License:Apache License
protected Control createDialogArea(Composite parent) { Composite composite2 = (Composite) super.createDialogArea(parent); GridData gd1 = new GridData(GridData.FILL_BOTH); gd1.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); gd1.heightHint = convertVerticalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); composite2.setLayoutData(gd1);/* w w w. ja v a 2 s. co m*/ Composite composite = BaseWidgetUtils.createColumnContainer(composite2, 2, 1); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); Label iso8859Label = new Label(composite, SWT.NONE); iso8859Label.setText(Messages.getString("EncoderDecoderDialog.ISOColon")); //$NON-NLS-1$ iso88591Text = new Text(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); GridData gd = new GridData(GridData.FILL_BOTH); iso88591Text.setLayoutData(gd); Label iso8859HexLabel = new Label(composite, SWT.NONE); iso8859HexLabel.setText(Messages.getString("EncoderDecoderDialog.ISOHex")); //$NON-NLS-1$ iso88591HexText = new Text(composite, SWT.BORDER | SWT.READ_ONLY); iso88591HexText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label utf8Label = new Label(composite, SWT.NONE); utf8Label.setText(Messages.getString("EncoderDecoderDialog.UTF")); //$NON-NLS-1$ utf8Text = new Text(composite, SWT.BORDER); utf8Text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label utf8HexLabel = new Label(composite, SWT.NONE); utf8HexLabel.setText(Messages.getString("EncoderDecoderDialog.UTFHex")); //$NON-NLS-1$ utf8HexText = new Text(composite, SWT.BORDER | SWT.READ_ONLY); utf8HexText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label base64Label = new Label(composite, SWT.NONE); base64Label.setText(Messages.getString("EncoderDecoderDialog.BASE")); //$NON-NLS-1$ base64Text = new Text(composite, SWT.BORDER); base64Text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); errorText = new Text(composite, SWT.BORDER | SWT.READ_ONLY); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; errorText.setLayoutData(gd); iso88591Text.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { if (!inModify) { inModify = true; try { String isoString = iso88591Text.getText(); byte[] isoBytes = isoString.getBytes("ISO-8859-1"); //$NON-NLS-1$ String utf8String = new String(isoBytes, "UTF-8"); //$NON-NLS-1$ iso88591HexText.setText(LdifUtils.hexEncode(isoBytes)); utf8Text.setText(utf8String); utf8HexText.setText(LdifUtils.hexEncode(utf8String.getBytes("UTF-8"))); //$NON-NLS-1$ base64Text.setText(LdifUtils.base64encode(isoBytes)); errorText.setText(""); //$NON-NLS-1$ } catch (Exception ex) { errorText.setText(ex.getMessage()); ex.printStackTrace(); } finally { inModify = false; } } } }); utf8Text.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { if (!inModify) { inModify = true; try { String utf8String = utf8Text.getText(); byte[] utf8Bytes = utf8String.getBytes("UTF-8"); //$NON-NLS-1$ String isoString = new String(utf8Bytes, "ISO-8859-1"); //$NON-NLS-1$ iso88591Text.setText(isoString); iso88591HexText.setText(LdifUtils.hexEncode(isoString.getBytes("ISO-8859-1"))); //$NON-NLS-1$ utf8HexText.setText(LdifUtils.hexEncode(utf8Bytes)); base64Text.setText(LdifUtils.base64encode(utf8Bytes)); errorText.setText(""); //$NON-NLS-1$ } catch (Exception ex) { errorText.setText(ex.getMessage()); ex.printStackTrace(); } finally { inModify = false; } } } }); base64Text.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { if (!inModify) { inModify = true; try { byte[] base64Bytes = LdifUtils.base64decodeToByteArray(base64Text.getText()); String isoString = new String(base64Bytes, "ISO-8859-1"); //$NON-NLS-1$ String utf8String = LdifUtils.utf8decode(base64Bytes); iso88591Text.setText(isoString); iso88591HexText.setText(LdifUtils.hexEncode(isoString.getBytes("ISO-8859-1"))); //$NON-NLS-1$ utf8Text.setText(utf8String); utf8HexText.setText(LdifUtils.hexEncode(utf8String.getBytes("UTF-8"))); //$NON-NLS-1$ errorText.setText(""); //$NON-NLS-1$ } catch (Exception ex) { errorText.setText(ex.getMessage()); ex.printStackTrace(); } finally { inModify = false; } } } }); return composite; }
From source file:org.apache.directory.studio.ldapbrowser.ui.dialogs.properties.ValuePropertyPage.java
License:Apache License
/** * {@inheritDoc}//ww w . ja v a2s . c o m */ protected Control createContents(Composite parent) { IValue value = getValue(getElement()); Composite composite = BaseWidgetUtils.createColumnContainer(parent, 1, 1); Composite mainGroup = BaseWidgetUtils.createColumnContainer(composite, 2, 1); BaseWidgetUtils.createLabel(mainGroup, Messages.getString("ValuePropertyPage.AttributeDescription"), 1); //$NON-NLS-1$ descriptionText = BaseWidgetUtils.createLabeledText(mainGroup, "", 1); //$NON-NLS-1$ BaseWidgetUtils.createLabel(mainGroup, Messages.getString("ValuePropertyPage.ValueType"), 1); //$NON-NLS-1$ typeText = BaseWidgetUtils.createLabeledText(mainGroup, "", 1); //$NON-NLS-1$ BaseWidgetUtils.createLabel(mainGroup, Messages.getString("ValuePropertyPage.ValueSize"), 1); //$NON-NLS-1$ sizeText = BaseWidgetUtils.createLabeledText(mainGroup, "", 1); //$NON-NLS-1$ BaseWidgetUtils.createLabel(mainGroup, Messages.getString("ValuePropertyPage.Data"), 1); //$NON-NLS-1$ if (value != null && value.isString()) { valueText = new Text(mainGroup, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY); valueText.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT)); GridData gd = new GridData(GridData.FILL_BOTH); gd.widthHint = convertHorizontalDLUsToPixels((int) (IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2)); gd.heightHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 4); valueText.setLayoutData(gd); valueText.setBackground(parent.getBackground()); } else { valueText = BaseWidgetUtils.createLabeledText(mainGroup, "", 1); //$NON-NLS-1$ } if (value != null) { super.setMessage(Messages.getString("ValuePropertyPage.Value") //$NON-NLS-1$ + org.apache.directory.studio.connection.core.Utils.shorten(value.toString(), 30)); descriptionText.setText(value.getAttribute().getDescription()); // valueText.setText(LdifUtils.mustEncode(value.getBinaryValue())?"Binary":value.getStringValue()); valueText.setText( value.isString() ? value.getStringValue() : Messages.getString("ValuePropertyPage.Binary")); //$NON-NLS-1$ typeText.setText(value.isString() ? Messages.getString("ValuePropertyPage.String") //$NON-NLS-1$ : Messages.getString("ValuePropertyPage.Binary")); //$NON-NLS-1$ int bytes = value.getBinaryValue().length; int chars = value.isString() ? value.getStringValue().length() : 0; String size = value.isString() ? chars + (chars > 1 ? Messages.getString("ValuePropertyPage.Characters") //$NON-NLS-1$ : Messages.getString("ValuePropertyPage.Character")) : ""; //$NON-NLS-1$ //$NON-NLS-2$ size += Utils.formatBytes(bytes); sizeText.setText(size); } return parent; }
From source file:org.apache.directory.studio.ldapbrowser.ui.search.SearchPage.java
License:Apache License
/** * {@inheritDoc}//w w w .j a v a2 s.c o m */ public void createControl(Composite parent) { // declare search search = BrowserSelectionUtils.getExampleSearch(container.getSelection()); // create search page content GridLayout gl = new GridLayout(); parent.setLayout(gl); GridData gd = new GridData(GridData.FILL_BOTH); gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); // gd.heightHint = // convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); parent.setLayoutData(gd); Composite composite = BaseWidgetUtils.createColumnContainer(parent, 3, 1); spw = new SearchPageWrapper(SearchPageWrapper.NONE); spw.createContents(composite); spw.loadFromSearch(search); spw.addWidgetModifyListener(this); errorMessageLabel = BaseWidgetUtils.createLabel(parent, "", 3); //$NON-NLS-1$ PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, BrowserUIConstants.PLUGIN_ID + "." + "tools_search_dialog"); //$NON-NLS-1$ //$NON-NLS-2$ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, BrowserUIConstants.PLUGIN_ID + "." + "tools_search_dialog"); //$NON-NLS-1$ //$NON-NLS-2$ super.setControl(parent); }
From source file:org.apache.directory.studio.openldap.common.ui.dialogs.PasswordDialog.java
License:Apache License
/** * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) *//*from ww w . j a v a2 s .c om*/ protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); composite.setLayoutData(gd); if (hasCurrentPassword()) { createCurrentPasswordGroup(composite); } createNewPasswordGroup(composite); addListeners(); applyDialogFont(composite); return composite; }
From source file:org.apache.directory.studio.openldap.config.acl.dialogs.OpenLdapAclDialog.java
License:Apache License
/** * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) *//*from w w w . j a v a2s .c o m*/ protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH) * 4 / 3; gd.heightHint = convertVerticalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH) * 4 / 3; composite.setLayoutData(gd); // Creating UI : first the precedence createPrecedenceGroup(composite); // the tab for the source/visual editor createTabFolderComposite(composite); // Setting default focus on the composite composite.setFocus(); applyDialogFont(composite); return composite; }
From source file:org.apache.directory.studio.openldap.config.editor.dialogs.DbConfigurationDialog.java
License:Apache License
/** * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) *///w ww . j a v a 2s . co m @Override protected Control createDialogArea(Composite parent) { // create composite Composite composite = (Composite) super.createDialogArea(parent); GridData gd = new GridData(GridData.FILL_BOTH); composite.setLayoutData(gd); // text widget text = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); gd = new GridData(GridData.FILL_BOTH); gd.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); gd.heightHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2); text.setLayoutData(gd); text.setText(prepareInitialConfiguration()); applyDialogFont(composite); return composite; }