List of usage examples for org.eclipse.jface.dialogs Dialog applyDialogFont
public static void applyDialogFont(Control control)
From source file:com.google.dart.tools.ui.internal.refactoring.InlineMethodInputPage.java
License:Open Source License
@Override public void createControl(Composite parent) { initializeDialogUnits(parent);/*from w ww . ja v a 2 s . c om*/ 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 = DartElementLabels.getElementLabel(fRefactoring.getMethod(), DartElementLabels.ALL_DEFAULT | DartElementLabels.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(), DartHelpContextIds.INLINE_METHOD_WIZARD_PAGE); }
From source file:com.google.dart.tools.ui.internal.refactoring.InlineMethodInputPage_NEW.java
License:Open Source License
@Override public void createControl(Composite parent) { initializeDialogUnits(parent);// w w w. j a v a2s.c o m fRefactoring = (ServerInlineMethodRefactoring) getRefactoring(); Composite result = new Composite(parent, SWT.NONE); setControl(result); GridLayout layout = new GridLayout(); result.setLayout(layout); GridData gd = null; boolean isDeclaration = fRefactoring.isDeclaration(); Label label = new Label(result, SWT.NONE); String methodLabel = fRefactoring.getFullName(); 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(isDeclaration); radioAll.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { if (((Button) event.widget).getSelection()) { fRemove.setEnabled(true); fRefactoring.setInlineAll(true); } } }); if (isDeclaration) { fRefactoring.setInlineAll(true); fRefactoring.setDeleteSource(true); } 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.setSelection(isDeclaration); 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(!isDeclaration); if (isDeclaration) { radioSelected.setEnabled(false); radioAll.setFocus(); } else { radioSelected.setFocus(); } radioSelected.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { if (((Button) event.widget).getSelection()) { fRemove.setEnabled(false); fRefactoring.setInlineAll(false); } } }); Dialog.applyDialogFont(result); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), DartHelpContextIds.INLINE_METHOD_WIZARD_PAGE); }
From source file:com.google.dart.tools.ui.internal.refactoring.InlineMethodInputPage_OLD.java
License:Open Source License
@Override public void createControl(Composite parent) { initializeDialogUnits(parent);//from w w w . j a va 2s. c o m fRefactoring = (ServiceInlineMethodRefactoring) 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 = fRefactoring.getMethodLabel(); 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(), DartHelpContextIds.INLINE_METHOD_WIZARD_PAGE); }
From source file:com.google.dart.tools.ui.internal.refactoring.reorg.RenameInputWizardPage.java
License:Open Source License
@Override public void createControl(Composite parent) { Composite superComposite = new Composite(parent, SWT.NONE); setControl(superComposite);//from w w w. j ava 2 s . c o m initializeDialogUnits(superComposite); superComposite.setLayout(new GridLayout()); Composite composite = new Composite(superComposite, SWT.NONE); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = 0; layout.marginWidth = 0; composite.setLayout(layout); RowLayouter layouter = new RowLayouter(2); Label label = new Label(composite, SWT.NONE); label.setText(getLabelText()); Text text = createTextInputField(composite); text.selectAll(); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.widthHint = convertWidthInCharsToPixels(25); text.setLayoutData(gd); layouter.perform(label, text, 1); Label separator = new Label(composite, SWT.NONE); GridData gridData = new GridData(SWT.FILL, SWT.FILL, false, false); gridData.heightHint = 2; separator.setLayoutData(gridData); addAdditionalOptions(composite, layouter); Dialog.applyDialogFont(superComposite); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), fHelpContextID); }
From source file:com.google.dart.tools.ui.internal.text.functions.AbstractInformationControl.java
License:Open Source License
protected Text createFilterText(Composite parent) { fFilterText = new Text(parent, SWT.NONE); Dialog.applyDialogFont(fFilterText); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalAlignment = GridData.FILL; data.verticalAlignment = GridData.CENTER; fFilterText.setLayoutData(data);//w w w . j a va 2 s . c o m fFilterText.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent e) { if (e.keyCode == 0x0D) { gotoSelectedElement(); } if (e.keyCode == SWT.ARROW_DOWN) { fTreeViewer.getTree().setFocus(); } if (e.keyCode == SWT.ARROW_UP) { fTreeViewer.getTree().setFocus(); } if (e.character == 0x1B) { dispose(); } } @Override public void keyReleased(KeyEvent e) { // do nothing } }); return fFilterText; }
From source file:com.google.dart.tools.ui.internal.text.functions.DartOutlineInformationControl_NEW.java
License:Open Source License
@Override protected Control createTitleControl(Composite parent) { filterText = new Text(parent, SWT.NONE); GridDataFactory.create(filterText).grabHorizontal().fillHorizontal().alignVerticalMiddle(); Dialog.applyDialogFont(filterText); filterText.setText(""); // navigation filterText.addKeyListener(new KeyAdapter() { @Override/* w w w . j a va 2s . co m*/ public void keyPressed(KeyEvent e) { if (e.keyCode == 0x0D) { gotoSelectedOutline(); } if (e.keyCode == SWT.ARROW_DOWN) { viewer.getTree().setFocus(); } if (e.keyCode == SWT.ARROW_UP) { viewer.getTree().setFocus(); } if (e.character == 0x1B) { dispose(); } } }); // filter change filterText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { String text = filterText.getText(); setMatcherString(text); } }); return filterText; }
From source file:com.google.dart.tools.ui.omni.BasePopupDialog.java
License:Open Source License
/** * Apply any desired fonts to the specified composite and its children. * /*from w w w . j a v a 2s. c o m*/ * @param composite the contents composite */ private void applyFonts(Composite composite) { Dialog.applyDialogFont(composite); if (titleLabel != null) { Font font = titleLabel.getFont(); FontData[] fontDatas = font.getFontData(); for (int i = 0; i < fontDatas.length; i++) { fontDatas[i].setStyle(SWT.BOLD); } titleFont = SWTUtil.getFont(titleLabel.getDisplay(), fontDatas); titleLabel.setFont(titleFont); } if (infoLabel != null) { Font font = infoLabel.getFont(); FontData[] fontDatas = font.getFontData(); for (int i = 0; i < fontDatas.length; i++) { fontDatas[i].setHeight(fontDatas[i].getHeight() * 9 / 10); } infoFont = SWTUtil.getFont(infoLabel.getDisplay(), fontDatas); infoLabel.setFont(infoFont); } }
From source file:com.google.gdt.eclipse.core.ui.controls.DemoSelectableControlList.java
License:Open Source License
private static Control createContents(Composite parent) { final Composite body = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 1;// w ww. j av a 2 s. c o m layout.marginHeight = 0; layout.marginWidth = 0; body.setLayout(layout); body.setFont(parent.getFont()); Button contributeWizardEntriesButton = new Button(body, SWT.CHECK); contributeWizardEntriesButton.setText("Show uninstalled toolkits as new wizard entries"); Label separator = new Label(body, SWT.SEPARATOR | SWT.HORIZONTAL); separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Text text = new Text(body, SWT.BORDER); text.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); Label label = new Label(body, SWT.NONE); label.setText("Install additional UI framework toolkits:"); label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); label.setForeground(COLOR_RED); // SampleControlList.createScolledComposite(body); final SampleControlList ctrlList = new SampleControlList(body, SWT.V_SCROLL | SWT.BORDER); ctrlList.setBackground(COLOR_WHITE); GridDataFactory.fillDefaults().grab(true, true).hint(100, 100).applyTo(ctrlList); // List<WBToolkit> toolkits = createToolkits(); ctrlList.addToolkits(new ArrayList<WBToolkit>()); Composite buttonPanel = new Composite(body, SWT.NONE); GridLayout layout2 = new GridLayout(2, false); layout2.marginHeight = 0; layout2.marginWidth = 0; buttonPanel.setLayout(layout2); buttonPanel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Button addButton = new Button(buttonPanel, SWT.PUSH); addButton.setText("Add..."); addButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { System.out.println("Add!!"); List<WBToolkit> tks = createToolkits(); ctrlList.addToolkit(tks.get((int) (tks.size() * Math.random()))); } }); Button clearButton = new Button(buttonPanel, SWT.PUSH); clearButton.setText("Clear"); clearButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ctrlList.clear(); } }); Button printSelectionsButton = new Button(buttonPanel, SWT.PUSH); printSelectionsButton.setText("Print Selections"); printSelectionsButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { System.out.println("Show."); } }); ProgressBar progressBar = new ProgressBar(body, SWT.NONE); progressBar.setMaximum(100); progressBar.setSelection(35); progressBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); progressBar.setVisible(false); Dialog.applyDialogFont(body); body.layout(true); return body; }
From source file:com.google.gdt.eclipse.core.ui.viewers.DemoSelectableControlListViewer.java
License:Open Source License
private static Control createContents(Composite parent) { final Composite body = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 1;//from w ww. ja v a 2 s . c om layout.marginHeight = 0; layout.marginWidth = 0; body.setLayout(layout); body.setFont(parent.getFont()); Button contributeWizardEntriesButton = new Button(body, SWT.CHECK); contributeWizardEntriesButton.setText("Show uninstalled toolkits as new wizard entries"); Label separator = new Label(body, SWT.SEPARATOR | SWT.HORIZONTAL); separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Text text = new Text(body, SWT.BORDER); text.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); Label label = new Label(body, SWT.NONE); label.setText("Install additional UI framework toolkits:"); label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); label.setForeground(COLOR_RED); // SampleControlList.createScolledComposite(body); final SelectableControlList<ToolkitControl> ctrlList = new SelectableControlList<ToolkitControl>(body, SWT.V_SCROLL | SWT.BORDER); ctrlList.setBackground(COLOR_WHITE); GridDataFactory.fillDefaults().grab(true, true).hint(100, 100).applyTo(ctrlList); final SelectableControlListViewer<WBToolkit, ToolkitControl> viewer = new SelectableControlListViewer<WBToolkit, ToolkitControl>( ctrlList); final WBToolkitProvider contentProvider = new WBToolkitProvider(createToolkits()); viewer.setContentProvider(contentProvider); final ToolkitControlFactory controlFactory = new ToolkitControlFactory(); viewer.setControlFactory(controlFactory); viewer.update(); Composite buttonPanel = new Composite(body, SWT.NONE); GridLayout layout2 = new GridLayout(2, false); layout2.marginHeight = 0; layout2.marginWidth = 0; buttonPanel.setLayout(layout2); buttonPanel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); Button addButton = new Button(buttonPanel, SWT.PUSH); addButton.setText("Add..."); addButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { System.out.println("Add!!"); List<WBToolkit> tks = createToolkits(); contentProvider.addToolkit(tks.get((int) (tks.size() * Math.random()))); } }); Button clearButton = new Button(buttonPanel, SWT.PUSH); clearButton.setText("Clear"); clearButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { contentProvider.clear(); } }); Button printSelectionsButton = new Button(buttonPanel, SWT.PUSH); printSelectionsButton.setText("Print Selections"); printSelectionsButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { System.out.println("Show."); } }); ProgressBar progressBar = new ProgressBar(body, SWT.NONE); progressBar.setMaximum(100); progressBar.setSelection(35); progressBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); progressBar.setVisible(false); Dialog.applyDialogFont(body); body.layout(true); return body; }
From source file:com.google.gdt.eclipse.designer.wizards.model.common.AbstractGwtWizardPage.java
License:Open Source License
public final void createControl(Composite parent) { initializeDialogUnits(parent);// w w w . ja v a 2 s.c o m // create composite Composite composite = new Composite(parent, SWT.NULL); composite.setFont(parent.getFont()); composite.setLayout(new GridLayout()); // create controls createPageControls(composite); // set composite Dialog.applyDialogFont(composite); setControl(composite); }