/** * @see Listener#handleEvent(Event) */ public void handleEvent(Event event) { if (event.widget == newNameText && OKButton != null) { String newName = newNameText.getText(); if (newName.trim().length() == 0) { statusMessageLabel.setText("");//$NON-NLS-1$ OKButton.setEnabled(false); return; } IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject newProject = root.getProject(newName); if (newProject.exists()) { statusMessageLabel.setForeground(JFaceColors.getErrorText(statusMessageLabel.getDisplay())); String[] names = {newName}; statusMessageLabel.setText(MessageFormat.format(J2EEUIMessages.getResourceString("Project_already_exists."), names)); //$NON-NLS-1$ OKButton.setEnabled(false); } else { statusMessageLabel.setText("");//$NON-NLS-1$ OKButton.setEnabled(true); } } }
@Override public void createControl(Composite parent) { pgComp = new Composite(parent, SWT.NULL); pgComp.setLayout(new FillLayout()); pgComp.setBackground(JFaceColors.getBannerBackground(pgComp.getDisplay())); }
private static void cacheColors(Display display) { BG_COLOR_RGB= JFaceColors.getInformationViewerBackgroundColor(display).getRGB(); FG_COLOR_RGB= JFaceColors.getInformationViewerForegroundColor(display).getRGB(); Color hyperlinkText= JFaceColors.getHyperlinkText(display); if (hyperlinkText != null) { LINK_COLOR_RGB= hyperlinkText.getRGB(); } Color activeHyperlinkText= JFaceColors.getActiveHyperlinkText(display); if (activeHyperlinkText != null) { ACTIVE_LINK_COLOR_RGB= activeHyperlinkText.getRGB(); } }
/** * Initializes the hyperlink foregrounds from the JFace defaults set for the * entire workbench. * * @see JFaceColors * @param display * the display to use when creating colors */ public void initializeDefaultForegrounds(Display display) { Color fg = JFaceColors.getHyperlinkText(display); Color afg = JFaceColors.getActiveHyperlinkText(display); if (fg == null) fg = display.getSystemColor(SWT.COLOR_LINK_FOREGROUND); setForeground(fg); setActiveForeground(afg); }
private void setInfoSystemColor() { ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); Color foreground = colorRegistry.get(JFacePreferences.INFORMATION_FOREGROUND_COLOR); if (foreground == null) { foreground = JFaceColors.getInformationViewerForegroundColor(fShell.getDisplay()); } Color background = colorRegistry.get(JFacePreferences.INFORMATION_BACKGROUND_COLOR); if (background == null) { background = JFaceColors.getInformationViewerBackgroundColor(fShell.getDisplay()); } setForegroundColor(foreground); setBackgroundColor(background); }
Color background = JFaceColors.getBannerBackground(display); Color foreground = JFaceColors.getBannerForeground(display); JFaceColors.setColors(messageLabel, foreground, background); messageLabel.setText(getBannerTitle()); messageLabel.setFont(JFaceResources.getHeaderFont());
Color bg = JFaceColors.getBannerBackground(display); Color fg = JFaceColors.getBannerForeground(display);
/** * Sets the styled text's link (blue) ranges */ private void setLinkRanges(StyledText styledText, int[][] linkRanges) { //Color fg = styledText.getDisplay().getSystemColor(SWT.COLOR_BLUE); Color fg = JFaceColors.getHyperlinkText(styledText.getShell() .getDisplay()); for (int i = 0; i < linkRanges.length; i++) { StyleRange r = new StyleRange(linkRanges[i][0], linkRanges[i][1], fg, null); styledText.setStyleRange(r); hyperlinkRanges.add(r); } }
messageText.setText(newMessage); if (showingError) setMessageColors(JFaceColors.getErrorBackground(messageComposite.getDisplay())); else { lastMessageText = newMessage; setMessageColors(JFaceColors.getBannerBackground(messageComposite.getDisplay()));
/** * Sets the message and image to the given status. * <code>null</code> is a valid argument and will set the empty text and no image * * @param status the status */ public void setErrorStatus(IStatus status) { if (status != null && !status.isOK()) { String message= status.getMessage(); if (message != null && message.length() > 0) { setText(message); setImage(findImage(status)); setBackground(JFaceColors.getErrorBackground(getDisplay())); return; } } setText(""); //$NON-NLS-1$ setImage(null); setBackground(fNormalMsgAreaBackground); } }
private static Color getInformationForegroundColor(Display display) { ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); Color foreground = colorRegistry.get(JFacePreferences.INFORMATION_FOREGROUND_COLOR); if (foreground == null) { return JFaceColors.getInformationViewerForegroundColor(display); } return foreground; }
foreground = null; } else { background = JFaceColors.getBannerBackground(display); foreground = JFaceColors.getBannerForeground(display); JFaceColors.setColors(titleLabel, foreground, background); titleLabel.setFont(JFaceResources.getBannerFont()); titleLabel.setText(" ");//$NON-NLS-1$ JFaceColors.setColors(messageLabel, foreground, background); messageLabel.setText(" \n "); // two lines//$NON-NLS-1$ messageLabel.setFont(JFaceResources.getDialogFont());
Color bg = JFaceColors.getBannerBackground(display); Color fg = JFaceColors.getBannerForeground(display);
/** * Sets the styled text's link (blue) ranges */ private void setLinkRanges(int[][] linkRanges) { Color fg = JFaceColors.getHyperlinkText(styledText.getShell() .getDisplay()); for (int[] linkRange : linkRanges) { StyleRange r = new StyleRange(linkRange[0], linkRange[1], fg, null); styledText.setStyleRange(r); } } }
messageText.setText(newMessage); if (showingError) setMessageColors(JFaceColors.getErrorBackground(messageComposite.getDisplay())); else { lastMessageText = newMessage; setMessageColors(JFaceColors.getBannerBackground(messageComposite.getDisplay()));
/** * Sets the message and image to the given status. * <code>null</code> is a valid argument and will set the empty text and no image */ public void setErrorStatus(IStatus status) { if (status != null && !status.isOK()) { String message= status.getMessage(); if (message != null && message.length() > 0) { setText(message); setImage(findImage(status)); setBackground(JFaceColors.getErrorBackground(getDisplay())); return; } } setText(""); //$NON-NLS-1$ setImage(null); setBackground(fNormalMsgAreaBackground); } }
/** * Initializes the hyperlink foregrounds from the JFace defaults set for the * entire workbench. * * @see JFaceColors * @param display * the display to use when creating colors */ public void initializeDefaultForegrounds(Display display) { Color fg = JFaceColors.getHyperlinkText(display); Color afg = JFaceColors.getActiveHyperlinkText(display); if (fg == null) fg = display.getSystemColor(SWT.COLOR_LINK_FOREGROUND); setForeground(fg); setActiveForeground(afg); }
Display display= fShell.getDisplay(); Color foreground= JFaceColors.getInformationViewerForegroundColor(display); Color background= JFaceColors.getInformationViewerBackgroundColor(display); setColor(fShell, foreground, background);
public AntModelLabelProvider() { ColorRegistry colorRegistry = JFaceResources.getColorRegistry(); normalForeground = colorRegistry.get(JFacePreferences.INFORMATION_FOREGROUND_COLOR); if (normalForeground == null) { normalForeground = JFaceColors.getInformationViewerForegroundColor(Display.getDefault()); } defaultForeground = colorRegistry.get(JFacePreferences.ACTIVE_HYPERLINK_COLOR); if (defaultForeground == null) { defaultForeground = JFaceColors.getInformationViewerForegroundColor(Display.getDefault()); } }
public void handleEvent(Event event) { if (statusMessage != null && validator != null) { String errorMsg = validator.isValid(group .getSelection()); if (errorMsg == null || errorMsg.equals("")) { //$NON-NLS-1$ statusMessage.setText(""); //$NON-NLS-1$ getOkButton().setEnabled(true); } else { statusMessage.setForeground(JFaceColors .getErrorText(statusMessage.getDisplay())); statusMessage.setText(errorMsg); getOkButton().setEnabled(false); } } } };