List of usage examples for org.eclipse.jface.fieldassist FieldAssistColors getRequiredFieldBackgroundColor
public static Color getRequiredFieldBackgroundColor(Control control)
From source file:com.ibm.research.tours.wizards.NewTourWizardPage1.java
License:Open Source License
/** * @see IDialogPage#createControl(Composite) *///from w w w . ja va 2 s . c o m public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(2, false); layout.verticalSpacing = 9; container.setLayout(layout); Label nameLabel = new Label(container, SWT.NONE); nameLabel.setText("Title:"); fTitleText = new Text(container, SWT.BORDER); fTitleText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { setPageComplete(validatePage()); } }); GridData nameTextdata = new GridData(GridData.FILL_HORIZONTAL); fTitleText.setLayoutData(nameTextdata); fTitleText.setBackground(FieldAssistColors.getRequiredFieldBackgroundColor(fTitleText)); Label descriptionLabel = new Label(container, SWT.NONE); descriptionLabel.setText("Description:"); fDescriptionText = new Text(container, SWT.MULTI | SWT.BORDER); GridData descriptionTextdata = new GridData(GridData.FILL_HORIZONTAL); descriptionTextdata.heightHint = 48; fDescriptionText.setLayoutData(descriptionTextdata); Label authorLabel = new Label(container, SWT.NONE); authorLabel.setText("Author:"); fAuthorText = new Text(container, SWT.BORDER); fAuthorText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fAuthorText.setText(System.getProperty("user.name")); setControl(container); setPageComplete(validatePage()); }
From source file:com.testingtech.ttworkbench.utp.ea.importer.EAImporterWizardPage.java
License:Open Source License
private void createOutputControls(final Composite parent) { final Composite outputArea = new Composite(parent, SWT.NONE); final GridLayout layout = new GridLayout(); layout.numColumns = 2;//from w w w . j a v a 2 s .co m layout.makeColumnsEqualWidth = false; layout.marginWidth = 0; layout.marginHeight = 0; outputArea.setLayout(layout); outputArea.setFont(parent.getFont()); GridData gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); outputArea.setLayoutData(gd); final Label label = new Label(outputArea, SWT.NONE); label.setText("UML2 File Name:"); outputFileField = new Text(outputArea, SWT.BORDER); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); gd.widthHint = SIZING_TEXT_FIELD_WIDTH; outputFileField.setLayoutData(gd); outputFileField.setFont(outputArea.getFont()); outputFileField.setBackground(FieldAssistColors.getRequiredFieldBackgroundColor(outputFileField)); outputFileField.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent e) { final IPath path = containerPath.append(outputFileField.getText()); final IFile newFile = createFileHandle(path); final IStatus status = validatePathLocation(newFile, containerPath); if (status.getSeverity() == IStatus.OK) { setMessage(null); setErrorMessage(null); outputFileName = newFile.getName(); } else if (status.getSeverity() == IStatus.WARNING) { setMessage(status.getMessage()); setErrorMessage(null); } else { setMessage(null); setErrorMessage(status.getMessage()); } } }); }
From source file:org.csstudio.platform.ui.composites.resourcefilter.ResourceAndContainerGroup.java
License:Open Source License
/** * Creates this object's visual components. * * @param parent/*w ww .j a v a 2s .c o m*/ * org.eclipse.swt.widgets.Composite * @param heightHint * height hint for the container selection widget group * @param resourceLabelString * resource label text. */ private void createContents(final Composite parent, final String resourceLabelString, final int heightHint) { // Font font = parent.getFont(); // server name group Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; composite.setLayout(layout); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); // composite.setFont(font); // container group if (heightHint == SWT.DEFAULT) { _containerGroup = new ResourceSelectionGroup(composite, this, null, null, _showClosedProjects); } else { _containerGroup = new ResourceSelectionGroup(composite, this, null, null, _showClosedProjects, true, heightHint, SIZING_TEXT_FIELD_WIDTH); } // resource name group Composite nameGroup = new Composite(composite, SWT.NONE); layout = new GridLayout(); layout.numColumns = 2; layout.marginWidth = 0; nameGroup.setLayout(layout); nameGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL)); // nameGroup.setFont(font); Label label = new Label(nameGroup, SWT.NONE); label.setText(resourceLabelString); // label.setFont(font); // resource name entry field _resourceNameField = new Text(nameGroup, SWT.BORDER); _resourceNameField.addListener(SWT.Modify, this); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; _resourceNameField.setLayoutData(data); _resourceNameField.setBackground(FieldAssistColors.getRequiredFieldBackgroundColor(_resourceNameField)); // full path label = new Label(nameGroup, SWT.NONE); label.setText("Full path:"); _fullPathLabel = new Label(nameGroup, SWT.NONE | SWT.WRAP); data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; _fullPathLabel.setLayoutData(data); this.refreshFullPath(); validateControls(); }
From source file:org.csstudio.sds.importer.ui.internal.wizards.ImportSourceSelectionWizardPage.java
License:Open Source License
/** * {@inheritDoc}/*from w ww . jav a2s .com*/ */ public void createControl(final Composite parent) { Composite control = new Composite(parent, SWT.NONE); control.setLayout(LayoutUtil.createGridLayout(1, 0, 5, 0)); control.setLayoutData(LayoutUtil.createGridDataForFillingCell()); Label label = new Label(control, SWT.NONE); label.setText("Choose file to import:"); Composite fileSelectionComposite = new Composite(control, SWT.NONE); fileSelectionComposite.setLayout(LayoutUtil.createGridLayout(2, 0, 0, 5)); fileSelectionComposite.setLayoutData(LayoutUtil.createGridDataForFillingCell()); _filePath = new Text(fileSelectionComposite, SWT.BORDER); _filePath.setBackground(FieldAssistColors.getRequiredFieldBackgroundColor(_filePath)); _filePath.setEditable(false); _filePath.setLayoutData(LayoutUtil.createGridDataForHorizontalFillingCell()); _filePath.addModifyListener(new ModifyListener() { public void modifyText(final ModifyEvent e) { setPageComplete(_filePath.getText() != null && _filePath.getText().length() > 0); } }); Button openFileButton = new Button(fileSelectionComposite, SWT.NONE); openFileButton.addMouseListener(new MouseAdapter() { @Override public void mouseUp(final MouseEvent e) { FileDialog fd = new FileDialog(parent.getShell()); String fileName = fd.open(); if (fileName != null) { _filePath.setText(fileName); } } }); openFileButton.setText("..."); openFileButton.setLayoutData(LayoutUtil.createGridData(30)); setPageComplete(false); setErrorMessage(null); setMessage(null); setControl(control); }
From source file:org.csstudio.ui.util.composites.ResourceAndContainerGroup.java
License:Open Source License
/** * Creates this object's visual components. * * @param parent/*www. j a v a 2 s . c om*/ * org.eclipse.swt.widgets.Composite * @param heightHint * height hint for the container selection widget group * @param resourceLabelString * resource label text. */ private void createContents(final Composite parent, final String resourceLabelString, final int heightHint) { // Font font = parent.getFont(); // server name group Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; composite.setLayout(layout); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); // composite.setFont(font); // container group if (heightHint == SWT.DEFAULT) { _containerGroup = new ResourceSelectionGroup(composite, this, null, null, _showClosedProjects); } else { _containerGroup = new ResourceSelectionGroup(composite, this, null, null, _showClosedProjects, true, heightHint, SIZING_TEXT_FIELD_WIDTH); } // resource name group Composite nameGroup = new Composite(composite, SWT.NONE); layout = new GridLayout(); layout.numColumns = 2; layout.marginWidth = 0; nameGroup.setLayout(layout); nameGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL)); // nameGroup.setFont(font); Label label = new Label(nameGroup, SWT.NONE); label.setText(resourceLabelString); // label.setFont(font); // resource name entry field _resourceNameField = new Text(nameGroup, SWT.BORDER); _resourceNameField.addListener(SWT.Modify, this); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; _resourceNameField.setLayoutData(data); // _resourceNameField.setFont(font); _resourceNameField.setBackground(FieldAssistColors.getRequiredFieldBackgroundColor(_resourceNameField)); // full path label = new Label(nameGroup, SWT.NONE); label.setText("Full path:"); _fullPathLabel = new Label(nameGroup, SWT.NONE | SWT.WRAP); data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); data.widthHint = SIZING_TEXT_FIELD_WIDTH; _fullPathLabel.setLayoutData(data); this.refreshFullPath(); validateControls(); }
From source file:org.springframework.ide.eclipse.ui.workingsets.SpringWorkingSetPage.java
License:Open Source License
public void createControl(Composite parent) { Font font = parent.getFont(); Composite composite = new Composite(parent, SWT.NULL); composite.setLayout(new GridLayout()); composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); setControl(composite);//from w w w.j a v a 2s . c om Label label = new Label(composite, SWT.WRAP); label.setText("Working set name:"); GridData data = new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); label.setLayoutData(data); label.setFont(font); text = new Text(composite, SWT.SINGLE | SWT.BORDER); text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); text.setFont(font); text.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { validateInput(); } }); text.setFocus(); text.setBackground(FieldAssistColors.getRequiredFieldBackgroundColor(text)); label = new Label(composite, SWT.WRAP); label.setText("Working set &contents:"); data = new GridData( GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); label.setLayoutData(data); label.setFont(font); tree = new CheckboxTreeViewer(composite); tree.setUseHashlookup(true); final ITreeContentProvider treeContentProvider = new SpringExplorerAdaptingContentProvider(); tree.setContentProvider(treeContentProvider); tree.setLabelProvider(new SpringExplorerAdaptingLabelProvider()); tree.setSorter(new ViewerSorter()); tree.setInput(IDEWorkbenchPlugin.getPluginWorkspace().getRoot()); data = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL); data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT; data.widthHint = SIZING_SELECTION_WIDGET_WIDTH; tree.getControl().setLayoutData(data); tree.getControl().setFont(font); tree.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { handleCheckStateChange(event); } }); tree.addTreeListener(new ITreeViewerListener() { public void treeCollapsed(TreeExpansionEvent event) { } public void treeExpanded(TreeExpansionEvent event) { final Object element = event.getElement(); if (tree.getGrayed(element) == false) { BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { public void run() { setSubtreeChecked(element, tree.getChecked(element), false); } }); } } }); Composite buttonComposite = new Composite(composite, SWT.NONE); buttonComposite.setLayout(new GridLayout(2, false)); buttonComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); Button selectAllButton = new Button(buttonComposite, SWT.PUSH); selectAllButton.setText("Select &All"); selectAllButton.setToolTipText("Select all of theses resource for this working set."); selectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent selectionEvent) { tree.setCheckedElements(treeContentProvider.getElements(tree.getInput())); validateInput(); } }); selectAllButton.setFont(font); setButtonLayoutData(selectAllButton); Button deselectAllButton = new Button(buttonComposite, SWT.PUSH); deselectAllButton.setText("Dese&lect All"); deselectAllButton.setToolTipText("Deselect all of these resources for this working set."); deselectAllButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent selectionEvent) { tree.setCheckedElements(new Object[0]); validateInput(); } }); deselectAllButton.setFont(font); setButtonLayoutData(deselectAllButton); initializeCheckedState(); if (workingSet != null) { text.setText(workingSet.getName()); } setPageComplete(false); }