List of usage examples for org.eclipse.jface.resource JFaceResources getFontRegistry
public static FontRegistry getFontRegistry()
From source file:org.eclipse.mylyn.builds.ui.spi.BuildServerPart.java
License:Open Source License
@Override protected Control createAdditionalContents(final Composite parent) { // SectionComposite sectionComposite = new SectionComposite(parent, SWT.NONE); // //sectionComposite.setMinHeight(150); // sectionComposite.setExpandVertical(false); final ExpandableComposite section = new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.COMPACT | ExpandableComposite.EXPANDED); section.clientVerticalSpacing = 0;/*from w w w . j a v a2 s. com*/ section.setBackground(parent.getBackground()); section.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); section.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { if (section.getLayoutData() instanceof GridData) { ((GridData) section.getLayoutData()).grabExcessVerticalSpace = e.getState(); } parent.layout(true); } }); section.setText("Build Plans"); // ExpandableComposite section = section.createSection("Build Plans"); // section.setExpanded(true); // if (section.getLayoutData() instanceof GridData) { // GridData gd = ((GridData) section.getLayoutData()); // gd.grabExcessVerticalSpace = true; // gd.verticalAlignment = SWT.FILL; // gd.minimumHeight = 150; // } Composite composite = new Composite(section, SWT.NONE); section.setClient(composite); GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 5).applyTo(composite); CheckboxFilteredTree filteredTree = new CheckboxFilteredTree(composite, SWT.FULL_SELECTION | SWT.BORDER, new SubstringPatternFilter()); GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, 200).applyTo(filteredTree); planViewer = filteredTree.getCheckboxTreeViewer();//new CheckboxTreeViewer(composite, SWT.FULL_SELECTION | SWT.BORDER); planViewer.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { BuildPlan plan = (BuildPlan) event.getElement(); plan.setSelected(event.getChecked()); } }); planViewer.setCheckStateProvider(new ICheckStateProvider() { public boolean isChecked(Object element) { return ((IBuildPlan) element).isSelected(); } public boolean isGrayed(Object element) { for (IBuildPlan child : ((IBuildPlan) element).getChildren()) { if (!child.isSelected()) { return true; } } return false; } }); planViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return ((IBuildPlan) element).getName(); } }); planViewer.setContentProvider(new ITreeContentProvider() { private BuildServerConfiguration configuration; private final Object[] EMPTY_ARRAY = new Object[0]; public void dispose() { // ignore } public Object[] getChildren(Object parentElement) { return EMPTY_ARRAY; } public Object[] getElements(Object inputElement) { return configuration.getPlans().toArray(); } public Object getParent(Object element) { return null; } public boolean hasChildren(Object element) { return false; } public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { configuration = (BuildServerConfiguration) newInput; } }); planViewer.setSorter(new ViewerSorter()); Composite buttonComposite = new Composite(composite, SWT.NONE); GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.TOP).applyTo(buttonComposite); GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).extendedMargins(0, 0, 0, 0) .applyTo(buttonComposite); createButtons(buttonComposite); return section; }
From source file:org.eclipse.mylyn.commons.workbench.forms.SectionComposite.java
License:Open Source License
public ExpandableComposite createSection(String title, int expansionStyle, final boolean grabExcessVerticalSpace) { final ExpandableComposite section = getToolkit().createExpandableComposite(getContent(), ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.COMPACT | expansionStyle);//from w ww. jav a 2 s.c o m section.titleBarTextMarginWidth = 0; section.setBackground(null); section.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); section.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { if ((Boolean) e.data == true && grabExcessVerticalSpace) { GridData g = (GridData) section.getLayoutData(); g.verticalAlignment = GridData.FILL; g.grabExcessVerticalSpace = true; section.setLayoutData(g); } else { GridData g = (GridData) section.getLayoutData(); g.verticalAlignment = GridData.BEGINNING; g.grabExcessVerticalSpace = false; section.setLayoutData(g); } resizeAndReflow(); } }); section.setText(title); if (content.getLayout() instanceof GridLayout) { GridDataFactory.fillDefaults().indent(0, 5).grab(true, false) .span(((GridLayout) content.getLayout()).numColumns, SWT.DEFAULT).applyTo(section); } return section; }
From source file:org.eclipse.mylyn.internal.bugzilla.ui.wizard.BugzillaAttachmentWizardPage.java
License:Open Source License
private void createAdvancedSection(final Composite container) { boolean flagFound = false; for (TaskAttribute attribute : attachmentAttribute.getAttributes().values()) { if (!attribute.getId().startsWith(BugzillaAttribute.KIND_FLAG)) { continue; }/*from w w w . jav a 2 s . c o m*/ flagFound = true; break; } if (!flagFound) { return; } advancedExpandComposite = toolkit.createExpandableComposite(container, ExpandableComposite.COMPACT | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR); advancedExpandComposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); advancedExpandComposite.setBackground(container.getBackground()); advancedExpandComposite.setText(Messages.BugzillaAttachmentWizardPage_Advanced); advancedExpandComposite.setLayout(new GridLayout(4, false)); GridDataFactory.fillDefaults().indent(-6, 0).grab(true, false).span(4, SWT.DEFAULT) .applyTo(advancedExpandComposite); advancedExpandComposite.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { container.layout(); container.redraw(); } }); Composite advancedBodyComposite = new Composite(advancedExpandComposite, SWT.NONE); GridLayoutFactory.fillDefaults().margins(0, 0).numColumns(2).applyTo(advancedBodyComposite); advancedBodyComposite.setBackground(container.getBackground()); createFlagEditors(2, advancedBodyComposite); advancedExpandComposite.setClient(advancedBodyComposite); }
From source file:org.eclipse.mylyn.internal.commons.ui.SectionComposite.java
License:Open Source License
public ExpandableComposite createSection(String title, int expansionStyle, final boolean grabExcessVerticalSpace) { final ExpandableComposite section = getToolkit().createExpandableComposite(getContent(), ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.COMPACT | expansionStyle);/*from ww w. j a v a 2s.c om*/ section.titleBarTextMarginWidth = 0; section.setBackground(null); section.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); section.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { if ((Boolean) e.data == true && grabExcessVerticalSpace) { GridData g = (GridData) section.getLayoutData(); g.verticalAlignment = GridData.FILL; g.grabExcessVerticalSpace = true; section.setLayoutData(g); } else { GridData g = (GridData) section.getLayoutData(); g.verticalAlignment = GridData.BEGINNING; g.grabExcessVerticalSpace = false; section.setLayoutData(g); } Point newSize = section.getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT, true); Rectangle currentbounds = section.getShell().getBounds(); if (newSize.x > currentbounds.width || newSize.y > currentbounds.height) { Object shellData = section.getShell().getData(); if (shellData instanceof Window) { Window window = (Window) shellData; Rectangle preferredSize = new Rectangle(currentbounds.x, currentbounds.y, newSize.x, newSize.y); Rectangle result = WindowUtil.getConstrainedShellBounds(window, preferredSize); section.getShell().setBounds(result); } } else { layout(true); reflow(true); } } }); section.setText(title); if (content.getLayout() instanceof GridLayout) { GridDataFactory.fillDefaults().indent(0, 5).grab(true, false) .span(((GridLayout) content.getLayout()).numColumns, SWT.DEFAULT).applyTo(section); } return section; }
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 v a2 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 . j av a 2 s.c o m 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 w w . j a v a 2s .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 .ja va2 s . c om 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 .j a v 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.tasks.ui.editors.RichTextEditor.java
License:Open Source License
public SourceViewer getDefaultViewer() { if (defaultViewer == null) { defaultViewer = createDefaultEditor(editorComposite, style); configure(defaultViewer, new Document(getText()), isReadOnly()); // fixed font size defaultViewer.getTextWidget().setFont(JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT)); // adapt maximize action defaultViewer.getControl().setData(EditorUtil.KEY_TOGGLE_TO_MAXIMIZE_ACTION, editorViewer.getControl().getData(EditorUtil.KEY_TOGGLE_TO_MAXIMIZE_ACTION)); // adapt menu to the new viewer installMenu(defaultViewer.getControl(), editorViewer.getControl().getMenu()); }/* w w w. j a v a 2 s. com*/ return defaultViewer; }