How to import the extended DJ package into my PDE project?

For the PDE (plug-in development environment) projects, you must put the external package you want to import in your project directory. Right click the root of your project in the Package Explorer View and choose ˇ°Propertiesˇ° item in the pop-up menu.

Choose "Java Build Path" tab. Click "Add JARs..." button. Find the expected package in your project directory and click "OK".

How to get the content of my SelectorLanguage Editor?

When you create the document for that Editor, keep a reference to that document by any reasonable means. Then when you want to have the text inside the Editor, simply call the get() method on that document.

How to import the DJ plug-in

In the plug-in.xml editor, set DJ plug-in as one of the required plug-in for your project.Then save the xml file, DJ package will be automatically added into the build path.

Project phase II clarification, What is that translator?

The purpose of the translator is to translate the last part of the user input (class dictionary) into a ClassGraph object. You may think immediately that we can simply do a string processing on the input, pick out that part, and feed it into a ClassGraph object to parse it. But that's no the case. Since before this stage, when you do the semantic checking, the entire input will be parsed into a SelectorLanguage (you can find this class in DJ plug-in) object, we should get the class dictionary part of the input by doing a traversal here.

Project phase II clarification, Reloaded!

The purpose of project phase II is to generate two class dictionaries (Original and Selected) from the SelectorLanguage input. Then how can you get the original one? OK, the original class dictionary can be obtained from the last part of the input. But how can you get the last part of the input? may use DJ traversal! But in order to use DJ traversal, I need to have the ClassGraph, the strategy and the object that I'm going to traverse. I can definitely write the strategy but how about the other two? Easy! Construct a ClassGraph for all the classes in "" package by using "new ClassGraph(true, false, ...)". You suddenly have the ClassGraph? Then what about the SelectorLanguage object that I will traverse? What? Haven't you ever heard the good news? The TA has generated all the necessary classes and also put them inside "" package. Simply use SelectorLanguage.parse()! It has never been such easy before! OK, since I have the ClassGraph, the strategy and the SelectorLanguage object, I may get anything I need from the SelectorLanguage input by simply traversing with an visitor. I think I'm pretty done!

How to create a classgraph for package

After consulting one of Prof Lieberherr's RAs who is responsible of maintaining DJ, I found out that it maybe very tricky to create a ClassGraph for a Java package, of which we only have the ".class" files, and especially if those ".class" files are inside a ".jar" package. Here's how we can do it: DJ will only search for ".java" and ".class" files within the current class path. So if ".class" files are contained in a ".jar" package, they will be skipped. So if we want to create such a ClassGraph, we must first extract the jar file into a directory, in which all the ".class" files of that package reside. And put this directory into your classpath. Then you may use "new ClassGraph(PKGName, true, false)" to create the ClassGraph we want (here it's "")!