How to create svg file in Eclipse - java

I'm making a web page with JSP and Eclipse Version: 2018-09 (4.9.0).
When working with VSCode, I simply create an empty svg file and paste the source code of image into it.
I expected Eclipse to behave as VSCode, however, it seems there is no svg file creating option for Eclipse.
Is an additional library essential to create svg file in Eclipse?
If not, I will be very much appreciated with your advice!

You can right-click on any folder or package in the file explorer or package explorer, or any file/class in the file explorer or package explorer, pick new, and then pick File. This will make a file in selected directory (/ directory that contains the source files of the selected package / same dir as the file/class you selected). Just enter the file name, and include the .svg file extension.
Eclipse will just treat it as a plain text file.
paste the source code of image into it.
If you mean, paste SVG in there - that works. If you mean: paste a PNG in there and expect the editor to create a bunch of scaffolding to have a PNG in an SVG, no that won't work, and that seems bizarre to want this, that is just getting you the worst aspects of PNG and the worst aspects of SVG.
I'm not aware of any SVG-specific plugins for eclipse.

Related

Intellij Tree with custom files in plugin

I'm developing intellij plugin and I have tree structure with files and directories (not related to current project nor file systems). Is is just some virtual tree structure provided by rest service. I want to display it in ToolWindow with all common staff like colors, file type icons etc.
Is my usecase already supported by intellij?
Which classs support this?
The closes one related to my case I found trees from vcs package but it is commit / change related.
I don't think what you want to do is formally supported by JetBrains, but you could create a "fake" project in Intellij IDEA as long as the files and directories you want to appear in the tools (Project) window have a single parent directory.
I had a folder named "docs2" which contained some random notes and documentation files of various types such as txt, pdf, zip, html, js and bak. I opened that directory as a project in Intellij IDEA's Project window as follows:
Create an new project: File -> New -> Project... -> Static Web -> Static Web, then click the Next button:
On the next screen populate the Project location field by navigating to the folder containing the files you want to open in Itellij IDEA, and give the project a suitable name. Then click Finish.
After that Intellij IDEA will treat the directory as though it was a static web project.
Notes:
Intellij IDEA won't necessarily be able to handle all of the project files created in this manner. For example, when I opened a pdf file it was opened in another application, and when I tried to open a zip file nothing happened. But other known file types such as *.txt, *.html and *.js can be opened and edited as though they were files in a "real" project.
When you open the directory as a project Intellij IDEA will create some files in that directory: a *.iml project file and a .idea folder containing configuration files, so you will need write access to the folder that you open as a project.
I also tried opening the directory as an Empty Project in Intellij IDEA, but that only worked partially; files under the parent directory were shown, but for some reason it would not show any sub-directories in the project.

Strange Icon files in package explorer

When looking at my project in the package explorer, there is a file called "Icon" in every Folder and package. The file is empty and has zero bites. Because of the large size of my project there are quite a lot of them that end up pushing files I want to access of the bottom of the screen, and being a general annoyance.
Why do these appear and is there any way to hide them?
Here is a picture:
If you are not created these files then these were created by some framework or tool/plugin used in your eclipse. Like VSS creates vss files and SVN .svn folder and files.
Check this post how to hide files from package explorer to know how to hide files in package explorer. But note that only hiding doesn't prevent these files from pushing.
To avoid/ignore pushing these file into git repo check this also refer this post GIT and pushing with ignored files

How to insert images using labels in NetBeans IDE, Java?

I'm making a virtual mall using NetBeans IDE 7.3.1
I inserted images using the following steps:
Drag and drop label onto frame
Go to label properties
Click on ellipsis of 'icon' option
Import to project, select desired image
Resize or reposition it accordingly.
Then, I saved the project, copied the project folder into a pendrive, tried to 'Open Project' in mate's laptop, using the same Java Netbeans IDE version.
When I tried to open the frames, they displayed empty labels, without images.
What went wrong?
Make sure that you have the image you want in the src folder of your project.
NetBeansProjects->YourProject->src->YourRequiredImage.
Now use the label properties and set icon from this folder.
Copy entire project folder to your friend's system and run. It should work.
Maybe the image was not imported properly.
Have you cross-verified that the image file was present in Netbeans Project Folder (maybe in the 'src' folder of your project or any other folder inside your project folder)?
Keep in mind always, If you want to give your app to someone else, So give your images too. And keep those images into the folder you have stored in.
Instead of using an external image, just create a resources folder in your src folder, and add the image to the folder. Then use select image from project. And select the folder from the drop-down and select the image.
That because your images are not included in the mentioned path ( path has been changed ). So always better to put your images in a Different PACKAGE under your project.

How to make eclipse recognize the correct file extension/open the correct editor for files opened outside of the scope of a project?

I have a simple file index.jsp outside of a project in a location such as /home/user/other/ and I open it in eclipse with File - Open file. The file opens but things such as content assist are not working.
I tried creating a file inside an eclipse project (with File - new - jsp file) and everything works (including content assist).
Is there a way to force eclipse to open the proper editor for files opened outside the scope of a project?
Edit: I'm running eclipse indigo for java ee.
There seems to be a problem with the file not being in a project. I tried moving the file inside a project and now it works. I still want to know how to make this work outside a project though.
Are the file associations set correctly in your eclipse version?
This can be done under Preferences -> General -> Editors -> File Associations
You can set the desired editors for each file extension there. You can also set multiple editors for file associations. In that case you should set the default associated editor to the desired one.
When the default editor is set to your desired one, it should open files from outside of your project with this one.
For JSP files specifically, Java content assist will not work outside the workspace since it relies on a project's Java Build Path (you'll find the same limitations opening .java files). This is normal.

Eclipse: displaying code source for class file?

I'm running Eclipse 3.5.2 and am debugging a class which calls a method -- let's call it flaky() -- in one of my other .jar files. When I step into flaky(), it shows the source code in a tab in the debugger, with the filename as Flaky.class.
The problem is, the code I see looks old and out of date, so I'm wondering which file I'm looking at.
Is there any way to find out the path of the file Eclipse is displaying?
Go to the Package Explorer view with the file open in the current editor. Click the "Link with Editor" toggle (the two arrows). This should jump you to the class file you are viewing, which should be in the jar you are using. If the jar is in a library, you should see the path to the jar in the package explorer. If not you can see the path to it in the preferences. From there you can also use Chin Huang's answer to find where the given source file is.
View the Properties for the JAR file. Under Java Source Attachment, you will see where Eclipse gets the source code for classes in the JAR file.

Categories