Java Code Examples for org.eclipse.swt.widgets.Composite#setFont()
The following examples show how to use
org.eclipse.swt.widgets.Composite#setFont() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractWizardPage.java From typescript.java with MIT License | 6 votes |
@Override public final void createControl(Composite parent) { initializeDialogUnits(parent); // top level group Composite topLevel = new Composite(parent, SWT.NONE); topLevel.setLayout(new GridLayout()); topLevel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL)); topLevel.setFont(parent.getFont()); // Create Body UI createBody(topLevel); // initialize page with default values initializeDefaultValues(); // Validate page fields. validateAndUpdateStatus(); setControl(topLevel); }
Example 2
Source File: JavaEditorCodeMiningConfigurationBlock.java From jdt-codemining with Eclipse Public License 1.0 | 6 votes |
@Override protected Control createContents(Composite parent) { fPixelConverter = new PixelConverter(parent); setShell(parent.getShell()); Composite mainComp = new Composite(parent, SWT.NONE); mainComp.setFont(parent.getFont()); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; mainComp.setLayout(layout); createIgnoreOptionalProblemsLink(mainComp); Composite spacer = new Composite(mainComp, SWT.NONE); spacer.setLayoutData(new GridData(0, 0)); Composite commonComposite = createStyleTabContent(mainComp); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); gridData.heightHint = fPixelConverter.convertHeightInCharsToPixels(30); commonComposite.setLayoutData(gridData); validateSettings(null, null, null); return mainComp; }
Example 3
Source File: TypeSelectionComponent.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private Control createHeader(Composite parent, Font font, String message) { Composite header= new Composite(parent, SWT.NONE); GridLayout layout= new GridLayout(); layout.numColumns= 2; layout.marginWidth= 0; layout.marginHeight= 0; header.setLayout(layout); header.setFont(font); Label label= new Label(header, SWT.NONE); label.setText(message); label.setFont(font); label.addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent e) { if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit) { e.detail= SWT.TRAVERSE_NONE; fFilter.setFocus(); } } }); GridData gd= new GridData(GridData.FILL_HORIZONTAL); label.setLayoutData(gd); createViewMenu(header); return header; }
Example 4
Source File: CommandPage.java From EasyShell with Eclipse Public License 2.0 | 6 votes |
private void createButtons(Composite pageComponent) { Font font = pageComponent.getFont(); // button pageComponent Composite groupComponent = new Composite(pageComponent, SWT.NULL); GridLayout groupLayout = new GridLayout(); groupLayout.marginWidth = 0; groupLayout.marginHeight = 0; groupComponent.setLayout(groupLayout); GridData gridData = new GridData(); gridData.verticalAlignment = GridData.FILL; gridData.horizontalAlignment = GridData.FILL; groupComponent.setLayoutData(gridData); groupComponent.setFont(font); // buttons createNewButton(font, gridData, groupComponent); createEditButton(font, gridData, groupComponent); createCopyButton(font, gridData, groupComponent); createRemoveButton(font, gridData, groupComponent); }
Example 5
Source File: HistoryListAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override protected Control createDialogArea(Composite parent) { initializeDialogUnits(parent); Composite composite= (Composite) super.createDialogArea(parent); Composite inner= new Composite(composite, SWT.NONE); inner.setFont(parent.getFont()); inner.setLayoutData(new GridData(GridData.FILL_BOTH)); LayoutUtil.doDefaultLayout(inner, new DialogField[] { fHistoryList }, true, 0, 0); LayoutUtil.setHeightHint(fHistoryList.getListControl(null), convertHeightInCharsToPixels(12)); LayoutUtil.setHorizontalGrabbing(fHistoryList.getListControl(null)); applyDialogFont(composite); return composite; }
Example 6
Source File: LauncherTabSettings.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
@Override public void createControl(Composite parent) { Font font = parent.getFont(); Composite comp = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(1, true); comp.setLayout(layout); comp.setFont(font); GridData gd = new GridData(GridData.FILL_BOTH); comp.setLayoutData(gd); setControl(comp); argsSimulator = new ArgumentsBlock(Messages.LauncherTabSettings_SimulatorArgs+':'); argsDebugger = new ArgumentsBlock(Messages.LauncherTabSettings_DebuggerArgs+':'); argsSimulator.createControl(comp); argsDebugger.createControl(comp); }
Example 7
Source File: SelectionStatusDialog.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
protected Control createButtonBar(Composite parent) { Font font = parent.getFont(); Composite composite = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); if (!fStatusLineAboveButtons) { layout.numColumns = 2; } layout.marginHeight = 0; layout.marginLeft = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginWidth = 0; composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); composite.setFont(font); if (!fStatusLineAboveButtons && isHelpAvailable()) { createHelpControl(composite); } fStatusLine = new MessageLine(composite); fStatusLine.setAlignment(SWT.LEFT); GridData statusData = new GridData(GridData.FILL_HORIZONTAL); fStatusLine.setErrorStatus(null); fStatusLine.setFont(font); if (fStatusLineAboveButtons && isHelpAvailable()) { statusData.horizontalSpan = 2; createHelpControl(composite); } fStatusLine.setLayoutData(statusData); /* * Create the rest of the button bar, but tell it not to * create a help button (we've already created it). */ boolean helpAvailable = isHelpAvailable(); setHelpAvailable(false); super.createButtonBar(composite); setHelpAvailable(helpAvailable); return composite; }
Example 8
Source File: ScrolledPageContent.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public ScrolledPageContent(Composite parent, int style) { super(parent, style); setFont(parent.getFont()); toolkit = getFormToolkit(); setExpandHorizontal(true); setExpandVertical(true); Composite body = new Composite(this, SWT.NONE); body.setFont(parent.getFont()); setContent(body); }
Example 9
Source File: ScrolledPageContent.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
public ScrolledPageContent(Composite parent, int style) { super(parent, style); setExpandHorizontal(true); setExpandVertical(true); Composite body = new Composite(this, SWT.NONE); body.setFont(parent.getFont()); setContent(body); }
Example 10
Source File: SelectLanguageConfigurationWizardPage.java From tm4e with Eclipse Public License 1.0 | 5 votes |
@Override public final void createControl(Composite parent) { initializeDialogUnits(parent); Composite topLevel = new Composite(parent, SWT.NONE); topLevel.setLayout(new GridLayout()); topLevel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL)); topLevel.setFont(parent.getFont()); createBody(topLevel); setPageComplete(false); setControl(topLevel); }
Example 11
Source File: SWTFactory.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
/** * Creates a Composite widget * @param parent the parent composite to add this composite to * @param font the font to set on the control * @param columns the number of columns within the composite * @param hspan the horizontal span the composite should take up on the parent * @param fill the style for how this composite should fill into its parent * @return the new group */ public static Composite createComposite(Composite parent, Font font, int columns, int hspan, int fill) { Composite g = new Composite(parent, SWT.NONE); g.setLayout(new GridLayout(columns, false)); g.setFont(font); GridData gd = new GridData(fill); gd.horizontalSpan = hspan; g.setLayoutData(gd); return g; }
Example 12
Source File: SpecProcessPage.java From n4js with Eclipse Public License 1.0 | 5 votes |
private void createErrorGroup(Composite parent) { Composite errorGroup = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 1; errorGroup.setLayout(layout); errorGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); errorGroup.setFont(parent.getFont()); errorText = new StyledText(errorGroup, SWT.READ_ONLY | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); errorText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); }
Example 13
Source File: CommandDataDialog.java From EasyShell with Eclipse Public License 2.0 | 5 votes |
public Composite createPageComponent(Composite parent) { Font font = parent.getFont(); Composite pageComponent = new Composite(parent,SWT.NULL); GridLayout layout0 = new GridLayout(); layout0.numColumns = 1; layout0.makeColumnsEqualWidth = false; layout0.marginWidth = 5; layout0.marginHeight = 4; pageComponent.setLayout(layout0); GridData data0 = new GridData(GridData.FILL_HORIZONTAL); data0.widthHint = 640; pageComponent.setLayoutData(data0); pageComponent.setFont(font); return pageComponent; }
Example 14
Source File: UserLibraryPreferencePage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@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; }
Example 15
Source File: SdkClasspathContainerPage.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 4 votes |
public final void createControl(Composite parent) { Composite panel = new Composite(parent, SWT.NONE); final GridLayout gridLayout = new GridLayout(); gridLayout.marginWidth = 10; gridLayout.marginHeight = 10; panel.setLayout(gridLayout); panel.setFont(parent.getFont()); panel.setLayoutData(new GridData(GridData.FILL_BOTH)); Group group = SWTFactory.createGroup(panel, this.getTitle(), 1, 1, GridData.FILL_HORIZONTAL); sdkSelectionBlock = new ClasspathContainerPageSdkSelectionBlock<T>(group, SWT.NONE) { @Override protected void doConfigure() { if (Window.OK == PreferencesUtil.createPreferenceDialogOn(getShell(), sdkPreferencePageID, new String[] {sdkPreferencePageID}, null).open()) { SdkClasspathContainerPage.this.validateJavaProjectAndSelectedSdk(); } } @Override protected T doGetDefaultSdk() { return sdkManager.findSdkForPath(SdkClasspathContainer.computeDefaultContainerPath(containerID)); } @Override protected List<T> doGetSpecificSdks() { return new ArrayList<T>(sdkManager.getSdks()); } }; sdkSelectionBlock.addSdkSelectionListener(new SdkSelectionBlock.SdkSelectionListener() { public void onSdkSelection(SdkSelectionEvent e) { validateJavaProjectAndSelectedSdk(); } }); setControl(panel); // Need to set the title and message from here to correctly initialize setTitle(getTitle()); setMessage("Select an SDK to add to the classpath."); int selection = -1; if (containerEntry != null && !SdkClasspathContainer.isDefaultContainerPath(containerID, containerEntry.getPath())) { T sdkForPath = sdkManager.findSdkForPath(containerEntry.getPath()); if (sdkForPath != null) { selection = new ArrayList<T>(sdkManager.getSdks()).indexOf(sdkForPath); } } sdkSelectionBlock.setSelection(selection); }
Example 16
Source File: AbstractSearchIndexPage.java From Pydev with Eclipse Public License 1.0 | 4 votes |
@Override public void createControl(Composite parent) { initializeDialogUnits(parent); searchIndexDataHistory.readConfiguration(); Composite composite = new Composite(parent, SWT.NONE); composite.setFont(parent.getFont()); GridLayout layout = new GridLayout(10, false); composite.setLayout(layout); // Line 1 createLabel(composite, SWT.LEAD, "&Text (* = any string, ? = any character, \\\\ = escape).", 10); createComponents(composite); if (fSelectProjects != null && fProjectNames != null) { fSelectProjects.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Shell activeShell = Display.getCurrent().getActiveShell(); ProjectSelectionDialog dialog = new ProjectSelectionDialog(activeShell, null, true); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); String text = fProjectNames.getText(); ArrayList<Object> lst = new ArrayList<>(); for (String s : StringUtils.split(text, ',')) { s = s.trim(); IProject project = root.getProject(s); if (project != null && project.exists() && project.isAccessible()) { lst.add(project); } } dialog.setInitialElementSelections(lst); int open = dialog.open(); if (open == Window.OK) { Object[] result = dialog.getResult(); if (result != null) { FastStringBuffer buf = new FastStringBuffer(); for (Object object : result) { if (object instanceof IProject) { if (buf.length() > 0) { buf.append(", "); } buf.append(((IProject) object).getName()); } } fProjectNames.setText(buf.toString()); setRadioSelection(fProjectsScopeRadio); } } } }); } setControl(composite); Dialog.applyDialogFont(composite); }
Example 17
Source File: PythonBreakpointPage.java From Pydev with Eclipse Public License 1.0 | 4 votes |
/** * Creates the controls that allow the user to specify the breakpoint's * condition * @param parent the composite in which the condition editor should be created * @throws CoreException if an exception occurs accessing the breakpoint */ private void createConditionEditor(Composite parent) throws CoreException { PyBreakpoint breakpoint = getBreakpoint(); String label = null; ICommandManager commandManager = PlatformUI.getWorkbench().getCommandSupport().getCommandManager(); ICommand command = commandManager.getCommand("org.eclipse.ui.edit.text.contentAssist.proposals"); //$NON-NLS-1$ if (command != null) { List keyBindings = command.getKeySequenceBindings(); if (keyBindings != null && keyBindings.size() > 0) { IKeySequenceBinding binding = (IKeySequenceBinding) keyBindings.get(0); label = StringUtils.format("E&nable Condition %s", binding.getKeySequence().format()); //$NON-NLS-1$ } } if (label == null) { label = "E&nable Condition (code assist not available)"; //$NON-NLS-1$ } Composite conditionComposite = new Group(parent, SWT.NONE); conditionComposite.setFont(parent.getFont()); conditionComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); conditionComposite.setLayout(new GridLayout()); fEnableConditionButton = createCheckButton(conditionComposite, label); fEnableConditionButton.setSelection(breakpoint.isConditionEnabled()); fEnableConditionButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setConditionEnabled(fEnableConditionButton.getSelection()); } }); fConditionEditor = new BreakpointConditionEditor(conditionComposite, this); //fSuspendWhenLabel= createLabel(conditionComposite, "Suspend when:"); //fConditionIsTrue= createRadioButton(conditionComposite, "condition is \'tr&ue\'"); //fConditionIsTrue= createLabel(conditionComposite, "condition is \'tr&ue\'"); //fConditionHasChanged= createRadioButton(conditionComposite, "value of condition ch&anges"); // if (breakpoint.isConditionSuspendOnTrue()) { // fConditionIsTrue.setSelection(true); // } else { // fConditionHasChanged.setSelection(true); // } setConditionEnabled(fEnableConditionButton.getSelection()); }
Example 18
Source File: SrxMapRulesManageDialog.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
@Override protected Control createButtonBar(Composite parent) { Composite buttonCmp = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.makeColumnsEqualWidth = false; layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); buttonCmp.setLayout(layout); GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); buttonCmp.setLayoutData(data); buttonCmp.setFont(parent.getFont()); Composite leftCmp = new Composite(buttonCmp, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(leftCmp); GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(3).equalWidth(false).applyTo(leftCmp); addBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, Messages.getString("srx.SrxMapRulesManageDialog.addBtn"), false); editBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, Messages.getString("srx.SrxMapRulesManageDialog.editBtn"), false); deleteBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, Messages.getString("srx.SrxMapRulesManageDialog.deleteBtn"), false); Composite rightCmp = new Composite(buttonCmp, SWT.NONE); GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(1).equalWidth(false).applyTo(rightCmp); new Label(rightCmp, SWT.NONE); Label separatorLbl = new Label(buttonCmp, SWT.HORIZONTAL | SWT.SEPARATOR); GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(separatorLbl); new Label(buttonCmp, SWT.NONE); Composite bottomCmp = new Composite(buttonCmp, SWT.NONE); GridDataFactory.fillDefaults().grab(false, false).applyTo(bottomCmp); GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(2).applyTo(bottomCmp); createButton(bottomCmp, IDialogConstants.OK_ID, Messages.getString("srx.SrxMapRulesManageDialog.ok"), false); createButton(bottomCmp, IDialogConstants.CANCEL_ID, Messages.getString("srx.SrxMapRulesManageDialog.cancel"), true).setFocus(); initListener(); return buttonCmp; }
Example 19
Source File: ImportOrganizeConfigurationBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override protected Control createContents(Composite parent) { setShell(parent.getShell()); fPixelConverter= new PixelConverter(parent); 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); fOrderListField.doFillIntoGrid(composite, 3); LayoutUtil.setHorizontalSpan(fOrderListField.getLabelControl(null), 2); LayoutUtil.setWidthHint(fOrderListField.getLabelControl(null), fPixelConverter.convertWidthInCharsToPixels(60)); LayoutUtil.setHorizontalGrabbing(fOrderListField.getListControl(null)); Composite importExportComp= new Composite(composite, SWT.NONE); importExportComp.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1)); layout= new GridLayout(); layout.numColumns= 2; layout.marginWidth= 0; layout.marginHeight= 0; importExportComp.setLayout(layout); fImportButton.doFillIntoGrid(importExportComp, 1); fExportButton.doFillIntoGrid(importExportComp, 1); fThresholdField.doFillIntoGrid(composite, 2); ((GridData) fThresholdField.getTextControl(null).getLayoutData()).grabExcessHorizontalSpace= false; fStaticThresholdField.doFillIntoGrid(composite, 2); fIgnoreLowerCaseTypesField.doFillIntoGrid(composite, 2); Dialog.applyDialogFont(composite); return composite; }
Example 20
Source File: NewClassWizardPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 3 votes |
public void createControl(Composite parent) { initializeDialogUnits(parent); Composite composite= new Composite(parent, SWT.NONE); composite.setFont(parent.getFont()); int nColumns= 4; GridLayout layout= new GridLayout(); layout.numColumns= nColumns; composite.setLayout(layout); // pick & choose the wanted UI components createContainerControls(composite, nColumns); createPackageControls(composite, nColumns); createEnclosingTypeControls(composite, nColumns); createSeparator(composite, nColumns); createTypeNameControls(composite, nColumns); createModifierControls(composite, nColumns); createSuperClassControls(composite, nColumns); createSuperInterfacesControls(composite, nColumns); createMethodStubSelectionControls(composite, nColumns); createCommentControls(composite, nColumns); enableCommentControl(true); setControl(composite); Dialog.applyDialogFont(composite); PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJavaHelpContextIds.NEW_CLASS_WIZARD_PAGE); }