Eclipse Package Explorer: Hide part of long package names? - eclipse

I've been searching for a "problem" that have annoyed me for a while (but without any luck).
I am developing an Android application with the rather long package name com.kennethbrodersen.simplecaster.
This project contains a number of subpackages. The problem is that all these packages are shown with the full package identifier in the package explorer. The result is that this view has to be very wide or that I have to scroll horizontally to actually view the interesting part of the name. The problem is very clearly visible on the screenshot below.
Do any of you know of a way to "hide" parts of the identifier (in this case com.kennethbrodersen.simplecaster)?

You can configure package name abbreviations in Helios (3.6) or later. Go to Window > Preferences > Java > Appearance to set up abbreviation rules.
For example, com.kennethbrodersen.simplepod could be configured to be displayed as {KBsimple} with the rule com.kennethbrodersen.simplepod={KBsimple}.

You can also install FeatureIDE plugin, which will show only short (package)name.

Related

Why does Eclipse project explorer shows complete path on every level

Directly after the upgrade to the latest version of Eclipse (4.23) the project explorer behaves abnormal. It shows the complete package path on every package hierarchy level.
The first image shows the abnormal view the second the expected view. As you can imagine with many hierarchy levels the view becomes quite confusing.
I've tried to change the package presantation, the project presentation and almost all other options in the project explorer view menu to no avail.
I assume this is a bug and will be fixed. Maybe someone has a workaround?

How to get the length of the selected word in the eclipse?

When I am checking the naming rules for my code. If i got variable or function name have more letters than allowed ERROR. I count the total character by manually or have to copy paste into Notpad++. Is there is any options to find the number of selected characters in eclipse.
Eclipse does not provide a way to display the length of a text selection like NotePad++.
Bug 73904: Show length of selection in status box was raised in 2004 (!!!) to add this feature but it still hasn't been implemented.
The good news is that someone has written a plugin named getStringLength to do exactly what you want, as mentioned in a comment in the Eclipse Bug Report:
Eclipse plugin that add the selected text counter on the right side of
the column and row position in the Eclipse status bar. After you
double click the text, this plug-in will show the length of text you
selected in the eclipse status bar; in the case you select more than
one row it will show the number of rows selected, like Notepad++ do.
The bad news is that I couldn't get it to work properly. After adding the plugin to Eclipse's dropins folder the status bar is updated as described, but the details are misaligned and not rendering correctly:
Through careful testing I can see that the plugin actually is updating the length of the selected text, but the entry on the status bar is practically illegible. Still, in the absence of anything else, it is worth trying - perhaps you will have better luck in your environment. Let us know if it works for you.
You don't need a plugin anymore with Eclipse 2019-09:
Editor status line shows more selection details
The status line for Text Editors now shows the cursor position, and when the editor has something selected, shows the number of characters in the selection as well.
This also works in the block selection mode.
These two new additions to the status line can be disabled via the General > Editors > Text Editors preference page.
i has fixed error rendering in eclipse version=4.12.0 on windows 10, with steps.
clone project (getStringLength project)
import to
edit file com.lyf.plugin.getStringLength.SelectedTextInfoControlContribution.java (line 26).
#Override
protected Control createControl(Composite parent) {
parent.getParent().setRedraw(true);
......
}
build plugin:
1. Right-click your plugin project in Package Explorer window.
2. Press Export... in shown context menu.
3. Select Plug-In Development -> Deployable plug-ins and fragments (or Deployable plug-ins and fragments directly in old Eclipses).
4. Close Eclipse. Copy this JAR to eclipse/plugins/ path. Run Eclipse again.
Good luck!

Mac os X Eclipse Package Explorer view , project folders in smaller size

I recently brought Mac Book Pro and I installed Eclipse Luna. I am facing a problem in viewing the Java projects in "Package Explorer" folders are very small. Is there a way to increase instead of changing the screen resolution?
It should be possible, have a look at this link: http://blog.vogella.com/2013/02/19/css-styling-individual-part-of-the-eclipse-ide/
(Copy of the essential part, in case the above link stops working:
#org-eclipse-jdt-ui-PackageExplorer {
font-size:20;
background:black;
}
)
Remains the question, where to put those lines. Best would be to create your own style, but I never figured out how to do it. So I usually just modify one of the built-in styles. To do this, go to /Applications/eclipse4.4/plugins/org.eclipse.ui.themes_1.0.1.v20140819-1717/css and open the css-file of the style you currently use (probably e4_default_mac.css). Then add the above lines at the end of that css file and restart Eclipse. Note: when updating Eclipse, you might have to repeat those steps.
EDIT: Just realized it was already asked and answered on SO: I cannot change the font size of package explorer in Eclipse Don't look at the accepted answer, but at the next one below.
No, there is no way to change the size of folders or other visual properties of package explorer.
The views, fonts, etc... of general views are set by the system/OS properties. Only the editor view allows customization of sizing, such as, font.

PyDev: project not visible

I was using PyDEV without issue but recently when I create a project in Eclipse the project is not visible in the PyDev perspective but is visible in the Java perspective. My project is a python project. It seems that the perspectives are a little mixed up.
Is there a way to fix this?
My solution was:
Going to PyDev Package Explorer
Click View Menu button (arrow pointing down, top left area of the Package Explorer panel)
Top Level Elements
Click Projects
Maybe you added some filter which is hiding it in the PyDev package explorer?
I.e.: have you tried going to the PyDev package explorer filters (in PyDev package explorer > Ctrl+F10 > Customize View).
Or maybe you set the top-level to working sets and don't have a working set on PyDev? (i.e.: Ctrl+F10 > top level elements)
Or maybe you selected a working set which has nothing? (i.e.: Ctrl+F10 > select working set)
I know this is an old question, but I've had to deal with this specific problem in Eclipse 4 Luna, and I have an idea for what's wrong.
Use Package Explorer instead of PyDev Package Explorer.
The native Package Explorer, when in working set view, appears to automatically create and populate the working set "Other Projects." PyDev's explorer does not appear to do this, at least not on my default Luna installation. As well, PyDev's assignment of projects to working sets appears broken on Eclipse 4 Luna, so users of PyDev Package Explorer may have trouble finding their projects between views.
Enable Package Explorer:
- Window -> Show View -> Package Explorer
If Package Explorer not in menu:
Window -> Customize Perspective
Click the Menu Visibility tab.
Expand Window
Expand Show View
Find Package Explorer and put a check in it.
OK
Click Window then Show View, choose Package Explorer and rejoice.
I hope this helps at least one of you. I'm terribly new to Eclipse, and it is probably the single most unfriendly thing I've ever had to use. Good luck!
I had the same problem. Newly created projects did not show up. This is what brought me to this question. While looking at the answer provided by #alecor_Dev, which does not answer to the question, at least in my case, I managed to solve mine.
If you have a working set created and selected new projects will not show up. The easiest way to test is to go to:
PyDev Package Explore->View Menu button (pointing down)-> Deselect Working Set.
If you has a working set but more projects in that workspace more projects will show up.
If you want to keep the view clean you can go back to your working set but add the new project by editing the working set:
PyDev Package Explore->View Menu button (pointing down)-> Edit Active Woking Set.
And click on the project you want to add or remove.
I hope that this will help other with similar issues. While working set are a convenient way to declutter the view, can add to confusion.
I Suggest to #Fabio Zadrozny to add some visible way of marking that we are working inside a working set.
I hope that #medPhys-pl can confirm this although he moved to LiClipse. Obviously, there can be other causes that can create this kind of behaviour, but the initial description of the problem seems very similar to mine and I hope that it will solve other people's issues.

How do I make eclipse (Indigo) collapse empty (parent) packages?

What I want to do is simply use the eclipse package explorer in hierarchical view but with empty packages being collapsed so I don't have to open 5+ packages to find the first Java file.
I'm not even sure how I did it in previous versions, but I've never had any trouble finding it before, it just seems to be gone now. I have a feeling there was a "flatten hierarchy" tick-box somewhere.
To clarify I get this:
com
example
etc
file1.java
Rather than:
com.example.etc
file1.java
I'm using Eclipse Indigo (v. 3.7.1)
Open the View menu (small triangle in top right corner), open filters and check Empty parent packages.
In most cases it works, but in case of existing projects it does not always work as expected. If you seem to have troubles, try to export the project, remove it, then re-add the exported version (or re-checkout from your VCS).
Assuming the view filter is engaged properly, perhaps your source folders are not as "empty" as you think.
For example, on Apple OS X, Eclipse will detect .DS_STORE entires along your src/package/hierarchy, making the parent packages technically non-empty.
Delete any such hidden files and refresh your project.
Window - Preferences - Java - Appearance - Abbreviate package names
And enter the following rule:
com.example.etc={cee}
I don't know what the problem actually was, but I couldn't get it fixed until I gave up altogether and reinstalled the OS (it was a fresh install anyway), and eclipse. It was completely fine after that. :\
Click on the arrow at the top right of the "Package explorer" and choose "Package presentation -> flat"
Try to restart Eclipse once in a while. I had trouble getting it to work, and after an Eclipse restart it suddenly was working again.