07.25.08

Day, full of news!

Posted in NetBeans, NetCAT, Personal at 8:03 pm by Varun

Bravo!

Today, the NetBeans Dream Team page was updated, and I am now one of them. Yes, I was invited to join the team, and had accepted the offer. So, here I am as a NetBeans Community Docs Contribution Coordinator and Dream Team Member!

Second, Jiri Kovalsky, the Liaison officer, Technical Community Manager and NetCAT 6.5 Coordinator. List is surely long and I am sorry If I missed something ;)

Highest Scorer

Today, he announced on demand of certain NetCAT participants, the points earned by every member. It was another shocker for me! I scored 83 points as of 25th July, 3:00 pm C.E.T.

Simply awesome! NetCAT has just completed 2 weeks, we are in for some more surprises, so wait till monday as I come out with 2nd edition of my own NetCAT weekly.

Summer Action Marathon continues…

taT | Editor Windows Reactivated!

Posted in Java, NetBeans, Platform, Tips|Tricks at 2:14 pm by Varun

Hey,

I have been blogging around for a while on hyperlinks in NetBeans IDE, what about the API’s, yeah the NetBeans API’s that helped me achieve a crucial milestone, i.e. activating the Opened panes! Also, the members of OpenIDE mailing lists, for giving accurate suggestions for making it possible.

Tricks

You must see numerous Developer FAQ’s based on Editor and Edited Files. Some of them referring to get access of relevant opened Window for editing. Still, something was missing. So, I would share what I experienced recently.

TopComponent[] comps = TopComponent.getRegistry().getOpened();
for (int i = 0; i < comps.length; i++) {
    Node[] arr = comps[i].getActivatedNodes();
    for (int j = 0; j < arr.length; j++) {
        EditorCookie ec = (EditorCookie)
arr[j].getCookie(EditorCookie.class);
        if (ec != null) {
            JEditorPane[] panes = ec.getOpenedPanes();
            if (panes != null) {
                // USE panes
            }
        }
    }
}

This has one issue, it no longers returns an array of TopComponent’s in the 1st line, in 6.0 and 6.1, I saw it returned Set<TopComponent>, so outer loop also changes like this-

Set<TopComponent> comps = TopComponent.getRegistry().getOpened();
for (TopComponent tc: comps) {
    Node[] arr = tc.getActivatedNodes();
    for (int j = 0; j < arr.length; j++) {
        EditorCookie ec = (EditorCookie)
arr[j].getCookie(EditorCookie.class);
        if (ec != null) {
            JEditorPane[] panes = ec.getOpenedPanes();
            if (panes != null) {
                // USE panes
            }
        }
    }
}

What about My Usecase?

Oh, yeah! I wanted to tell you about re-activating opened panes. After interacting with Wade on OpenIDE mailing lists. I created this method- verifyHyperlinkStatus(), please have a look, you might have to scroll a bit. So, I have commented 2 lines there-

//final int index = k;
/*
After some coding...
*/
//tc[index].requestActive();

tc[index] is a particular TopComponent instance obtained by iterating over an Array of TopComponent’s. Array? But, we have just discussed its Set<TopComponent> not an Array. You’re in for another surprise-

//To obtain an array, use this-
final TopComponent[] tc = TopComponent.getRegistry().
getOpened().toArray(new TopComponent[0]);
//As mentioned in the following reference tutorial.

Referenced Tutorial- http://wiki.netbeans.org/RevampedHyperlinkNavigation

final, but why?

Actually, when you deal with methods that required to run within a AWT Thread, invoked by various means, then the variables used, within their implemented run() method, if defined outside should be made final so as to prevent it from any modification. In Java, final modifier means that an identifier would be constant within a block of code. In this case, within a method- verifyHyperlinkStatus()

So, index was modified as final, and was used within an AWT Thread inside a if-block, which invoked tc[index].requestActive(), i.e. to activate that window, if its already opened.

Why I am doing this?

As I have to re-activate a opened editor window which was already opened by clicking a hyperlink in HTML file. So, I was earlier using setCaretPositon(), that’s why I had to requestActive(), to show that editor window again.

Tips to Remember

Vita suggested to use NbEditorUtilities instead of a combination of setCaretPosition() and requestActive(). So, I did that by commenting the following statements present in one of the setPosition() methods.

NbEditorUtilities.getLine(d, index, true).show(Line.SHOW_GOTO);
//pane[pos].setCaretPosition(index);

Here, index is found using indexOf(), and d is the document, whose contents were used to retrieve the index. This is indeed a great utility, why? Because, it opens/re-activates the opened document and places the cursor at the beginning of the line, that was searched.

Final thoughts

This time all was said and done, rather than the saying “All is said, more than done!”.

07.24.08

Hyperlink Navigation Renaissance

Posted in Community Docs, NetBeans, Platform at 8:40 pm by Varun

Howdy,

After lot of discussion on OpenIDE mailing lists, exploring Developer FAQ’s, exerting my wrist, flexing fingers and what not? Finally, hit the deck hard! Yeah, Hyperlink Navigation in NetBeans got smarter! Especially, for HTML documents.

While working on my Internship Project, I came across Hyperlink Navigation Tutorial, on platform.netbeans.org/tutorials!

Recently, I felt that the sample project needs revision, and should implement some more usecases, which are commonly used. Think about rendering of HTML pages on Web Browser, you click on an anchor name, it takes you to the exact position in either same OR referenced document. Also, when you click external links, browser opens New Tab, and presents that page.

Ever thought of having a similar functionality in NetBeans, yes your favorite IDE. Just follow the following tutorial, to master hyperlinking in the IDE.

Have a look at the tutorial-
http://wiki.netbeans.org/RevampedHyperlinkNavigation

Also, download following plugin, and it would add a sample project with all the code present in it, the one mentioned in tutorial, just Run that module, it will Install in Target Platform, and play with HTML files. Follow the instructions carefully.

Created in 6.0, compatible with 6.0, 6.1, 6.5 (daily builds)!

Samples | NetBeans Modules Project-
http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=11222

Add to Technorati Favorites

07.22.08

XML Hyperlink Project Update

Posted in DTD, NetBeans, Personal, XML, nb-61 at 5:10 pm by Varun

Recently,

I blogged about How to Hyperlink XML Layer, with the bit update on my project as well. So, DTD file, if exists, got opened when I click on ARGUMENT, opening TAG Token Id’s, like <filesystem><file name=”"></file></filesystem>

See the italics and bold faced text, they are hyperlinked. So, clicking them I am directed to the apt DTD file within the IDE. Earlier what happened, when I clicked the links again, file which is actually a TopComponent opened as Editor Window, was not requesting focus.

Navigation got smarter

However, now its working…If I click umpteen times, I will be directed to the doc same no. of times. You can get to see this feature in the Revamped Hyperlink Navigation Tutorial, based on a tutorial. I have developed a plugin for that for the time being, though expect the plugin to get updated soon.

NetBeans API’s (Lexer API) rocks!

Enjoy Technology…Enjoy NetBeans

07.21.08

NetCAT 6.5 Weekly | Report #1

Posted in NetBeans, NetCAT, Reviews, nb-65 at 11:09 am by Varun

Beginning

NetCAT 6.5 began on 15th July, I got an unexpected amount of mails, many people (incl. of me) were shocked to recieve such amount of mails. Many newbie’s are taking part this time, even I’m participating for the 1st time!

It wasn’t a problem for the experienced NetCATian’s who are actually termed as NetCAT Veterans.

What I missed…

Jiri Kovalsky, NetCAT Coordinator had given the NetCAT Team, 1st task for the week, and it was a survey, to be taken by us. However, due to some unavoidable circumstances I couldn’t fill it up. Any issues, not at all I lost a chance to gain 5 points! Anyways, more tasks to follow soon and I would hopefully complete those…

What I did…

Answered a lot of mails, queried as well! It was a breath-taking first 2-3 days! Now, I have filtered mails (on my mail account), that I don’t want to read OR irrelevant to me, with respect to this program. Also, my primary focus is on PHP and Documentation (you know why ;)). Soon, I will review docs as well, as there are no at present…

Bugs Filed-
Filed 5 bugs, 2 were resolved for duplicacy :( However, 1 of the other 3, getting approved to be fixed for the next Milestone, probably Beta version (not sure, though).

Others-
Wrote an article on my other blog- Milestone OR Daily Builds!

New Features

This section would list the features I saw during the past 1 week-

  • Milestone 1 -
    I am not using it anymore, click it for more info about the features.
  • NetBeans Platform-
    I came across 1 feature, which I had also mentioned in my Milestone blog entry, that it was a bug.
  • Actually, its not… I’m talking about “Install/Reload in Target Platform”. Its an enhancement that has been done for removing redundancy.
  • When you create a Module, and for a preview, you click on the above Menu Item for result. Though, from now on you would see it disabled, and Module will install in Target Platform, only by F6!
  • When the Module is running, see the Menu Item again, now its enabled for Reload. Cool, isn’t it?

NetBeans Builds…

DISCLAIMER
This NetCAT Weekly Report #1, is my personal report on what I experienced during a particular week.
Its not related in any respect with NetCAT organisers.

« Older entries