Add support for creating a Xaraya module
authorchoochter <choochter>
Tue, 4 Feb 2003 22:23:32 +0000 (22:23 +0000)
committerchoochter <choochter>
Tue, 4 Feb 2003 22:23:32 +0000 (22:23 +0000)
net.sourceforge.phpeclipse/plugin.xml
net.sourceforge.phpeclipse/src/com/xaraya/wizard/NewXarayaResourceWizard.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/com/xaraya/wizard/XarayaModuleContainerPage.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/com/xaraya/wizard/XarayaModuleFilePage.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/com/xaraya/wizard/XarayaModuleMessages.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/com/xaraya/wizard/XarayaModuleMessages.properties [new file with mode: 0644]
net.sourceforge.phpeclipse/src/com/xaraya/wizard/XarayaModuleText.java [new file with mode: 0644]
net.sourceforge.phpeclipse/src/com/xaraya/wizard/XarayaVersionModel.java [new file with mode: 0644]

index b9ea43e..eb01250 100644 (file)
             Create a basic PHP file.
          </description>
       </wizard>
+<!-- choochter's stuff -->       
+         <wizard
+            name="Xaraya Module"
+            icon="icons/obj16/php.gif"
+            category="net.sourceforge.phpeclipse.wizards.NewWizardCategoryPHP"
+            class=" com.xaraya.wizard.NewXarayaResourceWizard"
+            project="true"
+            id="net.sourceforge.phpeclipse.wizards.NewXarayaModuleWizard">
+         <description>
+            Create a Xaraya module.
+         </description>
+      </wizard>       
    </extension>
    <extension
          point="org.eclipse.ui.projectNatureImages">
diff --git a/net.sourceforge.phpeclipse/src/com/xaraya/wizard/NewXarayaResourceWizard.java b/net.sourceforge.phpeclipse/src/com/xaraya/wizard/NewXarayaResourceWizard.java
new file mode 100644 (file)
index 0000000..d57b268
--- /dev/null
@@ -0,0 +1,61 @@
+package com.xaraya.wizard;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
+
+public class NewXarayaResourceWizard extends BasicNewResourceWizard {
+       
+    private XarayaModuleContainerPage mainPage;  //get where to place resource and module name
+    private XarayaModuleFilePage  page1;  //get first load of details author/email/which files
+
+       private XarayaVersionModel xvm = new XarayaVersionModel();  //holder for details
+               
+public NewXarayaResourceWizard() {
+       super();
+       //initialize static classes that are required..
+       new XarayaModuleText();  
+       new XarayaModuleMessages();
+}
+
+public void addPages() {
+       super.addPages();
+       mainPage = new XarayaModuleContainerPage(XarayaModuleMessages.getString("Xaraya.label.container"), getSelection());
+       addPage(mainPage);
+       page1 = new XarayaModuleFilePage(XarayaModuleMessages.getString("Xaraya.label.container"));
+       addPage(page1);
+}
+
+public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
+       super.init(workbench, currentSelection);
+       setWindowTitle(XarayaModuleMessages.getString("Xaraya.label.container"));
+       setNeedsProgressMonitor(true);
+}
+
+public boolean performFinish() {
+       page1.saveDataToModel();
+       IFolder folder = mainPage.createNewModuleFolder(); //create the folder for the module
+       if (folder == null)
+               return false;
+
+       Object[] files = mainPage.createNewModuleFiles();  //create the files
+        
+       selectAndReveal(folder);        
+
+       // Open editor on new xaraya init file.
+       IWorkbenchWindow dw = getWorkbench().getActiveWorkbenchWindow();
+       try {
+               IWorkbenchPage page = dw.getActivePage();
+               if (page != null)
+               page.openEditor((IFile)files[0]);
+       } catch (Exception e) {
+       }
+       
+       return true;
+}
+
+}
diff --git a/net.sourceforge.phpeclipse/src/com/xaraya/wizard/XarayaModuleContainerPage.java b/net.sourceforge.phpeclipse/src/com/xaraya/wizard/XarayaModuleContainerPage.java
new file mode 100644 (file)
index 0000000..488ca10
--- /dev/null
@@ -0,0 +1,382 @@
+package com.xaraya.wizard;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceStatus;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.dialogs.ContainerGenerator;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.ui.internal.IHelpContextIds;
+import org.eclipse.ui.internal.WorkbenchMessages;
+import org.eclipse.ui.internal.WorkbenchPlugin;
+import org.eclipse.ui.internal.misc.ResourceAndContainerGroup;
+
+public class XarayaModuleContainerPage extends WizardPage implements Listener {
+       private static final int SIZING_CONTAINER_GROUP_HEIGHT = 250;
+       private IStructuredSelection currentSelection;
+       private IContainer currentParent;
+       NewXarayaResourceWizard wizard;
+       private IPath newModulePath;
+       private IFolder newModule;
+       
+       // widgets
+       private ResourceAndContainerGroup resourceGroup;
+
+public XarayaModuleContainerPage(String pageName, IStructuredSelection selection) {
+       super(XarayaModuleMessages.getString("Xaraya.label.container"));
+       setTitle(pageName);
+       setDescription(XarayaModuleMessages.getString("Xaraya.label.container")); 
+       this.currentSelection = selection;
+}
+
+public void createControl(Composite parent) {
+       initializeDialogUnits(parent);
+       // top level group
+       Composite composite = new Composite(parent,SWT.NONE);
+       composite.setFont(parent.getFont());
+       composite.setLayout(new GridLayout());
+       composite.setLayoutData(new GridData(
+               GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
+
+       WorkbenchHelp.setHelp(composite, IHelpContextIds.NEW_FOLDER_WIZARD_PAGE);
+
+       resourceGroup = new ResourceAndContainerGroup(composite,this,
+               XarayaModuleMessages.getString("Xaraya.label.container"),
+               XarayaModuleMessages.getString("Xaraya.label.modversionname"),
+                       false, SIZING_CONTAINER_GROUP_HEIGHT); //$NON-NLS-2$ //$NON-NLS-1$
+       resourceGroup.setAllowExistingResources(false);
+       initializePage();
+       validatePage();
+       // Show description on opening
+       setErrorMessage(null);
+       setMessage(null);
+       setControl(composite);
+}
+
+protected void createFolder(IFolder folderHandle, IProgressMonitor monitor) throws CoreException {
+    try {
+        // Create the folder resource in the workspace
+        // Update: Recursive to create any folders which do not exist already
+        if (!folderHandle.exists()) {
+            IContainer parent= folderHandle.getParent();
+            if (parent instanceof IFolder && (!((IFolder)parent).exists())) {
+                createFolder((IFolder)parent, monitor);
+            }
+                       folderHandle.create(false, true, monitor);
+        }
+    }
+    catch (CoreException e) {
+        // If the folder already existed locally, just refresh to get contents
+        if (e.getStatus().getCode() == IResourceStatus.PATH_OCCUPIED)
+            folderHandle.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 500));
+        else
+            throw e;
+    }
+
+    if (monitor.isCanceled())
+        throw new OperationCanceledException();
+}
+
+protected IFolder createFolderHandle(IPath folderPath) {
+       return WorkbenchPlugin.getPluginWorkspace().getRoot().getFolder(folderPath);
+}
+
+public IFolder createNewModuleFolder() {
+       if (newModule != null)
+               return newModule;
+
+       // create the new folder and cache it if successful
+       final IPath containerPath = resourceGroup.getContainerFullPath();
+       newModulePath = containerPath.append(resourceGroup.getResource());
+       final IFolder newModuleHandle = createFolderHandle(newModulePath);
+
+       WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
+               public void execute(IProgressMonitor monitor) throws CoreException {
+                       try {
+                               monitor.beginTask(WorkbenchMessages.getString("WizardNewFolderCreationPage.progress"), 2000); //$NON-NLS-1$
+                               ContainerGenerator generator = new ContainerGenerator(containerPath);
+                               generator.generateContainer(new SubProgressMonitor(monitor, 1000));
+                               createFolder(newModuleHandle, new SubProgressMonitor(monitor, 1000));
+                       } finally {
+                               monitor.done();
+                       }
+               }
+       };
+
+       try {
+               getContainer().run(true, true, op);
+       } catch (Exception e) {
+               return null;
+       }
+       newModule = newModuleHandle;
+       return newModule;
+}
+
+public boolean createNewGuiFolder() {
+       final IPath containerPath = newModulePath;
+       IPath newFolderPath = containerPath.append(XarayaModuleMessages.getString("Xaraya.folder.gui"));
+       final IFolder newFolderHandle = createFolderHandle(newFolderPath);
+
+       WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
+               public void execute(IProgressMonitor monitor) throws CoreException {
+                       try {
+                               monitor.beginTask(WorkbenchMessages.getString("WizardNewFolderCreationPage.progress"), 2000); //$NON-NLS-1$
+                               ContainerGenerator generator = new ContainerGenerator(containerPath);
+                               generator.generateContainer(new SubProgressMonitor(monitor, 1000));
+                               createFolder(newFolderHandle, new SubProgressMonitor(monitor, 1000));
+                       } finally {
+                               monitor.done();
+                       }
+               }
+       };
+
+       try {
+               getContainer().run(true, true, op);
+       } catch (Exception e) {
+               return false;
+       } 
+       return true;
+}
+
+protected void createFile(IFile fileHandle, InputStream contents, IProgressMonitor monitor) throws CoreException {
+       if (contents == null)
+               contents = new ByteArrayInputStream(new byte[0]);
+
+       try {
+                       fileHandle.create(contents, false, monitor);
+       }
+       catch (CoreException e) {
+               // If the file already existed locally, just refresh to get contents
+               if (e.getStatus().getCode() == IResourceStatus.PATH_OCCUPIED)
+                       fileHandle.refreshLocal(IResource.DEPTH_ZERO, null);
+               else
+                       throw e;
+       }
+
+       if (monitor.isCanceled())
+               throw new OperationCanceledException();
+}
+
+protected IFile createFileHandle(IPath filePath) {
+       return WorkbenchPlugin.getPluginWorkspace().getRoot().getFile(filePath);
+}
+
+public Object[] createNewModuleFiles(){
+       ArrayList fileAL = new ArrayList();
+       boolean isGuiDirCreated = false;
+       fileAL.add(createNewFile(XarayaModuleMessages.getString("Xaraya.files.init")));
+       fileAL.add(createNewFile(XarayaModuleMessages.getString("Xaraya.files.version")));
+       if (XarayaVersionModel.isAdminApi()) fileAL.add(createNewFile(XarayaModuleMessages.getString("Xaraya.files.adminApi"))); 
+       if (XarayaVersionModel.isAdminGui()) {
+               fileAL.add(createNewFile(XarayaModuleMessages.getString("Xaraya.files.adminGui")));
+               isGuiDirCreated=createNewGuiFolder();
+       }  
+       if (XarayaVersionModel.isUserApi()) fileAL.add(createNewFile(XarayaModuleMessages.getString("Xaraya.files.userApi")));  
+       if (XarayaVersionModel.isUserGui()) {
+               fileAL.add(createNewFile(XarayaModuleMessages.getString("Xaraya.files.userGui")));
+               if (!isGuiDirCreated) isGuiDirCreated=createNewGuiFolder();     
+       } 
+       return fileAL.toArray();
+}
+
+public IFile createNewFile(String fileName) {
+       final IPath containerPath = newModulePath;
+       IPath newFilePath = containerPath.append(fileName);
+       final IFile newFileHandle = createFileHandle(newFilePath);
+       final InputStream initialContents = getInitialContents(fileName);
+       WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
+               protected void execute(IProgressMonitor monitor) throws CoreException,
+                       InterruptedException
+               {
+                       try {
+                               monitor.beginTask("Progress", 2000); //$NON-NLS-1$
+                               ContainerGenerator generator = new ContainerGenerator(containerPath);
+                               generator.generateContainer(new SubProgressMonitor(monitor, 1000));
+                               createFile(newFileHandle,initialContents, new SubProgressMonitor(monitor, 1000));
+                       } finally {
+                               monitor.done();
+                       }
+               }
+       };
+
+       try {
+               getContainer().run(true, true, op);
+       } catch (Exception e) {
+               return null;
+       } 
+       return newFileHandle;
+}
+
+       protected InputStream getInitialContents(String fileName) {
+               StringBuffer inputString = new StringBuffer();
+               if (fileName.equals(XarayaModuleMessages.getString("Xaraya.files.init"))) 
+                       inputString=XarayaModuleText.xarinit;
+               if (fileName.equals(XarayaModuleMessages.getString("Xaraya.files.adminGui"))) 
+                       inputString=XarayaModuleText.xaradmin;
+               if (fileName.equals(XarayaModuleMessages.getString("Xaraya.files.adminApi"))) 
+                       inputString=XarayaModuleText.xaradminapi;
+               if (fileName.equals(XarayaModuleMessages.getString("Xaraya.files.userGui"))) 
+                       inputString=XarayaModuleText.xaruser;
+               if (fileName.equals(XarayaModuleMessages.getString("Xaraya.files.userApi"))) 
+                       inputString=XarayaModuleText.xaruserapi;
+               if (fileName.equals(XarayaModuleMessages.getString("Xaraya.files.version"))) 
+                       inputString=XarayaModuleText.xarversion;
+               
+               ArrayList inserts = new ArrayList();
+               //makes things simpler to just refer to the arraylist...
+               inserts.add(XarayaModuleMessages.getString("Xaraya.insert.name"));
+               inserts.add(XarayaModuleMessages.getString("Xaraya.insert.id"));
+               inserts.add(XarayaModuleMessages.getString("Xaraya.insert.version"));
+               inserts.add(XarayaModuleMessages.getString("Xaraya.insert.description"));
+               inserts.add(XarayaModuleMessages.getString("Xaraya.insert.official"));
+               inserts.add(XarayaModuleMessages.getString("Xaraya.insert.author"));
+               inserts.add(XarayaModuleMessages.getString("Xaraya.insert.contact"));
+               inserts.add(XarayaModuleMessages.getString("Xaraya.insert.admin"));
+               inserts.add(XarayaModuleMessages.getString("Xaraya.insert.user"));
+               inserts.add(XarayaModuleMessages.getString("Xaraya.insert.securityschema"));
+               inserts.add(XarayaModuleMessages.getString("Xaraya.insert.class"));
+               inserts.add(XarayaModuleMessages.getString("Xaraya.insert.category"));
+       
+               ArrayList names = new ArrayList();
+               names.add(XarayaVersionModel.getModversionname());
+               names.add(XarayaVersionModel.getModversionid());
+               names.add(XarayaVersionModel.getModversionversion());
+               names.add(XarayaVersionModel.getModversiondescription());
+               names.add(XarayaVersionModel.getModversionofficial());
+               names.add(XarayaVersionModel.getModversionauthor());
+               names.add(XarayaVersionModel.getModversioncontact());
+               names.add(XarayaVersionModel.getModversionadmin());
+               names.add(XarayaVersionModel.getModversionuser());
+               names.add(XarayaVersionModel.getModversionsecurityschema());
+               names.add(XarayaVersionModel.getModversionclass());
+               names.add(XarayaVersionModel.getModversioncategory());
+               
+               PipedOutputStream ps = null;
+               PipedInputStream is = null;
+               String buffer = inputString.toString();         
+               for (int i=0; i<inserts.size(); i++)
+               {
+                       String insert = (String)inserts.get(i);
+                       String replace = (String)names.get(i);
+       
+                       buffer = buffer.replaceAll(insert, replace.toLowerCase());              
+                       try {
+                               ps = new PipedOutputStream();
+                               is = new PipedInputStream(ps);
+                               PrintStream os = new PrintStream(ps);
+                               os.println(buffer);
+                               os.close();
+                       } catch (Exception e) {
+                               System.out.println("writing to file:"+fileName +"failed with:"+ e);
+                       }
+               }
+               return is;
+       }
+       
+
+public void handleEvent(Event ev) {
+       setPageComplete(validatePage());
+}
+
+public boolean canFlipToNextPage() {
+       return isPageComplete();
+}
+
+protected void initializePage() {
+       Iterator enum = currentSelection.iterator();
+       if (enum.hasNext()) {
+               Object next = enum.next();
+               IResource selectedResource = null;
+               if (next instanceof IResource) {
+                       selectedResource = (IResource)next;
+               } else if (next instanceof IAdaptable) {
+                       selectedResource = (IResource)((IAdaptable)next).getAdapter(IResource.class);
+               }
+               if (selectedResource != null) {
+                       if (selectedResource.getType() == IResource.FILE)
+                               selectedResource = selectedResource.getParent();
+                       if (selectedResource.isAccessible())
+                               resourceGroup.setContainerFullPath(selectedResource.getFullPath());
+               }
+       }
+       setPageComplete(false);
+}
+
+public void setVisible(boolean visible) {
+       super.setVisible(visible);
+       if(visible)
+               resourceGroup.setFocus();
+}
+
+protected boolean validatePage() {
+       boolean valid = true;
+       String moduleName = new String();
+       IWorkspace workspace = WorkbenchPlugin.getPluginWorkspace();
+    IStatus nameStatus = null;
+    String folderName = resourceGroup.getResource();
+    moduleName = folderName;
+    if (folderName.indexOf(IPath.SEPARATOR) != -1) {
+        StringTokenizer tok = new StringTokenizer(folderName, String.valueOf(IPath.SEPARATOR));
+        while (tok.hasMoreTokens()) {
+            String pathFragment = tok.nextToken();
+            nameStatus = workspace.validateName(pathFragment, IResource.FOLDER);
+            if (!nameStatus.isOK()) {
+                break;
+            }
+               }
+    }
+       //If the name status was not set validate using the name
+       if(nameStatus == null && folderName.length() > 0)
+        nameStatus = workspace.validateName(folderName, IResource.FOLDER);
+    if (nameStatus != null && !nameStatus.isOK()) {
+               setErrorMessage(nameStatus.getMessage());
+        return false;
+    }
+
+       if (!resourceGroup.areAllValuesValid()) {
+               // if blank name then fail silently
+               if (resourceGroup.getProblemType() == ResourceAndContainerGroup.PROBLEM_RESOURCE_EMPTY
+                       || resourceGroup.getProblemType() == ResourceAndContainerGroup.PROBLEM_CONTAINER_EMPTY) {
+                       setMessage(resourceGroup.getProblemMessage());
+                       setErrorMessage(null);
+               } else {
+                       setErrorMessage(resourceGroup.getProblemMessage());
+               }
+               valid = false;
+       }
+       if (valid) {
+               XarayaVersionModel.setModversionname(moduleName);
+               setErrorMessage(null);
+       } 
+       return valid;
+}
+
+}
+
diff --git a/net.sourceforge.phpeclipse/src/com/xaraya/wizard/XarayaModuleFilePage.java b/net.sourceforge.phpeclipse/src/com/xaraya/wizard/XarayaModuleFilePage.java
new file mode 100644 (file)
index 0000000..509cfef
--- /dev/null
@@ -0,0 +1,245 @@
+package com.xaraya.wizard;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+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.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+
+public class XarayaModuleFilePage extends WizardPage implements Listener
+{
+
+       IStructuredSelection selection;
+       
+       //Xaraya stuff
+       private Text modversionid;
+       private Text modversionversion;
+       private Text modversiondescription;
+       private Text modversionofficial;
+       private Text modversionauthor;
+       private Text modversioncontact;
+       private Text modversionsecurityschema;
+       private Text modversionclass;
+       private Text modversioncategory;
+
+       private Button officialButton;
+       private Button xarUserApi;
+       private Button xarUserGui;
+       private Button xarAdminApi;
+       private Button xarAdminGui;
+       
+       public XarayaModuleFilePage(String argument) {
+               super(argument);
+               setTitle(XarayaModuleMessages.getString("Xaraya.label.module"));
+               setDescription(XarayaModuleMessages.getString("Xaraya.label.details"));
+               setPageComplete(false);
+       }
+
+       public void createControl(Composite parent) {
+           // create the composite to hold the widgets
+               GridData gd;
+               Composite composite =  new Composite(parent, SWT.NULL);
+           // create the desired layout for this wizard page
+               GridLayout gl = new GridLayout();
+               int ncol = 4;
+               gl.numColumns = ncol;
+               composite.setLayout(gl);
+               Group detailsgrp = new Group(composite, SWT.NULL);
+               detailsgrp.setText(XarayaModuleMessages.getString("Xaraya.label.detailsgrp")/*"Module details"*/);
+               detailsgrp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+               detailsgrp.setLayout(new GridLayout());
+
+               new Label (detailsgrp, SWT.NONE).setText(XarayaModuleMessages.getString("Xaraya.label.modversionid")/*"modversionid"*/);                                
+               modversionid = new Text(detailsgrp, SWT.BORDER);
+               modversionid.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+               modversionid.addListener(SWT.KeyUp, this);
+               modversionid.setFocus();
+               new Label (detailsgrp, SWT.NONE).setText(XarayaModuleMessages.getString("Xaraya.label.modversionversion")/*"modversionversion"*/);                              
+               modversionversion = new Text(detailsgrp, SWT.BORDER);
+               modversionversion.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+               modversionversion.addListener(SWT.KeyUp, this);
+               new Label (detailsgrp, SWT.NONE).setText(XarayaModuleMessages.getString("Xaraya.label.modversionDescription")/*"modversionDescription"*/);                              
+               modversiondescription = new Text(detailsgrp, SWT.BORDER);
+               modversiondescription.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+               modversiondescription.addListener(SWT.KeyUp, this);
+       //      new Label (detailsgrp, SWT.NONE).setText(XarayaModuleMessages.getString("Xaraya.label.modversionofficial")/*"modversionofficial"*/);                            
+       //      modversionofficial = new Text(detailsgrp, SWT.BORDER);
+       //      modversionofficial.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+       //      modversionofficial.addListener(SWT.KeyUp, this);
+               new Label (detailsgrp, SWT.NONE).setText(XarayaModuleMessages.getString("Xaraya.label.modversionauthor")/*"modversionauthor"*/);                                
+               modversionauthor = new Text(detailsgrp, SWT.BORDER);
+               modversionauthor.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+               modversionauthor.addListener(SWT.KeyUp, this);
+               new Label (detailsgrp, SWT.NONE).setText(XarayaModuleMessages.getString("Xaraya.label.modversioncontact")/*"modversioncontact"*/);                              
+               modversioncontact = new Text(detailsgrp, SWT.BORDER);
+               modversioncontact.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+               modversioncontact.addListener(SWT.KeyUp, this);
+               new Label (detailsgrp, SWT.NONE).setText(XarayaModuleMessages.getString("Xaraya.label.modversionsecurityschema")/*"modversionsecurityschema"*/);                                
+               modversionsecurityschema = new Text(detailsgrp, SWT.BORDER);
+               modversionsecurityschema.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+               modversionsecurityschema.addListener(SWT.KeyUp, this);
+               new Label (detailsgrp, SWT.NONE).setText(XarayaModuleMessages.getString("Xaraya.label.modversionclass")/*"modversionclass"*/);                          
+               modversionclass = new Text(detailsgrp, SWT.BORDER);
+               modversionclass.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+               modversionclass.addListener(SWT.KeyUp, this);
+               new Label (detailsgrp, SWT.NONE).setText(XarayaModuleMessages.getString("Xaraya.label.modversioncategory")/*"modversioncategory"*/);                            
+               modversioncategory = new Text(detailsgrp, SWT.BORDER);
+               modversioncategory.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+               modversioncategory.addListener(SWT.KeyUp, this);
+               
+               Composite compo = new Composite(composite, SWT.NONE);
+               gl = new GridLayout();
+               ncol = 1;
+               gl.numColumns = ncol;
+               compo.setLayout(gl);
+               
+               //Group officialgrp = new Group(composite, SWT.NONE);
+               Group officialgrp = new Group(compo, SWT.NONE);
+               officialgrp.setText(XarayaModuleMessages.getString("Xaraya.label.officialgrp")/*"Module details"*/);
+               officialgrp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+               officialgrp.setLayout(new GridLayout());
+
+               officialButton = new Button(officialgrp, SWT.CHECK);
+               officialButton.setText(XarayaModuleMessages.getString("Xaraya.label.official"));
+               gd = new GridData(GridData.FILL_HORIZONTAL);
+               //gd.horizontalSpan = ncol;
+               officialButton.setLayoutData(gd);
+               officialButton.setSelection(false);
+               
+               //Group autoGensgrp = new Group(composite, SWT.NONE);
+               Group autoGensgrp = new Group(compo, SWT.NONE);
+               autoGensgrp.setText(XarayaModuleMessages.getString("Xaraya.label.autoGensgrp"));
+               autoGensgrp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+               autoGensgrp.setLayout(new GridLayout());
+
+               xarUserApi = new Button(autoGensgrp, SWT.CHECK);
+               xarUserApi.setText(XarayaModuleMessages.getString("Xaraya.label.xarUserApi"));
+               gd = new GridData(GridData.FILL_HORIZONTAL);
+               gd.horizontalSpan = ncol;
+               xarUserApi.setLayoutData(gd);
+               xarUserApi.setSelection(false);
+               xarUserGui = new Button(autoGensgrp, SWT.CHECK);
+               xarUserGui.setText(XarayaModuleMessages.getString("Xaraya.label.xarUserGui"));
+               gd = new GridData(GridData.FILL_HORIZONTAL);
+               gd.horizontalSpan = ncol;
+               xarUserGui.setLayoutData(gd);
+               xarUserGui.setSelection(false);
+               xarAdminApi = new Button(autoGensgrp, SWT.CHECK);
+               xarAdminApi.setText(XarayaModuleMessages.getString("Xaraya.label.xarAdminApi"));
+               gd = new GridData(GridData.FILL_HORIZONTAL);
+               gd.horizontalSpan = ncol;
+               xarAdminApi.setLayoutData(gd);
+               xarAdminApi.setSelection(false);
+               xarAdminGui = new Button(autoGensgrp, SWT.CHECK);
+               xarAdminGui.setText(XarayaModuleMessages.getString("Xaraya.label.xarAdminGui"));
+               gd = new GridData(GridData.FILL_HORIZONTAL);
+               gd.horizontalSpan = ncol;
+               xarAdminGui.setLayoutData(gd);
+               xarAdminGui.setSelection(false);
+
+           // set the composite as the control for this page
+               setControl(composite);          
+               addListeners();
+       }
+       
+       private void addListeners()
+       {
+               officialButton.addListener(SWT.Selection, this);
+               xarUserApi.addListener(SWT.Selection, this);
+               xarUserGui.addListener(SWT.Selection, this);
+               xarAdminApi.addListener(SWT.Selection, this);
+               xarAdminGui.addListener(SWT.Selection, this);
+       }
+
+       public void handleEvent(Event event) {
+               setPageComplete(validatePage());
+       }
+
+//     public boolean canFlipToNextPage()
+//     {
+//             if (getErrorMessage() != null) return false;
+//             if (isPageComplete() && validatePage()) {
+//                     saveDataToModel();
+//                     return true;
+//             } 
+//             return false;
+//     }
+       public boolean canFinish(){
+               if (isPageComplete() /*&& validatePage()*/) {
+                       saveDataToModel();
+                       return true;
+               } 
+               return false;           
+       }
+
+
+
+       private boolean validateText(Text input){
+               String buf = input.getText();
+               if ((buf!=null) 
+                       &&  (buf.trim().length() >0)) return true;
+               else return false;      
+       }
+       public boolean isNumeric(Text input) {
+               //there is something in the field to check..
+               StringBuffer buf = new StringBuffer(input.getText());
+               for (int i=0; i < buf.length(); i++){
+                       if (!( Character.isDigit(buf.charAt(i)) //is it a number
+                               || (buf.charAt(i) == '.')  //is it a decimal point
+                               || (buf.charAt(i) == '_'))) //is it an under_score (incase of 1_2)
+                               return false;
+               }
+               return true;
+       }
+                       
+       private boolean validatePage()  {
+               StringBuffer buf = new StringBuffer();
+               if (!validateText(modversionid)) buf.append("Id field incomplete");
+               else if (!isNumeric(modversionid)) buf.append("Id field must be numeric");
+               else if (!validateText(modversionversion)) buf.append("Version field incomplete");
+               else if (!isNumeric(modversionversion)) buf.append("Version must be numeric");
+               else if (!validateText(modversiondescription)) buf.append("Description field incomplete");
+               else if (!validateText(modversionauthor)) buf.append("Author field incomplete");
+               else if (!validateText(modversioncontact)) buf.append("Contact field incomplete");
+               else if (!validateText(modversionsecurityschema)) buf.append("Security schema field incomplete");
+               else if (!validateText(modversionclass)) buf.append("Class field incomplete");
+               else if (!validateText(modversioncategory)) buf.append("Category field incomplete");
+               if (buf.length() == 0) {
+                       //setErrorMessage("Module ready for creation");
+                       setErrorMessage(null); 
+                       return true;
+               }       
+               setErrorMessage(buf.toString());
+               return false;           
+       }
+
+       public void saveDataToModel()
+       {
+               XarayaVersionModel.setModversionid(modversionid.getText());
+               XarayaVersionModel.setModversionversion(modversionversion.getText());
+               XarayaVersionModel.setModversiondescription(modversiondescription.getText());
+               XarayaVersionModel.setModversionauthor(modversionauthor.getText());
+               XarayaVersionModel.setModversioncontact(modversioncontact.getText());
+               XarayaVersionModel.setModversionsecurityschema(modversionsecurityschema.getText());
+               XarayaVersionModel.setModversionclass(modversionclass.getText());
+               XarayaVersionModel.setModversioncategory(modversioncategory.getText());
+               XarayaVersionModel.setUserApi(xarUserApi.getSelection());
+               XarayaVersionModel.setUserGui(xarUserGui.getSelection());
+               XarayaVersionModel.setAdminApi(xarAdminApi.getSelection());
+               XarayaVersionModel.setAdminGui(xarAdminGui.getSelection());
+               XarayaVersionModel.setModversionofficial(
+                       (officialButton.getSelection()) ? "1" : "0");
+               XarayaVersionModel.setModversionadmin(
+                       (xarAdminGui.getSelection()) ? "1" : "0" );
+               XarayaVersionModel.setModversionuser( 
+                       (xarUserGui.getSelection()) ? "1" : "0" );
+               }
+}
+
diff --git a/net.sourceforge.phpeclipse/src/com/xaraya/wizard/XarayaModuleMessages.java b/net.sourceforge.phpeclipse/src/com/xaraya/wizard/XarayaModuleMessages.java
new file mode 100644 (file)
index 0000000..8f7e937
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * (c) Copyright IBM Corp. 2000, 2001.
+ * All Rights Reserved.
+ */
+package com.xaraya.wizard;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class XarayaModuleMessages {
+
+       private static final String RESOURCE_BUNDLE= XarayaModuleMessages.class.getName();
+       private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
+
+       protected XarayaModuleMessages() {
+       }
+
+       public static String getString(String key) {
+               try {
+                       return fgResourceBundle.getString(key);
+               } catch (MissingResourceException e) {
+                       return '!' + key + '!';
+               }
+       }
+       
+       /**
+        * Gets a string from the resource bundle and formats it with the argument
+        * 
+        * @param key   the string used to get the bundle value, must not be null
+        */
+       public static String getFormattedString(String key, Object arg) {
+               return MessageFormat.format(getString(key), new Object[] { arg });
+       }
+
+
+       /**
+        * Gets a string from the resource bundle and formats it with arguments
+        */     
+       public static String getFormattedString(String key, Object[] args) {
+               return MessageFormat.format(getString(key), args);
+       }
+}
diff --git a/net.sourceforge.phpeclipse/src/com/xaraya/wizard/XarayaModuleMessages.properties b/net.sourceforge.phpeclipse/src/com/xaraya/wizard/XarayaModuleMessages.properties
new file mode 100644 (file)
index 0000000..28bede5
--- /dev/null
@@ -0,0 +1,59 @@
+########################################
+#Constants for use in the xaraya wizard#
+########################################
+
+#Xaraya files
+Xaraya.files.init=xarinit.php
+Xaraya.files.version=xarversion.php
+Xaraya.files.userGui=xaruser.php
+Xaraya.files.userApi=xaruserapi.php
+Xaraya.files.adminGui=xaradmin.php
+Xaraya.files.adminApi=xaradminapi.php
+Xaraya.folder.gui=xartemplates
+
+#Xaraya inserts for replacement
+Xaraya.insert.name=<modname>
+Xaraya.insert.id=<id number>
+Xaraya.insert.version=<version>
+Xaraya.insert.description=<description>
+Xaraya.insert.official=<official>
+Xaraya.insert.author=<author name>
+Xaraya.insert.contact=<author email>
+Xaraya.insert.admin=<admin>
+Xaraya.insert.user=<user>
+Xaraya.insert.securityschema=<security schema>
+Xaraya.insert.class=<classification>
+Xaraya.insert.category=<category>
+Xaraya.insert.help=<help>
+Xaraya.insert.changelog=<changelog>
+Xaraya.insert.credits=<credits>
+Xaraya.insert.license=<license>
+
+#Xaraya label texts
+Xaraya.label.container=New Xaraya Module
+Xaraya.label.module=Create Xaraya module
+Xaraya.label.details=Enter module details
+Xaraya.label.modversionname=Module Name
+Xaraya.label.modversionid=Id number
+Xaraya.label.modversionversion=Module version
+Xaraya.label.modversionDescription=Description
+Xaraya.label.modversionofficial=Official
+Xaraya.label.modversionauthor=Author
+Xaraya.label.modversioncontact=Contact e-mail
+Xaraya.label.modversionsecurityschema=Security schema
+Xaraya.label.modversionclass=Classification
+Xaraya.label.modversioncategory=Category
+Xaraya.label.modversionhelp=Help
+Xaraya.label.modversionchangelog=Change log
+Xaraya.label.modversioncredits=Credits
+Xaraya.label.modversionlicense=License
+Xaraya.label.detailsgrp=Module details
+Xaraya.label.autoGensgrp=Select files to create
+Xaraya.label.officialgrp=Official module settings
+Xaraya.label.official=Official module?
+Xaraya.label.xarUserApi=User api (xarUserApi.php)
+Xaraya.label.xarUserGui=User gui (xarUser.php)
+Xaraya.label.xarAdminApi=Admin api(xarAdminApi.php)
+Xaraya.label.xarAdminGui=Admin gui (xarAdmin.php)
+
+
diff --git a/net.sourceforge.phpeclipse/src/com/xaraya/wizard/XarayaModuleText.java b/net.sourceforge.phpeclipse/src/com/xaraya/wizard/XarayaModuleText.java
new file mode 100644 (file)
index 0000000..8664b8d
--- /dev/null
@@ -0,0 +1,153 @@
+package com.xaraya.wizard;
+
+public  final class XarayaModuleText {
+       final static StringBuffer xarinit = new StringBuffer(
+               "<?php\n" +
+               "/**\n" +
+               " * File: $Id: XarayaModuleText.java,v 1.1 2003-02-04 22:23:09 choochter Exp $\n" +
+               " * \n" +
+               " * Initialise <modname> Module\n" +
+               " *\n" +
+               " * @package Xaraya eXtensible Management System\n" +
+               " * @copyright (C) 2002 by the Xaraya Development Team.\n" +
+               " * @license GPL <http://www.gnu.org/licenses/gpl.html>\n" +
+               " * @link http://www.xaraya.org\n" +
+               " *\n" +
+               " * @subpackage <modname> Module\n" +
+               " * @author <author name> <<author email>>\n" +
+               " */\n" +
+               "\n" +
+               "/**\n" +
+               " * initialise the <modname> module\n" +
+               " *\n" +
+               " * @access public\n" +
+               " * @param none\n" +
+               " * @returns bool\n" +
+               " * @raise DATABASE_ERROR\n" +
+               " */\n" +
+               "function <modname>_init()\n" +
+               "{\n" +
+               "       return true;\n" +
+               "}\n" +
+               "\n" +
+               "/** \n" +
+               " * upgrade the <modname> module from an old version\n" +
+               " *  \n" +
+               " * @access public\n" +
+               " * @param oldversion float \"Previous version upgrading from\"\n" +
+               " * @returns bool\n" +
+               " * @raise DATABASE_ERROR\n" +
+               " */ \n" +
+               "function <modname>_upgrade($oldversion)\n" +
+               "{\n" +
+               "       return true;\n" +
+               "}\n" +
+               "\n" +
+               "/**\n" +
+               " * remove the <modname> module\n" +
+               " *\n" +
+               " * @access public\n" +
+               " * @param none\n" +
+               " * @returns bool\n" +
+               " * @raise DATABASE_ERROR\n" +
+               " */\n" +
+               "function <modname>_delete()\n" +
+               "{\n" +
+               "       return true;\n" +
+               "}\n" +
+               "?>");
+               
+       final static StringBuffer xaradmin = new StringBuffer(
+               "<?php\n" +
+               "/**\n" +
+               " * File: $Id: XarayaModuleText.java,v 1.1 2003-02-04 22:23:09 choochter Exp $\n" +
+               " * \n" +
+               " * <modname> Admin Interface\n" +
+               " *\n" +
+               " * @package Xaraya eXtensible Management System\n" +
+               " * @copyright (C) 2002 by the Xaraya Development Team.\n" +
+               " * @license GPL <http://www.gnu.org/licenses/gpl.html>\n" +
+               " * @link http://www.xaraya.org\n" +
+               " *\n" +
+               " * @subpackage <modname> Module\n" +
+               " * @author <author name> <<author email>>\n" +
+               " */\n" +
+               "\n" +
+               "?>\n" 
+       );
+
+       final static StringBuffer xaradminapi = new StringBuffer(
+               "<?php\n" +
+               "/**\n" +
+               " * File: $Id: XarayaModuleText.java,v 1.1 2003-02-04 22:23:09 choochter Exp $\n" +
+               " * \n" +
+               " * <modname> Admin API\n" +
+               " *\n" +
+               " * @package Xaraya eXtensible Management System\n" +
+               " * @copyright (C) 2002 by the Xaraya Development Team.\n" +
+               " * @license GPL <http://www.gnu.org/licenses/gpl.html>\n" +
+               " * @link http://www.xaraya.org\n" +
+               " *\n" +
+               " * @subpackage <modname> Module\n" +
+               " * @author <author name> <<author email>>\n" +
+               " */\n" +
+               "\n" +
+               "?>\n"
+       );
+
+
+       final static StringBuffer xaruser = new StringBuffer(
+               "<?php\n" +
+               "/**\n" +
+               " * File: $Id: XarayaModuleText.java,v 1.1 2003-02-04 22:23:09 choochter Exp $\n" +
+               " * \n" +
+               " * <modname> User Interface\n" +
+               " *\n" +
+               " * @package Xaraya eXtensible Management System\n" +
+               " * @copyright (C) 2002 by the Xaraya Development Team.\n" +
+               " * @license GPL <http://www.gnu.org/licenses/gpl.html>\n" +
+               " * @link http://www.xaraya.org\n" +
+               " *\n" +
+               " * @subpackage <modname> Module\n" +
+               " * @author <author name> <<author email>>\n" +
+               " */\n" +
+               "\n" +
+               "?>\n"
+       );
+
+       final static StringBuffer xaruserapi = new StringBuffer(
+               "<?php\n" +
+               "/**\n" +
+               " * File: $Id: XarayaModuleText.java,v 1.1 2003-02-04 22:23:09 choochter Exp $\n" +
+               " * \n" +
+               " * <modname> User API\n" +
+               " *\n" +
+               " * @package Xaraya eXtensible Management System\n" +
+               " * @copyright (C) 2002 by the Xaraya Development Team.\n" +
+               " * @license GPL <http://www.gnu.org/licenses/gpl.html>\n" +
+               " * @link http://www.xaraya.org\n" +
+               " *\n" +
+               " * @subpackage <modname> Module\n" +
+               " * @author <author name> <<author email>>\n" +
+               " */\n" +
+               "\n" +
+               "?>\n"
+       );
+
+       final static StringBuffer xarversion = new StringBuffer(
+               "<?php\n" +
+               "$modversion['name'] = '<modname>';\n" +
+               "$modversion['id'] = '<id number>';\n" +
+               "$modversion['version'] = '<version>';\n" +
+               "$modversion['description'] = '<description>';\n" +
+               "$modversion['official'] = <official>;\n" +
+               "$modversion['author'] = '<author name>';\n" +
+               "$modversion['contact'] = '<author email>';\n" +
+               "$modversion['admin'] = <admin>;\n" +
+               "$modversion['user'] = <user>;\n" +
+               "$modversion['securityschema'] = array('<modname>::' => '::');\n" +
+               "$modversion['class'] = '<classification>';\n" +
+               "$modversion['category'] = '<category>';\n" +
+               "?>\n"
+       );
+}
diff --git a/net.sourceforge.phpeclipse/src/com/xaraya/wizard/XarayaVersionModel.java b/net.sourceforge.phpeclipse/src/com/xaraya/wizard/XarayaVersionModel.java
new file mode 100644 (file)
index 0000000..788fd1d
--- /dev/null
@@ -0,0 +1,79 @@
+package com.xaraya.wizard;
+
+
+/**
+ * Class to hold the details of a xarya module so the
+ * filecreation process can be performed 
+*/
+public final class XarayaVersionModel 
+{
+       //Fields to hold the details of the project to write
+       //in the xarVersions.php file..
+       private static String modversionname;  //compulsory
+       private static String modversiondescription;    //compulsory
+       private static String modversionid;  //compulsory
+       private static String modversionversion;  //compulsory
+       private static String modversioncredits;
+       private static String modversionhelp;
+       private static String modversionchangelog;
+       private static String modversionlicense;
+       private static String modversioncoding;
+       private static String modversionofficial;  //compulsory
+       private static String modversionauthor;  //compulsory
+       private static String modversioncontact;  //compulsory
+       private static String modversionadmin;  //compulsory
+       private static String modversionuser;  //compulsory
+       private static String modversionsecurityschema;  //compulsory
+       private static String modversionclass;  //compulsory
+       private static String modversioncategory;  //compulsory
+       
+       public static boolean /*modversionofficial,*/userApi, userGui, adminApi, adminGui;
+       
+
+//Getters and setters for xaraya specifics
+       public static String getModversiondescription() {       return modversiondescription; }
+       public static String getModversionname() { return modversionname; }
+       public static String getModversionadmin() { return modversionadmin;}
+       public static String getModversionauthor() { return modversionauthor;}
+       public static String getModversioncategory() { return modversioncategory;}
+       public static String getModversionchangelog() {return modversionchangelog;}
+       public static String getModversionclass() {return modversionclass;}
+       public static String getModversioncontact() {return modversioncontact;}
+       public static String getModversioncredits() {return modversioncredits;}
+       public static String getModversionhelp() {return modversionhelp;}
+       public static String getModversionid() {return modversionid;}
+       public static String getModversionlicense() {return modversionlicense;}
+       public static String getModversioncoding() {return modversioncoding;}
+       public static String getModversionofficial() {return modversionofficial;}
+       public static String getModversionsecurityschema() {return modversionsecurityschema;}
+       public static String getModversionuser() {return modversionuser;}
+       public static String getModversionversion() {return modversionversion;}
+       public static void setModversiondescription(String mvd) { XarayaVersionModel.modversiondescription = mvd; }
+       public static void setModversionname(String mvn) { XarayaVersionModel.modversionname = mvn; }
+       public static void setModversionadmin(String mva) {XarayaVersionModel.modversionadmin = mva;}
+       public static void setModversionauthor(String mva) {XarayaVersionModel.modversionauthor = mva;}
+       public static void setModversioncategory(String mvc) {XarayaVersionModel.modversioncategory = mvc;}
+       public static void setModversionchangelog(String mvc) {XarayaVersionModel.modversionchangelog = mvc;}
+       public static void setModversionclass(String mvc) {XarayaVersionModel.modversionclass = mvc;}
+       public static void setModversioncontact(String mvc) {XarayaVersionModel.modversioncontact = mvc;}
+       public static void setModversioncredits(String mvc) {XarayaVersionModel.modversioncredits = mvc;}
+       public static void setModversionhelp(String mvh) {XarayaVersionModel.modversionhelp = mvh;}
+       public static void setModversionid(String mvid) {XarayaVersionModel.modversionid = mvid;}
+       public static void setModversionlicense(String mvl) {XarayaVersionModel.modversionlicense = mvl;}
+       public static void setModversioncoding(String mvl) {XarayaVersionModel.modversioncoding = mvl;}
+       public static void setModversionofficial(String mvo) {XarayaVersionModel.modversionofficial = mvo;}
+       public static void setModversionsecurityschema(String mvss) {XarayaVersionModel.modversionsecurityschema = mvss;}
+       public static void setModversionuser(String mvu) {XarayaVersionModel.modversionuser = mvu;}
+       public static void setModversionversion(String mvv) {XarayaVersionModel.modversionversion = mvv;}
+
+       //public static boolean isOfficial() { return modversionofficial; }
+       public static boolean isAdminApi() { return adminApi; }
+       public static boolean isAdminGui() { return adminGui; }
+       public static boolean isUserApi()  { return userApi;  }
+       public static boolean isUserGui()  { return userGui;  }
+       //public static void setOfficial(boolean official) { XarayaVersionModel.modversionofficial = official; }
+       public static void setAdminApi(boolean adminApi) { XarayaVersionModel.adminApi = adminApi;}
+       public static void setAdminGui(boolean adminGui) { XarayaVersionModel.adminGui = adminGui; }
+       public static void setUserApi(boolean userApi) { XarayaVersionModel.userApi = userApi; }
+       public static void setUserGui(boolean userGui) { XarayaVersionModel.userGui = userGui; }
+}