In Intellij Idea, how to keep showing context information? - java

I know for sure that by clicking hot key alt + q, the context of current method or class could show up just like:
But is there any way to make the IDE keep showing the context information at the top of the edit area?

You can't keep the method definition for the 'currently active' method pinned to the top of the editor but if your goal is to display the method definition for the 'currently active' method while you are editing that method then you could use the Structure tool window and select Autoscroll from source. This will show you the definition of the method you are currently editing / your cursor is currently sitting in.
Here's a screenshot:
Autoscroll from source is the last icon on the right at the top of the Structure tool window.
You can activate the Structure tool window via keystokes (e.g. ALT 7), to identify the correct keystroke just have a look at the keystroke associated with the menu item: View > Tool Windows > Structure.
More details in the docs

Related

Is there any possibility to just open a piece of code in a separate tab/section in Intellij?

I know the that we can close the sections of the code as mentioned here
Imagine a jsp file and you want to change a part of code (e.g from lines 100 -150 in 700 jsp file)
It would be easy for any one to select the code and open in any of below mentioned scenarios
popup
permanently highlight the background
new tab
Do intellij/eclipse supports any of the above mentioned feature even with plugins ?
There is no way to open only the code fold in another editor.
What I do is I split the editor, for example right-click on the editor tab and select Split Vertically or Horizontally. Then you'll get another editor window showing the same file. Expanding/collapsing code folds in one window will not affect the other window.
There is a great, related feature that however only works in specialized cases, where IDEA detects (automatically or via annotation) that a region contains another language, for example:
//language=HTML
String foo ="<div>Tralala</div>";
Here you can press alt-enter on the string and select "Edit HTML Fragment" to see only the string content in a new editor window.
In many cases IDEA automatically detects that the language, in other cases it needs help (alt-enter, then "Inject language or reference").

How do I find the bounds of a Win32 API text/edit control?

I am working on a program that will allow the user to record steps of simple tasks and then generate a file to send to people that show these steps. So if you left click on a window it will say "User Left Clicked on Google Chrome" with an appropriate screenshot and highlighted cursor for visbility.
I am using Java Native Hook Found here for the global mouse/key listeners and Java Native Access Found here to get the title of the application that is clicked.
I would like to include something that highlights an area where text is entered. At the moment I am thinking of taking a screenshot when the user clicks a textbox and then storing all the keys that are pressed (for the guide) and taking a second screenshot after the text has been input, and also adding a highlight outline around the text.
I feel like it would be easier to generate the highlighting if I could get the location of the caret but i'm not exactly sure how to do this for global applications.

Swing shows empty tooltips, how to disable this?

I'm creating a java Swing app and I'm new to that.
The problem is that when I move cursor to menu item, for example, it shows me an empty tooltip.
Is there any way to disable this?
P.S. Using NetBeans, if it's important. Maybe it generated some odd code?
Go to the properties of the menu or menu item that displays the empty tooltip and choose tooltip. Then add "null" as a String value for setTooltipText. The empty tooltip will then dissapear.
If the toolTipText property in the designer is bold (changed), you can just press the Reset to Default button at the bottom of the above window, or even right-click on said property in the list and select Restore Default Value.
I guess you're using the (now dead) Swing Application Framework. Netbeans automatically generates an entry in the properties file associated with each panel for the tooltip, with an empty value (instead of not generating the property at all if you leave the text box blank). Just remove the property in the properties file manually.
The lines looking like the following should be removed:
someAction.shortDescription=

TextBox inside eclipse's draw2d figure

Is there any way to include a Text Box inside a draw2d figure? (a code example would be nice)
Not easily, and if you're just using Draw2d without GEF, then I don't think it's possible.
With GEF, you can make use of a DirectEditManager in an Edit Part, and create an Edit Policy (extending DirectEditPolicy, installed with the key EditPolicy.DIRECT_EDIT_ROLE) to allow a direct edit to be performed on a figure.
You could create a figure which extends Label that is styled to look like a text box, and activate (by overriding performRequest in the Edit Part) editing upon selection.
This Schema Diagram example contains this type of functionality (and more importantly, the code!), although the figure used for edit (EditableLabel) isn't styled to look like a text box, and the activation itself is on double-click rather than selection.
It may point you in the right direction though.

How to extend Eclipse's compare context menu?

I want to create a plugin that displays additional information about Eclipse's compare results. For example, clicking a difference in Eclipse will bring up additional meta-information in my new view about who made the change, when it was made, what are the related changes, etc. I've got everything else figured out except how to call the view from the compare editor. I am thinking of using a context menu.
I was able to implement a context menu for the text editor. I used a targetID of targetID="#TextEditorContext and the action to inherit from IViewActionDelegate. But somehow the compare editor is not the same as the normal text editor. What targetID should I use? Is this even possible? Or if someone has a better idea than context menu, do share.
I was able to add additional commands (Handlers) to the compare view's context menu using the popup menu id popup:org.eclipse.compare.CompareEditor?after=additions

Categories

Resources