List of usage examples for org.eclipse.jface.resource JFaceResources DEFAULT_FONT
String DEFAULT_FONT
To view the source code for org.eclipse.jface.resource JFaceResources DEFAULT_FONT.
Click Source Link
"org.eclipse.jface.defaultfont"
). From source file:org.eclipse.jst.jsf.facesconfig.ui.preference.TitleBarButton.java
License:Open Source License
private void initialize() { setRequestFocusEnabled(true);/*from w w w. java 2s . co m*/ setFocusTraversable(true); if (uncheckedImage != null) { org.eclipse.swt.graphics.Rectangle r = uncheckedImage.getBounds(); setBounds(new Rectangle(0, 0, r.width, r.height)); prefSize = new Dimension(r.width, r.height); } else { setForegroundColor(ColorConstants.black); setBackgroundColor(ColorConstants.white); calculatePreferredSize(); setBounds(new Rectangle(0, 0, prefSize.width, prefSize.height)); } setCursor(Cursors.ARROW); setBorder(null); setFont(JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT)); addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { setState(!state); } }); this.addMouseMotionListener(new MouseMotionListener() { public void mouseDragged(MouseEvent me) { // TODO Auto-generated method stub } public void mouseEntered(MouseEvent me) { hilite = true; repaint(); } public void mouseExited(MouseEvent me) { hilite = false; repaint(); } public void mouseHover(MouseEvent me) { // TODO Auto-generated method stub } public void mouseMoved(MouseEvent me) { // TODO Auto-generated method stub } }); }
From source file:org.eclipse.koneki.ldt.ui.internal.buildpath.LuaExecutionEnvironmentLabelProvider.java
License:Open Source License
/** * @see org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider#getStyledText(java.lang.Object) *//* w ww . j av a2 s . c o m*/ @Override public StyledString getStyledText(Object element) { // we styled only execution environment; if (!(element instanceof LuaExecutionEnvironment)) return null; // custom style for embedded execution environment final String text = getText(element); if (((LuaExecutionEnvironment) element).isEmbedded()) return new StyledString(text + Messages.LuaExecutionEnvironmentLabelProvider_embedded_string, new Styler() { @Override public void applyStyles(TextStyle textStyle) { if (textStyle instanceof StyleRange) { ((StyleRange) textStyle).start = text.length(); Font italic = JFaceResources.getFontRegistry() .getItalic(JFaceResources.DEFAULT_FONT); textStyle.font = italic; ((StyleRange) textStyle).fontStyle = SWT.BOLD; } textStyle.foreground = Display.getCurrent() .getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND); } }); // else default styled return new StyledString(text); }
From source file:org.eclipse.mylyn.internal.jira.ui.JiraTaskEditor.java
License:Open Source License
public void createPartControl(Composite parent) { FormToolkit toolkit = new FormToolkit(getSite().getShell().getDisplay()); Form form = toolkit.createForm(parent); GridLayout formLayout = new GridLayout(1, true); final Composite formBody = form.getBody(); formBody.setLayout(formLayout);//from w w w. j a va2 s. c o m if (issue == null) { form.setText("Error opening task"); toolkit.createLabel(formBody, "Could not download: " + this.input.getTask().getDescription()); toolkit.createLabel(formBody, "\nTry synchronizing the corresponding query"); return; } form.setText(issue.getKey() + ": " + issue.getSummary()); Section summarySection = toolkit.createSection(formBody, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); summarySection.setText("Attributes"); summarySection.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); summarySection.setExpanded(true); Composite summary = toolkit.createComposite(summarySection); summary.setLayout(new GridLayout(6, false)); Label lblCreated = toolkit.createLabel(summary, "Created:"); lblCreated.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); toolkit.createLabel(summary, DATE_FORMAT.format(issue.getCreated())); Label lblUpdated = toolkit.createLabel(summary, "Updated:"); lblUpdated.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); toolkit.createLabel(summary, DATE_FORMAT.format(issue.getUpdated())); if (issue.getDue() != null) { Label lblDue = toolkit.createLabel(summary, "Due:"); lblDue.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); toolkit.createLabel(summary, DATE_FORMAT.format(issue.getDue())); } else { Label spacer = toolkit.createLabel(summary, ""); spacer.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).create()); } Label lblStatus = toolkit.createLabel(summary, "Status:"); lblStatus.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); toolkit.createLabel(summary, issue.getStatus().getName()); Label lblResolution = toolkit.createLabel(summary, "Resolution:"); lblResolution.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); if (issue.getResolution() != null) { Label resolution = toolkit.createLabel(summary, issue.getResolution().getName()); resolution.setToolTipText(issue.getResolution().getDescription()); } else { toolkit.createLabel(summary, "Unresolved"); } Label lblPriority = toolkit.createLabel(summary, "Priority:"); lblPriority.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); if (issue.getPriority() != null) { Label priority = toolkit.createLabel(summary, issue.getPriority().getName()); priority.setToolTipText(issue.getPriority().getDescription()); } else { toolkit.createLabel(summary, "No Priority"); } Label lblReporter = toolkit.createLabel(summary, "Reporter:"); lblReporter.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); toolkit.createLabel(summary, issue.getReporter()); Label lblAssignee = toolkit.createLabel(summary, "Assignee"); lblAssignee.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); toolkit.createLabel(summary, issue.getAssignee()); // spacer Label spacer2 = toolkit.createLabel(summary, ""); spacer2.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).create()); StringBuffer sbComponents = new StringBuffer(); if (issue.getComponents().length > 0) { for (int i = 0; i < issue.getComponents().length; i++) { if (i != 0) { sbComponents.append(", "); } sbComponents.append(issue.getComponents()[i].getName()); } } else { sbComponents.append("None"); } Label lblComponents = toolkit.createLabel(summary, "Components"); lblComponents.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); toolkit.createLabel(summary, sbComponents.toString()); StringBuffer sbAffectsVersions = new StringBuffer(); if (issue.getReportedVersions().length > 0) { for (int i = 0; i < issue.getReportedVersions().length; i++) { if (i != 0) { sbAffectsVersions.append(", "); } sbAffectsVersions.append(issue.getReportedVersions()[i].getName()); } } else { sbAffectsVersions.append("None"); } Label lblAffectsVersion = toolkit.createLabel(summary, "Affects Versions"); lblAffectsVersion.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); toolkit.createLabel(summary, sbAffectsVersions.toString()); StringBuffer sbFixVersions = new StringBuffer(); if (issue.getFixVersions().length > 0) { for (int i = 0; i < issue.getFixVersions().length; i++) { if (i != 0) { sbFixVersions.append(", "); } sbFixVersions.append(issue.getFixVersions()[i].getName()); } } else { sbFixVersions.append("None"); } Label lblFixVersions = toolkit.createLabel(summary, "Fix Versions"); lblFixVersions.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); toolkit.createLabel(summary, sbFixVersions.toString()); summarySection.setClient(summary); // created, updated, due (optional) final Section descriptionSection = toolkit.createSection(formBody, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); descriptionSection.setExpanded(true); descriptionSection.setText("Description"); final GridData dgd = GridDataFactory.fillDefaults().grab(true, false).create(); descriptionSection.setLayoutData(dgd); Composite c = toolkit.createComposite(descriptionSection); GridLayout gl = new GridLayout(1, true); gl.marginHeight = 0; gl.marginWidth = 0; c.setLayout(gl); Text description = toolkit.createText(c, issue.getDescription(), SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); description.setLayoutData( GridDataFactory.fillDefaults().grab(true, false).minSize(200, 80).hint(200, 80).create()); description.setText(issue.getDescription()); description.setEditable(false); description.setFont(JFaceResources.getTextFont()); descriptionSection.setClient(c); commentsSection = toolkit.createSection(formBody, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); commentsSection.setExpanded(true); ImageHyperlink sortOrder = toolkit.createImageHyperlink(commentsSection, SWT.NONE); sortOrder.setText("Direction"); commentsSection.setTextClient(sortOrder); commentsSection.setText("Comments"); commentsSection.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); sc = new ScrolledComposite(commentsSection, SWT.H_SCROLL | SWT.V_SCROLL); sc.setExpandHorizontal(true); sc.setExpandVertical(true); sc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); final Composite c1 = toolkit.createComposite(sc); GridLayout commentsLayout = new GridLayout(1, true); commentsLayout.marginWidth = 0; commentsLayout.marginHeight = 0; c1.setLayout(commentsLayout); for (int i = 0; i < issue.getComments().length; i++) { Comment comment = issue.getComments()[i]; ExpandableComposite expandableComposite = toolkit.createExpandableComposite(c1, ExpandableComposite.TREE_NODE); expandableComposite.setText( "Comment by " + comment.getAuthor() + " [" + DATE_FORMAT.format(comment.getCreated()) + "]"); expandableComposite.setLayout(new FillLayout(SWT.HORIZONTAL)); expandableComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); Text t = toolkit.createText(expandableComposite, comment.getComment(), SWT.MULTI | SWT.WRAP); t.setEditable(false); t.setFont(JFaceResources.getTextFont()); expandableComposite.setClient(t); expandableComposite.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { sc.layout(true, true); } }); commentToControlMap.put(comment, expandableComposite); t.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); if (i == issue.getComments().length - 1) { expandableComposite.setExpanded(true); } } commentsSection.setClient(sc); sc.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent e) { Point size = c1.computeSize(sc.getClientArea().width, SWT.DEFAULT); sc.setMinSize(size); } }); final Section commentSection = toolkit.createSection(formBody, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR); commentSection.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); commentSection.setText("Add Comment"); commentSection.setExpanded(false); commentSection.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { formBody.layout(true); } }); final Composite commentArea = toolkit.createComposite(commentSection); GridLayout commentAreaLayout = new GridLayout(1, false); commentAreaLayout.marginHeight = 0; commentAreaLayout.marginWidth = 0; commentAreaLayout.verticalSpacing = 0; commentAreaLayout.horizontalSpacing = 0; commentArea.setLayout(commentAreaLayout); commentSection.setClient(commentArea); comment = new Text(commentArea, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); comment.setFont(JFaceResources.getTextFont()); final GridData commentGd = new GridData(SWT.FILL, SWT.FILL, true, false); commentGd.heightHint = 80; comment.setLayoutData(commentGd); comment.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { int charCount = comment.getCharCount(); if (charCount > 0) { isDirty = true; // if ((isDirty && charCount == 0) || (!isDirty && charCount > 0)) { firePropertyChange(PROP_DIRTY); } } }); sc.setContent(c1); sc.setMinSize(c1.computeSize(SWT.DEFAULT, SWT.DEFAULT)); }
From source file:org.eclipse.mylyn.internal.monitor.usage.preferences.UsageDataPreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayoutFactory.fillDefaults().applyTo(container); if (studyParameters.getCustomizingPlugin() != null) { Label label = new Label(parent, SWT.NULL); label.setText(studyParameters.getCustomizedByMessage()); label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); if (studyParameters.getMoreInformationUrl() != null) { ImageHyperlink link = new ImageHyperlink(parent, SWT.NONE); link.setText(Messages.UsageDataPreferencePage_Learn_More); link.setForeground(CommonColors.HYPERLINK_WIDGET); link.addHyperlinkListener(new HyperlinkAdapter() { @Override// w w w . java 2 s . c om public void linkActivated(HyperlinkEvent e) { openMoreInformaionInBrowser(); } }); } } createLogFileSection(container); createUsageSection(container); updateEnablement(); Dialog.applyDialogFont(container); return container; }
From source file:org.eclipse.mylyn.internal.monitor.usage.wizards.GetNewUserIdPage.java
License:Open Source License
@SuppressWarnings("deprecation") private void createBrowserSection(Composite parent) { if (extendedMonitor) { Label label = new Label(parent, SWT.NULL); label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); label.setText(studyParameters.getCustomizedByMessage()); Composite container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); container.setLayout(layout);/*from w ww . ja va 2 s.c om*/ layout.numColumns = 1; Browser browser = new Browser(parent, SWT.NONE); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.heightHint = 200; gd.widthHint = 600; browser.setLayoutData(gd); URL url = Platform.getBundle(studyParameters.getCustomizingPlugin()) .getEntry(studyParameters.getFormsConsent()); try { URL localURL = Platform.asLocalURL(url); browser.setUrl(localURL.toString()); } catch (Exception e) { browser.setText(Messages.GetNewUserIdPage_Feedback_Description_Not_Located); } } else { Label label = new Label(parent, SWT.NULL); label.setText(""); //$NON-NLS-1$ } }
From source file:org.eclipse.mylyn.internal.monitor.usage.wizards.GetNewUserIdPage.java
License:Open Source License
private void createUserIdButtons(Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 1;//w ww . j a v a2s. c o m container.setLayout(layout); Label l = new Label(container, SWT.NONE); l.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); l.setText(Messages.GetNewUserIdPage_I_Consent_Acknowledge); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); l.setLayoutData(gd); container = new Composite(parent, SWT.NULL); layout = new GridLayout(); layout.numColumns = 2; container.setLayout(layout); getNewUid = new Button(container, SWT.PUSH); gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); getNewUid.setLayoutData(gd); getNewUid.setSelection(false); getNewUid.setText(Messages.GetNewUserIdPage_I_Consent); getNewUid.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { if (e.widget instanceof Button) { if (hasAllFields(false)) { final int[] uid = new int[1]; try { getWizard().getContainer().run(false, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { uid[0] = UiUsageMonitorPlugin.getDefault().getUploadManager().getNewUid( studyParameters, first, last, email, anon, jobFunction, companySize, companyFunction, contactEmail, monitor); } catch (UsageDataException e) { StatusHandler.log(new Status(IStatus.ERROR, UiUsageMonitorPlugin.ID_PLUGIN, e.getMessage(), e)); uid[0] = -1; } } }); } catch (InvocationTargetException e1) { StatusHandler.log( new Status(IStatus.ERROR, UiUsageMonitorPlugin.ID_PLUGIN, e1.getMessage(), e1)); } catch (InterruptedException e1) { StatusHandler.log( new Status(IStatus.ERROR, UiUsageMonitorPlugin.ID_PLUGIN, e1.getMessage(), e1)); } if (uid[0] != -1 && uid[0] != 0) { UiUsageMonitorPlugin.getDefault().getPreferenceStore() .setValue(studyParameters.getUserIdPreferenceId(), uid[0]); if (wizard.getUploadPage() != null) { wizard.getUploadPage().updateUid(); } hasValidated = true; MessageDialog.openInformation(Display.getDefault().getActiveShell(), NLS.bind(Messages.GetNewUserIdPage_X_User_Study_Id, studyParameters.getStudyName()), NLS.bind(Messages.GetNewUserIdPage_Your_X_User_Study_Id_Y, studyParameters.getStudyName(), wizard.getUid())); } else { MessageDialog.openError(null, Messages.UsageSubmissionWizard_Error_Getting_User_Id, Messages.UsageSubmissionWizard_Unable_To_Get_New_User_Id); } } else { MessageDialog.openError(Display.getDefault().getActiveShell(), Messages.GetNewUserIdPage_Incomplete_Form_Input, Messages.GetNewUserIdPage_Please_Complete_All_Fields); } GetNewUserIdPage.this.setPageComplete(GetNewUserIdPage.this.isPageComplete()); } } public void widgetDefaultSelected(SelectionEvent e) { // don't care about default selected } }); getExistingUid = new Button(container, SWT.PUSH); gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); getExistingUid.setLayoutData(gd); getExistingUid.setSelection(false); getExistingUid.setText(Messages.GetNewUserIdPage_Already_Consented); getExistingUid.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { if (e.widget instanceof Button) { if (hasAllFields(true)) { final int[] uid = new int[1]; try { getWizard().getContainer().run(false, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { uid[0] = UiUsageMonitorPlugin.getDefault().getUploadManager() .getExistingUid(studyParameters, first, last, email, anon, monitor); } catch (UsageDataException e) { uid[0] = -1; StatusHandler.log(new Status(IStatus.ERROR, UiUsageMonitorPlugin.ID_PLUGIN, e.getMessage(), e)); } } }); } catch (InvocationTargetException e1) { StatusHandler.log( new Status(IStatus.ERROR, UiUsageMonitorPlugin.ID_PLUGIN, e1.getMessage(), e1)); } catch (InterruptedException e1) { StatusHandler.log( new Status(IStatus.ERROR, UiUsageMonitorPlugin.ID_PLUGIN, e1.getMessage(), e1)); } if (uid[0] != -1 && uid[0] != 0) { UiUsageMonitorPlugin.getDefault().getPreferenceStore() .setValue(studyParameters.getUserIdPreferenceId(), uid[0]); if (wizard.getUploadPage() != null) { wizard.getUploadPage().updateUid(); } hasValidated = true; MessageDialog.openInformation(Display.getDefault().getActiveShell(), NLS.bind(Messages.GetNewUserIdPage_X_User_Study_Id, studyParameters.getStudyName()), NLS.bind(Messages.GetNewUserIdPage_Your_X_User_Study_Id_Y_Retrieve_By_Repeating, studyParameters.getStudyName(), wizard.getUid())); } else { MessageDialog.openError(null, Messages.UsageSubmissionWizard_Error_Getting_User_Id, Messages.UsageSubmissionWizard_Unable_To_Get_New_User_Id); } } else { MessageDialog.openError(Display.getDefault().getActiveShell(), Messages.GetNewUserIdPage_Incomplete_Form_Input, Messages.GetNewUserIdPage_Please_Complete_All_Fields); } GetNewUserIdPage.this.setPageComplete(GetNewUserIdPage.this.isPageComplete()); } } public void widgetDefaultSelected(SelectionEvent e) { // don't care about default selected } }); updateEnablement(); }
From source file:org.eclipse.mylyn.internal.monitor.usage.wizards.UsageUploadWizardPage.java
License:Open Source License
/** * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) *//* w w w .jav a 2 s .c o m*/ public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); container.setLayout(layout); layout.numColumns = 1; Composite topContainer = new Composite(container, SWT.NULL); GridLayout topContainerLayout = new GridLayout(); topContainer.setLayout(topContainerLayout); topContainerLayout.numColumns = 2; topContainerLayout.verticalSpacing = 9; Label label; if (studyParameters.getCustomizingPlugin() != null) { label = new Label(parent, SWT.NULL); label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT)); label.setText(studyParameters.getCustomizedByMessage()); } label = new Label(topContainer, SWT.NULL); label.setText(Messages.UsageUploadWizardPage_Upload_Url); serverAddrText = new Text(topContainer, SWT.BORDER | SWT.SINGLE); GridData gd = new GridData(GridData.FILL_HORIZONTAL); serverAddrText.setLayoutData(gd); serverAddrText.setEditable(false); serverAddrText.setText(studyParameters.getUploadServletUrl()); label = new Label(topContainer, SWT.NULL); label.setText(Messages.UsageUploadWizardPage_Usage_File_Location); usageFileText = new Text(topContainer, SWT.BORDER | SWT.SINGLE); gd = new GridData(GridData.FILL_HORIZONTAL); usageFileText.setLayoutData(gd); usageFileText.setEditable(false); usageFileText.setText(wizard.getMonitorFileName()); Composite bottomContainer = new Composite(container, SWT.NULL); GridLayout bottomContainerLayout = new GridLayout(); bottomContainer.setLayout(bottomContainerLayout); bottomContainerLayout.numColumns = 2; Label submissionLabel = new Label(bottomContainer, SWT.NONE); submissionLabel.setText(studyParameters.getFilteredIdSubmissionText()); setControl(container); }
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);/*ww w.j a v a 2 s . c o 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 ww w. j a va2s. co 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);//w w w.jav 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())); }