Java Code Examples for org.eclipse.ui.editors.text.TextEditor#getAdapter()
The following examples show how to use
org.eclipse.ui.editors.text.TextEditor#getAdapter() .
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: TestSyntaxHighlighting.java From aCute with Eclipse Public License 2.0 | 5 votes |
@Test public void testSyntaxHighlighting() throws Exception { IFile csharpSourceFile = getProject("csproj").getFile("Program.cs"); TextEditor editor = (TextEditor) IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), csharpSourceFile, "org.eclipse.ui.genericeditor.GenericEditor"); StyledText editorTextWidget = (StyledText)editor.getAdapter(Control.class); new DisplayHelper() { @Override protected boolean condition() { return editorTextWidget.getStyleRanges().length > 1; } }.waitForCondition(editorTextWidget.getDisplay(), 4000); Assert.assertTrue("There should be multiple styles in editor", editorTextWidget.getStyleRanges().length > 1); }
Example 2
Source File: TestSyntaxHighlighting.java From corrosion with Eclipse Public License 2.0 | 5 votes |
@Test public void testRustSyntaxHighlighting() throws CoreException, IOException { IFile rustFile = getProject(BASIC_PROJECT_NAME).getFolder("src").getFile("main.rs"); TextEditor editor = (TextEditor) IDE.openEditor( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), rustFile, "org.eclipse.ui.genericeditor.GenericEditor"); StyledText editorTextWidget = (StyledText) editor.getAdapter(Control.class); new DisplayHelper() { @Override protected boolean condition() { return editorTextWidget.getStyleRanges().length > 1; } }.waitForCondition(editorTextWidget.getDisplay(), 4000); Assert.assertTrue("There should be multiple styles in editor", editorTextWidget.getStyleRanges().length > 1); }
Example 3
Source File: TestSyntaxHighlighting.java From corrosion with Eclipse Public License 2.0 | 5 votes |
@Test public void testManifestSyntaxHighlighting() throws CoreException, IOException { IFile rustFile = getProject(BASIC_PROJECT_NAME).getFile("Cargo.toml"); TextEditor editor = (TextEditor) IDE.openEditor( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), rustFile, "org.eclipse.ui.genericeditor.GenericEditor"); StyledText editorTextWidget = (StyledText) editor.getAdapter(Control.class); new DisplayHelper() { @Override protected boolean condition() { return editorTextWidget.getStyleRanges().length > 1; } }.waitForCondition(editorTextWidget.getDisplay(), 4000); Assert.assertTrue("There should be multiple styles in editor", editorTextWidget.getStyleRanges().length > 1); }