Method Chooser in Intellij IDEA plugin - intellij-plugin

I'm developing plugin for IDEA. It need to select public abstract methods with no parameters, and allow user to choose subset of them. I found MemberChooser dialog, but cannot see similar thing for methods.
So if I have List<PsiMethod> how to show dialog for choosing subset of them?

You can use MemberChooser.selectElements with your list.
That is, if you create a PsiMethodMember from each PsiMethod.

Related

Intellisense - deduce right Class by its methods

I'm used to work with NetBeans and now I'm trying IntelliJ. So my question is: Does IntelliJ has a way to get right class by its methods?
For example, in NetBeans if I write:
glGenBu // Intellisense will kick in and will suggest me
to use GL15.glGenBuffers() method from GL15 class
This will automatically import the right library.
This is very handy because I'm working with LWJGL and it has a bad way to manage OpenGL methods ('GLXX' where XX is the version of OpenGL and all methods that appeared in that version are stored in that class) and I never remember the right class where my desired method is.
Thank you.
Pressing Ctrl+Space when you already see completion list will show more suggestions, with static methods from the entire project among them. See https://www.jetbrains.com/help/idea/auto-completing-code.html for more details.

How can I add custom sorting to commonNavigator in an Eclipse plug-in?

I am trying to create an Eclipse plugin that contains a commonNavigator extension.
I can't figure out how to override the default alphabetical sorting. I want element type A to be before all the elements of type B. When I return the children of an element, I return them in the order that I want them, but they are displayed sorted.
I've seen a few really old tutorials that talk about a customSorter, but I am having trouble implementing it. This tutorial says to create it through plugin.xml, but when I try, I can only create a generic element, not a customSorter. I think it must be outdated because it didn't work even with the code that came with the tutorial.
Any tips?

What is the AlertOverride class used for in WebDriver?

In Selenium 2.0 there is a class I've seen used with WebDriverCommandProcessor called AlertOveride. Unfortunately I cannot seem to find any documentation around this class, does anyone have any knowledge of what the class is meant to be used for?
Looking at the JavaScript in the file it seems that this class is responsible for overriding the alert and confirm boxes that we would typically see when invoked in the application under test. The way selenium works it was unable to interact with those modal boxes, hence the need to override their defaults. I don't see a way to override that functionality (although it might be doable with a DesiredCapability).
I'm guessing that one of the first things the WebDriver instance does upon loading a page is invoking the methods in the AlertOverride class, so that we can get a handle on alerts/confirmations as soon as possible. This would also make sense as to why we can't get a handle on confirmation boxes that are created on the onload functions.

Pharo/Squeak - How do I quickly browse the implementation of a given method in a given class?

Let's say I want to see how "copy" is implemented in the Dictionary class. Currently I use the system browser and manually traverse the inheritance hierarchy (bottom up) until I find the class that implements the given message. Is there a one-liner for the workspace, that would open the system browser at the right location?
( SomeClass whichClassIncludesSelector: #initialize ) browse
That will browse the class that implements the message #initialize.
Personally, I just type the #selector in a workspace, highlight it, and hit alt+m to pull up all implementors of the message. Much faster than typing all that code.
(SomeClass>>#someSelector) browse
works as well in my Pharo image.
works as well in my Pharo image.
And since you want to find a class first, you can combine it with previous example..
((SomeSubclass whichClassIncludesSelector: #someSelector)>>#someSelector) browse
to directly go to given method.
If you are using OmniBrowser, you can use the contextual menu Implementors in Hierarchy... to only browse the implementors of a selector in the hierarchy of the Dictionary.
OmniBrowser also provides an Inheritance Browser. Select any implementation of #copy and click on the Inheritance button in the toolbar. It will show you a hierarchical view of all implementors of #copy.

How do I remove icons from menu items in an Eclipse RCP-based application?

I am working on an Eclipse RCP-based application, and we have decided that we do not want any of the menu items to display icons next to the text. The problem we are seeing is that the standard actions like Undo, Redo, Cut, Copy, Paste, and so on all display the default icons for the corresponding actions.
Is there any way to tell the action management infrastructure to ignore the icons? My brute force solution to this was to rebuild the SWT so that MenuItem.setImage() was a no-op, and then include our own copy of the SWT in the final product, but it seems like there should be a lighter-weight solution.
This turned out to be easier than I had hoped.
Create a subclass of org.eclipse.ui.application.ActionBarAdvisor. Override the method register like this:
protected void register(IAction action) {
super.register(action);
action.setImageDescriptor(null);
}
Then, create a subclass of org.eclipse.ui.application.WorkbenchWindowAdvisor that overrides createActionBarAdvisor:
public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) {
return new MyActionBarAdvisor(configurer);
}
That's it. All actions will no longer have icons.
I believe you want to further examine going into the manifest and looking into
org.eclipse.ui.views and seeing if there is anything in there for removing icons
What is the reason for not including icons?
A lot of effort went into creating a standard interface, what would be the benefit of deviating from the standard? Do you think their omission increases usability?
Having said all that you could try contributing a fragment with some AspectJ around advice to intercept calls to setImage() and veto them.
You can do this by going to the extension tab in plugin.xml.add the extension org.eclipse.ui.menu (if not present).Right click create a new menu contribution.again right click and create a new menu.here u have the option to change the images with the ones saved in your icon folder in your class path