How Can I Save A Class Diagram In Intellij? - intellij-idea

I discovered that in Intellij I can create nice class diagrams by going to New > Diagram > Java Class Diagram. I can do everything that I want to do, except figure out how to save the diagram after I'm done. When I create a diagram, save it, shut down Intellij, and then start it up again, I see that the diagram that I had just "saved" has reverted to a generic window displaying all of the packages in my project. I realize that I can save the diagam in a PNG format, but I don't want to do that. I want to be able to save it in an editable format? Thoughts?

The top left save disk does nothing. The right save disk will actually save the diagram.

IntelliJ IDEA 15
A general method (that works when you can't find/remember something)
press Ctrl + Shift + A (or go to Help > Find Action)
type "Save d" (or just "dia")
double click on the "Save diagram" row
select the path where you want to save it > OK

Update 2022
Click this icon or right-click a blank spot on the diagram and select Export Diagram. Click Export to File then pick your format.

Related

Cannot Delete UML diagram in Intellij

I am new to Intellij, I created an UML diagram for a class as below but didnt save it.
after closing the tab i could always see this file when i do double shift and search for files as below
Can someone tell me how to delete this UML diagram. as its bit irritating to see this all the time. Any help will be appreciated. Thanks in Advance
Your UML-Diagram is saved as an .uml file. Closing the tab does not delete it.
To find the location of the file open it and click on Select opened file.
Its the "aiming" symbol in your Project-Tab.
Then delete the file when you found it.

Refactored "MySettings" to "Settings" on accident. Cannot revert back to normal

I was trying to troubleshoot why my default settings. Settings values weren't updating. Visual Studio showed me a recommended fix of refactoring "MySettings" to "Settings" and now every reference to My.Settings is broken and the word settings has turned green (used to be white).
I tried just hitting the undo button, and then closing without saving. But it didn't fix anything. Makes me think it isn't a project issue but a VS2016 issue.
My.Settings.ActiveDrive = My.Settings.Default.ActiveDrive
My.Settings.Save()
This is the code I was altering. I was trying to error proof my code and reset the value to the default to simulate a new user with no saved settings yet. Then I switched Settings to MySettings to see if that'd do anything and VS asked if I wanted to refactor MySettings to just Settings. I said yes... And now the code is broken.
I just want Settings to go back to normal. The way it worked before I hit "refactor MySettings".
I was actually able to figure it out.
For anyone out there that runs into this issue in the future (Since I found 0 results on google about this), you simply go to your solution explorer in the top right, click the drop down icon next to Settings.settings, double click on Settings.Designer.vb, ctrl+f and search for "settings" and rename any class designated "Settings" result back to "MySettings". Don't rename the other "Settings" appearances otherwise it'll break again.
Then your code will go back to having a read-only "settings" option and a class option called "MySettings".

Use the same file in more than one solution

Just wondering whether it is possible to used a single form into more than 1 solutions?
I have frmbookstock.vb in solution A and i need to use frmbookstock.vb in solution B as well. So every time i change the content of the frmbookstock.vb, both of the solution will received the update as well.
I have tried to import it to another solutions, but it will create a new file under the new solution.
Yes you can.
In Visual Studio go to the folder that you want to add the existing item to.
Right click and Go to "Add".
Select "Existing Item".
Select your file.
IMPORTANT STEP: Select the little dropdown arrow next to the "Add" button.
Select "Add as Link" instead.
This will place a link to the original file in the source folder.
So now you have two Visual Studio items in different projects that point to the same, real, file on your hard drive.

"There is no editor available for ../Form1.vb" error?

I was happily using VB.NET, saved, and, well, there was a blackout.
Probably lucky? Well, now I open my project just fine, double click the Form1.vb and.... "There is no editor available for ../Form1.vb, make sure the application for the file type (.vb) is installed."
.......... Did something go wrong with my project? Is it dead?
Windows 7, Visual Basic 2010 Express.
What should I do?
The same thing just occurred to me but I couldn't get it fixed trying the previous answers. For some reason, one of my references Microsoft.Office.Core had a yellow exclamation point on it.
Simple Solution
Solution Explorer
Expand References
Right click on the item with "Yellow Triangle w/ "!" point"
Select "Remove"
Open the "Build" Menu at the top
Select Rebuild "filename"
Once this was done, I could open my forms correctly.
It's difficult to imagine what you're seeing. I've seen plenty of cases where the design view won't open for whatever reason, but I've never been unable to view the code for the form.
First thing to try is navigating to your project folder in Windows Explorer, right-clicking on the Form1.vb file, and trying to open it in Notepad. This is pretty much the ultimate test. If you can open it in Notepad, your work is salvageable. If not, the file is corrupted and your best bet is to start over. I suppose if you really feel that you have a lot invested, you could try various file recovery techniques, but considering it's a single form file, I seriously doubt it's worth the time or expense.
If that succeeds, and you can open the file in Notepad, select all the code and copy it to the clipboard. Now go back into Visual Studio, and add a new Form to your project. Delete everything in the new form's code file and paste the salvaged code from your original form back in. You still won't be able to open the form in the designer though, and you'll likely be missing references to all of your controls. Ignore all those squiggly underlines for now.
To fix that, you need to go back to Windows Explorer, and find a file named Form1.Designer.vb. This is the partial class that the designer saves information into; it contains declarations for all of your controls and the properties you set for those controls at design time. Just as before, right-click on this file and open it in Notepad. Select everything and copy it to the clipboard. Now go back to Visual Studio, and click on the "Show All Files" button at the top of the Solution Explorer (hover over them to read the ToolTips). You'll see a bunch of extra junk show up, but what you're primarily interested in are the drop-down arrows that just appeared to the side of every Form class. Expand the new form you added in the previous step, and find it's .Designer file. Delete everything that's in there now, and paste in the code from your salvaged form's .Designer file.
You now have an exact copy of your old form in your project. You can delete that old, corrupted form file, because you're no longer using it. You'll also probably want to change the name of the new file itself by right-clicking on it in the Solution Explorer—right now, it's named Form1 just like your old form, because it's an exact copy of that form. The code says it's name is Form1 and couldn't care less about your file name. Clean and rebuild your project, and if things go your way, everything should be back to normal.
Windows 7/ Vista:
Try right clicking the .vb file and selecting the "Previous versions" tab. When the list has loaded (if it has) select the most recent file from the list and select "Restore". Now reload your project, try doing this with all of the form files, e.g. "Form1.resx" and "Form1.designer.vb" and "Form1.vb" and then reload the project.
It implies that the file is corrupted.Replace an uncorrupted copy of that file in the corresponding directory and then try.
I had the same problem and it was from a bad reference to Excel caused by copying the project from a Win7 machine to a Win8 machine probably.
Open the solution explorer and expand the references You will see two references with the yellow exclamation mark icon beside them indicating a problem - Microsoft.Office.Core - Microsoft.Office.Interop.Excel Right click on both these icons and click remove Your form should load now, if not, save the project, close it then reopen it.
i have this problem too . when i restart Visual Studio the form create successfully and show it's designer.
I've created the Form with a different version of VS, other than 2012 (eg VS 2010, VS 2013, VS 2015; I've used VS 2015). Save the Form in the solution, open the solution with VS 2012 and include the form in the solution. It worked for me.
To fix the problem you need :
1) NotePad++
And you should follow this simple steps :
1) Close Visual Studio .
2) Go to the Backup Folder of your VS version usually in : "C:\Users(your user name)\Documents\Visual Studio (year)\Backup Files\your project or application name" .
3) Open the last Backup file of your corrupted file , usually the name format is : "Recovered-month.-day-year-time.(Your File Name).cs" with NotePad++ , and copy the source code .
4) Go to your corrupted file in the project folder and open it with NotePad++ , Edit => Select All => Past the source code and Save .
5) Go to windows start list and search for : "Visual Studio Tools" folder , open it and double click on : "Developer Command Prompt for VS(year)" .
6) Write this two codes in the Developer Command Prompt : "devenv.exe /setup" and then "devenv /resetskippkgs" .
7) Open your project .
Note : if this didn't work for you try to do the steps before in this arrangement :
1) => 2) => 3) => 4) => 7) => 1) => 5) => 6) => 7)
and your problem will be fixed .
It works 100% for me , i hope this will helps you
Try changing the security permissions on the form affected. Right click the file, go to properties then security and change the access ability to everyone.

How do I create a new class in IntelliJ without using the mouse?

Is there a way to create a new class in a desired location without using the mouse in IntelliJ?
I understand there is no keyboard binding in the default keymap.
If you are already in the Project View, press Alt+Insert (New) | Class. Project View can be activated via Alt+1.
To create a new class in the same directory as the current one use Ctrl+Alt+Insert (New...).
You can also do it from the Navigation Bar, press Alt+Home, then choose package with arrow keys, then press Alt+Insert.
Another useful shortcut is View | Select In (Alt+F1), Project (1), then Alt+Insert to create a class near the existing one or use arrow keys to navigate through the packages.
And yet another way is to just type the class name in the existing code where you want to use it, IDEA will highlight it in red as it doesn't exist yet, then press Alt+Enter for the Intention Actions pop-up, choose Create Class.
You can also use: ctrl+alt+insert
With Esc and Command + 1 you can navigate between project view and editor area - back and forward, in this way you can select the folder/location you need
With Control +Option + N you can trigger New file menu and select whatever you need, class, interface, file, etc. This works in editor as well in project view and it relates to the current selected location
// please consider that this is working with standard key mapping
For Mac Os, command + 1 , then press control + return
On Mac OS 10.14.5, Idea Intellij 2019.1.3 - Press command + 1 to navigate to project files then press control + n
On Mac you can navigate to the location in Project view where you want to create your class and then use ⌘N followed by Enter.
I do this a lot, and I don't have an insert key on my laptop, so I made my own keybinding for it. You can do this by opening Settings > IDE Settings > Keymap and navigating to Main menu > File > New... (I would recommend typing "new" into the search box - that will narrow it down considerably).
Then you can add a new keyboard shortcut for it by double clicking on that item and selecting Add Keyboard Shortcut.
Alt-Home until you're in Packages view
Down-arrow until package is highlighted
Alt-insert
Enter X 2
Type name
$PROFIT$
If you use Mac, you are in luck. One can change the keymap for Intellij as Mac OS X, then you can use option+C.
In my (linux mint) system I can not get working combination alt+insert so I do the next steps:
alt+1 (navigate to "tree") --> "context button - analog right mouse click" (between right alt and ctrl) -- then with arrows (up or down) desired choice (create new class or package or ...)
Hope it helps some "mint" owners )).
I also searched this answer. Equivalent of command+N on Mac OS for Windows is ctr + alt + insert which #manyways already answered. If you searching this in settings it is in Settings > IDE Settings > Keymap, Other > New ...
If the difficulty is in finding the option that makes .java or .class files (Like me), then simply,
click on the folder you want to create file on. select new, and type file's name along with extension.
For example, instead of, helloWorld type helloworld.java or any file extension you desire.