Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-discussion] Build Questions (was Re: Question on some old classes/methods)

Mark Feblowitz MarkFeblowitz at comcast.net
Tue Oct 24 14:21:34 PDT 2006


I was finally able to debug the problem and to come up with a solution.

The problem is in ProjectManager.java: setCurrentProject has the side 
effect of displaying the project, using the standard 
displayCurrentProject method. This is probably a fine optimization 
for most uses of Protege. The LexGrid code wants to display the 
project in an Eclipse environment, though. So the caller has a 
choice: call code that doesn't set the current project (and break the 
metadata tab code) or call the code that sets the current project and 
have an exception in the LexGrid code when Protege tries to display 
to a nonexistent root frame.

My workaround is to replace the current setCurrentProject(Project 
project, boolean remote) method with the following:

    public void setCurrentProject(Project project, boolean remote) {
         setCurrentProject(project, true, false);
     }

and to add the following method:

    public void setCurrentProject(Project project, boolean remote, 
boolean suppressDisplay) {
         if (closeProjectRequest()) {
             _currentProject = project;
             if (_currentProject != null && !suppressDisplay) {
                 _projectPluginManager.afterLoad(_currentProject);
                 displayCurrentProject(remote);
             }
         }
     }

It might be better to factor out the call to displayCurrentProject 
from the setCurrentProject code, but that'd be a judgement call on 
the part of the designers.

How could I get this accommodated an upcoming Protege build?

Thanks,

Mark


At 03:08 PM 10/24/2006, Tania Tudorache wrote:
>Mark,
>
>You can load a project using a call like:
>
>Project prj = Project.loadProjectFromFile("/tmp/pizza/pizza.pprj", errors);
>
>This will set the correct current project.
>
>You also got a class not found error. The class that was not found 
>was in the jena.jar.  Did you add to your Eclipse project:
>
>- the protege.jar (or protege-cores sources)
>- the protege-owl.jar (or protege-owl sources)
>
>If you compile the protege-owl sources, than you need to add to the 
>Eclipse project all the jars from the protege owl plugin directory 
>(such as, jena.jar, owlsyntax.jar, etc.).
>
>Tania
>
>
>
>Mark Feblowitz wrote:
>>Since there's been radio silence on this, I'll restate my request 
>>as I currently understand it.
>>
>>What is the best way to load a project, such that currentProject is 
>>set correctly?  It seems like simply issuing a "new Project(...)"
>>doesn't do the trick.
>>
>>(Is that a bug or simply an incomplete creation/loading of the project?)
>>
>>It would help to see some code that loads a project (that is an Owl project).
>>
>>Thanks,
>>
>>Mark
>>
>>
>>At 10:09 AM 10/20/2006, Mark Feblowitz wrote:
>>>Ok -
>>>
>>>Forget all of my prior questions :-) Using ant instead of eclipse,
>>>I've been able to debug and diagnose the problem I'm having.
>>>
>>>You were right on the money!
>>>
>>>The LexGrid Protege in Eclipse code creates a project and project
>>>views, but does not set the current project.
>>>
>>>The problem comes when trying to get the current project.
>>>
>>>I assume that the LG code is using some outdated means of loading a
>>>project. Below is the method that appears to be flawed.
>>>
>>>Can you point me to something the does this correctly?
>>>
>>>Thanks!
>>>
>>>Mark
>>>
>>>from LgProtegeEditor.java:
>>>...
>>>public void init() throws SwingInitException {
>>>          try {
>>>                  final IFileEditorInput input = (IFileEditorInput)
>>>getEditorInput();
>>>                  if (input != null) {
>>>                          Collection errs = new ArrayList();
>>>                          p = new
>>>
>>>Project(((org.eclipse.core.internal.resources.File)
>>>
>>>input.getStorage()).getRawLocation().toString(), errs);
>>>                          if (!disposed) {
>>>                                  if (!errs.isEmpty()) {
>>>                                          for (Iterator errIt =
>>>                                         errs.iterator(); errIt.hasNext(); )
>>>
>>>Plugin.log(IStatus.ERROR,
>>>
>>>errIt.next().toString());
>>>                                              display.syncExec(new 
>>> Runnable() {
>>>                                                  public void run() {
>>>
>>>MessageDialog.openError(getSite().getShell(),
>>>                                         "Error",
>>>
>>>"Errors occurred initializing the Protege project. Refer to the 
>>>error log for  additional information.");
>>>                                                  }
>>>                                          });
>>>                                  }
>>>                                  if (p.hasCompleteSources()) {
>>>                                          // Create the 
>>> Swing-based canvas ...
>>>                                          pv = new ProjectView(p);
>>>                                          f.setLayout(new 
>>> java.awt.BorderLayout());
>>>                                          f.add(pv, "Center");
>>>                                          f.addWindowListener(new 
>>> WindowAdapter() {
>>>                                                  public void 
>>> windowClosing(WindowEvent event) {
>>>                                                          dispose();
>>>                                                  }
>>>                                          });
>>>                                          // Fresh starting point 
>>> for edit tracking ...
>>>                                          p.clearIsDirty();
>>>                                  } else {
>>>                                          throw new SwingInitException();
>>>                                  }
>>>                          }
>>>                  }
>>>...
>>>
>>>
>>>At 04:50 PM 10/17/2006, Tania Tudorache wrote:
>>> >Mark,
>>> >
>>> >I can't tell you what's going on, if I don't know in which line the
>>> >exception occurred. I suppose it occurred in
>>> >
>>> >String projName =
>>> >ProjectManager.getProjectManager().getCurrentProject().getName();
>>> >
>>> >which probably means that the project manager was not initialized
>>> >correctly, or that the project was not yet created.
>>> >
>>> >Maybe some things have also changed in Eclipse initialization as
>>> >well. I know that they support only partially Swing applications.
>>> >
>>> >Tania
>>> >
>>> >
>>> >
>>> >Mark Feblowitz wrote:
>>> >>I am using Java 1.5, either the IBM version or the Sun version.
>>> >>
>>> >>I'll see if I can get some help here in using eclipse to do the build.
>>> >>
>>> >>I'm bringing in the Protege source to debug what's happening in
>>> >>Protege. It's a problem with rendering the Metadata Tab, but looks
>>> >>like it occurs in the Protege code. Here's the exception:
>>> >>
>>> >>WARNING: _java.lang.NullPointerException
>>> >>_at
>>> >>edu.stanford.smi.protegex.owl.ui.importstree.ImportsTreePanel.cr 
>>> ea teOntologyBrowserHeader(Unknown
>>> >>Source)
>>> >>at
>>> >>edu.stanford.smi.protegex.owl.ui.importstree.ImportsTreePanel.<i 
>>> ni t>(Unknown
>>> >>Source)
>>> >>at
>>> >>edu.stanford.smi.protegex.owl.ui.metadatatab.OWLMetadataTab.crea 
>>> te MainPanel(Unknown
>>> >>Source)
>>> >>at
>>> >>edu.stanford.smi.protegex.owl.ui.metadatatab.OWLMetadataTab.init 
>>> ia lize(Unknown
>>> >>Source)
>>> >>at
>>> >>edu.stanford.smi.protege.widget.WidgetUtilities.createTabWidget( 
>>> Un known Source)
>>> >>at edu.stanford.smi.protege.ui.ProjectView.addTab(Unknown Source)
>>> >>at 
>>> edu.stanford.smi.protege.ui.ProjectView.createTabbedPane(Unknown Source)
>>> >>at edu.stanford.smi.protege.ui.ProjectView.<init>(Unknown Source)
>>> >>at
>>> >>org.lexgrid.ui.extension.protege.LgProtegeEditor$SwingFrameAccess.init(
>>> >>_LgProtegeEditor.java:180_ )
>>> >>at org.lexgrid.ui.extension.protege.LgProtegeEditor.getSwingFrame(
>>> >>_LgProtegeEditor.java:338_ )
>>> >>at
>>> >>org.lexgrid.ui.extension.protege.LgProtegeEditor$SwingInitThread.run
>>> >>( _LgProtegeEditor.java:266_ )
>>> >>
>>> >>Mark
>>> >>
>>> >>
>>> >>
>>> >>At 02:48 PM 10/17/2006, you wrote:
>>> >>>Mark,
>>> >>>
>>> >>>If you use the latest Protege 3.2 beta, than you should use Java 1.5.
>>> >>>
>>> >>>The Parser class is automatically generated by the Protege build
>>> >>>script. The instructions for building Protege out of the svn
>>> >>>repository or source code distribution are here:
>>> >>>http://protege.stanford.edu/doc/readme.html
>>> >>>
>>> >>>However, I don't think that you need to recompile Protege. I
>>> >>>suppose, you can use the Protege jars and only recompile the
>>> >>>Eclipse plugin code.
>>> >>>
>>> >>>Tania
>>> >>>
>>> >>>
>>> >>>Mark Feblowitz wrote:
>>> >>>>My prior questions had to do with my efforts to update the
>>> >>>>LexGrid "Protege in Eclipse" project. All seems to be well, with
>>> >>>>the exception of the Protege Owl Plugin's Metadata Tab.
>>> >>>>
>>> >>>>I'm trying to debug and have the need to debug the source of
>>> >>>>Protege. I've imported the Protege core, but have a persistent
>>> >>>>problem with two build errors:
>>> >>>>
>>> >>>>         The project was not built since its build path is
>>> >>>> incomplete. Cannot find the class file for
>>> >>>> javax.swing.plaf.metal.DefaultMetalTheme.
>>> >>>>
>>> >>>>     The type javax.swing.plaf.metal.DefaultMetalTheme cannot be
>>> >>>>     resolved. It is indirectly referenced from required .class files
>>> >>>>     Protege/src/edu/stanford/smi/protege/util
>>> >>>>ProtegePlasticTheme.java
>>> >>>>I'm using the IBM 1.5 JRE. When I switch to the Sun 1.5 JRE, I
>>> >>>>get 4 errors about
>>> >>>>
>>> >>>>     "Parser cannot be resolved to at type"
>>> >>>>and 42 errors about
>>> >>>>
>>> >>>>     jThe declared package "javax.swing.plaf.metal" does not match the
>>> >>>>     expected package "edu.stanford.smi.protege.util"
>>> >>>>
>>> >>>>I'm doing this work within ecplise 3.2.0
>>> >>>>
>>> >>>>What should I be using for my JRE? Any additional jars in the
>>> >>>>build path needed to reference 
>>> javax.swing.plaf.metal.DefaultMetalTheme?
>>> >>>>
>>> >>>>Thanks,
>>> >>>>
>>> >>>>Mark
>>> >>>>
>>> >>>>
>>> >>>>At 06:24 PM 10/13/2006, Tania Tudorache wrote:
>>> >>>>>Mark,
>>> >>>>>
>>> >>>>>We are very careful not to delete or move public classes or methods.
>>> >>>>>
>>> >>>>>The
>>> >>>>>
>>> >>>>>edu.stanford.smi.protege.util.FileHandler
>>> >>>>>
>>> >>>>>is in the same place :)
>>> >>>>>
>>> >>>>>In which version did Protege have a detachCurrentTab() method in
>>> >>>>>ProjectView? I think the method you are looking for is the
>>> >>>>>detachCurrentView().
>>> >>>>>
>>> >>>>>The DefaultEntry is still in the same place:
>>> >>>>>
>>> >>>>>edu.stanford.smi.protege.plugin. DefaultEntry
>>> >>>>>
>>> >>>>>Are you using the right jars?
>>> >>>>>
>>> >>>>>Tania
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> >>>>>Mark Feblowitz wrote:
>>> >>>>> > Add to that
>>> >>>>> >
>>> >>>>> >          edu.stanford.smi.protege.util.FileHandler
>>> >>>>> >
>>> >>>>> >
>>> >>>>> > At 05:05 PM 10/13/2006, Mark Feblowitz wrote:
>>> >>>>> > >> I was wondering what became of these two classes in Protege:
>>> >>>>> >>
>>> >>>>> >>          edu.stanford.smi.protege.ui.ProjectView - specifically
>>> >>>>> >> detachCurrentTab()
>>> >>>>> >>
>>> >>>>> >>          edu.stanford.smi.protege.plugin.DefaultEntry
>>> >>>>> >>
>>> >>>>> >> Have these been moved, removed or replaced? What would be
>>> >>>>> the new equivalents?
>>> >>>>> >>
>>> >>>>> >> Thanks,
>>> >>>>> >>
>>> >>>>> >> Mark
>>> >>>>> >> _______________________________________________
>>> >>>>> >> protege-discussion mailing list
>>> >>>>> >> protege-discussion at lists.stanford.edu
>>> >>>>> >> https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>>> >>>>> >>
>>> >>>>> >> Instructions for unsubscribing:
>>> >>>>> >> http://protege.stanford.edu/doc/faq.html#01a.03
>>> >>>>> >>
>>> >>>>> >
>>> >>>>> > _______________________________________________
>>> >>>>> > protege-discussion mailing list
>>> >>>>> > protege-discussion at lists.stanford.edu
>>> >>>>> > https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>>> >>>>> >
>>> >>>>> > Instructions for unsubscribing:
>>> >>>>> http://protege.stanford.edu/doc/faq.html#01a.03
>>> >>>>> >
>>> >>>>> >
>>> >>>>>_______________________________________________
>>> >>>>>protege-discussion mailing list
>>> >>>>>protege-discussion at lists.stanford.edu
>>> >>>>>https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>>> >>>>>
>>> >>>>>Instructions for unsubscribing:
>>> >>>>>http://protege.stanford.edu/doc/faq.html#01a.03
>>>
>>>_______________________________________________
>>>protege-discussion mailing list
>>>protege-discussion at lists.stanford.edu
>>>https://mailman.stanford.edu/mailman/listinfo/protege-discussion
>>>
>>>Instructions for unsubscribing: 
>>>http://protege.stanford.edu/doc/faq.html#01a.03
>>



More information about the protege-discussion mailing list