aymanhs / jsyntaxpane Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/jsyntaxpane
Automatically exported from code.google.com/p/jsyntaxpane
What steps will reproduce the problem?
1. Start SyntaxTester
2. Insert text (must have vertical scrolls)
3. Change content from drop-down list
What is the expected output? What do you see instead?
Line numbers on the top-left start from 1, not the number before the change.
Please use labels and text to provide additional information.
Release 0.9.4 - SVN r68.
Original issue reported on code.google.com by [email protected]
on 12 Jan 2009 at 7:48
Before uploading to the Maven public repository, it would be good to have a
new version released. There has been some changes in the code since last
release.
The version numbering scheme also needs to change. Having the date as
versioning detail is convenient from the developer perspective, but from
the user perspective difficult to remember. Also some OpenSource software
which had this type of naming are ordered wrongly in the MVNRepository
search page. For example:
http://www.mvnrepository.com/artifact/commons-pool/commons-pool
Older version files are shown in the top, which might tempt unwary users to
include that instead of the latest stable version.
So what is the best version? Well, this has to be just thought out. My
personal preference would be something like 0.8.0. This indicates it is a
fairly stable product which has not yet reached 1.0 release.
Once you let me know the version number, I can create that version, tag it,
and open an issue to upload to the Maven public repository.
Original issue reported on code.google.com by subwiz
on 7 Aug 2008 at 8:41
This is an initial version of the flex file to support c syntax..
it's a slighly modified version of the one found in jhighligh.
i hope it's useful
Original issue reported on code.google.com by [email protected]
on 3 Nov 2008 at 10:47
Attachments:
What steps will reproduce the problem?
1. Create an editor pane for an xml document.
2. Paste the following into the document:
<textfield first="" second="" />
What is the expected output? What do you see instead?
I expect no coloring, but the library appears to color from the second
double-quote to the third inclusive.
What version of the product are you using? On what operating system?
0.9
Please provide any additional information below.
N/A
Original issue reported on code.google.com by [email protected]
on 23 Sep 2008 at 5:53
Not sure, but I think there was no hint that this JAR needs Java 6 to run.
This prohibits its use in our project, though :-( too bad.
Maybe you could refactor it.
Original issue reported on code.google.com by [email protected]
on 21 Nov 2008 at 1:08
See
http://code.google.com/p/jsyntaxpane/source/browse/trunk/src/main/java/jsyntaxpa
ne/SyntaxView.java#49
Original issue reported on code.google.com by peter.arrenbrecht
on 21 Nov 2008 at 7:25
Unless I am mistaken, there is no way to change the keyword for a language.
This is a very useful feature because, for example, by changing the
keywords most of C++ based languages can be supported (the same lexer as
Java can be used)
Original issue reported on code.google.com by mavroprovato
on 5 Sep 2008 at 1:23
What steps will reproduce the problem?
1. Change the TokenType.DEFAULT color to Color.ORANGE in SyntaxStyles
2. Start SyntaxTester
3. Type @ (it will be orange)
3. Type ! (now the string "@!" will be black)
What is the expected output? What do you see instead?
Expect the string "@!" to use the default color (orange).
Please use labels and text to provide additional information.
SyntaxView:56
graphics.setColor(Color.BLACK);
should be
SyntaxStyles.getInstance().setGraphicsStyle(graphics, TokenType.DEFAULT);
Original issue reported on code.google.com by [email protected]
on 9 Aug 2008 at 4:28
e.g. you type in as follows:
if (k == 1) {
} else if (k == 2) {
} else {
}
The result looks like this afterwards:
if (k == 1) {
} else if (k == 2) {
else {
}
It would be better to separate indentation and
de-indentation actions; the first could be triggered
by pressing Return, the other by entering a closing
brace (}).
Besides, comments aren't recognised at indent time, like:
if (true) { // do it always
My suggestion to implement this is here:
import java.awt.event.ActionEvent;
import java.util.HashSet;
import java.util.Set;
import javax.swing.text.JTextComponent;
import javax.swing.text.TextAction;
import jsyntaxpane.SyntaxDocument;
import jsyntaxpane.Token;
import jsyntaxpane.TokenType;
import jsyntaxpane.actions.SyntaxActions;
public class JIndentAction extends TextAction {
/**
* Crerates new JIndentAction.
*/
public JIndentAction() {
super("JINDENT");
}
/**
* {@inheritDoc}
*/
@Override
public void actionPerformed(ActionEvent e) {
JTextComponent target = getTextComponent(e);
if (target != null) {
SyntaxDocument sDoc = SyntaxActions.getSyntaxDocument(target);
int pos = target.getCaretPosition();
int start = sDoc.getParagraphElement(pos).getStartOffset();
String line = SyntaxActions.getLine(target);
String lineToPos = line.substring(0, pos - start);
String prefix = SyntaxActions.getIndent(line);
int tabSize = JavaScriptKit.getTabSize(target);
if (lineToPos.trim().endsWith("{")) {
prefix += StringTools.fillString(" ", tabSize);
} else {
String noComment = getLineTextWithoutComment(start, pos, sDoc); //
skip EOL comments
if (noComment.trim().endsWith("{")) {
prefix += StringTools.fillString(" ", tabSize);
}
}
target.replaceSelection("\n" + prefix);
}
}
/**
* Gets the line without the comments. For example for the string
* <code>{ // it's a comment</code> this method will return "{ ".
* @param aStart start of the line.
* @param anEnd end of the line.
* @param aDocument document which holds the line.
* @return string for the line without comments (if exists).
*/
protected String getLineTextWithoutComment(int aStart, int anEnd,
SyntaxDocument aDocument) {
Set<Token> tokens = new HashSet<Token>();
StringBuilder result = new StringBuilder();
for (int i = aStart; i < anEnd; i++) {
Token t = aDocument.getTokenAt(i);
if (null != t && ! tokens.contains(t)) {
tokens.add(t);
if (TokenType.COMMENT != t.type && TokenType.COMMENT2 != t.type) {
result.append(t.getText(aDocument));
}
}
}
return result.toString();
}
}
import java.awt.event.ActionEvent;
import javax.swing.text.BadLocationException;
import javax.swing.text.JTextComponent;
import javax.swing.text.TextAction;
import jsyntaxpane.SyntaxDocument;
import jsyntaxpane.Token;
import jsyntaxpane.actions.SyntaxActions;
public class JDeindentAction extends TextAction {
/**
* Crerates new DeindentAction.
* @param name
*/
public JDeindentAction() {
super("JDEINDENT");
}
/**
* {@inheritDoc}
*/
@Override
public void actionPerformed(ActionEvent e) {
JTextComponent target = getTextComponent(e);
if (target != null) {
SyntaxDocument sDoc = SyntaxActions.getSyntaxDocument(target);
int pos = target.getCaretPosition();
int start = sDoc.getParagraphElement(pos).getStartOffset();
String line = SyntaxActions.getLine(target);
int tabSize = JavaScriptKit.getTabSize(target);
if (StringTools.notNull(line).trim().isEmpty()) {
try {
sDoc.insertString(pos, "}", null);
Token t = sDoc.getPairFor(sDoc.getTokenAt(pos));
if (null != t) {
String pairLine = SyntaxActions.getLineAt(target, t.start);
String indent = getIndent(pairLine, tabSize);
sDoc.replace(start, line.length() + 1, indent + "}", null);
}
} catch (BadLocationException ble) {
target.replaceSelection("}");
}
} else {
target.replaceSelection("}");
}
}
}
/**
* Gets the indent string for the given line.
* @param aLine string whos indent must be returned.
* @param aTabSize number of spaces per tab.
* @return indent string for the line.
*/
public static String getIndent(String aLine, int aTabSize) {
StringBuilder b = new StringBuilder();
if (! StringTools.isEmpty(aLine)) {
int i = 0;
while (i < aLine.length() && (aLine.charAt(i) == ' ' ||
aLine.charAt(i) == '\t')) {
if (aLine.charAt(i) == ' ') {
b.append(aLine.charAt(i));
} else {
b.append(StringTools.fillString(" ", aTabSize));
}
i++;
}
}
return b.toString();
}
}
Here some used util methods:
class StringTools
public static String fillString(String source, int repeat) {
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < repeat; i++) {
buffer.append(source);
}
return buffer.toString();
}
public static String notNull(String aString) {
String result = aString;
if (null == result) {
result = ""; //$NON-NLS-1$
}
return result;
}
public static boolean isEmpty(String s) {
return (null == s) || (0 == s.length());
}
class JavaScriptKit
public static int getTabSize(JTextComponent aComponent) {
Integer tabs = (Integer)
aComponent.getDocument().getProperty(PlainDocument.tabSizeAttribute);
return null == tabs || tabs.intValue() == 0? 4 : tabs.intValue();
}
Original issue reported on code.google.com by [email protected]
on 20 Nov 2008 at 8:43
If java.flex and JavaLexer are GPL, then the entire project must be GPL.
Hopefully this is a typo and java.flex is Apache 2.0.
Original issue reported on code.google.com by [email protected]
on 4 Sep 2008 at 5:30
EndOfLineStringProperty is supposed to automatically find out the new line
separator, but that ain't working. I also tried setting it manually to no
avail. Since EndOfLineStringProperty is a property of the
DefaultEditorKit, I have to assume that JSyntaxPane is the culprit. Then
again, who knows, there might be something else I'm not seeing.
Original issue reported on code.google.com by [email protected]
on 28 Jun 2008 at 9:46
A very nice to have would be highlighting matching parentheses (, [ or {
Original issue reported on code.google.com by [email protected]
on 31 Jul 2008 at 4:03
Provide an unsigned jar as part of the distribution so that applications
can sign the jar as required and not rely on the expiration date set in the
prebuilt jar (currently around September 2008).
Original issue reported on code.google.com by [email protected]
on 24 Jun 2008 at 3:56
What steps will reproduce the problem?
1. checkout
2. mvn package (took me 6 minutes to download and compile after a fresh
maven install)
3. java -jar jsyntaxpane.jar
What is the expected output? What do you see instead?
Tester should start, but get:
Failed to load Main-Class manifest attribute from
jsyntaxpane-0.9.0.jar
You should probablly add the jar manifest and the set the main class for
this to work.
Please use labels and text to provide additional information.
Original issue reported on code.google.com by [email protected]
on 11 Aug 2008 at 6:27
What steps will reproduce the problem?
1. launch SyntaxTester
2. press ctrl-z
What is the expected output? What do you see instead?
Expected: no action, the original text is the initial state to the user
Actual: the editor becomes empty, which is the initial state to the code
I think SyntaxDocument/SyntaxKit should call
CompoundUndoManager.discardAllEdits() at the right time, or there needs to
be a public method in SyntaxDocument so the client can clear edits when
they choose.
Original issue reported on code.google.com by [email protected]
on 14 Aug 2008 at 3:07
What steps will reproduce the problem?
1. DefaultSyntaxKit.initKit();
2. editorPane = new JEditorPane();
3. editorPane.setContentType("text/java");
What is the expected output? What do you see instead?
Exception in thread "main" java.lang.NullPointerException at
jsyntaxpane.components.LineNumbersRuler.install(LineNumbersRuler.java:113)
at jsyntaxpane.DefaultSyntaxKit.install(DefaultSyntaxKit.java:109)
at javax.swing.JEditorPane.setEditorKit(Unknown Source)
at javax.swing.JEditorPane.setContentType(Unknown Source)
at main.CustomEditor.getEditorPane(CustomEditor.java:96)
at main.CustomEditor.getEditorScrollPane(CustomEditor.java:82)
at main.CustomEditor.getMainPanel(CustomEditor.java:63)
at main.CustomEditor.<init>(CustomEditor.java:47)
at main.TestClass.<init>(TestClass.java:10)
at main.TestClass.main(TestClass.java:59)
What version of the product are you using? On what operating system?
jsyntaxpane-0.9.3.jar with jre 1.6.0_03 on Windows Vista 32 bits
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 10 Nov 2008 at 1:06
Are you planning to support the python language ?
Thanks
Original issue reported on code.google.com by [email protected]
on 5 Nov 2008 at 1:05
What steps will reproduce the problem?
1. Set type to java
2. paste:
"public void foo{
}"
3.try to add lines after the last }
What is the expected output? What do you see instead?
You should be able to add lines
What version of the product are you using? On what operating system?
ref 47
Please provide any additional information below.
I have an patch file attached (i believe the problem lies in the JavaIndent)
Raphael
[email protected]
Original issue reported on code.google.com by [email protected]
on 24 Oct 2008 at 8:19
Attachments:
I am the project owner of: http://code.google.com/p/rest-client/
Your project seems to match our requirement. One glitch though, the project
is not available in Maven repository. Can you upload to Maven repository?
http://maven.apache.org/guides/mini/guide-central-repository-upload.html
I also see that your build is happening through Netbeans supplied build
scripts. If you need, I can help you convert your project to Maven.
Original issue reported on code.google.com by subwiz
on 5 Aug 2008 at 1:50
What steps will reproduce the problem?
1. Edit SyntaxTester to change the JEditorPane's selected color (eg.
pane.setSelectedTextColor(Color.magenta))
2. Start SyntaxTester
3. Select some text
What is the expected output? What do you see instead?
Expected: selected text is orange
Actual: selected text is the same color as unselected text
The problem is that SyntaxView.drawSelectedText() calls
drawUnselectedText() instead of implementing the selected text method. The
workaround seems to be commenting out SyntaxView.drawSelectedText()
Original issue reported on code.google.com by [email protected]
on 11 Aug 2008 at 9:40
What steps will reproduce the problem?
1. Use Tester
2. Set to XML
3. notice some text is not displayed.
4. Clear text, and type first <
5. The first < is not shown until full tag is displayed
Original issue reported on code.google.com by [email protected]
on 21 Jun 2008 at 5:58
your jsyntaxpane is very cool, but recently I focus on my own XML editor,
which can use your library. but a shortcoming is tag auto completion, e.g.
when I press <Test>, another </Test> should be automatically followed
because of it is an XML document.
Could you please fix it?
Original issue reported on code.google.com by [email protected]
on 30 Jul 2008 at 10:10
What steps will reproduce the problem?
1. Type in a parameterless method name e.g. thisclass.open();
2.
3.
What is the expected output? What do you see instead?
As I type I expect to see (); however I end up with ();) due to the
additional parenthesis.
What version of the product are you using? On what operating system?
JSyntaxPane-080623a.jar windows
Please provide any additional information below.
This was addressed in Eclipse at one point. If the user opens a
parentheses and you add one, any parenthese typed next to the one you
added should replace, not add an additional one. Of course the logic is
probably tougher than that.
Original issue reported on code.google.com by [email protected]
on 1 Jul 2008 at 6:50
What steps will reproduce the problem?
1. launch SyntaxTester
2. type 1
What is the expected output? What do you see instead?
Expected: SyntaxTester.jEdtTestCaretUpdate() gets the number token from the
Document and displays it in lblToken.
Actual: SyntaxTester.jEdtTestCaretUpdate() gets a null token.
Please use labels and text to provide additional information.
The problem is that caretUpdate() is called during
SyntaxDocument.insertString()'s call to super.insertString(), which means
CaretListeners are called before SyntaxDocument.parse(). Since the
SyntaxDocument is only "half" updated, SyntaxDocument.getTokenAt() returns
a value that is out of date.
Original issue reported on code.google.com by [email protected]
on 14 Aug 2008 at 2:28
I came across the above method which should make registering and even using
the library much easier. The only downside in my opinion is that now if
you need to use your own lexer, you also need to create a SyntaxKit
implementation. Mind you, it will be generally just one liner class with a
constructor that calls default SynatxKit with the proper lexer.
When that is done, you can actually use code like:
JEditor.setContentType("text/java")
I have an implementation that works fine, but needs some cleanup and a
clean way to register the various editor kits to the languages.
Any suggestions?
Original issue reported on code.google.com by [email protected]
on 18 Sep 2008 at 12:59
it would be nice to get an code completion just like Java IDE Eclipse. When
Ctrl + space is pressed, a popup menu appears to help user select words.
For instance, I can pass two arrays:
String[] text = {“Name”, “Comment”};
Icon[] icons = {…..};
Text array is for the text of Intellisence and icons array is for the icons
on the left side.
Possible request:
1. the Intellisense popup menu appears wherever Ctrl + Space is pressed
2. if there is no letter before the cursor, IntelliHint will show all the
items from text array
3. if there is a letter before the cursor, IntelliHint will only show the
items beginning with the letter from text array
4. if the item from popup menu is selected, the corresponding text should
be inserted
Original issue reported on code.google.com by [email protected]
on 30 Jul 2008 at 10:15
What steps will reproduce the problem?
1. Press Ctrl-F to open the find dialog
2. Click on the Highlight button
What is the expected output? What do you see instead?
Expected result: nothing happens
Original issue reported on code.google.com by [email protected]
on 31 Oct 2008 at 4:01
What steps will reproduce the problem?
1. Add a document filter to the SyntaxDocument. For example in
SyntaxTester.jCmbLangsItemStateChanged after you set the EditorKit:
((SyntaxDocument) jEdtTest.getDocument()).setDocumentFilter(new
DocumentFilter());
2. Launch the SyntaxTester and start editing. The syntax highlighting
won't update as you type.
What is the expected output? What do you see instead?
Expect SyntaxDocument.parse() to get called, but SyntaxDocument doesn't
override AbstractDocument.replace() (which is called by the
DocumentFilter's FilterBypass). So it goes around the SyntaxDocument, and
the highlight doesn't update.
What version of the product are you using? On what operating system?
JSyntaxPane-08071 source, Windows XP
Thanks!
Original issue reported on code.google.com by [email protected]
on 31 Jul 2008 at 11:00
What steps will reproduce the problem?
1. create a syntaxpane in editor pane(xml, java...)
2. type xml text or java text in relative syntaxpane(I haven't tried other
syntaxpanes)
3. if character in syntaxpane is bold, the character size will be enlarged,
but the cursor won't change the position. I think the cursor should also be
next to the bold characters, not still stay in position where next to the
character when not bold.
OS: Windos XP sp2, en_US.
JDK:1.6.0_07
Original issue reported on code.google.com by [email protected]
on 20 Nov 2008 at 3:03
Attachments:
very useful component, thanks.
how can i change the font family used? i've tried using setFont() and
setting the component to honour the properties, but it just makes the
spacing bigger.
Original issue reported on code.google.com by [email protected]
on 19 Jun 2008 at 1:31
What steps will reproduce the problem?
1. Use jsyntaxpane on Macintosh
2. Undo/Redo keys are control-Z/control-Y instead of mac standard
command-Z/command-Y
I would suggest the following diff to account for different platforms menu keys:
Index: src/main/java/jsyntaxpane/DefaultSyntaxKit.java
===========================================================
========
--- src/main/java/jsyntaxpane/DefaultSyntaxKit.java (revision 45)
+++ src/main/java/jsyntaxpane/DefaultSyntaxKit.java (working copy)
@@ -15,6 +15,8 @@
import java.awt.Font;
import java.awt.GraphicsEnvironment;
+import java.awt.Toolkit;
+import java.awt.event.KeyEvent;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Properties;
@@ -92,8 +94,8 @@
* @param map
*/
public void addKeyActions(Keymap map) {
- map.addActionForKeyStroke(KeyStroke.getKeyStroke("control Z"),
SyntaxActions.UNDO);
- map.addActionForKeyStroke(KeyStroke.getKeyStroke("control Y"),
SyntaxActions.REDO);
+ map.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_Z,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), SyntaxActions.UNDO);
+ map.addActionForKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_Y,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), SyntaxActions.REDO);
map.addActionForKeyStroke(KeyStroke.getKeyStroke("TAB"), SyntaxActions.INDENT);
map.addActionForKeyStroke(KeyStroke.getKeyStroke("shift TAB"), SyntaxActions.UNINDENT);
}
@@ -163,4 +165,4 @@
Arrays.sort(types);
return types;
}
-}
\ No newline at end of file
+}
Original issue reported on code.google.com by [email protected]
on 9 Oct 2008 at 8:14
Can we get some build instructions on the website? Before it used maven, I
was able to check out the source into Eclipse and use it right away.
Now it won't build because the package names are wrong, the lexer classes
are missing, etc. I installed maven and it generates the lexers, but the
packages are still incorrect, and if I refactor in eclipse I get conflicts
when I update.
I'd like step by step instructions of how to compile and edit the source.
Original issue reported on code.google.com by [email protected]
on 11 Aug 2008 at 9:12
What steps will reproduce the problem?
1. Launch JSyntaxPaneTest
2. set content type "text/c"
3. press ENTER
What is the expected output? What do you see instead?
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at jsyntaxpane.components.LineNumbersRuler.updateSize(LineNumbersRuler.java:98)
Proposed patch:
Container parent = getParent();
if(parent!=null)
{
parent.doLayout();
}
Original issue reported on code.google.com by [email protected]
on 9 Jan 2009 at 5:04
What is the expected output? What do you see instead?
Hi,
Currently the "left" and "right" parameter of PairAction is \" :
public static PairAction SQUOTE = new PairAction("SQUOTE", "\"", "\"");
I think it should be \'
What version of the product are you using? On what operating system?
Version from SVN.
Original issue reported on code.google.com by [email protected]
on 10 Jul 2008 at 1:38
Hello
I am trying to integrate your project with my program given here below
import javax.swing.*;
import java.awt.*;
import java.io.*;
import jsyntaxpane.*;
import jsyntaxpane.lexers.*;
import jsyntaxpane.syntaxkits.*;
import jsyntaxpane.util.*;
class TestEditor
{
public static void main(String[] args)
{
try
{
jsyntaxpane.DefaultSyntaxKit.initKit();
JEditorPane editorPane = new JEditorPane("text", "yahoo");
editorPane.setEditable(true);
editorPane.setEditorKit(new SqlSyntaxKit());
editorPane.setContentType("text/sql");
JFrame frame = new JFrame();
frame.getContentPane().add(editorPane, BorderLayout.CENTER);
frame.setSize(1000, 1000);
frame.setVisible(true);
}
catch (Exception e)
{
}
}
}
It compiles well . But when I run it from Terminal it throws the following
error .
imac02:~/Desktop/idv tverma$ java TestEditor
Exception in thread "main" java.lang.NoSuchMethodError:
java.util.Properties.stringPropertyNames()Ljava/util/Set;
at jsyntaxpane.DefaultSyntaxKit.initKit(DefaultSyntaxKit.java:118)
at jsyntaxpane.DefaultSyntaxKit.<clinit>(DefaultSyntaxKit.java:44)
at TestEditor.main(TestEditor.java:20)
My dir structure is
imac02:~/Desktop/idv tverma$ ls
TestEditor.class TestEditor.java jsyntaxpane-0.9.0.jar
My java version is 1.5
imac02:~/Desktop/idv tverma$ java -version
java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-241)
Java HotSpot(TM) Client VM (build 1.5.0_13-121, mixed mode, sharing)
Can you please help me understand about where am I going incorrect.
Thank you
Tarun Verma.
Original issue reported on code.google.com by tarunverma82
on 25 Sep 2008 at 3:11
Current version does not support line wrapping. It will be good to have
that feature.
Need to fine tune the Line Number if that is supported. May need to create
a new document or view instance to support that.
Original issue reported on code.google.com by [email protected]
on 23 Nov 2008 at 6:08
It would also be nice to add folding functionality to java editor or xml
editor.
Original issue reported on code.google.com by [email protected]
on 30 Jul 2008 at 10:16
What steps will reproduce the problem?
1. Run SyntaxTester
2. Enter enough text so that a scroll bar appears
3. Place the cursor in the middle of the buffer, such the the scroll bar is in
the middle of the
scroll bar track
4. Change the language
5. Observe that the text component scrolls to the bottom and the cursor is
placed there.
What is the expected output? What do you see instead?
No movement of the cursor or currently visible rectangle should be changed.
Please use labels and text to provide additional information.
Original issue reported on code.google.com by [email protected]
on 10 Aug 2008 at 8:47
The screenshot displays the problem.
Original issue reported on code.google.com by subwiz
on 6 Aug 2008 at 12:53
Attachments:
-What steps will reproduce the problem?
Create an EditorPane and set the SyntaxKit as EditorKit.
The coloring should be for XML.
editorPane = new JEditorPane();
editorPane.setEditorKit(new SyntaxKit("xml"));
- What is the expected output? What do you see instead?
As seen in the attached picture, whenever there is a backslash in an
attribute value the coloring bails out. See the path attribute for example.
<subst drive="x:" path="O:cs40_fds_emafra" /> <!-- Colored correctly -->
<subst drive="x:" path="O:\cs40_fds_substance" /> <!-- incorrect -->
<subst drive="x:" path="O:\\cs40_0_sdp_ec_emafra" /> <!-- incorrect -->
What version of the product are you using? On what operating system?
I'm using the 080629a version on windows 2000 / JDK 1.6.0
regards
/frans
Original issue reported on code.google.com by [email protected]
on 1 Jul 2008 at 8:03
Attachments:
What steps will reproduce the problem?
1. Add an EditorPane.
2. Set the type to text/java.
3. Observe with -Dswing.aatext=true
What is the expected output?
* Anti-aliased text.
What do you see instead?
* Jaggy font rendering.
What version of the product are you using? On what operating system?
* Ubuntu 8.04
Please provide any additional information below.
* The font *is* aliased if I don't set the content type.
Original issue reported on code.google.com by peter.arrenbrecht
on 24 Nov 2008 at 4:15
The current implementation cannot support tokens to be embedded within
tokens. Something like a Groovy ${val} in a Groovy String cannot be
highlighted. Only the Complete String can be highlighted.
This change requires a slightly major refactoring of the way {{{Tokens}}}
are returned to the {{{SyntaxDocument}}}, and possibly in the
{{{SyntaxView}}} to handle overlapping tokens. The {{{Lexers}}} will also
need to change to use proper states instead of just Regexp for some constructs.
But the possibilities are very nice indeed. Highlighting JavaDocs, and
Groovy Strings will look very nice.
Anybody interested in having this? If so, please add a comment and if
demand is there, I'll push it up the list of things to do.
Original issue reported on code.google.com by [email protected]
on 1 Jul 2008 at 10:06
What steps will reproduce the problem?
1. Standard Max OS X java installation.
2. Set an editor kit on a JEditorPane - i.e., pane.setEditorKit(new
JavaScriptSyntaxKit());
What is the expected output? What do you see instead?
Expect to see the text editor. Instead I get the following error message:
Exception in thread "" java.lang.NoSuchMethodError:
java.util.Properties.stringPropertyNames()Ljava/util/Set;
at jsyntaxpane.DefaultSyntaxKit.initKit(DefaultSyntaxKit.java:118)
at jsyntaxpane.DefaultSyntaxKit.<clinit>(DefaultSyntaxKit.java:44)
What version of the product are you using? On what operating system?
0.9.1 on Mac OS X with Eclipse 3.4
Please provide any additional information below.
The method 'stringPropertyNames()' does not exist in Java SE 5.0.
Original issue reported on code.google.com by [email protected]
on 22 Oct 2008 at 11:50
What steps will reproduce the problem?
1. Add another JEditorPane and JScrollPane to SyntaxTester
2. Do not call setEditorKit() on the second editorpane
3. setContentType("text/html") on the second editorpane
4. start SyntaxTester
What is the expected output? What do you see instead?
1. Type "(" in the second pane.
Expected: no autocomplete
Actual: autocomplete
2. Type [tab] in the second pane
Expected: tab
Actual: exception
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException:
javax.swing.text.html.HTMLDocument cannot be cast to
javax.swing.text.PlainDocument
at
jsyntaxpane.SyntaxActions$IndentAction.actionPerformed(SyntaxActions.java:122)
see attached SyntaxTester.java for repro
Original issue reported on code.google.com by [email protected]
on 9 Aug 2008 at 5:09
Attachments:
What steps will reproduce the problem?
1. instanciate a new JEditorPane
2. perform a setText on it with some content
3. call setContentType("text/java") on this JEditorPane
What is the expected output? What do you see instead?
It should work fine since the component is not visible yet.
Unfortunately, a NPE is thrown.
What version of the product are you using? On what operating system?
0.9.4a on OSX 10.6
Please provide any additional information below.
A NPE is thrown in the getLineNumber() method of ActionUtils class because
the JEditorComponent has not been sized yet. Therefore, the call
editor.modelToView(pos) will return a null reference, and the next
instruction r.y will throw a NPE.
Original issue reported on code.google.com by [email protected]
on 24 Dec 2008 at 10:53
When running RESTClient with JSyntaxPane 0.9.3 in Java 5, I am getting this
trace:
Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError:
java.util.Properties.stringPropertyNames()Ljava/util/Set;
at jsyntaxpane.DefaultSyntaxKit.initKit(DefaultSyntaxKit.java:185)
at jsyntaxpane.DefaultSyntaxKit.<clinit>(DefaultSyntaxKit.java:64)
at
org.wiztools.restclient.ui.JSyntaxPaneScriptEditor.<init>(JSyntaxPaneScriptEdito
r.java:16)
at
org.wiztools.restclient.ui.ScriptEditorFactory.getXMLScriptEditor(ScriptEditorFa
ctory.java:19)
I think java.util.Properties has introduced stringPropertyNames() method in
version 6. We have to find corresponding method in Java and update the
JSyntaxPane code so that it is compatible with Java 5.
Original issue reported on code.google.com by subwiz
on 15 Nov 2008 at 7:55
1) It displays line numbers for lines that don't exist (in fact for the
entire height of the JScrollPane)
2) It does not support setting the background color
My suggestion to implement these features:
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
import javax.swing.JComponent;
import javax.swing.JScrollPane;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
import javax.swing.text.JTextComponent;
public class LineNumberComponent extends JComponent implements CaretListener {
/** Need to correct the y position of line number text for better support
of custom L&F. */
private int positionCorrector;
private JTextComponent pane;
private String format;
public static final int R_MARIGIN = 5;
public static final int L_MARIGIN = 5;
/**
* Crerates new LineNumberComponent.
*/
public LineNumberComponent() {
super();
}
@Override
protected void paintComponent(Graphics g) {
g.setColor(getBackground());
Rectangle clip = g.getClipBounds();
g.fillRect(clip.x, clip.y, clip.width, clip.height);
g.setColor(getForeground());
g.setFont(pane.getFont());
int lh = getLineHeight();
int end = clip.y + clip.height + lh;
int lineCount = getLineNumber(pane);
int lineNum = clip.y / lh + 1;
// round the start to a multiple of lh, and shift by 2 pixels to align
// properly to the text.
for (int y = (clip.y / lh) * lh + lh - 2; y <= end && lineNum <=
lineCount; y += lh) {
String text = String.format(format, lineNum);
lineNum++;
g.drawString(text, L_MARIGIN, y + getPositionCorrector());
}
}
/**
* Upddate the size of the line numbers based on the length of the document
*/
protected void updateSize() {
int lineCount = getLineNumber(pane);
int h = lineCount * getLineHeight() + pane.getHeight();
int d = (int) Math.log10(lineCount) + 2;
if (d < 0) {
d = 2;
}
int w = d * getCharWidth() + R_MARIGIN + L_MARIGIN;
format = "%" + d + "d";
setPreferredSize(new Dimension(w, h));
}
protected int getLineHeight() {
return pane.getFontMetrics(pane.getFont()).getHeight();
}
protected int getCharWidth() {
return pane.getFontMetrics(pane.getFont()).charWidth('0');
}
/**
* Get the JScrollPane that contains this EditorPane, or null if no
* JScrollPane is the parent of this editor
* @param editorPane editor whose scroll pane must be found.
* @return the scroll pane for the component.
*/
public JScrollPane getScrollPane(JTextComponent editorPane) {
JScrollPane result = null;
if (null != editorPane.getParent() &&
editorPane.getParent().getParent() instanceof JScrollPane) {
result = (JScrollPane) editorPane.getParent().getParent();
}
return result;
}
@Override
public void caretUpdate(CaretEvent e) {
updateSize();
revalidate();
repaint();
}
public void install(JTextComponent editor) {
this.pane = editor;
JScrollPane sp = getScrollPane(pane);
if (sp != null) {
sp.setRowHeaderView(this);
this.pane.addCaretListener(this);
updateSize();
}
}
/**
* Installs this widget for the given text component.
* @param editor text component whose lines must be painted.
*/
public void deinstall(JTextComponent editor) {
JScrollPane sp = getScrollPane(editor);
if (sp != null) {
editor.removeCaretListener(this);
sp.setRowHeaderView(null);
}
}
/**
* Gets the number of lines in the given text component. Simply counts
the number of \n.
* This method works only for a plain document without line wrapping.
* @param aComponent text component whose line number is to return.
* @return number of lines in the given text component.
*/
public static int getLineNumber(JTextComponent aComponent) {
String text = aComponent.getText();
int len = text.length();
int result = 1;
for (int i = 0; i < len; i++) {
result += text.charAt(i) == '\n'? 1 : 0;
}
return result;
}
/**
* Gets the value which will be incremented to the y position of line
number text.
* Used for better support of custom L&F.
* @return the value which will be incremented to the y position of line
number text.
*/
public int getPositionCorrector() {
return positionCorrector;
}
/**
* Sets the value which will be incremented to the y position of line
number text.
* Used for better support of custom L&F.
* @param aPositionCorrector increment for position of line number text.
May be 0 or negative.
*/
public void setPositionCorrector(int aPositionCorrector) {
positionCorrector = aPositionCorrector;
}
}
Original issue reported on code.google.com by [email protected]
on 20 Nov 2008 at 8:24
Attachments:
I think you must add code completion for SQL Script.
I wish your library will have SQL Completion like on Netbeans 6.5
Original issue reported on code.google.com by [email protected]
on 6 Jan 2009 at 8:36
What steps will reproduce the problem?
1. I instantiated a jsyntaxpane with a "sql" editorkit
2. Type 2 or more rows of text
3. Try to move caret up or down with up or down arrows
What is the expected output? What do you see instead?
I expect the caret to move up or down but the caret does not move. Left and
right arrows work
OK.
What version of the product are you using? On what operating system?
Version 080717 on Mac OS X (JRE 6)
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 31 Jul 2008 at 4:05
What steps will reproduce the problem?
1. instantiated a new JEditorPane
DefaultSyntaxKit.initKit();
setContentType("text/java");
2. add the lines
import com.xyz.model.billing.ChargeModel;
charge : ChargeModel()
3. click into the word ChargeModel
4. Both words are highlighted in light brown
3. placed the cursor before the C.
held down shift
moved cursor after the l
4. The chargemodel is now selected such that I can copy but it still
displays the original highlighting - I cant tell I actually selected it
5. I click away elsewhere in the editor
6. The two ChargeModels are still highlighted with the light brown selection
What is the expected output?
If a word is selected which appears else where the selection display should
not interfere with the standard editor highlighting functionality.
What version of the product are you using? On what operating system?
jsyntaxpane-0.9.3a.jar
Windows XP
Please provide any additional information below.
If I can disable this particular feature that would be great
Original issue reported on code.google.com by [email protected]
on 17 Nov 2008 at 5:48
Attachments:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.