cvs diff -w Bundle.properties WebContextObject.java (in directory P:\release35\nb_all\web\core\src\org\netbeans\modules\web\context\) Index: Bundle.properties =================================================================== RCS file: /cvs/web/core/src/org/netbeans/modules/web/context/Bundle.properties,v retrieving revision 1.9.26.3 diff -u -w -r1.9.26.3 Bundle.properties --- Bundle.properties 28 Mar 2003 13:00:09 -0000 1.9.26.3 +++ Bundle.properties 1 Apr 2003 14:06:37 -0000 @@ -80,3 +80,7 @@ CTL_NewWebModuleMountWizardPanel.newFolderBrowseB.mnemonic=R ERR_cannotDeleteWebInf=WEB-INF object cannot be deleted. + +#ClearCase hack +MSG_PutIntoClearCase=The IDE is about to create new directories. Should these be put under ClearCase? + Index: WebContextObject.java =================================================================== RCS file: /cvs/web/core/src/org/netbeans/modules/web/context/WebContextObject.java,v retrieving revision 1.27.2.4 diff -u -w -r1.27.2.4 WebContextObject.java --- WebContextObject.java 28 Mar 2003 13:00:11 -0000 1.27.2.4 +++ WebContextObject.java 1 Apr 2003 14:06:38 -0000 @@ -470,13 +470,20 @@ // Vector warnings = new Vector(); + boolean shouldPutIn = false; + boolean alreadyAsked = false; + // create WEB-INF FileObject webInf = fs.find(FOLDER_WEB_INF, null, null); if (webInf == null) { + if (!alreadyAsked) { + alreadyAsked = true; + shouldPutIn = shouldPutIntoClearCase(fs); + } // this should not happen, as if WEB-INF does not exist, then we shouldn't be called // but anyway try { - webInf = FileUtil.createFolder(fs.getRoot(), FOLDER_WEB_INF); + webInf = createFolderClearCaseHack(fs.getRoot(), FOLDER_WEB_INF, shouldPutIn); } catch (IOException fx1) { warnings.addElement(NbBundle.getMessage (WebContextObject.class, "MSG_WARNING_CannotCreateWEBINF")); // NOI18N } @@ -484,8 +491,12 @@ // create WEB-INF/classes FileObject classesDir = fs.find(FOLDER_WEB_INF + "." + FOLDER_CLASSES, null, null);//NOI18N if (classesDir == null) { + if (!alreadyAsked) { + alreadyAsked = true; + shouldPutIn = shouldPutIntoClearCase(fs); + } try { - classesDir = FileUtil.createFolder(webInf, FOLDER_CLASSES); + classesDir = createFolderClearCaseHack(webInf, FOLDER_CLASSES, shouldPutIn); } catch (IOException fx1) { warnings.addElement(NbBundle.getMessage (WebContextObject.class, "MSG_WARNING_CannotCreateWEBINFclasses")); // NOI18N } @@ -493,8 +504,12 @@ // create WEB-INF/lib FileObject libDir = fs.find(FOLDER_WEB_INF + "." + FOLDER_LIB, null, null);//NOI18N if (libDir == null) { + if (!alreadyAsked) { + alreadyAsked = true; + shouldPutIn = shouldPutIntoClearCase(fs); + } try { - libDir = FileUtil.createFolder(webInf, FOLDER_LIB); + libDir = createFolderClearCaseHack(webInf, FOLDER_LIB, shouldPutIn); } catch (IOException fx1) { warnings.addElement(NbBundle.getMessage (WebContextObject.class, "MSG_WARNING_CannotCreateWEBINFlib")); // NOI18N } @@ -533,6 +548,53 @@ NotifyDescriptor.INFORMATION_MESSAGE)); } + } + + /** + * Creates a folder on given filesystem. The name of the new folder can be + * specified as a multi-component pathname whose components are separated + * by File.separatorChar or "/" (forward slash). + * Has the following ClearCase-related behavior: if the folder is on clearcase FS, + * and the putToVCS argument is set to true, then puts the file into VCS + * + * @param folder where the new folder will be placed in + * @param name name of the new folder + * @return the new folder + * @exception IOException if the creation fails + */ + public static FileObject createFolderClearCaseHack(FileObject folder, String name, boolean putToVCS) throws IOException { + FileObject result = null; + if (putToVCS) { + String folderName = folder.getPath(); + if ((folderName.length() > 0) && !folderName.endsWith("/")) { + folderName = folderName + "/"; + } + folderName = folderName + name; + folder.getFileSystem().getRoot().setAttribute("VCS_MKDIR_ACTION", folderName); + result = folder.getFileObject(name); + } + if (result == null) { + result = FileUtil.createFolder(folder, name); + } + return result; + } + + /** Hack - we may be putting some directories into clearcase. + */ + public static boolean shouldPutIntoClearCase(FileSystem fs) { + FileObject root = fs.getRoot(); + if ("ClearCase".equals(root.getAttribute("FS_DISPLAY_NAME"))) { + // ask the user + NotifyDescriptor nd = new NotifyDescriptor.Confirmation( + NbBundle.getMessage(WebContextObject.class, "MSG_PutIntoClearCase"), NotifyDescriptor.OK_CANCEL_OPTION); + DialogDisplayer.getDefault().notify(nd); + + if (nd.getValue() != NotifyDescriptor.OK_OPTION) return false; + return true; + } + else { + return false; + } } // Necessary because of bug - filesystems are added incorrectly if one is *****CVS exited normally with code 1*****