Create a new toolbar

I've seen some general descriptions of how to create a new toolbar, but can someone be more specific? I want to add a toolbar, and then put a JList into that toolbar to display something. How would this be done?

6 comments
Comment actions Permalink

Basically, I've extended AnAction. Now that I have extended that, what must I do next?

0
Comment actions Permalink

Figured it out. This creates a drop-down that displays the menu item for invoking the action, so you would use this instead of AnAction:

public class YouTubeAction extends ComboBoxAction {

public void actionPerformed(AnActionEvent e) {
Application application = ApplicationManager.getApplication();
YouTubeApplicationComponent youTubeComponent = application.getComponent(YouTubeApplicationComponent.class);
youTubeComponent.searchYouTube();
}

@NotNull
protected DefaultActionGroup createPopupActionGroup(JComponent jComponent) {
DefaultActionGroup group = new DefaultActionGroup();
group.add(ActionManager.getInstance().getAction("SearchYouTube"));
return group;
}

}

Another method on ComboBoxAction is this one, which can return any kind of JComponent:

public JComponent createCustomComponent(Presentation presentation) {
return super.createCustomComponent(presentation);
}

I learnt a lot from this thread:

http://intellij.net/forums/thread.jspa?messageID=5203185&#5203185

0
Comment actions Permalink

Hello geertjan,

Basically, I've extended AnAction. Now that I have extended that, what
must I do next?


From reading your tutorial at jetbrains.dzone.com, I assume you actually
need a tool_window_ rather than a tool_bar_? I don't quite understand how
the list of search results could be displayed in a toolbar. :)

If you need a toolwindow, your starting point should be the examples/toolWindow
sample plugin in the Plugin Development Kit. It shows you the basic steps
for creating a toolwindow.

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Hi Dmitry,

This is what I mean:

http://blogs.sun.com/geertjan/resource/youtube-movies-in-intellij-toolbar.png

Now, is there a way to open an external browser from one of the IntelliJ APIs? That would be great because then the selected movie would be openable and one could watch it right away.

0
Comment actions Permalink

Hello geertjan,

Hi Dmitry,

This is what I mean:

http://blogs.sun.com/geertjan/resource/youtube-movies-in-intellij-tool
bar.png


OK, I see now. :)

Now, is there a way to open an external browser from one of the
IntelliJ APIs? That would be great because then the selected movie
would be openable and one could watch it right away.


BrowserUtil.launchBrowser()

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Hi Geerjan,

This is what I mean:
http://blogs.sun.com/geertjan/resource/youtube-movies-in-intellij-toolbar.png

Thank you very much for your tutorial.

I always enjoyed you tutorials(and book :) ) about NB, and I'm very glad you are writing
some articles for IntelliJ too.

Please do more articles.

Thanks in advance,

Ahmed.

0

Please sign in to leave a comment.