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
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • What Are Protocol Buffers?
  • My Experiences with Maven in IntelliJ IDEA and NetBeans IDE
  • Hack OpenJDK with NetBeans IDE
  • Develop and Debug C++ Messaging Client Using AMQP Protocol in Apache ActiveMQ Artemis

Trending

  • Spring WebFlux Retries
  • LTS JDK 21 Features
  • Next.js vs. Gatsby: A Comprehensive Comparison
  • Automated Testing: The Missing Piece of Your CI/CD Puzzle
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. Interview: Google Protocol Buffer Plugin for NetBeans IDE

Interview: Google Protocol Buffer Plugin for NetBeans IDE

Geertjan Wielenga user avatar by
Geertjan Wielenga
·
Jan. 30, 09 · News
Like (0)
Save
Tweet
Share
22.46K Views

Join the DZone community and get the full member experience.

Join For Free

One of the students in the recent NetBeans Platform Certified Training in Warsaw, Piotr Tabor, has been working on a very interesting certification project: treating NetBeans IDE as a tools platform, he's created features for working with Google Protocol Buffers.

Certification projects are, essentially, homework that students do after the course to prove that they have understood the material. They can choose the topic themselves, so long as it involves the usage of the NetBeans APIs in some way. Upon successful completion of this homework task, they become NetBeans Certified Engineers. Below follows an interview with Piotr, where he talks about his project, the things he learned, and the NetBeans Platform in general.

Hi Piotr, can you start by saying a bit about who you are? I'm a PhD student at the University of Warsaw. I am working on new ideas connected to object databases and database query languages (http://sbql.pl/). For a living, I'm working as a Java Architect and developer, creating infrastructures that enable the integration of web portals.

You created a NetBeans plugin for 'protocol buffers'. Why did you do that? I like "protocol buffers" and there was no support for this technology in IDEs (neither NetBeans IDE nor Eclipse). And I also had to do a project to finish the NetBeans Platform Certified Training. The plugin's project page is http://code.google.com/p/protobuf-netbeans-plugin/.

Can you say a few things to introduce us to 'protocol buffers', such as who uses them and why? Protocol buffers ("protobuf") is a technology by Google that has similar goals to XML: a data interchange  format that is hierarchical and independent of the platform and developer's environment. The problem with XML is that it is very slow in parsing and that it is space ineffective. There is no such drawback in protobuf, because of its binary format.

To use protobuf, you have to write a description of a message, in a simple but special language, and then use the "protoc" (protobuf compiler) program to generate serialize, deserialize and transport classes for Java, C++ and Python. There are also "unofficial" (not provided by Google) generators to other languages.

You can also generate an RPC service, based on the message format you created. That's a very effective alternative to Web Services.

So your plugin supports this language. Can you describe the main features? I provided editor support for *.proto files (message format description files), with syntax coloring, tree navigation through the code, error markers on the lines where the error is found, and context-aware code completion:

You also can regenerate code (using protoc), by selecting the "Regenerate" action from the context menu.

Finally, I created my own Update Center, which contains the modules that make up this plugin. Go here to see it, register it in the Plugin Manager, and you'll be able to install my project into your IDE.

Can you show some more screenshots?

Error marks in the editor:

Syntax navigation:

Generate Java code from Proto file in the editor:

Generate Java code from multiple Proto files in the explorer views:

Proto file template:

Options window extension for Protoc compiler:



Which feature was the most challenging to create?
Context aware code completion was the most complicated  part  of the code. There were two problems:

  • How to acquire ASTTree (parsing result of current code) from Schliemann. I found the sources of the "AST Browser" in NetBeans to learn how to do that.
  • How to know in which syntax construction the caret  is? The problem was connected to the fact that Schliemann recognizes whitespace chars (SKIP syntax tokens) as part of previous syntax construction.

What are the main NetBeans API classes that you used?

  • Schliemann
  • AST* from "General Language Framework" API
  • CodeCompletionProvider
  • FileObject
  • DataObject
  • Node
  • Annotation
  • OutputListener
  • NbProcessDescriptor.

Did you enjoy creating the plugin? What did you like most & least about creating it? Sure. It's quite simple compared to the usefulness of the results you acquire. There is only the general "huge API" problem: there are so many things available in the API that you never really know if the functionality you are coding is already available in existing NetBeans API libraries or not.

Do you have any tips for people beginning to use the NetBeans Platform?

  1. Search for tutorials via Google, in the NetBeans Developer FAQ, and on the NetBeans Platform Homepage.
  2. Look for similar functionality as you need in already existing plugins and in NetBeans IDE itself. Examine the sources and then write your code.
  3. Install "Tools" -> "Plugins" -> "Available Plugins" -> "NetBeans API Documentation". NetBeans code completion for NetBeans API classes is very helpful.

Are you going to continue developing this plugin and, if so, which features will be added next? Yes. At least I want to fix bugs and it would be cool to integrate code generation with the build process. I'm not sure if I should do that by coding in my plugin automatic tweaking  ./nbproject/build-impl.xml file or is there some layout.xml binding to provide my own build goal for "generate-sources" phase. (It works this way in Maven 2, to which I contributed some time ago ).

Any final thoughts? Thanks to Karol Harezlak, Toni Epple and Geertjan for the NetBeans Platform Certified Training in Warsaw, where I learned that creating plugins is relatively easy.

 

Integrated development environment NetBeans Google (verb) Buffer (application) Protocol (object-oriented programming) Interview (journalism)

Opinions expressed by DZone contributors are their own.

Related

  • What Are Protocol Buffers?
  • My Experiences with Maven in IntelliJ IDEA and NetBeans IDE
  • Hack OpenJDK with NetBeans IDE
  • Develop and Debug C++ Messaging Client Using AMQP Protocol in Apache ActiveMQ Artemis

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

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

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: