01: /*
02: * The contents of this file are subject to the terms of the Common Development
03: * and Distribution License (the License). You may not use this file except in
04: * compliance with the License.
05: *
06: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
07: * or http://www.netbeans.org/cddl.txt.
08: *
09: * When distributing Covered Code, include this CDDL Header Notice in each file
10: * and include the License file at http://www.netbeans.org/cddl.txt.
11: * If applicable, add the following below the CDDL Header, with the fields
12: * enclosed by brackets [] replaced by your own identifying information:
13: * "Portions Copyrighted [year] [name of copyright owner]"
14: *
15: * The Original Software is NetBeans. The Initial Developer of the Original
16: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17: * Microsystems, Inc. All Rights Reserved.
18: */
19:
20: package org.netbeans.modules.bpel.mapper.model;
21:
22: import java.awt.event.KeyEvent;
23: import javax.swing.ActionMap;
24: import javax.swing.InputMap;
25: import javax.swing.JComponent;
26: import javax.swing.KeyStroke;
27: import org.netbeans.modules.bpel.mapper.tree.BpelMapperContext;
28: import org.netbeans.modules.bpel.mapper.tree.actions.DeleteGraphSelectionAction;
29: import org.netbeans.modules.soa.mappercore.Mapper;
30: import org.netbeans.modules.soa.mappercore.model.MapperModel;
31:
32: /**
33: *
34: * @author nk160297
35: */
36: public class BpelMapperFactory {
37:
38: public static Mapper createMapper(MapperModel model) {
39: Mapper newMapper = new Mapper(model);
40: newMapper.setContext(new BpelMapperContext());
41: //
42: // Specify the action processing
43: InputMap inputMap1 = newMapper
44: .getInputMap(JComponent.WHEN_FOCUSED);
45: InputMap inputMap2 = newMapper
46: .getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
47: ActionMap actionMap = newMapper.getActionMap();
48: //
49: String deleteActionKey = "delete-something"; // NOI18N
50: inputMap1.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),
51: deleteActionKey); // NOI18N
52: inputMap2.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0),
53: deleteActionKey); // NOI18N
54: actionMap.put(deleteActionKey, new DeleteGraphSelectionAction(
55: newMapper)); // NOI18N
56: //
57: // Tune up Vertex Item editors
58: // newMapper.getCanvas().setVertexItemEditor(valueType, editor);
59: //
60: return newMapper;
61: }
62:
63: }
|