private List<Text> addTextFrom(final Page page, final Composite c) { if (lines != null) { for (Composite line : lines) { line.dispose(); } } List<Text> list = new ArrayList<Text>(); this.page = page; Composite lineComposite = new Composite(c, SWT.NONE); setLineLayout(lineComposite); if (lines != null) lines.add(lineComposite); for (Word word : JavaConversions.asJavaIterable(page.words())) { if (word.original().equals(Page.ParagraphMarker())) { lineComposite = new Composite(c, SWT.NONE); setLineLayout(lineComposite); lines.add(lineComposite); } else { Text text = new Text(lineComposite, SWT.NONE); setCssName(text); text.setText(TextHelper.fixForDisplay(word.history().top().form())); handleEmptyText(text); // option: word.isPossibleError() ? UNCHECKED : DEFAULT text.setForeground(parent.getDisplay().getSystemColor(DEFAULT)); text.setData(Word.class.toString(), word); text.setData(Page.class.toString(), page); addListeners(text); text.setEditable(!word.isLocked() && !page.done()); list.add(text); } } this.layout(); return list; }
/** * 为Text控件增加灰色提醒,获得焦点时自动清除灰色提醒 * * @param text Text控件 * @param initTxt 灰色提醒字符串 */ private void setGray(final Text text, final String initTxt) { text.setForeground(gray); text.setText(initTxt); text.addFocusListener( new FocusListener() { public void focusLost(FocusEvent arg0) { if (text.getText().trim().equals("")) { if (!text.getForeground().equals(gray)) { text.setForeground(gray); } text.setText(initTxt); } else { if (!text.getForeground().equals(black)) { text.setForeground(black); } } } public void focusGained(FocusEvent arg0) { if (text.getText().trim().equals(initTxt)) { text.setText(""); text.setForeground(black); } else { if (!text.getForeground().equals(black)) { text.setForeground(black); } } } }); }
public boolean validate() { String txt = text.getText(); if (txt.length() == 0) { return true; } Object value = Converters.convert(txt, parameter.type); if (value == null) { text.setToolTipText("Could not create " + parameter.type); text.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); return false; } else { text.setToolTipText(null); text.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); return true; } }
/** * ************************************************************************* Create the dialog * area contents. * * @param parent The base composite of the dialog * @return The resulting contents * ************************************************************************ */ protected Control createDialogArea(Composite parent) { // Main composite of the dialog area ----------------------------------- Composite top = new Composite(parent, SWT.NONE); top.setLayoutData(new GridData(GridData.FILL_BOTH)); top.setLayout(new GridLayout(1, true)); IConfigurationManager cfg = (IConfigurationManager) ServiceManager.get(IConfigurationManager.class); Font codeFont = cfg.getFont(FontKey.MASTERC); Color bcolor = cfg.getGuiColor(GuiColorKey.CONSOLE_BG); Color wcolor = cfg.getGuiColor(GuiColorKey.CONSOLE_FG); // Create the console display m_display = new Text(top, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); m_display.setFont(codeFont); m_display.setBackground(bcolor); m_display.setForeground(wcolor); GridData ddata = new GridData(GridData.FILL_BOTH); ddata.minimumHeight = 200; m_display.setLayoutData(ddata); m_display.setText(""); m_display.setEditable(false); // Create the input field m_prompt = new PromptField(top, ""); m_prompt.getContents().setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); m_prompt.getContents().addKeyListener(this); m_prompt.getContents().setFocus(); return parent; }
/* * (non-Javadoc) * * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) */ protected Control createContents(Composite parent) { Text text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP); text.setForeground(JFaceColors.getErrorText(text.getDisplay())); text.setBackground(text.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); text.setText(WorkbenchMessages.ErrorPreferencePage_errorMessage); return text; }
public void initChatControl(Text chat) { chat.setFont(iniAppearance.getFontChat()); chat.setBackground(iniAppearance.getColorBackground()); chat.setForeground(iniAppearance.getColorForeground()); chatControls.add(chat); }
public void setForeground(Color color) { super.setForeground(color); foreground = color; if (text != null) text.setForeground(color); if (list != null) list.setForeground(color); if (icon != null) icon.setForeground(color); if (arrow != null) arrow.setForeground(color); }
public void applyColor(ColorType type, RGB rgb) { Color newColor = new Color(SwtUtils.DISPLAY, rgb); Color oldColor = null; switch (type) { case BACKGROUND: { oldColor = iniAppearance.getColorBackground(); for (Control control : controls) { if (control.isDisposed()) continue; control.setBackground(newColor); } for (Text chat : chatControls) { if (chat.isDisposed()) continue; chat.setBackground(newColor); } iniAppearance.setColorBackground(newColor); break; } case FOREGROUND: { oldColor = iniAppearance.getColorForeground(); for (Control control : controls) { if (control.isDisposed()) continue; control.setForeground(newColor); } for (Text chat : chatControls) { if (chat.isDisposed()) continue; chat.setForeground(newColor); } iniAppearance.setColorForeground(newColor); break; } case LOG_BACKGROUND: { oldColor = iniAppearance.getColorLogBackground(); for (StyledText text : logControls) { if (text.isDisposed()) continue; text.setBackground(newColor); text.setForeground(newColor); } iniAppearance.setColorLogBackground(newColor); } } if (oldColor != null) oldColor.dispose(); }
/** * Set the name chosen for the invoked element * * @param text the text string or null for auto-initialization */ private void setInvokedName(String text) { String name = text; if (text == null) { name = LabelHelper.INSTANCE.findName(parameterOwner, UMLPackage.eINSTANCE.getParameter()); // the name assignment will be performed by listener's call creationNameText.setText(name); } else if (name != null && !"".equals(name.trim())) { selectedName = name.trim(); Color black = creationNameText.getDisplay().getSystemColor(SWT.COLOR_BLACK); creationNameText.setForeground(black); refreshOkButton(); } else { selectedName = null; Color red = creationNameText.getDisplay().getSystemColor(SWT.COLOR_RED); creationNameText.setForeground(red); refreshOkButton(); } }
public boolean validate() { boolean valid = true; for (Entry<String, Boolean> entry : type.validate(text.getText(), null).entrySet()) { if (!entry.getValue().booleanValue()) { valid = false; break; } } if (valid) { text.setForeground(fgColor); text.setBackground(bgColor); refontLabel(false); return true; } if (useValidationGUIHints) { text.setForeground(Colors.BLACK); text.setBackground(Colors.YELLOW); refontLabel(true); } return false; }
/** Method setEnabledFields. */ @Override protected void setEnabledFields() { if (R4EUIModelController.isJobInProgress() || fProperties.getElement().isReadOnly() || !fProperties.getElement().isEnabled() || null == R4EUIModelController.getActiveReview() || ((R4EReviewState) R4EUIModelController.getActiveReview().getReview().getState()) .getState() .equals(R4EReviewPhase.R4E_REVIEW_PHASE_COMPLETED)) { fPositionText.setForeground(UIUtils.DISABLED_FONT_COLOR); fAssignedToText.setForeground(UIUtils.DISABLED_FONT_COLOR); fAssignedToButton.setEnabled(false); fUnassignedFromButton.setEnabled(false); } else { fPositionText.setForeground(UIUtils.ENABLED_FONT_COLOR); fAssignedToText.setForeground(UIUtils.ENABLED_FONT_COLOR); fAssignedToButton.setEnabled(true); if (fAssignedToText.getText().length() > 0) { fUnassignedFromButton.setEnabled(true); } else { fUnassignedFromButton.setEnabled(false); } } }
@Override public void createControl(Composite parent) { creatingControl = true; // Create page final Composite mainPanel = new Composite(parent, SWT.NONE); mainPanel.setLayout(new GridLayout(1, false)); mainPanel.setLayoutData( new GridData()); // GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL)); mainPanel.setSize(mainPanel.computeSize(SWT.DEFAULT, SWT.DEFAULT)); setControl(mainPanel); // Create Bottom Composite Composite upperPanel = WidgetFactory.createPanel(mainPanel, SWT.NONE, GridData.FILL_HORIZONTAL, 2, 2); upperPanel.setLayout(new GridLayout(2, false)); setMessage(INITIAL_MESSAGE); Label selectedFileLabel = new Label(upperPanel, SWT.NONE); selectedFileLabel.setText(getString("selectedFile")); // $NON-NLS-1$ selectedFileText = new Text(upperPanel, SWT.BORDER); // , SWT.BORDER | SWT.SINGLE); selectedFileText.setBackground( Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW)); selectedFileText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE)); selectedFileText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); selectedFileText.setEditable(false); createFilePreviewOptionsGroup(mainPanel); createColumnOptionsRadioGroup(mainPanel); createFileContentsGroup(mainPanel); creatingControl = false; setPageComplete(false); }
@Override public void createPartControl(Composite parent) { parent.setLayout(new FillLayout()); description = new Text(parent, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY); // read preferences to set the initial text color String color = Platform.getPreferencesService() .getString("org.fipro.eclipse.migration.ui", "description_color", "black", null); Color toUse = "blue".equals(color) ? Display.getDefault().getSystemColor(SWT.COLOR_BLUE) : Display.getDefault().getSystemColor(SWT.COLOR_BLACK); description.setForeground(toUse); // register a listener on the PreferencesStore to react on changes Activator.getDefault() .getPreferenceStore() .addPropertyChangeListener( new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty() == "description_color") { Color toUse = "blue".equals(event.getNewValue()) ? Display.getDefault().getSystemColor(SWT.COLOR_BLUE) : Display.getDefault().getSystemColor(SWT.COLOR_BLACK); if (description != null && !description.isDisposed()) { description.setForeground(toUse); } } } }); getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(selectionListener); }
@Override protected Composite createToolTipContentArea(Event event, Composite parent) { Composite result = new Composite(parent, SWT.NONE); Color background = new Color(result.getDisplay(), Colors.INFO_TOOLTIP_BACKGROUND.swt()); result.addDisposeListener(e -> background.dispose()); result.setBackground(background); result.setLayout(new GridLayout()); // create tool tip with a reasonable width int width = SWTHelper.stringWidth(result, "ABCDEFGHIJK") * 5; // $NON-NLS-1$ Text text = new Text(result, SWT.WRAP); text.setBackground(background); text.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_BLACK)); text.setText(message.get()); GridData gridData = new GridData(); gridData.widthHint = width; text.setLayoutData(gridData); Dialog.applyDialogFont(result); return result; }
private void createErrorControl(Composite parent) { Color bgColor = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND); Color fgColor = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND); parent.setBackground(bgColor); parent.setForeground(fgColor); GridLayout layout = new GridLayout(); layout.numColumns = 3; int spacing = 8; int margins = 8; layout.marginBottom = margins; layout.marginTop = margins; layout.marginLeft = margins; layout.marginRight = margins; layout.horizontalSpacing = spacing; layout.verticalSpacing = spacing; parent.setLayout(layout); Label imageLabel = new Label(parent, SWT.NONE); imageLabel.setBackground(bgColor); Image image = getImage(); if (image != null) { image.setBackground(bgColor); imageLabel.setImage(image); imageLabel.setLayoutData( new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_BEGINNING)); } Text text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP); text.setBackground(bgColor); text.setForeground(fgColor); // text.setForeground(JFaceColors.getErrorText(text.getDisplay())); text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); text.setText(Messages.getString("ReportDocumentEditor.errorMessage")); // $NON-NLS-1$ detailsButton = new Button(parent, SWT.PUSH); detailsButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { showDetails(!showingDetails); } }); detailsButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); detailsButton.setVisible(e != null); updateDetailsText(); detailsArea = new Composite(parent, SWT.NONE); detailsArea.setBackground(bgColor); detailsArea.setForeground(fgColor); GridData data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 3; data.verticalSpan = 1; detailsArea.setLayoutData(data); detailsArea.setLayout(new FillLayout()); parent.layout(true); }
public void createPartControl(Composite parent) { final Font monospaceFont = new Font(parent.getDisplay(), new FontData("Monospace", 12, SWT.NONE)); final Color greenColor = parent.getDisplay().getSystemColor(SWT.COLOR_DARK_GREEN); final Color redColor = parent.getDisplay().getSystemColor(SWT.COLOR_DARK_RED); final Color blackColor = parent.getDisplay().getSystemColor(SWT.COLOR_BLACK); final Color greyColor = parent.getDisplay().getSystemColor(SWT.COLOR_GRAY); FillLayout fillLayout = (FillLayout) parent.getLayout(); fillLayout.type = SWT.VERTICAL; Composite terminalComposite = new Composite(parent, SWT.NONE); terminalComposite.setLayout(new FormLayout()); terminalComposite.setBackground(blackColor); TabFolder terminalPane = new TabFolder(terminalComposite, SWT.BOTTOM); terminalPane.setBackground(blackColor); FormData terminalLayoutData = new FormData(); terminalLayoutData.top = new FormAttachment(0); terminalLayoutData.left = new FormAttachment(0); terminalLayoutData.right = new FormAttachment(100); terminalPane.setLayoutData(terminalLayoutData); TabItem outTabItem = new TabItem(terminalPane, SWT.NONE); outTabItem.setText("out"); // terminalDataLayer = new DataLayer(currentlySelectedExecutionRecordDataProvider); SelectionLayer selectionLayer = new SelectionLayer(terminalDataLayer); ViewportLayer viewPortLayer = new ViewportLayer(selectionLayer); viewPortLayer.setRegionName(GridRegion.BODY); ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(new DataLayer(columnDataProvider), viewPortLayer, selectionLayer); CompositeLayer compositeLayer = new CompositeLayer(1, 2); compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER, columnHeaderLayer, 0, 0); compositeLayer.setChildLayer(GridRegion.BODY, viewPortLayer, 0, 1); compositeLayer.setConfigLabelAccumulatorForRegion(GridRegion.BODY, configLabelAccumulator); terminalGrid = new NatTable(terminalPane, compositeLayer); terminalGrid.setTheme(new EarlGridTheme()); terminalGrid.setBackground(blackColor); outTabItem.setControl(terminalGrid); TabItem errTabItem = new TabItem(terminalPane, SWT.NONE); errTabItem.setText("err"); tabularErrorTable = new Table(terminalPane, SWT.VIRTUAL | SWT.HIDE_SELECTION); tabularErrorTable.setHeaderVisible(false); tabularErrorTable.setLinesVisible(true); // tabularErrorTable.addListener(SWT.SetData, tabularErrorDataHandler); tabularErrorTable.setFont(monospaceFont); tabularErrorTable.setBackground(redColor); tabularErrorTable.setForeground(greyColor); errTabItem.setControl(tabularErrorTable); TabItem logTabItem = new TabItem(terminalPane, SWT.NONE); logTabItem.setText("log"); tabularLogTable = new Table(terminalPane, SWT.VIRTUAL | SWT.HIDE_SELECTION); tabularLogTable.setHeaderVisible(false); tabularLogTable.setLinesVisible(true); // tabularLogTable.addListener(SWT.SetData, tabularErrorDataHandler); tabularLogTable.setFont(monospaceFont); tabularLogTable.setBackground(greenColor); tabularLogTable.setForeground(greyColor); logTabItem.setControl(tabularLogTable); terminalPane.setSelection(0); commandLineTxt = new Text(terminalComposite, SWT.BORDER); FormData commandLineTxtLayoutData = new FormData(); commandLineTxtLayoutData.left = new FormAttachment(terminalPane, 0, SWT.LEFT); commandLineTxtLayoutData.right = new FormAttachment(terminalPane, 0, SWT.RIGHT); commandLineTxtLayoutData.bottom = new FormAttachment(100); commandLineTxt.setLayoutData(commandLineTxtLayoutData); commandLineTxt.addFocusListener(commandLineFocusListener); commandLineTxt.addKeyListener(commandLineKeyListener); commandLineTxt.setFont(monospaceFont); commandLineTxt.setBackground(blackColor); commandLineTxt.setForeground(greyColor); commandLineTxt.addTraverseListener(preventTraversal); terminalLayoutData.bottom = new FormAttachment(commandLineTxt); monospaceFont.dispose(); }
public Control createControl( final Composite parent, IMemoryBlock memBlock, IDialogSettings properties, ExportMemoryDialog parentDialog) { fMemoryBlock = memBlock; fParentDialog = parentDialog; fProperties = properties; Composite composite = new Composite(parent, SWT.NONE) { public void dispose() { fProperties.put(TRANSFER_FILE, fFileText.getText().trim()); fProperties.put(TRANSFER_START, fStartText.getText().trim()); fProperties.put(TRANSFER_END, fEndText.getText().trim()); try { fStartAddress = getStartAddress(); fEndAddress = getEndAddress(); fOutputFile = getFile(); } catch (Exception e) { } super.dispose(); } }; FormLayout formLayout = new FormLayout(); formLayout.spacing = 5; formLayout.marginWidth = formLayout.marginHeight = 9; composite.setLayout(formLayout); // start address Label startLabel = new Label(composite, SWT.NONE); startLabel.setText(Messages.getString("SRecordExporter.StartAddress")); // $NON-NLS-1$ FormData data = new FormData(); startLabel.setLayoutData(data); fStartText = new Text(composite, SWT.BORDER); data = new FormData(); data.left = new FormAttachment(startLabel); data.width = 120; fStartText.setLayoutData(data); // end address Label endLabel = new Label(composite, SWT.NONE); endLabel.setText(Messages.getString("SRecordExporter.EndAddress")); // $NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fStartText, 0, SWT.CENTER); data.left = new FormAttachment(fStartText); endLabel.setLayoutData(data); fEndText = new Text(composite, SWT.BORDER); data = new FormData(); data.top = new FormAttachment(fStartText, 0, SWT.CENTER); data.left = new FormAttachment(endLabel); data.width = 120; fEndText.setLayoutData(data); // length Label lengthLabel = new Label(composite, SWT.NONE); lengthLabel.setText(Messages.getString("SRecordExporter.Length")); // $NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fStartText, 0, SWT.CENTER); data.left = new FormAttachment(fEndText); lengthLabel.setLayoutData(data); fLengthText = new Text(composite, SWT.BORDER); data = new FormData(); data.top = new FormAttachment(fStartText, 0, SWT.CENTER); data.left = new FormAttachment(lengthLabel); data.width = 120; fLengthText.setLayoutData(data); // file Label fileLabel = new Label(composite, SWT.NONE); fFileText = new Text(composite, SWT.BORDER); Button fileButton = new Button(composite, SWT.PUSH); fileLabel.setText(Messages.getString("Exporter.FileName")); // $NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fileButton, 0, SWT.CENTER); fileLabel.setLayoutData(data); data = new FormData(); data.top = new FormAttachment(fileButton, 0, SWT.CENTER); data.left = new FormAttachment(fileLabel); data.width = 360; fFileText.setLayoutData(data); fileButton.setText(Messages.getString("Exporter.Browse")); // $NON-NLS-1$ data = new FormData(); data.top = new FormAttachment(fLengthText); data.left = new FormAttachment(fFileText); fileButton.setLayoutData(data); // Restriction notice about 32-bit support Label spacingLabel = new Label(composite, SWT.NONE); spacingLabel.setText(""); // $NON-NLS-1$ data = new FormData(); data.left = new FormAttachment(0); data.top = new FormAttachment(fileLabel); spacingLabel.setLayoutData(data); Label restrictionLabel = new Label(composite, SWT.NONE); restrictionLabel.setText( Messages.getString("SRecordExporter.32BitLimitationMessage")); // $NON-NLS-1$ data = new FormData(); data.left = new FormAttachment(0); data.top = new FormAttachment(spacingLabel); restrictionLabel.setLayoutData(data); String textValue = fProperties.get(TRANSFER_FILE); fFileText.setText(textValue != null ? textValue : ""); // $NON-NLS-1$ textValue = fProperties.get(TRANSFER_START); fStartText.setText(textValue != null ? textValue : "0x0"); // $NON-NLS-1$ try { getStartAddress(); } catch (Exception e) { fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); } textValue = fProperties.get(TRANSFER_END); fEndText.setText(textValue != null ? textValue : "0x0"); // $NON-NLS-1$ try { getEndAddress(); } catch (Exception e) { fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); } try { BigInteger length = getEndAddress().subtract(getStartAddress()); fLengthText.setText(length.toString()); if (length.compareTo(BigInteger.ZERO) <= 0) { fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); } } catch (Exception e) { fLengthText.setText("0"); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); } fileButton.addSelectionListener( new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { // TODO Auto-generated method stub } public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(parent.getShell(), SWT.SAVE); dialog.setText(Messages.getString("SRecordExporter.ChooseFile")); // $NON-NLS-1$ dialog.setFilterExtensions(new String[] {"*.*;*"}); // $NON-NLS-1$ dialog.setFilterNames( new String[] {Messages.getString("Exporter.AllFiles")}); // $NON-NLS-1$ dialog.setFileName(fFileText.getText().trim()); dialog.open(); String filename = dialog.getFileName(); if (filename != null && filename.length() != 0) { fFileText.setText(dialog.getFilterPath() + File.separator + filename); } validate(); } }); fStartText.addKeyListener( new KeyListener() { public void keyReleased(KeyEvent e) { try { fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); BigInteger startAddress = getStartAddress(); BigInteger actualLength = getEndAddress().subtract(startAddress); fLengthText.setText(actualLength.toString()); if (actualLength.compareTo(BigInteger.ZERO) <= 0) { fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); } if (startAddress.compareTo(BigInteger.ZERO) < 0) { fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); } BigInteger endAddress = getEndAddress(); if (endAddress.compareTo(BigInteger.ZERO) < 0) { fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); } } catch (Exception ex) { fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); } validate(); } public void keyPressed(KeyEvent e) {} }); fEndText.addKeyListener( new KeyListener() { public void keyReleased(KeyEvent e) { try { fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); BigInteger actualLength = getEndAddress().subtract(getStartAddress()); fLengthText.setText(actualLength.toString()); if (actualLength.compareTo(BigInteger.ZERO) <= 0) { fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); } BigInteger startAddress = getStartAddress(); if (startAddress.compareTo(BigInteger.ZERO) < 0) { fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); } BigInteger endAddress = getEndAddress(); if (endAddress.compareTo(BigInteger.ZERO) < 0) { fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); } } catch (Exception ex) { fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); } validate(); } public void keyPressed(KeyEvent e) {} }); fLengthText.addKeyListener( new KeyListener() { public void keyReleased(KeyEvent e) { try { fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); fStartText.setText(fStartText.getText().trim()); BigInteger length = getLength(); String endString; BigInteger startAddress = getStartAddress(); BigInteger endAddress = startAddress.add(length); if (length.compareTo(BigInteger.ZERO) <= 0) { if (endAddress.compareTo(BigInteger.ZERO) < 0) { endString = endAddress.toString(16); // $NON-NLS-1$ } else { endString = "0x" + endAddress.toString(16); // $NON-NLS-1$ } } else { endString = "0x" + endAddress.toString(16); // $NON-NLS-1$ } fEndText.setText(endString); if (length.compareTo(BigInteger.ZERO) <= 0) { fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); } if (startAddress.compareTo(BigInteger.ZERO) < 0) { fStartText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); } if (endAddress.compareTo(BigInteger.ZERO) < 0) { fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); } } catch (Exception ex) { if (fLengthText.getText().trim().length() != 0) { fEndText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); } fLengthText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); } validate(); } public void keyPressed(KeyEvent e) {} }); fFileText.addKeyListener( new KeyListener() { public void keyReleased(KeyEvent e) { validate(); } public void keyPressed(KeyEvent e) {} }); composite.pack(); parent.pack(); /* * We need to perform a validation. If we do it immediately we will get an exception * because things are not totally setup. So we schedule an immediate running of the * validation. For a very brief time the view logically may show a state which does * not reflect the true state of affairs. But the validate immediately corrects the * info. In practice the user never sees the invalid state displayed, because of the * speed of the draw of the dialog. */ Display.getDefault() .asyncExec( new Runnable() { public void run() { validate(); } }); return composite; }
/** Create contents of the window. */ protected void createContents() { shlMyanmarTyping = new Shell(); shlMyanmarTyping.setSize(437, 456); shlMyanmarTyping.setText("Myanmar Typing"); shlMyanmarTyping.setLayout(new GridLayout(2, false)); lblUnicode = new Label(shlMyanmarTyping, SWT.NONE); lblUnicode.setText("Unicode:"); lblUnicode.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); text_4 = new Text(shlMyanmarTyping, SWT.BORDER); text_4.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_LIGHT_SHADOW)); text_4.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK)); text_4.setFont(SWTResourceManager.getFont("Arial", 10, SWT.NORMAL)); text_4.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); lblText = new Label(shlMyanmarTyping, SWT.NONE); lblText.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblText.setText("Myanmar3:"); text = new Text(shlMyanmarTyping, SWT.BORDER); text.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK)); text.setFont(SWTResourceManager.getFont("Myanmar3", 20, SWT.NORMAL)); text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); lblPyidaungsu = new Label(shlMyanmarTyping, SWT.NONE); lblPyidaungsu.setText("Pyidaungsu:"); lblPyidaungsu.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); text_3 = new Text(shlMyanmarTyping, SWT.BORDER); text_3.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_LIGHT_SHADOW)); text_3.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK)); text_3.setFont(SWTResourceManager.getFont("Pyidaungsu", 12, SWT.NORMAL)); text_3.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); lblNewLabel = new Label(shlMyanmarTyping, SWT.NONE); lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblNewLabel.setText("Noto Sans Myanmar:"); text_2 = new Text(shlMyanmarTyping, SWT.BORDER); text_2.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_LIGHT_SHADOW)); text_2.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK)); text_2.setFont(SWTResourceManager.getFont("Noto Sans Myanmar", 12, SWT.NORMAL)); text_2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); lblNewLabel_1 = new Label(shlMyanmarTyping, SWT.NONE); lblNewLabel_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblNewLabel_1.setText("Zawgyi-One:"); text_1 = new Text(shlMyanmarTyping, SWT.BORDER); text_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_LIGHT_SHADOW)); text_1.setFont(SWTResourceManager.getFont("Zawgyi-One", 12, SWT.NORMAL)); text_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); composite_1 = new Composite(shlMyanmarTyping, SWT.NONE); composite_1.setFont(SWTResourceManager.getFont("Myanmar3", 11, SWT.NORMAL)); composite_1.setLayout(new GridLayout(5, false)); GridData gd_composite_1 = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1); gd_composite_1.heightHint = 73; gd_composite_1.widthHint = 174; composite_1.setLayoutData(gd_composite_1); new Label(composite_1, SWT.NONE); composite = new Composite(composite_1, SWT.NONE); composite.setLayout(new GridLayout(5, false)); btn1 = new Button(composite, SWT.FLAT); btn1.setText(MM.KA); btn1.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn2 = new Button(composite, SWT.FLAT); btn2.setText(MM.KHA); btn2.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn3 = new Button(composite, SWT.FLAT); btn3.setText(MM.GA); btn3.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn4 = new Button(composite, SWT.FLAT); btn4.setText(MM.GHA); btn4.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn5 = new Button(composite, SWT.FLAT); btn5.setText(MM.NGA); btn5.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn6 = new Button(composite, SWT.FLAT); btn6.setText(MM.CA); btn6.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn7 = new Button(composite, SWT.FLAT); btn7.setText(MM.CHA); btn7.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn8 = new Button(composite, SWT.FLAT); btn8.setText(MM.JA); btn8.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn9 = new Button(composite, SWT.FLAT); btn9.setText(MM.JHA); btn9.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn10 = new Button(composite, SWT.FLAT); btn10.setText(MM.NNYA); btn10.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn11 = new Button(composite, SWT.FLAT); btn11.setText(MM.TA); btn11.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn12 = new Button(composite, SWT.FLAT); btn12.setText(MM.THA); btn12.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn13 = new Button(composite, SWT.FLAT); btn13.setText(MM.DA); btn13.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn14 = new Button(composite, SWT.FLAT); btn14.setText(MM.DHA); btn14.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn15 = new Button(composite, SWT.FLAT); btn15.setText(MM.NA); btn15.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn16 = new Button(composite, SWT.FLAT); btn16.setText(MM.PA); btn16.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn17 = new Button(composite, SWT.FLAT); btn17.setText(MM.PHA); btn17.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn18 = new Button(composite, SWT.FLAT); btn18.setText(MM.BA); btn18.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn19 = new Button(composite, SWT.FLAT); btn19.setText(MM.BHA); btn19.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn20 = new Button(composite, SWT.FLAT); btn20.setText(MM.MA); btn20.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn21 = new Button(composite, SWT.FLAT); btn21.setText(MM.YA); btn21.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn22 = new Button(composite, SWT.FLAT); btn22.setText(MM.RA); btn22.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn23 = new Button(composite, SWT.FLAT); btn23.setText(MM.LA); btn23.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn24 = new Button(composite, SWT.FLAT); btn24.setText(MM.WA); btn24.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn25 = new Button(composite, SWT.FLAT); btn25.setText(MM.SA); btn25.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn26 = new Button(composite, SWT.FLAT); btn26.setText(MM.HA); btn26.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn27 = new Button(composite, SWT.FLAT); btn27.setText(MM.LLA); btn27.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); btn28 = new Button(composite, SWT.FLAT); btn28.setText(MM.A); btn28.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); new Label(composite, SWT.NONE); button_5 = new Button(composite, SWT.FLAT); button_5.setText(MM.NNA); composite_2 = new Composite(composite_1, SWT.NONE); composite_2.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); composite_2.setLayout(new GridLayout(2, false)); btnSign1 = new Button(composite_2, SWT.FLAT); btnSign1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); btnSign1.setText(MM.SIGN_TALL_AA); btnSign2 = new Button(composite_2, SWT.FLAT); btnSign2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); btnSign2.setText(MM.SIGN_AA); btnSign3 = new Button(composite_2, SWT.FLAT); btnSign3.setText(MM.SIGN_I); btnSign3.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); btnSign4 = new Button(composite_2, SWT.FLAT); btnSign4.setText(MM.SIGN_II); btnSign4.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); btnSign5 = new Button(composite_2, SWT.FLAT); btnSign5.setText(MM.SIGN_U); btnSign5.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); btnSign6 = new Button(composite_2, SWT.FLAT); btnSign6.setText(MM.SIGN_UU); btnSign6.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); btnSign7 = new Button(composite_2, SWT.FLAT); btnSign7.setText(MM.SIGN_E); btnSign7.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); btnSign8 = new Button(composite_2, SWT.FLAT); btnSign8.setText(MM.SIGN_AI); btnSign8.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); btnSign9 = new Button(composite_2, SWT.FLAT); btnSign9.setText(MM.SIGN_DOT_BELOW); btnSign9.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); btnSign10 = new Button(composite_2, SWT.FLAT); btnSign10.setText(MM.SIGN_ANUSVARA); btnSign10.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); btnSign11 = new Button(composite_2, SWT.FLAT); btnSign11.setText(MM.SIGN_VISARGA); btnSign11.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); btnSign12 = new Button(composite_2, SWT.FLAT); btnSign12.setText(MM.SIGN_ASAT); btnSign12.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); btnSign13 = new Composite(composite_1, SWT.NONE); btnSign13.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); btnSign13.setLayout(new GridLayout(2, false)); btnSign14 = new Button(btnSign13, SWT.FLAT); btnSign14.setText(MM.SIGN_MEDIAL_YA); btnSign15 = new Button(btnSign13, SWT.FLAT); btnSign15.setText(MM.SIGN_MEDIAL_RA); btnSign16 = new Button(btnSign13, SWT.FLAT); btnSign16.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); btnSign16.setText(MM.SIGN_MEDIAL_WA); btnSign17 = new Button(btnSign13, SWT.FLAT); btnSign17.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); btnSign17.setText(MM.SIGN_MEDIAL_HA); button_1 = new Button(btnSign13, SWT.FLAT); button_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); button_1.setText(MM.SIGN_LITTLE_SECTION); button_2 = new Button(btnSign13, SWT.FLAT); button_2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); button_2.setText(MM.SIGN_SECTION); button_4 = new Button(btnSign13, SWT.FLAT); button_4.setFont(SWTResourceManager.getFont("Myanmar3", 11, SWT.NORMAL)); button_4.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); button_4.setText(MM.SIGN_VIRAMA); new Label(btnSign13, SWT.NONE); composite_4 = new Composite(composite_1, SWT.NONE); composite_4.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); composite_4.setLayout(new GridLayout(3, false)); btnNum7 = new Button(composite_4, SWT.FLAT); btnNum7.setText(MM.SEVEN); btnNum8 = new Button(composite_4, SWT.FLAT); btnNum8.setText(MM.EIGHT); btnNum9 = new Button(composite_4, SWT.FLAT); btnNum9.setText(MM.NINE); btnNum4 = new Button(composite_4, SWT.FLAT); btnNum4.setText(MM.FOUR); btnNum5 = new Button(composite_4, SWT.FLAT); btnNum5.setText(MM.FIVE); btnNum6 = new Button(composite_4, SWT.FLAT); btnNum6.setText(MM.SIX); btnNum1 = new Button(composite_4, SWT.FLAT); btnNum1.setText(MM.ONE); btnNum2 = new Button(composite_4, SWT.FLAT); btnNum2.setText(MM.TWO); btnNum3 = new Button(composite_4, SWT.FLAT); btnNum3.setText(MM.THREE); btnNum0 = new Button(composite_4, SWT.FLAT); btnNum0.setText(MM.ZERO); new Label(composite_4, SWT.NONE); new Label(composite_4, SWT.NONE); new Label(composite_1, SWT.NONE); composite_3 = new Composite(composite_1, SWT.NONE); GridData gd_composite_3 = new GridData(SWT.FILL, SWT.CENTER, false, false, 4, 1); gd_composite_3.widthHint = 102; composite_3.setLayoutData(gd_composite_3); composite_3.setLayout(new GridLayout(6, false)); button_3 = new Button(composite_3, SWT.FLAT); button_3.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent arg0) { String normalizeStr = Normalizer2.getNFDInstance().normalize(text.getText()); text.setText(normalizeStr); } }); button_3.setText("Normalize"); button = new Button(composite_3, SWT.FLAT); button.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent arg0) { text.setText(""); } }); button.setText("Clear"); new Label(composite_3, SWT.NONE); lblNewLabel_2 = new Label(composite_3, SWT.NONE); lblNewLabel_2.setAlignment(SWT.RIGHT); lblNewLabel_2.setText("Any Unicode:"); lblNewLabel_2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); text_5 = new Text(composite_3, SWT.BORDER); btnAdd = new Button(composite_3, SWT.FLAT); btnAdd.setFont(SWTResourceManager.getFont("Myanmar3", 11, SWT.NORMAL)); btnAdd.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { String t = btnAdd.getText(); if (t.length() == 1) { text.append(t); } } }); btnAdd.setText("Add"); new Label(composite_1, SWT.NONE); new Label(composite_1, SWT.NONE); new Label(composite_1, SWT.NONE); new Label(composite_1, SWT.NONE); new Label(composite_1, SWT.NONE); new Label(shlMyanmarTyping, SWT.NONE); new Label(shlMyanmarTyping, SWT.NONE); }
@Override protected Control createContents(final Composite parent) { final Composite panel = new Composite(parent, SWT.NONE); panel.setLayout(new GridLayout(2, false)); final Label titleLabel = new Label(panel, SWT.NONE); titleLabel.setAlignment(SWT.RIGHT); { final GridData gridData = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1); gridData.widthHint = 60; titleLabel.setLayoutData(gridData); } titleLabel.setText("Title:"); this.ftitle = new Text(panel, SWT.BORDER); ftitle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); lblDescription = new Label(panel, SWT.NONE); lblDescription.setAlignment(SWT.RIGHT); lblDescription.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1)); lblDescription.setText("Description:"); this.fbody = new Text(panel, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.WRAP); { final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); gridData.heightHint = 150; fbody.setLayoutData(gridData); } this.fbody.setText("(enter error description here, paste any relevant code too)"); final Label contactoptionalLabel = new Label(panel, SWT.NONE); contactoptionalLabel.setAlignment(SWT.RIGHT); contactoptionalLabel.setText("Contact (email):"); this.fcontact = new Text(panel, SWT.BORDER); fcontact.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); fcontact.setText(System.getProperty("user.name")); attachTechnicalDataButton = new Button(panel, SWT.CHECK); attachTechnicalDataButton.setLayoutData( new GridData(SWT.CENTER, SWT.CENTER, false, false, 2, 1)); attachTechnicalDataButton.setSelection(true); attachTechnicalDataButton.setText(" Attach technical data (eclipse and erlide logs) "); sendButton = new Button(panel, SWT.NONE); { GridData gridData = new GridData(SWT.CENTER, SWT.CENTER, false, false, 2, 1); gridData.widthHint = 243; sendButton.setLayoutData(gridData); } sendButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { postReport(); } }); sendButton.setText("Create report"); responseLabel = new Label(panel, SWT.CENTER); responseLabel.setVisible(false); responseLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 2, 1)); responseLabel.setText( "The report was saved in the location below, you can now close this window."); locationLabel = new Text(panel, SWT.CENTER | SWT.WRAP | SWT.READ_ONLY); locationLabel.setVisible(false); locationLabel.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_BLUE)); locationLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); locationLabel.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); locationLabel.setText("location"); responseLabel_1 = new Label(panel, SWT.CENTER); responseLabel_1.setVisible(false); responseLabel_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); responseLabel_1.setText("Please attach the report if you are writing a trouble ticket."); noDefaultAndApplyButton(); return panel; }
/** This is a callback that will allow us to create the viewer and initialize it. */ @Override public void createPartControl(Composite parent) { FormToolkit toolkit = new FormToolkit(parent.getDisplay()); Composite frame = toolkit.createComposite(parent, SWT.BORDER); GridLayoutFactory.fillDefaults().numColumns(2).applyTo(frame); Composite comboDescFrame = toolkit.createComposite(frame, SWT.NONE); GridDataFactory.fillDefaults().applyTo(comboDescFrame); GridLayoutFactory.fillDefaults() .margins(5, 20) .spacing(SWT.DEFAULT, 25) .applyTo(comboDescFrame); Composite comboFrame = toolkit.createComposite(comboDescFrame, SWT.NONE); GridDataFactory.fillDefaults().applyTo(comboFrame); GridLayoutFactory.fillDefaults().applyTo(comboFrame); Composite labelFrame = toolkit.createComposite(comboFrame, SWT.NONE); GridDataFactory.fillDefaults().applyTo(labelFrame); GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(labelFrame); Label jbLabel = WidgetFactory.createLabel( labelFrame, UTIL.getString("TeiidServerOverviewSection.jbLabel")); // $NON-NLS-1$ jbLabel.setForeground(labelFrame.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE)); GridDataFactory.swtDefaults().grab(false, false).applyTo(jbLabel); newServerOrOpenServerViewHyperlink = toolkit.createHyperlink(labelFrame, EDIT_SERVER_LABEL, SWT.NONE); GridDataFactory.swtDefaults().applyTo(newServerOrOpenServerViewHyperlink); newServerOrOpenServerViewHyperlink.addHyperlinkListener( new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { if (serverMap.isEmpty()) { // There are no servers so open the server wizard NewServerAction action = new NewServerAction(getViewSite().getShell(), getServerManager()); action.run(); } else { // open the servers view IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); try { window .getActivePage() .showView("org.eclipse.wst.server.ui.ServersView"); // $NON-NLS-1$ } catch (PartInitException ex) { UTIL.log(ex); } } } }); jbossServerCombo = new Combo(comboFrame, SWT.READ_ONLY | SWT.DROP_DOWN); toolkit.adapt(jbossServerCombo); GridDataFactory.swtDefaults().minSize(250, 30).grab(true, false).applyTo(jbossServerCombo); jbossServerCombo.addSelectionListener( new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { handleServerComboSelection(); } @Override public void widgetDefaultSelected(SelectionEvent e) { handleServerComboSelection(); } }); Text descriptionText = toolkit.createText( comboDescFrame, UTIL.getString("TeiidServerOverviewSection.description"), // $NON-NLS-1$ SWT.MULTI | SWT.WRAP); descriptionText.setForeground(comboDescFrame.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE)); GridDataFactory.fillDefaults() .grab(false, true) .hint(100, SWT.DEFAULT) .applyTo(descriptionText); super.createPartControl(frame); viewer = getCommonViewer(); GridDataFactory.fillDefaults().grab(true, true).applyTo(viewer.getControl()); viewer.setSorter(new NameSorter()); DqpPlugin.getInstance().getServersProvider().addServerLifecycleListener(serversListener); // Populate the jboss server combo box which // should also populate the viewer as well populateJBossServerCombo(); viewer.expandToLevel(3); }
public static void mensagemError(String message) { txtStatus.setBackground(SWTResourceManager.getColor(SWT.COLOR_RED)); txtStatus.setForeground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); txtStatus.setText(message); }
public static void mensagemWarning(String message) { txtStatus.setBackground(SWTResourceManager.getColor(SWT.COLOR_YELLOW)); txtStatus.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK)); txtStatus.setText(message); }
private static void createText(final Group group) { group.setLayout(new GridLayout(2, false)); group.setText("Text widget"); final Label lbl0 = new Label(group, SWT.NONE); lbl0.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); lbl0.setText("No prompt :"); final Text txt0 = new Text(group, SWT.BORDER); txt0.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); final Label lbl1 = new Label(group, SWT.NONE); lbl1.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); lbl1.setText("Simple text prompt :"); final Text txt1 = new Text(group, SWT.BORDER); txt1.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); PromptSupport.setPrompt("Type anything you want", txt1); final Label lbl2 = new Label(group, SWT.NONE); lbl2.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); lbl2.setText("Other style (bold) :"); final Text txt2 = new Text(group, SWT.BORDER); txt2.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); PromptSupport.setPrompt("Type anything you want in bold", txt2); PromptSupport.setFontStyle(SWT.BOLD, txt2); final Label lbl3 = new Label(group, SWT.NONE); lbl3.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); lbl3.setText("Behaviour highlight :"); final Text txt3 = new Text(group, SWT.BORDER); txt3.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); PromptSupport.setPrompt("Type anything you want", txt3); PromptSupport.setFocusBehavior(FocusBehavior.HIGHLIGHT_PROMPT, txt3); final Label lbl4 = new Label(group, SWT.NONE); lbl4.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); lbl4.setText("Change colors :"); final Text txt4 = new Text(group, SWT.BORDER); txt4.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); PromptSupport.setPrompt("Type anything you want", txt4); PromptSupport.setForeground(txt4.getDisplay().getSystemColor(SWT.COLOR_YELLOW), txt4); PromptSupport.setBackground(txt4.getDisplay().getSystemColor(SWT.COLOR_BLACK), txt4); final Label lbl5 = new Label(group, SWT.NONE); lbl5.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); lbl5.setText("Change when widget is initialized :"); final Text txt5 = new Text(group, SWT.BORDER); txt5.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); txt5.setText("Remove what is typed..."); txt5.setBackground(txt4.getDisplay().getSystemColor(SWT.COLOR_BLACK)); txt5.setForeground(txt4.getDisplay().getSystemColor(SWT.COLOR_YELLOW)); PromptSupport.setPrompt("Type anything you want", txt5); PromptSupport.setForeground(txt4.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE), txt5); PromptSupport.setBackground(txt4.getDisplay().getSystemColor(SWT.COLOR_WHITE), txt5); }
public Map<String, Serializable> getParams() { Map<String, Serializable> dsParams = new HashMap<String, Serializable>(); boolean error = false; try { URL u = new URL(urlCombo.getText()); dsParams.put(WFSDataStoreFactory.URL.key, u); } catch (Exception e) { if (red == null) red = new Color(null, 255, 0, 0); urlCombo.setForeground(red); error = true; } // if(user.getText()!=null && !user.getText().equals("")){ //$NON-NLS-1$ // String username = user.getText(); // String password = pass.getText(); // if(password == null || "".equals(password)){ //$NON-NLS-1$ // if(red == null) // red = new Color(null,255,0,0); // user.setForeground(red); // pass.setForeground(red); // error = true; // } // r.put(WFSDataStoreFactory.USERNAME.key,username); // r.put(WFSDataStoreFactory.PASSWORD.key,password); // } if (postDefault.getSelection()) { dsParams.put(WFSDataStoreFactory.PROTOCOL.key, Boolean.TRUE); } else { if (getDefault.getSelection()) { dsParams.put(WFSDataStoreFactory.PROTOCOL.key, Boolean.FALSE); } else { dsParams.put(WFSDataStoreFactory.PROTOCOL.key, null); } } String timeout = timeoutText.getText(); if (!WFSRegistryWizardPage.timeoutDefault.equals(timeout)) { // parse the string Integer sec = null; try { sec = new Integer(timeout); } catch (NumberFormatException e) { if (red == null) red = new Color(null, 255, 0, 0); timeoutText.setForeground(red); error = true; } dsParams.put(WFSDataStoreFactory.TIMEOUT.key, new Integer(sec.intValue() * 1000)); } String buffer = bufferText.getText(); if (!WFSRegistryWizardPage.bufferDefault.equals(buffer)) { // parse the string Integer sec = null; try { sec = new Integer(buffer); } catch (NumberFormatException e) { if (red == null) red = new Color(null, 255, 0, 0); bufferText.setForeground(red); error = true; } dsParams.put(WFSDataStoreFactory.BUFFER_SIZE.key, sec); } // String maxFeatures = maxFeaturesText.getText(); // if(!WFSRegistryWizardPage.maxFeaturesDefault.equals(timeout)){ // // parse the string // Integer max = null; // try{ // max = Integer.valueOf(maxFeatures); // }catch(NumberFormatException e){ // if(red == null) // red = new Color(null,255,0,0); // maxFeaturesText.setForeground(red); // error = true; // } // dsParams.put(WFSDataStoreFactory.MAXFEATURES.key, max); // } /* boolean usePull = usePullParser.getSelection(); dsParams.put("USE_PULL_PARSER", String.valueOf(usePull)); //$NON-NLS-1$ */ return error ? null : dsParams; }
@SuppressWarnings("unused") @Override protected Control createDialogArea(Composite parent) { creatingContents = true; if (isEdit) { setTitle(EDIT_TITLE); } else { setTitle(CREATE_TITLE); } Composite dialogComposite = (Composite) super.createDialogArea(parent); Composite composite = WidgetFactory.createPanel(dialogComposite); // ------------------------------ // Set layout for the Composite // ------------------------------ GridLayout gridLayout = new GridLayout(); composite.setLayout(gridLayout); gridLayout.numColumns = 2; GridData gridData = new GridData(GridData.FILL_BOTH); gridData.grabExcessHorizontalSpace = true; gridData.widthHint = 500; composite.setLayoutData(gridData); Label label = new Label(composite, SWT.NONE | SWT.RIGHT); label.setText(UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.NAME)); label.setLayoutData(new GridData()); final Text indexNameText = new Text(composite, SWT.BORDER | SWT.SINGLE); indexNameText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE)); indexNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); indexNameText.addModifyListener( new ModifyListener() { @Override public void modifyText(final ModifyEvent event) { String value = indexNameText.getText(); if (value == null) { value = EMPTY_STRING; } editedIndex.setName(value); validate(); } }); label = new Label(composite, SWT.NONE | SWT.RIGHT); label.setText(Messages.nameInSourceLabel); label.setLayoutData(new GridData()); final Text indexNISText = new Text(composite, SWT.BORDER | SWT.SINGLE); indexNISText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE)); indexNISText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); indexNISText.addModifyListener( new ModifyListener() { @Override public void modifyText(final ModifyEvent event) { String value = indexNISText.getText(); if (value == null) { value = EMPTY_STRING; } editedIndex.setNameInSource(value); validate(); } }); // Group to present properties widgets PROPERTIES_GROUP: { this.autoUpdateCB = new Button(composite, SWT.CHECK | SWT.RIGHT); this.autoUpdateCB.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); this.autoUpdateCB.setText(Messages.autoUpdateLabel); this.autoUpdateCB.addSelectionListener( new SelectionAdapter() { /** * {@inheritDoc} * * @see * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(SelectionEvent e) { editedIndex.setAutoUpdate(autoUpdateCB.getSelection()); validate(); } }); new Label(composite, SWT.NONE); this.nullableCB = new Button(composite, SWT.CHECK | SWT.RIGHT); this.nullableCB.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); this.nullableCB.setText(Messages.nullableLabel); this.nullableCB.addSelectionListener( new SelectionAdapter() { /** * {@inheritDoc} * * @see * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(SelectionEvent e) { editedIndex.setNullable(nullableCB.getSelection()); validate(); } }); new Label(composite, SWT.NONE); this.uniqueCB = new Button(composite, SWT.CHECK | SWT.RIGHT); this.uniqueCB.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); this.uniqueCB.setText(Messages.uniqueLabel); this.uniqueCB.addSelectionListener( new SelectionAdapter() { /** * {@inheritDoc} * * @see * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(SelectionEvent e) { editedIndex.setUnique(uniqueCB.getSelection()); validate(); } }); new Label(composite, SWT.NONE); label = new Label(composite, SWT.NONE | SWT.RIGHT); label.setText(Messages.filterConditionLabel); label.setLayoutData(new GridData()); filterConditionText = new Text(composite, SWT.BORDER | SWT.SINGLE); filterConditionText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE)); filterConditionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); filterConditionText.addModifyListener( new ModifyListener() { @Override public void modifyText(final ModifyEvent event) { String value = filterConditionText.getText(); if (value == null) { value = EMPTY_STRING; } editedIndex.setFilterCondition(value); validate(); } }); } Group theColumnsGroup = WidgetFactory.createGroup( dialogComposite, Messages.selectColumnReferencesForIndex, SWT.NONE, 1, 1); theColumnsGroup.setLayout(new GridLayout(1, false)); GridData gd = new GridData(GridData.FILL_BOTH); gd.heightHint = 120; gd.widthHint = 500; theColumnsGroup.setLayoutData(gd); Table tableWidget = new Table( theColumnsGroup, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.CHECK); tableWidget.setHeaderVisible(false); tableWidget.setLinesVisible(true); tableWidget.setLayout(new TableLayout()); tableWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); theColumnDataViewer = new TableViewer(tableWidget); gd = new GridData(GridData.FILL_BOTH); gd.heightHint = 160; gd.horizontalSpan = 2; theColumnDataViewer.getControl().setLayoutData(gd); theColumnDataViewer.setContentProvider( new ITreeContentProvider() { @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { // TODO Auto-generated method stub } @Override public void dispose() { // TODO Auto-generated method stub } @Override public boolean hasChildren(Object element) { return !theTable.getColumns().isEmpty(); } @Override public Object getParent(Object element) { return null; } @Override public Object[] getElements(Object inputElement) { if (inputElement instanceof RelationalTable) { return theTable.getColumns().toArray(new Object[0]); } return new Object[0]; } @Override public Object[] getChildren(Object parentElement) { // TODO Auto-generated method stub return new Object[0]; } }); this.theColumnDataViewer .getTable() .addSelectionListener( new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { editedIndex.getColumns().clear(); for (TableItem item : theColumnDataViewer.getTable().getItems()) { if (item.getChecked()) { editedIndex.addColumn((RelationalColumn) item.getData()); } } validate(); } @Override public void widgetDefaultSelected(SelectionEvent e) {} }); theColumnDataViewer.setLabelProvider(new ColumnDataLabelProvider(0)); theColumnDataViewer.setInput(this.theTable); for (RelationalColumn col : this.editedIndex.getColumns()) { for (TableItem item : theColumnDataViewer.getTable().getItems()) { if (item.getData() == col) { item.setChecked(true); } } } DESCRIPTION_GROUP: { final Group descGroup = WidgetFactory.createGroup( dialogComposite, UILabelUtil.getLabel(UiLabelConstants.LABEL_IDS.DESCRIPTION), GridData.FILL_BOTH, 3); descriptionTextEditor = new StyledTextEditor( descGroup, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.WRAP | SWT.BORDER); final GridData descGridData = new GridData(GridData.FILL_BOTH); descGridData.horizontalSpan = 1; descGridData.heightHint = 120; // descGridData.minimumHeight = 30; descGridData.grabExcessVerticalSpace = true; descriptionTextEditor.setLayoutData(descGridData); descriptionTextEditor.setText(""); // $NON-NLS-1$ descriptionTextEditor .getTextWidget() .addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { editedIndex.setDescription(descriptionTextEditor.getText()); } }); } setMessage(Messages.newIndexMessage); if (editedIndex.getName() != null) { indexNameText.setText(editedIndex.getName()); } if (editedIndex.getNameInSource() != null) { indexNISText.setText(editedIndex.getNameInSource()); } this.autoUpdateCB.setSelection(editedIndex.isAutoUpdate()); this.nullableCB.setSelection(editedIndex.isNullable()); this.uniqueCB.setSelection(editedIndex.isUnique()); if (editedIndex.getFilterCondition() != null) { filterConditionText.setText(editedIndex.getFilterCondition()); } if (editedIndex.getDescription() != null) { descriptionTextEditor.setText(editedIndex.getDescription()); } creatingContents = false; return composite; }
/** * @see * org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite) * @since 5.5.3 */ @Override protected Control createDialogArea(Composite parent) { Composite pnlOuter = (Composite) super.createDialogArea(parent); Composite panel = new Composite(pnlOuter, SWT.NONE); GridLayout gridLayout = new GridLayout(); gridLayout.marginLeft = 20; gridLayout.marginRight = 20; panel.setLayout(gridLayout); panel.setLayoutData(new GridData(GridData.FILL_BOTH)); // set title setTitle(Messages.selectProcedureTypeDialogSubTitle); { // simple procedure procedureRB = new Button(panel, SWT.RADIO); procedureRB.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false)); procedureRB.setText(Messages.procedureLabel); procedureRB.addSelectionListener( new SelectionAdapter() { /** * {@inheritDoc} * * @see * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(SelectionEvent e) { handleInfoChanged(); } }); procedureRB.setSelection(!relationalProcedure.isFunction()); Text descText = new Text(panel, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY); descText.setBackground(parent.getBackground()); descText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE)); descText.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true)); ((GridData) descText.getLayoutData()).horizontalIndent = 20; ((GridData) descText.getLayoutData()).heightHint = (3 * descText.getLineHeight()); descText.setText(Messages.createRelationalViewProcedureDescription); } { // user defined function userDefinedFunctionRB = new Button(panel, SWT.RADIO); userDefinedFunctionRB.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false)); userDefinedFunctionRB.setText(Messages.userDefinedFunctionLabel); userDefinedFunctionRB.addSelectionListener( new SelectionAdapter() { /** * {@inheritDoc} * * @see * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(SelectionEvent e) { handleInfoChanged(); } }); Text descText = new Text(panel, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY); descText.setBackground(parent.getBackground()); descText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE)); descText.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true)); ((GridData) descText.getLayoutData()).horizontalIndent = 20; ((GridData) descText.getLayoutData()).heightHint = (3 * descText.getLineHeight()); descText.setText(Messages.createRelationalViewUserDefinedFunctionDescription); } return pnlOuter; }
public static void mensagemLimpar() { txtStatus.setBackground(null); txtStatus.setForeground(null); txtStatus.setText("Barra de Status!"); }
/** Create the tableViewer Panel */ @SuppressWarnings("unused") private void createTableViewerPanel(Composite theParent) { Composite tablePanel = new Composite(theParent, SWT.NONE); // Set the layout GridLayout gridLayout = new GridLayout(); tablePanel.setLayout(gridLayout); GridData gridData = new GridData(GridData.FILL_BOTH); tablePanel.setLayoutData(gridData); // Add header panel HEADER_PANEL: { Composite headerPanel = WidgetFactory.createPanel(tablePanel); // ------------------------------ // Set layout for the Composite // ------------------------------ headerPanel.setLayout(new GridLayout()); ((GridLayout) headerPanel.getLayout()).numColumns = 3; headerPanel.setLayoutData(new GridData(GridData.FILL_BOTH)); ((GridData) headerPanel.getLayoutData()).minimumHeight = 80; // ((GridData)headerPanel.getLayoutData()).grabExcessHorizontalSpace = true; // Add general info/instructions text box { helpText = new Text(headerPanel, SWT.WRAP | SWT.READ_ONLY); helpText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW)); helpText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE)); helpText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); ((GridData) helpText.getLayoutData()).horizontalSpan = 3; ((GridData) helpText.getLayoutData()).heightHint = 40; ((GridData) helpText.getLayoutData()).widthHint = 360; helpText.setText(Messages.datatypeReconciler_helpText); } // Add button bar containing: // [CHANGE ALL COLUMN DATATYPES] - or - [CONVERT ALL SQL SYMBOLS] this.convertAllSqlSymbolsButton = WidgetFactory.createButton( headerPanel, Messages.datatypeReconciler_convertAllSqlSymbolsLabel); this.convertAllSqlSymbolsButton.setToolTipText( Messages.datatypeReconciler_convertAllSqlSymbolsTooltip); this.convertAllSqlSymbolsButton.setImage( UiPlugin.getDefault().getImage(PluginConstants.Images.ARROW_LEFT_ICON)); this.convertAllSqlSymbolsButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent event) { changeAllColumnDatatypesButtonPressed(); } }); WidgetFactory.createLabel(headerPanel, " - or - "); // $NON-NLS-1$ this.changeAllColumnDatatypesButton = WidgetFactory.createButton( headerPanel, Messages.datatypeReconciler_convertAllColumnDatatypesLabel); this.changeAllColumnDatatypesButton.setToolTipText( Messages.datatypeReconciler_convertAllColumnDatatypesTooltip); this.changeAllColumnDatatypesButton.setImage( UiPlugin.getDefault().getImage(PluginConstants.Images.ARROW_RIGHT_ICON)); this.changeAllColumnDatatypesButton.setEnabled(false); this.changeAllColumnDatatypesButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent event) { changeAllColumnDatatypesPressed(); } }); } BINDING_TABLE: { table = new Table(tablePanel, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); table.setHeaderVisible(true); table.setLinesVisible(true); table.setLayout(new TableLayout()); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); gd.heightHint = 200; table.setLayoutData(gd); this.bindingTableViewer = new TableViewer(table); this.bindingTableViewer.getControl().setLayoutData(gd); this.bindingContentProvider = new BindingContentProvider(); // create columns // | status icon | Source SQL Symbol | <-- | Matched Datatype | -> | Target Column // COLUMN 0 : STATUS ICON Button TableViewerColumn column = new TableViewerColumn(this.bindingTableViewer, SWT.LEFT); column.setLabelProvider(new TheBindingColumnLabelProvider(0)); column.getColumn().setText(getSpaces(8)); column.getColumn().pack(); // COLUMN 1 : SOURCE SQL SYMBOL column = new TableViewerColumn(this.bindingTableViewer, SWT.LEFT); column.getColumn().setText(Messages.datatypeReconciler_sourceSqlSymbolLabel + getSpaces(100)); column.setLabelProvider(new TheBindingColumnLabelProvider(1)); column.getColumn().pack(); // COLUMN 2 : LEFT ARROW Button column = new TableViewerColumn(this.bindingTableViewer, SWT.LEFT); column.getColumn().setText(getSpaces(8)); column.setLabelProvider(new TheBindingColumnLabelProvider(2)); column.setEditingSupport(new ConvertSymbolEditingSupport(this.bindingTableViewer)); column.getColumn().pack(); column.getColumn().setToolTipText(Messages.datatypeReconciler_convertSourceDatatypeTooltip); // COLUMN 3 : Matched datatype column = new TableViewerColumn(this.bindingTableViewer, SWT.LEFT); column.getColumn().setText(Messages.datatypeReconciler_matchedTypeLabel + getSpaces(60)); column.setLabelProvider(new TheBindingColumnLabelProvider(3)); column.setEditingSupport(new ChangeProposedDatatypeEditingSupport(this.bindingTableViewer)); column.getColumn().pack(); column.getColumn().setToolTipText(Messages.datatypeReconciler_matchedDatatypeTooltip); // COLUMN 4 : RIGHT ARROW Button column = new TableViewerColumn(this.bindingTableViewer, SWT.LEFT); column.getColumn().setText(getSpaces(8)); column.setLabelProvider(new TheBindingColumnLabelProvider(4)); column.setEditingSupport(new ChangeDatatypeEditingSupport(this.bindingTableViewer)); column.getColumn().pack(); column.getColumn().setToolTipText(Messages.datatypeReconciler_changeTargetDatatypeTooltip); // COLUMN 5 : Target Column Definition column = new TableViewerColumn(this.bindingTableViewer, SWT.LEFT); column.getColumn().setText(Messages.datatypeReconciler_targetColumnLabel + getSpaces(25)); column.setLabelProvider(new TheBindingColumnLabelProvider(5)); column.getColumn().pack(); bindingTableViewer.setUseHashlookup(true); bindingTableViewer.setContentProvider(this.bindingContentProvider); bindingTableViewer.setInput(this.bindingListInput); updateRowColors(); } // Panel to display selection details SELECTION_STATUS_PANEL: { Composite selectionPanel = WidgetFactory.createGroup( tablePanel, Messages.datatypeReconciler_selectionPanelInfoLabel); // ------------------------------ // Set layout for the Composite // ------------------------------ selectionPanel.setLayout(new GridLayout()); ((GridLayout) selectionPanel.getLayout()).numColumns = 2; selectionPanel.setLayoutData(new GridData(GridData.FILL_BOTH)); ((GridData) selectionPanel.getLayoutData()).minimumHeight = 80; // Label selectedSymbolLabel = new Label(selectionPanel, SWT.NONE); // selectedSymbolLabel.setText("Selected Symbol: "); symbolConversionLabel = new Label(selectionPanel, SWT.NONE); symbolConversionLabel.setText(PluginConstants.EMPTY_STRING); symbolConversionLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); symbolConversionLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE)); Label messageLabel = new Label(selectionPanel, SWT.NONE); // messageLabel.setText("Status: "); symbolWarningLabel = new Label(selectionPanel, SWT.NONE); symbolWarningLabel.setText(PluginConstants.EMPTY_STRING); symbolWarningLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); symbolWarningLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE)); } }
/** Create contents of the window */ protected void createContents() { m_BkscoverageShell = new Shell(); m_BkscoverageShell.setImage( SWTResourceManager.getImage(BKSCoverageAppWnd.class, "/Properties.ico")); final BorderLayout borderLayout = new BorderLayout(0, 0); borderLayout.setVgap(5); m_BkscoverageShell.setLayout(borderLayout); m_BkscoverageShell.setSize(800, 400); m_BkscoverageShell.setMinimumSize(new Point(800, 400)); m_BkscoverageShell.setText("BKSCoverage"); Composite composite; composite = new Composite(m_BkscoverageShell, SWT.NONE); { TabFolder tabFolder = new TabFolder(composite, SWT.NONE); tabFolder.setBounds(10, 10, 748, 173); { TabItem tbtmTools = new TabItem(tabFolder, SWT.NONE); tbtmTools.setText("Parameters"); Composite composite_1 = new Composite(tabFolder, SWT.NONE); tbtmTools.setControl(composite_1); m_txtWKSPFolder = new Text(composite_1, SWT.BORDER); m_txtWKSPFolder.setText(""); m_txtWKSPFolder.setBounds(122, 14, 564, 21); Button btnWKSPFolder = new Button(composite_1, SWT.NONE); btnWKSPFolder.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { _selectFolder(m_txtWKSPFolder); } }); btnWKSPFolder.setText("..."); btnWKSPFolder.setBounds(692, 12, 38, 25); m_txtStorageFile = new Text(composite_1, SWT.BORDER); m_txtStorageFile.setText(""); m_txtStorageFile.setBounds(122, 45, 564, 21); Button btnStorageFile = new Button(composite_1, SWT.NONE); btnStorageFile.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { _selectFolder(m_txtStorageFile); } }); btnStorageFile.setText("..."); btnStorageFile.setBounds(692, 43, 38, 25); m_lblStorageFile = new Label(composite_1, SWT.NONE); m_lblStorageFile.setText("Storage File:"); m_lblStorageFile.setBounds(10, 48, 119, 15); Label lblUpdFolder = new Label(composite_1, SWT.NONE); lblUpdFolder.setText("WKSP Folder:"); lblUpdFolder.setBounds(10, 17, 119, 15); { m_chkLoadFromStorage = new Button(composite_1, SWT.CHECK); m_chkLoadFromStorage.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) {} }); m_chkLoadFromStorage.setLocation(122, 75); m_chkLoadFromStorage.setSize(138, 16); m_chkLoadFromStorage.setSelection(true); m_chkLoadFromStorage.setText("Load From Storage"); } { m_btnCheckWKSP = new Button(composite_1, SWT.NONE); m_btnCheckWKSP.setLocation(120, 109); m_btnCheckWKSP.setSize(90, 25); m_btnCheckWKSP.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { checkWKPS(); } }); m_btnCheckWKSP.setText("Check WKSP"); } } } composite.setLayoutData(BorderLayout.NORTH); final Label lblX = new Label(composite, SWT.NONE); lblX.setBounds(10, 10, 14, 180); final CTabFolder m_tabTraces = new CTabFolder(m_BkscoverageShell, SWT.NONE); m_tabTraces.setLayoutData(BorderLayout.CENTER); m_infoTabItem = new CTabItem(m_tabTraces, SWT.NONE); m_infoTabItem.setText("Info"); final Text txtInfo = new Text(m_tabTraces, SWT.V_SCROLL | SWT.READ_ONLY | SWT.MULTI | SWT.H_SCROLL | SWT.BORDER); txtInfo.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); txtInfo.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); txtInfo.setEditable(false); m_infoTabItem.setControl(txtInfo); m_warnTabItem = new CTabItem(m_tabTraces, SWT.NONE); m_warnTabItem.setText("Warning"); final Text txtWarn = new Text(m_tabTraces, SWT.V_SCROLL | SWT.READ_ONLY | SWT.MULTI | SWT.H_SCROLL | SWT.BORDER); txtWarn.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); txtWarn.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); txtWarn.setEditable(false); m_warnTabItem.setControl(txtWarn); m_debugTabItem = new CTabItem(m_tabTraces, SWT.NONE); m_debugTabItem.setText("Debug"); final Text txtDebug = new Text(m_tabTraces, SWT.V_SCROLL | SWT.READ_ONLY | SWT.MULTI | SWT.H_SCROLL | SWT.BORDER); txtDebug.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); txtDebug.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); txtDebug.setEditable(false); m_debugTabItem.setControl(txtDebug); m_errorTabItem = new CTabItem(m_tabTraces, SWT.NONE); m_errorTabItem.setText("Error"); final Text txtError = new Text(m_tabTraces, SWT.V_SCROLL | SWT.READ_ONLY | SWT.MULTI | SWT.H_SCROLL | SWT.BORDER); txtError.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); txtError.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); txtError.setEditable(false); m_errorTabItem.setControl(txtError); }