alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 * GazoogleDuplicateSupport.java
 *
 * Created on Friday, 13 July 2001 1430 MDT
 */

package com.example.nb.tutorial.chapter_5;

import java.io.IOException;

import org.openide.TopManager;
import org.openide.filesystems.FileObject;

/**
 *
 * @author  adams
 * @version 1.0
 */
public class GazoogleDuplicateSupport implements DuplicateCookie 
{
    protected GazoogleDataObject dataObject;

    /** Creates new GazoogleOpenSupport */
    public GazoogleDuplicateSupport(GazoogleDataObject dObj) 
    {
        dataObject = dObj;
    }

    /** Invokes the duplicate action  */
    public void duplicate() 
    {
        // get the FileObject from the GazoogleDataObject reference
        // we saved in the constructor; this is the FileObject that
        // was associated with the DuplicateCookie (this support class)
        // when it was instantiated:
        FileObject fo = dataObject.getPrimaryFile();
        String dupeFileName = fo.getName() + "Copy";
        try
        {
            // conveniently, NetBeans OpenAPI has a copy() method:
            fo.copy(fo.getParent(), dupeFileName, fo.getExt());
        }
        catch (IOException ioe)
        {
            TopManager.getDefault().notifyException(ioe);
        }
    }
}

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.