Author: cmarcum
Date: Sat May 2 15:19:57 2015
New Revision: 1677322
URL: http://svn.apache.org/r1677322
Log:
#i126246#
added sdkOk property and getter/setter in ComponentWizardIterator to keep track
of valid office and sdk locations.
added getter for ComponentWizardIterator in ComponentWizardPanel1Project to be
used by ComponentPanelVisual1Project valid method.
added check of sdkOk in ComponentPanelVisual1Project 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/component/Bundle.properties
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/Bundle_it_IT.properties
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/ComponentPanelVisual1Project.java
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/ComponentWizardIterator.java
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/ComponentWizardPanel1Project.java
Modified:
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/Bundle.properties
URL:
http://svn.apache.org/viewvc/openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/Bundle.properties?rev=1677322&r1=1677321&r2=1677322&view=diff
==============================================================================
---
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/Bundle.properties
(original)
+++
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/Bundle.properties
Sat May 2 15:19:57 2015
@@ -15,6 +15,7 @@ LBL_Error_ProjectFolderNotValid=Project
LBL_Error_CreateProjectFolderNot=Project Folder cannot be created.
LBL_Error_ProjectFolderNotEmpty=Project Folder already exists and is not empty.
LBL_Error_MandatoryService=There has to be at least one implemented service
with at least one valid interface.
+LBL_ErrorMessageOfficeSdk=Cancel and set OpenOffice and SDK locations in
<br/>Tools > Options > Miscellaneous > AOO API Plugin
# tooltips
TF_ProjectName_Tooltip=The name of the newly created project (also used as
project folder name)
Modified:
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/Bundle_it_IT.properties
URL:
http://svn.apache.org/viewvc/openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/Bundle_it_IT.properties?rev=1677322&r1=1677321&r2=1677322&view=diff
==============================================================================
---
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/Bundle_it_IT.properties
(original)
+++
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/Bundle_it_IT.properties
Sat May 2 15:19:57 2015
@@ -16,6 +16,7 @@ Templates/Project/org-openoffice-extensi
#LBL_Error_CreateProjectFolderNot=Project Folder cannot be created.
#LBL_Error_ProjectFolderNotEmpty=Project Folder already exists and is not
empty.
#LBL_Error_MandatoryService=There has to be at least one implemented service
with at least one valid interface.
+#LBL_ErrorMessageOfficeSdk=Cancel and set OpenOffice and SDK locations in
<br/>Tools > Options > Miscellaneous > AOO API Plugin
LBL_ProjectName=Nome &Progetto:
LBL_ServiceName=Nome &Classe:
LBL_Package=&Package:
@@ -25,11 +26,12 @@ LBL_CreatedFiles=File(s) generati:
LBL_ButtonBrowse=S&foglia...
CB_Backward_Compatibility=Crea componente r&etrocompatibile
LBL_FileChooser_Title=Seleziona percorso del progetto
-LBL_Error_ProjectNameNotValid=Il nome del progetto non \u00E8 un nome di
cartella valido.
-LBL_Error_ProjectFolderNotValid=La cartella di progetto non \u00E8 un percorso
valido.
-LBL_Error_CreateProjectFolderNot=La cartella di progetto non pu\u00F2 essere
creata.
-LBL_Error_ProjectFolderNotEmpty=La cartella di progetto \u00E8 gi\u00E0
esistente e non \u00E8 vuota.
+LBL_Error_ProjectNameNotValid=Il nome del progetto non \u00e8 un nome di
cartella valido.
+LBL_Error_ProjectFolderNotValid=La cartella di progetto non \u00e8 un percorso
valido.
+LBL_Error_CreateProjectFolderNot=La cartella di progetto non pu\u00f2 essere
creata.
+LBL_Error_ProjectFolderNotEmpty=La cartella di progetto \u00e8 gi\u00e0
esistente e non \u00e8 vuota.
LBL_Error_MandatoryService=Deve essere implementato almeno un servizio con
almeno un'interfaccia valida.
+LBL_ErrorMessageOfficeSdk=Annullare e impostare i percorsi di OpenOffice e del
suo SDK in <br/>Tools > Options > Miscellaneous > AOO API Plugin
# tooltips
#TF_ProjectName_Tooltip=The name of the newly created project (also used as
project folder name)
@@ -41,9 +43,9 @@ LBL_Error_MandatoryService=Deve essere i
TF_ProjectName_Tooltip=Nome del nuovo progetto creato (utilizzato anche come
nome della cartella di progetto)
TF_ClassName_Tooltip=Nome della classe di implementazione principale
TF_PackageName_Tooltip=Nome del package Java
-TF_ProjectLocation_Tooltip=Percorso della directory in cui il progetto
verr\u00E0 creato
+TF_ProjectLocation_Tooltip=Percorso della directory in cui il progetto
verr\u00e0 creato
TF_ProjectFolder_Tooltip=Cartella di destinazione finale del nuovo progetto
-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
#NewTypeBrowserDialog
#LBL_TypeBrowser_Title=Select a new Data type
Modified:
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/ComponentPanelVisual1Project.java
URL:
http://svn.apache.org/viewvc/openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/ComponentPanelVisual1Project.java?rev=1677322&r1=1677321&r2=1677322&view=diff
==============================================================================
---
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/ComponentPanelVisual1Project.java
(original)
+++
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/ComponentPanelVisual1Project.java
Sat May 2 15:19:57 2015
@@ -248,6 +248,12 @@ public class ComponentPanelVisual1Projec
boolean valid(WizardDescriptor wizardDescriptor) {
+ if (!panel.getComponentWizardIterator().isSdkOk()) {
+ String message =
NbBundle.getMessage(ComponentWizardIterator.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(ComponentWizardIterator.class,
"LBL_Error_ProjectNameNotValid");
wizardDescriptor.putProperty("WizardPanel_errorMessage", message);
// NOI18N
Modified:
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/ComponentWizardIterator.java
URL:
http://svn.apache.org/viewvc/openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/ComponentWizardIterator.java?rev=1677322&r1=1677321&r2=1677322&view=diff
==============================================================================
---
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/ComponentWizardIterator.java
(original)
+++
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/ComponentWizardIterator.java
Sat May 2 15:19:57 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.component;
import java.awt.Component;
@@ -42,43 +41,46 @@ import org.openoffice.extensions.project
import org.openoffice.extensions.util.ProjectCreator;
public class ComponentWizardIterator implements
WizardDescriptor.InstantiatingIterator {
-
+
private int index;
private WizardDescriptor.Panel[] panels;
private WizardDescriptor wiz;
-
- public ComponentWizardIterator() {}
-
+
+ // 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 ComponentWizardIterator() {
+ }
+
public static ComponentWizardIterator createIterator() {
return new ComponentWizardIterator();
}
-
+
private WizardDescriptor.Panel[] createPanels() {
- return new WizardDescriptor.Panel[] {
- new ComponentWizardPanel1Project(),
- new ComponentWizardPanel2IdlFiles(),
- };
+ return new WizardDescriptor.Panel[]{
+ new ComponentWizardPanel1Project(this),
+ new ComponentWizardPanel2IdlFiles(),};
}
-
+
private String[] createSteps() {
- return new String[] {
+ return new String[]{
NbBundle.getMessage(ComponentWizardIterator.class,
"LBL_CreateProjectStep"),
- NbBundle.getMessage(ComponentWizardIterator.class, "LBL_IdlFiles"),
- };
+ NbBundle.getMessage(ComponentWizardIterator.class,
"LBL_IdlFiles"),};
}
-
+
public Set<FileObject> instantiate() throws IOException {
Set<FileObject> resultSet = new LinkedHashSet<FileObject>();
File dirF = FileUtil.normalizeFile((File) wiz.getProperty("projdir"));
// NOI18N
dirF.mkdirs();
-
+
FileObject dir = FileUtil.toFileObject(dirF);
ProjectCreator creator = new ProjectCreator(dirF, wiz);
creator.createComponent();
// create initial description.xml
DescriptionXmlHandler dXml = new DescriptionXmlHandler(dir);
dXml.writeDescriptionXml();
-
+
// Always open top dir as a project:
resultSet.add(dir);
// Look for nested projects to open as well:
@@ -94,12 +96,18 @@ public class ComponentWizardIterator imp
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();
@@ -122,47 +130,58 @@ public class ComponentWizardIterator imp
}
}
}
-
+
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;
}
-
+
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;
+ }
+
}
Modified:
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/ComponentWizardPanel1Project.java
URL:
http://svn.apache.org/viewvc/openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/ComponentWizardPanel1Project.java?rev=1677322&r1=1677321&r2=1677322&view=diff
==============================================================================
---
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/ComponentWizardPanel1Project.java
(original)
+++
openoffice/devtools/netbeansintegration/trunk/src/org/openoffice/extensions/projecttemplates/component/ComponentWizardPanel1Project.java
Sat May 2 15:19:57 2015
@@ -40,9 +40,11 @@ public class ComponentWizardPanel1Projec
private WizardDescriptor wizardDescriptor;
private ComponentPanelVisual1Project component;
+ private ComponentWizardIterator wizIt;
/** Creates a new instance of templateWizardPanel */
- public ComponentWizardPanel1Project() {
+ public ComponentWizardPanel1Project(ComponentWizardIterator it) {
+ wizIt = it;
}
public Component getComponent() {
@@ -103,4 +105,8 @@ public class ComponentWizardPanel1Projec
component.validate(wizardDescriptor);
}
+ public ComponentWizardIterator getComponentWizardIterator() {
+ return wizIt;
+ }
+
}