Showing hidden directories in Project Explorer view - eclipse-plugin

My Eclipse RCP application includes the Project Explorer view, which by default hides all directories whose name starts with the dot (".") character.
Is it possible to customize the Project Explorer view so that these directories are no longer hidden?
EDIT: I would like to do this programmatically.

I found a way to do this by looking at the code behind the Customize View dialog (accessing the dialog is described here).
The INavigatorFilterService interface provides the activateFilterIdsAndUpdateViewer method, which allows callers to activate certain filters and deactivate all others. The org.eclipse.ui.navigator.resources plugin defines the org.eclipse.ui.navigator.resources.filters.startsWithDot filter, which is used to remove all files and directories whose name starts with a dot character from the Project Explorer view.
The following code snippet can be used:
ProjectExplorer projectExpl = ... // get project explorer
INavigatorContentService contentServ = projectExpl.getNavigatorContentService();
INavigatorFilterService filterServ = contentServ.getFilterService();
String[] enabledFilters = new String[0]; // this will clear all filters
filterServ.activateFilterIdsAndUpdateViewer(enabledFilters);

Related

Can I customize the "New File" menu in PhpStorm?

I would like to add some other options, like "PHP Enum" or "PHP Interface" directly to this menu. Also, I would like to put PHP-related options first. It is possible tu customize this in PhpStorm? I'm using last version (2022.3.2) with the new UI enabled.
I tried using Appearance & Behaviour -> Menus & Toolbars but that didn't work for me.
Do you know that you can use the universal PHP Class entry and just change the type of the object (and therefore the file template) there? That can be done right away when typing the file or class name -- just use Arrow Up / Down keys:
(GREEN rectangle area is where that Up / Down key will work; RED rectangle shows my custom file templates)
P.S. The template for PHP Enums is also there, it just the screenshot was taken in a project with PHP 8.0 language level (need 8.1 for enums to appear).
P.P.S. The IDE will remember the last used template when you invoke this dialog again.
https://www.jetbrains.com/help/phpstorm/creating-php-classes.html
You can add new entries to this menu by creating custom File Templates at Settings/Preferences | Editor | File and Code Templates
https://www.jetbrains.com/help/phpstorm/settings-file-and-code-templates.html
Here are my test custom file templates:
And this is how they appear in that menu:
Customizing this menu (removing items, changing their order)
This is not possible at the moment. https://youtrack.jetbrains.com/issue/IDEA-143090 -- watch this ticket (star/vote/comment) to get notified with any progress.

Cannot add menu to org.eclipse.ui.main.menu through Model Fragment Definition in Eclipse 4 model editor

I have a eclipse-rcp application developed with Eclipse 4. This application is modularized with several plugins and features. This application is built with maven-tycho using pomless. The project structure follows the guidelines proposed by vogella for Eclipse Tycho.
This project has a main Application model defined in the plugin app.rcp (Application.e4xmi). It has several plugins that extend this application model through several fragment.e4xmi files. Specifically, in one of them, I modify the application model to add a menu to the application main menu with the following line in the frament.e4xmi:
Extended Element-ID: org.eclipse.ui.main.menu
Feature Name: children
Position in list: index:1000
This model fragment allows me to add menus, handled menus and so on without any problem through the Eclipse 4 model editor.
At this point, my objective is to build a separate feature, which is not in the same project, to add a similar menu to the application main menu, which will be installed in the original application using a p2 update site.
For this, I have created a plug-in with an application model fragment (fragment.e4xmi). I try to modify the file with the Eclipse 4 model editor pushing Find... of Extended Element-ID field. However, when I select Menu in Container-Type, there is no item that I can select. In the other plugin I can select the Main menu (org.eclipse.ui.main.menu) and other created menus.
I have tried to add dependencies to the plugins of the main application. The project compiles in the command line (mvn clean verify), but in Eclipse IDE it shows that it cannot find the plug-ins of the main application.
EDIT:
The problem here is that the combo to add Menu, MenuSeparator, HandledMenuItem, etc is disabled, so I have no way of adding any of it. When I push the add button, it does nothing. I have tried to use a text editor to change the fragment.e4xmi file directly, but I haven't been able to test if that works.
The combo box that I refer to is located below the "Position in list" field of the model fragment ( see Model Fragment editor image)
You must add the menu to the 'Imports' section in the fragment.e4xmi to make the 'Find' dialog work.
You can also just add the id manually, it should still be resolved properly when the model is being loaded.

Exclude files when using "Find Usages" in IntelliJ IDEA

In Java source files, when I select a class or a method, then click the right button of mouse, in the pop up context menu, and run Find Usages, the files that use the class or methods are searched out.
But I would like to exclude certain files (e.g. JUnit test files) from the search results.
Where could I configure this?
From the docs; you can confgure the Find Usages scope by clicking on the tools icon in the top left hand corner of the Find Usages results.
Here are some screenshots:
Click on the tools icon here:
Click on the build button (... next to the Scope field) to create a Scope and define it like so (in this examples I have included production classes and excluded test classes):
Choose that scope in the Find Usages dialog:
Notes:
You can also chose the precanned scope named Project Production Files from the Scope dropdown
All subsequent searches will use this scope by default until you choose a different scope.

VB.Net Picture Box Control

OK so currently this is the code I have below of a picture box
PxBx.Image = Image.FromFile("C:\Users\Ashleysaurus\Documents\Visual Studio 2015\Projects\ThisProject\ThisProject\Images\filename.JPG")
What is the correct syntax for using images files stored in the application files after i publish a project? Namely b/c this path will not always be the same based off when/where users would store the app files?
I did a bit of searching but havent figured out how to ask the correct question to get the answer from forums/google.
Thanks in advance
I suggest you to add to your Settings.settings a new entry for the path to the folder where you store the images. This setting will be read at runtime and used to find your images. The advantage of this approach is that you can manually (or through your setup code) change the config file (where the setting is stored) to whatever your customer requires. Instead, hard coding a path (relative or not) inside the code is just a problem waiting to happen.
To add an entry in your setting.settings file right click your project and select properties, then the settings tab. Here, add a Name like "ImagePath", of Type = String and Scope = "Application", then set your current path as value and save.
Now, if you open the app.config (or web.config) file you will see the new entry and its value. To use it at runtime
string imagePath = Properties.Settings.Default.ImagePath;
You can utilize the Application.StartupPath property and use Path.Combine() to construct a proper path:
PxBx.Image = Image.FromFile(Path.Combine(Application.StartupPath, "Images", "filename.JPG"))
You have to add the image to the project.
You have 2 ways:
Create a folder in your solution explorer called Images or whatever you want. Right click on it and click 'Add Existing Item'. Choose the image you want.
Then type in your code:
PxBx.Image = Image.FromFile("Images\FileName.jpg")
Click on your project name in the solution explorer. It will take you to a new "screen" (I don't know how to call it), from the right click on 'Resources', from there you can add your image.
Then you reference it in your code using:
PxBx.Image = My.Resources.Filename

is this problem resolved? image view with folder reference

Anybody know a workaround for this problem described under:
"When you add the folder as a reference ("blue folder") it adds that folder to your bundle and not just the files in that folder. This means that when you want to reference a file in that folder, you have to reference it by doing foldername/myfile.png (because you have to dive into that folder, instead of just files in the root of the bundle).
I haven't found a way around this, so if you need to reference a file in a folder like that - be it in IB or a method like imageNamed: you need to do foldername/filename otherwise it won't be found."
It works when I create groups instead of folder references though.
Oh and I was wondering, if I add a folder with pictures in it with "Create groups for any added folders" selected, is all the structure going to be lost and everything will be on the root in my app bundle on the phone? Because if I go with the finder in my dev project, I can see that xcode copied my folder with all the pictures in it. But if it's true and no structure is kept, it means that I can't have two images with the same name in different folders in my dev project, correct? and even if all my images are in a folder "images" in my dev project, I still access them directly (foo.png not images/foo.png) in xcode, right?
EDIT
OK after adding the User paths (thanks to #Matthew Frederick) I can now see the filename of my images in the dropdown of IB and they show up on the interface! Problem is, it does not add the folder in the dropdown (I only see filename.png not images/filename.png), so when I compile, it looks for filename.png instead of "images/filename.png", so it does not work. I have to put images/filename.png manually in the IB dropdown, but then the image does not show in IB...
Interface Builder will only look for potential graphics/media in your target's header search paths, so if you want access to anything that's not loose in your project folder you'll need to add those paths.
Fortunately it's easy.
In the Project Navigator click on your project, and then in the main area click on your target.
Click the Build Settings tab and scroll down to the Search Paths section.
In the User Header Search Paths subsection double-click on the area in the Project column (3rd column over) and a small dialog will appear:
Click the + button, then type the path to your added folders, relative to the project's base folder, then click Done. The paths should be specified in the form of /yourPathName.
Poof, now IB can see the graphics inside the folder, and will present them as "folderName/imageName" in it's various dropdown menus and such.
Note: This is also true for .h and .m files and anything else inside a folder inside your project's folder: adding paths tells the compiler other places to look (hence the folders you see in my screenshot, "Human Data Classes" and "Machine Data Classes," where I keep my Core Data class files as created by mogenerator).