Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Disable page in multi-page editor if syntax errors in main editor
Disable page in multi-page editor if syntax errors in main editor [message #1728606] Tue, 05 April 2016 19:11
David M. Karr is currently offline David M. KarrFriend
Messages: 580
Registered: July 2009
Senior Member
I'm working on a somewhat largish Eclipse plugin codebase that I've inherited. I'm the entire team, and this is my first Eclipse plugin work (although I've worked with Java since before the turn), so you can imagine there are lots of things I've had to figure out on my own. I have an issue with "multi-page editor" and detecting syntax errors that I can't quite figure out.

The plugin provides an editor for a particular obscure specification language. It integrates the use of a parser for this language, so users can get immediate feedback, along with other benefits.

The ecosystem for this language provides for the generation of an associated file that happens to be in XML format (doesn't really matter). It's useful for users to be able to quickly generate that associated file so they can inspect it. For reference, that associated view is called "Yin".

Instead of defining a top-level menu item to generate the file from the current editor, I decided it would be better to simply add a tab to the editor view with a "Yin" label. While viewing the source file, the user just clicks on that tab and they see the Yin contents. This editor view already had two tabs, one a "source" view for the original text, and a "Diagram" tab to show a graphical view of the information, so adding a third tab wasn't that big of a deal.

It was already using a subclass of MultiPageEditorPart to provide this functionality.

I've implemented this, and it works pretty well.

The problem is, if the original source has syntax errors, it's impossible to generate the Yin file. When I attempt to generate the file, I am able to get the error messages from the parser, but at this point there's not much point in reporting these specific errors, because the user can clearly see them in problem markers in the main source view. I could potentially change the text in the associated file view to "Unable to render, syntax errors" or some such punting.

What would make more sense to me is that as soon as a red mark appears in the main source view, then the tab for the Yin view would become insensitive, so the user couldn't switch to it. In order to do this, I'd have to have some sort of listener set up that can also manipulate the MultiPageEditorPart. I'd also have to figure out how to make a tab insensitive, which I didn't see from a quick survey of the MPEP api.

In the codebase, I find references to a "reconciling strategy" which seems like it would be in the picture somehow.

If anyone has implemented something similar, or understands the architecture of these components, I'd appreciate some useful advice.

If it helps, you can see the codebase that my fork is based on at https://github.com/xored/yang-ide . I've been making small changes (including the addition of the Yin view), which you won't see there, but that shouldn't matter too much.
Previous Topic:Strategies for making XML content in StructuredTextEditor be formatted, and read-only?
Next Topic:How to display plugin product icon launcher in Linux
Goto Forum:
  


Current Time: Thu Nov 15 00:31:43 GMT 2018

Powered by FUDForum. Page generated in 0.02151 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top