diff options
-rw-r--r-- | odk/examples/DevelopersGuide/UCB/ResourceCreator.java | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/odk/examples/DevelopersGuide/UCB/ResourceCreator.java b/odk/examples/DevelopersGuide/UCB/ResourceCreator.java index 0b12b31d..c28bc47e 100644 --- a/odk/examples/DevelopersGuide/UCB/ResourceCreator.java +++ b/odk/examples/DevelopersGuide/UCB/ResourceCreator.java @@ -8,7 +8,7 @@ * * The Contents of this file are made available subject to the terms of * the BSD license. - * + * * Copyright (c) 2003 by Sun Microsystems, Inc. * All rights reserved. * @@ -35,7 +35,7 @@ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * *************************************************************************/ import com.sun.star.beans.PropertyValue; @@ -43,7 +43,6 @@ import com.sun.star.uno.UnoRuntime; import com.sun.star.ucb.ContentInfo; import com.sun.star.ucb.InsertCommandArgument; import com.sun.star.ucb.XContent; -import com.sun.star.ucb.XContentCreator; import com.sun.star.io.XInputStream; @@ -154,18 +153,17 @@ public class ResourceCreator { boolean result = false; if ( stream != null && name != null && !name.equals( "" )) { - // Obtain content creator interface. - XContentCreator creator = ( XContentCreator )UnoRuntime.queryInterface( - XContentCreator.class, m_content ); - - // Note: The data for info may have been obtained using - // XContentCreator::queryCreatableContentsInfo(). + // Note: The data for info may have been obtained from + // property CreatableContentsInfo. ContentInfo info = new ContentInfo(); info.Type = "application/vnd.sun.staroffice.fsys-file"; info.Attributes = 0; - // Create new, empty content. - XContent newContent = creator.createNewContent( info ); + // Create new, empty content (execute command "createNewContent"). + XContent newContent = ( XContent )UnoRuntime.queryInterface( + XContent.class, + m_helper.executeCommand( m_content, "createNewContent", info ) ); + if ( newContent != null ) { ///////////////////////////////////////////////////////////////////// @@ -181,7 +179,7 @@ public class ResourceCreator { props[ 0 ] = prop; // Execute command "setPropertyValues". - m_helper.executeCommand( newContent, "setPropertyValues",props ); + m_helper.executeCommand( newContent, "setPropertyValues", props ); ///////////////////////////////////////////////////////////////////// // Write the new file to disk... @@ -241,7 +239,7 @@ public class ResourceCreator { String workdir = ""; for ( int i = 0; i < args.length; i++ ) { - if ( args[i].startsWith( "-url=" )) { + if ( args[i].startsWith( "-url=" )) { m_contenturl = args[i].substring( 5 ); } else if ( args[i].startsWith( "-name=" )) { m_name = args[i].substring( 6 ); |