KickJava   Java API By Example, From Geeks To Geeks.

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


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  * AttributeOnElementNewType.java
22  *
23  * Created on July 18, 2006, 4:04 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.schema.abe.ABEBaseDropPanel;
34 import org.netbeans.modules.xml.schema.abe.InstanceUIContext;
35 import org.netbeans.modules.xml.schema.abe.StartTagPanel;
36 import org.openide.util.NbBundle;
37 import org.openide.util.datatransfer.NewType;
38
39 /**
40  *
41  * @author girix
42  */

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