Index: src/org/openide/WizardDescriptor.java =================================================================== RCS file: /cvs/openide/src/org/openide/WizardDescriptor.java,v retrieving revision 1.77 diff -c -r1.77 WizardDescriptor.java *** src/org/openide/WizardDescriptor.java 29 Jan 2003 01:42:35 -0000 1.77 --- src/org/openide/WizardDescriptor.java 14 Feb 2003 10:28:46 -0000 *************** *** 413,418 **** --- 413,427 ---- } }); } + if ("WizardPanel_errorMessage".equals(name)) { + if (value == null) { + value = " "; + } + WizardPanel wp = wizardPanel; + if (wp != null) { + wp.setErrorMessage((String)value); + } + } } /** Getter for stored property. *************** *** 1302,1307 **** --- 1311,1318 ---- private JLabel label; /** Selected index of content */ private int selectedIndex; + + private javax.swing.JLabel m_lblMessage; /** Creates new WizardPanel. * @param contentDisplayed whether content will be displayed in the left pane *************** *** 1352,1367 **** --- 1363,1391 ---- labelPanel.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 11)); rightPanel.setBorder(BorderFactory.createEmptyBorder(0, 12, 11, 11)); panelName.setLabelFor(labelPanel); + + JPanel errorPanel = new JPanel(new BorderLayout()); + errorPanel.setBorder(BorderFactory.createEmptyBorder(0, 12, 12, 11)); + m_lblMessage = new javax.swing.JLabel(" "); //NOI18N + m_lblMessage.setForeground(Color.red); + errorPanel.add(m_lblMessage, BorderLayout.CENTER); JPanel fullRightPanel = new JPanel(new BorderLayout()); fullRightPanel.add(labelPanel, BorderLayout.NORTH); fullRightPanel.add(rightPanel, BorderLayout.CENTER); + fullRightPanel.add(errorPanel, BorderLayout.SOUTH); + JSeparator sep = new JSeparator(); sep.setForeground(Color.darkGray); add(fullRightPanel, BorderLayout.CENTER); add(sep, BorderLayout.SOUTH); } + + public void setErrorMessage(String msg) { + m_lblMessage.setText(msg); + } + /** Creates content panel. * @param contentNumbered boolean whether content will be numbered * @param leftDimension Dimension dimension of content pane Index: src/org/openide/loaders/Bundle.properties =================================================================== RCS file: /cvs/openide/src/org/openide/loaders/Bundle.properties,v retrieving revision 1.94 diff -c -r1.94 Bundle.properties *** src/org/openide/loaders/Bundle.properties 13 Jan 2003 17:56:38 -0000 1.94 --- src/org/openide/loaders/Bundle.properties 14 Feb 2003 10:28:46 -0000 *************** *** 197,199 **** --- 197,205 ---- MSG_renameError=This object cannot be renamed from {0} to {1}. MSG_NotValidName=Cannot give {0} an empty name. ERR_NoFilesystem=No enabled filesystem. Make sure that you have at least one filesystem that is not read-only and is not hidden. + + # TemplateWizardPanel2 + MSG_fs_or_folder_does_not_exist=Target filesystem or folder does not exist + MSG_fs_is_readonly=Target filesystem is readonly + # {0} - name of the existing file + MSG_file_already_exist=File {0} already exist \ No newline at end of file Index: src/org/openide/loaders/TemplateWizard2.java =================================================================== RCS file: /cvs/openide/src/org/openide/loaders/TemplateWizard2.java,v retrieving revision 1.51 diff -c -r1.51 TemplateWizard2.java *** src/org/openide/loaders/TemplateWizard2.java 29 Jan 2003 01:42:48 -0000 1.51 --- src/org/openide/loaders/TemplateWizard2.java 14 Feb 2003 10:28:46 -0000 *************** *** 32,37 **** --- 32,38 ---- import org.openide.explorer.propertysheet.PropertyPanel; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileSystem; + import org.openide.util.NbBundle; import org.openide.util.Utilities; /** Dialog that can be used in create from template. *************** *** 220,242 **** /** Helper implementation of WizardDescription.Panel for TemplateWizard.Panel2. * Test whether the panel is finished and it is safe to proceed to the next one. * If the panel is valid, the "Next" (or "Finish") button will be enabled. ! * @return true if the user has entered satisfactory information */ ! boolean implIsValid () { ! // test whether the selected folder on selected filesystem already exists FileSystem fs = (FileSystem)fileSystemRef.get (); if (locationFolder == null || fs == null) ! return false; // target filesystem should be writable if (((FileSystem)fileSystemRef.get ()).isReadOnly ()) ! return false; // test whether the selected name already exists StringBuffer sb = new StringBuffer (); sb.append (locationFolder.getPrimaryFile ().getPath ()); ! sb.append (java.io.File.separatorChar); sb.append (newObjectName.getText ()); if ("" != extension) { // NOI18N sb.append ('.'); --- 221,243 ---- /** Helper implementation of WizardDescription.Panel for TemplateWizard.Panel2. * Test whether the panel is finished and it is safe to proceed to the next one. * If the panel is valid, the "Next" (or "Finish") button will be enabled. ! * @return null if the user has entered satisfactory information ! * or localized string describing the error. */ ! String implIsValid () { // test whether the selected folder on selected filesystem already exists FileSystem fs = (FileSystem)fileSystemRef.get (); if (locationFolder == null || fs == null) ! return NbBundle.getMessage(TemplateWizard2.class, "MSG_fs_or_folder_does_not_exist"); // target filesystem should be writable if (((FileSystem)fileSystemRef.get ()).isReadOnly ()) ! return NbBundle.getMessage(TemplateWizard2.class, "MSG_fs_is_readonly"); // test whether the selected name already exists StringBuffer sb = new StringBuffer (); sb.append (locationFolder.getPrimaryFile ().getPath ()); ! sb.append ("/"); sb.append (newObjectName.getText ()); if ("" != extension) { // NOI18N sb.append ('.'); *************** *** 244,254 **** } FileObject f = fs.findResource (sb.toString ()); if (f != null) { ! return false; } ! // all ok ! return true; } /** Gives notification that an attribute or set of attributes changed. --- 245,255 ---- } FileObject f = fs.findResource (sb.toString ()); if (f != null) { ! return NbBundle.getMessage(TemplateWizard2.class, "MSG_file_already_exist", sb.toString()); } ! // all ok ! return null; } /** Gives notification that an attribute or set of attributes changed. Index: src/org/openide/loaders/TemplateWizardPanel2.java =================================================================== RCS file: /cvs/openide/src/org/openide/loaders/TemplateWizardPanel2.java,v retrieving revision 1.2 diff -c -r1.2 TemplateWizardPanel2.java *** src/org/openide/loaders/TemplateWizardPanel2.java 3 Dec 2002 14:11:55 -0000 1.2 --- src/org/openide/loaders/TemplateWizardPanel2.java 14 Feb 2003 10:28:47 -0000 *************** *** 26,31 **** --- 26,33 ---- /** listener to changes in the wizard */ private ChangeListener listener; + private WizardDescriptor settings; + private TemplateWizard2 getPanelUI () { if (templateWizard2UI == null) { templateWizard2UI = new TemplateWizard2 (); *************** *** 82,88 **** public boolean isValid() { if (templateWizard2UI == null) return false; ! return getPanelUI ().implIsValid (); } /** Provides the wizard panel with the current data--either --- 84,93 ---- public boolean isValid() { if (templateWizard2UI == null) return false; ! ! String err = getPanelUI().implIsValid(); ! settings.putProperty("WizardPanel_errorMessage", err); //NOI18N ! return err == null; } /** Provides the wizard panel with the current data--either *************** *** 97,102 **** --- 102,108 ---- * */ public void readSettings(Object settings) { + this.settings = (WizardDescriptor)settings; getPanelUI ().implReadSettings (settings); } *************** *** 116,121 **** --- 122,128 ---- */ public void storeSettings(Object settings) { getPanelUI ().implStoreSettings (settings); + this.settings = null; } }