1 /*******************************************************************************
\r
2 * Copyright (c) 2006 Sybase, Inc. and others.
\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
10 * Sybase, Inc. - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.eclipse.jst.pagedesigner.elementedit;
\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
27 * IElementEdit support additional edit support to an element.
\r
29 * This interface should not be extended by clients. Extend AbstractElementEdit
\r
32 * <p><b>Provisional API - subject to change</b></p>
\r
37 public interface IElementEdit
\r
40 * override default edit policies on part
\r
43 public void createEditPolicies(ElementEditPart part);
\r
46 * The element (or its decendent) changed.
\r
51 * @return handle model changes on part.
\r
53 public boolean handleModelChange(Element ele, ElementEditPart part,
\r
57 * Add special menu items for the particular element to the context menu.
\r
59 * @param contextMenu
\r
62 public void fillContextMenu(IMenuManager contextMenu, Element ele);
\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
72 * @param contextMenu
\r
74 * the elementeditpart corresponding to this ElementEdit
\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
80 * @return true if added actions.
\r
82 public boolean fillContainerContextMenu(IMenuManager contextMenu,
\r
83 ElementEditPart elePart, NodeEditPart nodePart,
\r
84 ISelection innerSelection);
\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
92 * @return true if ele has resize support
\r
94 public boolean isResizable(Element ele);
\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
100 * @param viewer is the viewer where the new strategy will optionally
\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
108 public IDropLocationStrategy getDropRequestorLocationStrategy(TagIdentifier tag, EditPartViewer viewer);
\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
118 public IDropCustomizer getDropCustomizer(TagIdentifier tagId);
\r
121 * @param dropSourceData
\r
122 * @return the drop customizer for the drop source data or null if none.
\r
124 public IDropCustomizer getDropCustomizer(final IDropSourceData dropSourceData);
\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
131 public ITagCreator getTagCreator(TagIdentifier tagId);
\r