diff options
author | pmoogk | 2007-08-15 15:36:17 +0000 |
---|---|---|
committer | pmoogk | 2007-08-15 15:36:17 +0000 |
commit | 2ec9666d12ba3e23716ed094b2724b8b0dc782c8 (patch) | |
tree | 84be9f4ebb4fe5d3ebd8f6efae2103fa7caed753 /bundles/org.eclipse.wst.command.env | |
parent | b03808c618710be437f025a167f8aee76a7e420e (diff) | |
download | webtools.webservices-2ec9666d12ba3e23716ed094b2724b8b0dc782c8.tar.gz webtools.webservices-2ec9666d12ba3e23716ed094b2724b8b0dc782c8.tar.xz webtools.webservices-2ec9666d12ba3e23716ed094b2724b8b0dc782c8.zip |
[188999] Some commands not getting the resource context from the environment.
Diffstat (limited to 'bundles/org.eclipse.wst.command.env')
-rw-r--r-- | bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/FileResourceUtils.java | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/FileResourceUtils.java b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/FileResourceUtils.java index a0b8709a1..74d1b9d75 100644 --- a/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/FileResourceUtils.java +++ b/bundles/org.eclipse.wst.command.env/src/org/eclipse/wst/command/internal/env/common/FileResourceUtils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2006 IBM Corporation and others. + * Copyright (c) 2001, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,6 +10,7 @@ * yyyymmdd bug Email and other contact information * -------- -------- ----------------------------------------------------------- * 20060112 121199 jesper@selskabet.org - Jesper Møller + * 20070813 188999 pmoogk@ca.ibm.com - Peter Moogk *******************************************************************************/ package org.eclipse.wst.command.internal.env.common; @@ -503,9 +504,25 @@ public final class FileResourceUtils IContainer parent = makeFolderPath(resourceContext, absolutePath.removeLastSegments(1), progressMonitor, statusHandler ); String folderName = absolutePath.lastSegment(); + checkParent( parent, absolutePath ); return makeFolder(resourceContext, parent,folderName, progressMonitor , statusHandler ); } } + + private static void checkParent( IContainer parent, IPath absolutePath ) throws CoreException + { + if( parent == null ) + { + // The parent is null, so there must have been problems creating it. We will throw + // a CoreException warning for this problem. + IPath parentPath = absolutePath.removeLastSegments(1); + String folderPath = absolutePath.lastSegment(); + throw new CoreException( StatusUtils.warningStatus( + NLS.bind(EnvironmentMessages.MSG_ERROR_FOLDER_CREATION_DISABLED, + new Object[]{ parentPath.toString(), folderPath} ) ) ); + } + } + // // Creates a folder under a container. // The container must already exist. @@ -705,6 +722,8 @@ public final class FileResourceUtils IContainer parent = makeFolderPathAtLocation(resourceContext, absolutePath.removeLastSegments(1), progressMonitor, statusHandler); String fileName = absolutePath.lastSegment(); + checkParent( parent, absolutePath ); + return makeFile(resourceContext, parent, fileName, inputStream, progressMonitor, statusHandler); } |