Java Code Examples for org.eclipse.swt.custom.StyledText#setBottomMargin()
The following examples show how to use
org.eclipse.swt.custom.StyledText#setBottomMargin() .
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: StyledTextCellEditor.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * 初始化默认颜色、字体等 * @param textControl * ; */ private void initStyle(final StyledText textControl, IStyle cellStyle) { // textControl.setBackground(cellStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR)); textControl.setBackground(GUIHelper.getColor(210, 210, 240)); textControl.setForeground(cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR)); textControl.setLineSpacing(Constants.SEGMENT_LINE_SPACING); textControl.setLeftMargin(Constants.SEGMENT_LEFT_MARGIN); textControl.setRightMargin(Constants.SEGMENT_RIGHT_MARGIN); textControl.setTopMargin(Constants.SEGMENT_TOP_MARGIN); textControl.setBottomMargin(Constants.SEGMENT_TOP_MARGIN); // textControl.setLeftMargin(0); // textControl.setRightMargin(0); // textControl.setTopMargin(0); // textControl.setBottomMargin(0); textControl.setFont(JFaceResources.getFont(net.heartsome.cat.ts.ui.Constants.XLIFF_EDITOR_TEXT_FONT)); textControl.setIME(new IME(textControl, SWT.NONE)); }
Example 2
Source File: CellEditor.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
@Override protected Control activateCell(Composite parent, Object originalCanonicalValue, Character initialEditValue) { if (originalCanonicalValue == null || !(originalCanonicalValue instanceof CellEditorCanonicalValue)) { return null; } StyledText textControl = createTextControl(parent); // init style IStyle cellStyle = getCellStyle(); textControl.setBackground(GUIHelper.getColor(210, 210, 240)); textControl.setForeground(cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR)); //textControl.setFont(cellStyle.getAttributeValue(CellStyleAttributes.FONT)); textControl.setLineSpacing(TmxEditorConstanst.SEGMENT_LINE_SPACING); textControl.setLeftMargin(TmxEditorConstanst.SEGMENT_LEFT_MARGIN); textControl.setRightMargin(TmxEditorConstanst.SEGMENT_RIGHT_MARGIN); textControl.setTopMargin(TmxEditorConstanst.SEGMENT_TOP_MARGIN); textControl.setBottomMargin(TmxEditorConstanst.SEGMENT_TOP_MARGIN); textControl.setIME(new IME(textControl, SWT.NONE)); setCanonicalValue(originalCanonicalValue); textControl.forceFocus(); return textControl; }
Example 3
Source File: StyledTextCellEditor.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * 初始化默认颜色、字体等 * @param textControl * ; */ private void initStyle(final StyledText textControl, IStyle cellStyle) { // textControl.setBackground(cellStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR)); textControl.setBackground(GUIHelper.getColor(210, 210, 240)); textControl.setForeground(cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR)); textControl.setLineSpacing(Constants.SEGMENT_LINE_SPACING); textControl.setLeftMargin(Constants.SEGMENT_LEFT_MARGIN); textControl.setRightMargin(Constants.SEGMENT_RIGHT_MARGIN); textControl.setTopMargin(Constants.SEGMENT_TOP_MARGIN); textControl.setBottomMargin(Constants.SEGMENT_TOP_MARGIN); // textControl.setLeftMargin(0); // textControl.setRightMargin(0); // textControl.setTopMargin(0); // textControl.setBottomMargin(0); textControl.setFont(JFaceResources.getFont(net.heartsome.cat.ts.ui.Constants.XLIFF_EDITOR_TEXT_FONT)); textControl.setIME(new IME(textControl, SWT.NONE)); }
Example 4
Source File: TmMatchEditDialog.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
/** * Create contents of the dialog. * @param parent */ @Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); container.setLayout(new GridLayout(1, false)); Group srcGroup = new Group(container, SWT.NONE); srcGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); srcGroup.setLayout(new GridLayout(1, false)); String srcGroupTile = Messages.getString("dialog.TmMatchEditDialog.component.src"); srcGroupTile = MessageFormat.format(srcGroupTile, fuzzyResult.getTu().getSource().getLangCode()); srcGroup.setText(srcGroupTile); srcSegmentViewer = new SegmentViewer(srcGroup, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL, null); StyledText srcTextControl = srcSegmentViewer.getTextWidget(); srcTextControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); srcTextControl.setLineSpacing(Constants.SEGMENT_LINE_SPACING); srcTextControl.setLeftMargin(Constants.SEGMENT_LEFT_MARGIN); srcTextControl.setRightMargin(Constants.SEGMENT_RIGHT_MARGIN); srcTextControl.setTopMargin(Constants.SEGMENT_TOP_MARGIN); srcTextControl.setBottomMargin(Constants.SEGMENT_TOP_MARGIN); srcTextControl.setFont(JFaceResources.getFont(Constants.MATCH_VIEWER_TEXT_FONT)); Group targetGroup = new Group(container, SWT.NONE); targetGroup.setLayout(new GridLayout(1, false)); targetGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); String tgtGroupTile = Messages.getString("dialog.TmMatchEditDialog.component.tgt"); tgtGroupTile = MessageFormat.format(tgtGroupTile, fuzzyResult.getTu().getSource().getLangCode()); targetGroup.setText(tgtGroupTile); tgtSegmentViewer = new SegmentViewer(targetGroup, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL, null); StyledText tgtTextControl = tgtSegmentViewer.getTextWidget(); tgtTextControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); tgtTextControl.setLineSpacing(Constants.SEGMENT_LINE_SPACING); tgtTextControl.setLeftMargin(Constants.SEGMENT_LEFT_MARGIN); tgtTextControl.setRightMargin(Constants.SEGMENT_RIGHT_MARGIN); tgtTextControl.setTopMargin(Constants.SEGMENT_TOP_MARGIN); tgtTextControl.setBottomMargin(Constants.SEGMENT_TOP_MARGIN); tgtTextControl.setFont(JFaceResources.getFont(Constants.MATCH_VIEWER_TEXT_FONT)); net.heartsome.cat.ts.ui.innertag.tagstyle.TagStyleConfigurator.configure(srcSegmentViewer); net.heartsome.cat.ts.ui.innertag.tagstyle.TagStyleConfigurator.configure(tgtSegmentViewer); TmMatchEditorBodyMenu srcMenu = new TmMatchEditorBodyMenu(srcSegmentViewer); srcSegmentViewer.getTextWidget().setMenu(srcMenu.getBodyMenu()); TmMatchEditorBodyMenu tgtMenu = new TmMatchEditorBodyMenu(tgtSegmentViewer); tgtSegmentViewer.getTextWidget().setMenu(tgtMenu.getBodyMenu()); loadData(); return container; }
Example 5
Source File: TmMatchEditDialog.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
/** * Create contents of the dialog. * @param parent */ @Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); container.setLayout(new GridLayout(1, false)); Group srcGroup = new Group(container, SWT.NONE); srcGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); srcGroup.setLayout(new GridLayout(1, false)); String srcGroupTile = Messages.getString("dialog.TmMatchEditDialog.component.src"); srcGroupTile = MessageFormat.format(srcGroupTile, fuzzyResult.getTu().getSource().getLangCode()); srcGroup.setText(srcGroupTile); srcSegmentViewer = new SegmentViewer(srcGroup, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL, null); StyledText srcTextControl = srcSegmentViewer.getTextWidget(); srcTextControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); srcTextControl.setLineSpacing(Constants.SEGMENT_LINE_SPACING); srcTextControl.setLeftMargin(Constants.SEGMENT_LEFT_MARGIN); srcTextControl.setRightMargin(Constants.SEGMENT_RIGHT_MARGIN); srcTextControl.setTopMargin(Constants.SEGMENT_TOP_MARGIN); srcTextControl.setBottomMargin(Constants.SEGMENT_TOP_MARGIN); srcTextControl.setFont(JFaceResources.getFont(Constants.MATCH_VIEWER_TEXT_FONT)); Group targetGroup = new Group(container, SWT.NONE); targetGroup.setLayout(new GridLayout(1, false)); targetGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); String tgtGroupTile = Messages.getString("dialog.TmMatchEditDialog.component.tgt"); tgtGroupTile = MessageFormat.format(tgtGroupTile, fuzzyResult.getTu().getSource().getLangCode()); targetGroup.setText(tgtGroupTile); tgtSegmentViewer = new SegmentViewer(targetGroup, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL, null); StyledText tgtTextControl = tgtSegmentViewer.getTextWidget(); tgtTextControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); tgtTextControl.setLineSpacing(Constants.SEGMENT_LINE_SPACING); tgtTextControl.setLeftMargin(Constants.SEGMENT_LEFT_MARGIN); tgtTextControl.setRightMargin(Constants.SEGMENT_RIGHT_MARGIN); tgtTextControl.setTopMargin(Constants.SEGMENT_TOP_MARGIN); tgtTextControl.setBottomMargin(Constants.SEGMENT_TOP_MARGIN); tgtTextControl.setFont(JFaceResources.getFont(Constants.MATCH_VIEWER_TEXT_FONT)); net.heartsome.cat.ts.ui.innertag.tagstyle.TagStyleConfigurator.configure(srcSegmentViewer); net.heartsome.cat.ts.ui.innertag.tagstyle.TagStyleConfigurator.configure(tgtSegmentViewer); TmMatchEditorBodyMenu srcMenu = new TmMatchEditorBodyMenu(srcSegmentViewer); srcSegmentViewer.getTextWidget().setMenu(srcMenu.getBodyMenu()); TmMatchEditorBodyMenu tgtMenu = new TmMatchEditorBodyMenu(tgtSegmentViewer); tgtSegmentViewer.getTextWidget().setMenu(tgtMenu.getBodyMenu()); loadData(); return container; }