DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Key Takeaways From Integrating a RAG Application With LangSmith
  • Improving Java Application Reliability with Dynatrace AI Engine
  • Enabling Single-Sign-On in SaaS Application
  • Reimagining Innovation: How Citizen Application Development is Reshaping the Modern Enterprise

Trending

  • Key Takeaways From Integrating a RAG Application With LangSmith
  • 5 Common Security Pitfalls in Serverless Architectures
  • How SaaS Architectures Break at Scale — and the Engineering Decisions That Prevent It
  • DevOps and Platform Engineering Readiness Checklist: Everything Needed for a Scalable, Secure, High-Velocity Delivery Platform
  1. DZone
  2. Coding
  3. Tools
  4. How to Create a Custom Project Type in a Mavenized NetBeans Platform Application

How to Create a Custom Project Type in a Mavenized NetBeans Platform Application

By 
Geertjan Wielenga user avatar
Geertjan Wielenga
·
Sep. 24, 10 · News
Likes (0)
Comment
Save
Tweet
Share
15.4K Views

Join the DZone community and get the full member experience.

Join For Free

Let's take the NetBeans Project Type Module Tutorial and port it to a Maven-based NetBeans Platform application. In contrast to the Hello World Maven NetBeans RCP article, we'll now use the NetBeans IDE's tooling, since the aforementioned article has laid the foundation that we need for using the NetBeans IDE's Maven tooling intelligently.

Take the following steps:

  1. Create the project as follows:






  2. Right-click on the node with the orange icon ("NetBeans Platform based application"), which is the application node, and choose "Build with Dependencies".

  3. Right-click the application node and choose Run. Here's your application:


  4. Copy the three Java classes from the "NetBeans Project Type Module Tutorial" into "TextAnalyzerProjectType NetBeans Module", which is the functionality module. Specifically, put them into the main package within "Source Packages", which is "com.text.analyzer". Copy the two icons into "Other Sources", specifically into "src/main/resources/com.text.analyzer". Make sure that you change the location of the icons in the two Java classes where they are used, otherwise they will not be found when you run the application.

  5. In the POM file of the functionality module, define the "dependencies" section as follows:
         <dependencies>
            <dependency>
                <groupId>org.netbeans.api</groupId>
                <artifactId>org-openide-util</artifactId>
                <version>${netbeans.version}</version>
            </dependency>
            <dependency>
                <groupId>org.netbeans.api</groupId>
                <artifactId>org-netbeans-modules-projectuiapi</artifactId>
                <version>RELEASE691</version>
            </dependency>
            <dependency>
                <groupId>org.netbeans.api</groupId>
                <artifactId>org-openide-util-lookup</artifactId>
                <version>RELEASE691</version>
            </dependency>
            <dependency>
                <groupId>org.netbeans.api</groupId>
                <artifactId>org-netbeans-modules-projectapi</artifactId>
                <version>RELEASE691</version>
            </dependency>
            <dependency>
                <groupId>org.netbeans.api</groupId>
                <artifactId>org-openide-filesystems</artifactId>
                <version>RELEASE691</version>
            </dependency>
            <dependency>
                <groupId>org.netbeans.api</groupId>
                <artifactId>org-openide-loaders</artifactId>
                <version>RELEASE691</version>
            </dependency>
            <dependency>
                <groupId>org.netbeans.api</groupId>
                <artifactId>org-openide-nodes</artifactId>
                <version>RELEASE691</version>
            </dependency>
        </dependencies>
  6. In the POM file of the application node, add this dependency:
            <dependency> 
               <groupId>org.netbeans.modules</groupId>
                <artifactId>org-netbeans-modules-projectui</artifactId>
                <version>RELEASE691</version>
            </dependency>
    The above is needed because we're depending on the Project UI API (see step 5 above). In that particular API, the "OpenIDE-Module-Needs" key is used in the manifest to specify that "ActionsFactory", "OpenProjectsTrampoline", and "ProjectChooserFactory" are needed by this module. Therefore, a module that implements and provides those classes is required, which is the Project UI module, which implements Project UI API. To ensure that that module will be available at runtime, you specify the dependency above as described, in the POM file of the application node. For details, go here.

  7. Repeat steps 2 and 3 above. Then open the Favorites window and browse to a folder that has a subfolder named "texts". Right-click on the folder that has a subfolder named "texts" and then click "Open Project". Here's your application, with the project opened:

 

Congrats, you've now ported the sample to a Maven based NetBeans Platform application.

application NetBeans

Opinions expressed by DZone contributors are their own.

Related

  • Key Takeaways From Integrating a RAG Application With LangSmith
  • Improving Java Application Reliability with Dynatrace AI Engine
  • Enabling Single-Sign-On in SaaS Application
  • Reimagining Innovation: How Citizen Application Development is Reshaping the Modern Enterprise

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook