Article | Auto-Format in NetBeans

Hey,

Today, I started off working with JSF Framework, executed a series of well-described, neat tutorials which helped me go through the initial phase easily. Now, I am confident in doing what these tutorials explained.

Anyways, I came across a shortcut key, its Alt+Shift+F, used for Formatting the code present in the editor. Today, I used this key combo, in JSP using JSF Framework and Java Classes, as well.

Remember, how shortcut key’s are registered? This means this action is registered in the XML Layer of some module, as O-S-F.shadow! Anyways, that’s a different issue. Well, seriously I feel why the hell I came across this key, so late…It could have helped me save a lot of time, in many Java Projects I made using NetBeans!

eNjoy Technology…

Advertisements

Whats the Surprise?

Hey,

Remember the recent blog series I started on hacking XML Layer in NetBeans Module Development, I told ya that I have a surprise for you people, i.e. the plugin I was working upon.

Time to unveil it to you, actually its been out since yesterday, see this blog entry- http://novicenetbeans.blogspot.com/2008/06/netbeans-snap-it.html

Yes, the snapshots you see my recent series of documentations either on blog OR NetBeans Zone, about XML Layer!

They were taken by Snap It!

Yes, Snap It, its a plugin that enables you to take screenshots from within the IDE. Basically, it tries to emulate the “Take Screenshot” Utility, bundled with almost every Ubuntu Distro. Hey, I saw it on OpenSolaris 2008.05 as well.

So, if its present on your Unix-compliant OS too, you would know, what this plugin do! Anyways, Jay and I, have developed this plugin. So, any queries, suggestions are always welcome!

Currently, plugin works only for Linux, Windows. If it works on your Mac, or OpenSolaris! Do notify us, we would love to hear your problems and rectify them ASAP 🙂

sTay Tuned for More…

NetBeans Zone | Everyone’s Playing

Guys,

Its been a hectic week for me, its just the 4th day of the week, and I am documenting a lot. Though, I made a comeback on this blog, out-of-the-blue! However, I’m enjoying it now, so does the NetBeans Zone users, who are enjoying playing with XML Layer!

How?

I wrote a blog entry, basically another edition of tips and Tricks, this time focus being on NetBeans Platform, and that too, primarily on XML Layer, which is an optional configuration file, for registering actions into the IDE, and much more than that, I guess!

I consulted Geertjan Wielenga, for reposting that entry into NetBeans Zone! He gave me a green signal, so I reposted it here – http://netbeans.dzone.com/tips/play-with-xml-layer

It was made public there since yesterday, and I am so happy to see the response, nearly 200 views, 13 Votes Up, No Votes Down! What else, you could ask for? Its titled, “Playing with NetBeans XML Layer Files (Part 1)“. Yes, 2nd part coming soon…Its pending moderation, I guess it would be publish there within this week.

Now, what?

I did blog that on Monday, and within 3 days, I am out with its 2nd part, planning a 3rd part, as well as, contributed 4 tutorials (based on all this stuff) to the NetBeans Community Docs, today! See, how much documenting is taking place, since Monday morning!

Three parts which are being blogged here, would eventually end up in NetBeans Community Docs, expanded into numerous HowTo’s. So, by this weekend you would see, great rush of blogs, tutorials, tips and tricks, howTo’s, and obviously more contributions from community bloggers! Have a look at the updated page on this blog!

FAQs. Do you have the answers? Add them to the User FAQ wiki page or write a short HowTo and link it here.

Thank You!

We are still accepting your contributions for Community Docs, where are you people, c’mon talk to us, have any problem contributing, discuss with us, atleast send in your blog URL to us, so that we can add your feeds to our personal blogs aggregator! Read more…

sTay Tuned for More…

NetBeans Quiz | End Is Near | 6

Hey,

Finally, this bi-weekly series coming to an end, so is the NetBeans Quizzes! Yes, last quiz- Quiz 11 is in progress, what are you upto? Coding, Relaxing, Tweeting, blogging, how about testing your IQ (with this fun-filled Tech Quiz) one last time! Yes, its coming to an end, and after 2 weeks result would be announced. So, my last 2 blogs in this series would unveil the Grand Prize Winner!

Week 9 –
Winner: Petr Hejkal, Prize: Nokia E 61i Mobilephone

Week 10 –
Winner: Till Woerner, Prize: LG 32″ Plasma TV

Its damn easy! A quick reminder to all, you could still be a part of these quizzes, just download Quiz Plugin from Plugin Manager using NetBeans IDE and participate in the current, as well as, any pervious quizzes that you might have left out. No more quizzing after 30th June!

Best of luck & Happy NetBeaning!

NetBeans Quizzes – brought to you by NetBeans Guru!

Add to Technorati Favorites

taT | Play with XML Layer (Part 2)

Wow!

I am really enjoying playing with XML Layer. I had mentioned an important note in my previous blog entry- Part One of this series! Its time to work with the CookieAction, i.e. make some Conditionally Enabled Actions and play with it.

By the way, I came to know, that CookieAction does support Shortcut Keys, however I used to think it doesn’t as it was always disabled, when I used Action Wizard to create it.
Its a bug, that’s present since 5.5 and I never realised- I have filed a bug report!

Pre-requisites

Read my previous blog entry- Part One of this series! You should be thorough with all that was explained previously. If not, get it clarified by me OR on Netbeans Community mailing lists.

Problem Description

Here, we are going to transform an Action from one type to another, i.e. from CallableSystemAction TO CookieAction, sounds cool! Though, never tried. Well, here I am sharing with you another trick to make it possible, without using New File Type Wizard. We will make use of SayCheez.java, which was made in previous entry.

Solution

So, to start with, remove the CallableSystemAction and let the class SayCheez extend CookieAction, like this;

public final class SayCheez extends CookieAction {

Now, don’t remove the already existing implementations of abstract methods of CallableSystemAction, just add following two to let the class SayCheez implement all the abstract methods defined by CookieAction.

@Override
protected Class<?>[] cookieClasses() {
return new Class[]{{$Interface}.class};
}

protected int mode() {
return CookieAction.{$mode};
}

Please note, that {$Interface} needs to be replaced by appropriate interface, i.e. it could be either of the following Cookie class(es), which are basically interfaces/abstract class(es);

  1. Project
  2. OpenCookie
  3. EditCookie
  4. EditorCookie
  5. DataObject (Abstract Class, NOT an Interface)

Also, {$mode} needs to be replaced with either MODE_EXACTLY_ONE[1] or MODE_ALL[2].

  1. User Selects One Node
  2. User May Select Multiple Nodes

MODE_EXACTLY_ONE –
Action will be enabled if there is exactly one selected node and it supports the given cookies.

MODE_ALL –
Action will be enabled if there are one or more selected nodes and all of them support the given cookies.

In our case, its EditorCookie!

Now, alter the performAction method like this,

protected void performAction(Node[] activatedNodes) {
{$Interface} ref = activatedNodes[0].getLookup().lookup({$Interface}.class);
// TODO use {$Interface}
}

Here, ref is basically the reference to either the interface/class being made, which is being assigned a subclass reference, it could be of great use. Now, add your code for DialogDisplayer used in previous blog entry, in place of TODO comment.

See, it was too easy! Anyways, the changes in XML Layer, which shall be done with respect to the change in the Action type, some of them are as follows and rest will be the mentioned in the next part of this series.

Tricks for Menu Item, Toolbar Button, Shortcut Keys

Trick #1 – If you had made a Global Menu Item OR Toolbar Button with CallableSystemAction, then no changes required.

Trick #2 – If you had made use of Shortcut Keys earlier, now you have to remove them, as CookieAction doesn’t support Shortcut Keys! Well, I don’t know why. So, remove following code from our XML Layer, formed earlier.

Thanks for following, enjoy and have fun! Surprise to be revealed soon…keep an eye on my blog!

Previously posted on NetBeans Zone –
Playing with NetBeans XML Layer Files (Part 1)

Add to Technorati Favorites

sTay Tuned for More…