Author: svasilyev
Date: 2007-07-31 10:04:13 -0400 (Tue, 31 Jul 2007)
New Revision: 2759
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeDomBuilder.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplate.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/templates/vpe-templates-jsf.xml
Log:
merge with HEAD revision
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2007-07-31
14:03:46 UTC (rev 2758)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2007-07-31
14:04:13 UTC (rev 2759)
@@ -10,9 +10,9 @@
******************************************************************************/
package org.jboss.tools.vpe.editor;
+import java.util.Iterator;
import java.util.List;
import java.util.Properties;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -22,6 +22,9 @@
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.bindings.Binding;
+import org.eclipse.jface.bindings.keys.KeySequence;
+import org.eclipse.jface.bindings.keys.KeyStroke;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.viewers.ISelection;
@@ -45,12 +48,16 @@
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.internal.keys.WorkbenchKeyboard;
+import org.eclipse.ui.keys.IBindingService;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
import org.eclipse.wst.sse.core.internal.model.ModelLifecycleEvent;
import org.eclipse.wst.sse.core.internal.provisional.IModelLifecycleListener;
@@ -74,7 +81,6 @@
import org.jboss.tools.common.model.event.XModelTreeListener;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.common.model.ui.dnd.ModelTransfer;
-import org.jboss.tools.common.model.util.ModelFeatureFactory;
import org.jboss.tools.common.model.ui.editor.IModelObjectEditorInput;
import org.jboss.tools.common.model.ui.editors.dnd.DropCommandFactory;
import org.jboss.tools.common.model.ui.editors.dnd.DropData;
@@ -125,6 +131,7 @@
import org.jboss.tools.vpe.messages.VpeUIMessages;
import org.jboss.tools.vpe.mozilla.browser.MozillaBrowser;
import org.jboss.tools.vpe.mozilla.browser.util.DOMTreeDumper;
+import org.jboss.tools.vpe.mozilla.internal.swt.xpl.XPCOM;
import org.jboss.tools.vpe.mozilla.internal.swt.xpl.nsIDOMEvent;
import org.jboss.tools.vpe.mozilla.internal.swt.xpl.nsIDOMKeyEvent;
import org.jboss.tools.vpe.mozilla.internal.swt.xpl.nsIDOMMouseEvent;
@@ -146,6 +153,9 @@
import org.w3c.dom.Text;
public class VpeController implements INodeAdapter, IModelLifecycleListener,
INodeSelectionListener, ITextSelectionListener, SelectionListener, EditorDomEventListener,
VpeTemplateListener, XModelTreeListener, ResourceReferenceListListener,
ISelectionChangedListener, IVisualController {
+ //id of command which is maximazed/minimazed editor
+ private static final String
MAXIMAZE_PART_ID="org.eclipse.ui.window.maximizePart";
+
StructuredTextEditor sourceEditor;
private MozillaEditor visualEditor;
MozillaBrowser browser;
@@ -785,7 +795,7 @@
selectionBuilder.setClickContentAreaSelection();
}
}
- switcher.stopActiveEditor();
+ switcher.stopActiveEditor();
}
public void mouseDblClick(nsIDOMMouseEvent mouseEvent) {
@@ -845,12 +855,17 @@
if (VpeDebug.printVisualKeyEvent) {
System.out.println("<<< keyPress type: " + keyEvent.getType() +
" Ctrl: " + keyEvent.isCtrlKey() + " Shift: " +
keyEvent.isShiftKey() + " CharCode: " + keyEvent.getCharCode() + "
KeyCode: " + keyEvent.getKeyCode()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
//$NON-NLS-4$ //$NON-NLS-5$
}
+
if (!switcher.startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
+ switcher.stopActiveEditor();
return;
}
+
visualEditor.hideResizer();
+ //TODO with this behaviour isn't works 'CTRL+M'
switcher.stopActiveEditor();
+
try {
if (visualKeyHandler.keyPressHandler(keyEvent)) {
switcher.startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL);
@@ -858,11 +873,70 @@
sourceSelectionChanged(true);
visualSelectionController.setCaretEnabled(true);
switcher.stopActiveEditor();
+ } else {
+ //adding calls of core event handlers, for example 'CTR+H' or
'CTRL+M' event handler dialog
+ Event keyboardEvent = new Event ();
+ //widget where event occur
+ keyboardEvent.widget=browser;
+ int rc=0;
+ boolean[] aAltKey = new boolean[1];
+ boolean[] aCtrlKey = new boolean[1];
+ boolean[] aShiftKey = new boolean[1];
+ boolean[] aMetaKey = new boolean[1];
+
+ rc = keyEvent.GetAltKey (aAltKey);
+ if (rc != XPCOM.NS_OK) MozillaBrowser.error (rc);
+ rc = keyEvent.GetCtrlKey (aCtrlKey);
+ if (rc != XPCOM.NS_OK) MozillaBrowser.error (rc);
+ rc = keyEvent.GetShiftKey (aShiftKey);
+ if (rc != XPCOM.NS_OK) MozillaBrowser.error (rc);
+ rc = keyEvent.GetMetaKey (aMetaKey);
+ if (rc != XPCOM.NS_OK) MozillaBrowser.error (rc);
+
+ keyboardEvent.stateMask = (aAltKey[0] ? SWT.ALT : 0) | (aCtrlKey[0] ? SWT.CTRL : 0) |
(aShiftKey[0] ? SWT.SHIFT : 0) | (aMetaKey[0] ? SWT.MOD1 : 0);
+ keyboardEvent.x=0;
+ keyboardEvent.y=0;
+ keyboardEvent.type=SWT.KeyDown;
+
+ if(keyEvent.getKeyCode()==0) {
+
+ keyboardEvent.keyCode=keyEvent.getCharCode();
+ } else{
+
+ keyboardEvent.keyCode=keyEvent.getKeyCode();
+ }
+ //for maximaze/minimaze command(CTRL+M), we shouldn't call event listeners
+ List possibleKeyStrokes =
WorkbenchKeyboard.generatePossibleKeyStrokes(keyboardEvent);
+ IWorkbench iWorkbench = VpePlugin.getDefault().getWorkbench();
+ if(iWorkbench.hasService(IBindingService.class)){
+ IBindingService iBindingService = (IBindingService)
iWorkbench.getService(IBindingService.class);
+
+ KeySequence sequenceBeforeKeyStroke = KeySequence.getInstance();
+ for (Iterator iterator = possibleKeyStrokes.iterator(); iterator
+ .hasNext();){
+ KeySequence sequenceAfterKeyStroke = KeySequence.getInstance(
+ sequenceBeforeKeyStroke, (KeyStroke) iterator.next());
+ if(iBindingService.isPerfectMatch(sequenceAfterKeyStroke)){
+ final Binding binding = iBindingService.getPerfectMatch(sequenceAfterKeyStroke);
+
+ if((binding!=null)
+ && (binding.getParameterizedCommand()!=null)
+ && (binding.getParameterizedCommand().getCommand()!=null)
+ && (binding.getParameterizedCommand().getCommand().getId()!=null)
+ &&binding.getParameterizedCommand().getCommand().getId().equals(VpeController.MAXIMAZE_PART_ID)){
+ keyboardEvent.type = SWT.NONE;
+ }
+ }
+ }
+ }
+ browser.notifyListeners(keyboardEvent.type, keyboardEvent);
+
}
} catch (Exception e) {
VpePlugin.getPluginLog().logError(e);
visualRefresh();
}
+
}
public void elementResized(Element element, int resizerConstrains, int top, int left,
int width, int height) {
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeDomBuilder.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeDomBuilder.java 2007-07-31
14:03:46 UTC (rev 2758)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeDomBuilder.java 2007-07-31
14:04:13 UTC (rev 2759)
@@ -38,7 +38,11 @@
return templateManager;
}
- public void registerNodes(VpeNodeMapping nodeMapping) {
+ public void registerNodes(VpeNodeMapping nodeMapping) {
+ if (sorceAdapter == null) {
+ return;
+ }
+
domMapping.mapNodes(nodeMapping);
Node sourceNode = nodeMapping.getSourceNode();
if (((INodeNotifier) sourceNode).getExistingAdapter(sorceAdapter) == null) {
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2007-07-31
14:03:46 UTC (rev 2758)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2007-07-31
14:04:13 UTC (rev 2759)
@@ -28,7 +28,6 @@
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput;
@@ -49,10 +48,10 @@
import org.eclipse.ui.texteditor.ITextEditorExtension;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.jboss.tools.jst.jsp.editor.IVisualEditor;
-
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.mozilla.EditorLoadWindowListener;
import org.jboss.tools.vpe.editor.mozilla.MozillaEditor;
+import org.jboss.tools.vpe.editor.mozilla.MozillaPreview;
import org.jboss.tools.vpe.editor.xpl.SashForm;
public class VpeEditorPart extends EditorPart implements ITextEditor,
ITextEditorExtension, IReusableEditor, IVisualEditor {
@@ -66,8 +65,15 @@
private EditorPart multiPageEditor;
private static final QualifiedName SPLITTER_POSITION_KEY1 = new
QualifiedName("", "splitter_position1");
private static final QualifiedName SPLITTER_POSITION_KEY2 = new
QualifiedName("", "splitter_position2");
+ private static final QualifiedName SPLITTER_POSITION_KEY3 = new
QualifiedName("", "splitter_position3");
private int controlCount = 0;
+ /** default web-browser */
+ private MozillaPreview previewWebBrowser = null;
+
+ /** preview content */
+ private Composite previewContent = null;
+
public StructuredTextEditor getSourceEditor(){
return sourceEditor;
}
@@ -150,10 +156,10 @@
if(sourceEditor!=null)sourceEditor.removeRulerContextMenuListener(listener);
}
public void setStatusField(IStatusField field, String category) {
- if(visualMode == VISUAL_MODE){
- if(field != null){
- field.setImage(null);
- field.setText(null);
+ if(visualMode == VISUAL_MODE) {
+ if(field != null) {
+ field.setImage(null);
+ field.setText(null);
}
}else
if(sourceEditor!=null)sourceEditor.setStatusField(field, category);
@@ -215,7 +221,7 @@
}
protected int[] loadSplitterPosition() {
- int[] sizes = new int[2];
+ int[] sizes = new int[3];
try {
IEditorInput input = getEditorInput();
if(!(input instanceof IFileEditorInput)) return null;
@@ -228,6 +234,10 @@
if (s != null) {
sizes[1] = Integer.parseInt(s);
}else return null;
+ s = file.getPersistentProperty(SPLITTER_POSITION_KEY3);
+ if (s != null) {
+ sizes[2] = Integer.parseInt(s);
+ }else return null;
} catch (Exception e) {
VpePlugin.getPluginLog().logError(e);
return null;
@@ -244,6 +254,8 @@
file.setPersistentProperty(SPLITTER_POSITION_KEY1, s);
s = String.valueOf(weights[1]);
file.setPersistentProperty(SPLITTER_POSITION_KEY2, s);
+ s = String.valueOf(weights[2]);
+ file.setPersistentProperty(SPLITTER_POSITION_KEY3, s);
} catch (Exception e) {
VpePlugin.getPluginLog().logError(e);
}
@@ -256,15 +268,41 @@
case VISUALSOURCE_MODE:
if(sourceContent!= null)sourceContent.setVisible(true);
if(visualContent!= null)visualContent.setVisible(true);
+ if(previewContent != null) {
+ previewContent.setVisible(false);
+ }
break;
+
case VISUAL_MODE:
if(sourceContent!= null)sourceContent.setVisible(false);
if(visualContent!= null)visualContent.setVisible(true);
+ if(previewContent != null) {
+ previewContent.setVisible(false);
+ }
break;
+
case SOURCE_MODE:
if(sourceContent!= null)sourceContent.setVisible(true);
if(visualContent!= null)visualContent.setVisible(false);
+ if(previewContent != null) {
+ previewContent.setVisible(false);
+ }
break;
+
+ case PREVIEW_MODE:
+ if(sourceContent!= null) {
+ sourceContent.setVisible(false);
+ }
+
+ if(visualContent!= null) {
+ visualContent.setVisible(false);
+ }
+
+ if(previewContent != null) {
+ previewWebBrowser.rebuildDom();
+ previewContent.setVisible(true);
+ }
+ break;
}
container.layout();
if(visualMode == SOURCE_MODE && type != SOURCE_MODE) {
@@ -290,6 +328,12 @@
sourceContent.setLayout(new FillLayout());
visualContent = new Composite(container, SWT.NONE);
visualContent.setLayout(new FillLayout());
+
+
+ // Create a preview content
+ previewContent = new Composite(container, SWT.NONE);
+ previewContent.setLayout(new FillLayout());
+
if(sourceEditor == null)sourceEditor = new StructuredTextEditor() {
public void safelySanityCheckState(IEditorInput input) {
super.safelySanityCheckState(input);
@@ -318,6 +362,13 @@
VpePlugin.reportProblem(e);
}
+ previewWebBrowser = new MozillaPreview(this, sourceEditor);
+ try {
+ previewWebBrowser.init(getEditorSite(), getEditorInput());
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ }
+
try {
sourceEditor.addPropertyListener(
new IPropertyListener() {
@@ -347,6 +398,18 @@
});
visualEditor.createPartControl(visualContent);
}
+
+
+ if(previewWebBrowser!=null) {
+ previewWebBrowser.setEditorLoadWindowListener(new EditorLoadWindowListener() {
+ public void load() {
+ previewWebBrowser.setEditorLoadWindowListener(null);
+ previewWebBrowser.buildDom();
+ }
+ });
+ previewWebBrowser.createPartControl(previewContent);
+ }
+
activeEditor = sourceEditor;
sourceContent.addListener(SWT.Activate, new Listener() {
@@ -371,6 +434,19 @@
}
});
+
+ previewContent.addListener(SWT.Activate, new Listener() {
+ public void handleEvent(Event event) {
+ if (event.type == SWT.Activate) {
+ if (previewWebBrowser!=null && activeEditor != previewWebBrowser) {
+ activeEditor = previewWebBrowser;
+ setFocus();
+ }
+ }
+ }
+ });
+
+
IWorkbenchWindow window = getSite().getWorkbenchWindow();
window.getPartService().addPartListener(activationListener);
window.getShell().addShellListener(activationListener);
@@ -414,6 +490,11 @@
visualEditor.dispose();
visualEditor = null;
}
+
+ if (previewContent != null) {
+ previewContent.dispose();
+ previewContent = null;
+ }
}
public Object getAdapter(Class adapter) {
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java 2007-07-31
14:03:46 UTC (rev 2758)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java 2007-07-31
14:04:13 UTC (rev 2759)
@@ -11,6 +11,7 @@
package org.jboss.tools.vpe.editor.bundle;
import java.io.File;
+import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
@@ -19,6 +20,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.MissingResourceException;
import java.util.Properties;
import java.util.ResourceBundle;
@@ -31,17 +33,16 @@
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
-
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.event.XModelTreeEvent;
import org.jboss.tools.common.model.event.XModelTreeListener;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.common.model.util.ELParser;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.vpe.VpePlugin;
+import org.jboss.tools.jst.jsp.preferences.VpePreference;
import org.jboss.tools.jst.web.project.WebProject;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
+import org.jboss.tools.vpe.VpePlugin;
public class BundleMap {
// private static final String BEGIN_BUNDLE = "#{";
@@ -201,8 +202,8 @@
try {
file = new File(javaSources[i]).getCanonicalFile();
urls[i] = file.toURL();
- } catch (Exception e) {
- VpePlugin.reportProblem(e);
+ } catch (IOException ioe) {
+ VpePlugin.reportProblem(ioe);
return null;
}
}
@@ -211,9 +212,10 @@
return bundle;
}
- } catch(Exception e) {
- VpePlugin.getPluginLog().logError(e);
+ } catch (MissingResourceException ex) {
+ // Ignore this exception
}
+
return null;
}
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2007-07-31
14:03:46 UTC (rev 2758)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2007-07-31
14:04:13 UTC (rev 2759)
@@ -39,6 +39,9 @@
protected boolean caseSensitive;
protected boolean children;
protected boolean modify;
+
+ protected boolean haveVisualPreview;
+
private VpeResizer resizer;
private VpeDnd dragger;
private TextFormatingData textFormatingData;
@@ -145,6 +148,16 @@
this.caseSensitive = caseSensitive;
children =
"yes".equals(templateElement.getAttribute(VpeTemplateManager.ATTR_TEMPLATE_CHILDREN));
modify =
"yes".equals(templateElement.getAttribute(VpeTemplateManager.ATTR_TEMPLATE_MODIFY));
+
+ String strHaveVisualPreview =
templateElement.getAttribute(VpeTemplateManager.ATTR_TEMPLATE_HAVE_VISUAL_PREVIEW);
+
+ if (strHaveVisualPreview != null && strHaveVisualPreview.length() != 0 ) {
+ haveVisualPreview = "yes".equals(strHaveVisualPreview);
+ } else {
+ haveVisualPreview = true;
+ }
+
+
init(templateElement);
}
@@ -892,4 +905,8 @@
public boolean containsText() {
return true;
}
+
+ public boolean isHaveVisualPreview() {
+ return haveVisualPreview;
+ }
}
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplate.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplate.java 2007-07-31
14:03:46 UTC (rev 2758)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplate.java 2007-07-31
14:04:13 UTC (rev 2759)
@@ -7,7 +7,7 @@
*
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.vpe.editor.template;
import org.jboss.tools.jst.jsp.editor.ITextFormatter;
@@ -25,241 +25,407 @@
/**
* Initiates template after its creating
- * @param templateElement <code>Element</code> with a name
"vpe:template" from the template file
- * @param caseSensitive The case sensitive of an element of a source file
+ *
+ * @param templateElement
+ * <code>Element</code> with a name "vpe:template" from
the
+ * template file
+ * @param caseSensitive
+ * The case sensitive of an element of a source file
*/
void init(Element templateElement, boolean caseSensitive);
/**
- * Creates a node of the visual tree on the node of the source tree.
- * This visual node should not have the parent node
- * This visual node can have child nodes.
- * @param pageContext Contains the information on edited page.
- * @param sourceNode The current node of the source tree.
- * @param visualDocument The document of the visual tree.
- * @return The information on the created node of the visual tree.
+ * Creates a node of the visual tree on the node of the source tree. This
+ * visual node should not have the parent node This visual node can have
+ * child nodes.
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceNode
+ * The current node of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @return The information on the created node of the visual tree.
*/
- VpeCreationData create(VpePageContext pageContext, Node sourceNode, Document
visualDocument);
-
+ VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ Document visualDocument);
+
/**
- * Is invoked after construction of all child nodes of the current visual node.
- * @param pageContext Contains the information on edited page.
- * @param sourceNode The current node of the source tree.
- * @param visualDocument The document of the visual tree.
- * @param data Object <code>VpeCreationData</code>, built by a method
<code>create</code>
+ * Is invoked after construction of all child nodes of the current visual
+ * node.
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceNode
+ * The current node of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @param data
+ * Object <code>VpeCreationData</code>, built by a method
+ * <code>create</code>
*/
- void validate(VpePageContext pageContext, Node sourceNode, Document visualDocument,
VpeCreationData data);
-
+ void validate(VpePageContext pageContext, Node sourceNode,
+ Document visualDocument, VpeCreationData data);
+
/**
* Processes keyboard input (without the pressed key Ctrl)
- * @param pageContext Contains the information on edited page.
- * @param sourceDocument The document of the source tree.
- * @param sourceNode The current node of the source tree.
- * @param visualNode The current node of the visual tree.
- * @param data The arbitrary data, built by a method <code>create</code>
- * @param charCode Code of the pressed key
- * @param selection The current selection
- * @param formatter Interface for formatting the source text
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceDocument
+ * The document of the source tree.
+ * @param sourceNode
+ * The current node of the source tree.
+ * @param visualNode
+ * The current node of the visual tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
+ * @param charCode
+ * Code of the pressed key
+ * @param selection
+ * The current selection
+ * @param formatter
+ * Interface for formatting the source text
* @return <code>true</code> if the key is processed
*/
- boolean nonctrlKeyPressHandler(VpePageContext pageContext, Document sourceDocument, Node
sourceNode, Node visualNode, Object data, int charCode, VpeSourceSelection selection,
ITextFormatter formatter);
-
+ boolean nonctrlKeyPressHandler(VpePageContext pageContext,
+ Document sourceDocument, Node sourceNode, Node visualNode,
+ Object data, int charCode, VpeSourceSelection selection,
+ ITextFormatter formatter);
+
/**
- * Sets value of attribute of the current visual element.
- * Is invoked at change of attribute of an source element.
- * @param pageContext Contains the information on edited page.
- * @param sourceElement The current element of the source tree.
- * @param visualDocument The document of the visual tree.
- * @param visualNode The current node of the visual tree.
- * @param data The arbitrary data, built by a method <code>create</code>
- * @param name Attribute name.
- * @param value Attribute value.
+ * Sets value of attribute of the current visual element. Is invoked at
+ * change of attribute of an source element.
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceElement
+ * The current element of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @param visualNode
+ * The current node of the visual tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
+ * @param name
+ * Attribute name.
+ * @param value
+ * Attribute value.
*/
- void setAttribute(VpePageContext pageContext, Element sourceElement, Document
visualDocument, Node visualNode, Object data, String name, String value);
-
+ void setAttribute(VpePageContext pageContext, Element sourceElement,
+ Document visualDocument, Node visualNode, Object data, String name,
+ String value);
+
/**
* Informs on remove of attribute of the current source element.
- * @param pageContext Contains the information on edited page.
- * @param sourceElement The current element of the source tree.
- * @param visualDocument The document of the visual tree.
- * @param visualNode The current node of the visual tree.
- * @param data The arbitrary data, built by a method <code>create</code>
- * @param name Attribute name.
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceElement
+ * The current element of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @param visualNode
+ * The current node of the visual tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
+ * @param name
+ * Attribute name.
*/
- void removeAttribute(VpePageContext pageContext, Element sourceElement, Document
visualDocument, Node visualNode, Object data, String name);
-
+ void removeAttribute(VpePageContext pageContext, Element sourceElement,
+ Document visualDocument, Node visualNode, Object data, String name);
+
/**
* Is invoked before removal of the visiblis node from the tree
- * @param pageContext Contains the information on edited page.
- * @param sourceNode The current node of the source tree.
- * @param visualNode The current node of the visual tree.
- * @param data The arbitrary data, built by a method <code>create</code>
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceNode
+ * The current node of the source tree.
+ * @param visualNode
+ * The current node of the visual tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
*/
- void beforeRemove(VpePageContext pageContext, Node sourceNode, Node visualNode, Object
data);
-
+ void beforeRemove(VpePageContext pageContext, Node sourceNode,
+ Node visualNode, Object data);
+
/**
- * At a modification of the node of an source tree, the method update
- * for this node is invoked. Template can indicate other node for update
- * @param pageContext Contains the information on edited page.
- * @param sourceNode The current node of the source tree.
- * @param visualNode The current node of the visual tree.
- * @param data The arbitrary data, built by a method <code>create</code>
- * @return For this node of an source tree the method update is invoked.
- * If null, that is invoked update for current source node
+ * At a modification of the node of an source tree, the method update for
+ * this node is invoked. Template can indicate other node for update
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceNode
+ * The current node of the source tree.
+ * @param visualNode
+ * The current node of the visual tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
+ * @return For this node of an source tree the method update is invoked. If
+ * null, that is invoked update for current source node
*/
- Node getNodeForUptate(VpePageContext pageContext, Node sourceNode, Node visualNode,
Object data);
-
+ Node getNodeForUptate(VpePageContext pageContext, Node sourceNode,
+ Node visualNode, Object data);
+
/**
* Is invoked at resize of an element visual tree
- * @param pageContext Contains the information on edited page.
- * @param sourceElement The current element of the source tree.
- * @param visualDocument The document of the visual tree.
- * @param visualElement The current element of the visual tree.
- * @param data The arbitrary data, built by a method <code>create</code>
- * @param resizerConstrains Code of resizer:<br>
- * top-left: 1<br>
- * top: 2<br>
- * top-right: 4<br>
- * left: 8<br>
- * right: 16<br>
- * bottomleft: 32<br>
- * bottom: 64<br>
- * bottom-right: 128<br>
- * @param top Element top
- * @param left Element left
- * @param width Element width
- * @param height Element height
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceElement
+ * The current element of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @param visualElement
+ * The current element of the visual tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
+ * @param resizerConstrains
+ * Code of resizer:<br>
+ * top-left: 1<br>
+ * top: 2<br>
+ * top-right: 4<br>
+ * left: 8<br>
+ * right: 16<br>
+ * bottomleft: 32<br>
+ * bottom: 64<br>
+ * bottom-right: 128<br>
+ * @param top
+ * Element top
+ * @param left
+ * Element left
+ * @param width
+ * Element width
+ * @param height
+ * Element height
*/
- void resize(VpePageContext pageContext, Element sourceElement, Document visualDocument,
Element visualElement, Object data, int resizerConstrains, int top, int left, int width,
int height);
-
+ void resize(VpePageContext pageContext, Element sourceElement,
+ Document visualDocument, Element visualElement, Object data,
+ int resizerConstrains, int top, int left, int width, int height);
+
/**
- * Checks a capability of drag of visual element
- * @param pageContext Contains the information on edited page.
- * @param sourceElement The current element of the source tree.
- * @param visualDocument The document of the visual tree.
- * @param visualElement The current element of the visual tree.
- * @param data The arbitrary data, built by a method <code>create</code>
+ * Checks a capability of drag of visual element
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceElement
+ * The current element of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @param visualElement
+ * The current element of the visual tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
* @return <code>true</code> The element can be dragged
*/
- boolean canInnerDrag(VpePageContext pageContext, Element sourceElement, Document
visualDocument, Element visualElement, Object data);
-
+ boolean canInnerDrag(VpePageContext pageContext, Element sourceElement,
+ Document visualDocument, Element visualElement, Object data);
+
/**
* Checks a capability to drop an element in the container
- * @param pageContext Contains the information on edited page.
- * @param container Element-Container
- * @param sourceDragNode Node for drop
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param container
+ * Element-Container
+ * @param sourceDragNode
+ * Node for drop
* @return <code>true</code> The node can be dropped
*/
- boolean canInnerDrop(VpePageContext pageContext, Node container, Node sourceDragNode);
-
+ boolean canInnerDrop(VpePageContext pageContext, Node container,
+ Node sourceDragNode);
+
/**
* Is invoked at drop of an element visual tree
- * @param pageContext Contains the information on edited page.
- * @param dragInfo The information on the dragged element
- * @param dropInfo The information on the drop container
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param dragInfo
+ * The information on the dragged element
+ * @param dropInfo
+ * The information on the drop container
*/
- void innerDrop(VpePageContext pageContext, VpeSourceInnerDragInfo dragInfo,
VpeSourceInnerDropInfo dropInfo);
-
+ void innerDrop(VpePageContext pageContext, VpeSourceInnerDragInfo dragInfo,
+ VpeSourceInnerDropInfo dropInfo);
+
/**
* Returns <code>VpeTagDescription</code>
- * @param pageContext Contains the information on edited page.
- * @param sourceElement The current element of the source tree.
- * @param visualDocument The document of the visual tree.
- * @param visualElement The current element of the visual tree.
- * @param data The arbitrary data, built by a method <code>create</code>
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceElement
+ * The current element of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @param visualElement
+ * The current element of the visual tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
* @return <code>VpeTagDescription</code>
*/
- VpeTagDescription getTagDescription(VpePageContext pageContext, Element sourceElement,
Document visualDocument, Element visualElement, Object data);
-
+ VpeTagDescription getTagDescription(VpePageContext pageContext,
+ Element sourceElement, Document visualDocument,
+ Element visualElement, Object data);
+
/**
- * Checks, whether it is necessary to re-create an element at change of attribute
- * @param pageContext Contains the information on edited page.
- * @param sourceElement The current element of the source tree.
- * @param visualDocument The document of the visual tree.
- * @param visualNode The current node of the visual tree.
- * @param data The arbitrary data, built by a method <code>create</code>
- * @param name Atrribute name
- * @param value Attribute value
- * @return <code>true</code> if it is required to re-create an element at a
modification of attribute, <code>false</code> otherwise.
+ * Checks, whether it is necessary to re-create an element at change of
+ * attribute
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceElement
+ * The current element of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @param visualNode
+ * The current node of the visual tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
+ * @param name
+ * Atrribute name
+ * @param value
+ * Attribute value
+ * @return <code>true</code> if it is required to re-create an element at
+ * a modification of attribute, <code>false</code> otherwise.
*/
- boolean isRecreateAtAttrChange(VpePageContext pageContext, Element sourceElement,
Document visualDocument, Node visualNde, Object data, String name, String value);
-
+ boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, Document visualDocument, Node visualNde,
+ Object data, String name, String value);
+
/**
* @return <code>true</code> if the element can have children
*/
boolean isChildren();
-
+
/**
* @return <code>true</code> if the element is case sensitive
*/
boolean isCaseSensitive();
-
+
/**
+ * Return <code>true</code> if the element has visual representation on tab
+ * 'Preview', otherwise <code>false</code>.<br/>
+ * This value is initialized by attribute <b>haveVisualPreview</b> of tag
+ * <b><vpe:template></b>. If the attribute is not presented
default
+ * value is <code>true</code>.<br/>
+ * <br/>
+ * Example:<br/>
+ * JSF tag <code><h:form></code>:<br/>
+ * <code>
+ * <vpe:tag name="h:form"
case-sensitive="yes"><br/>
+ * <vpe:template children="yes"
modify="yes" haveVisualPreview="no"><br/>
+ *
<div
style="border:1px dotted #FF6600;padding: 5px;"
title="{tagstring()}"/><br/>
+ *
<vpe:dnd><br/>
+ *
<vpe:drag
start-enable="yes"/><br/>
+ *
<vpe:drop
container="yes"/><br/>
+ *
</vpe:dnd><br/>
+ * </vpe:template><br/>
+ * </vpe:tag><br/>
+ * </code><br/>
+ * In visual editor part (see tab 'Visual') the tag have a red border for
+ * visualization reason, but it is not visual element and it shouldn't have
+ * visual representation on tab 'Preview'.<br/>
+ * <br/>
+ * @return <code>true</code> if the element is have visual preview
+ */
+ boolean isHaveVisualPreview();
+
+ /**
* Returns the data for formatting an element of source tree
+ *
* @return <code>TextFormatingData</code>
*/
TextFormatingData getTextFormatingData();
-
+
/**
- * Returns a list of attributes of an element of the source tree,
- * the values which one are mapped in the visiblis editor
+ * Returns a list of attributes of an element of the source tree, the values
+ * which one are mapped in the visiblis editor
+ *
* @return attrubute name array
*/
- String [] getOutputAtributeNames();
+ String[] getOutputAtributeNames();
/**
* Is invoked at a change of bundle values
- * @param pageContext Contains the information on edited page.
- * @param sourceElement The current element of the source tree.
- * @param data The arbitrary data, built by a method <code>create</code>
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceElement
+ * The current element of the source tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
*/
- void refreshBundleValues(VpePageContext pageContext, Element sourceElement, Object
data);
+ void refreshBundleValues(VpePageContext pageContext, Element sourceElement,
+ Object data);
/**
- * Opens proprties editor for bundle value
- * Is invoked at double mouse click on visual element
- * @param pageContext Contains the information on edited page.
- * @param sourceElement The current element of the source tree.
- * @param data The arbitrary data, built by a method <code>create</code>
+ * Opens proprties editor for bundle value Is invoked at double mouse click
+ * on visual element
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceElement
+ * The current element of the source tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
*/
- void openBundleEditors(VpePageContext pageContext, Element sourceElement, Object data);
+ void openBundleEditors(VpePageContext pageContext, Element sourceElement,
+ Object data);
/**
* Opens editor of source file for include-element
- * @param pageContext Contains the information on edited page.
- * @param sourceElement The current element of the source tree.
- * @param data The arbitrary data, built by a method <code>create</code>
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceElement
+ * The current element of the source tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
*/
- void openIncludeEditor(VpePageContext pageContext, Element sourceElement, Object data);
+ void openIncludeEditor(VpePageContext pageContext, Element sourceElement,
+ Object data);
/**
* @deprecated
- * @param pageContext Contains the information on edited page.
- * @param sourceElement The current element of the source tree.
- * @param data The arbitrary data, built by a method <code>create</code>
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceElement
+ * The current element of the source tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
*/
- void setSourceAttributeValue(VpePageContext pageContext, Element sourceElement, Object
data);
-
+ void setSourceAttributeValue(VpePageContext pageContext,
+ Element sourceElement, Object data);
+
/**
- * If the value of attribute of an element of an source tree
- * is mapped by the way of text node of a visual treer,
- * this method returns the text node, otherwise - null
- * @param pageContext Contains the information on edited page.
- * @param sourceElement The current element of the source tree.
- * @param data The arbitrary data, built by a method <code>create</code>
+ * If the value of attribute of an element of an source tree is mapped by
+ * the way of text node of a visual treer, this method returns the text
+ * node, otherwise - null
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceElement
+ * The current element of the source tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
* @return Text node or null
*/
- Node getOutputTextNode(VpePageContext pageContext, Element sourceElement, Object data);
+ Node getOutputTextNode(VpePageContext pageContext, Element sourceElement,
+ Object data);
/**
* @deprecated
- * @param pageContext Contains the information on edited page.
- * @param sourceElement The current element of the source tree.
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceElement
+ * The current element of the source tree.
* @param offset
* @param length
* @param data
*/
- void setSourceAttributeSelection(VpePageContext pageContext, Element sourceElement, int
offset, int length, Object data);
+ void setSourceAttributeSelection(VpePageContext pageContext,
+ Element sourceElement, int offset, int length, Object data);
/**
* @deprecated
@@ -279,15 +445,20 @@
VpeAnyData getAnyData();
/**
- * The unfilled element of an source tree can be mapped
- * in the visiblis editor with the default contents
- * This method fills default contents
- * @param pageContext Contains the information on edited page.
- * @param sourceContainer The current element of the source tree.
- * @param visualContainer The current element of the visual tree.
- * @param visualDocument The document of the visual tree.
+ * The unfilled element of an source tree can be mapped in the visiblis
+ * editor with the default contents This method fills default contents
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceContainer
+ * The current element of the source tree.
+ * @param visualContainer
+ * The current element of the visual tree.
+ * @param visualDocument
+ * The document of the visual tree.
*/
- void setPseudoContent(VpePageContext pageContext, Node sourceContainer, Node
visualContainer, Document visualDocument);
-
+ void setPseudoContent(VpePageContext pageContext, Node sourceContainer,
+ Node visualContainer, Document visualDocument);
+
boolean containsText();
}
\ No newline at end of file
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java 2007-07-31
14:03:46 UTC (rev 2758)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java 2007-07-31
14:04:13 UTC (rev 2759)
@@ -112,6 +112,9 @@
static final String ATTR_TEMPLATE_CLASS = "class";
static final String ATTR_TEMPLATE_CHILDREN = "children";
static final String ATTR_TEMPLATE_MODIFY = "modify";
+
+ /** ATTR_TEMPLATE_HAVE_VISUAL_PREVIEW */
+ static final String ATTR_TEMPLATE_HAVE_VISUAL_PREVIEW = "haveVisualPreview";
static final String ATTR_COPY_ATTRS = "attrs";
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java 2007-07-31
14:03:46 UTC (rev 2758)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java 2007-07-31
14:04:13 UTC (rev 2759)
@@ -13,6 +13,7 @@
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.compare.Splitter;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTException;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -163,7 +164,7 @@
Rectangle rect = null;
try {
rect = composite.getBounds();
- } catch (Exception e) {
+ } catch (SWTException e) {
VpePlugin.getPluginLog().logError(e);
}
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/templates/vpe-templates-jsf.xml
===================================================================
---
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/templates/vpe-templates-jsf.xml 2007-07-31
14:03:46 UTC (rev 2758)
+++
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe/templates/vpe-templates-jsf.xml 2007-07-31
14:04:13 UTC (rev 2759)
@@ -1060,7 +1060,7 @@
</vpe:tag>
<vpe:tag name="f:view" case-sensitive="yes">
- <vpe:template children="yes" modify="yes">
+ <vpe:template children="yes" modify="yes"
haveVisualPreview="no">
<div style="border:1px dotted #FF6600;padding: 5px;"
title="{tagstring()}"/>
<vpe:dnd>
<vpe:drag start-enable="yes"/>
@@ -1078,7 +1078,7 @@
</vpe:tag>
<vpe:tag name="f:subview" case-sensitive="yes">
- <vpe:template children="yes" modify="yes">
+ <vpe:template children="yes" modify="yes"
haveVisualPreview="no">
<div style="border:1px dotted #FF6600;padding: 5px;"
title="{tagstring()}"/>
<vpe:dnd>
<vpe:drag start-enable="yes"/>
@@ -1096,7 +1096,7 @@
</vpe:tag>
<vpe:tag name="h:form" case-sensitive="yes">
- <vpe:template children="yes" modify="yes">
+ <vpe:template children="yes" modify="yes"
haveVisualPreview="no">
<div style="border:1px dotted #FF6600;padding: 5px;"
title="{tagstring()}"/>
<vpe:dnd>
<vpe:drag start-enable="yes"/>