Web module from custom scratch in IntellijIDEA 11.1.3 - intellij-idea

When I create new project in the aforementioned IDE, I can select Web Module and then Web Module Type (HTML5 Boilerplate, Twitter Bootstrap, Node.js).
I want to write custom IntellijIDEA Plugin to add custom Web Module Type.
I expect following user action sequence:
User clicks File - New project
Then selects option Create project from scratch
Creates new Web Module
Chooses Custom Scratch web module type
Specifies some preferences (as on picture above)
Clicks Finish
Let say, that I have java class, which receives few arguments and generates all necessary files in new project folder.
How can I create an interface for passing some arguments to my java class, which will make all the rest? As it is made for Node.js Express App.

The documentation for tying into certain pieces of IntelliJ are in the format of "the code is the documentation". This is a bit difficult when you want to interface with commercial plugins only available in the Ultimate Edition.
For open-source integration, you should be able to download the source for the Community Edition and navigate to your heart's content.
For commercial plugin integration, you'll need to find the jar file for that plugin and take a look at the class/method structure to get a guage on what you'll need to call. As far as defining your components in the plugin.xml file, you'll need to look for extension points in the plugin's plugin.xml file and implement those interfaces. There is documentation on the IntelliJ site explaining how to define extension points and define implementations of extension points for other plugins.
I used both of these approaches when I wrote a plugin for configuring an internal framework where I work.

Related

Create GWT project in Intellij IDE

I'm beginner in using IntelliJ IDEA IDE and I want to create a new GWT project. I have added the GWT plugin to IntelliJ IDEA and now and I want to create a project. I googled but I didn't find a helpful tutorials or examples. Did you have guys a helpful tutorials to start. Thanks in advance.
Do not use the GWT project builders from IntelliJ or Eclipse. Both generate projects which use the same class path for client and server. In todays GWT development it is common to use a separate class path for client and server.
Depending on the server you prefer to use, choose:
https://github.com/tbroyer/gwt-maven-archetypes
in case you want to use Jetty or Tomcat on the server side or:
https://github.com/NaluKit/gwt-maven-springboot-archetype
in case you want to use Spring Boot.
How to create a new GWT project in IntelliJ
Create a new project: File → New... → Project...
Select Java EE (Legacy).
Select Java 8.
Do not use Java 9 or above unless you know what you're doing. Yes, GWT 2.8.2+ works with Java 11+, but you'll need to open some internal modules for it to work. If you just want to learn GWT, stay with Java 8.
In Additional Libraries and Frameworks, check ☑ Google Web Toolkit.
In GWT SDK, fill in the path to your GWT installation.
Check ☑ Create sample application and introduce a fully qualified class name for the main class.
Click Next, and fill in the rest of needed info for your new project (this has nothing to do with GWT).
You'll end up with something like this:
If you followed the steps closely, the sample project should be fully functional. IntelliJ should've created a Run configuration for you, too, so you can run the GWT app right away and see it in action:
This is all explained in the official help documentation for IntelliJ 2020.1, which was the last version to include GWT support out of the box.

How to properly import a Play 2+ project in IntelliJ 14+ with all integrated features (run, debug, test)?

I work on a Java based Play! project for severals months now and I'd like to import it completely in IntelliJ, meaning being able to run, compile, test and debug from IntelliJ, without the need to use the command line.
According to this post from Jetbrain, it seems to be possible, if I quote the article it says clearly : "Now you don’t need to switch between IntelliJ IDEA and Play console anymore. Everything is available right from your favorite IDE.", but I can't figure out a way to achieve this for now, even if I follow the tutorial provided by Jetbrains.
Here are the steps I've been throught :
Open my fav IDE IntelliJ ;)
Go to the project list window.
Import project
Import from external model and choose SBT as suggested in Jetbrains tutorial.
option "Use auto import" checked, option "create directories for empty content roots automatically" checked. Project SDK Java 1.7
Global sbt settings : JVM From project JDK.
Finish
By now, if I try to make the project and launch it from IntelliJ, I'll get scala compiling errors related to routes object. Thanks to this post, we can understand that this happens because scala routes are located to specific folders that needs to be included in IntelliJ sources settings for this project. So next step was :
File -> Project Structure -> Modules
Add target/scala-2.10/classes:target/scala-2.10/resources_managed:target/scala-2.10/src_managed as sources folders.
But my problem remains the same, routes object being unrecognized.
Notes : I have no scala facets in my project structure configuration nor can add one.
IntelliJ provides integrated support for the Play Framework for Scala and Java. Support is currently only available in IntelliJ Ultimate Edition (see the Frameworks and Technology section).
Assuming Ultimate Edition, the setup for Play is incredibly easy. Simply create a new project by importing build.sbt, then choose Add Framework Support and choose Play 2.
Once complete, you can start and stop Play using the Play 2 Run/Debug configuration. No command line necessary.
Here is a more in depth look at IntelliJ's Play project configuration.
You could try the command play idea if you are using play or activator idea if you are using activator. That will do the magic.

Defining an external tool for my IDE plug-in via Eclipse launching API

I tried to create, as user from my Xtext plug-in, a new external tool configuration to simply execute a .bat wich launches an external compiler of the language for which I'm implementing an IDE using Xtext. I did so by selecting External Tools -> External Tools Configurations... -> New Program, and then by filling the information about location of the .bat, working directory and arguments. This was very simple.
Now, I'm trying to define directly in my plug-in this external tool which executes my .bat, by using the Eclipse launching API, but I found very difficult to understand how I could obtain this... I don't understand if there is some class which implements ILaunchConfigurationDelegate that I can extend to automatically launch my .bat (or in general, to launch a program!).
Have you any hint, or is there some simple example about implementing an external tool that simply launches a .bat (or program in general), using Eclipse launching API?
Thanks in advance,
Marco

How to ensure eclipse plugin has required bundles available?

I'm just starting to develop a new eclipse plugin where I want a web application server running in Eclipse. I found a nice blog, OSGi as a Web Application Server, that describes how to do this. The author suggests creating a target environment for my bundle requirements, and some of those bundles get pulled in from the Equinox Project SDK (now called Equinox Target Components in Juno). I notice that the tutorial project runs fine when my target platform is the platform I created in the tutorial, but fails to start when it is the default platform. So, now for my question...
If I need bundles that are not part of the default, how will my plugin project get access to those bundles? Will I need to deploy them along with my plugin? How would I know if the user's eclipse does or does not already have those required bundles?
You was not much clear about what kind of application you are developing. Running a web server in an Eclipse IDE as a plugin don't make any sense to me. This kind of server application is best just running on top of Equinox.
Anyway, the right path is to create a "Product Configuration" file and add categories that contains the needed bundles (go to File/Plug-in Development/Product Configuration).
With this file you can run an instance of the product (inside the IDE) and can export it (create a zip containing all needed bundles)
And if you want to able your user to install plugin inside his IDE you must create a P2 repository (using a Target Definition File) and expose the exported directory within a Http server. You could research about Tycho to build this kind of components in a maven style.
Well, I'm not sure if re-inventing the wheel again is really sufficient.
You might take a look at Pax-Web for inspiration on how to do it, or take a look Apache Karaf as a OSGi-Container (using Pax-Web). Or even better start contributing to one of the two :-)

I cannot add web module to IntellIj 9 Ultimate

I wanted to add a JSP to my project and I think this is most conveniently done by adding a web module. Unfortunately when I do File->New Module the only types available are Java Module and Android Module.
I have tried turning on all likely plug-ins but no Web (or other module type, except Android) Module type appears.
Help About says it's IntelliJ 9.0.2 Ultimate (Personal License). The Register page appears to have a satisfactory license key.
Running on Windows XP.
You need to select the Java Module, and if your JEE integration plugin is enabled, you will be able to select the "web facet" later in your module creation.
You could also install the maven plugin and create a maven module based on the maven-archetype-webapp archetype.