private void createControls() { Display display = UIUtils.getDisplay(); if (tipShell != null) { return; } tipShell = new Shell(display, SWT.ON_TOP | SWT.TOOL); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2; gridLayout.marginWidth = 2; gridLayout.marginHeight = 2; tipShell.setLayout(gridLayout); tipShell.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); tipLabelImage = new Label(tipShell, SWT.NONE); tipLabelImage.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); tipLabelImage.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); tipLabelImage.setLayoutData( new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER)); tipLabelText = new Label(tipShell, SWT.NONE); tipLabelText.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); tipLabelText.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); tipLabelText.setLayoutData( new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER)); }
public BackBoard(Composite parent, int style) { super(parent, SWT.NONE); this.display = parent.getDisplay(); GridLayout layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; super.setLayout(layout); Composite back = new Composite(this, SWT.NONE); back.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); back.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); GridLayout backLayout = new GridLayout(); backLayout.numColumns = 1; backLayout.verticalSpacing = 10; backLayout.marginWidth = 0; backLayout.marginHeight = 0; back.setLayout(backLayout); GridData titleBarGridData = new GridData(GridData.FILL, GridData.FILL, true, false); titleBarGridData.heightHint = 33; titleBar = new Canvas(back, SWT.NONE); titleBar.setLayoutData(titleBarGridData); titleBar.setBackgroundImage( Activator.getImageDescriptor("/icons/titleback.gif").createImage(display)); backLayout = new GridLayout(); backLayout.horizontalSpacing = 10; backLayout.marginWidth = 0; backLayout.marginHeight = 3; backLayout.marginRight = 10; titleBar.setLayout(backLayout); paintListener = new PaintListener() { public void paintControl(PaintEvent e) { if (e.widget == titleBar) { drawTitle(e); } } }; titleBar.addPaintListener(paintListener); contents = new Composite(back, SWT.NONE); GridData contentsGridData = new GridData(GridData.FILL, GridData.FILL, true, true); contents.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); contents.setLayoutData(contentsGridData); GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true); gridData.horizontalAlignment = SWT.RIGHT; toolBar = new ToolBar(titleBar, SWT.FLAT); toolBar.setLayoutData(gridData); toolBar.setBackgroundImage( Activator.getImageDescriptor("/icons/titleback.gif").createImage(display)); }
protected void drawBottomSpace(GC gc) { Rectangle r = getClientArea(); if (m_Model.getRowCount() > 0) { r.y = m_Model.getFirstRowHeight() + (m_Model.getFixedRowCount() - 1 + m_RowsVisible) * m_Model.getRowHeight() + 1; } gc.setBackground(getBackground()); gc.fillRectangle(r); gc.fillRectangle(getLastColumnRight() + 2, 0, r.width, r.height); if (m_Model.getRowCount() > 0) { if (flatStyleSpecified) // gc.setForeground(this.getBackground()); gc.setForeground(m_Display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); else gc.setForeground(m_Display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW)); // Linke Schattenlinie gc.drawLine(0, 0, 0, r.y - 1); } if (!flatStyleSpecified) gc.setForeground(this.getBackground()); else gc.setForeground(m_Display.getSystemColor(SWT.COLOR_WHITE)); // Untere Abschlusslinie gc.drawLine(0, r.y - 1, getLastColumnRight() + 1, r.y - 1); // Rechte Abschlusslinie gc.drawLine(getLastColumnRight() + 1, 0, getLastColumnRight() + 1, r.y - 1); }
private void updateItems(final FileInfo parent) { if (fDisplay == null) return; assert Thread.currentThread() == fDisplay.getThread(); TreeItem[] items = null; boolean expanded = true; if (parent.children == null || parent.children_error != null) { if (parent == fRootInfo) { fileTree.setItemCount(1); items = fileTree.getItems(); } else { TreeItem item = findItem(parent); if (item == null) return; expanded = item.getExpanded(); item.setItemCount(1); items = item.getItems(); } assert items.length == 1; items[0].removeAll(); if (parent.children_pending) { items[0].setForeground(fDisplay.getSystemColor(SWT.COLOR_LIST_FOREGROUND)); items[0].setText("Pending..."); } else if (parent.children_error != null) { String msg = parent.children_error.getMessage(); if (msg == null) msg = parent.children_error.getClass().getName(); else msg = msg.replace('\n', ' '); items[0].setForeground(fDisplay.getSystemColor(SWT.COLOR_RED)); items[0].setText(msg); items[0].setImage((Image) null); } else if (expanded) { loadChildren(parent); items[0].setForeground(fDisplay.getSystemColor(SWT.COLOR_LIST_FOREGROUND)); items[0].setText("Pending..."); } else { items[0].setText(""); } } else { FileInfo[] arr = parent.children; if (parent == fRootInfo) { fileTree.setItemCount(arr.length); items = fileTree.getItems(); } else { TreeItem item = findItem(parent); if (item == null) return; expanded = item.getExpanded(); item.setItemCount(expanded ? arr.length : 1); items = item.getItems(); } if (expanded) { assert items.length == arr.length; for (int i = 0; i < items.length; i++) fillItem(items[i], arr[i]); expandSelect(); } else { items[0].setText(""); } } }
/* (non-Javadoc) * @see IgoOutlinePanel#setFocus(boolean) */ public void setFocus(boolean focused) { isFocused_ = focused; Display display = frame_.getDisplay(); frame_.setBackground( display.getSystemColor(focused ? SWT.COLOR_LIST_SELECTION : SWT.COLOR_WIDGET_BACKGROUND)); annotationLabel_.setBackground( display.getSystemColor(focused ? SWT.COLOR_LIST_SELECTION : SWT.COLOR_WIDGET_BACKGROUND)); annotationLabel_.setForeground( display.getSystemColor( focused ? SWT.COLOR_LIST_SELECTION_TEXT : SWT.COLOR_WIDGET_FOREGROUND)); }
private StyleRange createRange(Match match, boolean selection) { Display display = composite.getDisplay(); Color fgColor, bgColor; if (selection) { // Lighten to avoid search selection on system selection fgColor = ColorManager.lighten(display.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT), 50); bgColor = ColorManager.getInstance().getSelectedBackgroundColor(); } else { // To avoid white text on light-green background fgColor = display.getSystemColor(SWT.COLOR_BLACK); bgColor = ColorManager.getInstance().getBackgroundColor(); } return new StyleRange(match.getOffset(), match.getLength(), fgColor, bgColor); }
/** * Set color and icon for a test method's TreeItem. * * @param node * @param outcome */ private void setColorAndIconForNode(TreeItem node, ApexTestOutcome outcome) { if (Utils.isEmpty(node) || Utils.isEmpty(outcome)) return; Display display = node.getDisplay(); if (outcome.equals(ApexTestOutcome.Pass)) { node.setForeground(display.getSystemColor(PASS_COLOR)); node.setImage(PASS_ICON); } else if (outcome.equals(ApexTestOutcome.Skip)) { node.setForeground(display.getSystemColor(WARNING_COLOR)); node.setImage(WARNING_ICON); } else { node.setForeground(display.getSystemColor(FAILURE_COLOR)); node.setImage(FAILURE_ICON); } }
@Override protected Control createContents(Composite parent) { ColorController.assignMethodColors(parent.getDisplay(), mReader.getMethods()); SelectionController selectionController = new SelectionController(); GridLayout gridLayout = new GridLayout(1, false); gridLayout.marginWidth = 0; gridLayout.marginHeight = 0; gridLayout.horizontalSpacing = 0; gridLayout.verticalSpacing = 0; parent.setLayout(gridLayout); Display display = parent.getDisplay(); Color darkGray = display.getSystemColor(SWT.COLOR_DARK_GRAY); // Create a sash form to separate the timeline view (on top) // and the profile view (on bottom) SashForm sashForm1 = new SashForm(parent, SWT.VERTICAL); sashForm1.setBackground(darkGray); sashForm1.SASH_WIDTH = 3; GridData data = new GridData(GridData.FILL_BOTH); sashForm1.setLayoutData(data); // Create the timeline view new TimeLineView(sashForm1, mReader, selectionController); // Create the profile view new ProfileView(sashForm1, mReader, selectionController); return sashForm1; }
@Override public void createPartControl(Composite parent) { if (engine == null) { init(); } Display display = parent.getDisplay(); fBackgroundColor = display.getSystemColor(SWT.COLOR_LIST_BACKGROUND); fForegroundColor = display.getSystemColor(SWT.COLOR_LIST_FOREGROUND); fSeparatorColor = ColorManager.getColor(152, 170, 203); fComposite = createComposite(parent); fComposite.setLayout(new GridLayout()); createTitleLabel(fComposite, Messages.getString("ReportDocumentEditor.1")); // $NON-NLS-1$ createLabel(fComposite, null); createLabel(fComposite, null); createHeadingLabel(fComposite, Messages.getString("ReportDocumentEditor.2")); // $NON-NLS-1$ Composite separator = createCompositeSeparator(fComposite); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = 2; separator.setLayoutData(data); createInfomation(fComposite); }
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new FillLayout()); final StyledText styledText = new StyledText(shell, SWT.WRAP | SWT.BORDER); styledText.setText(text); FontData data = display.getSystemFont().getFontData()[0]; Font font = new Font(display, data.getName(), 16, SWT.BOLD); styledText.setFont(font); styledText.setForeground(display.getSystemColor(SWT.COLOR_BLUE)); styledText.addListener( SWT.Resize, new Listener() { public void handleEvent(Event event) { Rectangle rect = styledText.getClientArea(); Image newImage = new Image(display, 1, Math.max(1, rect.height)); GC gc = new GC(newImage); gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE)); gc.setBackground(display.getSystemColor(SWT.COLOR_YELLOW)); gc.fillGradientRectangle(rect.x, rect.y, 1, rect.height, true); gc.dispose(); styledText.setBackgroundImage(newImage); if (oldImage != null) oldImage.dispose(); oldImage = newImage; } }); shell.setSize(700, 400); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } if (oldImage != null) oldImage.dispose(); font.dispose(); display.dispose(); }
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); // Set the shell background to something different shell.setBackground(display.getSystemColor(SWT.COLOR_RED)); // Tell the shell to give its children the same background color or image shell.setBackgroundMode(SWT.INHERIT_DEFAULT); // Optionally trying creating a patterned image for the shell background // final Image backImage = new Image(display,10,10); // GC gc = new GC(backImage); // gc.drawLine(0,0,9,9); // gc.dispose(); // shell.addDisposeListener(new DisposeListener() { // public void widgetDisposed(DisposeEvent e) { // backImage.dispose(); // } // }); // shell.setBackgroundImage(backImage); PGroup group = new PGroup(shell, SWT.SMOOTH); group.setText("Example"); group.setLayout(new FillLayout()); group.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); Composite groupClient = new Composite(group, SWT.NONE); groupClient.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); groupClient.setLayout(new GridLayout()); Label label = new Label(groupClient, SWT.NONE); label.setText("Contents"); Button button = new Button(groupClient, SWT.PUSH); button.setText("Contents"); Scale scale = new Scale(groupClient, SWT.HORIZONTAL); shell.setSize(200, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
/** * Blends two colors with the given ration. The colors are represented by int values as colors as * defined in the {@link SWT} class. * * @param color1 First color. * @param color2 Second color. * @param ratio Percentage of the first color in the blend (0-100). * @param display {@link Display} * @return New color. * @see FormColors#blend(RGB, RGB, int) */ private Color createColor(int color1, int color2, int ratio, Display display) { RGB rgb1 = display.getSystemColor(color1).getRGB(); RGB rgb2 = display.getSystemColor(color2).getRGB(); RGB blend = FormColors.blend(rgb2, rgb1, ratio); return new Color(display, blend); }
@Override public Color getBackground(Object element) { if (isUnmodifiable(element)) { Display display = Display.getCurrent(); return display.getSystemColor(SWT.COLOR_INFO_BACKGROUND); } return null; }
private void inititalizeColors() { if (getSite().getShell().isDisposed()) return; Display display = getSite().getShell().getDisplay(); if (display == null || display.isDisposed()) return; setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); ColorRegistry registry = JFaceResources.getColorRegistry(); registry.addListener(this); fBackgroundColorRGB = registry.getRGB(getBackgroundColorKey()); Color bgColor; if (fBackgroundColorRGB == null) { bgColor = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND); fBackgroundColorRGB = bgColor.getRGB(); } else { bgColor = new Color(display, fBackgroundColorRGB); fBackgroundColor = bgColor; } setBackground(bgColor); }
void paint(PaintEvent event) { GC gc = event.gc; Display disp = getDisplay(); Rectangle rect = getClientArea(); gc.fillRectangle(rect); if (showBorder) { drawBevelRect( gc, rect.x, rect.y, rect.width - 1, rect.height - 1, disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW), disp.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW)); } paintStripes(gc); }
/** * Initializes the default colors. * * @since 3.3 */ private void initializeDefaultColors() { if (getPreferenceStore() .getBoolean(PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR_SYSTEM_DEFAULT)) { Display display = fAppearanceColorList.getDisplay(); RGB rgb = SourceViewerInformationControl.getVisibleBackgroundColor(display); if (rgb == null) rgb = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB(); PreferenceConverter.setValue( getPreferenceStore(), PreferenceConstants.EDITOR_SOURCE_HOVER_BACKGROUND_COLOR, rgb); } }
/** Draw the item {@inheritDoc} */ @Override public void paintControl(final PaintEvent e) { final Display display = getDisplay(); final GC gc = e.gc; final Rectangle bounds = getBounds(); last_alarm_state = item.getSeverity(); gc.setBackground(color_provider.getColor(last_alarm_state)); gc.fillRoundRectangle(0, 0, bounds.width, bounds.height, 10, 10); gc.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_BORDER)); gc.drawRoundRectangle(0, 0, bounds.width - 1, bounds.height - 1, 10, 10); // Draw Text gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK)); final String label = item.getName(); final Point extend = gc.textExtent(label); gc.drawString(label, (bounds.width - extend.x) / 2, (bounds.height - extend.y) / 2, true); }
public static void main(String[] args) throws Exception { final Shell shell = new Shell(); final Display display = shell.getDisplay(); shell.setLayout(new GridLayout(1, false)); final Switch control = new Switch(shell); control.setLayoutData(GridDataFactory.swtDefaults().create()); control.setActiveText("Shown"); control.setActiveBackground(new Color(display, 135, 209, 243)); control.setInactiveBackground(new Color(display, 198, 198, 198)); control.setInactiveText("Hidden"); control.setFont(new Font(display, "Arial", 10, SWT.BOLD)); control.setEnabled(true); control.setSelection(true); final Switch control1 = new Switch(shell); control1.setLayoutData(GridDataFactory.swtDefaults().create()); control1.setActiveText("Shown"); control1.setActiveBackground(new Color(display, 135, 209, 243)); control1.setInactiveBackground(new Color(display, 198, 198, 198)); control1.setInactiveText("Hidden"); control1.setFont(new Font(display, "Arial", 10, SWT.BOLD)); control1.setEnabled(false); control1.setSelection(true); final Switch control2 = new Switch(shell); control2.setLayoutData(GridDataFactory.swtDefaults().create()); control2.setActiveText("Shown"); control2.setActiveBackground(new Color(display, 135, 209, 243)); control2.setInactiveBackground(new Color(display, 198, 198, 198)); control2.setInactiveText("Hidden"); control2.setFont(new Font(display, "Arial", 10, SWT.BOLD)); control2.setEnabled(false); control2.setSelection(false); final RoundedComposite c3 = new RoundedComposite(shell, SWT.LEFT); c3.setBackground(new Color(display, 135, 209, 243)); c3.setLayoutData( GridDataFactory // .swtDefaults() // .hint(SWT.DEFAULT, SWT.DEFAULT) // .create()); final Label label = new Label(c3, SWT.NONE); label.setText("Hi"); label.setForeground(display.getSystemColor(SWT.COLOR_WHITE)); label.setFont(new Font(display, "Arial", 11, SWT.BOLD)); c3.setClient(label); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } }
public void setEnabled(boolean enabled) { if (enabled != fEnabled) { fEnabled = enabled; StyledText c = getSourceViewer().getTextWidget(); if (c != null) { c.setEnabled(enabled); Display d = c.getDisplay(); c.setBackground(enabled ? d.getSystemColor(SWT.COLOR_LIST_BACKGROUND) : null); } } }
public Color getForeground(Object element) { if (element instanceof LogItem) { final LogItem item = (LogItem) element; final Display display = Display.getCurrent(); if (item.isError) { if (item.output) { return display.getSystemColor(SWT.COLOR_DARK_RED); } else { return display.getSystemColor(SWT.COLOR_RED); } } else if (!item.output) { return display.getSystemColor(SWT.COLOR_DARK_YELLOW); } else if (item.output) { return display.getSystemColor(SWT.COLOR_DARK_BLUE); } else { return new Color(display, textColor); } } return null; }
/** Paint the Label's border. */ private void paintBorder(GC gc, Rectangle r) { Display disp = getDisplay(); Color c1 = null; Color c2 = null; int style = getStyle(); if ((style & SWT.SHADOW_IN) != 0) { c1 = disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW); c2 = disp.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW); } if ((style & SWT.SHADOW_OUT) != 0) { c1 = disp.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW); c2 = disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW); } if (c1 != null && c2 != null) { gc.setLineWidth(1); drawBevelRect(gc, r.x, r.y, r.width - 1, r.height - 1, c1, c2); } }
private static void drawViewMenu(GC gc, GC maskgc) { Display display = Display.getCurrent(); gc.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW)); gc.setBackground(display.getSystemColor(SWT.COLOR_LIST_BACKGROUND)); int[] shapeArray = new int[] {1, 1, 10, 1, 6, 5, 5, 5}; gc.fillPolygon(shapeArray); gc.drawPolygon(shapeArray); Color black = display.getSystemColor(SWT.COLOR_BLACK); Color white = display.getSystemColor(SWT.COLOR_WHITE); maskgc.setBackground(black); maskgc.fillRectangle(0, 0, 12, 16); maskgc.setBackground(white); maskgc.setForeground(white); maskgc.fillPolygon(shapeArray); maskgc.drawPolygon(shapeArray); }
private void drawVersionWarning(GC gc, Display display) { gc.setBackground(versionWarningBackgroundColor); gc.setForeground(versionWarningForegroundColor); gc.fillRectangle(290, 231, 367, 49); gc.drawRectangle(290, 231, 367, 49); gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK)); gc.drawImage(exclamation_image, 304, 243); gc.setFont(devWarningFont); gc.drawText( BaseMessages.getString(PKG, "SplashDialog.DevelopmentWarning"), 335, 241); // $NON-NLS-1$ }
private void fillItem(TreeItem item, FileInfo info) { assert Thread.currentThread() == fDisplay.getThread(); Object data = item.getData("TCFContextInfo"); if (data != null && data != info) item.removeAll(); item.setData("TCFContextInfo", info); String text = info.name != null ? info.name : info.fullname; item.setText(text); item.setForeground(fDisplay.getSystemColor(SWT.COLOR_LIST_FOREGROUND)); item.setImage(getImage(info)); if (!canHaveChildren(info)) item.setItemCount(0); else if (info.children == null || info.children_error != null) item.setItemCount(1); else item.setItemCount(info.children.length); }
public ToolTipHandler(org.eclipse.swt.widgets.Shell parent) { final org.eclipse.swt.widgets.Display display = parent.getDisplay(); this.parentShell = parent; tipShell = new org.eclipse.swt.widgets.Shell(parent, SWT.ON_TOP | SWT.TOOL); org.eclipse.swt.layout.GridLayout gridLayout = new org.eclipse.swt.layout.GridLayout(); gridLayout.numColumns = 2; gridLayout.marginWidth = 2; gridLayout.marginHeight = 2; tipShell.setLayout(gridLayout); tipShell.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); tipLabelImage = new org.eclipse.swt.widgets.Label(tipShell, SWT.NONE); tipLabelImage.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); tipLabelImage.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); tipLabelImage.setLayoutData( new org.eclipse.swt.layout.GridData( GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER)); tipLabelText = new org.eclipse.swt.widgets.Label(tipShell, SWT.NONE); tipLabelText.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND)); tipLabelText.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND)); tipLabelText.setLayoutData( new org.eclipse.swt.layout.GridData( (-(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER)))); }
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Font font = new Font(display, "Tahoma", 24, SWT.BOLD); Color foreground = display.getSystemColor(SWT.COLOR_RED), background = display.getSystemColor(SWT.COLOR_YELLOW); new ShellCaption(shell, 0, 0, "upper left", font, foreground, background, false); new ShellCaption(shell, -10, 0, "upper right", font, foreground, null, true); new ShellCaption(shell, 0, -30, "lower left", font, foreground, null, true); new ShellCaption(shell, -10, -30, "lower right", font, foreground, background, true); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } font.dispose(); display.dispose(); }
private void createContents(final Shell shell) { GridLayout gridLayout1 = new GridLayout(); GridData gridData2 = new GridData(GridData.FILL_HORIZONTAL); GridData gridData3 = new GridData(GridData.FILL_HORIZONTAL); GridData gridData4 = new GridData(GridData.FILL_HORIZONTAL); GridData gridData5 = new GridData(GridData.FILL_HORIZONTAL); GridData gridData6 = new GridData(GridData.FILL_HORIZONTAL); GridData gridData7 = new GridData(GridData.FILL_HORIZONTAL); GridData gridData8 = new GridData(GridData.FILL_HORIZONTAL); GridData gridData9 = new GridData(GridData.FILL_HORIZONTAL); header = new Label(shell, SWT.NONE); textArea = new Text(shell, SWT.MULTI | SWT.READ_ONLY | SWT.BORDER | SWT.V_SCROLL); Display disp = shell.getDisplay(); textArea.setBackground(disp.getSystemColor(SWT.COLOR_WHITE)); trailer = new Label(shell, SWT.NONE); button = createButton(shell, IMQSCScriptsConstants.RUN_SCRIPT_RUN_BUTTON, "Run", false); button1 = createButton(shell, IMQSCScriptsConstants.RUN_SCRIPT_SKIP_BUTTON, "Skip", false); button2 = createButton(shell, IMQSCScriptsConstants.RUN_SCRIPT_RUNALL_BUTTON, "Run All", false); button3 = createButton(shell, IMQSCScriptsConstants.RUN_SCRIPT_SKIPALL_BUTTON, "Skip All", false); button4 = createButton(shell, IMQSCScriptsConstants.RUN_SCRIPT_ABORT_BUTTON, "Abort", false); shell.setLayout(gridLayout1); header.setLayoutData(gridData2); trailer.setLayoutData(gridData4); gridLayout1.numColumns = 5; gridData2.horizontalSpan = 5; gridData3.horizontalSpan = 5; gridData3.verticalSpan = 25; textArea.setLayoutData(gridData3); gridData4.horizontalSpan = 5; gridData5.grabExcessHorizontalSpace = true; button.setLayoutData(gridData5); gridData6.grabExcessHorizontalSpace = true; button1.setLayoutData(gridData6); gridData7.grabExcessHorizontalSpace = true; button2.setLayoutData(gridData7); gridData8.grabExcessHorizontalSpace = true; button3.setLayoutData(gridData8); gridData9.grabExcessHorizontalSpace = true; button4.setLayoutData(gridData9); shell.setSize(new org.eclipse.swt.graphics.Point(350, 225)); shell.setText("Invalid MQSC Command Found"); header.setText("The following command appears to be invalid MQSC."); textArea.setText(fText); trailer.setText( "Do you want to Run this command, Skip it, Run All invalid commands, or Skip All invalid commands?"); shell.pack(); }
public Image getCheckedImage(Display display, Label l, ArrayList<Mesh> meshes, Rectangle r) { Point p = l.getSize(); Point c = new Point(r.width / 2, r.height / 2); Image image = new Image(display, p.x - 20, p.y - 20); GC gc = new GC(image); gc.drawLine((int) beginX, (int) beginY, (int) endX, (int) endY); // gc.setBackground(display.getSystemColor(SWT.COLOR_YELLOW)); // gc.fillOval(0, 0, p.x-20, p.y-20); // gc.setForeground(display.getSystemColor(SWT.COLOR_DARK_GREEN)); // gc.drawLine(0, 0, p.x-20, p.y-20); // gc.drawLine(p.x-20, 0, 0, p.y-20); gc.setForeground(display.getSystemColor(SWT.COLOR_RED)); for (int i = 0; i < meshes.size(); i++) { drawMesh(meshes.get(i), gc, c); } gc.dispose(); return image; }
public HyperlinkSettings getHyperlinkSettings() { // #132723 cannot have null settings if (hyperlinkSettings == null) { Display display = SWTUtil.getStandardDisplay(); hyperlinkSettings = new HyperlinkSettings(display); // Setting link foreground color for windows 7 final String osName = System.getProperty("os.name"); // $NON-NLS-1$ if (osName.toLowerCase().startsWith("windows 7")) { // $NON-NLS-1$ activeForeground = new Color(display, LINK_FOREGROUND); hyperlinkSettings.setForeground(activeForeground); } enabledForeground = hyperlinkSettings.getForeground(); // Bug 22782 - DCR - Need API to draw disabled text in native platform way disabledForeground = display.getSystemColor(SWT.COLOR_GRAY); } return hyperlinkSettings; }
/* * (non-Javadoc) * @see org.eclipse.ice.viz.service.widgets.PlotComposite#createInfoContent(org.eclipse.swt.widgets.Composite, int) */ @Override protected Composite createInfoContent(Composite parent, int style) { // Get the info Composite and its child with the message label. final Composite infoComposite = super.createInfoContent(parent, style); final Composite msgComposite = (Composite) infoComposite.getChildren()[1]; // Get a Display and Shell used to create the hyperlink. final Display display = infoComposite.getDisplay(); final Shell shell = infoComposite.getShell(); // Set the text to display in the hyperlink. final String linkText = "Click here to update the connection " + "preferences."; // Create a link to the preference page. link = new Hyperlink(msgComposite, SWT.NONE); link.setText(linkText); link.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); link.setUnderlined(true); link.setForeground(display.getSystemColor(SWT.COLOR_LINK_FOREGROUND)); // Add the listener to redirect the user to the preferences. link.addHyperlinkListener( new IHyperlinkListener() { @Override public void linkActivated(HyperlinkEvent e) { // Open up the viz service connection preferences. PreferencesUtil.createPreferenceDialogOn( shell, getConnectionPreferencePageID(), null, null) .open(); } @Override public void linkEntered(HyperlinkEvent e) { // Nothing to do yet. } @Override public void linkExited(HyperlinkEvent e) { // Nothing to do yet. } }); return infoComposite; }