What is this icon?
Some codes are "hidden" because of this icon, when I click it, the IDE pops up the code snippet that's supposed to be there before, since codes disappeared, I can't reference it from other files either.
If you are using a version control system (such as Git) in the project you are working on with the IDE, you will see these marks on the files (See sample images below).
File content
Grey triangles: deleted content
Blue rectangles: changed content
Green rectangles: added new content
These are seen when the changes are not yet committed. Once all the changes are committed the marks are gone.
If you click on those marks you will see the content that was there before the change took place.
Files
The same principle is applied for files (see below images)
Green: new file
Blue: modified file
Grey: deleted file
While working you see the files like this (deleted ones are omitted):
And, by the time you're committing changes you will see them like this (you see all files changed):
See official doc for more info.
Related
I wanted to add a java class to a project, but I did a mistake and added it as a text file. Then, I removed it and tried to add it again as a java class, but unfortunately it doesn't work anymore. And I get the following error:
Unable to parse template "Class" Error message: ABC.java mapped to not java file type text
As I searched, I faced some solutions like
this one but I can't find File Type under Editor or anything similar that I can change as suggested in the solution.
Any help would be appreciated.
PS: I am using IntelliJ 2018.3.4.
Thanks in advance,
Go on File->Settings and a dialog will open. In that dialog navigate on the left part to Editor/File Types and then you need to choose from the section Recognized File Types Java Class and remove from bottom section the problematic extension (note you have a small minus button on the right)
https://www.jetbrains.com/help/idea/creating-and-registering-file-types.html
This is a variant of Markov's answer that worked in my scenario.
Try going to File->Settings->Editor->File Types and to the Recognized File Types tab. Click the "Auto-detect file type by content" choice, and delete the name of the file you are trying to create from the "File Name Patterns" section by using the minus button.
Select required file type in top list (Recognized File Types) -- do it for "Text files"
In bottom list (Registered Patterns) select undesired pattern -- "SomeFileName.java"
Click on "-" (Minus) button to remove pattern from the list
Repeat 1-2-3 for other undesired patterns
If desired, you can also do this manually by editing config file while IDE is closed. Because it's IDE-wide setting, it is not stored in .idea folder (which has project settinsg only) -- the file to look for is called filetypes.xml and shoudl be located in ~/Library/Preferences/IntelliJIdeaXX/options ( see http://devnet.jetbrains.net/docs/DOC-181 for other OS etc )
Certainly inelegant, but you can simply copy the contents of the file to the clipboard (ctrl-c or similar), delete the file (maybe make a temporary backup somewhere outside the project), then in IntelliJ go to the desired package, right click, select new, select Java Class, name it correctly, and then you can paste in the contents of your file (ctrl-v or similar).
A colleague of mine recently ran a scan of a code base using HP Fortify 4.3 using an HP Fortify 4.3 installation on his computer.
When I opened the .fpr file in my HP Fortify 4.3 installation, the line numbers in the issues do not always match the lines in the code window when I double-click on the issue.
For example if an issue is reported in line 214 of a particular Java class, when I double-click the issue to view it in a code window, the highlighted line 214 doesn't contain the reported issue. It might instead be on line 205.
This doesn't happen with every source file.
What might be the cause? I assume the .fpr file contains a snapshot of the code that was audited. If that's true, then why would the line numbers not be in sync when I open the file in my Fortify installation?
Thanks in advance!
Yes the .fpr file does contain a snapshot of the code that was audited. But that is not its first choice Fortify uses when displaying code. (The source code is zipped up, so that is not used for performance reasons [I think]). If you have a copy of the source code on your machine that is in the same location as the code your colleague scan, Fortify will use that. And it may be that the source code has changed since the scan.
When Fortify goes to display source code and cannot find code at the external path of the scan, it will then display a message:
The current source path is invalid, but the project contains a copy of
the scanned source code. Would you like to extract the source code to
a location on disk, or update the path to an existing location?
With three options:
Use Source Included in FPR
Cancel
Update Path
If you want exactly what was scan then choose the first option
If you want it to point Fortify to the location of the source code on your system use the third option.
If you want it to use the internal source then do the following
Open the FPR
Do Tool -> Extract Source Code
Pick a location
When you do this, Fortify will automatically start using that location to pull the source code for display.
Firstly, is it legal to use the dark theme of JavaFX's SceneBuilder 2 in my application? Since it is open source now here: SceneBuilder/css
Secondly, how to do this if legal? Or just for training purposes if not legal?
I tried to download the ThemeDark.css file from the link above and add it to my fxml file, but i see no change applied.
Any ideas ?
Edit (what I did):
I have downloaded the .css file and pasted it in package css.
Then I added these lines in my .fxml file (with the <> symbols but I removed them in this question as they hid the text if present) :
stylesheets
URL value="#/css/ThemeDark.css"
/stylesheets
See below resulting screenshot: (themeDark not applied)
If you are using SceneBuilder you can add a global css sheet to it and be happy with the new look.
Alternative, if you want to set it within your code you can use
scene.getStylesheets().clear();
scene.getStylesheets().add("path/stylesheet.css"); // Modify to your path
to add a style-sheet. Notice that you should put your style-sheet in a resource folder in your application, just to keep everything cleaned up.
I really have a problem adding images to my java project, and before you ask, yes i have searched already and tried everything, but i just can't get it working.
Here is my problem:
At the moment i am using this code to get the images:
ImageIcon goldIcon = new ImageIcon("res/Gold_coin.png");
ImageIcon silverIcon = new ImageIcon("res/Silver_icon.png");
ImageIcon copperIcon = new ImageIcon("res/Copper_icon.png");
My project structure is as following:
I have one project folder with two sub folders.
Both sub folders are specified as source folders, one is the "src" folder and the other one i named "res". In the "src" folder i have one package with all classes in it. In the "res" folder i have all the images saved.
Now the strange thing is, the "Gold_icon" DOES work, but both silver and copper do NOT. I am using eclipse luna and if someone could give me a step by step instruction how to add an image would be really nice.
Because all i find is always "add to resource" , "add it to resources folder" and honestly, i tried creatig a new folder, i copied it to the "src" folder, i tried every possible call, from ("res/Gold_coin.png") over ("/Gold_coin.png") to
("Gold_coin.png") and ("/res/Gold_coin.png")
I refreshed the project, the folders, the package, the classes, i restarted eclipse but nothing helps
I just don't get it..
Please help :(
If you need the information what i want to do with this images afterwards, i am adding them together into a JPanel with flowlayout which i write into a JTable cell with a cellrenderer, which is everything working with the gold icon, but not the other two. And it also does not work to remove the gold icon (because i thought maybe for whatever reason only the first icon works..) but then nothing is displayed
You should use getResource to load images or whatever from resource folder.
For example:
String pathToImage = "res/Gold_coin.png";
ImageIcon myIcon = new ImageIcon(getClass().getClassLoader().getResource(pathToImage));
or with all project path: nameOfProject/res/Gold_coin.png.
I have a project opened in eclipse, its a java web application. In eclipse I can see that there is a red cross sign with my project name, On expanding my project I can see many files have the same red cross sign.
What does this cross sign means in eclipse? Is it showing some compilation error? if error how can I see the error? Also what does that triangle icon means?
Please check the screenshot above and see the cross and triangle signs...
The cross on red ground means an error in this file, while a question mark on yellow ground indicates a warning. You can see them in the Problems tab in eclipse:
You can customize what is treated as an error and as a warning under Window -> Preferences and then search for errors/warnings (Also take a look at the docs: Java Compiler Errors/Warnings Preferences
In addition to the markings on the resources, you can see errors and warnings in an open file next to the scroll bar:
Cross sign shows the error in that Source,Triangle indicates that your source has some warinings
Just open those files could find the Red x under line and marks in the source editor , if warnings will be displayed as Triangle with ! in the side bar of the source editor
If your source code is large then you can use shortcut ctrl + . to see the errors in the source file. The following shortcuts will move to the warnings and errors from top to bottom in your eclipse
Few shortcuts to see the errors in eclipse:
Next error: `Ctrl + .`
Previous error: `Ctrl + ,`
Quick fixes: `Ctrl + 1`
The cross sign indicates that the file web.xml has some error. Also, possibly some files within the 'jsp' and 'lib' directories also have error.
The yellow triangles are warnings. To see the details of all, Go to Window -> Show view -> Problems
I don't see anyone mentioning one thing that may be confusing to a beginner: the red X appears on the file with the error as well as on all its parents. These other marks are a great convenience when your tree is collapsed—they lead you to the file in error, but can also cause confusion when viewing an expanded tree.
Every error marked with the red X annotation also appears in the Problems view, if the view's filter is properly configured. You configure the filter through the view's local menu (accessed through the little downward-facing triangle in the top-right corner of the view's title bar).
It means your projects contains error, if appears red-cross.
It seems that your project contains error,if it shows red-cross
General way you can see Window > Show View > Problems
The easy way using shut cut key Alt+Shift+Q,X
Yes, it means you have an error, whereas the yellow triangle with the exclamation mark means you have a warning.
You can view the error by opening the file. The line with the error will an error mark on the left margin.