Java Code Examples for org.eclipse.swt.custom.StyledText#setLeftMargin()
The following examples show how to use
org.eclipse.swt.custom.StyledText#setLeftMargin() .
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: SuffixText.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * Creates, configures and returns the suffix text control. */ private StyledText createSuffixText() { StyledText styledText = new StyledText(this, SWT.TRANSPARENT); styledText.setText(""); styledText.setForeground(INACTIVE_COLOR); styledText.setBackground(getDisplay().getSystemColor(SWT.COLOR_TRANSPARENT)); styledText.setEditable(false); styledText.setEnabled(false); styledText.setLeftMargin(0); return styledText; }
Example 5
Source File: BaseSourceViewer.java From Pydev with Eclipse Public License 1.0 | 5 votes |
public BaseSourceViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler, boolean showAnnotationsOverview, int styles, IVerticalIndentGuidePreferencesProvider verticalIndentPrefs) { super(parent, verticalRuler, overviewRuler, showAnnotationsOverview, styles); verticalLinesPainter = new VerticalIndentGuidesPainter( getIndentGuide(verticalIndentPrefs)); StyledText styledText = this.getTextWidget(); verticalLinesPainter.setStyledText(styledText); styledText.addPaintListener(verticalLinesPainter); styledText.setLeftMargin(Math.max(styledText.getLeftMargin(), 2)); }
Example 6
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 7
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; }