Author: cmarcum
Date: Sat May  2 15:24:43 2015
New Revision: 1677323

URL: http://svn.apache.org/r1677323
Log:
#i126246#
added sdkOk property and getter/setter in UNOClientAppWizardIterator to keep 
track of valid office and sdk locations.

added getter for UNOClientAppWizardIterator in UNOClientAppWizardPanel to be 
used by UNOClientAppPanelVisual valid method.

added check of sdkOk in UNOClientAppPanelVisual valid method to disable next 
button and display message.

added message to bundle to display instructions to cancel dialog if settings 
were skipped and where to find settings in tools > options.

added same message in it_IT bundle.


Modified:
    
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/Bundle.properties
    
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/Bundle_it_IT.properties
    
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/UNOClientAppPanelVisual.java
    
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/UNOClientAppWizardIterator.java
    
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/UNOClientAppWizardPanel.java

Modified: 
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/Bundle.properties
URL: 
http://svn.apache.org/viewvc/openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/Bundle.properties?rev=1677323&r1=1677322&r2=1677323&view=diff
==============================================================================
--- 
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/Bundle.properties
 (original)
+++ 
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/Bundle.properties
 Sat May  2 15:24:43 2015
@@ -13,6 +13,7 @@ LB_Error_ProjectFolder=Project Folder ca
 LB_Error_ProjectFolderNotEmpty=Project Folder already exists and is not empty
 LB_Error_ClassName=Class Name is not a valid class name
 LB_Error_Package=Package is not a valid name.
+LBL_ErrorMessageOfficeSdk=Cancel and set OpenOffice and SDK locations in 
<br/>Tools > Options > Miscellaneous > AOO API Plugin
 
 LBL_ProjectName=Project &Name:
 LBL_ClassName=&Class Name:

Modified: 
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/Bundle_it_IT.properties
URL: 
http://svn.apache.org/viewvc/openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/Bundle_it_IT.properties?rev=1677323&r1=1677322&r2=1677323&view=diff
==============================================================================
--- 
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/Bundle_it_IT.properties
 (original)
+++ 
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/Bundle_it_IT.properties
 Sat May  2 15:24:43 2015
@@ -11,7 +11,7 @@ Templates/Project/org-openoffice-extensi
 TF_ProjectName_Tooltip=Nome del nuovo progetto creato (utilizzato anche come 
nome della cartella di progetto)
 TF_ClassName_Tooltip=Nome della classe, impostata come classe principale
 TF_JavaPackage_Tooltip=Nome del package Java
-TF_Location_Tooltip=Percorso della directory in cui il progetto verr\u00E0 
creato
+TF_Location_Tooltip=Percorso della directory in cui il progetto verr\u00e0 
creato
 TF_ProjectFolder_Tooltip=Cartella di destinazione finale del nuovo progetto
 
 #LB_Error_ProjectName=Project Name is not a valid folder name.
@@ -20,12 +20,14 @@ TF_ProjectFolder_Tooltip=Cartella di des
 #LB_Error_ProjectFolderNotEmpty=Project Folder already exists and is not empty
 #LB_Error_ClassName=Class Name is not a valid class name
 #LB_Error_Package=Package is not a valid name.
-LB_Error_ProjectName=Il nome del progetto non \u00E8 un nome di cartella 
valido.
-LB_Error_ProjectPath=La cartella di progetto non \u00E8 un percorso valido.
-LB_Error_ProjectFolder=La cartella di progetto non pu\u00F2 essere creata.
-LB_Error_ProjectFolderNotEmpty=La cartella di progetto \u00E8 gi\u00E0 
esistente e non \u00E8 vuota.
-LB_Error_ClassName=Il nome della classe non \u00E8 un nome di classe valido
-LB_Error_Package=Package non \u00E8 un nome valido.
+#LBL_ErrorMessageOfficeSdk=Cancel and set OpenOffice and SDK locations in 
<br/>Tools > Options > Miscellaneous > AOO API Plugin
+LB_Error_ProjectName=Il nome del progetto non \u00e8 un nome di cartella 
valido.
+LB_Error_ProjectPath=La cartella di progetto non \u00e8 un percorso valido.
+LB_Error_ProjectFolder=La cartella di progetto non pu\u00f2 essere creata.
+LB_Error_ProjectFolderNotEmpty=La cartella di progetto \u00e8 gi\u00e0 
esistente e non \u00e8 vuota.
+LB_Error_ClassName=Il nome della classe non \u00e8 un nome di classe valido
+LB_Error_Package=Package non \u00e8 un nome valido.
+LBL_ErrorMessageOfficeSdk=Annullare e impostare i percorsi di OpenOffice e del 
suo SDK in <br/>Tools > Options > Miscellaneous > AOO API Plugin
 
 #LBL_ProjectName=Project &Name:
 #LBL_ClassName=&Class Name:
@@ -44,4 +46,4 @@ LBL_BrowseButton=S&foglia
 LBL_FileChooserTitle=Seleziona percorso del progetto
 
 #BUTTON_Browse_Tooltip=Select a folder where the project will be created
-BUTTON_Browse_Tooltip=Selezionare una cartella in cui il progetto verr\u00E0 
creato
+BUTTON_Browse_Tooltip=Selezionare una cartella in cui il progetto verr\u00e0 
creato

Modified: 
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/UNOClientAppPanelVisual.java
URL: 
http://svn.apache.org/viewvc/openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/UNOClientAppPanelVisual.java?rev=1677323&r1=1677322&r2=1677323&view=diff
==============================================================================
--- 
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/UNOClientAppPanelVisual.java
 (original)
+++ 
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/UNOClientAppPanelVisual.java
 Sat May  2 15:24:43 2015
@@ -1,24 +1,23 @@
-/**************************************************************
- * 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * 
- *************************************************************/
-
+/**
+ * ************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations 
under
+ * the License.
+ *
+ ************************************************************
+ */
 package org.openoffice.extensions.projecttemplates.unoclientapplication;
 
 import java.io.File;
@@ -39,14 +38,16 @@ import org.openoffice.extensions.config.
 import org.openoffice.extensions.projecttemplates.actions.ProjectVersion;
 
 public class UNOClientAppPanelVisual extends JPanel implements 
DocumentListener {
-    
+
     public static final String PROP_PROJECT_NAME = "ProjectName"; // NOI18N
     public static final String PROP_CLASS_NAME = "ClassName"; // NOI18N
 
-    private boolean classNameModified = false;    
+    private boolean classNameModified = false;
     private UNOClientAppWizardPanel panel;
-    
-    /** Creates new form PanelProjectLocationVisual */
+
+    /**
+     * Creates new form PanelProjectLocationVisual
+     */
     public UNOClientAppPanelVisual(UNOClientAppWizardPanel panel) {
         initComponents();
         this.panel = panel;
@@ -56,16 +57,15 @@ public class UNOClientAppPanelVisual ext
         projectLocationTextField.getDocument().addDocumentListener(this);
         projectPackageTextField.getDocument().addDocumentListener(this);
     }
-    
-    
+
     public String getProjectName() {
         return this.projectNameTextField.getText();
     }
-    
-    /** This method is called from within the constructor to
-     * initialize the form.
-     * WARNING: Do NOT modify this code. The content of this method is
-     * always regenerated by the Form Editor.
+
+    /**
+     * This method is called from within the constructor to initialize the 
form.
+     * WARNING: Do NOT modify this code. The content of this method is always
+     * regenerated by the Form Editor.
      */
     // <editor-fold defaultstate="collapsed" desc="Generated 
Code">//GEN-BEGIN:initComponents
     private void initComponents() {
@@ -168,14 +168,14 @@ public class UNOClientAppPanelVisual ext
                 .addGap(165, 165, 165))
         );
     }// </editor-fold>//GEN-END:initComponents
-    
+
     private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) 
{//GEN-FIRST:event_browseButtonActionPerformed
         String command = evt.getActionCommand();
         if ("BROWSE".equals(command)) { // NOI18N
             JFileChooser chooser = new 
JFileChooser(FileSystemView.getFileSystemView());
             FileUtil.preventFileChooserSymlinkTraversal(chooser, 
ConfigurationSettings.getDefaultFileChooserStartingDir());
             chooser.setDialogTitle(
-                NbBundle.getMessage(UNOClientAppPanelVisual.class, 
"LBL_FileChooserTitle"));
+                    NbBundle.getMessage(UNOClientAppPanelVisual.class, 
"LBL_FileChooserTitle"));
             chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
             String path = this.projectLocationTextField.getText();
             if (path.length() > 0) {
@@ -191,10 +191,10 @@ public class UNOClientAppPanelVisual ext
             }
             panel.fireChangeEvent();
         }
-        
+
     }//GEN-LAST:event_browseButtonActionPerformed
-    
-    
+
+
     // Variables declaration - do not modify//GEN-BEGIN:variables
     private javax.swing.JButton browseButton;
     private javax.swing.JLabel createdFolderLabel;
@@ -208,15 +208,21 @@ public class UNOClientAppPanelVisual ext
     private javax.swing.JLabel projectPackageLabel;
     private javax.swing.JTextField projectPackageTextField;
     // End of variables declaration//GEN-END:variables
-    
+
     public void addNotify() {
         super.addNotify();
         //same problem as in 31086, initial focus on Cancel button
         projectNameTextField.requestFocus();
     }
-    
+
     boolean valid(WizardDescriptor wizardDescriptor) {
-        
+
+        if (!panel.getUNOClientAppWizardIterator().isSdkOk()) {
+            String message = 
NbBundle.getMessage(UNOClientAppWizardIterator.class, 
"LBL_ErrorMessageOfficeSdk");
+            wizardDescriptor.putProperty("WizardPanel_errorMessage", message); 
// NOI18N
+            return false; // Office or SDK skipped during Configuration Panel
+        }
+
         if (projectNameTextField.getText().length() == 0) {
             String message = 
NbBundle.getMessage(UNOClientAppWizardIterator.class, "LB_Error_ProjectName");
             wizardDescriptor.putProperty("WizardPanel_errorMessage", message); 
// NOI18N
@@ -229,7 +235,7 @@ public class UNOClientAppPanelVisual ext
             return false;
         }
         final File destFolder = FileUtil.normalizeFile(new 
File(createdFolderTextField.getText()).getAbsoluteFile());
-        
+
         File projLoc = destFolder;
         while (projLoc != null && !projLoc.exists()) {
             projLoc = projLoc.getParentFile();
@@ -239,13 +245,13 @@ public class UNOClientAppPanelVisual ext
             wizardDescriptor.putProperty("WizardPanel_errorMessage", message); 
// NOI18N
             return false;
         }
-        
+
         if (FileUtil.toFileObject(projLoc) == null) {
             String message = 
NbBundle.getMessage(UNOClientAppWizardIterator.class, "LB_Error_ProjectPath");
             wizardDescriptor.putProperty("WizardPanel_errorMessage", message); 
// NOI18N
             return false;
         }
-        
+
         File[] kids = destFolder.listFiles();
         if (destFolder.exists() && kids != null && kids.length > 0) {
             // Folder exists and is not empty
@@ -253,7 +259,7 @@ public class UNOClientAppPanelVisual ext
             wizardDescriptor.putProperty("WizardPanel_errorMessage", message); 
// NOI18N
             return false;
         }
-        
+
         String mainClass = projectClassNameTextField.getText().trim();
         if (mainClass.length() == 0 || 
!mainClass.matches("[a-zA-Z_][a-zA-Z_$0-9]*")) { // NOI18N
             String message = 
NbBundle.getMessage(UNOClientAppWizardIterator.class, "LB_Error_ClassName");
@@ -269,22 +275,26 @@ public class UNOClientAppPanelVisual ext
         wizardDescriptor.putProperty("WizardPanel_errorMessage", ""); // NOI18N
         return true;
     }
-    
+
     void store(WizardDescriptor d) {
         String name = projectNameTextField.getText().trim();
         String folder = createdFolderTextField.getText().trim();
 
         ConfigurationSettings settings = ConfigurationSettings.getSettings();
-        
-        String user = System.getProperty ("user.name"); // NOI18N
+
+        String user = System.getProperty("user.name"); // NOI18N
         if (user == null) {
-               user = "SomeBody"; // NOI18N
+            user = "SomeBody"; // NOI18N
         }
-        
+
         d.putProperty("UserName", settings.getUser()); // NOI18N
         d.putProperty("BuildUnoVersion", ProjectVersion.getProjectVersion()); 
// NOI18N
         d.putProperty("TimeStamp", ConfigurationSettings.getTimeStamp()); // 
NOI18N
-        d.putProperty("OfficeLibrary", settings.getLibraryName()); // NOI18N
+        try {
+            d.putProperty("OfficeLibrary", settings.getLibraryName()); // 
NOI18N
+        } catch (java.lang.NullPointerException npe) {
+            System.err.println("Caught NullPointerException: " + 
npe.getMessage());
+        }
         d.putProperty("OfficePath", 
Utilities.replaceString(settings.getValue(settings.KEY_OFFICE_INSTALLATION), 
"\\", "/")); // NOI18N
         d.putProperty("SdkPath", 
Utilities.replaceString(settings.getValue(settings.KEY_SDK_INSTALLATION), "\\", 
"/")); // NOI18N
         d.putProperty("projdir", new File(folder)); // NOI18N
@@ -296,123 +306,133 @@ public class UNOClientAppPanelVisual ext
         d.putProperty("UnoPackagePath", 
Utilities.replaceString(projectPackageTextField.getText().trim(), ".", "/")); 
// NOI18N
         d.putProperty("UnoClientMain", 
projectClassNameTextField.getText().trim()); // NOI18N
     }
-    
+
     void read(WizardDescriptor settings) {
-        File projectLocation = (File) settings.getProperty("ProjectDir"); // 
NOI18N
+        File projectLocation = null;
+        try {
+            projectLocation = (File) settings.getProperty("ProjectDir"); // 
NOI18N
+        } catch (java.lang.ClassCastException cce) {
+            System.out.println("Caught ClassCastException " + cce);
+        }
         if (projectLocation == null || projectLocation.getParentFile() == null 
|| !projectLocation.getParentFile().isDirectory()) {
             projectLocation = ProjectChooser.getProjectsFolder();
         } else {
             projectLocation = projectLocation.getParentFile();
         }
         
this.projectLocationTextField.setText(projectLocation.getAbsolutePath());
-        
+
         String projectName = (String) 
settings.getProperty("ProjectDisplayName"); // NOI18N
-        if(projectName == null) {
+        if (projectName == null) {
             projectName = "OfficeUNOClientApp"; // NOI18N
             String[] fileList = projectLocation.list(new FilenameFilter() {
                 public boolean accept(File dir, String name) {
-                    if (name.startsWith("OfficeUNOClientApp")) return true; // 
NOI18N
+                    if (name.startsWith("OfficeUNOClientApp")) {
+                        return true; // NOI18N
+                    }
                     return false;
                 }
             });
             boolean searchProjectName = true;
             int length = projectName.length();
-            for (int i=0; searchProjectName && i<fileList.length + 1; i++) {
+            for (int i = 0; searchProjectName && i < fileList.length + 1; i++) 
{
                 switch (i) {
                     case 0: // keep project name
                         break;
                     case 1: // append 1
-                        projectName = new 
StringBuffer(projectName).append(1).toString(); 
+                        projectName = new 
StringBuffer(projectName).append(1).toString();
                         break;
                     default: // remove number and append the next one
                         projectName = new 
StringBuffer(projectName.substring(0, length)).append(i).toString();
                 }
                 // test if the name is already used
                 searchProjectName = false;
-                for (int j=0; !searchProjectName && j<fileList.length; j++) {
+                for (int j = 0; !searchProjectName && j < fileList.length; 
j++) {
                     // if the project name isn't found, searchProjectName 
stays false and the name is kept
                     searchProjectName |= fileList[j].equals(projectName);
                 }
             }
         }
-        
+
         String mainClassName = (String) settings.getProperty("UnoClientMain"); 
// NOI18N
-        if(mainClassName == null) {
+        if (mainClassName == null) {
             mainClassName = projectName;
         }
 
-        String pkg = (String) settings.getProperty ("UnoPackage"); // NOI18N
+        String pkg = (String) settings.getProperty("UnoPackage"); // NOI18N
         if (pkg == null) {
             pkg = NbBundle.getMessage(ConfigurationSettings.class, 
"default.package"); // NOI18N
-        }        
+        }
         this.projectPackageTextField.setText(pkg);
         this.projectNameTextField.setText(projectName);
         this.projectNameTextField.selectAll();
         this.projectClassNameTextField.setText(mainClassName);
         this.projectPackageTextField.setText(pkg);
     }
-    
+
     void validate(WizardDescriptor d) throws WizardValidationException {
         // nothing to validate
     }
-    
+
     // Implementation of DocumentListener 
--------------------------------------
-    
     public void changedUpdate(DocumentEvent e) {
         updateTexts(e);
         if (this.projectNameTextField.getDocument() == e.getDocument()) {
-            
firePropertyChange(PROP_PROJECT_NAME,null,this.projectNameTextField.getText());
+            firePropertyChange(PROP_PROJECT_NAME, null, 
this.projectNameTextField.getText());
         }
         if (this.projectClassNameTextField.getDocument() == e.getDocument()) {
-            
firePropertyChange(PROP_CLASS_NAME,null,this.projectClassNameTextField.getText());
+            firePropertyChange(PROP_CLASS_NAME, null, 
this.projectClassNameTextField.getText());
         }
     }
-    
+
     public void insertUpdate(DocumentEvent e) {
         updateTexts(e);
         if (this.projectNameTextField.getDocument() == e.getDocument()) {
-            
firePropertyChange(PROP_PROJECT_NAME,null,this.projectNameTextField.getText());
+            firePropertyChange(PROP_PROJECT_NAME, null, 
this.projectNameTextField.getText());
         }
         if (this.projectClassNameTextField.getDocument() == e.getDocument()) {
-            
firePropertyChange(PROP_CLASS_NAME,null,this.projectClassNameTextField.getText());
+            firePropertyChange(PROP_CLASS_NAME, null, 
this.projectClassNameTextField.getText());
         }
     }
-    
+
     public void removeUpdate(DocumentEvent e) {
         updateTexts(e);
         if (this.projectNameTextField.getDocument() == e.getDocument()) {
-            
firePropertyChange(PROP_PROJECT_NAME,null,this.projectNameTextField.getText());
+            firePropertyChange(PROP_PROJECT_NAME, null, 
this.projectNameTextField.getText());
         }
         if (this.projectClassNameTextField.getDocument() == e.getDocument()) {
-            
firePropertyChange(PROP_CLASS_NAME,null,this.projectClassNameTextField.getText());
+            firePropertyChange(PROP_CLASS_NAME, null, 
this.projectClassNameTextField.getText());
         }
-}
-    
-    /** Handles changes in the Project name and project directory, */
+    }
+
+    /**
+     * Handles changes in the Project name and project directory,
+     */
     private void updateTexts(DocumentEvent e) {
-        
+
         Document doc = e.getDocument();
 
-        if (doc == projectClassNameTextField.getDocument() && 
projectClassNameTextField.getText().length()>0) {
-            if 
(!projectNameTextField.getText().equals(projectClassNameTextField.getText()))
+        if (doc == projectClassNameTextField.getDocument() && 
projectClassNameTextField.getText().length() > 0) {
+            if 
(!projectNameTextField.getText().equals(projectClassNameTextField.getText())) {
                 classNameModified = true;
+            }
         }
-        
+
         if (doc == projectNameTextField.getDocument() || doc == 
projectLocationTextField.getDocument()) {
             // Change in the project name
-            
+
             String projectName = projectNameTextField.getText();
             String projectFolder = projectLocationTextField.getText();
-            
-            if (!classNameModified)
+
+            if (!classNameModified) {
                 projectClassNameTextField.setText(projectName);
-            
+            }
+
             //if (projectFolder.trim().length() == 0 || 
projectFolder.equals(oldName)) {
             createdFolderTextField.setText(projectFolder + File.separatorChar 
+ projectName);
             //}
-            
+
         }
         panel.fireChangeEvent(); // Notify that the panel changed
     }
-    
+
 }

Modified: 
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/UNOClientAppWizardIterator.java
URL: 
http://svn.apache.org/viewvc/openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/UNOClientAppWizardIterator.java?rev=1677323&r1=1677322&r2=1677323&view=diff
==============================================================================
--- 
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/UNOClientAppWizardIterator.java
 (original)
+++ 
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/UNOClientAppWizardIterator.java
 Sat May  2 15:24:43 2015
@@ -1,24 +1,23 @@
-/**************************************************************
- * 
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- * 
- *************************************************************/
-
+/**
+ * ************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations 
under
+ * the License.
+ *
+ ************************************************************
+ */
 package org.openoffice.extensions.projecttemplates.unoclientapplication;
 
 import java.awt.Component;
@@ -47,41 +46,44 @@ import org.openide.util.NbBundle;
 import org.openoffice.extensions.config.ConfigurationValidator;
 import org.openoffice.extensions.util.Substitutions;
 
-
 public class UNOClientAppWizardIterator implements 
WizardDescriptor.InstantiatingIterator {
-    
+
     private int index;
     private WizardDescriptor.Panel[] panels;
     private WizardDescriptor wiz;
-    
-    public UNOClientAppWizardIterator() {}
-    
+
+    // to track status of valid office and sdk through ConfigurationValidator
+    // to disable next button in AddOnWizardPanel1Project if setting was 
skipped
+    private boolean sdkOk = false;
+
+    public UNOClientAppWizardIterator() {
+    }
+
     public static UNOClientAppWizardIterator createIterator() {
         return new UNOClientAppWizardIterator();
     }
-    
+
     private WizardDescriptor.Panel[] createPanels() {
-        return new WizardDescriptor.Panel[] {
-            new UNOClientAppWizardPanel(),
-        };
+        return new WizardDescriptor.Panel[]{
+            new UNOClientAppWizardPanel(this),};
     }
-    
+
     private String[] createSteps() {
-        return new String[] {
+        return new String[]{
             NbBundle.getMessage(UNOClientAppWizardIterator.class, 
"LBL_CreateProjectStep")
         };
     }
-    
+
     public Set<FileObject> instantiate() throws IOException {
         Set<FileObject> resultSet = new LinkedHashSet<FileObject>();
         File dirF = FileUtil.normalizeFile((File) 
wiz.getProperty("ProjectDir")); // NOI18N
         dirF.mkdirs();
-        
+
         FileObject template = Templates.getTemplate(wiz);
         FileObject dir = FileUtil.toFileObject(dirF);
-      
+
         unZipFile(wiz, template.getName(), template.getInputStream(), dir);
-               
+
         // Always open top dir as a project:
         resultSet.add(dir);
         // Look for nested projects to open as well:
@@ -92,17 +94,23 @@ public class UNOClientAppWizardIterator
                 resultSet.add(subfolder);
             }
         }
-        
+
         File parent = dirF.getParentFile();
         if (parent != null && parent.exists()) {
             ProjectChooser.setProjectsFolder(parent);
         }
-        
+
         return resultSet;
     }
-    
+
     public void initialize(WizardDescriptor wiz) {
-        ConfigurationValidator.validateSettings();
+        // ConfigurationValidator.validateSettings();
+        if (ConfigurationValidator.validateSettings()) {
+            setSdkOk(true);
+        } else {
+            setSdkOk(false);
+        }
+        // continue so user may cancel
         this.wiz = wiz;
         index = 0;
         panels = createPanels();
@@ -125,55 +133,66 @@ public class UNOClientAppWizardIterator
             }
         }
     }
-    
+
     public void uninitialize(WizardDescriptor wiz) {
-        this.wiz.putProperty("projdir",null); // NOI18N
-        this.wiz.putProperty("name",null); // NOI18N
+        this.wiz.putProperty("projdir", null); // NOI18N
+        this.wiz.putProperty("name", null); // NOI18N
         this.wiz = null;
         panels = null;
     }
-    
+
     public String name() {
         return MessageFormat.format("{0} of {1}",
-                new Object[] {new Integer(index + 1), new 
Integer(panels.length)}); // NOI18N
+                new Object[]{new Integer(index + 1), new 
Integer(panels.length)}); // NOI18N
     }
-    
+
     public boolean hasNext() {
         return index < panels.length - 1;
     }
-    
+
     public boolean hasPrevious() {
-        return index > 0;
+            return index > 0;
     }
-    
+
     public void nextPanel() {
         if (!hasNext()) {
             throw new NoSuchElementException();
         }
         index++;
     }
-    
+
     public void previousPanel() {
         if (!hasPrevious()) {
             throw new NoSuchElementException();
         }
         index--;
     }
-    
+
     public WizardDescriptor.Panel current() {
         return panels[index];
     }
     
     // If nothing unusual changes in the middle of the wizard, simply:
-    public final void addChangeListener(ChangeListener l) {}
-    public final void removeChangeListener(ChangeListener l) {}
-    
+    public final void addChangeListener(ChangeListener l) {
+    }
+
+    public final void removeChangeListener(ChangeListener l) {
+    }
+
+    public boolean isSdkOk() {
+        return this.sdkOk;
+    }
+
+    public void setSdkOk(boolean sdkOk) {
+        this.sdkOk = sdkOk;
+    }
+
     private static void unZipFile(WizardDescriptor wiz, String templateName, 
InputStream source, FileObject projectRoot) throws IOException {
-        String[] pathProperties = { "UnoPackagePath", "UnoClientMain"}; // 
NOI18N
-        String[] contentProperties = { "UnoPackage", "UnoClientMain", 
"UnoClientProjectName", "TimeStamp", 
-                                       "UserName", "BuildUnoVersion", 
"OfficePath", "SdkPath", "OfficeLibrary"}; // NOI18N
-        
-        Substitutions substitutions = new Substitutions (wiz, new 
BufferedInputStream (
+        String[] pathProperties = {"UnoPackagePath", "UnoClientMain"}; // 
NOI18N
+        String[] contentProperties = {"UnoPackage", "UnoClientMain", 
"UnoClientProjectName", "TimeStamp",
+            "UserName", "BuildUnoVersion", "OfficePath", "SdkPath", 
"OfficeLibrary"}; // NOI18N
+
+        Substitutions substitutions = new Substitutions(wiz, new 
BufferedInputStream(
                 
UNOClientAppWizardIterator.class.getResourceAsStream(templateName + 
".properties")), pathProperties, contentProperties); // NOI18N
         try {
             ZipInputStream str = new ZipInputStream(source);
@@ -203,5 +222,5 @@ public class UNOClientAppWizardIterator
             source.close();
         }
     }
-    
+
 }

Modified: 
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/UNOClientAppWizardPanel.java
URL: 
http://svn.apache.org/viewvc/openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/UNOClientAppWizardPanel.java?rev=1677323&r1=1677322&r2=1677323&view=diff
==============================================================================
--- 
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/UNOClientAppWizardPanel.java
 (original)
+++ 
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/unoclientapplication/UNOClientAppWizardPanel.java
 Sat May  2 15:24:43 2015
@@ -40,9 +40,11 @@ public class UNOClientAppWizardPanel imp
     
     private WizardDescriptor wizardDescriptor;
     private UNOClientAppPanelVisual component;
+    private UNOClientAppWizardIterator wizIt;
     
     /** Creates a new instance of templateWizardPanel */
-    public UNOClientAppWizardPanel() {
+    public UNOClientAppWizardPanel(UNOClientAppWizardIterator it) {
+        wizIt = it;
     }
     
     public Component getComponent() {
@@ -103,4 +105,8 @@ public class UNOClientAppWizardPanel imp
         component.validate(wizardDescriptor);
     }
     
+    public UNOClientAppWizardIterator getUNOClientAppWizardIterator() {
+        return wizIt;
+    }
+    
 }


Reply via email to