forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgard...@apache.org
Subject svn commit: r226895 - /forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/NavigationView.java
Date Mon, 01 Aug 2005 22:09:07 GMT
Author: rgardler
Date: Mon Aug  1 15:09:01 2005
New Revision: 226895

URL: http://svn.apache.org/viewcvs?rev=226895&view=rev
Log:
load document whenever the selection is changed to any resource in a project, not just the
project root (thanks to Anil Ramnanan, fixes FOR-587)

Modified:
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/NavigationView.java

Modified: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/NavigationView.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/NavigationView.java?rev=226895&r1=226894&r2=226895&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/NavigationView.java
(original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/views/NavigationView.java
Mon Aug  1 15:09:01 2005
@@ -83,22 +83,26 @@
     /**
      * When the selection in the navigator view is changed 
      * we look to see if the new selection is an IProject.
-     * If it is then we load the site.xml file into this
-     * SiteXMLView.
-     */
+     * If it is then we load the relevant navigation
+     * configuration file.
+     */    
     public void selectionChanged(IWorkbenchPart part, ISelection selection) {
         if (selection instanceof IStructuredSelection) {
             Object first = ((IStructuredSelection) selection).getFirstElement();
             IResource resource = (IResource) first;
-            if (resource instanceof IProject) {
-                activeProject = (IProject) resource;
-                projectName = activeProject.getProject().getName();
-                xDocPath = (activeProject.getProject().getLocation()
+            if (resource != null) {
+            	 IProject newActiveProject = resource.getProject();
+            	 if (newActiveProject != activeProject){
+                     // TODO: only attempt to load config file if this is a Forrest project
+            		 activeProject = newActiveProject;
+            		 projectName = activeProject.getProject().getName();
+            		xDocPath = (activeProject.getProject().getLocation()
                         .toString()
                         + java.io.File.separator);
-                path = xDocPath + getFilename();
-                document = DOMUtilities.loadDOM(path);
-                treeViewer.setInput(document);
+            		path = xDocPath + getFilename();
+            		document = DOMUtilities.loadDOM(path);
+            		treeViewer.setInput(document);
+                 }
             }
         }
     }



Mime
View raw message