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 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
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
Partner Zones AWS Cloud
by AWS Developer Relations
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
Partner Zones
AWS Cloud
by AWS Developer Relations

Trending

  • Building A Log Analytics Solution 10 Times More Cost-Effective Than Elasticsearch
  • Playwright JavaScript Tutorial: A Complete Guide
  • Apache Kafka vs. Message Queue: Trade-Offs, Integration, Migration
  • Build a Simple Chat Server With gRPC in .Net Core
  1. DZone
  2. Coding
  3. Languages
  4. Dynamic JFace XML TableViewer Tutorial

Dynamic JFace XML TableViewer Tutorial

Glenn Galang user avatar by
Glenn Galang
·
Nov. 18, 08 · News
Like (0)
Save
Tweet
Share
15.68K Views

Join the DZone community and get the full member experience.

Join For Free

The following tutorial will show you how to build a dynamic JFace TableViewer driven from an XML file. The beauty of this solution is that your data model is decoupled from view logic so when the XML data changes you don’t need to change the concrete code.


It’s a pretty simple tutorial which should take around 5 – 10 minutes to complete.

Step 1. Create a new project in eclipse 3.4

Open Eclipse -> Click File -> new Plug-in project -> Next

To keep the examples simple type galang.research in the project name and click next. You can type any name you want though you’ll need to factor this into all the code samples I will provide.

Select Yes in the Rich Client Application section, click next.

Select RCP application with a view, click next.

Select Add Branding.

Click finish, then Yes.

Unzip the file located at the URL below and save the test.xml within the zip file as /temp/test.xml to your local pc.

https://sourceforge.net/project/showfiles.php?group_id=228168&package_id=299144&release_id=640558

Right click project and configure build path, link source, then click browse and select the src location to where you have unzipped the file above.

Enter srcExt fo folder name

Your package explorer should look like this.

Modfy View.java in the galang.research package with the following code.

/**

* This is a callback that will allow us to create the viewer and initialize

* it.

*/

public void createPartControl(Composite parent) {

viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL

| SWT.V_SCROLL);





viewer.setContentProvider(new RowContentProvider());

RowLabelProvider labelProvider = new RowLabelProvider();

labelProvider.createColumns(viewer);

viewer.setLabelProvider(labelProvider);

viewer.setInput(getViewSite()); 

}

And add the following imports to View.java

import galang.research.jface.RowContentProvider;

import galang.research.jface.RowLabelProvider;

 

Double click plugin-xml and click the Lanch eclipse application.

Congratulations, you’ve just completed this tutorial. Have a play around with the /test/temp.xml and see how it dynamically impacts the RCP application after restarting it.

From http://ggalangblog.blogspot.com.

XML JFace

Published at DZone with permission of Glenn Galang. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • Building A Log Analytics Solution 10 Times More Cost-Effective Than Elasticsearch
  • Playwright JavaScript Tutorial: A Complete Guide
  • Apache Kafka vs. Message Queue: Trade-Offs, Integration, Migration
  • Build a Simple Chat Server With gRPC in .Net Core

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

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: