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.eclipse.egit.ui.internal.dialogs.CreateTagDialog.java
License:Open Source License
private void createLeftSection(SashForm mainForm) { Composite left = new Composite(mainForm, SWT.RESIZE); left.setLayout(GridLayoutFactory.swtDefaults().margins(10, 5).create()); left.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); Label label = new Label(left, SWT.WRAP); label.setText(UIText.CreateTagDialog_tagName); GridData data = new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2); label.setLayoutData(data);// ww w .j av a 2s . com label.setFont(left.getFont()); tagNameText = new Text(left, SWT.SINGLE | SWT.BORDER); tagNameText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); tagNameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String textValue = Pattern.quote(tagNameText.getText()); tagNamePattern = Pattern.compile(textValue, Pattern.CASE_INSENSITIVE); tagViewer.refresh(); validateInput(); } }); UIUtils.addBulbDecorator(tagNameText, UIText.CreateTagDialog_tagNameToolTip); new Label(left, SWT.WRAP).setText(UIText.CreateTagDialog_tagMessage); tagMessageText = new SpellcheckableMessageArea(left, tagMessage); tagMessageText.setLayoutData(GridDataFactory.fillDefaults().minSize(50, 50).grab(true, true).create()); // key listener taken from CommitDialog.createDialogArea() allow to // commit with ctrl-enter tagMessageText.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent arg0) { if (arg0.keyCode == SWT.CR && (arg0.stateMask & SWT.CONTROL) > 0) { Control button = getButton(IDialogConstants.OK_ID); // fire OK action only when button is enabled if (button != null && button.isEnabled()) buttonPressed(IDialogConstants.OK_ID); } else if (arg0.keyCode == SWT.TAB && (arg0.stateMask & SWT.SHIFT) == 0) { arg0.doit = false; tagMessageText.traverse(SWT.TRAVERSE_TAB_NEXT); } } }); tagMessageText.getTextWidget().addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validateInput(); } }); overwriteButton = new Button(left, SWT.CHECK); overwriteButton.setEnabled(false); overwriteButton.setText(UIText.CreateTagDialog_overwriteTag); overwriteButton.setToolTipText(UIText.CreateTagDialog_overwriteTagToolTip); overwriteButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean state = overwriteButton.getSelection(); tagNameText.setEnabled(state); if (commitCombo != null) commitCombo.setEnabled(state); tagMessageText.setEnabled(state); validateInput(); } }); createAdvancedSection(left); }
From source file:org.eclipse.egit.ui.internal.synchronize.SelectSynchronizeResourceDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); composite.setLayout(GridLayoutFactory.swtDefaults().create()); GridData data = new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2); new Label(composite, SWT.WRAP).setText(UIText.SelectSynchronizeResourceDialog_srcRef); srcRefCombo = new RemoteSelectionCombo(composite, syncRepos, UIText.RemoteSelectionCombo_sourceName, UIText.RemoteSelectionCombo_sourceRef); srcRefCombo.setDefaultValue(UIText.SynchronizeWithAction_localRepoName, HEAD); srcRefCombo.setLayoutData(data);/*from w w w. jav a 2 s. com*/ srcRefCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); shouldIncludeLocalButton = new Button(composite, SWT.CHECK | SWT.WRAP); shouldIncludeLocalButton.setText(UIText.SelectSynchronizeResourceDialog_includeUncommitedChanges); shouldIncludeLocalButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean includeLocal = shouldIncludeLocalButton.getSelection(); srcRefCombo.setEnabled(!includeLocal); if (includeLocal) srcRefCombo.setDefaultValue(UIText.SynchronizeWithAction_localRepoName, HEAD); } }); new Label(composite, SWT.WRAP).setText(UIText.SelectSynchronizeResourceDialog_dstRef); dstRefCombo = new RemoteSelectionCombo(composite, syncRepos, UIText.RemoteSelectionCombo_destinationName, UIText.RemoteSelectionCombo_destinationRef); dstRefCombo.setDefaultValue(getDefaultRemoteName(), MASTER); dstRefCombo.setLayoutData(data); dstRefCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); setTitle(NLS.bind(UIText.SelectSynchronizeResourceDialog_selectProject, repoName)); setMessage(UIText.SelectSynchronizeResourceDialog_header); setTitleImage(UIIcons.WIZBAN_CONNECT_REPO.createImage()); return composite; }
From source file:org.eclipse.emf.edit.ui.provider.InputDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { // create composite Composite composite = (Composite) super.createDialogArea(parent); // create message if (message != null) { Label label = new Label(composite, SWT.WRAP); label.setText(message);//from w ww. j a v a 2 s. c o m 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()); } /* text = new Text(composite, SWT.SINGLE | SWT.BORDER); text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); */ text = createText(composite); text.addModifyListener(new ModifyListener() { /** * */ private static final long serialVersionUID = 1L; public void modifyText(ModifyEvent e) { validateInput(); } }); errorMessageText = new Text(composite, SWT.READ_ONLY); errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); // Set the error message text // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292 setErrorMessage(errorMessage); applyDialogFont(composite); return composite; }
From source file:org.eclipse.emf.emfstore.client.ui.views.emfstorebrowser.views.CertificateAliasDialog.java
License:Open Source License
/** * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) * @param parent//ww w . j av a 2s . c o m * Parent Composite * @return the composite */ @Override protected Control createDialogArea(Composite parent) { // create composite Composite composite = (Composite) super.createDialogArea(parent); // create message if (message != null) { Label label = new Label(composite, SWT.WRAP); label.setText(message); 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()); } text = new Text(composite, SWT.SINGLE | SWT.BORDER); text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); applyDialogFont(composite); return composite; }
From source file:org.eclipse.epf.common.serviceability.WrappedMessageDialog.java
License:Open Source License
protected Control createMessageArea(Composite composite) { Control rComposite = super.createMessageArea(composite); int minWidth = IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH;// + 300; // TO-DO: need to revist the # of dialog display units and margin // when in other languages int charsPerLine = minWidth / 4 - 15; GridData gd = (GridData) messageLabel.getLayoutData(); gd.minimumWidth = minWidth;//from w w w. ja va2 s .co m messageLabel.setText(addLineBreaks(message, charsPerLine)); return rComposite; }
From source file:org.eclipse.epf.library.ui.dialogs.PathSelectionDialog.java
License:Open Source License
/** * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) *//*from ww w . j a v a 2 s .c o m*/ protected Control createDialogArea(Composite parent) { // create composite Composite composite = (Composite) super.createDialogArea(parent); // create message if (message != null) { Label label = new Label(composite, SWT.WRAP); label.setText(message); 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()); } ctrl_path = new Text(composite, SWT.SINGLE | SWT.BORDER); ctrl_path.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); ctrl_browse_button = new Button(composite, SWT.NONE); ctrl_browse_button.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); ctrl_browse_button.setText(LibraryUIResources.browseButton_text); ctrl_browse_button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { openDirectoryDialog(); } }); applyDialogFont(composite); return composite; }
From source file:org.eclipse.equinox.internal.p2.importexport.internal.wizard.StyledErrorDialog.java
License:Open Source License
@Override protected Control createMessageArea(Composite composite) { // create composite // create image Image image = getImage();/*from w ww. j av a 2 s . co m*/ if (image != null) { imageLabel = new Label(composite, SWT.NULL); image.setBackground(imageLabel.getBackground()); imageLabel.setImage(image); addAccessibleListeners(imageLabel, image); GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).applyTo(imageLabel); } // create message if (message != null) { FormToolkit toolkit = new FormToolkit(Display.getDefault()); Composite toolkitComp = toolkit.createComposite(composite); toolkitComp.setLayout(new FillLayout(SWT.HORIZONTAL | SWT.VERTICAL)); FormText text = toolkit.createFormText(toolkitComp, false); text.setText(message, true, true); text.setBackground(composite.getBackground()); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false) .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT) .applyTo(toolkitComp); text.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent event) { try { URI uri = URI.create((String) event.data); if ("pref".equals(uri.getScheme())) { //$NON-NLS-1$ Map<String, String> para = new HashMap<String, String>(); para.put(IWorkbenchCommandConstants.WINDOW_PREFERENCES_PARM_PAGEID, uri.getAuthority()); Command prefCommand = ((ICommandService) PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getService(ICommandService.class)) .getCommand(IWorkbenchCommandConstants.WINDOW_PREFERENCES); prefCommand.executeWithChecks(new ExecutionEvent(prefCommand, para, null, null)); } } catch (ExecutionException e) { Platform.getLog(Platform.getBundle(Constants.Bundle_ID)) .log(new Status(IStatus.ERROR, Constants.Bundle_ID, e.getMessage(), e)); } catch (NotDefinedException e) { Platform.getLog(Platform.getBundle(Constants.Bundle_ID)) .log(new Status(IStatus.ERROR, Constants.Bundle_ID, e.getMessage(), e)); } catch (NotEnabledException e) { Platform.getLog(Platform.getBundle(Constants.Bundle_ID)) .log(new Status(IStatus.ERROR, Constants.Bundle_ID, e.getMessage(), e)); } catch (NotHandledException e) { Platform.getLog(Platform.getBundle(Constants.Bundle_ID)) .log(new Status(IStatus.ERROR, Constants.Bundle_ID, e.getMessage(), e)); } } }); } return composite; }
From source file:org.eclipse.equinox.internal.p2.ui.dialogs.UserValidationDialog.java
License:Open Source License
private void createFieldsSection(Composite composite) { Composite fieldContainer = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2;//www . j a v a 2s .c o m fieldContainer.setLayout(layout); GridData layoutData = new GridData(); fieldContainer.setLayoutData(layoutData); Label label = new Label(fieldContainer, SWT.WRAP | SWT.LEAD); GridData data = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1); data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); label.setLayoutData(data); label.setText(message); label = new Label(fieldContainer, SWT.NONE); label.setText(ProvUIMessages.UserValidationDialog_UsernameLabel); username = new Text(fieldContainer, SWT.BORDER); layoutData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); username.setLayoutData(layoutData); username.setText(getUserName()); label = new Label(fieldContainer, SWT.NONE); label.setText(ProvUIMessages.UserValidationDialog_PasswordLabel); password = new Text(fieldContainer, SWT.PASSWORD | SWT.BORDER); layoutData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); password.setLayoutData(layoutData); password.setText(getPassword()); saveButton = new Button(fieldContainer, SWT.CHECK); saveButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1)); saveButton.setText(ProvUIMessages.UserValidationDialog_SavePasswordButton); saveButton.setSelection(saveResult()); }
From source file:org.eclipse.jdt.internal.debug.ui.actions.ExpressionInputDialog.java
License:Open Source License
/** * Creates the appropriate widgetry in the input area. This * method is intended to be overridden by subclasses who wish * to use alternate input widgets.//from w w w .java2 s. c o m * @param parent parent composite */ protected void populateInputArea(Composite parent) { fSourceViewerComposite = SWTFactory.createComposite(parent, parent.getFont(), 1, 1, GridData.FILL_BOTH, 0, 0); String name = ActionMessages.ExpressionInputDialog_3; try { name = fVariable.getName(); } catch (DebugException e) { JDIDebugUIPlugin.log(e); } SWTFactory.createWrapLabel(fSourceViewerComposite, NLS.bind(ActionMessages.ExpressionInputDialog_0, new String[] { name }), 1, convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH)); fSourceViewer = new JDISourceViewer(fSourceViewerComposite, null, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); fSourceViewer.setInput(fSourceViewerComposite); configureSourceViewer(); fSourceViewer.doOperation(ITextOperationTarget.SELECT_ALL); }
From source file:org.eclipse.jst.j2ee.internal.plugin.ErrorDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { // create a composite with standard margins and spacing 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);//from w w w . j a va 2 s . c om composite.setLayoutData(new GridData(GridData.FILL_BOTH)); composite.setFont(parent.getFont()); ((GridLayout) composite.getLayout()).numColumns = 2; // create image Image image = composite.getDisplay().getSystemImage(SWT.ICON_ERROR); if (image != null) { Label label = new Label(composite, 0); image.setBackground(label.getBackground()); label.setImage(image); label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_BEGINNING)); } // create message if (msg != null) { Label label = new Label(composite, SWT.WRAP); label.setText(msg); 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()); } return composite; }