List of usage examples for org.eclipse.jface.dialogs Dialog applyDialogFont
public static void applyDialogFont(Control control)
From source file:ext.org.eclipse.jdt.internal.ui.preferences.SmartTypingConfigurationBlock.java
License:Open Source License
private void createMessage(final Composite composite) { // TODO create a link with an argument, so the formatter preference page can open the // current profile automatically. String linkTooltip = PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_tooltip; String text;//from w w w. ja va 2s . com String indentMode = JavaPlugin.getDefault().getCombinedPreferenceStore() .getString(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR); if (JavaCore.TAB.equals(indentMode)) text = Messages.format(PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_tab_text, new String[] { Integer.toString(getTabDisplaySize()) }); else text = Messages.format(PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_others_text, new String[] { Integer.toString(getTabDisplaySize()), Integer.toString(getIndentSize()), getIndentMode() }); final Link link = new Link(composite, SWT.NONE); link.setText(text); link.setToolTipText(linkTooltip); GridData gd = new GridData(SWT.FILL, SWT.BEGINNING, true, false); gd.widthHint = 300; // don't get wider initially link.setLayoutData(gd); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { PreferencesUtil.createPreferenceDialogOn(link.getShell(), "org.eclipse.jdt.ui.preferences.CodeFormatterPreferencePage", null, null); //$NON-NLS-1$ } }); final IPreferenceStore combinedStore = JavaPlugin.getDefault().getCombinedPreferenceStore(); final IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener() { private boolean fHasRun = false; public void propertyChange(PropertyChangeEvent event) { if (fHasRun) return; if (composite.isDisposed()) return; String property = event.getProperty(); if (DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR.equals(property) || DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE.equals(property)) { fHasRun = true; link.dispose(); createMessage(composite); Dialog.applyDialogFont(composite); composite.redraw(); composite.layout(); } } }; combinedStore.addPropertyChangeListener(propertyChangeListener); link.addDisposeListener(new DisposeListener() { public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e) { combinedStore.removePropertyChangeListener(propertyChangeListener); } }); }
From source file:ext.org.eclipse.jdt.internal.ui.preferences.SourceAttachmentPropertyPage.java
License:Open Source License
@Override protected Control createContents(Composite composite) { initializeDialogUnits(composite);// w ww.j av a2 s . com Control result = createPageContent(composite); Dialog.applyDialogFont(result); return result; }
From source file:ext.org.eclipse.jdt.internal.ui.preferences.TypeFilterPreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { initializeDialogUnits(parent);// w w w .j ava 2 s . c om Composite composite = new Composite(parent, SWT.NONE); composite.setFont(parent.getFont()); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginWidth = 0; layout.marginHeight = 0; composite.setLayout(layout); fFilterListField.doFillIntoGrid(composite, 3); LayoutUtil.setHorizontalSpan(fFilterListField.getLabelControl(null), 2); LayoutUtil.setWidthHint(fFilterListField.getLabelControl(null), convertWidthInCharsToPixels(40)); LayoutUtil.setHorizontalGrabbing(fFilterListField.getListControl(null)); fFilterListField.getTableViewer().setComparator(new ViewerComparator()); Label spacer = new Label(composite, SWT.LEFT); GridData gd = new GridData(SWT.DEFAULT, convertHeightInCharsToPixels(1) / 2); gd.horizontalSpan = 2; spacer.setLayoutData(gd); String label = PreferencesMessages.TypeFilterPreferencePage_restricted_link; Map<String, String> targetInfo = new java.util.HashMap<String, String>(2); targetInfo.put(ProblemSeveritiesPreferencePage.DATA_SELECT_OPTION_KEY, JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE); targetInfo.put(ProblemSeveritiesPreferencePage.DATA_SELECT_OPTION_QUALIFIER, JavaCore.PLUGIN_ID); createPreferencePageLink(composite, label, targetInfo); fHideForbiddenField.doFillIntoGrid(composite, 2); fHideDiscouragedField.doFillIntoGrid(composite, 2); Dialog.applyDialogFont(composite); return composite; }
From source file:ext.org.eclipse.jdt.internal.ui.preferences.UserLibraryPreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setFont(parent.getFont()); LayoutUtil.doDefaultLayout(composite, new DialogField[] { fLibraryList }, true); LayoutUtil.setHorizontalGrabbing(fLibraryList.getTreeControl(null)); Dialog.applyDialogFont(composite); return composite; }
From source file:ext.org.eclipse.jdt.internal.ui.refactoring.code.ExtractMethodInputPage.java
License:Open Source License
public void createControl(Composite parent) { fRefactoring = (ExtractMethodRefactoring) getRefactoring(); loadSettings();// w ww .j a v a2s . co m Composite result = new Composite(parent, SWT.NONE); setControl(result); GridLayout layout = new GridLayout(); layout.numColumns = 2; result.setLayout(layout); RowLayouter layouter = new RowLayouter(2); GridData gd = null; initializeDialogUnits(result); Label label = new Label(result, SWT.NONE); label.setText(getLabelText()); fTextField = createTextInputField(result, SWT.BORDER); fTextField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); layouter.perform(label, fTextField, 1); ASTNode[] destinations = fRefactoring.getDestinations(); if (destinations.length > 1) { label = new Label(result, SWT.NONE); label.setText(RefactoringMessages.ExtractMethodInputPage_destination_type); final Combo combo = new Combo(result, SWT.READ_ONLY | SWT.DROP_DOWN); SWTUtil.setDefaultVisibleItemCount(combo); for (int i = 0; i < destinations.length; i++) { ASTNode declaration = destinations[i]; combo.add(getLabel(declaration)); } combo.select(0); combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); combo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { fRefactoring.setDestination(combo.getSelectionIndex()); updatePreview(getText()); } }); } label = new Label(result, SWT.NONE); label.setText(RefactoringMessages.ExtractMethodInputPage_access_Modifiers); Composite group = new Composite(result, SWT.NONE); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); layout = new GridLayout(); layout.numColumns = 4; layout.marginWidth = 0; group.setLayout(layout); String[] labels = new String[] { RefactoringMessages.ExtractMethodInputPage_public, RefactoringMessages.ExtractMethodInputPage_protected, RefactoringMessages.ExtractMethodInputPage_default, RefactoringMessages.ExtractMethodInputPage_private }; Integer[] data = new Integer[] { new Integer(Modifier.PUBLIC), new Integer(Modifier.PROTECTED), new Integer(Modifier.NONE), new Integer(Modifier.PRIVATE) }; Integer visibility = new Integer(fRefactoring.getVisibility()); for (int i = 0; i < labels.length; i++) { Button radio = new Button(group, SWT.RADIO); radio.setText(labels[i]); radio.setData(data[i]); if (data[i].equals(visibility)) radio.setSelection(true); radio.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { final Integer selectedModifier = (Integer) event.widget.getData(); fSettings.put(ACCESS_MODIFIER, selectedModifier.intValue()); setVisibility(selectedModifier); } }); } layouter.perform(label, group, 1); if (!fRefactoring.getParameterInfos().isEmpty()) { ChangeParametersControl cp = new ChangeParametersControl(result, SWT.NONE, RefactoringMessages.ExtractMethodInputPage_parameters, new IParameterListChangeListener() { public void parameterChanged(ParameterInfo parameter) { parameterModified(); } public void parameterListChanged() { parameterModified(); } public void parameterAdded(ParameterInfo parameter) { updatePreview(getText()); } }, ChangeParametersControl.Mode.EXTRACT_METHOD); gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 2; cp.setLayoutData(gd); cp.setInput(fRefactoring.getParameterInfos()); } Button checkBox = new Button(result, SWT.CHECK); checkBox.setText(RefactoringMessages.ExtractMethodInputPage_throwRuntimeExceptions); checkBox.setSelection(fSettings.getBoolean(THROW_RUNTIME_EXCEPTIONS)); checkBox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setRethrowRuntimeException(((Button) e.widget).getSelection()); } }); layouter.perform(checkBox); checkBox = new Button(result, SWT.CHECK); checkBox.setText(RefactoringMessages.ExtractMethodInputPage_generateJavadocComment); boolean generate = computeGenerateJavadoc(); setGenerateJavadoc(generate); checkBox.setSelection(generate); checkBox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setGenerateJavadoc(((Button) e.widget).getSelection()); } }); layouter.perform(checkBox); int duplicates = fRefactoring.getNumberOfDuplicates(); checkBox = new Button(result, SWT.CHECK); if (duplicates == 0) { checkBox.setText(RefactoringMessages.ExtractMethodInputPage_duplicates_none); } else if (duplicates == 1) { checkBox.setText(RefactoringMessages.ExtractMethodInputPage_duplicates_single); } else { checkBox.setText(Messages.format(RefactoringMessages.ExtractMethodInputPage_duplicates_multi, new Integer(duplicates))); } checkBox.setSelection(fRefactoring.getReplaceDuplicates()); checkBox.setEnabled(duplicates > 0); checkBox.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { fRefactoring.setReplaceDuplicates(((Button) e.widget).getSelection()); } }); layouter.perform(checkBox); label = new Label(result, SWT.SEPARATOR | SWT.HORIZONTAL); label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); layouter.perform(label); createSignaturePreview(result, layouter); Dialog.applyDialogFont(result); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.EXTRACT_METHOD_WIZARD_PAGE); }
From source file:ext.org.eclipse.jdt.internal.ui.refactoring.code.InlineMethodInputPage.java
License:Open Source License
public void createControl(Composite parent) { initializeDialogUnits(parent);//from w ww . ja v a 2s . com fRefactoring = (InlineMethodRefactoring) getRefactoring(); Composite result = new Composite(parent, SWT.NONE); setControl(result); GridLayout layout = new GridLayout(); result.setLayout(layout); GridData gd = null; boolean all = fRefactoring.getInitialMode() == InlineMethodRefactoring.Mode.INLINE_ALL; Label label = new Label(result, SWT.NONE); String methodLabel = JavaElementLabels.getElementLabel(fRefactoring.getMethod(), JavaElementLabels.ALL_DEFAULT | JavaElementLabels.M_FULLY_QUALIFIED); label.setText(Messages.format(RefactoringMessages.InlineMethodInputPage_inline_method, methodLabel)); label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite separator = new Composite(result, SWT.NONE); separator.setLayoutData(new GridData(0, 0)); Button radioAll = new Button(result, SWT.RADIO); radioAll.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); radioAll.setText(RefactoringMessages.InlineMethodInputPage_all_invocations); radioAll.setSelection(all); radioAll.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { fRemove.setEnabled(fRefactoring.canEnableDeleteSource()); if (((Button) event.widget).getSelection()) changeRefactoring(InlineMethodRefactoring.Mode.INLINE_ALL); } }); fRemove = new Button(result, SWT.CHECK); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalIndent = convertWidthInCharsToPixels(3); fRemove.setLayoutData(gd); fRemove.setText(RefactoringMessages.InlineMethodInputPage_delete_declaration); fRemove.setEnabled(all && fRefactoring.canEnableDeleteSource()); fRemove.setSelection(fRefactoring.canEnableDeleteSource()); fRefactoring.setDeleteSource(fRefactoring.canEnableDeleteSource()); fRemove.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { fRefactoring.setDeleteSource(((Button) e.widget).getSelection()); } }); Button radioSelected = new Button(result, SWT.RADIO); radioSelected.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); radioSelected.setText(RefactoringMessages.InlineMethodInputPage_only_selected); radioSelected.setSelection(!all); if (all) { radioSelected.setEnabled(false); radioAll.setFocus(); } else { radioSelected.setFocus(); } radioSelected.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { fRemove.setEnabled(false); if (((Button) event.widget).getSelection()) changeRefactoring(InlineMethodRefactoring.Mode.INLINE_SINGLE); } }); Dialog.applyDialogFont(result); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.INLINE_METHOD_WIZARD_PAGE); }
From source file:ext.org.eclipse.jdt.internal.ui.refactoring.code.ReplaceInvocationsInputPage.java
License:Open Source License
public void createControl(Composite parent) { initializeDialogUnits(parent);/*from w w w. j a v a 2 s . co m*/ fRefactoring = (ReplaceInvocationsRefactoring) getRefactoring(); Composite result = new Composite(parent, SWT.NONE); setControl(result); GridLayout layout = new GridLayout(); result.setLayout(layout); createMethodSignature(result); Label separator = new Label(parent, SWT.NONE); GridData gridData = new GridData(SWT.FILL, SWT.FILL, false, false); gridData.heightHint = 5; separator.setLayoutData(gridData); Label bodyLabel = new Label(result, SWT.NONE); bodyLabel.setText(RefactoringMessages.ReplaceInvocationsInputPage_replaceInvocationsBy); createBody(result); Button replaceAll = new Button(result, SWT.CHECK); replaceAll.setText(RefactoringMessages.ReplaceInvocationsInputPage_replaceAll); boolean canSingle = fRefactoring.canReplaceSingle(); // replaceAll.setEnabled(canSingle); replaceAll.setEnabled(false); // does not work for now... replaceAll.setSelection(!canSingle); replaceAll.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { boolean all = ((Button) event.widget).getSelection(); changeMode(all ? ReplaceInvocationsRefactoring.Mode.REPLACE_ALL : ReplaceInvocationsRefactoring.Mode.REPLACE_SINGLE); } }); Dialog.applyDialogFont(result); }
From source file:ext.org.eclipse.jdt.internal.ui.refactoring.CreateTextFileChangePreviewViewer.java
License:Open Source License
/** * {@inheritDoc}/*w ww . j a v a2 s . c o m*/ */ public void createControl(Composite parent) { fPane = new CreateTextFilePreviewer(parent, SWT.BORDER | SWT.FLAT); Dialog.applyDialogFont(fPane); fSourceViewer = new SourceViewer(fPane, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.FULL_SELECTION); fSourceViewer.setEditable(false); fSourceViewer.getControl().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)); fPane.setContent(fSourceViewer.getControl()); }
From source file:ext.org.eclipse.jdt.internal.ui.refactoring.ExtractSupertypeMemberPage.java
License:Open Source License
/** * {@inheritDoc}/* w w w . j ava2s.co m*/ */ @Override public void createControl(final Composite parent) { final Composite composite = new Composite(parent, SWT.NONE); final GridLayout layout = new GridLayout(); layout.numColumns = 2; composite.setLayout(layout); createSuperTypeField(composite); createSpacer(composite); createSuperTypeCheckbox(composite); createInstanceOfCheckbox(composite, layout.marginWidth); createStubCheckbox(composite); createSuperTypeControl(composite); createSpacer(composite); createMemberTableLabel(composite); createMemberTableComposite(composite); createStatusLine(composite); setControl(composite); Dialog.applyDialogFont(composite); initializeEnablement(); initializeCheckboxes(); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.EXTRACT_SUPERTYPE_WIZARD_PAGE); }
From source file:ext.org.eclipse.jdt.internal.ui.refactoring.nls.ExternalizeWizardPage.java
License:Open Source License
public void createControl(Composite parent) { initializeDialogUnits(parent);//from w w w . j a va 2s . c om Composite supercomposite = new Composite(parent, SWT.NONE); supercomposite.setFont(parent.getFont()); supercomposite.setLayout(new GridLayout()); createIsEclipseNLSCheckbox(supercomposite); createKeyPrefixField(supercomposite); SashForm composite = new SashForm(supercomposite, SWT.VERTICAL); composite.setFont(supercomposite.getFont()); GridData data = new GridData(GridData.FILL_BOTH); composite.setLayoutData(data); createTableViewer(composite); createSourceViewer(composite); createAccessorInfoComposite(supercomposite); composite.setWeights(new int[] { 65, 45 }); validateKeys(false); updateButtonStates(StructuredSelection.EMPTY); // promote control setControl(supercomposite); Dialog.applyDialogFont(supercomposite); PlatformUI.getWorkbench().getHelpSystem().setHelp(supercomposite, IJavaHelpContextIds.EXTERNALIZE_WIZARD_KEYVALUE_PAGE); }