Intellisense - deduce right Class by its methods - intellij-idea

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.

Related

Why doesn't Xcode suggest #synchronized?

I only rarely use #synchronized, but as far as I can remember (meaning around Xcode 3.2 or something), it never suggested #synchronized when using the auto-completion, and still never does.
I do get suggestions when typing '#', like #autorelease, #encode, #selector and so forth.
Is there any known reason for this ? I wasn't able to find any related topic. It's been bugging me, because it gives me the feeling that this is not a valid method to handle concurrency in iOS.
#synchronized does not appear when using auto-completion because Apple has not mapped that keyword to any code sense implementation.
Per Apple's suggestion, I have filed a bug report.
However, I can offer an auto-complete solution.
You may create an #synchronized snippet that can be auto-completed or drag and dropped into your code.
Copy/paste the code below into one of your Xcode documents.
Select the new code and drag it to your snippets library.
Double-click the new snippet and click edit.
Enter #synchronized for the completion shortcut.
For more info: http://nshipster.com/xcode-snippets/
#synchronized(anObj) {
// Everything between the braces is protected by the #synchronized directive.
}

How to decorate Objective C methods with documentation?

When I'm typing up a Cocoa object and calling a selector on that object, I sometimes can see 'documentation' or 'help' information about that method. For instance, as I type [NSArray alloc], I see two help hints. One for NSArray, and one for alloc. Both of these appear in the popup autocomplete suggestions listbox as I type the code.
How do I produce similar method/class decorated help hints which will appear when I type? I want to see my comments as I type my custom class name and custom methods. How can I do this?
For instance, C# provides this feature through XML documentation which can be placed before any method, class, or interface/protocol declaration.
You have to create a “docset”. There are tools like appledoc for creating docsets from your comments. You could set up a build phase that runs appledoc on your code.
The problem is that there's no way to make Xcode 4 reload a docset except by restarting Xcode. So even if you run appledoc automatically as part of your build, you will have to restart Xcode to make it see the changes to your docset.

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.

Showing inherited methods in Squeak/Pharo Smalltalk

I'm familiar with the VisualWorks and Dolphin versions of Smalltalk, but have not previously used Squeak. I'm just familiarising myself with Pharo, which is a 'cleaned up' fork of Squeak.
I'm used to having the facility in the Class Browser to show either only the methods implemented by a class or both the methods inherited and the methods implemented.
Is this useful facility missing in Squeak, or have I just been unable to find it?
You can double-click on any class to open a Hierarchy Browser on that particular class. The hierarchy button in the toolbar and the menu entry browse hierarchy (Ctrl+H) open the same view.
There is the Inheritance Browser that shows you the hierarchal implementations of the currently selected method. Click on the inheritance button in the toolbar.
Furthermore there is the Protocol Browser that displays all methods and super methods of a class together. To open this browser select browse protocol (Ctrl+Shift+P) in the context menu of the class.
If you want to build a browser with that behaviour, you should take a look at the Glamour browser construction DSL.
I personally do not feel the need to see all 34 pages of method names defined in ProtoObject and Object, or the 5 pages of method categories. Object methods size prints 421.
AFAIK in the GemStoneTool there is such a thing, thre is a 1 or so and a # which seems to change the view to see all the methods available in a class (be it inherited or in the class itself) I'm as amazed as you that nothing like that exists in "standard images". Maybe the users know the libraries for ages, and maybe they remember enough to not bother. ....

Is there a key combination in Xcode to implement a Protocol?

In Visual Studio if I define a class to implement an interface e.g.
class MyObject : ISerializable {}
I am able to right click on ISerializable, select "Implement Interface" from the context menu and see the appropriate methods appear in my class definition.
class MyObject : ISerializable {
#region ISerializable Members
public void GetObjectData(SerializationInfo info,
StreamingContext context)
{
throw new NotImplementedException();
}
#endregion
}
Is there anything anything like this functionality available in Xcode on the Mac? I would like to be able to automatically implement Protocols in this way. Maybe with the optional methods generated but commented out.
XCode currently does not support that kind of automation. But: an easy way to get your code bootstrapped with a protocol is to option-click the protocol name in your class declaration
#interface FooAppDelegate : NSObject <NSApplicationDelegate,
NSTableViewDelegate> {
to quickly open the .h file defining the protocol. From there, copy and paste the methods you're interested in. Those headers tend to be well-commented, which helps in determining which methods you can safely ignore.
I have not seen that feature in Xcode.
But it seems like someone could write a new user script called "Place Implementor Defs on Clipboard" that sits inside of Scripts > Code.
You did not find this useful.
There is not currently such a refactoring in Xcode.
If you'd like it, please file an enhancement request.
I know this thread s a bit old, but I wondered the same thing and found this question.
In my case, I'm defining a property in the interface (.h) and I want to synthesize it in the implementation (.m). I also need to implement methods defined in the interface. Yes, Xcode helps as others have mentioned, but modern IDEs offer these productivity enhancements for things we do frequently. It appears that this is still not a feature in Xcode 4.3.3. However, the feature is available in JetBrains' AppCode. I'm only dabbling with the trial, but it appears to only be possible one property or method at a time, not the whole interface like Visual Studio.
Xcode can help you per protocol method, lets say you have a protocol like this:
#protocol PosterousWebsitesDelegate <NSObject>
- (void)PosterousWebsitesLoadSuccess:(PosterousWebsites*)websites;
#end
in the #implementation section of your .m file you can start writing the name of the method and pressing ESC key to autocomplete the signature of the method/selector:
-(void)Poste (...press ESC...)
Xcode will autocomplete a full signature of the #protocol method, pres TAB to confirm the code.
If you are really committing to learn OSX/iOS Development, I would recommend you to read "XCode 3 Unleashed", a book that really helped me to know Xcode as deep as I know VS :)
check this plugin
https://github.com/music4kid/FastStub-Xcode
it does the thing that you are asking for and more.
Macrumors had a discussion on this too. There is a link to some apple scripts. I haven't actually tried these.