Accidentally created Java application instead of JavaFX - netbeans

Using Netbeans 8.0.1, I have created a simple Java (ant) project instead of a JavaFX project. Is it possible to convert this project to a JavaFX project? In that case, how do I do that?
Thank you very much.

If you're using Java 8, the JavaFX classes are on your classpath.
You can just create a class that extends javafx.application.Application and implement the start(Stage stage)
and
main (String[] args)
methods.
Next, in Project Properties go to the "run" tab and select your new class as "Main Class"

Related

get all the classes with main method in Eclipse Java project

I'm working on an Eclipse plugin to help people manage their project.
Is there a way to list all the classes with the main method under a project by Java code?
I think the best practise is to use only keyboard.
Create new java class with Ctrl+n
on dialog box, enter its (class) name
use (left)Alt+v to easily tick checkbox for - public static void main(String[] args)
then press [enter] Finish and voila class is ready

How To Run JApplet Class As Main Project Class

Very simple question here: I'm using Netbeans and Im making an applet, how can I make it so that that my JApplet class runs whenever I het the big green play button (ie Run Project).
Steps that I took to create the project:
Create new Java Class Library
Add file > new JApplet File called "NewApplet"
This automatically generates the applet. It runs perfectly if you right click and select Run File. But yeah... how can I get the project or the IDE to recognize it as the main class??

Eclipse RCP Migration from 3 to 4: How to Replace PresenationFactory.createEditorPresentation()

We have a large RCP based on Eclipse 3.7 that we want to migrate to Eclipse 4. We were able to build the system successfully using the compatibility layer.
The Problem: We use our own WorkbenchPresentationFactory-Implementation that in turn uses a specialStackPresentation:
public class PresentationFactory extends WorkbenchPresentationFactory {
public PresentationFactory() {}
#Override
public StackPresentation createEditorPresentation(Composite parent, IStackPresentationSite site) {
return new SimpleStackPresentation(parent, site);
}
}
This SimpleStackPresentation is basically a copy of the original Eclipse 3.7 StackPresentation and accompanying "helper" classes altered so that there is always only one editor visible at a time, editors are never closed but hidden.
Now, the use of a PresentationFactory is deprecated officially in Eclipse 4, see:https://www.eclipse.org/eclipse/development/porting/4.2/incompatibilities.php#presentationAPI
Were do I start to implement the same behavior with Eclipse 4 in conjunction with the compatibility layer?
Any help is very much appreciated!
Regards
sascha

how to open a text editor in eclipse 4.4 programmatically?

I want to open a text editor in eclipse 4.4 programmatically. I've tried it using IDE class but it is not accessible in eclipse 4.4. How can I do this?
e4 only has parts, not editors and views. It also doesn't have any predefined text editors.
Assuming you want to have several editor parts open at the same time you need to define a 'Part Descriptor' in the application model for the editor.
You then create a part from the descriptor using:
#Inject
EPartService partService;
MPart part = partService.createPart("descriptor id");
You now need to add this to the application model. Usually this will be a child of an 'MPartStack':
#Inject
EModelService modelService;
#Inject
MApplication app;
MPartStack editorStack = (MPartStack)modelService.find("part stack id", app);
editorStack.getChildren().add(part);
Finally show the part:
partService.showPart(part, PartState.ACTIVATE);
The class you specify in the part descriptor for the editor will have to implement the text editor. You can use the JFace text editor classes but not the 'org.eclipse.ui.xxx' editor classes.
For a very simple text editor the TextViewer and Document classes are enough.

e4 Toolbar at Top Position invisible

I have a question regarding e4 rcp applications.
I am creating an Eclipse e4 RCP project which uses the compatibilty layer.
Basically I created an 3.x RCP project, a product and an Application.e4xmi to use e4 features in my 3.x RCP project. I did this to be able to use the compatibilty layer for stuff like the project explorer, the console etc....
I started with that tutorial: http://dirksmetric.wordpress.com/2012/08/01/tutorial-eclipse-rcp-e4-with-3-x-views-like-project-explorer-properties-etc/
and now I'm migrating my own plugins from 3.x to e4.
Till now that worked out pretty well. I can still use a multiparteditor from 3.x but also dependency injection for some parts. Now I'm facing a rather odd problem.
My Application has a Trimmed Window with a Main menu some parts and then there are the TrimBars...my problem.
The toolbar I create there is not shown if I choose the 'top' side...every other side is working.
In a pure e4 Application that is working fine. I'm not sure why...maybe you have an idea.
Thx.
After you have created your RCP application, you should have class ApplicationWorkbenchWindowAdvisor (extends WorkbenchWindowAdvisor) created for you. It has preWindowOpen() method overridden with IWorkbenchWindowConfigurer.setShowCoolBar(false). Change it to true:
public void preWindowOpen() {
IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
configurer.setInitialSize(new Point(400, 300));
configurer.setShowCoolBar(true);
configurer.setShowStatusLine(false);
configurer.setTitle("RCP Application");
}
Make sure that your XMI file defines the 'TOP' TrimBar with the id 'org.eclipse.ui.main.menu', there's currently some dependency on the handling code that requires this (i.e. it finds the trim bar by ID rather than position).