Lines 13-18
Link Here
|
13 |
|
13 |
|
14 |
package org.netbeans.modules.j2ee.deployment.devmodules.spi; |
14 |
package org.netbeans.modules.j2ee.deployment.devmodules.spi; |
15 |
|
15 |
|
|
|
16 |
import java.io.File; |
17 |
import java.io.IOException; |
16 |
import org.netbeans.modules.j2ee.deployment.config.*; |
18 |
import org.netbeans.modules.j2ee.deployment.config.*; |
17 |
import org.netbeans.modules.j2ee.deployment.devmodules.api.*; |
19 |
import org.netbeans.modules.j2ee.deployment.devmodules.api.*; |
18 |
import org.netbeans.modules.j2ee.deployment.impl.Server; |
20 |
import org.netbeans.modules.j2ee.deployment.impl.Server; |
Lines 21-27
Link Here
|
21 |
import org.netbeans.modules.j2ee.deployment.impl.ServerString; |
23 |
import org.netbeans.modules.j2ee.deployment.impl.ServerString; |
22 |
import org.netbeans.modules.j2ee.deployment.plugins.api.ServerDebugInfo; |
24 |
import org.netbeans.modules.j2ee.deployment.plugins.api.ServerDebugInfo; |
23 |
import org.netbeans.modules.j2ee.deployment.common.api.SourceFileMap; |
25 |
import org.netbeans.modules.j2ee.deployment.common.api.SourceFileMap; |
|
|
26 |
import org.openide.ErrorManager; |
24 |
import org.openide.filesystems.FileObject; |
27 |
import org.openide.filesystems.FileObject; |
|
|
28 |
import org.openide.filesystems.FileSystem; |
29 |
import org.openide.filesystems.FileStateInvalidException; |
30 |
import org.openide.filesystems.FileUtil; |
25 |
import org.openide.util.WeakListeners; |
31 |
import org.openide.util.WeakListeners; |
26 |
|
32 |
|
27 |
/** This object must be implemented by J2EE module support and an instance |
33 |
/** This object must be implemented by J2EE module support and an instance |
Lines 192-208
Link Here
|
192 |
if (oldServer != null && !oldServer.equals (newServer)) { |
198 |
if (oldServer != null && !oldServer.equals (newServer)) { |
193 |
|
199 |
|
194 |
if (J2eeModule.WAR.equals(getJ2eeModule().getModuleType())) { |
200 |
if (J2eeModule.WAR.equals(getJ2eeModule().getModuleType())) { |
195 |
String oldCtxPath = getConfigSupportImpl().getWebContextRoot(); |
201 |
FileSystem fs = getMasterFileSystem(); |
196 |
confSupp = null; |
202 |
try { |
197 |
String ctx = getConfigSupportImpl().getWebContextRoot (); |
203 |
fs.runAtomicAction(new FileSystem.AtomicAction() { |
198 |
if (ctx == null || ctx.equals ("")) { |
204 |
public void run() { |
199 |
getConfigSupportImpl().setWebContextRoot(oldCtxPath); |
205 |
String oldCtxPath = getConfigSupportImpl().getWebContextRoot(); |
|
|
206 |
confSupp = null; |
207 |
String ctx = getConfigSupportImpl().getWebContextRoot (); |
208 |
if (ctx == null || ctx.equals ("")) { |
209 |
getConfigSupportImpl().setWebContextRoot(oldCtxPath); |
210 |
} |
211 |
} |
212 |
}); |
213 |
} |
214 |
catch (IOException e) { |
215 |
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); |
200 |
} |
216 |
} |
201 |
} else { |
217 |
} else { |
202 |
J2eeModuleProvider.this.confSupp = null; |
218 |
J2eeModuleProvider.this.confSupp = null; |
203 |
ServerString newServerString = new ServerString(newServer); |
219 |
ServerString newServerString = new ServerString(newServer); |
204 |
ConfigSupportImpl.createInitialConfiguration(this, newServerString); |
220 |
ConfigSupportImpl.createInitialConfiguration(this, newServerString); |
205 |
} |
221 |
} |
|
|
222 |
} |
223 |
} |
224 |
|
225 |
// HACK - there should be an API method to retrieve MasterFS |
226 |
private FileSystem getMasterFileSystem() { |
227 |
try { |
228 |
File nbUser = new File(System.getProperty("netbeans.user")); |
229 |
FileObject userFO = FileUtil.toFileObject(nbUser); |
230 |
return userFO.getFileSystem(); |
231 |
} |
232 |
catch (FileStateInvalidException e) { |
233 |
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); |
234 |
return null; |
206 |
} |
235 |
} |
207 |
} |
236 |
} |
208 |
|
237 |
|