Netbeans doesn't output application tests - netbeans

Is it possible to output automaticaly the result of testing each application of a project in Netbeans? I mean output the result with Alt+F6, so that I do not need to change everytime the main class of my project in the properties.
Explanation:
My project has many classes with main methods
so to see the output of one specific application I need to go to:
Right click on the project and scroll down to the Properties
Select run on the left
And then change to the main class I want.
So my question is: is it possible to do it automatically?
Thanks

The answer is Shift+F6 :)
Having one main methode in the package is recommended!
Thanks

Related

Eclipse "top level elements" changes to "Working sets" on change of perspective

When I close my perspective B, and open it again, even if the B perspective "top level elements" property was "Projects", it gets changed to "top level elements".
However please note that when I open up the perspective the very first time, the property was "Projects".
I am sorry if this question is very elementary but I am quite new to Eclipse development.
Does anyone know which class this property belongs to, so I can override it when the Perspective is opened?
I suspect it should belong Common Navigator Framework and specifically the CommonNavigator class?
P.S. What would be the correct way to know such things, i.e. where is such an action defined and what function is it bind to? Is there any direct way or does it need a person with full knowledge of the eclipse framework?
Well just closing and opening a normal Project Explorer view always seems to revert to Working Sets so it looks like the view does not persist this setting.
You can find out some things about what classes are used by using Eclipse plug-in spy. You can also look at the plugin definitions and the source code. Project Explorer is in the org.eclipse.ui.navigator.resources plugin.
It looks like org.eclipse.ui.internal.navigator.workingsets.WorkingSetsContentProvider deals with this setting but I don't see an obvious way to change it.

Incorporate small swift project into another swift project

I have a swift project in Xcode that I am working on. I'll call it the primary project. I have most of it working. I was having trouble with date pickers, date ranges and date math so I started another project called StarEndDate with just one table view controller so I could tinker without messing up the primary project that is working. I finally have everything working the I want it in the StartEndDate project and now want to implement what I learned in the primary project. Do I just copy and paste chunks of code between the 2 projects or is there another less burdensome way to incorporate the small swift project into the primary project? I will never use any of the code again so I wanted to keep it simple. I can't seem to phrase what I want to do in searches well enough to get any results that would help so I would also appreciate help on how to describe what I want to do.
The easiest thing to do would probably be just adding these files from the original project into your new project.
So, if you right click (or Ctrl+click) in the project navigator, you get this menu:
Alternatively, from the top bar, you can open the "File" menu:
Either way, you want to select:
"Add Files to "YourProjectName"...
Or, you can use the keyboard shortcut: ⌥ + ⌘ + A.
Anyway, this will open up a window from which you can navigate to and select the files you want to add to your project. For this scenario, I'd recommend making sure you have "Copy items if needed" checked.

Parenthesis in Eclipse Run Configuration

Hi.
As you know, if there is already a Run configuration for a given
class with main type, Eclipse gives parenthesis and number at the
tail of the class name as in the attached image.
But even when there is no preexisting class with conflicting name,
why do I see it with paranthesized number at the end of (main type)
program name, like program(1), program(2)?
Do you have any explanation for this?
In the Launch Configurations window, there's a filter button in the toolbar (the "triple arrows" icon at the top of your screen shot). Clicking that drop-down allows to filter out (or not) various types of launches, including those that belong to closed or missing projects. If you un-check all of the filters you should be able to see the conflicting launch that's causing the name conflict.
I have had this before in Eclipse where I had a project with a runnable class (lets say the class was called MainRun) and then I close or delete the project from the Eclipse workspace. The MainRun run configuration disappears from the "Run Configurations" list. But if you later create a new project with a class called MainRun that you want to run, it somehow remembers that you used to have a configuration called MainRun, even though it is no longer in the list, and so your new one has to be MainRun (1). Could this be what is happening to you?

How to add views to Show In menu for particular file types

I use an older plugin called Veloeclipse for editing Velocity templates in Eclipse. There's been no development on this since 2009, which isn't a problem because it's mainly just for syntax highlighting and format validation. The really annoying thing about it, however, is that when I try to do Show In to view the current Velocity template within my Package Explorer or Project Explorer, the only available option is Properties. That's not really useful. I really need to be able to get to the file in one of the regular explorer views.
So I have sort of two questions:
Is there a way to configure this without having to monkey with any code? A configuration file or something? I've grepped through my Eclipse installation and haven't seen anything, but I'm hoping that there's something I'm missing.
So assuming that the answer to my first question is no, how do I go about modifying the plugin code so that it will show more than the Properties view in the Show In menu? Most of what I found on the plugin development wiki comes from the other direction: how to make your view or perspective appear in the Show In menu.
Any help with this would be hugely appreciated!
Try to check the plugin source code. it might do something different than other editors. What I mean is that the show in menu item that you have there is not the usual extension point but a hard coded context menu option.

Bypassing Lock on Generated Code in NetBeans 6.5?

In NetBeans the GUI Builder generates code that is off limits to you from the editor.
I know you can switch to Design Mode and specify custom code and then enter edit in indirectly that way, but it's a pain to not be able to edit text that's 2 lines from your cursor.
Can I allow editing within those regions... I promise I'll be careful :)
Thanks.
Note: I don't want to lose code generation
If you open it in an external editor, there are two possibilities:
there is no guarantee that the changes you make will work (and not break anything) in the Netbeans UI Editor
The next time you edit the file in Netbeans it will be regenerated.
Either way, probably not what you want. The best thing to do would probably be to make the whole design up in the gui editor and when you are happy with it, delete the comments and continue on.
[sarcasm]
With the drag and drop gui editor, what could you possibly want to change by hand anyway?
[/sarcasm] ;)
If you open the .java files in Notepad or WordPad, you'll find pairs of comments that say
// GEN-BEGIN: <name of section>
...
// GEN-END: <name of section>
Delete those comments, and two things will happen.
You'll be able to edit anywhere in the file in NetBeans.
NetBeans will not be able to regenerate the file from the GUI editor.
So it can be done, but don't do it unless you really mean it.
EDIT: "Note: I don't want to lose code generation." Ok, let's see here.
You want to change what is generated.
You don't want to lose code generation.
You don't want to use the facilities NetBeans provides for adding custom code.
It sounds like you're wishing yourself trouble. :D
I had a same problem. I extended JPanel with my own panel class and I was not able to pack it with the rest of UI. First I searched the web and I found your question. I was not able to find elegant solution to this problem.
Therefore, I decided to create another java class and copy NetBeans created code into it. It worked like a charm.
I agree, it would be nice if we can modify existing code like in .NET.
I copy the initcomponents() method, create my own method newInitComponents() paste the generated code, and override what needs to be overridden before i distribute the code. That way when a change is made in the editor, you can still copy paste the code into your new method. You keep the functionality without costing you the ability to override where necessary. Just call newInitComponents() in your constructor rather than the original. This is not the most efficient way of doing things, but it does what you want.
You can also try moving the .form file in
(project name)\src\(name of JFrame/JPanel).form
NetBeans will now see it as a .java file.
If you did not edit anything necessary for the GUI editor, you can move the .form file back into the src folder.
Can you subclass the class and redefine the method where this code is? Of course then you'll have to maintain the method over time as you make changes to the GUI.
You can maybe also look into AspectJ. It will modify the byte-code at build time and make the changes you define. Not sure if this gives you enough control over what code to change.
If you use APT you can rewrite source code at compile time. This way you can overwrite the code that's there at the moment. You could keep the new code in the same Java file along with comments to explain what is going on. This tutorial makes it pretty easy to get started. Copy that code, get it working, then tweak it to your liking. To find out where in the code the annotated method is call getPosition() on the Declaration.
Go to design page and select any one of the fields. Right click on any selected field and choose Customizer Code , In Customizer Code change all default code to custom creation . Now you can edit your design code as you like...
Very simple... the crappy UTF-8 did not let me compile one JasperReport (everything done by GUI). So, I needed to change Project to iso-8859-1. Result? The project is messed up and some of the things to correct are in the blocked parts of the code. So, I really NEED to edit those automatically generated parts. When they are regenerated, they will be fine because the project is now iso-8859-1.
Step # 1 Close the project in NetBeans
Step # 2 Delete the .form file from the source directory of your project
Reopen the project and it will be editable now!