[ANN] GoToClass plugin v0.1 (with wildcards)

Go to Class (accepts wildcard's in search) plugin v0.1
This action plugin is used to go to classes like IDEA's default go to class action. Except this action can use wildcards in the search for classes.
Searching for all your bean classes is easy as just to type *bean in the input field. You can use more wildcards in the search so a *pluginaction* will find all classes that has plugin and action in it's name.

Usage
The action is installed in the go to menu. And can be invoked with ALT N.

Todo
Since it's an alpha version, there is some work to be done.
- Better GUI. Anyone a Swing expert who wanna help???
- To function more like IDEA's go to Class.
- Peformance improvents. This action gathers all the class information each time it's invoked. Maybe somekind of caching and hook to some of IDEA's listeners to be notified with filechanges and editor changes to mark a flag for reload.
- Uses hardcoded colors as the default IDEA theme. Should use the same color constant's as IDEA does. Anyone know where to get these informations?
- Other features you need?



http://www.intellij.org/twiki/bin/view/Main/GoToClassPlugin

14 comments
Comment actions Permalink

Claus, can you add WebForm to you plugin?
Get more information on:
http://www.intellij.org/twiki/bin/view/Main/IntelliJPluginsHome#IntelliJ_Plu
gin_Packages

Thanks!

--
Alexey Efimov, Software Engineer
Sputnik Labs,
http://www.spklabs.com
"Claus Ibsen" <cib_rejse@yahoo.dk> wrote in message
news:5515298.1038577113911.JavaMail.jrun@is.intellij.net...

Go to Class (accepts wildcard's in search) plugin v0.1
This action plugin is used to go to classes like IDEA's default go to

class action. Except this action can use wildcards in the search for
classes.

Searching for all your bean classes is easy as just to type *bean

in the input field. You can use more wildcards in the search so a
*pluginaction* will find all classes that has plugin and action in
it's name.
>

Usage
The action is installed in the go to menu. And can be invoked with *ALT

N*.
>

Todo
Since it's an alpha version, there is some work to be done.
- Better GUI. Anyone a Swing expert who wanna help???
- To function more like IDEA's go to Class.
- Peformance improvents. This action gathers all the class information

each time it's invoked. Maybe somekind of caching and hook to some of IDEA's
listeners to be notified with filechanges and editor changes to mark a flag
for reload.

- Uses hardcoded colors as the default IDEA theme. Should use the same

color constant's as IDEA does. Anyone know where to get these informations?

- Other features you need?

>
>
>

http://www.intellij.org/twiki/bin/view/Main/GoToClassPlugin



0
Comment actions Permalink

Nice one!

Unfortunately, I get this trace produced in the IDEA console and the action
isn't in the Go to menu...

ERROR - nSystem.impl.ActionManagerImpl - action with the ID
"Actions.
ActionsPlugin.LECGroup" was already registered. Registered action is
com.intelli
j.openapi.actionSystem.DefaultActionGroup@d9cbcb
ERROR - nSystem.impl.ActionManagerImpl - IntelliJ IDEA 3.0 Build
#68
3
ERROR - nSystem.impl.ActionManagerImpl - JDK: 1.4.1_01
ERROR - nSystem.impl.ActionManagerImpl - VM: Java HotSpot(TM)
Client
VM
ERROR - nSystem.impl.ActionManagerImpl - Vendor: Sun Microsystems
Inc
.
ERROR - nSystem.impl.ActionManagerImpl - OS: Windows XP
ERROR - nSystem.impl.ActionManagerImpl - Last Action:
ERROR - nSystem.impl.ActionManagerImpl -
java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:45)
at com.intellij.openapi.actionSystem.b.a.registerAction(a.java:357)
at com.intellij.openapi.actionSystem.b.a.c(a.java:306)
at com.intellij.openapi.actionSystem.b.a.a(a.java:366)
at com.intellij.idea.v.r(v.java:15)
at com.intellij.idea.v.g(v.java:19)
at com.intellij.idea.v.a(v.java:59)
at com.intellij.idea.o.run(o.java:1)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Claus Ibsen wrote:

Go to Class (accepts wildcard's in search) plugin v0.1
This action plugin is used to go to classes like IDEA's default go to
class action. Except this action can use wildcards in the search for
classes. Searching for all your bean classes is easy as just to type
*bean in the input field. You can use more wildcards in the
search so a *pluginaction* will find all classes that has
plugin and action in it's name.

>

Usage
The action is installed in the go to menu. And can be invoked with
ALT N.

>

Todo
Since it's an alpha version, there is some work to be done.
- Better GUI. Anyone a Swing expert who wanna help???
- To function more like IDEA's go to Class.
- Peformance improvents. This action gathers all the class
information each time it's invoked. Maybe somekind of caching and
hook to some of IDEA's listeners to be notified with filechanges and
editor changes to mark a flag for reload.
- Uses hardcoded colors as the default IDEA theme. Should use the
same color constant's as IDEA does. Anyone know where to get these
informations?
- Other features you need?

>
>
>

http://www.intellij.org/twiki/bin/view/Main/GoToClassPlugin




0
Comment actions Permalink

Thanks for the info. It's done now.

0
Comment actions Permalink

Ahh that's because you also have my other plugin installed: GenerateToString. Is that right?

I reused the plugin.xml file. Will fix it now.

/Claus

0
Comment actions Permalink

Yes that's right :)

Claus Ibsen wrote:

Ahh that's because you also have my other plugin installed:
GenerateToString. Is that right?

>

I reused the plugin.xml file. Will fix it now.

>

/Claus



0
Comment actions Permalink

Hi,

Your plugin will not behave good on any project of decent size. Accessing
all psi files would load all files in memory & parse them into source tree.
Consider using PsiShortNamesCache.
--
Best regards,
Mike Aizatsky.
-


JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"


0
Comment actions Permalink

Woudln't it be easier for you guys quickly to add the wildcard search in your dialog :)

Thanks for the tip about the cache, will investigate it.

About this cache. Can I use it to:
- get all the names of the classes in the project?
- determine if a class is from a writeable directory? (a class that the user is developing)
- get the packagename of the class.
- get the file the class belongs to.

And will the cache be up-to-date with user editing? If the user creates a new class in the editor? Well do you guys use this cache for your go to Class?

/Claus

0
Comment actions Permalink

v0.11 is uploaded

0
Comment actions Permalink

Hi,

Your plugin will not behave good on any project of
decent size. Accessing
all psi files would load all files in memory & parse
them into source tree.
Consider using PsiShortNamesCache.

The methods I can invoke on the PsiShortNamesCache are:


And they all returns arrays of either String, PsiClass or PsiFile. So I can't see how this API can help performin a wildcard search for classes and also get information about the file this classes is stored in, so I can load it in the editor?

But you guys use this API for your go to Class?


/Claus

0
Comment actions Permalink
         cache.getClassesByName(String)
>         cache.getClassesByName(String, int)
>         cache.getClassNames()
>         cache.getClassNames(String, boolean)
>         cache.getFileNames()
>         cache.getFileNames(String, boolean)
>         cache.getFilesByName()
>         cache.isReady()]]>

Any help what the parameter's are used for?

/Claus

0
Comment actions Permalink

And they all returns arrays of either String, PsiClass or PsiFile. So I

can't see how this API can help performin a wildcard search for classes and
also get information about the file this classes is stored in, so I can load
it in the editor?

I think the following method (in the same interface) might help you:

String[] getClassNames();

>

But you guys use this API for your go to Class?


Yes, we do.

And they all returns arrays of either String, PsiClass or PsiFile. So I

can't see how this API can help performin a wildcard search for classes and
also get information about the file this classes is stored in, so I can load
it in the editor?

String parameters in the mentioned methods means "prefix", boolean parameter
means "case sensitive" (for the prefix).

--
Valentin Kipiatkov
JetBrains, Inc
http://www.intellij.com
"Develop with pleasure!"


"Claus Ibsen" <cib_rejse@yahoo.dk> wrote in message
news:424467.1038581666437.JavaMail.jrun@is.intellij.net...

Hi,

>

Your plugin will not behave good on any project of
decent size. Accessing
all psi files would load all files in memory & parse
them into source tree.
Consider using PsiShortNamesCache.

The methods I can invoke on the PsiShortNamesCache are:

>

         cache.getClassesByName(String)
>         cache.getClassesByName(String, int)
>         cache.getClassNames()
>         cache.getClassNames(String, boolean)
>         cache.getFileNames()
>         cache.getFileNames(String, boolean)
>         cache.getFilesByName()
>         cache.isReady()]]>

>

And they all returns arrays of either String, PsiClass or PsiFile. So I

can't see how this API can help performin a wildcard search for classes and
also get information about the file this classes is stored in, so I can load
it in the editor?
>

But you guys use this API for your go to Class?

>
>

/Claus



0
Comment actions Permalink

String parameters in the mentioned methods means
"prefix", boolean parameter
means "case sensitive" (for the prefix).

Thanks alot.

I tink I can use the method that returns the PisClass[]. And I recall there was a method somewhere called isFromJDK I might use to filter the classes from the JDK.

Will work on the plugin tonight when I got some time.

/Claus

0
Comment actions Permalink

Your plugin will not behave good on any project of
decent size. Accessing
all psi files would load all files in memory & parse
them into source tree.
Consider using PsiShortNamesCache.

I added all the source code to JBoss 3.04 to my project and had this performance times



So the first time the dialog is invoked all the files is loaded as you say and it took 28sek.

But the next time the action is performed the initialization only takes 32msec, since all the files are cached in IDEA.

I have also tried your shortname cache but the problem is that:


the only method to return PsiClass[] must accepts a search parameter. You can't use null or an empty string in this parameter to get all the classes and then do the regexp. matching.


And the other methods that return a classname as is not a name included packagename, so you can get ambigous names (ex List from java.util and java.awt).

/Claus

0
Comment actions Permalink

Damm the message looked alright in preview mode.

Your plugin will not behave good on any project of
decent size. Accessing
all psi files would load all files in memory &

parse

them into source tree.
Consider using PsiShortNamesCache.

I added all the source code to JBoss 3.04 to my
project and had this performance times

GoToClassAction: found source classes: 3291 > GoToClassAction: timetaken: 27843 msec. > GoToClassAction.actionPerformed > GoToClassAction: found source classes: 3291 > GoToClassAction: timetaken: 32 msec.]]>

So the first time the dialog is invoked all the files
is loaded as you say and it took 28sek.

But the next time the action is performed the
initialization only takes 32msec, since all the files
are cached in IDEA.

I have also tried your shortname cache but the
problem is that:

 cache.getClassesByName("");
> for (int i = 0, j = 0; i < classes.length;
> length; i++) {
>             PsiClass aClass = classes+;
> System.out.println("no " + j++ + " - " +
> + + " - " + aClass.getQualifiedName());
>             if (! manager.isFromJdk(aClass)) {
> System.out.println("is not from
> ln("is not from JDK");
>             }
>         }]]>


the only method to return PsiClass[] must accepts a
search parameter. You can't use null or an empty
string in this parameter to get all the classes and
then do the regexp. matching.



And the other methods that return a classname as
is not a name included
packagename, so you can get ambigous names (ex List
from java.util and java.awt).

/Claus


0

Please sign in to leave a comment.