Initialize
[sdk/ide/product.git] / org.eclipse.jst.pagedesigner / src / org / eclipse / jst / pagedesigner / elementedit / IElementEdit.java
1 /*******************************************************************************\r
2  * Copyright (c) 2006 Sybase, Inc. and others.\r
3  *\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     Sybase, Inc. - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.eclipse.jst.pagedesigner.elementedit;\r
13 \r
14 import org.eclipse.gef.EditPartViewer;\r
15 import org.eclipse.jface.action.IMenuManager;\r
16 import org.eclipse.jface.viewers.ISelection;\r
17 import org.eclipse.jst.jsf.common.dom.TagIdentifier;\r
18 import org.eclipse.jst.pagedesigner.editors.palette.IDropSourceData;\r
19 import org.eclipse.jst.pagedesigner.itemcreation.ITagCreator;\r
20 import org.eclipse.jst.pagedesigner.itemcreation.customizer.IDropCustomizer;\r
21 import org.eclipse.jst.pagedesigner.parts.ElementEditPart;\r
22 import org.eclipse.jst.pagedesigner.parts.NodeEditPart;\r
23 import org.eclipse.jst.pagedesigner.viewer.IDropLocationStrategy;\r
24 import org.w3c.dom.Element;\r
25 \r
26 /**\r
27  * IElementEdit support additional edit support to an element.\r
28  *\r
29  * This interface should not be extended by clients.  Extend AbstractElementEdit\r
30  * instead.\r
31  *\r
32  * <p><b>Provisional API - subject to change</b></p>\r
33  *\r
34  * @author mengbo\r
35  * @version 1.5\r
36  */\r
37 public interface IElementEdit\r
38 {\r
39         /**\r
40          * override default edit policies on part\r
41          * @param part\r
42          */\r
43         public void createEditPolicies(ElementEditPart part);\r
44 \r
45         /**\r
46          * The element (or its decendent) changed.\r
47          *\r
48          * @param ele\r
49          * @param part\r
50          * @param recursive\r
51          * @return handle model changes on part.\r
52          */\r
53         public boolean handleModelChange(Element ele, ElementEditPart part,\r
54                         boolean recursive);\r
55 \r
56         /**\r
57          * Add special menu items for the particular element to the context menu.\r
58          *\r
59          * @param contextMenu\r
60          * @param ele\r
61          */\r
62         public void fillContextMenu(IMenuManager contextMenu, Element ele);\r
63 \r
64         /**\r
65          * This method is called when current selection is inside "ele". And this\r
66          * method should fill in menu items relating to the "ele" context and the\r
67          * current "innerSelection". For example, this "ele" could be a table,\r
68          * "innerSelection" could be something inside a cell. Then could fill in\r
69          * actions relating to the table and the cell, such as "add row before",\r
70          * "delete current column", etc.\r
71          *\r
72          * @param contextMenu\r
73          * @param elePart\r
74          *            the elementeditpart corresponding to this ElementEdit\r
75          * @param nodePart\r
76          *            the smallest part covers the current selection. nodePart will\r
77          *            always be a decedent of the elePart.\r
78          * @param innerSelection\r
79          *            the selection\r
80          * @return true if added actions.\r
81          */\r
82         public boolean fillContainerContextMenu(IMenuManager contextMenu,\r
83                         ElementEditPart elePart, NodeEditPart nodePart,\r
84                         ISelection innerSelection);\r
85 \r
86         /**\r
87          * whether the corresponding element support resize. If it does, then the\r
88          * corresponding policy installed through <code>createEditPolicies</code>\r
89          * should handle resize.\r
90          * @param ele\r
91          *\r
92          * @return true if ele has resize support\r
93          */\r
94         public boolean isResizable(Element ele);\r
95 \r
96     /**\r
97      * @param tag the element to return a drop location strategy for.\r
98      * This is the requesting element (being dropped), not the drop target\r
99      *\r
100      * @param viewer is the viewer where the new strategy will optionally\r
101      * add feedback\r
102      *\r
103      * @return the strategy to be used to use to find a drop location when\r
104      * the corresponding element is being dropped (the source part).  May\r
105      * be null signalling that the caller should use its default strategy.\r
106      *\r
107      */\r
108      public IDropLocationStrategy getDropRequestorLocationStrategy(TagIdentifier tag, EditPartViewer viewer);\r
109 \r
110     /**\r
111      * @param tagId\r
112      * @return the drop customizer for this edit's element.  May return null.\r
113      * Returning null and returning a IDropCustomizer whose runCustomizer always returns\r
114      * OK and getDropCustomizationData always returns null will be considered\r
115      * equivalent by the framework.\r
116      * @deprecated use getDropCustomizer(IDropSourceData) instead\r
117      */\r
118     public IDropCustomizer getDropCustomizer(TagIdentifier tagId);\r
119 \r
120     /**\r
121      * @param dropSourceData\r
122      * @return the drop customizer for the drop source data or null if none.\r
123      */\r
124     public IDropCustomizer getDropCustomizer(final IDropSourceData dropSourceData);\r
125 \r
126     /**\r
127      * @param tagId\r
128      * @return a tag creator for the indicated tag or null to indicate that the\r
129      * system should use it's default tag creator\r
130      */\r
131     public ITagCreator getTagCreator(TagIdentifier tagId);\r
132 }\r