KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > schema > abe > action > ElementOnElementNewType


1
2 /*
3  * The contents of this file are subject to the terms of the Common Development
4  * and Distribution License (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
8  * or http://www.netbeans.org/cddl.txt.
9  *
10  * When distributing Covered Code, include this CDDL Header Notice in each file
11  * and include the License file at http://www.netbeans.org/cddl.txt.
12  * If applicable, add the following below the CDDL Header, with the fields
13  * enclosed by brackets [] replaced by your own identifying information:
14  * "Portions Copyrighted [year] [name of copyright owner]"
15  *
16  * The Original Software is NetBeans. The Initial Developer of the Original
17  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
18  * Microsystems, Inc. All Rights Reserved.
19  */

20 /*
21  * ElementNewType.java
22  *
23  * Created on July 18, 2006, 3:07 PM
24  *
25  * To change this template, choose Tools | Template Manager
26  * and open the template in the editor.
27  */

28
29 package org.netbeans.modules.xml.schema.abe.action;
30
31 import java.io.IOException JavaDoc;
32 import java.util.List JavaDoc;
33 import org.netbeans.modules.xml.axi.AXIContainer;
34 import org.netbeans.modules.xml.schema.abe.ABEBaseDropPanel;
35 import org.netbeans.modules.xml.schema.abe.InstanceUIContext;
36 import org.netbeans.modules.xml.schema.abe.StartTagPanel;
37 import org.openide.util.NbBundle;
38 import org.openide.util.datatransfer.NewType;
39
40 /**
41  *
42  * @author girix
43  */

44 public class ElementOnElementNewType extends NewType {
45     
46     InstanceUIContext context;
47     /** Creates a new instance of ElementNewType */
48     public ElementOnElementNewType(InstanceUIContext context) {
49         super();
50         this.context = context;
51     }
52     
53     public void create() throws IOException JavaDoc {
54         List JavaDoc<ABEBaseDropPanel> list = context.getComponentSelectionManager().
55                 getSelectedComponentList();
56         if(list.size() <= 0)
57             return;
58         StartTagPanel startTagPanel = (StartTagPanel) list.get(0);
59         context.setUserInducedEventMode(true, startTagPanel);
60         startTagPanel.addElement();
61         context.setUserInducedEventMode(false);
62     }
63     
64     public String JavaDoc getName() {
65         return NbBundle.getMessage(ElementOnElementNewType.class, "LBL_NEW_ELEMENT_ACTION");
66     }
67     
68     
69 }
70
Popular Tags