[jira] [Assigned] (NETBEANS-5596) No syntax coloring with the Java Editor Kit

2022-02-11 Thread Nicolas Baumann (Jira)


 [ 
https://issues.apache.org/jira/browse/NETBEANS-5596?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nicolas Baumann reassigned NETBEANS-5596:
-

Assignee: Nicolas Baumann

> No syntax coloring with the Java Editor Kit
> ---
>
> Key: NETBEANS-5596
> URL: https://issues.apache.org/jira/browse/NETBEANS-5596
> Project: NetBeans
>  Issue Type: Bug
>  Components: java - Editor
>Affects Versions: 12.3
>Reporter: Nicolas Baumann
>Assignee: Nicolas Baumann
>Priority: Minor
>
> I think this is somewhere between a bug and an improvement request because I 
> have no doubt that syntax coloring works well inside the IDE but my issue 
> happens when I use the java editor as a dependency for a plain java 
> application rather than a netbeans platform application.
> I have to activate syntax coloring programatically with the line of code 
> below whereas it should be done automatically based on the mime type of the 
> editor which is text/x-java.
> {code:java}
> doc.putProperty(Language.class, JavaTokenId.language()){code}
> There are some cases where the editor is not accessible due to member 
> visibility, for example with the the DiffView from org-netbeans-modules-diff.
> Here is a mininal code sample to reproduce :
>  
> {code:java}
> final JFrame f = new JFrame("JAVA Syntax Coloring");
> final JEditorPane pane = new JEditorPane();
>  
> pane.setEditorKit(CloneableEditorSupport.getEditorKit(JavaKit.JAVA_MIME_TYPE));
>  //pane.getDocument().putProperty(Language.class, JavaTokenId.language()); // 
> activates syntax coloring
>  try {
>  SwingUtilities.invokeAndWait(() -> {
>  try {
>  pane.getDocument().insertString(0, "public class Hello {}", null);
>  } catch (final BadLocationException e) {
>  e.printStackTrace();
>  }
>  });
>  } catch (final Exception e) {
>  e.printStackTrace();
>  }
>  f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>  f.getContentPane().add(new JScrollPane(pane));
>  f.setSize(400, 300);
>  f.setVisible(true);
> {code}
>  
> From the javadoc :
> [https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-lexer/org/netbeans/api/lexer/TokenHierarchy.html#get-D-]
> _Get or create mutable token hierarchy for the given swing document._
>  _The document may define a top language by doing 
> {{doc.putProperty("mimeType", mimeType)}} (a language defined for the given 
> mime type will be searched and used) or by doing 
> {{putProperty(Language.class, language)}}. Otherwise the returned hierarchy 
> will be inactive and 
> [{{TokenHierarchy.tokenSequence()}}|https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-lexer/org/netbeans/api/lexer/TokenHierarchy.html#tokenSequence--]
>  will return null._
> In my case setting the mimeType property on the document was not enough to 
> activate the token hierarchy for syntax coloring. Only setting the 
> Language.class property resulted in activating it. But it's not possible with 
> an editor that I did not create myself and which I cannot have access to.
>  
> Suggestion :
> In the JavaKit class there is method createDefaultDocument() which creates a 
> default document. Is it possible for you to set the Langage.class property 
> here ?
>  
> Here is a workaround that I use to activate syntax coloring in the diff view.
> In the file org/netbeans/modules/java/editor/resources/layer.xml :
> {code:java}
> 
>  
>  {code}
>  
>  
> {code:java}
> public class SyntaxColoringJavaKit extends 
> org.netbeans.modules.editor.java.JavaKit {
> private static final long serialVersionUID = 1L;
>  @Override
>  public Document createDefaultDocument() {
>final Document document = super.createDefaultDocument();
>document.putProperty(Language.class, JavaTokenId.language());
>return document;
>  }
>  
> }
> {code}
>  
>  Below the maven dependencies that I use in this example :
> {code:java}
> 
>  
> org.netbeans.modules
> org-netbeans-modules-editor-mimelookup-impl 
> RELEASE123
>  
> 
> org.netbeans.modules
> org-netbeans-modules-editor-plain
> RELEASE123 
>  
> 
> org.netbeans.modules
> org-netbeans-modules-java-editor 
> RELEASE123  
>  
> org.frgaal
> compiler
> 14.0.0
> 
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



[jira] [Updated] (NETBEANS-5596) No syntax coloring with the Java Editor Kit

2021-04-18 Thread Nicolas Baumann (Jira)


 [ 
https://issues.apache.org/jira/browse/NETBEANS-5596?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nicolas Baumann updated NETBEANS-5596:
--
Description: 
I think this is somewhere between a bug and an improvement request because I 
have no doubt that syntax coloring works well inside the IDE but my issue 
happens when I use the java editor as a dependency for a plain java application 
rather than a netbeans platform application.

I have to activate syntax coloring programatically with the line of code below 
whereas it should be done automatically based on the mime type of the editor 
which is text/x-java.
{code:java}
doc.putProperty(Language.class, JavaTokenId.language()){code}
There are some cases where the editor is not accessible due to member 
visibility, for example with the the DiffView from org-netbeans-modules-diff.

Here is a mininal code sample to reproduce :

 
{code:java}
final JFrame f = new JFrame("JAVA Syntax Coloring");
final JEditorPane pane = new JEditorPane();
 pane.setEditorKit(CloneableEditorSupport.getEditorKit(JavaKit.JAVA_MIME_TYPE));
 //pane.getDocument().putProperty(Language.class, JavaTokenId.language()); // 
activates syntax coloring
 try {
 SwingUtilities.invokeAndWait(() -> {
 try {
 pane.getDocument().insertString(0, "public class Hello {}", null);
 } catch (final BadLocationException e) {
 e.printStackTrace();
 }
 });
 } catch (final Exception e) {
 e.printStackTrace();
 }
 f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 f.getContentPane().add(new JScrollPane(pane));
 f.setSize(400, 300);
 f.setVisible(true);
{code}
 

>From the javadoc :

[https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-lexer/org/netbeans/api/lexer/TokenHierarchy.html#get-D-]

_Get or create mutable token hierarchy for the given swing document._
 _The document may define a top language by doing {{doc.putProperty("mimeType", 
mimeType)}} (a language defined for the given mime type will be searched and 
used) or by doing {{putProperty(Language.class, language)}}. Otherwise the 
returned hierarchy will be inactive and 
[{{TokenHierarchy.tokenSequence()}}|https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-lexer/org/netbeans/api/lexer/TokenHierarchy.html#tokenSequence--]
 will return null._

In my case setting the mimeType property on the document was not enough to 
activate the token hierarchy for syntax coloring. Only setting the 
Language.class property resulted in activating it. But it's not possible with 
an editor that I did not create myself and which I cannot have access to.

 

Suggestion :

In the JavaKit class there is method createDefaultDocument() which creates a 
default document. Is it possible for you to set the Langage.class property here 
?

 

Here is a workaround that I use to activate syntax coloring in the diff view.

In the file org/netbeans/modules/java/editor/resources/layer.xml :
{code:java}

 
 {code}
 

 
{code:java}
public class SyntaxColoringJavaKit extends 
org.netbeans.modules.editor.java.JavaKit {
private static final long serialVersionUID = 1L;
 @Override
 public Document createDefaultDocument() {
   final Document document = super.createDefaultDocument();
   document.putProperty(Language.class, JavaTokenId.language());
   return document;
 }
 
}
{code}
 

 Below the maven dependencies that I use in this example :
{code:java}

 
org.netbeans.modules
org-netbeans-modules-editor-mimelookup-impl 
RELEASE123
 

org.netbeans.modules
org-netbeans-modules-editor-plain
RELEASE123 
 

org.netbeans.modules
org-netbeans-modules-java-editor 
RELEASE123  
 
org.frgaal
compiler
14.0.0

{code}

  was:
I think this is somewhere between a bug and an improvement request because I 
have no doubt that syntax coloring works well inside the IDE but my issue 
happens when I use the java editor as a dependency for a plain java application 
rather than a netbeans platform application.

I have to activate syntax coloring programatically with the line of code below 
whereas it should be done automatically based on the mime type of the editor 
which is text/x-java.
{code:java}
doc.putProperty(Language.class, JavaTokenId.language()){code}
There are some cases where the editor is not accessible due to member 
visibility, for example with the the DiffView from org-netbeans-modules-diff.

Here is a mininal code sample to reproduce :

 
{code:java}
final JFrame f = new JFrame("JAVA Syntax Coloring");
final JEditorPane pane = new JEditorPane();
 pane.setEditorKit(CloneableEditorSupport.getEditorKit(JavaKit.JAVA_MIME_TYPE));
 //pane.getDocument().putProperty(Language.class, JavaTokenId.language()); // 
activates syntax coloring
 try {
 SwingUtilities.invokeAndWait(() -> {
 try {
 pane.getDocument().insertString(0, "public class Hello {}", null);
 } catch (final BadLocationException e) {
 

[jira] [Updated] (NETBEANS-5596) No syntax coloring with the Java Editor Kit

2021-04-18 Thread Nicolas Baumann (Jira)


 [ 
https://issues.apache.org/jira/browse/NETBEANS-5596?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nicolas Baumann updated NETBEANS-5596:
--
Description: 
I think this is somewhere between a bug and an improvement request because I 
have no doubt that syntax coloring works well inside the IDE but my issue 
happens when I use the java editor as a dependency for a plain java application 
rather than a netbeans platform application.

I have to activate syntax coloring programatically with the line of code below 
whereas it should be done automatically based on the mime type of the editor 
which is text/x-java.
{code:java}
doc.putProperty(Language.class, JavaTokenId.language()){code}
There are some cases where the editor is not accessible due to member 
visibility, for example with the the DiffView from org-netbeans-modules-diff.

Here is a mininal code sample to reproduce :

 
{code:java}
final JFrame f = new JFrame("JAVA Syntax Coloring");
final JEditorPane pane = new JEditorPane();
 pane.setEditorKit(CloneableEditorSupport.getEditorKit(JavaKit.JAVA_MIME_TYPE));
 //pane.getDocument().putProperty(Language.class, JavaTokenId.language()); // 
activates syntax coloring
 try {
 SwingUtilities.invokeAndWait(() -> {
 try {
 pane.getDocument().insertString(0, "public class Hello {}", null);
 } catch (final BadLocationException e) {
 e.printStackTrace();
 }
 });
 } catch (final Exception e) {
 e.printStackTrace();
 }
 f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 f.getContentPane().add(new JScrollPane(pane));
 f.setSize(400, 300);
 f.setVisible(true);
{code}
 

>From the javadoc :

[https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-lexer/org/netbeans/api/lexer/TokenHierarchy.html#get-D-]

_Get or create mutable token hierarchy for the given swing document._
 _The document may define a top language by doing {{doc.putProperty("mimeType", 
mimeType)}} (a language defined for the given mime type will be searched and 
used) or by doing {{putProperty(Language.class, language)}}. Otherwise the 
returned hierarchy will be inactive and 
[{{TokenHierarchy.tokenSequence()}}|https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-lexer/org/netbeans/api/lexer/TokenHierarchy.html#tokenSequence--]
 will return null._

In my case setting the mimeType property on the document was not enough to 
activate the token hierarchy for syntax coloring. Only setting the 
Language.class property resulted in activating it. But it's not possible with 
an editor that I did not create myself and which I cannot have access to.

 

Suggestion :

In the JavaKit class there is method createDefaultDocument() which creates a 
default document. Is it possible for you to set the Langage.class property here 
?

 

Here is a workaround that I use to activate syntax coloring in the diff view.

In the file org/netbeans/modules/java/editor/resources/layer.xml :
{code:java}

 
 {code}
 

 
{code:java}
public class SyntaxColoringJavaKit extends 
org.netbeans.modules.editor.java.JavaKit {
private static final long serialVersionUID = 1L;
 @Override
 public Document createDefaultDocument() {
   final Document document = super.createDefaultDocument();
   document.putProperty(Language.class, JavaTokenId.language());
   return document;
 }
 
}
{code}
 

 Below the maven dependencies that I use in this example :

 
{code:java}
  org.netbeans.modules 
org-netbeans-modules-editor-mimelookup-impl 
${netbeans.version}   
org.netbeans.modules 
org-netbeans-modules-editor-plain 
${netbeans.version}   
org.netbeans.modules 
org-netbeans-modules-java-editor 
${netbeans.version}   
org.frgaal compiler 
14.0.0  
{code}
 

 

  was:
I think this is somewhere between a bug and an improvement request because I 
have no doubt that syntax coloring works well inside the IDE but my issue 
happens when I use the java editor as a dependency for a plain java application 
rather than a netbeans platform application.

I have to activate syntax coloring programatically with the line of code below 
whereas it should be done automatically based on the mime type of the editor 
which is text/x-java.
{code:java}
doc.putProperty(Language.class, JavaTokenId.language()){code}
There are some cases where the editor is not accessible due to member 
visibility, for example with the the DiffView from org-netbeans-modules-diff.

Here is a mininal code sample to reproduce :

 
{code:java}
final JFrame f = new JFrame("JAVA Syntax Coloring");
final JEditorPane pane = new JEditorPane();
 pane.setEditorKit(CloneableEditorSupport.getEditorKit(JavaKit.JAVA_MIME_TYPE));
 //pane.getDocument().putProperty(Language.class, JavaTokenId.language()); // 
activates syntax coloring
 try {
 SwingUtilities.invokeAndWait(() -> {
 try {
 pane.getDocument().insertString(0, "public class Hello {}", null);
 } catch (final BadLocationException e) {
 e.printStackTrace();
 }
 });
 } catch (final Exception e) {
 e.printStackTrace();
 }
 

[jira] [Updated] (NETBEANS-5596) No syntax coloring with the Java Editor Kit

2021-04-18 Thread Nicolas Baumann (Jira)


 [ 
https://issues.apache.org/jira/browse/NETBEANS-5596?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nicolas Baumann updated NETBEANS-5596:
--
Description: 
I think this is somewhere between a bug and an improvement request because I 
have no doubt that syntax coloring works well inside the IDE but my issue 
happens when I use the java editor as a dependency for a plain java application 
rather than a netbeans platform application.

I have to activate syntax coloring programatically with the line of code below 
whereas it should be done automatically based on the mime type of the editor 
which is text/x-java.
{code:java}
doc.putProperty(Language.class, JavaTokenId.language()){code}
There are some cases where the editor is not accessible due to member 
visibility, for example with the the DiffView from org-netbeans-modules-diff.

Here is a mininal code sample to reproduce :

 
{code:java}
final JFrame f = new JFrame("JAVA Syntax Coloring");
final JEditorPane pane = new JEditorPane();
 pane.setEditorKit(CloneableEditorSupport.getEditorKit(JavaKit.JAVA_MIME_TYPE));
 //pane.getDocument().putProperty(Language.class, JavaTokenId.language()); // 
activates syntax coloring
 try {
 SwingUtilities.invokeAndWait(() -> {
 try {
 pane.getDocument().insertString(0, "public class Hello {}", null);
 } catch (final BadLocationException e) {
 e.printStackTrace();
 }
 });
 } catch (final Exception e) {
 e.printStackTrace();
 }
 f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 f.getContentPane().add(new JScrollPane(pane));
 f.setSize(400, 300);
 f.setVisible(true);
{code}
 

>From the javadoc :

[https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-lexer/org/netbeans/api/lexer/TokenHierarchy.html#get-D-]

_Get or create mutable token hierarchy for the given swing document._
 _The document may define a top language by doing {{doc.putProperty("mimeType", 
mimeType)}} (a language defined for the given mime type will be searched and 
used) or by doing {{putProperty(Language.class, language)}}. Otherwise the 
returned hierarchy will be inactive and 
[{{TokenHierarchy.tokenSequence()}}|https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-lexer/org/netbeans/api/lexer/TokenHierarchy.html#tokenSequence--]
 will return null._

In my case setting the mimeType property on the document was not enough to 
activate the token hierarchy for syntax coloring. Only setting the 
Language.class property resulted in activating it. But it's not possible with 
an editor that I did not create myself and which I cannot have access to.

 

Suggestion :

In the JavaKit class there is method createDefaultDocument() which creates a 
default document. Is it possible for you to set the Langage.class property here 
?

 

Here is a workaround that I use to activate syntax coloring in the diff view.

In the file org/netbeans/modules/java/editor/resources/layer.xml :
{code:java}

 
 {code}
 

 
{code:java}
public class SyntaxColoringJavaKit extends 
org.netbeans.modules.editor.java.JavaKit {
private static final long serialVersionUID = 1L;
 @Override
 public Document createDefaultDocument() {
   final Document document = super.createDefaultDocument();
   document.putProperty(Language.class, JavaTokenId.language());
   return document;
 }
 
}
{code}
 

 Below the maven dependencies that I use in this example :

 
{code:java}
   
org.netbeans.modules 
org-netbeans-modules-editor-mimelookup-impl 
${netbeans.version}   
org.netbeans.modules 
org-netbeans-modules-editor-plain 
${netbeans.version}   
org.netbeans.modules 
org-netbeans-modules-java-editor 
${netbeans.version}   
org.frgaal compiler 
14.0.0  
{code}
 

 

  was:
I think this is somewhere between a bug and an improvement request because I 
have no doubt that syntax coloring works well inside the IDE but my issue 
happens when I use the java editor as a dependency for a plain java application 
rather than a netbeans platform application.

I have to activate syntax coloring programatically with the line of code below 
whereas it should be done automatically based on the mime type of the editor 
which is text/x-java.
{code:java}
doc.putProperty(Language.class, JavaTokenId.language()){code}
There are some cases where the editor is not accessible due to member 
visibility, for example with the the DiffView from org-netbeans-modules-diff.

Here is a mininal code sample to reproduce :

 
{code:java}
final JFrame f = new JFrame("JAVA Syntax Coloring");
final JEditorPane pane = new JEditorPane();
 pane.setEditorKit(CloneableEditorSupport.getEditorKit(JavaKit.JAVA_MIME_TYPE));
 //pane.getDocument().putProperty(Language.class, JavaTokenId.language()); // 
activates syntax coloring
 try {
 SwingUtilities.invokeAndWait(() -> {
 try {
 pane.getDocument().insertString(0, "public class Hello {}", null);
 } catch (final BadLocationException e) {
 e.printStackTrace();
 }
 });
 } catch (final Exception e) {
 e.printStackTrace();
 }
 

[jira] [Updated] (NETBEANS-5596) No syntax coloring with the Java Editor Kit

2021-04-18 Thread Nicolas Baumann (Jira)


 [ 
https://issues.apache.org/jira/browse/NETBEANS-5596?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nicolas Baumann updated NETBEANS-5596:
--
Description: 
I think this is somewhere between a bug and an improvement request because I 
have no doubt that syntax coloring works well inside the IDE but my issue 
happens when I use the java editor as a dependency for a plain java application 
rather than a netbeans platform application.

I have to activate syntax coloring programatically with the line of code below 
whereas it should be done automatically based on the mime type of the editor 
which is text/x-java.
{code:java}
doc.putProperty(Language.class, JavaTokenId.language()){code}
There are some cases where the editor is not accessible due to member 
visibility, for example with the the DiffView from org-netbeans-modules-diff.

Here is a mininal code sample to reproduce :

 
{code:java}
final JFrame f = new JFrame("JAVA Syntax Coloring");
final JEditorPane pane = new JEditorPane();
 pane.setEditorKit(CloneableEditorSupport.getEditorKit(JavaKit.JAVA_MIME_TYPE));
 //pane.getDocument().putProperty(Language.class, JavaTokenId.language()); // 
activates syntax coloring
 try {
 SwingUtilities.invokeAndWait(() -> {
 try {
 pane.getDocument().insertString(0, "public class Hello {}", null);
 } catch (final BadLocationException e) {
 e.printStackTrace();
 }
 });
 } catch (final Exception e) {
 e.printStackTrace();
 }
 f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 f.getContentPane().add(new JScrollPane(pane));
 f.setSize(400, 300);
 f.setVisible(true);
{code}
 

>From the javadoc :

[https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-lexer/org/netbeans/api/lexer/TokenHierarchy.html#get-D-]

_Get or create mutable token hierarchy for the given swing document._
 _The document may define a top language by doing {{doc.putProperty("mimeType", 
mimeType)}} (a language defined for the given mime type will be searched and 
used) or by doing {{putProperty(Language.class, language)}}. Otherwise the 
returned hierarchy will be inactive and 
[{{TokenHierarchy.tokenSequence()}}|https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-lexer/org/netbeans/api/lexer/TokenHierarchy.html#tokenSequence--]
 will return null._

In my case setting the mimeType property on the document was not enough to 
activate the token hierarchy for syntax coloring. Only setting the 
Language.class property resulted in activating it. But it's not possible with 
an editor that I did not create myself and which I cannot have access to.

 

Suggestion :

In the JavaKit class there is method createDefaultDocument() which creates a 
default document. Is it possible for you to set the Langage.class property here 
?

 

Here is a workaround that I use to activate syntax coloring in the diff view.

In the file org/netbeans/modules/java/editor/resources/layer.xml :
{code:java}

 
 {code}
 

 
{code:java}
public class SyntaxColoringJavaKit extends 
org.netbeans.modules.editor.java.JavaKit {
private static final long serialVersionUID = 1L;
 @Override
 public Document createDefaultDocument() {
   final Document document = super.createDefaultDocument();
   document.putProperty(Language.class, JavaTokenId.language());
   return document;
 }
 
}
{code}
 

 Below the maven dependencies that I use in this example :

 
{code:java}
 
log4j log4j 
1.2.14   
org.netbeans.api 
org-netbeans-modules-diff 
${netbeans.version}   
org.netbeans.modules 
org-netbeans-modules-editor-mimelookup-impl 
${netbeans.version}   
org.netbeans.modules 
org-netbeans-modules-editor-plain 
${netbeans.version}   
org.netbeans.modules 
org-netbeans-modules-java-editor 
${netbeans.version}   
org.frgaal compiler 
14.0.0
UTF-8 
1.8 
1.8 
RELEASE123 
github.com {code}
 

 

 

 

 

  was:
I think this is somewhere between a bug and an improvement request because I 
have no doubt that syntax coloring works well inside the IDE but my issue 
happens when I use the java editor as a dependency for a plain java application 
rather than a netbeans platform application.

I have to activate syntax coloring programatically with the line of code below 
whereas it should be done automatically based on the mime type of the editor 
which is text/x-java.
{code:java}
doc.putProperty(Language.class, JavaTokenId.language()){code}
There are some cases where the editor is not accessible due to member 
visibility, for example with the the DiffView from org-netbeans-modules-diff.

Here is a mininal code sample to reproduce :

 
{code:java}
final JFrame f = new JFrame("JAVA Syntax Coloring");
final JEditorPane pane = new JEditorPane();
 pane.setEditorKit(CloneableEditorSupport.getEditorKit(JavaKit.JAVA_MIME_TYPE));
 //pane.getDocument().putProperty(Language.class, JavaTokenId.language()); // 
activates syntax coloring
 try {
 SwingUtilities.invokeAndWait(() -> {
 try {
 pane.getDocument().insertString(0, "public class Hello