Revision: 3390
          http://vexi.svn.sourceforge.net/vexi/?rev=3390&view=rev
Author:   mkpg2
Date:     2009-02-17 02:50:35 +0000 (Tue, 17 Feb 2009)

Log Message:
-----------
Development. Cleaning up.

Modified Paths:
--------------
    trunk/tools/org.vexi.vexidev/plugin.xml
    trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/IConstants.java
    trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/VexiProject.java
    
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/debug/VexiRunnerConfig.java
    
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/debug/ui/LaunchShortcut.java
    
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/navigator/VexiModelProvider.java
    trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/EditableList.java
    
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/projectprops/ProjectPathsBlock.java
    
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/projectprops/ProjectsPage.java
    
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/projectprops/SourcePage.java

Added Paths:
-----------
    trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/IVexiPathList.java
    trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/PathPage.java
    
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/preferences/LibrariesEditor.java
    
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/preferences/VexiLibraryPreferences.java
    
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/preferences/VexiMainPreferences.java

Removed Paths:
-------------
    trunk/tools/org.vexi.vexidev/src/org/python/pydev/core/
    
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/preferences/VexiPreferencePage.java
    
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/projectprops/PathPage.java

Modified: trunk/tools/org.vexi.vexidev/plugin.xml
===================================================================
--- trunk/tools/org.vexi.vexidev/plugin.xml     2009-02-16 03:34:13 UTC (rev 
3389)
+++ trunk/tools/org.vexi.vexidev/plugin.xml     2009-02-17 02:50:35 UTC (rev 
3390)
@@ -5,9 +5,15 @@
          point="org.eclipse.ui.preferencePages">
       <page
             name="Vexi Preferences"
-            class="org.vexi.vexidev.ui.preferences.VexiPreferencePage"
-            id="org.vexi.vexidev.preferences.VexiPreferencePage">
+            class="org.vexi.vexidev.ui.preferences.VexiMainPreferences"
+            id="org.vexi.vexidev.preferences.VexiPreferences">
       </page>
+      <page
+            category="org.vexi.vexidev.preferences.VexiPreferences"
+            class="org.vexi.vexidev.ui.preferences.VexiLibraryPreferences"
+            id="org.vexi.vexidev.preferences.VexiLibraries"
+            name="Vexi Libraries">
+      </page>
    </extension>
    <extension
          id="org.vexi.vexidev.preferences"

Modified: trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/IConstants.java
===================================================================
--- trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/IConstants.java   
2009-02-16 03:34:13 UTC (rev 3389)
+++ trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/IConstants.java   
2009-02-17 02:50:35 UTC (rev 3390)
@@ -27,6 +27,7 @@
        
   
   final String PREF_VEXIBINARY = "vexiBinary";
+  final String PREF_VEXILIBS = "vexiLibs";
        
   final String PREF_COL_PROCINSTR = "procInstrColor";
   final String PREF_COL_STRING = "stringColor";

Added: trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/IVexiPathList.java
===================================================================
--- trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/IVexiPathList.java        
                        (rev 0)
+++ trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/IVexiPathList.java        
2009-02-17 02:50:35 UTC (rev 3390)
@@ -0,0 +1,10 @@
+package org.vexi.vexidev;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+
+public interface IVexiPathList {
+    public void setPath(List<IResource> path);
+    public List<IResource> getPath();
+}


Property changes on: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/IVexiPathList.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/VexiProject.java
===================================================================
--- trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/VexiProject.java  
2009-02-16 03:34:13 UTC (rev 3389)
+++ trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/VexiProject.java  
2009-02-17 02:50:35 UTC (rev 3390)
@@ -28,23 +28,110 @@
 import tim.dynamic.js.JSON;
 
 public class VexiProject extends PlatformObject implements IConstants{
-
+       
        IProject project;
-       private VexiPath vexiPath = null;
        
        public VexiProject(IProject project) {
                this.project = project;
        }
        
-       static public class VexiPath{
-               List<IResource> source;
-               List<IResource> projects;
-               public VexiPath(List<IResource> source, List<IResource> 
projects){
-                       this.source = source;
-                       this.projects = projects;
+       
+       static final int RESOURCES = 0;
+       static final int PROJECTS = 1;
+       
+       final public IVexiPathList sources = new PathList(RESOURCES);
+       final public IVexiPathList projects = new PathList(PROJECTS);
+       
+       List<IResource>[] lists = null;
+
+
+
+    // Recurse on all referenced projects adding sourcepath of each one
+       synchronized public List getFullPath() {
+               List path = new ArrayList();
+               Set<VexiProject> visited = new HashSet<VexiProject>();
+               getFullPath(visited, path);
+               return path;
+       }
+    
+       private void getFullPath(Set<VexiProject> visited , List path ) {
+               if(visited.contains(this))
+                       return;
+               visited.add(this);
+               loadIfNecessary();
+               
+               // Add source paths first (precedence)
+               List resources = lists[RESOURCES];
+               for(int i=0; i<resources.size(); i++){
+                       Object o = resources.get(i);
+                       if(!path.contains(o))
+                               path.add(resources.get(i));
                }
+
+               List projects = lists[PROJECTS];
+               for(int i=0; i<projects.size(); i++){
+                       IProject p = (IProject)projects.get(i);
+                       VexiProject vp = 
(VexiProject)p.getAdapter(VexiProject.class);
+                       vp.getFullPath(visited, path);
+               }
        }
        
+       
+       
+       synchronized private void loadIfNecessary(){
+               if(lists==null){
+                       lists = new List[2];
+                       lists[RESOURCES] = new ArrayList();
+                       lists[PROJECTS] = new ArrayList();
+                       IFile ifile = project.getFile(".vexipath");
+                       IPath rawLocation = ifile.getRawLocation();
+                       if(rawLocation != null){
+                               try{
+                               File file = rawLocation.toFile();
+                                       Object vexiPath_ = JSON.readObj(file);
+                                       List source_ = 
objToList(navigate(vexiPath_, "source"));
+                                       List projects_ = 
objToList(navigate(vexiPath_, "projects"));
+                                       lists[RESOURCES] = 
convertToResourceList(source_);
+                                       lists[PROJECTS] = 
convertToResourceList(projects_);
+                               }catch(Exception e){
+                                       log(e);
+                               }
+                       }
+               }
+       }
+       
+       
+       synchronized private void save(){
+               assert(lists==null);
+               IFile ifile = project.getFile(".vexipath");
+               IPath rawLocation = ifile.getRawLocation();
+               if(rawLocation != null){
+                       try{
+                       File file = rawLocation.toFile();
+                       Map r = new LinkedHashMap();
+                       r.put("source", convertToStringList(lists[RESOURCES]));
+                       r.put("projects", convertToStringList(lists[PROJECTS]));
+                       JSON.writeObj(new FileWriter(file),r);
+                       }catch(Exception e){
+                               log(e);
+                       }
+               }
+       }
+       
+       class PathList implements IVexiPathList{
+               final int which;
+               PathList(int which){ this.which = which; }
+               public List<IResource> getPath() { 
+                       loadIfNecessary();
+                       return lists[which];
+               }
+               public void setPath(List<IResource> path) {
+                       lists[which] = path;
+                       save();
+               }
+       }
+       
+       
        static private List<String> convertToStringList(List<IResource> l) 
throws DefinitionException{
                List<String> r = new ArrayList(l.size());
                for(IResource res: l){
@@ -53,8 +140,9 @@
                return r;
        }
        
-       static private void convertToResourceList(List l, List<IResource> r) 
throws DefinitionException{
+       static private List<IResource> convertToResourceList(List l) throws 
DefinitionException{
                IWorkspace workspace = ResourcesPlugin.getWorkspace();
+               List<IResource> r = new ArrayList();
                for(Object o: l){
                        String s = objToString(o);
                        if(s.length()==0)continue;
@@ -73,92 +161,6 @@
                        }
 
                }
+               return r;
        }
-       
-       synchronized void saveVexiPath(){
-               IFile ifile = project.getFile(".vexipath");
-               IPath rawLocation = ifile.getRawLocation();
-               if(rawLocation != null){
-                       try{
-                       File file = rawLocation.toFile();
-                       Map r = new LinkedHashMap();
-                       r.put("source", convertToStringList(vexiPath.source));
-                       r.put("projects", 
convertToStringList(vexiPath.projects));
-                       JSON.writeObj(new FileWriter(file),r);
-                       }catch(Exception e){
-                               log(e);
-                       }
-               }
-       }
-       
-       synchronized VexiPath getVexiPath(){
-               if(vexiPath==null){
-                       IFile ifile = project.getFile(".vexipath");
-                       List source = new ArrayList();
-                       List projects = new ArrayList();
-                       IPath rawLocation = ifile.getRawLocation();
-                       if(rawLocation != null){
-                               try{
-                               File file = rawLocation.toFile();
-                                       Object vexiPath_ = JSON.readObj(file);
-                                       List source_ = 
objToList(navigate(vexiPath_, "source"));
-                                       List projects_ = 
objToList(navigate(vexiPath_, "projects"));
-                                       convertToResourceList(source_,source);
-                                       
convertToResourceList(projects_,projects);
-                               }catch(Exception e){
-                                       log(e);
-                               }
-                       }
-                       vexiPath = new VexiPath(source,projects);
-               }
-               return vexiPath;
-       }
-    
-    public List<IResource> getSourcePath(){
-       return getVexiPath().source;
-    }
-    
-    synchronized public void setSourcePath(List<IResource> path){
-       getVexiPath().source = path;
-       saveVexiPath();
-    }
-    
-    public List<IResource> getProjectsPath(){
-       return getVexiPath().projects;
-    }
-    
-    synchronized public void setProjectsPath(List<IResource> path){
-       getVexiPath().projects = path;
-       saveVexiPath();
-    }
-
-
-    // Recurse on all referenced projects adding sourcepath of each one
-       public List getFullPath() {
-               List path = new ArrayList();
-               Set<VexiProject> visited = new HashSet<VexiProject>();
-               getFullPath(visited, path);
-               return path;
-       }
-    
-       private void getFullPath(Set<VexiProject> visited , List path ) {
-               if(visited.contains(this))
-                       return;
-               visited.add(this);
-               
-               // Add source paths first (precedence)
-               List resources = getSourcePath();
-               for(int i=0; i<resources.size(); i++){
-                       Object o = resources.get(i);
-                       if(!path.contains(o))
-                               path.add(resources.get(i));
-               }
-
-               List projects = getProjectsPath();
-               for(int i=0; i<projects.size(); i++){
-                       IProject p = (IProject)projects.get(i);
-                       VexiProject vp = 
(VexiProject)p.getAdapter(VexiProject.class);
-                       vp.getFullPath(visited, path);
-               }
-       }
 }

Modified: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/debug/VexiRunnerConfig.java
===================================================================
--- 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/debug/VexiRunnerConfig.java   
    2009-02-16 03:34:13 UTC (rev 3389)
+++ 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/debug/VexiRunnerConfig.java   
    2009-02-17 02:50:35 UTC (rev 3390)
@@ -73,9 +73,13 @@
                String path = conf.getAttribute(P_LAUNCH_PATH,(String)null);  
                String argString = 
conf.getAttribute(P_LAUNCH_ARGS,(String)null);
                String vmArgString = conf.getAttribute(P_LAUNCH_VMARGS, 
(String)null);
-               argString = argString==null?"":argString.trim(); 
+               
                String mainTemplate = 
conf.getAttribute(P_LAUNCH_MAINTEMPLATE,(String)null);  
                
+               // tidy
+               argString = argString==null?"":argString.trim(); 
+               vmArgString = vmArgString==null?"":vmArgString.trim(); 
+               
                cmdLine = constructCommand(binaryFile, vmArgString, argString, 
path, mainTemplate);
                envp = new String[0];
 
@@ -88,6 +92,8 @@
                for (int i=resources.size()-1; i>=0; i--) {
                        IResource resource = resources.get(i);
                        IPath rawLoc =resource.getLocation(); 
+                       if(rawLoc==null) 
+                               throw new RuntimeException("Not a valid 
location: " + resource);
                        r[i] = rawLoc.toOSString();
                }
                return r;

Modified: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/debug/ui/LaunchShortcut.java
===================================================================
--- 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/debug/ui/LaunchShortcut.java  
    2009-02-16 03:34:13 UTC (rev 3389)
+++ 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/debug/ui/LaunchShortcut.java  
    2009-02-17 02:50:35 UTC (rev 3390)
@@ -65,11 +65,10 @@
                }
        }
        
-       // Blessing = fully qualified template path 
        static protected String getVexiPathOfFile(IFile file){
                IProject proj = file.getProject();
                VexiProject vproj = (VexiProject) 
proj.getAdapter(VexiProject.class);
-               List sourcePath = vproj.getSourcePath();
+               List sourcePath = vproj.sources.getPath();
                for(int i=0; i<sourcePath.size(); i++){
                        Object dir = sourcePath.get(i);
                        if(dir instanceof IProject){

Modified: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/navigator/VexiModelProvider.java
===================================================================
--- 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/navigator/VexiModelProvider.java
  2009-02-16 03:34:13 UTC (rev 3389)
+++ 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/navigator/VexiModelProvider.java
  2009-02-17 02:50:35 UTC (rev 3390)
@@ -75,7 +75,7 @@
         
                if(parent instanceof IProject){
                        VexiProject vproject = 
(VexiProject)((IProject)parent).getAdapter(VexiProject.class);
-                       Set<IResource> srcPath = new 
HashSet(vproject.getSourcePath());
+                       Set<IResource> srcPath = new 
HashSet(vproject.sources.getPath());
                        //getSourcePath
                        List elements = new ArrayList(currentElements);
                        currentElements.clear();
@@ -152,49 +152,49 @@
        }
 
        private boolean interceptRefreshOrUpdate(Set targets){
-              LinkedHashSet newtargets = new LinkedHashSet();
-               for (Iterator tItr = targets.iterator(); tItr.hasNext();) {
-                   Object t = tItr.next();
-                   
-                   if(t == null){
-                       //only case when a child is removed and another one is 
not added (null)
-                       tItr.remove();
-                       continue;
-                   }
-                   
-                   if(t instanceof IResource && !(t instanceof IVexiResource)){
-                       IResource res = (IResource) t;
-                       IVexiResource vres = getMapping(res);
-                       if(vres != null){
-                           //if it is in the vexi model, just swap
-                           tItr.remove();
-                           newtargets.add(vres);
-                           break;
-                       }
-                       while(res!=null){
-                               vres = getMapping(res);
-                               if(vres != null){
-                                   break;
-                               }
-                               IContainer p = res.getParent();
-                               if(res instanceof IFolder && p instanceof 
IProject){
-                                       // The folder is a vexi src folder, it 
just does not 
-                                       // know it yet!!
-                               VexiProject vproject = 
(VexiProject)((IProject)p).getAdapter(VexiProject.class);
-                                       Set<IResource> srcPath = new 
HashSet(vproject.getSourcePath());
-                                       if(srcPath.contains(res)){
-                                               
newtargets.add(getVexiSourceFolder(p, (IFolder) res));
-                                       }
-                               }
-                               res = p;
-                       }
-                   }
-               }
-               if (!newtargets.isEmpty()) {
-                       targets.addAll(newtargets);
-                   return true;
-               }
-               return false;        
+               LinkedHashSet newtargets = new LinkedHashSet();
+               for (Iterator tItr = targets.iterator(); tItr.hasNext();) {
+                       Object t = tItr.next();
+
+                       if(t == null){
+                               //only case when a child is removed and another 
one is not added (null)
+                               tItr.remove();
+                               continue;
+                       }
+
+                       if(t instanceof IResource && !(t instanceof 
IVexiResource)){
+                               IResource res = (IResource) t;
+                               IVexiResource vres = getMapping(res);
+                               if(vres != null){
+                                       //if it is in the vexi model, just swap
+                                       tItr.remove();
+                                       newtargets.add(vres);
+                                       break;
+                               }
+                               while(res!=null){
+                                       vres = getMapping(res);
+                                       if(vres != null){
+                                               break;
+                                       }
+                                       IContainer p = res.getParent();
+                                       if(res instanceof IFolder && p 
instanceof IProject){
+                                               // The folder is a vexi src 
folder, it just does not 
+                                               // know it yet!!
+                                               VexiProject vproject = 
(VexiProject)((IProject)p).getAdapter(VexiProject.class);
+                                               Set<IResource> srcPath = new 
HashSet(vproject.sources.getPath());
+                                               if(srcPath.contains(res)){
+                                                       
newtargets.add(getVexiSourceFolder(p, (IFolder) res));
+                                               }
+                                       }
+                                       res = p;
+                               }
+                       }
+               }
+               if (!newtargets.isEmpty()) {
+                       targets.addAll(newtargets);
+                       return true;
+               }
+               return false;        
        }
 
        public boolean interceptRefresh(PipelinedViewerUpdate 
refreshSynchronization) {

Modified: trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/EditableList.java
===================================================================
--- trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/EditableList.java      
2009-02-16 03:34:13 UTC (rev 3389)
+++ trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/EditableList.java      
2009-02-17 02:50:35 UTC (rev 3390)
@@ -268,12 +268,4 @@
         viewer.setContentProvider(contentProvider);
         
     }
-    
-       
-    /**
-     * Save path as project property
-     */
-    void save() {
-
-    }
 }

Copied: trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/PathPage.java 
(from rev 3134, 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/projectprops/PathPage.java)
===================================================================
--- trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/PathPage.java          
                (rev 0)
+++ trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/PathPage.java  
2009-02-17 02:50:35 UTC (rev 3390)
@@ -0,0 +1,108 @@
+package org.vexi.vexidev.ui;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.vexi.vexidev.IVexiPathList;
+
+
+abstract public class PathPage extends EditableList {
+
+       protected IWorkspaceRoot workspace;
+       protected IVexiPathList pathlist;
+       protected Shell shell;
+
+    protected PathPage(IWorkspaceRoot workspace, Shell shell, IVexiPathList 
pathlist) {
+       super(PathObjectLabelProvider.PROJECT);
+               this.shell = shell;
+               this.pathlist = pathlist;
+               this.workspace = workspace; 
+       }
+
+    protected PathPage(IWorkspaceRoot workspace, Shell shell){
+       super(PathObjectLabelProvider.WORKSPACE);
+               this.shell = shell;
+               this.workspace = workspace;
+    }
+    
+    
+       final protected Button constructAddButton(Composite buttons, String 
text, final String addDialogTitle, final ViewerFilter filter ){
+               SelectionListener selectionListener = new SelectionListener(){
+
+            public void widgetSelected(SelectionEvent e) {
+               
+                       ILabelProvider lp= new WorkbenchLabelProvider();
+                       ITreeContentProvider cp= new WorkbenchContentProvider();
+               MultipleFolderSelectionDialog selectionDialog= new 
MultipleFolderSelectionDialog(shell, lp, cp);
+               //selectionDialog.setExisting(existingContainers.toArray());
+               
+               
+                       
+               selectionDialog.setTitle(addDialogTitle);
+               selectionDialog.setMessage(addDialogTitle);
+               selectionDialog.addFilter(filter);
+               selectionDialog.setInput(workspace);
+//             if(project!=null)
+//                     selectionDialog.setInitialFocus(project);
+               
+               
+               
+                       if (selectionDialog.open() == Window.OK) {
+                               Object[] elements= selectionDialog.getResult(); 
+                               update(elements, e.widget);
+                       //refresh(dialog.getResult()(), 
dialog.getRemovedElements(), dialog.getModifiedElements(), 
dialog.getOutputLocation());
+                               }
+               /*
+                               // NORMAL FILE DIALOG
+                DirectoryDialog dialog = new 
DirectoryDialog(buttonAdd.getShell());
+                String path = dialog.open();
+                if(path != null){
+                               TableItem item = new TableItem(table, SWT.NONE);
+                               item.setText(new String[] {path});
+                }*/                        
+            }
+
+            public void widgetDefaultSelected(SelectionEvent e) {
+            }
+            
+        };
+        return constructAddButton(buttons, text, selectionListener);
+    }
+    
+    protected void update(Object[] elements, Widget widget){
+               for(int i=0; i<elements.length; i++){
+                       
((ContentProvider)viewer.getContentProvider()).add(elements[i]);
+               }
+    }
+    
+       public void init() {
+               init(pathlist.getPath());
+       }
+
+       public void save(List elements) {
+               pathlist.setPath(elements);
+       }
+    
+    
+    public void init(List objects){
+       this.viewer.setInput(objects);
+    }
+    
+    public void save(){
+       List elements = contentProvider.data;
+       save(elements);
+    }
+    
+}

Added: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/preferences/LibrariesEditor.java
===================================================================
--- 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/preferences/LibrariesEditor.java
                               (rev 0)
+++ 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/preferences/LibrariesEditor.java
       2009-02-17 02:50:35 UTC (rev 3390)
@@ -0,0 +1,224 @@
+package org.vexi.vexidev.ui.preferences;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Widget;
+
+public class LibrariesEditor extends FieldEditor {
+       ListEditor listEditor;
+
+       public LibrariesEditor(String prefVexilibs, Composite p) {
+        init(prefVexilibs, "Manage Libraries");
+        createControl(p);
+       }
+
+       @Override
+       protected void doFillIntoGrid(Composite parent, int numColumns) {
+               Composite listComposite  = new Composite(parent, SWT.NONE); 
+               listEditor = new ListEditor(listComposite);
+       }
+
+       protected void doLoadDefault() {}
+       protected void doLoad() {
+               // TODO Auto-generated method stub
+
+       }
+       
+       protected void doStore() {
+               // TODO Auto-generated method stub
+
+       }
+
+
+       public int getNumberOfControls() { return 1; }
+       protected void adjustForNumColumns(int numColumns) {}
+
+       
+
+       /** Copied and modified from org.eclipse.jface.preference.ListEditor */
+       static public class ListEditor {
+
+               private Label label;
+           private List list;
+           private Composite buttonBox;
+
+           private Button addButton;
+           private Button removeButton;
+
+           private SelectionListener selectionListener;
+
+           protected ListEditor(Composite parent) {
+               GridLayout layout = new GridLayout();
+               layout.numColumns = getNumberOfControls();
+               layout.marginWidth = 0;
+               layout.marginHeight = 0;
+               layout.horizontalSpacing = HORIZONTAL_GAP;
+               parent.setLayout(layout);
+               
+               int numColumns = layout.numColumns;
+
+               list = createListControl(parent);
+               GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+               gd.verticalAlignment = GridData.FILL;
+               gd.horizontalSpan = numColumns - 1;
+               gd.grabExcessHorizontalSpace = true;
+               list.setLayoutData(gd);
+
+               buttonBox = createButtonBoxControl(parent);
+               gd = new GridData();
+               gd.verticalAlignment = GridData.BEGINNING;
+               buttonBox.setLayoutData(gd);
+           }
+           
+           private void addPressed() {
+               String input = getNewInputObject();
+
+               if (input != null) {
+                       
+                       for (int i = 0; i < list.getItemCount(); i++) {
+                                       String item = list.getItem(i);
+                                       if(item.compareTo(input)>0)
+                                               list.add(input, i);
+                               }
+                   selectionChanged();
+               }
+           }
+
+           protected void adjustForNumColumns(int numColumns) {
+               ((GridData) label.getLayoutData()).horizontalSpan = numColumns;
+               ((GridData) list.getLayoutData()).horizontalSpan = numColumns - 
1;
+           }
+
+           private void createButtons(Composite box) {
+               addButton = createPushButton(box, 
"ListEditor.add");//$NON-NLS-1$
+               removeButton = createPushButton(box, 
"ListEditor.remove");//$NON-NLS-1$
+           }
+
+           private Button createPushButton(Composite parent, String key) {
+               Button button = new Button(parent, SWT.PUSH);
+               button.setText(JFaceResources.getString(key));
+               button.setFont(parent.getFont());
+               GridData data = new GridData(GridData.FILL_HORIZONTAL);
+               int widthHint = convertHorizontalDLUsToPixels(button,
+                       IDialogConstants.BUTTON_WIDTH);
+               data.widthHint = Math.max(widthHint, 
button.computeSize(SWT.DEFAULT,
+                       SWT.DEFAULT, true).x);
+               button.setLayoutData(data);
+               button.addSelectionListener(getSelectionListener());
+               return button;
+           }
+
+           protected int convertHorizontalDLUsToPixels(Control control, int 
dlus) {
+               GC gc = new GC(control);
+               gc.setFont(control.getFont());
+               int averageWidth = gc.getFontMetrics().getAverageCharWidth();
+               gc.dispose();
+
+               double horizontalDialogUnitSize = averageWidth * 0.25;
+
+               return (int) Math.round(dlus * horizontalDialogUnitSize);
+           }
+           
+           public void createSelectionListener() {
+               selectionListener = new SelectionAdapter() {
+                   public void widgetSelected(SelectionEvent event) {
+                       Widget widget = event.widget;
+                       if (widget == addButton) {
+                           addPressed();
+                       } else if (widget == removeButton) {
+                           removePressed();
+                       } else if (widget == list) {
+                           selectionChanged();
+                       }
+                   }
+               };
+           }
+
+           public Composite createButtonBoxControl(Composite parent) {
+               buttonBox = new Composite(parent, SWT.NULL);
+            GridLayout layout = new GridLayout();
+            layout.marginWidth = 0;
+            buttonBox.setLayout(layout);
+            createButtons(buttonBox);
+               selectionChanged();
+               return buttonBox;
+           }
+
+           public List createListControl(Composite parent) {
+            list = new List(parent, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL
+                    | SWT.H_SCROLL);
+            list.setFont(parent.getFont());
+            list.addSelectionListener(getSelectionListener());
+          
+               return list;
+           }
+
+           protected String getNewInputObject() {
+               InputDialog d = new InputDialog(getShell(), 
+                       "Library Name", 
+                       "Enter a name for the new library",
+                       null, 
+                       null);
+               d.open();
+               return d.getValue();
+           }
+
+           public int getNumberOfControls() {
+               return 2;
+           }
+
+           private SelectionListener getSelectionListener() {
+               if (selectionListener == null) {
+                               createSelectionListener();
+                       }
+               return selectionListener;
+           }
+
+           protected Shell getShell() {
+               if (addButton == null) {
+                               return null;
+                       }
+               return addButton.getShell();
+           }
+
+           private void removePressed() {
+               int index = list.getSelectionIndex();
+               if (index >= 0) {
+                   list.remove(index);
+                   selectionChanged();
+               }
+           }
+
+           private void selectionChanged() {
+               int index = list.getSelectionIndex();
+               removeButton.setEnabled(index >= 0);
+           }
+
+           public void setFocus() {
+               if (list != null) {
+                   list.setFocus();
+               }
+           }
+           
+           public void setEnabled(boolean enabled, Composite parent) {
+               list.setEnabled(enabled);
+               addButton.setEnabled(enabled);
+               removeButton.setEnabled(enabled);
+           }
+       }
+}


Property changes on: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/preferences/LibrariesEditor.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/preferences/VexiLibraryPreferences.java
===================================================================
--- 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/preferences/VexiLibraryPreferences.java
                                (rev 0)
+++ 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/preferences/VexiLibraryPreferences.java
        2009-02-17 02:50:35 UTC (rev 3390)
@@ -0,0 +1,108 @@
+package org.vexi.vexidev.ui.preferences;
+
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.vexi.vexidev.IConstants;
+import org.vexi.vexidev.VexidevPlugin;
+
+/**
+ * This class represents a preference page that
+ * is contributed to the Preferences dialog. By 
+ * subclassing <samp>FieldEditorPreferencePage</samp>, we
+ * can use the field support built into JFace that allows
+ * us to create a page that is small and knows how to 
+ * save, restore and apply itself.
+ * <p>
+ * This page is used to modify preferences only. They
+ * are stored in the preference store that belongs to
+ * the main plug-in class. That way, preferences can
+ * be accessed directly via the preference store.
+ */
+
+
+public class VexiLibraryPreferences
+       extends FieldEditorPreferencePage
+       implements IWorkbenchPreferencePage,
+       IConstants{
+
+
+       
+
+       public VexiLibraryPreferences() {
+               super(GRID);
+               
setPreferenceStore(VexidevPlugin.getDefault().getPreferenceStore());
+               setDescription("Vexi-Dev libraries");
+               initializeDefaults();
+       }
+/**
+ * Sets the default values of the preferences.
+ */
+       private void initializeDefaults() {
+
+       }
+       
+/**
+ * Creates the field editors. Field editors are abstractions of
+ * the common GUI blocks needed to manipulate various types
+ * of preferences. Each field editor knows how to save and
+ * restore itself.
+ */
+
+       public void createFieldEditors() {
+               
+               Composite p = getFieldEditorParent();
+               addField(
+                               new LibrariesEditor(PREF_VEXILIBS, p));
+//             
+//             addField(
+//                     new FileFieldEditor(PREF_VEXIBINARY, "Vexi Binary", p));
+//             
+//             createSpacer(p, 3);
+//             
+//             addField(
+//                 new ColorFieldEditor(PREF_COL_DEFAULT, "Default Colour",p));
+//       
+//             addField(
+//                 new ColorFieldEditor(PREF_COL_VS_COMMENT, "VexiScript 
comment",p));
+//             addField(
+//                 new ColorFieldEditor(PREF_COL_VS_KEYWORD, "VexiScript 
keyword",p));
+//             addField(
+//                 new ColorFieldEditor(PREF_COL_VS_STRING, "VexiScript 
string",p));
+//
+//             addField(
+//                 new ColorFieldEditor(PREF_COL_TAG, "XML Tag",p));
+//             addField(
+//                 new ColorFieldEditor(PREF_COL_STRING, "String in Tag",p));
+//             addField(
+//                 new ColorFieldEditor(PREF_COL_XMLCOMMENT, "Xml comment",p));
+//         addField(
+//                 new ColorFieldEditor(PREF_COL_PROCINSTR, "XML Proc. 
Intruction",p));
+
+
+
+               //addField(
+               //    new ColorFieldEditor(P_VEXI_SCRIPT, "Vexi comment 
color",getFieldEditorParent()));
+
+       
+       }
+
+       protected void createSpacer(Composite composite, int columnSpan) {
+               Label label = new Label(composite, SWT.NONE);
+               GridData gd = new GridData();
+               gd.horizontalSpan = columnSpan;
+               label.setLayoutData(gd);
+       }
+       
+       
+       
+       public void init(IWorkbench workbench) {
+       }
+       
+
+       
+}
\ No newline at end of file


Property changes on: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/preferences/VexiLibraryPreferences.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Copied: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/preferences/VexiMainPreferences.java
 (from rev 3134, 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/preferences/VexiPreferencePage.java)
===================================================================
--- 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/preferences/VexiMainPreferences.java
                           (rev 0)
+++ 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/preferences/VexiMainPreferences.java
   2009-02-17 02:50:35 UTC (rev 3390)
@@ -0,0 +1,108 @@
+package org.vexi.vexidev.ui.preferences;
+
+import org.eclipse.jface.preference.ColorFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.FileFieldEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.vexi.vexidev.IConstants;
+import org.vexi.vexidev.VexidevPlugin;
+
+/**
+ * This class represents a preference page that
+ * is contributed to the Preferences dialog. By 
+ * subclassing <samp>FieldEditorPreferencePage</samp>, we
+ * can use the field support built into JFace that allows
+ * us to create a page that is small and knows how to 
+ * save, restore and apply itself.
+ * <p>
+ * This page is used to modify preferences only. They
+ * are stored in the preference store that belongs to
+ * the main plug-in class. That way, preferences can
+ * be accessed directly via the preference store.
+ */
+
+
+public class VexiMainPreferences
+       extends FieldEditorPreferencePage
+       implements IWorkbenchPreferencePage,
+       IConstants{
+
+
+       
+
+       public VexiMainPreferences() {
+               super(GRID);
+               
setPreferenceStore(VexidevPlugin.getDefault().getPreferenceStore());
+               setDescription("Vexi-Dev preferences");
+               initializeDefaults();
+       }
+/**
+ * Sets the default values of the preferences.
+ */
+       private void initializeDefaults() {
+
+       }
+       
+/**
+ * Creates the field editors. Field editors are abstractions of
+ * the common GUI blocks needed to manipulate various types
+ * of preferences. Each field editor knows how to save and
+ * restore itself.
+ */
+
+       public void createFieldEditors() {
+               
+               Composite p = getFieldEditorParent();
+               
+               addField(
+                       new FileFieldEditor(PREF_VEXIBINARY, "Vexi Binary", p));
+               
+               createSpacer(p, 3);
+               
+               addField(
+                   new ColorFieldEditor(PREF_COL_DEFAULT, "Default Colour",p));
+         
+               addField(
+                   new ColorFieldEditor(PREF_COL_VS_COMMENT, "VexiScript 
comment",p));
+               addField(
+                   new ColorFieldEditor(PREF_COL_VS_KEYWORD, "VexiScript 
keyword",p));
+               addField(
+                   new ColorFieldEditor(PREF_COL_VS_STRING, "VexiScript 
string",p));
+
+               addField(
+                   new ColorFieldEditor(PREF_COL_TAG, "XML Tag",p));
+               addField(
+                   new ColorFieldEditor(PREF_COL_STRING, "String in Tag",p));
+               addField(
+                   new ColorFieldEditor(PREF_COL_XMLCOMMENT, "Xml comment",p));
+           addField(
+                   new ColorFieldEditor(PREF_COL_PROCINSTR, "XML Proc. 
Intruction",p));
+
+
+
+               //addField(
+               //    new ColorFieldEditor(P_VEXI_SCRIPT, "Vexi comment 
color",getFieldEditorParent()));
+
+       
+       }
+
+       protected void createSpacer(Composite composite, int columnSpan) {
+               Label label = new Label(composite, SWT.NONE);
+               GridData gd = new GridData();
+               gd.horizontalSpan = columnSpan;
+               label.setLayoutData(gd);
+       }
+       
+       
+       
+       public void init(IWorkbench workbench) {
+       }
+       
+
+       
+}
\ No newline at end of file

Deleted: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/preferences/VexiPreferencePage.java
===================================================================
--- 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/preferences/VexiPreferencePage.java
    2009-02-16 03:34:13 UTC (rev 3389)
+++ 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/preferences/VexiPreferencePage.java
    2009-02-17 02:50:35 UTC (rev 3390)
@@ -1,108 +0,0 @@
-package org.vexi.vexidev.ui.preferences;
-
-import org.eclipse.jface.preference.ColorFieldEditor;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.FileFieldEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.vexi.vexidev.IConstants;
-import org.vexi.vexidev.VexidevPlugin;
-
-/**
- * This class represents a preference page that
- * is contributed to the Preferences dialog. By 
- * subclassing <samp>FieldEditorPreferencePage</samp>, we
- * can use the field support built into JFace that allows
- * us to create a page that is small and knows how to 
- * save, restore and apply itself.
- * <p>
- * This page is used to modify preferences only. They
- * are stored in the preference store that belongs to
- * the main plug-in class. That way, preferences can
- * be accessed directly via the preference store.
- */
-
-
-public class VexiPreferencePage
-       extends FieldEditorPreferencePage
-       implements IWorkbenchPreferencePage,
-       IConstants{
-
-
-       
-
-       public VexiPreferencePage() {
-               super(GRID);
-               
setPreferenceStore(VexidevPlugin.getDefault().getPreferenceStore());
-               setDescription("Vexi-Dev preferences");
-               initializeDefaults();
-       }
-/**
- * Sets the default values of the preferences.
- */
-       private void initializeDefaults() {
-
-       }
-       
-/**
- * Creates the field editors. Field editors are abstractions of
- * the common GUI blocks needed to manipulate various types
- * of preferences. Each field editor knows how to save and
- * restore itself.
- */
-
-       public void createFieldEditors() {
-               
-               Composite p = getFieldEditorParent();
-               
-               addField(
-                       new FileFieldEditor(PREF_VEXIBINARY, "Vexi Binary", p));
-               
-               createSpacer(p, 3);
-               
-               addField(
-                   new ColorFieldEditor(PREF_COL_DEFAULT, "Default Colour",p));
-         
-               addField(
-                   new ColorFieldEditor(PREF_COL_VS_COMMENT, "VexiScript 
comment",p));
-               addField(
-                   new ColorFieldEditor(PREF_COL_VS_KEYWORD, "VexiScript 
keyword",p));
-               addField(
-                   new ColorFieldEditor(PREF_COL_VS_STRING, "VexiScript 
string",p));
-
-               addField(
-                   new ColorFieldEditor(PREF_COL_TAG, "XML Tag",p));
-               addField(
-                   new ColorFieldEditor(PREF_COL_STRING, "String in Tag",p));
-               addField(
-                   new ColorFieldEditor(PREF_COL_XMLCOMMENT, "Xml comment",p));
-           addField(
-                   new ColorFieldEditor(PREF_COL_PROCINSTR, "XML Proc. 
Intruction",p));
-
-
-
-               //addField(
-               //    new ColorFieldEditor(P_VEXI_SCRIPT, "Vexi comment 
color",getFieldEditorParent()));
-
-       
-       }
-
-       protected void createSpacer(Composite composite, int columnSpan) {
-               Label label = new Label(composite, SWT.NONE);
-               GridData gd = new GridData();
-               gd.horizontalSpan = columnSpan;
-               label.setLayoutData(gd);
-       }
-       
-       
-       
-       public void init(IWorkbench workbench) {
-       }
-       
-
-       
-}
\ No newline at end of file

Deleted: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/projectprops/PathPage.java
===================================================================
--- 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/projectprops/PathPage.java 
    2009-02-16 03:34:13 UTC (rev 3389)
+++ 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/projectprops/PathPage.java 
    2009-02-17 02:50:35 UTC (rev 3390)
@@ -1,105 +0,0 @@
-package org.vexi.vexidev.ui.projectprops;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.vexi.vexidev.ui.EditableList;
-import org.vexi.vexidev.ui.MultipleFolderSelectionDialog;
-import org.vexi.vexidev.ui.PathObjectLabelProvider;
-
-
-abstract public class PathPage extends EditableList {
-
-       protected IWorkspaceRoot workspace;
-       protected IProject project;
-       protected Shell shell;
-
-    protected PathPage(IProject project, Shell shell) {
-       super(PathObjectLabelProvider.PROJECT);
-               this.shell = shell;
-               this.project = project;
-               this.workspace = (IWorkspaceRoot) project.getParent(); 
-       }
-
-    protected PathPage(IWorkspaceRoot workspace, Shell shell){
-       super(PathObjectLabelProvider.WORKSPACE);
-               this.shell = shell;
-               this.workspace = workspace;
-    }
-    
-    
-       final protected Button constructAddButton(Composite buttons, String 
text, final String addDialogTitle, final ViewerFilter filter ){
-               SelectionListener selectionListener = new SelectionListener(){
-
-            public void widgetSelected(SelectionEvent e) {
-               
-                       ILabelProvider lp= new WorkbenchLabelProvider();
-                       ITreeContentProvider cp= new WorkbenchContentProvider();
-               MultipleFolderSelectionDialog selectionDialog= new 
MultipleFolderSelectionDialog(shell, lp, cp);
-               //selectionDialog.setExisting(existingContainers.toArray());
-               
-               
-                       
-               selectionDialog.setTitle(addDialogTitle);
-               selectionDialog.setMessage(addDialogTitle);
-               selectionDialog.addFilter(filter);
-               selectionDialog.setInput(workspace);
-               if(project!=null)
-                       selectionDialog.setInitialFocus(project);
-               
-               
-               
-                       if (selectionDialog.open() == Window.OK) {
-                               Object[] elements= selectionDialog.getResult(); 
-                               update(elements, e.widget);
-                       //refresh(dialog.getResult()(), 
dialog.getRemovedElements(), dialog.getModifiedElements(), 
dialog.getOutputLocation());
-                               }
-               /*
-                               // NORMAL FILE DIALOG
-                DirectoryDialog dialog = new 
DirectoryDialog(buttonAdd.getShell());
-                String path = dialog.open();
-                if(path != null){
-                               TableItem item = new TableItem(table, SWT.NONE);
-                               item.setText(new String[] {path});
-                }*/                        
-            }
-
-            public void widgetDefaultSelected(SelectionEvent e) {
-            }
-            
-        };
-        return constructAddButton(buttons, text, selectionListener);
-    }
-    
-    protected void update(Object[] elements, Widget widget){
-               for(int i=0; i<elements.length; i++){
-                       
((ContentProvider)viewer.getContentProvider()).add(elements[i]);
-               }
-    }
-    
-    abstract public void init();
-    abstract public void save(List elements);
-    
-    public void init(List objects){
-       this.viewer.setInput(objects);
-    }
-    
-    protected void save(){
-       List elements = contentProvider.data;
-       save(elements);
-    }
-    
-}

Modified: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/projectprops/ProjectPathsBlock.java
===================================================================
--- 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/projectprops/ProjectPathsBlock.java
    2009-02-16 03:34:13 UTC (rev 3389)
+++ 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/projectprops/ProjectPathsBlock.java
    2009-02-17 02:50:35 UTC (rev 3390)
@@ -56,7 +56,7 @@
         //item.setText(NewWizardMessages.BuildPathsBlock_tab_source); 
         
//item.setImage(JavaPluginImages.get(JavaPluginImages.IMG_OBJS_PACKFRAG_ROOT));
                
-        sourcePage = new SourcePage(project, shell);
+        sourcePage = new SourcePage(shell, project);
         item= new TabItem(folder, SWT.NONE);
         item.setText("Source");
         item.setImage(sharedImages.getImage(ISharedImages.IMG_OBJ_FOLDER));
@@ -68,7 +68,7 @@
                Image projectImage= 
sharedImages.getImage(IDE.SharedImages.IMG_OBJ_PROJECT);
                
                
-               projectsPage = new ProjectsPage(project, shell);
+               projectsPage = new ProjectsPage(shell, project);
                item= new TabItem(folder, SWT.NONE);
                item.setText("Projects");
                //item.setText(NewWizardMessages.BuildPathsBlock_tab_projects); 

Modified: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/projectprops/ProjectsPage.java
===================================================================
--- 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/projectprops/ProjectsPage.java
 2009-02-16 03:34:13 UTC (rev 3389)
+++ 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/projectprops/ProjectsPage.java
 2009-02-17 02:50:35 UTC (rev 3390)
@@ -1,19 +1,24 @@
 package org.vexi.vexidev.ui.projectprops;
 
-import java.util.List;
-
 import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.viewers.ViewerFilter;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Shell;
 import org.vexi.vexidev.VexiProject;
+import org.vexi.vexidev.ui.PathPage;
 
 
 public class ProjectsPage extends PathPage{
-
-       protected ProjectsPage(IProject project, Shell shell) {
-               super(project, shell);
+       IProject project;
+       protected ProjectsPage(Shell shell, IProject project) {
+               super(
+                (IWorkspaceRoot) project.getParent(),
+                shell,
+                ((VexiProject)project.getAdapter(VexiProject.class)).projects  
+               );
+               this.project = project;
        }
 
 
@@ -30,17 +35,7 @@
        constructAddButton(buttons, "Add Project", "Select Vexi Projects to 
reference", filter);
  
     }
-       @Override
-       public void init() {
-               VexiProject vproject = 
(VexiProject)project.getAdapter(VexiProject.class);
-               init(vproject.getProjectsPath());
-       }
 
-       @Override
-       public void save(List elements) {
-               VexiProject vproject = 
(VexiProject)project.getAdapter(VexiProject.class);
-               vproject.setProjectsPath(elements);
-       }
 
 
 }

Modified: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/projectprops/SourcePage.java
===================================================================
--- 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/projectprops/SourcePage.java
   2009-02-16 03:34:13 UTC (rev 3389)
+++ 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/ui/projectprops/SourcePage.java
   2009-02-17 02:50:35 UTC (rev 3390)
@@ -2,7 +2,6 @@
 
 import java.io.File;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 import org.eclipse.core.resources.IContainer;
@@ -10,6 +9,7 @@
 import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IStatus;
@@ -25,6 +25,7 @@
 import org.eclipse.ui.dialogs.ISelectionStatusValidator;
 import org.vexi.vexidev.VexiProject;
 import org.vexi.vexidev.ui.PathObjectLabelProvider;
+import org.vexi.vexidev.ui.PathPage;
 
 /**
  * Source tab in project preferences. For choosing which folders are source 
folders.
@@ -37,12 +38,17 @@
        Button add1 = null;
        Button add2 = null;
        
-       public SourcePage(IProject project, Shell shell) {
-               super(project, shell);
+       IProject project;
+       protected SourcePage(Shell shell, IProject project) {
+               super(
+                (IWorkspaceRoot) project.getParent(),
+                shell,
+                ((VexiProject)project.getAdapter(VexiProject.class)).sources   
+               );
+               this.project = project;
                this.tableCaption = "Configure source folders";
        }
 
-
        public SourcePage(Shell shell) {
                super(ResourcesPlugin.getWorkspace().getRoot(), shell);
        }
@@ -153,22 +159,6 @@
                        
                }
        }
-
-       @Override
-       public void init() {
-               VexiProject vproject = 
(VexiProject)project.getAdapter(VexiProject.class);
-               init(vproject.getSourcePath());
-       }
-
-       @Override
-       public void save(List elements) {
-               VexiProject vproject = 
(VexiProject)project.getAdapter(VexiProject.class);
-               vproject.setSourcePath(elements);
-       }
-       
-
-       
-       
 }
 
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to