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:ac.soton.eventb.classdiagrams.diagram.sheet.custom.NewConstraintDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); Group group = new Group(composite, SWT.SHADOW_ETCHED_IN); group.setText("Constraint"); GridLayout layout = new GridLayout(2, false); group.setLayout(layout);//from w w w .j a va2 s . c o m GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.widthHint = 300; group.setLayoutData(gd); // predicate Label predicateLabel = new Label(group, SWT.NONE); predicateLabel.setText("Predicate:"); predicateLabel.setData(new GridData(SWT.TOP)); predicateText = new Text(group, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); data.widthHint = IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH; predicateText.setLayoutData(data); predicateText.setFont(PropertySectionUtil.rodinFont); predicateText.addModifyListener(PropertySectionUtil.eventBListener); predicateText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validatePredicate(); } }); // name Label nameLabel = new Label(group, SWT.NONE); nameLabel.setText("Name:"); nameText = new Text(group, SWT.SINGLE | SWT.BORDER); nameText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); nameText.setFont(PropertySectionUtil.rodinFont); nameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validateName(); } }); // comment Label commentLabel = new Label(group, SWT.NONE); commentLabel.setText("Comment:"); commentText = new Text(group, SWT.SINGLE | SWT.BORDER); commentText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); commentText.setFont(PropertySectionUtil.rodinFont); // theorem @SuppressWarnings("unused") Label theoremLabel = new Label(group, SWT.NONE); theoremButton = new Button(group, SWT.CHECK); theoremButton.setText("Theorem"); // validators predicateValidator = new DecoratedInputValidator(PropertySectionUtil.createDecorator(predicateText, "Please enter predicate", FieldDecorationRegistry.DEC_ERROR, false)) { @Override public String isValidInput(String predicate) { if (predicate == null || predicate.trim().isEmpty()) return "Predicate cannot be empty"; return null; } }; nameValidator = new DecoratedInputValidator(PropertySectionUtil.createDecorator(nameText, "Please enter name", FieldDecorationRegistry.DEC_ERROR, false)) { @Override public String isValidInput(String name) { if (name == null || name.trim().isEmpty()) return "Name cannot be empty"; return null; } }; return composite; }
From source file:ac.soton.eventb.statemachines.diagram.sheet.custom.NewInvariantDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); Group group = new Group(composite, SWT.SHADOW_ETCHED_IN); group.setText("Invariant"); GridLayout layout = new GridLayout(2, false); group.setLayout(layout);//from w w w .j a v a2s . c o m GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.widthHint = 300; group.setLayoutData(gd); // predicate Label predicateLabel = new Label(group, SWT.NONE); predicateLabel.setText("Predicate:"); predicateLabel.setData(new GridData(SWT.TOP)); predicateText = new Text(group, SWT.SINGLE | SWT.BORDER); GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); data.widthHint = IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH; predicateText.setLayoutData(data); predicateText.setFont(PropertySectionUtil.rodinFont); predicateText.addModifyListener(PropertySectionUtil.eventBListener); predicateText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validatePredicate(); } }); // name Label nameLabel = new Label(group, SWT.NONE); nameLabel.setText("Name:"); nameText = new Text(group, SWT.SINGLE | SWT.BORDER); nameText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); nameText.setFont(PropertySectionUtil.rodinFont); nameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validateName(); } }); // comment Label commentLabel = new Label(group, SWT.NONE); commentLabel.setText("Comment:"); commentText = new Text(group, SWT.SINGLE | SWT.BORDER); commentText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); commentText.setFont(PropertySectionUtil.rodinFont); // theorem @SuppressWarnings("unused") Label theoremLabel = new Label(group, SWT.NONE); theoremButton = new Button(group, SWT.CHECK); theoremButton.setText("Theorem"); // validators predicateValidator = new DecoratedInputValidator(PropertySectionUtil.createDecorator(predicateText, "Please enter predicate", FieldDecorationRegistry.DEC_ERROR, false)) { @Override public String isValidInput(String predicate) { if (predicate == null || predicate.trim().isEmpty()) return "Predicate cannot be empty"; return null; } }; nameValidator = new DecoratedInputValidator(PropertySectionUtil.createDecorator(nameText, "Please enter name", FieldDecorationRegistry.DEC_ERROR, false)) { @Override public String isValidInput(String name) { if (name == null || name.trim().isEmpty()) return "Name cannot be empty"; return null; } }; return composite; }
From source file:au.gov.ga.earthsci.catalog.ui.handler.BrowseInputDialog.java
License:Open Source License
@Override protected Control createDialogArea(final 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);//w ww . jav 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()); } Composite textComposite = new Composite(composite, SWT.NONE); textComposite.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); textComposite.setLayout(new GridLayout(2, false)); text = new Text(textComposite, getInputTextStyle()); text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); text.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { validateInput(); } }); Button browseButton = new Button(textComposite, SWT.PUSH); browseButton.setText("Browse..."); browseButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(parent.getShell()); String file = dialog.open(); if (file != null) { text.setText(new File(file).toURI().toString()); } } }); errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP); 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:br.puc.molic.diagram.multiline.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 w w.jav 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() { 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:com.amalto.workbench.dialogs.InputComboDialog.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 ww w . ja v a 2 s. co 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()); } inputCombo = new Combo(composite, SWT.READ_ONLY); inputCombo.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); inputCombo.setItems(values); if (isAppendBlankItem) { inputCombo.add("");//$NON-NLS-1$ } for (String pro : values) { if (pro.equals(value)) { inputCombo.setText(pro); break; } } if (txtValue != null) { errorMessageText = new Text(composite, SWT.BORDER); errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); errorMessageText .setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); errorMessageText.setText(txtValue); errorMessageText.setEditable(false); } // applyDialogFont(composite); return composite; }
From source file:com.amalto.workbench.editors.dialog.CustomInputDialog.java
License:Open Source License
protected void createMessageWidget(Composite parent, Composite composite) { // create message if (message != null) { Label label = new Label(composite, SWT.WRAP); label.setText(message);// w w w . j ava 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()); } }
From source file:com.aptana.git.ui.dialogs.AddRemoteDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); Label label = new Label(composite, SWT.WRAP); label.setText(Messages.AddRemoteDialog_AddRemoteDialog_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);//from ww w . j av a2 s .c om label.setFont(parent.getFont()); originNameText = new Text(composite, SWT.SINGLE | SWT.BORDER); originNameText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); originNameText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validateInput(); } }); label = new Label(composite, SWT.NONE); label.setText(Messages.AddRemoteDialog_RemoteURILabel); remoteURIText = new Text(composite, SWT.SINGLE | SWT.BORDER); remoteURIText.setText(remoteURI); remoteURIText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); // Add an option to track! Default to "on" for remote of "origin" trackButton = new Button(composite, SWT.CHECK); trackButton.setText(Messages.AddRemoteDialog_TrackButtonLabel); trackButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { super.widgetSelected(e); track = trackButton.getSelection(); dontAutoChangeTrack = true; } }); return composite; }
From source file:com.aptana.git.ui.dialogs.CreatePullRequestDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); // --- Overview of the two endpoints this PR is for Composite overview = new Composite(composite, SWT.NONE); overview.setLayout(GridLayoutFactory.fillDefaults().numColumns(5).create()); // icon//from w w w .ja v a2s . co m Label icon = new Label(overview, SWT.NONE); icon.setImage(GitUIPlugin.getImage("icons/obj16/pull_request.gif")); //$NON-NLS-1$ Color lightBlue = ThemePlugin.getDefault().getColorManager().getColor(new RGB(209, 227, 237)); // base baseRepoCombo = new Combo(overview, SWT.DROP_DOWN | SWT.READ_ONLY); baseRepoCombo.setFont(JFaceResources.getTextFont()); baseRepoCombo.setBackground(lightBlue); List<String> names = CollectionsUtil.map(repos, new IMap<IGithubRepository, String>() { public String map(IGithubRepository item) { return item.getFullName(); } }); baseRepoCombo.setItems(names.toArray(new String[names.size()])); baseRepoCombo.setText(baseRepo.getFullName()); baseRepoCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final String repoOwnerAndName = baseRepoCombo.getText(); // Get the repo out of some map? baseRepo = CollectionsUtil.find(repos, new IFilter<IGithubRepository>() { public boolean include(IGithubRepository item) { return item.getFullName().equals(repoOwnerAndName); } }); baseBranch = baseRepo.getDefaultBranch(); // Reload the branches in the branch combo! Set<String> branches = baseRepo.getBranches(); baseBranchCombo.setItems(branches.toArray(new String[branches.size()])); baseBranchCombo.setText(baseBranch); } }); // FIXME Use toolbars so we want maintain the blue bg? baseBranchCombo = new Combo(overview, SWT.DROP_DOWN | SWT.READ_ONLY); baseBranchCombo.setFont(JFaceResources.getTextFont()); baseBranchCombo.setBackground(lightBlue); baseBranchCombo.setItems(new String[] { baseBranch }); baseBranchCombo.setText(baseBranch); // We need to set the items to be the list of branches on the base repo Display.getCurrent().asyncExec(new Runnable() { public void run() { Set<String> branches = baseRepo.getBranches(); baseBranchCombo.setItems(branches.toArray(new String[branches.size()])); baseBranchCombo.setText(baseBranch); } }); baseBranchCombo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { baseBranch = baseBranchCombo.getText(); } }); // ... Label ellipsis = new Label(overview, SWT.WRAP); ellipsis.setText(" ... "); //$NON-NLS-1$ ellipsis.setFont(JFaceResources.getTextFont()); ellipsis.setEnabled(false); // head Label headLabel = new Label(overview, SWT.WRAP); headLabel.setText(head); headLabel.setFont(JFaceResources.getTextFont()); headLabel.setBackground(lightBlue); // ------- END OVERVIEW -------------------------- // Title Label titleLabel = new Label(composite, SWT.WRAP); titleLabel.setText(Messages.CreatePullRequestDialog_TitleFieldLabel); 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); titleLabel.setLayoutData(data); titleLabel.setFont(parent.getFont()); titleText = new Text(composite, SWT.SINGLE | SWT.BORDER); titleText.setText(title); titleText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); titleText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { title = titleText.getText(); validate(); } }); // Body Label label = new Label(composite, SWT.NONE); label.setText(Messages.CreatePullRequestDialog_BodyFieldLabel); bodyText = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); bodyText.setText(body); GridDataFactory.fillDefaults().hint(400, 300).applyTo(bodyText); bodyText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { body = bodyText.getText(); validate(); } }); return composite; }
From source file:com.aptana.ide.core.ui.dialogs.InputURLDialog.java
License:Open Source License
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 w w .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()); } combo = new CCombo(composite, getInputComboStyle()); combo.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); combo.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validateInput(); } }); errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP); errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); errorMessageText.setForeground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_RED)); // 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:com.aptana.ide.debug.internal.ui.dialogs.HitCountDialog.java
License:Open Source License
protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); Button checkbox = new Button(composite, SWT.CHECK); checkbox.setText(Messages.BreakpointHitCountAction_EnableHitCount); GridDataFactory.fillDefaults().grab(true, false) .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT) .applyTo(checkbox);/*from ww w .j a v a 2 s.c om*/ checkbox.setFont(parent.getFont()); checkbox.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { enabled = ((Button) e.widget).getSelection(); getText().setEnabled(enabled); if (enabled) { validateInput(); } else { setErrorMessage(null); } } }); enabled = true; checkbox.setSelection(enabled); return composite; }