SWT Syntax highlighting widget - java

Anyone know of an SWT widget that can be a text editor with support for syntax highlighting? I'm aware of the StyledText widget but I'm hoping that somebody has already written some libraries so one can just specify the keywords that should be highlighted.

Indeed, the general principle of syntax highlighting are using the StyledText Widget.
The JavaSourcecodeViewer is a more advanced example.
The JavaViewer is even more detailed (source code).

I'd look into what Eclipse uses in their code editor. Because if any SWT application uses syntax highlighting, its Eclipse.

Perhaps what you are looking for is Eclipse Colorer plug-in.
I have no idea though if and how would the colorer be usable as an SWT widget.

Related

Can Eclipse's Java editor do soft line wrapping?

I like to use Eclipse's Java editor feature that allows the me to split the editor window into several panes so I can look at multiple files at once (See below). When I do this, the editors usually can't display the longest lines, and I have to use the horizontal scroll bar.
I don't want to reformat the source itself because the window widths change depending upon what I'm looking at. So what I'm looking for is a soft line wrap, like many editors support (See below). Can I do this in Eclipse?
Nope. Not that is hasn't been asked for.
There's a plugin but I've never used it.
This bug has been finally fixed in Eclipse 4.6 Neon:
https://www.eclipse.org/eclipse/news/4.6/platform.php#word-wrap
EDIT: Here's a screenshot of a Java editor with the feature active.
February 2014: the new repo de.cdhq.eclipse.wordwrap from Florian Weßling (ColdDevil) does provide good wrapping.
It just got updated to support Auto-Wrapping on Startup:
When it's activated in the preferences word wrap will be automatically enabled in all open editors when Eclipse is started.
See the project page:
It seems that this is not possible in Eclipse at this time; this feature has been requested and unimplemented since 2003 with 103 users on the CC list.
There is now a plugin allowing soft wrapping. It is experimental and will break the line numbering.
http://ahtik.com/blog/projects/eclipse-word-wrap/

Eclipse text-editor drag-and-drop mouse click key combination

In the Java source editor in Eclipse, you could select a block of code, pick it with a mouse click and drop the block of code into another area of the code.
You can't do that for other text editors like XML, HTML, etc. I had to press a key combination before I could use the mouse to move and drop the selected text. I have a new Eclipse set-up now and I can't recall what the key combination is. I tried ctrl-shift, ctrl-alt, alt-shift, and ctrl-shift-alt. None of them work. I had drag-and-drop enabled.
Is there something else on Eclipse that I had installed in my old Eclipse set-up that I forgot to install in my new Eclipse set-up? It shouldn't be because the text editor config has a check box for "enable drag and drop" which I enabled.
Of course, if you are one of those guys who wrote the eclipse text editor, you should also answer this question:
why did you not make the other text editors behave like the Java code editor? Why did you make us into having to do a key-combination to perform drag and drop for the other editors? What's wrong with having all the editors exhibit the same behaviour?
I woogled and googled and could not find any eclipse manual that would tell me what the key combination is. I also could not find it in the local help files. If you required us to use key-combination, why did you not document that in a manual?
My apologies, but I realise I sound a little frustrated now.
The text DnD (Drag and Drop) feature (initially introduced by bug 11624 in 2007) has been slowly extended to various editors, as reported by the bug 231294:
Tested in EclipsePdt-2.2.0.v20100427
Verified fixed for:
PHP files
JS files
Still reproducible in:
CSS files
HTML files
XML files (source view)
So it is still "work in progress".
The relevant blocking issues are:
bug 178104: [DND] Need to revisit dnd API to allow multiple drop targets
bug 173405 Make use of IDragAndDropService (Show Votes)
bug 195655 Drag'n'drop selected text

Implementing a simple UI editor in Java

I'm thinking about writing a simple UI designer in Java. I'm just playing with ideas at the moment to see if it is feasible.
It would be good to have something like this as all of our UIs are generated from XML. Just wondering if anyone has tried anything like this before. I know there will be a lot of effort in doing something like this.
Does anyone know of any 3rd party products that already do something like this?
If not then at a simple level, it will have drag and drop support for any component that can be positioned on a panel. Then extra bits will be added. Are there any good samples on the net for this?
Cheers
Dated back to 2005, this has an overview of Java UI Builders:
http://www.fullspan.com/articles/java-gui-builders.html
Here is a page on how to use the Eclipse Visual Editor:
http://www.ibm.com/developerworks/opensource/library/os-ecvisual/
Here is a good page on the different approaches to build UIs in Java:
http://leepoint.net/notes-java/GUI/misc/80gui-generator.html
Which GUI technology are you using? Swing? NetBeans has a very good drag-and-drop Swing GUI editor. For Eclipse there are several plugins.
If you want to see other projects in which a Swing GUI is generated from XML config files, there are different libraries that do this.
Eclipse 4.0 Developer Preview was just released with an xml based toolkit called XWT. It can be styled with CSS and has a GUI builder. This is a developer preview and there will be some changes over the next year as it progresses to release 4.1, but it is useable right now and the community support is really good.

Creating SWT Forms using Eclipse similar to Visual Studio C#/VB, possible?

Please forgive if this question has been asked numerous times. I recently installed Eclipse Classic v3.6.0 which I need to create a little utility using Java. In Visual Studio I can create a new form then from the Toolbar I can drag and drop components (Button, TextBox, ListBox, etc) onto the Form. Is this possible using Eclipse?
I have tried various (see below for a few examples) combination using both Stack Overflow and Google, but nothing that I have seen that discusses this topic. I have read that there are plug-ins for Eclipse and was thinking there might be a plug-in for this type of behavior? I am not sure if this feature is supported out of the box. Any help is greatly appreciated.
"eclipse form drag drop"
"using eclipse drag and drop form creation"
I have also found the following links that show examples for creating Form using SWT, but these are more of snippets. These are great if I want to generate the file myself, but I would like the IDE to most of that work (since I am lazy).
SWT Snippets
http://www.eclipse.org/swt/snippets/
SWT GridLayout
http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/SWTGridLayout.htm
SWT JFace Eclipse
http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/CatalogSWT-JFace-Eclipse.htm
Thanks,
Mark
Instantiations SWT Designer is probably your best bet.

Creating a "netbeans property" style dialog box

I've been trying to create a GUI using netbeans, that includes a dialog similar to Netbean's own "property dialog" that appears when designing. ie. a dialog that contains a table that can be expanded by tree nodes. Something like the dialog on this page, http://platform.netbeans.org/tutorials/nbm-property-editors.html
As far as I can understand, the page I linked to describes a custom editor I can set up for use within netbeans while designing - I'm just looking for a way to doing something similar for my actual application I'm writing. Is there an easy way to do this?
I came across this and have tried it but it doesn't quite work in the same way as the standard Netbeans dialog. weblogs.java.net/blog/timboudreau/archive/2008/06/egads_an_actual.html
Any tips greatly appreciated.
This will sound flip... but I am being serious.
The easiest way to do this is to write your app using the NetBeans RCP platform.
You may want to look at the Swing Application Framework, too.
There are a couple SAF samples integrated into NetBeans... You can read about them here: http://netbeans.org/kb/docs/java/gui-saf.html
I could not find a property editor dialog sample, though.
I found a couple other pointers, using this query: http://www.google.com/search?q=how+to+write+a+property+editor+dialog+in+swing
You could take a look into the l2fprod components
(source: l2fprod.com)

Categories

Resources