org.eclipse.ui.editors.text.TextEditor Java Examples

The following examples show how to use org.eclipse.ui.editors.text.TextEditor. 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 vote down vote up
@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 vote down vote up
@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 vote down vote up
@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);
}
 
Example #4
Source File: OpenAction.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Note: This constructor is for internal use only. Clients should not call this constructor.
 * @param editor the Java editor
 *
 * @noreference This constructor is not intended to be referenced by clients.
 */
public OpenAction(TextEditor editor) {
	this(editor.getEditorSite());
	fEditor= editor;
	setText(Messages.OpenAction_Open);
	setEnabled(CoreEditorUtils.getEditorInputXdsElement(fEditor) != null);
}
 
Example #5
Source File: OpenEditorActionGroup.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
public OpenEditorActionGroup(TextEditor editor) {
	fIsEditorOwner= true;
	fOpen= new OpenAction(editor);
	editor.setAction("OpenEditor", fOpen); //$NON-NLS-1$
	fSite= editor.getEditorSite();
	fSelectionProvider= fSite.getSelectionProvider();
	initialize();
}
 
Example #6
Source File: ManifestMultiPageEditor.java    From XPagesExtensionLibrary with Apache License 2.0 4 votes vote down vote up
public TextEditor getSrcEditor() {
    return _srcEditor;
}
 
Example #7
Source File: ReportXMLSourceEditorFormPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected TextEditor getTextEditor( )
{
	return reportXMLEditor;
}
 
Example #8
Source File: TextEditorPerspectiveFactory.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public boolean isRelevantFor(final IEditorPart part) {
    return !(part instanceof MarkdownEditor) && (part instanceof TextEditor || part instanceof WebBrowserEditor)
            && !isInsideprojectWithREStApiExtensionNature(part);
}
 
Example #9
Source File: EditorRefreshActionDelegate.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void setActiveEditor(IAction action, IEditorPart targetEditor) {
	if(targetEditor instanceof TextEditor){
		this.editor = (TextEditor) targetEditor ;
	}
}
 
Example #10
Source File: IRulerPainter.java    From xds-ide with Eclipse Public License 1.0 votes vote down vote up
void setTextEditor(TextEditor editor);