Example usage for org.eclipse.jface.resource JFaceResources getFontRegistry

List of usage examples for org.eclipse.jface.resource JFaceResources getFontRegistry

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceResources getFontRegistry.

Prototype

public static FontRegistry getFontRegistry() 

Source Link

Document

Returns the font registry for JFace itself.

Usage

From source file:org.eclipse.mylyn.internal.wikitext.tasks.ui.preferences.MarkupViewerPreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    colorRegistry = new Colors();
    colorRegistry.put(WHITE, new RGB(255, 255, 255));

    Composite composite = new Composite(parent, SWT.NULL);
    GridLayoutFactory.fillDefaults().margins(5, 5).numColumns(1).applyTo(composite);

    Label label = new Label(composite, SWT.WRAP);
    label.setText(Messages.MarkupViewerPreferencePage_appearanceInfo);
    GridDataFactory.fillDefaults().applyTo(label);

    Preferences preferences = WikiTextUiPlugin.getDefault().getPreferences();

    Composite viewerContainer = new Composite(composite, SWT.BORDER);
    GridLayoutFactory.fillDefaults().margins(0, 0).numColumns(1).applyTo(viewerContainer);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(viewerContainer);
    {/*from ww  w.ja va  2s . com*/
        sourceViewer = new SourceViewer(viewerContainer, new VerticalRuler(0), SWT.WRAP | SWT.V_SCROLL);
        GridDataFactory.fillDefaults().grab(true, true).applyTo(sourceViewer.getControl());

        Document document = new Document(preferences.getMarkupViewerCss());
        CssPartitioner partitioner = new CssPartitioner();
        partitioner.connect(document);
        document.setDocumentPartitioner(partitioner);
        sourceViewer.setDocument(document);

        CssConfiguration configuration = new CssConfiguration(colorRegistry);
        sourceViewer.configure(configuration);
    }

    label = new Label(composite, SWT.WRAP);
    label.setText(Messages.MarkupViewerPreferencePage_preview);
    GridDataFactory.fillDefaults().applyTo(label);

    applyDialogFont(composite);

    Composite previewViewerContainer = new Composite(composite, SWT.BORDER);
    GridLayoutFactory.fillDefaults().margins(0, 0).numColumns(1).applyTo(previewViewerContainer);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(previewViewerContainer);
    {
        previewViewer = new HtmlViewer(previewViewerContainer, new VerticalRuler(0), SWT.WRAP | SWT.V_SCROLL);
        previewViewer.getTextWidget().setBackground(colorRegistry.get(WHITE));
        GridDataFactory.fillDefaults().grab(true, true).applyTo(previewViewer.getControl());

        htmlViewerConfiguration = new HtmlViewerConfiguration(previewViewer);
        previewViewer.configure(htmlViewerConfiguration);
        previewViewer.getTextWidget().setEditable(false);
        previewViewer.setStylesheet(preferences.getStylesheet());

        if (JFaceResources.getFontRegistry()
                .hasValueFor(WikiTextTasksUiPlugin.FONT_REGISTRY_KEY_DEFAULT_FONT)) {
            previewViewer.getTextWidget().setFont(
                    JFaceResources.getFontRegistry().get(WikiTextTasksUiPlugin.FONT_REGISTRY_KEY_DEFAULT_FONT));
        }
        if (JFaceResources.getFontRegistry()
                .hasValueFor(WikiTextTasksUiPlugin.FONT_REGISTRY_KEY_MONOSPACE_FONT)) {
            previewViewer.setDefaultMonospaceFont(JFaceResources.getFontRegistry()
                    .get(WikiTextTasksUiPlugin.FONT_REGISTRY_KEY_MONOSPACE_FONT));
        }

        previewViewer.setHtml(createPreviewHtml());

        sourceViewer.getDocument().addDocumentListener(new IDocumentListener() {
            public void documentAboutToBeChanged(DocumentEvent event) {
            }

            public void documentChanged(DocumentEvent event) {
                schedulePreviewUpdate();
            }
        });
    }
    return composite;
}

From source file:org.eclipse.mylyn.internal.wikitext.ui.editor.MarkupEditor.java

License:Open Source License

@Override
public void createPartControl(Composite parent) {
    super.createPartControl(parent);
    ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
    // fix bug 267553: font problems can occur if the default font of the text widget doesn't match the
    //                 default font returned by the token scanner
    if (sourceViewerConfiguration.getDefaultFont() != null) {
        viewer.getTextWidget().setFont(sourceViewerConfiguration.getDefaultFont());
    }/* www .  ja va  2s.c  o m*/

    projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors());
    projectionSupport.install();

    syncProjectionModeWithPreferences();

    viewer.addProjectionListener(new IProjectionListener() {
        public void projectionDisabled() {
            projectionAnnotationById = null;
            saveProjectionPreferences();
        }

        public void projectionEnabled() {
            saveProjectionPreferences();
            updateProjectionAnnotations();
        }
    });

    if (!outlineDirty && isFoldingEnabled()) {
        updateProjectionAnnotations();
    }
    JFaceResources.getFontRegistry().addListener(preferencesListener);
}

From source file:org.eclipse.mylyn.internal.wikitext.ui.editor.MarkupEditor.java

License:Open Source License

@Override
public void dispose() {
    if (document != null) {
        if (documentListener != null) {
            document.removeDocumentListener(documentListener);
        }//from  w  ww. j ava  2  s.c om
        if (documentPartitioningListener != null) {
            document.removeDocumentPartitioningListener(documentPartitioningListener);
        }
        document = null;
    }
    if (preferencesListener != null) {
        WikiTextUiPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(preferencesListener);
        JFaceResources.getFontRegistry().addListener(preferencesListener);
        preferencesListener = null;
    }
    super.dispose();
}

From source file:org.eclipse.mylyn.internal.wikitext.ui.viewer.CssStyleManager.java

License:Open Source License

public StyleRange createStyleRange(FontState fontState, int offset, int length) {
    StyleRange styleRange = new StyleRange(offset, length, getColorFromRgb(fontState.foreground),
            getColorFromRgb(fontState.background));
    if (fontState.isBold()) {
        styleRange.fontStyle |= SWT.BOLD;
    }//from  ww  w  .  ja  v a2  s  . com
    if (fontState.isUnderline()) {
        styleRange.underline = true;
    }
    if (fontState.isStrikethrough()) {
        styleRange.strikeout = true;
    }
    if (fontState.isItalic()) {
        styleRange.fontStyle |= SWT.ITALIC;
    }
    if (fontState.isSubscript()) {
        styleRange.rise = -4;
    } else if (fontState.isSuperscript()) {
        styleRange.rise = 4;
    }
    if (fontState.isFixedWidth()) {
        String symbolicName = computeSymbolicName(fontState, "monospace", defaultMonospaceFont); //$NON-NLS-1$
        Font monospaceFont = JFaceResources.getFontRegistry().hasValueFor(symbolicName)
                ? JFaceResources.getFontRegistry().get(symbolicName)
                : null;
        if (monospaceFont == null) {
            FontData[] fontData = null;
            if (defaultMonospaceFont != null) {
                fontData = defaultMonospaceFont.getFontData();
            } else {
                Font defaultFont = JFaceResources.getFontRegistry().defaultFont();

                // look for a monospace font.  First look for non-scalable fonts (bug 263074 comment 3 to comment 6)
                // then scalable fonts.  This addresses platform-specific issues.
                String[] fontNames = computeMonospaceFontNames();
                for (String fontName : fontNames) {
                    fontData = defaultFont.getDevice().getFontList(fontName, false);
                    if (fontData == null || fontData.length == 0) {
                        fontData = defaultFont.getDevice().getFontList(fontName, true);
                    }
                    if (fontData != null && fontData.length > 0) {
                        break;
                    }
                }
            }
            if (fontData != null && fontData.length > 0) {
                fontData = applyFontState(fontState, fontData);
                JFaceResources.getFontRegistry().put(symbolicName, fontData);
                monospaceFont = JFaceResources.getFontRegistry().get(symbolicName);
            }
        }
        if (monospaceFont != null) {
            styleRange.font = monospaceFont;
        }
    } else {
        String symbolicName = computeSymbolicName(fontState, "default", defaultFont); //$NON-NLS-1$
        Font font = JFaceResources.getFontRegistry().hasValueFor(symbolicName)
                ? JFaceResources.getFontRegistry().get(symbolicName)
                : null;
        if (font == null) {
            FontData[] fontData = createFontData(fontState, defaultFont);
            JFaceResources.getFontRegistry().put(symbolicName, fontData);
            font = JFaceResources.getFontRegistry().get(symbolicName);
        }
        if (font != null) {
            styleRange.font = font;
        }

    }
    return styleRange;
}

From source file:org.eclipse.mylyn.internal.xplanner.ui.editor.XPlannerTaskEditorExtraControls.java

License:Open Source License

private void createDataSection(FormToolkit toolkit, final Composite formBody, TaskData repositoryTaskData) {

    Section dataSection = toolkit.createSection(formBody,
            ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE);
    dataSection.setText(Messages.XPlannerTaskEditor_DATA_SECTION_TITLE);
    dataSection.setLayout(new GridLayout(1, true));
    GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.TOP).applyTo(dataSection);
    dataSection.setExpanded(true);//from   w w  w  .  j  a v a 2 s  .  co  m
    Composite dataComposite = toolkit.createComposite(dataSection, SWT.BORDER);
    dataComposite.setLayout(new GridLayout(5, false));
    GridDataFactory.fillDefaults().grab(true, true).applyTo(dataComposite);

    dataSection.setClient(dataComposite);
    // acceptor label
    Label acceptorLabel = toolkit.createLabel(dataComposite, Messages.XPlannerTaskEditor_ACCEPTOR_TEXT);
    acceptorLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));

    // acceptor text
    Label acceptorValue = toolkit.createLabel(dataComposite, ""); //$NON-NLS-1$
    GridDataFactory.fillDefaults().grab(true, false).align(SWT.BEGINNING, SWT.CENTER).applyTo(acceptorValue);
    acceptorValue.setText(getAssignedToValue());

    // estimated hours label
    Label estimatedHoursLabel = toolkit.createLabel(dataComposite,
            Messages.XPlannerTaskEditor_ESTIMATED_HOURS_TEXT);
    estimatedHoursLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));

    // estimated hours text
    final Text estimatedTimeText = toolkit.createText(dataComposite, XPlannerRepositoryUtils
            .formatSingleFractionHours(XPlannerRepositoryUtils.getAdjustedEstimatedHours(repositoryTaskData)));
    estimatedTimeText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            Double value = XPlannerRepositoryUtils.getHoursValue(estimatedTimeText.getText());
            updateAttribute(XPlannerAttributeMapper.ATTRIBUTE_EST_HOURS_NAME, Double.toString(value));
        }
    });

    estimatedTimeText.addVerifyListener(new HoursVerifyListener());

    // original estimated hours label
    toolkit.createLabel(dataComposite, " (" //$NON-NLS-1$
            + XPlannerRepositoryUtils.formatSingleFractionHours(
                    XPlannerRepositoryUtils.getEstimatedOriginalHours(repositoryTaskData))
            + ")"); //$NON-NLS-1$ 

    completedButton = toolkit.createButton(dataComposite, Messages.XPlannerTaskEditor_COMPLETED_BUTTON,
            SWT.CHECK);
    completedButton.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            updateAttribute(XPlannerAttributeMapper.ATTRIBUTE_TASK_COMPLETED,
                    completedButton.getSelection() ? "1" : "0"); //$NON-NLS-1$//$NON-NLS-2$
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        };
    });

    completedButton.setSelection(XPlannerRepositoryUtils.isCompleted(repositoryTaskData));

    // actual time label
    Label actualTimeLabel = toolkit.createLabel(dataComposite, Messages.XPlannerTaskEditor_ACTUAL_HOURS_TEXT);
    actualTimeLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    GridDataFactory.fillDefaults().grab(true, false).span(2, 1).align(SWT.END, SWT.CENTER)
            .applyTo(actualTimeLabel);

    // actual hours text
    lastRepositoryActualTime = XPlannerRepositoryUtils.getActualHours(repositoryTaskData);
    actualTimeText = toolkit.createText(dataComposite,
            XPlannerRepositoryUtils.formatSingleFractionHours(lastRepositoryActualTime));

    actualTimeText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            if (validateActualTime() == null) {
                Double value = XPlannerRepositoryUtils.getHoursValue(actualTimeText.getText());
                updateAttribute(XPlannerAttributeMapper.ATTRIBUTE_ACT_HOURS_NAME, Double.toString(value));
            }
        }
    });
    actualTimeText.addVerifyListener(new HoursVerifyListener());

    // remaining time label
    Label remainingTimeLabel = toolkit.createLabel(dataComposite,
            Messages.XPlannerTaskEditor_REMAINING_HOURS_TEXT);
    remainingTimeLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    GridDataFactory.fillDefaults().grab(true, false).span(3, 1).align(SWT.END, SWT.CENTER)
            .applyTo(remainingTimeLabel);

    Double remainingHours = new Double(XPlannerRepositoryUtils.getRemainingHours(repositoryTaskData));
    String formattedRemainingHours = XPlannerRepositoryUtils.formatSingleFractionHours(remainingHours);
    remainingTimeValueLabel = toolkit.createLabel(dataComposite, formattedRemainingHours);

    updateRemainingTimeFont();
    dataSection.setExpanded(true);
}

From source file:org.eclipse.mylyn.internal.xplanner.ui.editor.XPlannerTaskEditorExtraControls.java

License:Open Source License

private void updateRemainingTimeFont() {
    if (remainingTimeValueLabel != null) {
        if (isTaskCompleted()) { // no remaining time if task completed
            remainingTimeValueLabel.setFont(JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT));
        } else { // if not completed, remaining hours are in bold
            remainingTimeValueLabel/*from   w  w  w  . j a  v  a 2  s  . c  o  m*/
                    .setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
        }
    }
}

From source file:org.eclipse.mylyn.internal.xplanner.ui.editor.XPlannerUserStoryEditor.java

License:Open Source License

private void createDataSection(FormToolkit toolkit, final Composite formBody) {
    Section dataSection = toolkit.createSection(formBody,
            ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE);
    dataSection.setText(Messages.XPlannerTaskEditor_DATA_SECTION_TITLE);
    dataSection.setLayout(new GridLayout(1, true));
    GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.TOP).applyTo(dataSection);
    dataSection.setExpanded(true);/*  ww  w. j a v a  2s.  c o m*/
    Composite dataComposite = toolkit.createComposite(dataSection, SWT.BORDER);
    dataComposite.setLayout(new GridLayout(4, false));
    GridDataFactory.fillDefaults().grab(true, true).applyTo(dataComposite);

    dataSection.setClient(dataComposite);
    // priority label
    Label priorityLabel = toolkit.createLabel(dataComposite, Messages.XPlannerUserStoryEditor_PRIORITY_LABEL);
    priorityLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    GridDataFactory.fillDefaults().grab(false, false).span(1, 2).applyTo(priorityLabel);

    // priority text
    Label priorityValue = toolkit.createLabel(dataComposite, ""); //$NON-NLS-1$
    GridDataFactory.fillDefaults().grab(true, false).span(1, 2).applyTo(priorityValue);
    priorityValue.setText(String.valueOf(getUserStoryData().getPriority()));

    // estimated hours label
    Label estimatedHoursLabel = toolkit.createLabel(dataComposite,
            Messages.XPlannerTaskEditor_ESTIMATED_HOURS_TEXT);
    estimatedHoursLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));

    // estimated hours text
    toolkit.createLabel(dataComposite, getUserStoryData().getAdjustedEstimatedHours() + " (" //$NON-NLS-1$
            + getUserStoryData().getEstimatedOriginalHours() + ")"); //$NON-NLS-1$

    // actual time label
    Label actualTimeLabel = toolkit.createLabel(dataComposite, Messages.XPlannerTaskEditor_ACTUAL_HOURS_TEXT);
    actualTimeLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));

    // actual time text
    toolkit.createLabel(dataComposite, getUserStoryData().getActualHours() + ""); //$NON-NLS-1$

    // tracker label
    Label trackerLabel = toolkit.createLabel(dataComposite, Messages.XPlannerUserStoryEditor_TRACKER_LABEL);
    trackerLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    GridDataFactory.fillDefaults().grab(false, false).applyTo(trackerLabel);

    // tracker text
    Label trackerValue = toolkit.createLabel(dataComposite, getTrackerName());
    GridDataFactory.fillDefaults().grab(true, false).applyTo(trackerValue);

    // remaining hours label
    Label remainingHoursLabel = toolkit.createLabel(dataComposite,
            Messages.XPlannerUserStoryEditor_REMAINING_HOURS_LABEL);
    remainingHoursLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));

    // remaining hours text
    toolkit.createLabel(dataComposite, String.valueOf(getUserStoryData().getRemainingHours()));

    // last updated time label
    Label lastUpdatedTimeLabel = toolkit.createLabel(dataComposite,
            Messages.XPlannerUserStoryEditor_LAST_UPDATE_LABEL);
    lastUpdatedTimeLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    GridDataFactory.fillDefaults().grab(false, false).applyTo(lastUpdatedTimeLabel);

    // last updated time text
    DateFormat dateFormat = DateFormat.getDateInstance(XPlannerAttributeMapper.DATE_FORMAT_STYLE);
    Label lastUpdatedTimeValue = toolkit.createLabel(dataComposite,
            dateFormat.format(((GregorianCalendar) getUserStoryData().getLastUpdateTime()).getTime()) + ""); //$NON-NLS-1$
    GridDataFactory.fillDefaults().grab(true, false).applyTo(lastUpdatedTimeValue);

    // disposition label
    Label dispositionLabel = toolkit.createLabel(dataComposite,
            Messages.XPlannerUserStoryEditor_DISPOSITION_LABEL);
    dispositionLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));

    // disposition text
    toolkit.createLabel(dataComposite, getUserStoryData().getDispositionName());

    Button completedButton = toolkit.createButton(dataComposite, Messages.XPlannerTaskEditor_COMPLETED_BUTTON,
            SWT.CHECK);
    GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).applyTo(completedButton);
    completedButton.setSelection(userStoryData.isCompleted());
    completedButton.setEnabled(false);

    //TODO -- no API for status      
    //      // status label
    //      Label statusLabel = toolkit.createLabel(dataComposite, Messages.XPlannerUserStoryEditor_STATUS_LABEL);
    //      statusLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT));
    //      
    //      // status text
    //      toolkit.createLabel(dataComposite, Messages.XPlannerUserStoryEditor_STATUS_PLACEHOLDER); //TODO -- getUserStoryData().getDispositionName()));   

}

From source file:org.eclipse.mylyn.reviews.r4e.ui.internal.dialogs.ParticipantInputDialog.java

License:Open Source License

/**
 * method createBasicParameters/*from w  w w  . j a  v  a2s .  c  om*/
 * 
 * @param aToolkit
 * @param aComposite
 */
private void createBasicParameters(FormToolkit aToolkit, Composite aComposite) {

    //Basic parameters section
    final Section basicSection = aToolkit.createSection(aComposite, Section.DESCRIPTION
            | ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
    final GridData basicSectionGridData = new GridData(GridData.FILL, GridData.FILL, true, false);
    basicSectionGridData.horizontalSpan = 4;
    basicSection.setLayoutData(basicSectionGridData);
    basicSection.setText(R4EUIConstants.BASIC_PARAMS_HEADER);
    basicSection.setDescription(R4EUIConstants.BASIC_PARAMS_HEADER_DETAILS + PARTICIPANT_LABEL);
    basicSection.addExpansionListener(new ExpansionAdapter() {
        @Override
        public void expansionStateChanged(ExpansionEvent e) {
            getShell().setSize(getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT));
        }
    });

    final Composite basicSectionClient = aToolkit.createComposite(basicSection);
    final GridLayout layout = new GridLayout(4, false);
    basicSectionClient.setLayout(layout);
    basicSection.setClient(basicSectionClient);

    //Participant Id
    Label label = aToolkit.createLabel(basicSectionClient, R4EUIConstants.ID_LABEL);
    label.setToolTipText(R4EUIConstants.PARTICIPANT_ID_TOOLTIP);
    label.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
    aToolkit.setBorderStyle(SWT.NULL);
    fParticipantIdInputTextField = aToolkit.createText(basicSectionClient, "");
    GridData textGridData = new GridData(GridData.FILL, GridData.FILL, true, false);
    textGridData.horizontalSpan = 3;
    fParticipantIdInputTextField.setEnabled(false);
    fParticipantIdInputTextField.setEditable(false);
    fParticipantIdInputTextField.setToolTipText(R4EUIConstants.PARTICIPANT_ID_TOOLTIP);
    fParticipantIdInputTextField.setLayoutData(textGridData);

    //Participant Email
    label = aToolkit.createLabel(basicSectionClient, R4EUIConstants.EMAIL_LABEL);
    label.setToolTipText(R4EUIConstants.PARTICIPANT_EMAIL_TOOLTIP);
    label.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
    aToolkit.setBorderStyle(SWT.BORDER);
    fParticipantEmailInputTextField = aToolkit.createText(basicSectionClient, "", SWT.SINGLE);
    textGridData = new GridData(GridData.FILL, GridData.FILL, true, false);
    textGridData.horizontalSpan = 3;
    fParticipantEmailInputTextField.setToolTipText(R4EUIConstants.PARTICIPANT_EMAIL_TOOLTIP);
    fParticipantEmailInputTextField.setLayoutData(textGridData);
    fParticipantEmailInputTextField.setEnabled(false);
    fParticipantEmailInputTextField.addListener(SWT.FocusOut, new Listener() {
        public void handleEvent(Event event) {
            if (fSelectedParticipantIndex >= 0) {
                final R4EParticipant participant = fParticipants.get(fSelectedParticipantIndex);
                participant.setEmail(fParticipantEmailInputTextField.getText().trim());
                final TableItem item = fAddedParticipantsTable.getItem(fSelectedParticipantIndex);
                if (null != participant.getEmail()) {
                    item.setFont(JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT));
                    item.setText(1, participant.getEmail());
                } else {
                    item.setFont(JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT));
                }
            }
        }
    });

    //User details
    label = aToolkit.createLabel(basicSectionClient, R4EUIConstants.USER_DETAILS_LABEL);
    label.setToolTipText(R4EUIConstants.PARTICIPANT_DETAILS_TOOLTIP);
    label.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
    aToolkit.setBorderStyle(SWT.NULL);
    fParticipantDetailsInputTextField = aToolkit.createText(basicSectionClient, "",
            SWT.MULTI | SWT.V_SCROLL | SWT.READ_ONLY);
    textGridData = new GridData(GridData.FILL, GridData.FILL, true, false);
    textGridData.horizontalSpan = 3;
    textGridData.heightHint = fParticipantDetailsInputTextField.getLineHeight() << 3;
    fParticipantDetailsInputTextField.setEnabled(false);
    fParticipantDetailsInputTextField.setEditable(false);
    fParticipantDetailsInputTextField.setToolTipText(R4EUIConstants.PARTICIPANT_DETAILS_TOOLTIP);
    fParticipantDetailsInputTextField.setLayoutData(textGridData);
}

From source file:org.eclipse.mylyn.reviews.r4e.ui.internal.dialogs.ParticipantInputDialog.java

License:Open Source License

/**
 * Method updateComponents.//from w w w.j a v a  2  s  .c om
 * 
 * @param aParticipant
 *            - R4EParticipant
 */
private void updateComponents(R4EParticipant aParticipant) {
    //Add item to the participants table
    final TableItem item = new TableItem(fAddedParticipantsTable, SWT.NONE);
    item.setText(0, aParticipant.getId());
    if (null != aParticipant.getEmail() && !("".equals(aParticipant.getEmail()))) {
        item.setFont(JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT));
        item.setText(1, aParticipant.getEmail());
    } else {
        //Mark table item as not complete
        item.setFont(JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT));
    }
    fAddedParticipantsTable.showItem(item);

    if (fParticipants.size() > 0) {
        fClearParticipantsButton.setEnabled(true);
        fRemoveUserButton.setEnabled(true);
        if (fUserToAddCombo instanceof CCombo) {
            ((CCombo) fUserToAddCombo).setText("");
        } else {
            ((Text) fUserToAddCombo).setText("");
        }
        getButton(IDialogConstants.OK_ID).setEnabled(true);
        getButton(IDialogConstants.OK_ID).setSelection(false);
    } else {
        if (fReviewSource) {
            getButton(IDialogConstants.OK_ID).setEnabled(false);
        }
    }
}

From source file:org.eclipse.mylyn.reviews.r4e.ui.internal.navigator.ReviewNavigatorDecorator.java

License:Open Source License

/**
 * Method decorateFont./*w  w  w .  j  a va  2 s.co m*/
 * 
 * @param aElement
 *            Object
 * @return Font
 * @see org.eclipse.jface.viewers.IFontDecorator#decorateFont(Object)
 */
public Font decorateFont(Object aElement) { // $codepro.audit.disable
    if (null != R4EUIModelController.getActiveReview()
            && R4EUIModelController.getActiveReview().equals(aElement)) {
        return JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);
    }
    if (isMyReview((IR4EUIModelElement) aElement)) {
        return JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT);
    }
    return null;
}