How to Change Netbeans Fonts and Colors Preview Document? - netbeans

Within the Netbeans 6.5's Tools -> Options -> Fonts & Colors -> Syntax dialog, you have the ability to change the look and feel of the Netbeans text editor. When you select a language, you are presented with a preview of your font/color scheme. However, when I preview Java, there are far more options for syntax changes than are being displayed in that preview window. If I were able to view a more robust piece of code, I'd be able to see the immediate effect of more of the options.
How can I supply a preview document to view my font/color changes?
UPDATE:
After looking into this some more, I've been able to narrow down the problem a bit. From what I can tell, everything in Netbeans is considered a plugin. The GUI editor is a plugin, and even the text editor is a plugin. This means that what ever piece of Netbeans that actually analyzes Java code and does syntax highlights is also a plugin (since Java is just one of many languages Netbeans highlights, it makes sense this is a plugin).
I think fromvega is on the right track with his suggestion. The tutorial for creating a manifest file editing plugin pointed me in the right direction. The tutorial eludes to a file used as a sample document used for font/color previews. It tells you how to create one inside this new plugin project. (Located in "Registering the Options in the NetBeans System Filesystem", part 4. About 4/5 of the way down the page.)
My next line of thought was to look for the Java syntax editing mode plugin and find this file and update it with a richer example file. I looked in the installation directory and came up empty, but I found what looks like the appropriate files within my user settings directory. There is a config directory with a lot of subfolders within my user directory (Windows: C:\Documents and Settings\saterus.netbeans\config).
I've been poking around inside this directory a bit, but have only found the xml files the manifest tutorial talks about. I have been unable to find the extensionless sample file for the Java plugin that I believe should be there.
Since I've hit a brick wall for the moment, I thought I'd toss it back to the SO community and see if you guys might make the last leap and find the solution.

Just for anyone who wants to alter this themselves it is possible on a unix machine to use grep to locate the file i.e.
grep -lr "some part of the current sample code" /path/to/netbeans
I used this method to locate the ruby example filename and from that identified that it is kept in org-netbeans-modules-ruby.jar as a file called RubyExample. By simply altering that file I was able to construct a better sample file for my own use.
Hope this helps someone!

The document which is displayed (for each mime type) is specified in a particular folder in the "system file system" (which is a NetBeans concept which is a virtual file system composed from contributions from individual modules; this is how functionality is dynamically registered in NetBeans).
Modules typically specify their system file system contributions in a file named "layer.xml" in the plugin. The create plugin templates typically offer to create this for you.
For example, here's how the Python example is registered:
<filesystem>
...
<folder name="OptionsDialog">
<folder name="PreviewExamples">
<folder name="text">
<file name="x-python" url="PythonExample.py"/>
</folder>
</folder>
...
Here, PythonExample.py is a sample file in the same directory as the layer file.
Therefore, what you need to do is create a plugin which overrides the existing registration(s) for the mime type(s) you care about and provide alternate sample documents. You may need to hide the existing registration first (see the _hidden
part from http://doc.javanb.com/netbeans-api-javadoc-5-0-0/org-openide-filesystems/org/openide/filesystems/MultiFileSystem.html ).
Hopefully this guides you in the right direction.
However, in thinking about it, we probably ought to make the preview area editable - so people can cut & paste whatever codefragment they care about right in there. This wouldn't be persistent, so whenever you change languages you get the original samples back - but it provides a quick way to see your own code. This shouldn't be just for the Fonts & Colors customization, but for the Formatting preview panels as well.
I've filed an issue against NetBeans for this:
http://www.netbeans.org/issues/show_bug.cgi?id=155964
-- Tor

I think you can only accomplish that with a new plugin, since you need somekind of parsing to define what is what.
Give a look a these tutorials, I haven't read them in details but they seem to show you how to do what you want:
http://platform.netbeans.org/tutorials/nbm-mfsyntax.html
http://www.antonioshome.net/kitchen/netbeans/nbms-coloring.php

Related

XPages: add a ResourceBundle Editor to the Domino Designer/Eclipse

I found this properties editor that seems perfect, I have a lot of translations to maintain. I found this editor that seems to be able to handle all languages at the same time, which is perfect for me: https://github.com/essiembre/eclipse-rbe
I managed to install the plugin, but now I have to confess that I'm way out of my league. Stumbling around in the dark...
How to start it, how to use it?
Or is there a better way to maintain properties in multiple languages?
I also have to maintain an application with a multi language user interface.
First of all I also started the attempt to use eclipse plugins for editing Java resource bundles but I am also failed... :(
After some test's with different editors I decided to work with JLokalize.
My way of proceeding:
Step (Switch to the package explorer of your Domino Designer)
Step (Select a folder for export to file system, e.g. Custom Controls or XPages)
Step (Set filter types to *.properties)
Step (Finish the export to your filesystem (or a network file share, if someone else should do the translation work))
Open and edit the resource files with JLokalize
After finishing your translation work you could import the translated files (e.g. *_en.properties for files translated to english) in your application.

Eclipse Ctrl+Shift+R not showing all files in the project

When i press Ctrl+Shift+R to open the Open Resource Dialog box, the filter box does not show most of the other resource files for example.. jsp, xml etc. it works fine with all the java files.. This is happening for only this particular java project. i have refreshed the project multiple times but still no-go. I have also rebuilt the index for eclipse under workspace/.metadata/.plugins/org.eclipse.jdt.core by deleting the index files but to no avail.
I am using eclipse Kepler version. Any help would be great..
Thanks All. Yes i had closed and opened the project many times. I have also not set any Resource filter exclusions. What i noticed was that opening any of these files for edit would set off an alert saying file was derived and would i like to edit? But on the properties for these file they were not ticked as derived but rather as Archived. So had to manually hunt for the parent folder which was making these files as derived. Also noticed that the Open Resource Dialog box has option for including Resource files "Show Derived Resources"...
This one helped me solve the problem
Eclipse treating all the files in a project as Derived
This is going to sound ridiculous...but maybe this'll help others too: make sure your file search string is correct! You may need to begin it with a wildcard (*).
I lost about 45 minutes on this as the result of user error.
I was looking for some local files named eRCaGuy_PPM_Writer.h and eRCaGuy_PPM_Writer.cpp (from my repo here). So, I pressed Ctrl + Shift + R and searched for ppm_writer, as shown here:
Nothing! It would not find those files! No matter what I did to the files it couldn't seem to find them. I tried all sorts of things. Then, I realized Eclipse doesn't have a fancy fuzzy search like Sublime Text 3, so I simply added an asterisk (*) to the front of the search, and voila! It works perfectly. Since the "PPM_Writer" part of those two file names is NOT at the beginning, I must start the search with a wildcard (*).
Now it works fine, as you can see here:
I've just added a note about this to my personal Eclipse setup and configuration instructions here: https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/tree/master/eclipse (for my full documentation, see also the PDF and Google Drive links at the top of that page).

sublime text - eclipse App Explorer equivalent

Hi I wondering if there is the equivalent to an App Explorer in Sublime Text 2.
When using eclipse, I use the App Explorer panel to search by file name.
I have a file naming convention that helps me find files by there functionality within the system.
So say I want to list all files relating to the registration process. I search for "regis" via the App Explorer and get a nice list of the relevant files. This filtered list is available all the time until I search again.
I can use Sublime Text's cmd+p but prefer the above as I can see the folder hierarchy etc.
In essence it is merely a file name filter on the folder list.
Are there any plugins that may give me something similar.
Any help much appreciated.
No, as far as I can tell nothing like this has been implemented in Sublime Text 2. I would suggest opening an issue at Sublime's UserEcho forum.
In the meantime:
Typing "regis" into Sublime's 'GoTo Anything' panel will bring up the files you're looking for, and show you their paths (I realize this doesn't help you with visualizing the hierarchy, but that's as close as it gets).
I use a package called SyncedSideBar - this will at least show you a visual representation of the folder hierarchy in the sidebar, for the open file, if it's added to the project.
The GoTo Folder package by freewizard may do something similar to what you're looking for, but I had trouble getting it to work. Maybe you'll have more success.
Good luck!

How does Eclipse do code completion specific to third-party frameworks?

How does the Eclipse editor work to enable code completion? For example, within the XML editor for Hibernate property files, if I ctrl-space within a tag, a list of possible value relevant to hibernate will show up.
I understand that the XML editor is pre-configured to understand xml tag, but how about tag specific to a particular framework? How does Eclipse know about that?
I believe that the eclipse XML editor gets the content assist information from any referenced DTDs, or XMLSchema information it associates with the XML file. Try this experiment: Remove the DOCTYPE entry at the beginning of the file and see if content assist still works.
If you're interested in writing your own content assistants, you may want to start by reading the following:
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/editors_contentassist.htm
In a nutshell, like most things in Eclipse, this is a platform hook. When you press the button, it queries all the registered assistants (I'm simplifying here), and they provide suggestions based on the current element or even the current content.
When writing a source editor or viewer for a particular language or document type, it is common to provide at least some rudimentary content assistants.
Removed the DOCTYPE entry at the beginning of the file and im now able to see the commands while typing ctrl+space...
To add to Uri's answer, you can define your own editor for your own language with XText as long as you have a simple EBNF grammar language for your DSL (domain specific language).
You will have:
syntax coloring,
model navigation (F3, etc.),
code completion,
outline view, and
code templates.
Here is a solution you can work. Actually I was facing a same problem with struts.xml file. I was not able to produce tags by cntrl+space
what i did was...
go to Preferences...Java...Editor...Content Assist...Advanced
check all the check-boxes ON and press OK.
sometimes the problem persists due to some false alarming in eclipse. If it happens, just delete your xml file and create a new one in same location.
I hope it will help.
I had the same issue while using the struts.xml file.
I got fix when I tried below...
Go to “Preferences>Java>Editor>Content Assist>Advanced“. Make sure “Java Non Types Proposals” are ticked on both the places as shown in the image below then click Apply and OK button:-

Insert template into every source file in an Eclipse project?

Is there a tool, option or script to insert a custom template into the header of every existing source file within an Eclipse project?`
Some background information
I have very recently open-sourced a small application written for a university assignment. Initially the source files did not require any explicit license or author information. But now I am releasing the code I would like to place this information in the header of each Java source file.
I know Eclipse has the capability of inserting a custom template in each new file, and I will be doing this from now on. But there is around 60 existing .java files within which I wish to place this header. While that is not a huge number, I really don't fancy repeating the same cut and paste operation 60 times if there's a lazier way to do it.
P.S. I couldn't think up any better tags for this question, suggestions welcome.
You may want to check out JAutodoc on sourceforge. http://jautodoc.sourceforge.net/
Specifically, check out the section entitled File Header
Hope this helps.