Highlighting Flex 3.5 CDATA component in Eclipse - eclipse

Is there any way to highlight the CDATA component in a .mxml file?
I have Eclipse and Flash Builder 3.5 and the flex components are highlighted, but the CDATA isn't. It contains action script.
Sorry, I meant syntax highlighting. For example:
<mx:Canvas ... >
<mx:Script>
<![CDATA[
private function foo():void {}
]]>
</mx:Script>

I don't think so, but your Outline View should allow you to click on any script tags to highlight them. Unfortunately you can't give them different ID's, so splitting your code among different blocks doesn't help much.

Related

Custom tag-colors for imported tag library tags in Eclipse

Is it somehow possible to change the tag-colors (not one-by-one, but for all of them... or else one-by-one would also be okay) of imported tag library tags (like e.g. jstl-tags: <c:if>, <c:forEach>, or <my:tag>, etc.)? Just to make some visual difference within a JSP-code between usual HTML-tags and all the rest.
Other than Preferences > Java > Editor > Syntax Coloring, I'm pretty sure you can't change tag colors for custom tags.

Custom content assist for default java editor in Eclipse

I'm currently trying to develop an Eclipse Plugin to support code replacement, like what the default content assist in Eclipse do. What I want to implement is something like "insert argument names automatically on method completion with visualized box around the argument" and I can "use the Tab key to navigate between the inserted names" and "while navigating, list of optional variables for current argument can be displayed and be chosen".
In short, it comes to two questions:
How to add the visualized box around the already existed variable or even Java keywords that need replacement? And at the meanwhile I can use Tab key to switch between these boxes.
How to display a list of candidates to select from when I trigger on the box?
By now I only figure out the extension point : org.eclipse.jdt.ui.javaCompletionProposalComputer may be useful, but I have no idea where to start at? Thanks in advance.
Oh, finally I've solved it myself...
For the 'box', it should be the LinkedModeModel, this class should work with LinkedPositionGroup and LinkedPosition to add mutiple boxes. And we should use LinkedModeUI to set it up.
For the content assistant, there's no need to use the extension point. There is a ProposalPosition class which extends LinkedPosition for you to add your proposals for the 'box' in its constructor. And we can simply use the CompletionProposal to construct a ICompletionProposal array as the argument of ProposalPosition's constructor.

Netbeans Code Templates Formatting syntax

I'd like to know what's the syntax or the language used to format the code templates in netbeans ide. I mean, in the default templates I can see things like;
while (${EXP default="exp"})
{
${selection line}${cursor}
}
And:
// <editor-fold defaultstate="collapsed" desc="${comment}">
${selection}${cursor}// </editor-fold>
And I experimented and did this:
int ${IDX newVarName default="loop"};
for (${IDX} = 0; ${IDX} < ${SIZE int default="size"}; ${IDX}++)
{
${cursor}
}
And it works but I don't really know where the "${IDX}" or the "${SIZE int default="size"}" or the "${selection}${cursor}" comes from and what other statements can I use to format my templates.
Is this some scripting or programming language?
Where can I find this information?
I think Netbeans uses the template engine Freemarker for this. So all variables (= ${...}) are filled in by Netbeans at the time you use the template.
Unfortunately I don't have a full list of all default variables / methods you can use, but here are two of them listed:
${cursor}:
defines a position where the caret will be located after the editing
of the code template values finishes.
${selection}:
defines a position for pasting the content of the editor selection.
This is used by so-called 'selection templates' that appear as hints
whenever the user selects some text in the editor.
See here: http://wiki.netbeans.org/Java_EditorUsersGuide#How_to_use_Code_Templates
${IDX} looks like a custom variable you use.
See also:
- Code Assistance in the NetBeans IDE Java Editor: A Reference Guide (Code Template)
- Code Templates in NetBeans IDE for PHP
How_to_use_Code_Templates pretty much covers everything there is.
Looking at CodeTemplateParameter.java shows there is another hint called "completionInvoke" which requests showing of the code completion popup for the currently focused text component, but that is all.

Task Tags in XSP sources

In Java sources one can use (by default) //TODO, //FIXME and //XXX comments to add that part of source to Tasks view in Eclipse/Domino Designer.
I would like to use it in SSJS too, but I can't make it work. In Designer preferences General/Editors/Structured Text Editors/Task Tags, Filters tab, you can eneable "Enable searching for Task Tags" checkbox and tick XML type. Affected content types section contains "xsp" that is file extension of XP/CC sources.
But any tag in SSJS source (property of XML tag, actually) does not appear in Tasks view.
How to write such task tag into XP/CC source to make it work?
In Domino Designer, searching for Task Tags can be enabled for most editors via the Preferences.
i.e. (General -> Editors -> Structured Text Editors -> Task Tags)
However, the reported behaviour occurs because the Task Tags are added to a CDATA section.
CDATA sections are basically the wild wild west of XML.
For reference, see http://www.w3.org/TR/REC-xml/#sec-cdata-sect specifically:
"Within a CDATA section, only the ]]> string is recognized as markup, so that left angle brackets and ampersands may occur in their literal form; they need not (and cannot) be escaped using < and &"
Therefore, for this reason, the contents of CDATA sections are generally ignored by Eclipse XML parsing and validating. So if <!-- TODO --> or //TODO (or any tag) is put into a CDATA section it is not picked up as such.
So as a consequence, any annotated Server-Side JavaScript in XSP source does not appear in the Tasks View.
Using this sample code as an example, the Tasks View displays as follows.

Eclipse plugin development: how to add functionality to editor

I have been trying there last days to extend the default editor (java, xml, all of them) functionality,
what I want to do is add a big ruler with text on the side of every editor.
example:
a default editor page looks like this:
|-----------|
|source |
|code |
| |
|-----------|
but i want it to be like this
|------|----|
|source| |
|code |line|
| |text|
|------|----|
also i can't use a view because the text in my ruler corresponds to a certain line and has to scroll along with the source code.
I have tried to do this by implementing IEditorActionDelegate
since I don't want a new editor, but to add functionality, but I could not find any solutions.
Wanted to mention that for putting my solution in practice i extended AbstractContributedRulerColumn
public class MyRuler extends AbstractContributedRulerColumn {
....
}
Arne's answer gave some good suggestions, but it still took me a while to figure out how to write a plugin that adds a column of text next to the editor.
I published a sample that just displays line numbers with an "x" after each line. Some useful resources I found along the way were:
Introduction to plugin development
Eclipse extensions and extension points
LineNumberColumn example that is really just a small amount of code that delegates to LineNumberRulerColumn buried in a bunch of compatibility stuff.
I think you are after the extension point org.eclipse.ui.workbench.texteditor.rulerColumns. The component that displays the line numbers in text editors is added using this point, so it should be possible to add other information, too.
Example from the API doc:
<extension
point="org.eclipse.ui.workbench.texteditor.rulerColumns">
<column
id="org.eclipse.ui.editors.columns.linenumbers"
name="Line Numbers"
class="org.eclipse.ui.internal.texteditor.LineNumberColumn"
enabled="false"
global="true"
includeInMenu="false">
<placement
gravity="0.9">
<after id="org.eclipse.ui.editors.columns.annotations"/>
</placement>
<targetClass
class="org.eclipse.ui.texteditor.AbstractDecoratedTextEditor">
</targetClass>
</column>
</extension>
After working with the ruler columns extension point for a while, I learned about the org.python.pydev.pydev_pyedit_listener extension point that lets you intercept the PyEdit creation event and wrap other controls around it. Some digging in the SWT widget reference let me add another pane on the right with a splitter, and I published a sample project. The main advantages are that you can choose where the new display appears, you can use any controls you like, and the user can scroll if there's too much text to fit in the display.