syso shortcut isn't working in Eclipse IDE - eclipse

so when I'm trying to use the shortcut syso in eclipse IDE it opens a suggestion pop up instead of just displaying System.out.println like it used to any suggestions to fix this? (I added an example to show what's happening)

You could use the Type Filters preference page for this, as you almost never want to refer to anything in the jdk.internals packages, and it will apply regardless of the JDK you're using.

See Nitin Dahyabhai's answer for the straightforward and recommended solution.
Alternatively, to avoid that the content assist proposes for syso also the type jdk.internal.misc.FileSystemOption, you can add to the system library the access rule Forbidden **/internal/** (assuming Hide forbidden references is enabled in Type Filters):
Go to Project > Properties: Java Build Path tab Libraries
Select Acceess rules which is a sub-node of the JRE System Library
Click Edit...
In the Type Access Rules dialog, click Add...
In the Add Access Rules dialog, enter **/internal/** click OK
In the Type Access Rules dialog, click OK
Click Apply and Close
Alternatively, you can change the name of the sysout template in the preferences in Java > Editor > Templates.

Related

Eclipse preference to automatically choose a conflicted auto-import?

When I use Eclipse's Souce->Organize Imports [ctrl-shift-o], I get sick of being repeatedly prompted to choose for names existing in multiple libraries. It's nice that there's a preference for the order in which the options are presented, but I'm hoping for still less interactivity.
Is there a preference to allow me to choose-by-default for some specific libraries?
EG, when I'm in a JavaFX project, ActionEvent always refers to javafx.event.ActionEvent, not java.awt.event.ActionEvent. And I ever did need the AWT version, I'd be happy to just hand-type it, or disable the feature for that project.
You can use 'Java > Appearance > Type Filters' in the Preferences to specify types and packages which are not offered by organize imports, content assist, quick fix and 'Open Type'.

how to format code in eclipse "git repository browsing prespective"?

How to format code to specific coding style in Git Repository perspective in Eclipse ? like Ctrl+shift+f works in Java perspective. Can anybody help me to solve this ?
Here My problem is to format a android repo.
The "format" actions are tied to specific editors. Use ctrl+shift+L twice in a row to open the list of all available hotkeys. Filter that list on "format" and you should see a number of potential candidates... and their context. The Java ctrl+shift+F (Format) action is available in any Java editor ... even when in the Git perspective (at least, that's true with Eclipse 4.2 as I just tried it). That is, as long as you have a Java editor open and it has focus. The Ant "format" action should work the same way : as long as you have an "ant build file" editor opened and focused.
Whether the "ctrl+shift+F" you want is active or not depends on which action exactly you are trying to trigger : java format, ant format, xtext format... and how that specific action is contributed (and bound) by its contributing plugin. To check that, you can open an editor where you know the action is active, hit alt+shift+F2 then right-click your editor and locate the "format" action. When you click that action just after alt+shift+F2 has been pressed, it will not be triggered : rather, a dialog will pop-up to tell you which action that is, who contributes it, through which plugin.xml...
I found the answer, it was very easy,
Right Click on project in Git perspective -> import project -> check import as a general project ->select the working directory which you want to import -> finish
Now go to the java perspective and find the project :) thats all

Slim down Eclipse context menus

I have several plugins (Apatana, SVN, Pydev, Zend Debugger, PHP) installed in my Eclipse 3.5.2 (Ubuntu 10.10) installation. The one problem that keeps bugging me since I first used Eclipse years ago is, that each plugin puts new entries into the context menus.
Unfortunately, it seems that the various perspectives are not able to determine, what menu entries are useless. So while programming PHP the menus are full of java and pydev stuff, I really have no use for!
The more plugins are installed the messier the menus get. It seems a bit odd, that such a rich IDE doesn't have support for context sensitive "context" menus ... :-(
My hope is, that somewhere out there on the internet, someone knows how to remove unused menu entries, or even has created a small plugin for that??
Any ideas?
Screenshot: http://i.stack.imgur.com/D9HjN.png
Eclipse provides "capabilities" as a functionality for the plugin developpers to provide a way to the users to disable the features and UI contributions of their plugins. I don't really know if that feature will help in your case (that is : if the plugins contributing the menu entries that bother you have defined the necessary capability to disable them).
If you go to Window > Preferences, then General > Capabilities, you can see a number of "capabilities" categories to enable or disable. I don't recommend disabling the categories themselves (for example "development") as you would disable all of Ant, Java, Python... menus and extension at once. Rather, use the "Advanced..." menu at the bottom of this page to see not only the categories, but also what they contain. There, under "Development", you should be able to disable "java development" (JDT) extensions and menus, "Ant Development" (remember that "Run Ant Tool" button that is visible on all perspectives beside the "Run" button? That would remove it)... You should be able to disable most of the clutter with this.
Note that if the provided capabilities are not sufficient, you can create your own very easily, allowing you to disable even the contributions from other plugins. For this the steps are simple :
Use the File > New > Other... menu item
Select Plug-in Project and name the new project as you desire, click Finish
In the editor that has opened, select the "Extensions" tab
Click Add, untick "Show only extensions points from the required plug-ins"
search for the extension point org.eclipse.ui.activities, select it, and hit Finish
Right click the item org.eclipse.ui.activities on the left and select New > Activity
enter the id of your new activity on the right of the page, for example my.disable.activity.id. Enter a human-readable name below it; for example "disable JDT".
Right click the item org.eclipse.ui.activities on the left and select New > activityPatternBinding.
re-enter your activity Id (my.disable.activity.id) in the "activityId" field, then enter the "pattern" of the contributions you wish to disable. This is a regex. In order to disable all "JDT" (java development) contributions, enter org\.eclipse\.jdt\..*
Right click the item org.eclipse.ui.activities on the left and select New > categoryActivityBinding
re-enter your activity Id (my.disable.activity.id) in the "activityId" field once again; then click Browse... at the right of the "categoryId" field. Double click the org.eclipse.categories.developmentCategory so that it appears in the preference menu for capability enablement.
Now, if you export this plugin (I won't detail the update site creation here, you should be able to adapt the explanation from Stephane Begaudeau's blog), all menus from the JDT will be disabled (I tested this, so I know it at least disables those I checked (the "source" and "refactor" menus from a right-click on a Java file). As you specified a category, you can re-enable these menu items from the capabilities preference page I hinted at in the beginning of this answer.
Not really a solution for your problem, but worth mentioning anyway: Eclipse does support the context sensitive menus, but in a way where the plug-in developer defines the contexts where the menu entries should be displayed.
Unfortunately many developers don't care and say "Make it visible everywhere". The solution then is to complain loudly to them.
Not a complete solution, but more of a workaround. You can install clearlooks compact theme for Ubuntu. It considerably reduces the size of components, even in Eclipse.

Netbeans Shortcut to Open File

I remember seeing someone use a shortcut in NetBeans to open a dialog similar to phpStrom that can open files based on class names or is it file name. whats that?
Updated
I'm fairly certain you are referring to the "Quick File Chooser" plugin. As someone else points out, though, there are several other candidates. I list them below...
The Quick File Chooser Plugin:
By default CTRL-SHIFT-O opens the Open Project dialog, and once the plugin is installed, you will get the dialog pictured here automatically:
(The Quick File Chooser plugin replaces the default open project dialog with its own.)
When opening a file with the Quick File Chooser plugin, you see this:
I did not find that the plugin was able to open based on a class name.
Quick File Chooser is available through the NetBeans Plugin Portal. You can also install it directly from within NetBeans versions 7.1 and 7.3 if you have the "Plugin Portal" Update Center configured. (See the bottom of this answer for instructions.)
NetBeans Core (no plugin)
By default CTRL-SHIFT-O opens the Open Project dialog, and without the QFC plugin, you will get the default dialog:
The default Open File dialog is this:
The Open File dialog does not have a keyboard shortcut by default, but you can easily add it:
Click on Tools, then Options, then on the Keymap icon in the tool bar of the dialog.
In Search: type "Open Fi" and you should see "Open File..." in the Actions list.
Double click on the Shortcut box for that entry, and select an appropriate shortcut (either by pressing the key combination, or by selecting it from the drop-down).
Click OK.
The Go To... Dialogs:
The Go To... dialogs are provided by core NetBeans, and are available even if the QFC plugin is installed (the QFC plugin does not override them).
The Go To File dialog is ALT-SHIFT-O.
Go To Type: CTRL-O, appears to list classes, variables, and all sorts of stuff.
Go To Symbol: CTRL-ALT-SHIFT-O
For PHP projects, Go To Type and Go To Symbol appear to list the same set. As mentioned, all of these are available on the Navigate menu.
Installing Quick File Chooser from the Plugin Portal Update Center
In NetBeans:
Click on Tools, then Plugins
Go to the Settings tab
Ensure that the "Plugin Portal" is listed in Configuration of Update Centers and checked as Active. If it is not listed, click Add, give it an appropriate name, and the URL is http://plugins.netbeans.org/nbpluginportal/updates/7.3/catalog.xml.gz for versions 7.3.x. (In the URL replace the "7.3" with, e.g., "7.2" or "7.1" if you are using an older version of NetBeans.)
Click on the Available Plugins tab.
Click on Reload Catalog just to be sure you have the latest contents.
In Search: type "Quick". That should be enough to get it listed by itself (or at least on a short list).
Click on the check box under the Install column, and then click on the Install button down below.
to open a file based on its name
Alt+Shift+O.
Hit Ctrl + O to search files based on their 'Class Name'.
I think the simplest solution for this would be
ALT+f+o
This will open the file open dialog box, now you can browse through the files and open which-ever file you want or if you have the complete path to that file just paste it in the text-field which says "File name:" and press Enter
I use Ctrl + Shift + O to open this dialog for Java classes.
I don't know if this is also valid for PHP though.
If you just want to open some file based on its name, you can use Ctrl + Shift + L.
Edit:
Both actions are available in the Navigate menu.
This is old and pretty much answered, but you may also try this plugin - works for all up to 8.2:
My shortcuts different from answers above (don't know why).
To me its Alt + Shift + L, Or Navigate->"Go to File".
To search by type its Alt + Shift + O or Navigate-> "Go to Type" (you can see the shortcut in front of it)
It did not require me to install any plugins BTW. Netbeans version: 8.2
The best way to search and open file in netbeans:
Press ctrl + o and type file name you are looking for, it will search in current projects and list matching files thn you can select file and open.
Another way is to use open file fast plugin. it got two matching modes, smart (like in textmate) and exact.
The best way to open the file without any plugins is to use Alt + Shift + O, then netbeans will offer all the available files with your given keywords.
I do also believe the answer from #faisalbhagat must be the accepted answer as #Thor mentioned above!

Excluding/Disabling Validation in Eclipse

I have the (mis)fortune of having a large project source-base in which I am working primarily on PHP and JavaScript. I have to have the full project area as the project root in Eclipse, but unfortunately this includes several directories that drive the validation built into WST/DLTK/etc. nuts.
I have tried disabling all validators in the project properties. I have gone into the validators one at a time and added rules to the "Exclude Group" set to exclude the specific folders. I have removed the folders from the PHP build path in the project properties. And yet, my Problems view/tab is still littered with thousands of red flags that stem mostly from a folder that we use to keep copies of external elements (Apache, PHP, etc.). You know, typical "have a copy of the specific versions we currently use" sort of thing.
The signal-to-noise ratio is so bad that I'm unable to use the view at all, which is a shame. If I'm not going to have the benefits of the IDE, I might as well be using vim for this (I use it for other stuff, but for this codebase a good IDE is a better choice, providing I can get it to work). It seems to me that it would be an obvious feature to be able to right-click a folder in a project and select "Exclude from Validation", but alas there is no such feature. Is there another way to get the validators (PHP, HTML, etc.) to ignore the folders I need ignored?
Tried solution;
Right click project
Select properties
Select validation
Check Enable Project specific settings
On the XML Validator row, click the '...' button
Select Exclude Gruop
Click Add rule
Select 'Folder or file name'
Click Next
Select files or folder which are not validated.
Click Finish
Click OK
Click OK
This solved my problem. Because eclipse validation gives error for generated GWT files.
Best regards.
I came upon this question while looking for the same answer. I will list the steps I did here and hopefully it will help someone in the future.
I am using Eclipse 4.1 and I do the following to exclude validation for specific xml files. I am sure if you configure the different validators it will work for other files as well.
Go to Preferences -> Validation
Find the Validator you wish to change and select settings (not all of the validators have settings, hopefully yours do).
In the settings you can add an Exclude Group where you can add a rule to specify to exclude the validator for specific extensions, folder or file name, project nature, facet or content type.
I have Eclipse for PHP Developers and I was dealing with the same issue.
In addition tot he excellent answers above, I have one more suggestion.
My first recommendation is not to use Aptana unless you actually want those validators (as they are nearly impossible to turn off from my experience).
Beyond that, go to File -> Properties -> Builders, and deselect "Validation" and "Script Builder" and "JavaScript Validator".
So far it's helped speed up some operations tremendously.
I also recommend disabling "Automatic Build". Because you're using PHP, the odds that you actually need it to build anything if you don't want validation is slim.
In the main menu, go to Project and uncheck "Build Automatically". You will want to build your project every now and then by right clicking on the project and selecting "Build Project".
All the above steps have helped me get the basic editor, which is exactly what I wanted.
I used to exclude resources from validation via project specific Exclude Group (as the most answer here suggests). But in case anyone is still having problems with disabling validation for a specified folder in 2014 - just mark the folder resource as Derived:
This should disable validation for that folder.
If you are using EGIT you might also want to disable automatic inclusion of derived resources in .gitignore:
It is not really possible to select a directory, at least under Windows.
After having pressed Preferences->Validation->Settings->Add Exclude Group->Add Rule->Folder or filename->Browse Folder->(selecting some directory)->[OK]
The "Browse for folder" dialog is being closed, with the "File or folder" field staying empty.
I had the same problem with the web app i'm developping.
I ended up disabling automatic build, and building once a day (Project->Build automatically), that way i still get the benefits of code completion from libraries, while speeding up the program on older computers.
I found in the project properties there is a Builders category. In the list of builders I had a JavaScript Builder. I deselected this builder and all my annoying javascript validation woes went away.
this worked for me:
Properties > Builders section and unchecking the corresponding box. https://bugs.eclipse.org/bugs/show_bug.cgi?id=317833
seems to be a bug in some versions of eclipse.
There are more gloabal validation parameters. You can suspend all validation (or only the ones you don't need) by going to:
Window > Preferences > Validation.
Here, check the box "Suspend all validators".
Alternatively, uncheck the validators you don't need from the list below.
A full build will be requested which might take some time. But Eclipse will run a lot faster afterwards [But without validation of course]
http://www.flickr.com/photos/jesuspresley/5094048124/
Solution.
Go configure what's displayed in the Problems View like lothar proposed, create new custom filter and in "Scope" area choose "On working set". Now press the button right below this option to configure what working set would it be: in working set selection pop-up hit the "New" button and mark all your project files EXCEPT those you want to exclude from validation. You might want to save this working set under convenient name, like "No_Validation_Set".
Summary:
1) working set excluding problematic files.
2) custom Problems View filter to operate on this set.
Issues:
when adding new files to project you need to update your working set, so they are validated too.
When I excluded files from validation for the project, my setting didn't seem to be recognised until I restarted Eclipse and cleaned the project.