JBoss Tools SVN: r5414 - in trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe: editor/mapping and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2007-12-20 14:20:25 -0500 (Thu, 20 Dec 2007)
New Revision: 5414
Added:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java
Removed:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mapping/VpeDomMapping.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mapping/VpeElementMapping.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaDomEventListener.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/dnd/VpeDnd.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/resize/VpeResizer.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/FormatControllerManager.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/BlockFormatHandler.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/SimpleTagHandler.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java
Log:
code revert http://jira.jboss.com/jira/browse/JBIDE-1457 and http://jira.jboss.com/jira/browse/JBIDE-788
Deleted: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java 2007-12-20 18:14:12 UTC (rev 5413)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java 2007-12-20 19:20:25 UTC (rev 5414)
@@ -1,490 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.editor.context;
-
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jst.jsp.core.internal.contentmodel.TaglibController;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TLDCMDocumentManager;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TaglibTracker;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.wst.xml.core.internal.document.ElementImpl;
-import org.jboss.tools.common.kb.KbConnectorFactory;
-import org.jboss.tools.common.kb.KbConnectorType;
-import org.jboss.tools.common.kb.KbTldResource;
-import org.jboss.tools.common.kb.wtp.JspWtpKbConnector;
-import org.jboss.tools.common.kb.wtp.TLDVersionHelper;
-import org.jboss.tools.common.kb.wtp.WtpKbConnector;
-import org.jboss.tools.common.model.XModel;
-import org.jboss.tools.common.model.project.IModelNature;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.jst.jsp.editor.IVisualContext;
-import org.jboss.tools.jst.jsp.editor.TLDRegisterHelper;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
-import org.jboss.tools.jst.web.tld.TaglibData;
-import org.jboss.tools.jst.web.tld.VpeTaglibListener;
-import org.jboss.tools.jst.web.tld.VpeTaglibManager;
-import org.jboss.tools.vpe.VpeDebug;
-import org.jboss.tools.vpe.VpePlugin;
-import org.jboss.tools.vpe.editor.VpeEditorPart;
-import org.jboss.tools.vpe.editor.VpeSourceDomBuilder;
-import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
-import org.jboss.tools.vpe.editor.bundle.BundleMap;
-import org.jboss.tools.vpe.editor.css.AbsoluteFolderReferenceList;
-import org.jboss.tools.vpe.editor.css.CSSReferenceList;
-import org.jboss.tools.vpe.editor.css.RelativeFolderReferenceList;
-import org.jboss.tools.vpe.editor.css.ResourceReference;
-import org.jboss.tools.vpe.editor.css.TaglibReferenceList;
-import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
-import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
-import org.jboss.tools.vpe.editor.util.FileUtil;
-import org.mozilla.interfaces.nsIDOMNode;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * Contains the information on edited page.
- */
-
-// vitali: Attention!!! this is refactoring intermediate version
-// because of bugfixing
-// http://jira.jboss.com/jira/browse/JBIDE-788 and
-// http://jira.jboss.com/jira/browse/JBIDE-1457
-
-//public class VpePageContext implements IVisualContext {
-public class VpePageContext {
-
- // vitali: time solution - set connector from JSPTextEditorPageContext
- public WtpKbConnector getConnector() {
- return getVisualContext().getConnector();
- }
- IVisualContext visualContext;
- public void setVisualContext(IVisualContext visualContext) {
- this.visualContext = visualContext;
- VpeTemplateManager.getInstance().initVisualContext(visualContext);
- }
- public IVisualContext getVisualContext() {
- return visualContext;
- }
-
-
-
- private ArrayList taglibs = new ArrayList();
- private Map taglibMap = new HashMap();
- private VpeTaglibListener[] taglibListeners = new VpeTaglibListener[0];
- private BundleMap bundle;
- private Set bundleDependencySet = new HashSet();
- private VpeSourceDomBuilder sourceBuilder;
- private VpeVisualDomBuilder visualBuilder;
- private VpeEditorPart editPart;
- private List lastTaglibs = new ArrayList();
- private boolean taglibChanged = false;
- WtpKbConnector connector;
- private nsIDOMNode currentVisualNode;
-
- public VpePageContext(BundleMap bundle, VpeEditorPart editPart) {
- this.bundle = bundle;
- this.editPart = editPart;
- }
-
- //+
- public void setSourceBuilder(VpeSourceDomBuilder sourceBuilder) {
- this.sourceBuilder = sourceBuilder;
- }
- //+
- public VpeSourceDomBuilder getSourceBuilder() {
- return sourceBuilder;
- }
-
- //+
- public VpeVisualDomBuilder getVisualBuilder(){
- return visualBuilder;
- }
- //+
- public void setVisualBuilder(VpeVisualDomBuilder visualBuilder) {
- this.visualBuilder = visualBuilder;
- }
-
- // vitali: delete this function with the class - use VpeController->getVisualBuilder()
- public VpeDomMapping getDomMapping () {
- return visualBuilder.getDomMapping();
- }
-
- // vitali: delete this function with the class
- public void clearAll() {
- taglibs.clear();
- taglibMap.clear();
- bundleDependencySet.clear();
- bundle.clearAll();
- }
-
- // vitali: delete this function with the class
- public void dispose() {
- bundle.dispose();
- clearAll();
- }
-
- // vitali: delete this function with the class - from all places
- //-
- public void setTaglib(int id, String newUri, String newPrefix, boolean ns) {
- for (int i = 0; i < taglibs.size(); i++) {
- TaglibData taglib = (TaglibData)taglibs.get(i);
- if (taglib.getId() == id) {
- if (newUri != null && newPrefix != null) {
- if (!newUri.equals(taglib.getUri()) || !newPrefix.equals(taglib.getPrefix())) {
- taglibs.set(i, new TaglibData(id, newUri, newPrefix, ns));
- rebuildTaglibMap();
- }
- } else {
- taglibs.remove(i);
- rebuildTaglibMap();
- }
- return;
- }
- }
- if (newUri != null && newPrefix != null) {
- taglibs.add(new TaglibData(id, newUri, newPrefix, ns));
- rebuildTaglibMap();
- }
- }
-
- //+
- public String getTemplateTaglibPrefix(String sourceTaglibPrefix) {
- // vitali TODO: this is wrong temporary way - get rid of it
- return (String) taglibMap.get(sourceTaglibPrefix);
- // vitali TODO: this is right way to use - for refactoring
- //return getVisualContext().getTemplateTaglibPrefix(sourceTaglibPrefix);
- }
-
- //-
- private void rebuildTaglibMap() {
- /**/
- // vitali TODO: this is wrong temporary way - get rid of it
- taglibMap.clear();
- VpeTemplateManager templateManager = VpeTemplateManager.getInstance();
- Set prefixSet = new HashSet();
- for (int i = 0; i < taglibs.size(); i++) {
- TaglibData taglib = (TaglibData)taglibs.get(i);
- String prefix = taglib.getPrefix();
- if (!prefixSet.contains(prefix)) {
- String templatePrefix = templateManager.getTemplateTaglibPrefix(taglib.getUri());
- if (templatePrefix != null) {
- taglibMap.put(prefix, templatePrefix);
- }
- prefixSet.add(prefix);
- }
- }
- taglibChanged = true;
- /** /
- try {
- registerTaglibs(connector, this, getSourceBuilder().getStructuredTextViewer().getDocument());
- } catch (Exception e) {
- VpePlugin.getPluginLog().logError(e);
- }
- /**/
- }
-
- /** /
- // vitali: parent
- public void addTaglibListener(VpeTaglibListener listener) {
- if (listener != null) {
- VpeTaglibListener[] newTaglibListeners = new VpeTaglibListener[taglibListeners.length + 1];
- System.arraycopy(taglibListeners, 0, newTaglibListeners, 0, taglibListeners.length);
- taglibListeners = newTaglibListeners;
- taglibListeners[taglibListeners.length - 1] = listener;
- }
- }
-
- // vitali: parent
- public void removeTaglibListener(VpeTaglibListener listener) {
- if (listener == null || taglibListeners.length == 0) return;
- int index = -1;
- for (int i = 0; i < taglibListeners.length; i++) {
- if (listener == taglibListeners[i]){
- index = i;
- break;
- }
- }
- if (index == -1) return;
- if (taglibListeners.length == 1) {
- taglibListeners = new VpeTaglibListener[0];
- return;
- }
- VpeTaglibListener[] newTaglibListeners = new VpeTaglibListener[taglibListeners.length - 1];
- System.arraycopy(taglibListeners, 0, newTaglibListeners, 0, index);
- System.arraycopy(taglibListeners, index + 1, newTaglibListeners, index, taglibListeners.length - index - 1);
- taglibListeners = newTaglibListeners;
- }
- /**/
-
- // vitali: delete this function with the class - save and getBundle() from other place
- // for examle visualBuilder
- public BundleMap getBundle() {
- return bundle;
- }
-
- // vitali: delete this function with the class - save and getBundle() from other place
- // for examle visualBuilder
- public void addBundleDependency(Element sourceNode) {
- bundleDependencySet.add(sourceNode);
- }
-
- // vitali: delete this function with the class - save and getBundle() from other place
- // for examle visualBuilder
- public void removeBundleDependency(Element sourceNode) {
- bundleDependencySet.remove(sourceNode);
- }
-
- /** /
- // vitali: parent
- public void refreshBundleValues() {
- Iterator iterator = bundleDependencySet.iterator();
- while (iterator.hasNext()) {
- Element sourceElement = (Element) iterator.next();
- visualBuilder.refreshBundleValues(sourceElement);
- }
- }
- /**/
-
- // vitali: put this function in to JSPTextEditorPageContext
- // VpeController ask JSPTextEditorPageContext via sourceEditor
- public boolean isCorrectNS(Node sourceNode) {
- String sourcePrefix = sourceNode.getPrefix();
- if (sourcePrefix == null || ((ElementImpl)sourceNode).isJSPTag()) {
- return true;
- }
- for (int i = 0; i < taglibs.size(); i++) {
- TaglibData taglib = (TaglibData)taglibs.get(i);
- if (sourcePrefix.equals(taglib.getPrefix())) {
- return true;
- }
- }
- return false;
- }
-
- // vitali: 2 places - RichFacesDataDefinitionListTemplate & VpeController
- // should implement this function & get taglibs from sourceEditor->JSPTextEditorPageContext
- public String getSourceTaglibUri(Node sourceNode) {
- String sourcePrefix = sourceNode.getPrefix();
- if (sourcePrefix == null || ((ElementImpl)sourceNode).isJSPTag()) {
- return null;
- }
- for (int i = 0; i < taglibs.size(); i++) {
- TaglibData taglib = (TaglibData)taglibs.get(i);
- if (sourcePrefix.equals(taglib.getPrefix())) {
- return taglib.getUri();
- }
- }
- return null;
- }
-
- // vitali: 24 places - !!! use other way to get VpeEditorPart
- public VpeEditorPart getEditPart() {
- return editPart;
- }
-
- // vitali: this is not right place to the function - put in into editPart - VpeEditorPart
- public void openIncludeFile(String file) {
- IEditorInput input = editPart.getEditorInput();
- IWorkbenchPage workbenchPage = VpePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
- try{
- IFile f = FileUtil.getFile(input, file);
- if (f != null) {
- IDE.openEditor(workbenchPage, f, true);
- }
- }catch(Exception ex){
- VpePlugin.reportProblem(ex);
- }
- }
-
- // vitali: public - can be protected!
- protected ResourceReference[] getIncludeTaglibs() {
- IEditorInput input = getEditPart().getEditorInput();
- IFile file = null;
- if (input instanceof IFileEditorInput) {
- file = ((IFileEditorInput)input).getFile();
- }
- ResourceReference[] resourceReferences = new ResourceReference[0];
- if (file != null) {
- resourceReferences = TaglibReferenceList.getInstance().getAllResources(file);
- }
- return resourceReferences;
- }
-
- // vitali: public - can be protected!
- protected ResourceReference[] getIncludeCss() {
- IEditorInput input = getEditPart().getEditorInput();
- IFile file = null;
- if (input instanceof IFileEditorInput) {
- file = ((IFileEditorInput)input).getFile();
- }
- ResourceReference[] resourceReferences = new ResourceReference[0];
- if (file != null) {
- resourceReferences = CSSReferenceList.getInstance().getAllResources(file);
- }
- return resourceReferences;
- }
-
- // vitali: 1 place - VpeVisualDomBuilder - put this into VpeVisualDomBuilder
- // and getIncludeTaglibs and getIncludeCss
- public void installIncludeElements() {
- ResourceReference[] list = getIncludeTaglibs();
- for (int i = 0; i < list.length; i++) {
- ResourceReference reference = list[i];
- setTaglib(i, reference.getLocation(), reference.getProperties(), false);
- }
-
- list = getIncludeCss();
- for (int i = 0; i < list.length; i++) {
- visualBuilder.addLinkNodeToHead(list[i].getLocation(), "yes");
- }
- }
-
- /** /
- // vitali: parent
- public List<TaglibData> getTagLibs() {
- List<TaglibData> clone = new ArrayList<TaglibData>();
- Iterator iter = taglibs.iterator();
- while (iter.hasNext()) {
- TaglibData taglib = (TaglibData)iter.next();
- if (!taglib.inList(clone)) {
- clone.add(taglib);
- }
- }
- return clone;
- }
- /**/
-
- // vitali: public
- private boolean buildTaglibsDifferences(List newTaglibs, List delTaglibs) {
- Iterator lastIter = lastTaglibs.iterator();
- while (lastIter.hasNext()) {
- TaglibData oldTaglib = (TaglibData)lastIter.next();
- Iterator newIter = newTaglibs.iterator();
- while (newIter.hasNext()) {
- if (oldTaglib.isEquals((TaglibData)newIter.next())) {
- newIter.remove();
- oldTaglib = null;
- break;
- }
- }
- if (oldTaglib != null) {
- delTaglibs.add(oldTaglib);
- }
- }
- return newTaglibs.size() > 0 || delTaglibs.size() > 0;
- }
-
- /** /
- // vitali: 5 places - all in VpeController -
- public void fireTaglibsChanged() {
- List newTaglibs = getTagLibs();
- List delTaglibs = new ArrayList();
- if (buildTaglibsDifferences(newTaglibs, delTaglibs)) {
- if (VpeDebug.PRINT_SOURCE_MUTATION_EVENT) {
- System.out.println(">>> TaglibsChanged");
- }
- for (int i = 0; i < taglibListeners.length; i++) {
- taglibListeners[i].taglibPrefixChanged(null);
- fireTaglibChanged(taglibListeners[i], newTaglibs, delTaglibs);
- }
- lastTaglibs = getTagLibs();
- }
- taglibChanged = false;
- }
- /**/
-
- private void fireTaglibChanged(VpeTaglibListener taglibListener, List newTaglibs, List delTaglibs) {
- Iterator iter = delTaglibs.iterator();
- while (iter.hasNext()) {
- TaglibData taglib = (TaglibData)iter.next();
- taglibListener.removeTaglib(taglib.getUri(), taglib.getPrefix());
- }
- iter = newTaglibs.iterator();
- while (iter.hasNext()) {
- TaglibData taglib = (TaglibData)iter.next();
- taglibListener.addTaglib(taglib.getUri(), taglib.getPrefix());
- }
- }
-
- // vitali: 1 place VpeController -
- public boolean isTaglibChanged() {
- if (!taglibChanged) return false;
- //vitali
- List newTaglibs = null;//getTagLibs();
- List delTaglibs = new ArrayList();
- return buildTaglibsDifferences(newTaglibs, delTaglibs);
- }
-
- /** /
- // vitali: parent
- public WtpKbConnector getConnector() {
- return connector;
- }
- /**/
-
- boolean registerTaglibs(WtpKbConnector wtpKbConnector, VpeTaglibManager taglibManager, IDocument document) {
- if(wtpKbConnector == null) return false;
- TLDCMDocumentManager manager = TaglibController.getTLDCMDocumentManager(document);
- if(taglibManager != null) {
- List list = taglibManager.getTagLibs();
- if(list != null) {
- Iterator it = list.iterator();
- while(it.hasNext()) {
- TaglibData data = (TaglibData)it.next();
- IEditorInput ei = editPart.getEditorInput();
- TLDRegisterHelper.registerTld(data, (JspWtpKbConnector)wtpKbConnector, document, ei);
- }
- return true;
- }
- }
- if(manager != null) {
- List list = manager.getTaglibTrackers();
- for (int i = 0; i < list.size(); i++) {
- TaglibTracker tracker = (TaglibTracker)list.get(i);
- if(tracker == null) continue;
- String version = TLDVersionHelper.getTldVersion(tracker);
- KbTldResource resource = new KbTldResource(tracker.getURI(), "", tracker.getPrefix(), version);
- wtpKbConnector.registerResource(resource);
- }
- return true;
- }
- return false;
- }
-
- // vitali: 2 places - VpeDataTableColumnCreator & VpeDataTableCreator
- public nsIDOMNode getCurrentVisualNode() {
- return currentVisualNode;
- }
-
- // vitali: 8 places in VpePreviewDomBuilder & VpeVisualDomBuilder
- // use - setCurrentVisualNode(XXX)
- // - getCurrentVisualNode()
- // then - setCurrentVisualNode(null)
- // just use other way to send current node as parameter
- public void setCurrentVisualNode(nsIDOMNode currentVisualNode) {
- this.currentVisualNode = currentVisualNode;
- }
-
-}
Copied: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java (from rev 5352, trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java)
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/context/VpePageContext.java 2007-12-20 19:20:25 UTC (rev 5414)
@@ -0,0 +1,443 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.editor.context;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jst.jsp.core.internal.contentmodel.TaglibController;
+import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TLDCMDocumentManager;
+import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TaglibTracker;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.wst.xml.core.internal.document.ElementImpl;
+import org.jboss.tools.common.kb.KbConnectorFactory;
+import org.jboss.tools.common.kb.KbConnectorType;
+import org.jboss.tools.common.kb.KbTldResource;
+import org.jboss.tools.common.kb.wtp.JspWtpKbConnector;
+import org.jboss.tools.common.kb.wtp.TLDVersionHelper;
+import org.jboss.tools.common.kb.wtp.WtpKbConnector;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.project.IModelNature;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.jst.jsp.editor.IVisualContext;
+import org.jboss.tools.jst.jsp.editor.TLDRegisterHelper;
+import org.jboss.tools.jst.jsp.preferences.VpePreference;
+import org.jboss.tools.jst.web.tld.TaglibData;
+import org.jboss.tools.jst.web.tld.VpeTaglibListener;
+import org.jboss.tools.jst.web.tld.VpeTaglibManager;
+import org.jboss.tools.vpe.VpeDebug;
+import org.jboss.tools.vpe.VpePlugin;
+import org.jboss.tools.vpe.editor.VpeEditorPart;
+import org.jboss.tools.vpe.editor.VpeSourceDomBuilder;
+import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
+import org.jboss.tools.vpe.editor.bundle.BundleMap;
+import org.jboss.tools.vpe.editor.css.AbsoluteFolderReferenceList;
+import org.jboss.tools.vpe.editor.css.CSSReferenceList;
+import org.jboss.tools.vpe.editor.css.RelativeFolderReferenceList;
+import org.jboss.tools.vpe.editor.css.ResourceReference;
+import org.jboss.tools.vpe.editor.css.TaglibReferenceList;
+import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
+import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
+import org.jboss.tools.vpe.editor.util.FileUtil;
+import org.mozilla.interfaces.nsIDOMNode;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Contains the information on edited page.
+ */
+
+public class VpePageContext implements VpeTaglibManager, IVisualContext {
+ private VpeTemplateManager templateManager;
+ private ArrayList taglibs = new ArrayList();
+ private Map taglibMap = new HashMap();
+ private VpeTaglibListener[] taglibListeners = new VpeTaglibListener[0];
+ private BundleMap bundle;
+ private Set bundleDependencySet = new HashSet();
+ private VpeSourceDomBuilder sourceBuilder;
+ private VpeVisualDomBuilder visualBuilder;
+ private VpeEditorPart editPart;
+ private List lastTaglibs = new ArrayList();
+ private boolean taglibChanged = false;
+ WtpKbConnector connector;
+ private nsIDOMNode currentVisualNode;
+
+ public VpePageContext(VpeTemplateManager templateManager, BundleMap bundle, VpeEditorPart editPart) {
+ this.templateManager = templateManager;
+ this.bundle = bundle;
+ this.editPart = editPart;
+ }
+
+ public VpeSourceDomBuilder getSourceBuilder(){
+ return sourceBuilder;
+ }
+
+ public boolean isAbsolutePosition(){
+ if("yes".equals(VpePreference.USE_ABSOLUTE_POSITION.getValue()))return true;
+ else return false;
+ }
+
+ public void setSourceDomBuilder(VpeSourceDomBuilder sourceBuilder) {
+ this.sourceBuilder = sourceBuilder;
+ refreshConnector();
+ }
+
+ public void refreshConnector() {
+ try {
+ IDocument document = sourceBuilder.getStructuredTextViewer().getDocument();
+ connector = (WtpKbConnector)KbConnectorFactory.getIntstance().createConnector(KbConnectorType.JSP_WTP_KB_CONNECTOR, document);
+ } catch (Exception e) {
+ VpePlugin.getPluginLog().logError(e);
+ }
+ }
+
+ public VpeVisualDomBuilder getVisualBuilder(){
+ return visualBuilder;
+ }
+
+ public void setVisualDomBuilder(VpeVisualDomBuilder visualBuilder) {
+ this.visualBuilder = visualBuilder;
+ }
+
+ public VpeDomMapping getDomMapping () {
+ return visualBuilder.getDomMapping();
+ }
+
+ public void clearAll() {
+ taglibs.clear();
+ taglibMap.clear();
+ bundleDependencySet.clear();
+ bundle.clearAll();
+ }
+
+ public void dispose() {
+ bundle.dispose();
+ clearAll();
+ }
+
+ public void setTaglib(int id, String newUri, String newPrefix, boolean ns) {
+ for (int i = 0; i < taglibs.size(); i++) {
+ TaglibData taglib = (TaglibData)taglibs.get(i);
+ if (taglib.getId() == id) {
+ if (newUri != null && newPrefix != null) {
+ if (!newUri.equals(taglib.getUri()) || !newPrefix.equals(taglib.getPrefix())) {
+ taglibs.set(i, new TaglibData(id, newUri, newPrefix, ns));
+ rebuildTaglibMap();
+ }
+ } else {
+ taglibs.remove(i);
+ rebuildTaglibMap();
+ }
+ return;
+ }
+ }
+ if (newUri != null && newPrefix != null) {
+ taglibs.add(new TaglibData(id, newUri, newPrefix, ns));
+ rebuildTaglibMap();
+ }
+ }
+
+ public String getTemplateTaglibPrefix(String sourceTaglibPrefix) {
+ return (String) taglibMap.get(sourceTaglibPrefix);
+ }
+
+ private void rebuildTaglibMap() {
+ taglibMap.clear();
+ Set prefixSet = new HashSet();
+ for (int i = 0; i < taglibs.size(); i++) {
+ TaglibData taglib = (TaglibData)taglibs.get(i);
+ String prefix = taglib.getPrefix();
+ if (!prefixSet.contains(prefix)) {
+ String templatePrefix = templateManager.getTemplateTaglibPrefix(taglib.getUri());
+ if (templatePrefix != null) {
+ taglibMap.put(prefix, templatePrefix);
+ }
+ prefixSet.add(prefix);
+ }
+ }
+ taglibChanged = true;
+
+ try {
+ registerTaglibs(connector, this, getSourceBuilder().getStructuredTextViewer().getDocument());
+ } catch (Exception e) {
+ VpePlugin.getPluginLog().logError(e);
+ }
+ }
+
+ public void addTaglibListener(VpeTaglibListener listener) {
+ if (listener != null) {
+ VpeTaglibListener[] newTaglibListeners = new VpeTaglibListener[taglibListeners.length + 1];
+ System.arraycopy(taglibListeners, 0, newTaglibListeners, 0, taglibListeners.length);
+ taglibListeners = newTaglibListeners;
+ taglibListeners[taglibListeners.length - 1] = listener;
+ }
+ }
+
+ public void removeTaglibListener(VpeTaglibListener listener) {
+ if (listener == null || taglibListeners.length == 0) return;
+ int index = -1;
+ for (int i = 0; i < taglibListeners.length; i++) {
+ if (listener == taglibListeners[i]){
+ index = i;
+ break;
+ }
+ }
+ if (index == -1) return;
+ if (taglibListeners.length == 1) {
+ taglibListeners = new VpeTaglibListener[0];
+ return;
+ }
+ VpeTaglibListener[] newTaglibListeners = new VpeTaglibListener[taglibListeners.length - 1];
+ System.arraycopy(taglibListeners, 0, newTaglibListeners, 0, index);
+ System.arraycopy(taglibListeners, index + 1, newTaglibListeners, index, taglibListeners.length - index - 1);
+ taglibListeners = newTaglibListeners;
+ }
+
+ public BundleMap getBundle() {
+ return bundle;
+ }
+
+ public void addBundleDependency(Element sourceNode) {
+ bundleDependencySet.add(sourceNode);
+ }
+
+ public void removeBundleDependency(Element sourceNode) {
+ bundleDependencySet.remove(sourceNode);
+ }
+
+ public void refreshBundleValues() {
+ Iterator iterator = bundleDependencySet.iterator();
+ while (iterator.hasNext()) {
+ Element sourceElement = (Element) iterator.next();
+ visualBuilder.refreshBundleValues(sourceElement);
+ }
+ }
+
+ public boolean isCorrectNS(Node sourceNode) {
+ String sourcePrefix = sourceNode.getPrefix();
+ if (sourcePrefix == null || ((ElementImpl)sourceNode).isJSPTag()) {
+ return true;
+ }
+ for (int i = 0; i < taglibs.size(); i++) {
+ TaglibData taglib = (TaglibData)taglibs.get(i);
+ if (sourcePrefix.equals(taglib.getPrefix())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public String getSourceTaglibUri(Node sourceNode) {
+ String sourcePrefix = sourceNode.getPrefix();
+ if (sourcePrefix == null || ((ElementImpl)sourceNode).isJSPTag()) {
+ return null;
+ }
+ for (int i = 0; i < taglibs.size(); i++) {
+ TaglibData taglib = (TaglibData)taglibs.get(i);
+ if (sourcePrefix.equals(taglib.getPrefix())) {
+ return taglib.getUri();
+ }
+ }
+ return null;
+ }
+
+ public VpeEditorPart getEditPart() {
+ return editPart;
+ }
+
+ public void openIncludeFile(String file) {
+ IEditorInput input = editPart.getEditorInput();
+ IWorkbenchPage workbenchPage = VpePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ try{
+ IFile f = FileUtil.getFile(input, file);
+ if (f != null) {
+ IDE.openEditor(workbenchPage, f, true);
+ }
+ }catch(Exception ex){
+ VpePlugin.reportProblem(ex);
+ }
+ }
+
+ public ResourceReference[] getIncludeTaglibs() {
+ IEditorInput input = getEditPart().getEditorInput();
+ IFile file = null;
+ if (input instanceof IFileEditorInput) {
+ file = ((IFileEditorInput)input).getFile();
+ }
+ ResourceReference[] resourceReferences = new ResourceReference[0];
+ if (file != null) {
+ resourceReferences = TaglibReferenceList.getInstance().getAllResources(file);
+ }
+ return resourceReferences;
+ }
+
+ public ResourceReference[] getIncludeCss() {
+ IEditorInput input = getEditPart().getEditorInput();
+ IFile file = null;
+ if (input instanceof IFileEditorInput) {
+ file = ((IFileEditorInput)input).getFile();
+ }
+ ResourceReference[] resourceReferences = new ResourceReference[0];
+ if (file != null) {
+ resourceReferences = CSSReferenceList.getInstance().getAllResources(file);
+ }
+ return resourceReferences;
+ }
+
+ public void installIncludeElements() {
+ ResourceReference[] list = getIncludeTaglibs();
+ for (int i = 0; i < list.length; i++) {
+ ResourceReference reference = list[i];
+ setTaglib(i, reference.getLocation(), reference.getProperties(), false);
+ }
+
+ list = getIncludeCss();
+ for (int i = 0; i < list.length; i++) {
+ visualBuilder.addLinkNodeToHead(list[i].getLocation(), "yes");
+ }
+ }
+
+ public ResourceReference getRuntimeRelativeFolder(IFile file) {
+ ResourceReference[] list = RelativeFolderReferenceList.getInstance().getAllResources(file);
+ if (list.length > 0) {
+ return list[list.length - 1];
+ }
+ return null;
+ }
+
+ public ResourceReference getRuntimeAbsoluteFolder(IFile file) {
+ ResourceReference[] list = AbsoluteFolderReferenceList.getInstance().getAllResources(file);
+ if (list.length > 0) {
+ return list[list.length - 1];
+ }
+ return null;
+ }
+
+ public List<TaglibData> getTagLibs() {
+ List<TaglibData> clone = new ArrayList<TaglibData>();
+ Iterator iter = taglibs.iterator();
+ while (iter.hasNext()) {
+ TaglibData taglib = (TaglibData)iter.next();
+ if (!taglib.inList(clone)) {
+ clone.add(taglib);
+ }
+ }
+ return clone;
+ }
+
+ private boolean buildTaglibsDifferences(List newTaglibs, List delTaglibs) {
+ Iterator lastIter = lastTaglibs.iterator();
+ while (lastIter.hasNext()) {
+ TaglibData oldTaglib = (TaglibData)lastIter.next();
+ Iterator newIter = newTaglibs.iterator();
+ while (newIter.hasNext()) {
+ if (oldTaglib.isEquals((TaglibData)newIter.next())) {
+ newIter.remove();
+ oldTaglib = null;
+ break;
+ }
+ }
+ if (oldTaglib != null) {
+ delTaglibs.add(oldTaglib);
+ }
+ }
+ return newTaglibs.size() > 0 || delTaglibs.size() > 0;
+ }
+
+ public void fireTaglibsChanged() {
+ List newTaglibs = getTagLibs();
+ List delTaglibs = new ArrayList();
+ if (buildTaglibsDifferences(newTaglibs, delTaglibs)) {
+ if (VpeDebug.PRINT_SOURCE_MUTATION_EVENT) {
+ System.out.println(">>> TaglibsChanged");
+ }
+ for (int i = 0; i < taglibListeners.length; i++) {
+ taglibListeners[i].taglibPrefixChanged(null);
+ fireTaglibChanged(taglibListeners[i], newTaglibs, delTaglibs);
+ }
+ lastTaglibs = getTagLibs();
+ }
+ taglibChanged = false;
+ }
+
+ private void fireTaglibChanged(VpeTaglibListener taglibListener, List newTaglibs, List delTaglibs) {
+ Iterator iter = delTaglibs.iterator();
+ while (iter.hasNext()) {
+ TaglibData taglib = (TaglibData)iter.next();
+ taglibListener.removeTaglib(taglib.getUri(), taglib.getPrefix());
+ }
+ iter = newTaglibs.iterator();
+ while (iter.hasNext()) {
+ TaglibData taglib = (TaglibData)iter.next();
+ taglibListener.addTaglib(taglib.getUri(), taglib.getPrefix());
+ }
+ }
+
+ public boolean isTaglibChanged() {
+ if (!taglibChanged) return false;
+ List newTaglibs = getTagLibs();
+ List delTaglibs = new ArrayList();
+ return buildTaglibsDifferences(newTaglibs, delTaglibs);
+ }
+
+ public WtpKbConnector getConnector() {
+ return connector;
+ }
+
+ boolean registerTaglibs(WtpKbConnector wtpKbConnector, VpeTaglibManager taglibManager, IDocument document) {
+ if(wtpKbConnector == null) return false;
+ TLDCMDocumentManager manager = TaglibController.getTLDCMDocumentManager(document);
+ if(taglibManager != null) {
+ List list = taglibManager.getTagLibs();
+ if(list != null) {
+ Iterator it = list.iterator();
+ while(it.hasNext()) {
+ TaglibData data = (TaglibData)it.next();
+ IEditorInput ei = editPart.getEditorInput();
+ TLDRegisterHelper.registerTld(data, (JspWtpKbConnector)wtpKbConnector, document, ei);
+ }
+ return true;
+ }
+ }
+ if(manager != null) {
+ List list = manager.getTaglibTrackers();
+ for (int i = 0; i < list.size(); i++) {
+ TaglibTracker tracker = (TaglibTracker)list.get(i);
+ if(tracker == null) continue;
+ String version = TLDVersionHelper.getTldVersion(tracker);
+ KbTldResource resource = new KbTldResource(tracker.getURI(), "", tracker.getPrefix(), version);
+ wtpKbConnector.registerResource(resource);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public nsIDOMNode getCurrentVisualNode() {
+ return currentVisualNode;
+ }
+
+ public void setCurrentVisualNode(nsIDOMNode currentVisualNode) {
+ this.currentVisualNode = currentVisualNode;
+ }
+
+}
\ No newline at end of file
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mapping/VpeDomMapping.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mapping/VpeDomMapping.java 2007-12-20 18:14:12 UTC (rev 5413)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mapping/VpeDomMapping.java 2007-12-20 19:20:25 UTC (rev 5414)
@@ -281,9 +281,6 @@
}
if (nodeMapping.getType() == VpeNodeMapping.ELEMENT_MAPPING) {
VpeElementMapping elementMapping = (VpeElementMapping)nodeMapping;
- /**/
- // vitali TODO: this is wrong temporary way - get rid of it
- //-
Map xmlnsMap = elementMapping.getXmlnsMap();
if (xmlnsMap != null) {
for (Iterator iter = xmlnsMap.values().iterator(); iter.hasNext();) {
@@ -291,7 +288,6 @@
}
elementMapping.setXmlnsMap(null);
}
- /**/
if (elementMapping.getBorder() != null) {
visualMap.remove(elementMapping.getBorder());
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mapping/VpeElementMapping.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mapping/VpeElementMapping.java 2007-12-20 18:14:12 UTC (rev 5413)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mapping/VpeElementMapping.java 2007-12-20 19:20:25 UTC (rev 5414)
@@ -22,11 +22,7 @@
public class VpeElementMapping extends VpeNodeMapping {
private VpeTemplate template;
private Set ifDependencySet;
- /**/
- //vitali
- //-
private Map xmlnsMap;
- /**/
private Object data;
private nsIDOMElement border;
@@ -48,19 +44,13 @@
return template;
}
- /**/
- // vitali TODO: this is wrong temporary way - get rid of it
- //-
public Map getXmlnsMap() {
return xmlnsMap;
}
- // vitali TODO: this is wrong temporary way - get rid of it
- //-
public void setXmlnsMap(Map xmlnsMap) {
this.xmlnsMap = xmlnsMap;
}
- /**/
public Object getData() {
return data;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaDomEventListener.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaDomEventListener.java 2007-12-20 18:14:12 UTC (rev 5413)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaDomEventListener.java 2007-12-20 19:20:25 UTC (rev 5414)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.vpe.editor.mozilla;
-import org.jboss.tools.vpe.VpeDebug;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
@@ -197,11 +196,6 @@
* @see org.mozilla.interfaces.nsISelectionListener#notifySelectionChanged(org.mozilla.interfaces.nsIDOMDocument, org.mozilla.interfaces.nsISelection, short)
*/
public void notifySelectionChanged(nsIDOMDocument domDocument, nsISelection selection, short reason) {
- if (VpeDebug.PRINT_VISUAL_MOUSE_EVENT) {
- System.out.println("MozillaDomEventListener.notifySelectionChanged: editorDomEventListener " +
- (editorDomEventListener) + " reason " +
- (reason));
- }
if (editorDomEventListener != null) {
editorDomEventListener.notifySelectionChanged(domDocument, selection, reason);
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2007-12-20 18:14:12 UTC (rev 5413)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2007-12-20 19:20:25 UTC (rev 5414)
@@ -43,7 +43,6 @@
import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
import org.eclipse.ui.editors.text.ILocationProvider;
import org.eclipse.ui.part.EditorPart;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.VpeController;
import org.jboss.tools.vpe.editor.css.VpeResourcesDialog;
@@ -64,7 +63,6 @@
import org.mozilla.interfaces.nsIDOMNodeList;
import org.mozilla.interfaces.nsISelection;
import org.mozilla.interfaces.nsISelectionPrivate;
-import org.w3c.dom.Document;
public class MozillaEditor extends EditorPart implements IReusableEditor {
protected static final String INIT_URL = "file://" + (new File(VpePlugin.getDefault().getResourcePath("ve"), "init.html")).getAbsolutePath();
@@ -73,11 +71,14 @@
static String SELECT_BAR = "SELECT_LBAR"; //$NON-NLS-1$
private XulRunnerEditor xulRunnerEditor;
+ private nsIDOMDocument domDocument;
private nsIDOMEventTarget documentEventTarget;
private nsIDOMElement contentArea;
private nsIDOMNode headNode;
private nsIDOMEventTarget contentAreaEventTarget;
private MozillaDomEventListener contentAreaEventListener = new MozillaDomEventListener();
+ //TODO Max Areshkau may be we need delete this
+ //private MozillaBaseEventListener baseEventListener = null;
private EditorLoadWindowListener editorLoadWindowListener;
//
private EditorDomEventListener editorDomEventListener;
@@ -325,11 +326,19 @@
}
public nsIDOMDocument getDomDocument() {
- if (null != xulRunnerEditor) {
- return xulRunnerEditor.getDOMDocument();
+ if (domDocument == null) {
+ domDocument = xulRunnerEditor.getDOMDocument();
}
- return null;
+ return domDocument;
}
+
+ /**
+ * @param domDocument the domDocument to set
+ */
+ protected void setDomDocument(nsIDOMDocument domDocument) {
+
+ this.domDocument = domDocument;
+ }
public nsIDOMElement getContentArea() {
return contentArea;
@@ -473,6 +482,8 @@
contentAreaEventTarget.addEventListener(MozillaDomEventListener.DBLCLICK, contentAreaEventListener, false);//$NON-NLS-1$
documentEventTarget = (nsIDOMEventTarget) getDomDocument().queryInterface(nsIDOMEventTarget.NS_IDOMEVENTTARGET_IID);
documentEventTarget.addEventListener(MozillaDomEventListener.KEYPRESS, contentAreaEventListener, false); //$NON-NLS-1$
+ } else {
+ //baseEventListener = new MozillaBaseEventListener();
}
}
}
@@ -492,7 +503,7 @@
contentAreaEventTarget.removeEventListener(MozillaDomEventListener.DBLCLICK, contentAreaEventListener, false);//$NON-NLS-1$
}
- if (documentEventTarget != null) {
+ if (domDocument != null && documentEventTarget != null) {
documentEventTarget.removeEventListener(MozillaDomEventListener.KEYPRESS, contentAreaEventListener, false); //$NON-NLS-1$
}
}
@@ -561,20 +572,6 @@
return controller;
}
- public IDOMDocument getSourceDocument() {
- if (null == getController()) {
- return null;
- }
- if (null == getController().getSourceBuilder()) {
- return null;
- }
- Document doc = getController().getSourceBuilder().getSourceDocument();
- if (doc instanceof IDOMDocument) {
- return (IDOMDocument)doc;
- }
- return null;
- }
-
/**
* @return the link
*/
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java 2007-12-20 18:14:12 UTC (rev 5413)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java 2007-12-20 19:20:25 UTC (rev 5414)
@@ -27,8 +27,6 @@
import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.jboss.tools.jst.jsp.editor.IJSPTextEditor;
-import org.jboss.tools.jst.jsp.editor.IVisualContext;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.VpeEditorPart;
import org.jboss.tools.vpe.editor.VpePreviewDomBuilder;
@@ -49,12 +47,14 @@
private EditorLoadWindowListener editorLoadWindowListener;
private EditorDomEventListener editorDomEventListener;
+ private VpeTemplateManager templateManager;
private VpePageContext pageContext;
private StructuredTextEditor sourceEditor;
private VpeEditorPart editPart;
private IDOMDocument sourceDocument;
public MozillaPreview(VpeEditorPart editPart, StructuredTextEditor sourceEditor) {
+ setTemplateManager(VpeTemplateManager.getInstance());
setSourceEditor(sourceEditor);
setEditPart(editPart);
}
@@ -153,8 +153,9 @@
//TODO Max Areshkau logic error (we should first call buildDom and only then we can call rebuildDom)
public void rebuildDom() {
- if (null != pageContext && null != pageContext.getVisualBuilder() && null != getSourceDocument()) {
- pageContext.getVisualBuilder().rebuildDom(getSourceDocument());
+ if(getPageContext()!=null&&getPageContext().getVisualBuilder()!=null&&getSourceDocument()!=null) {
+
+ getPageContext().getVisualBuilder().rebuildDom(getSourceDocument());
}
}
@@ -163,15 +164,13 @@
BundleMap bundle = new BundleMap();
bundle.init(getSourceEditor());
- pageContext = new VpePageContext(bundle, getEditPart());
+ setPageContext(new VpePageContext(getTemplateManager(), bundle, getEditPart()));
- // vitali - temp solution
- pageContext.setVisualContext(getPageContext());
- VpeDomMapping domMapping = new VpeDomMapping(pageContext);
- VpeSourceDomBuilder sourceBuilder = new VpeSourceDomBuilder(domMapping, null, getSourceEditor(), pageContext);
- VpeVisualDomBuilder visualBuilder = new VpePreviewDomBuilder(domMapping, null, this, pageContext);
- pageContext.setSourceBuilder(sourceBuilder);
- pageContext.setVisualBuilder(visualBuilder);
+ VpeDomMapping domMapping = new VpeDomMapping(getPageContext());
+ VpeSourceDomBuilder sourceBuilder = new VpeSourceDomBuilder(domMapping, null, getTemplateManager(), getSourceEditor(), getPageContext());
+ VpeVisualDomBuilder visualBuilder = new VpePreviewDomBuilder(domMapping, null, getTemplateManager(), this, getPageContext());
+ getPageContext().setSourceDomBuilder(sourceBuilder);
+ getPageContext().setVisualDomBuilder(visualBuilder);
IDOMModel sourceModel = (IDOMModel)getSourceEditor().getModel();
setSourceDocument(sourceModel.getDocument());
@@ -182,7 +181,7 @@
/**
* @return the sourceDocument
*/
- public IDOMDocument getSourceDocument() {
+ protected IDOMDocument getSourceDocument() {
return sourceDocument;
}
@@ -193,15 +192,27 @@
this.sourceDocument = sourceDocument;
}
- public IVisualContext getPageContext() {
- IVisualContext visualContext = null;
- if (sourceEditor instanceof IJSPTextEditor) {
- visualContext = ((IJSPTextEditor)sourceEditor).getPageContext();
- }
- return visualContext;
+
+
+ /**
+ * @return the pageContext
+ */
+ private VpePageContext getPageContext() {
+ return pageContext;
}
+
+
/**
+ * @param pageContext the pageContext to set
+ */
+ private void setPageContext(VpePageContext pageContext) {
+ this.pageContext = pageContext;
+ }
+
+
+
+ /**
* @return the editPart
*/
private VpeEditorPart getEditPart() {
@@ -209,6 +220,7 @@
}
+
/**
* @param editPart the editPart to set
*/
@@ -216,13 +228,35 @@
this.editPart = editPart;
}
+
+
/**
+ * @return the templateManager
+ */
+ private VpeTemplateManager getTemplateManager() {
+ return templateManager;
+ }
+
+
+
+ /**
+ * @param templateManager the templateManager to set
+ */
+ private void setTemplateManager(VpeTemplateManager templateManager) {
+ this.templateManager = templateManager;
+ }
+
+
+
+ /**
* @return the sourceEditor
*/
private StructuredTextEditor getSourceEditor() {
return sourceEditor;
}
+
+
/**
* @param sourceEditor the sourceEditor to set
*/
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/dnd/VpeDnd.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/dnd/VpeDnd.java 2007-12-20 18:14:12 UTC (rev 5413)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/dnd/VpeDnd.java 2007-12-20 19:20:25 UTC (rev 5414)
@@ -12,7 +12,6 @@
import java.util.HashSet;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
import org.jboss.tools.vpe.editor.VpeSourceInnerDragInfo;
import org.jboss.tools.vpe.editor.VpeSourceInnerDropInfo;
import org.jboss.tools.vpe.editor.context.VpePageContext;
@@ -105,7 +104,7 @@
}
public boolean isDropEnabled(VpePageContext pageContext, Node container, Node node){
- if(!VpePreference.isAbsolutePosition() && isAncestor(container, node)) return false;
+ if(!pageContext.isAbsolutePosition() && isAncestor(container, node)) return false;
if(isContainer){
if(enabledTags != null && enabledTags.size() > 0){
String name = node.getNodeType() == Node.ELEMENT_NODE ? node.getLocalName().toLowerCase() : node.getNodeName();
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java 2007-12-20 18:14:12 UTC (rev 5413)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java 2007-12-20 19:20:25 UTC (rev 5414)
@@ -33,8 +33,6 @@
import org.jboss.tools.jst.web.tld.IFilePathEncoder;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.css.AbsoluteFolderReferenceList;
-import org.jboss.tools.vpe.editor.css.RelativeFolderReferenceList;
import org.jboss.tools.vpe.editor.css.ResourceReference;
import org.w3c.dom.Node;
@@ -88,10 +86,10 @@
if (null != file) {
ResourceReference resourceReference = null;
if ("/".equals(tagValue.substring(0, 1))) {
- resourceReference = getRuntimeAbsoluteFolder(file);
+ resourceReference = pageContext.getRuntimeAbsoluteFolder(file);
tagValue = tagValue.substring(1);
} else {
- resourceReference = getRuntimeRelativeFolder(file);
+ resourceReference = pageContext.getRuntimeRelativeFolder(file);
}
String location = null;
@@ -115,22 +113,6 @@
return new VpeValue(getUnresolved());
}
- public static ResourceReference getRuntimeRelativeFolder(IFile file) {
- ResourceReference[] list = RelativeFolderReferenceList.getInstance().getAllResources(file);
- if (list.length > 0) {
- return list[list.length - 1];
- }
- return null;
- }
-
- public static ResourceReference getRuntimeAbsoluteFolder(IFile file) {
- ResourceReference[] list = AbsoluteFolderReferenceList.getInstance().getAllResources(file);
- if (list.length > 0) {
- return list[list.length - 1];
- }
- return null;
- }
-
protected IPath getInputParentPath(IEditorInput input) {
IPath inputPath = null;
if (input instanceof ILocationProvider) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/resize/VpeResizer.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/resize/VpeResizer.java 2007-12-20 18:14:12 UTC (rev 5413)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/resize/VpeResizer.java 2007-12-20 19:20:25 UTC (rev 5414)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.vpe.editor.template.resize;
-import org.jboss.tools.jst.jsp.preferences.VpePreference;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeTagDescription;
@@ -96,7 +95,7 @@
*/
public void resize(VpePageContext pageContext, Element sourceElement, nsIDOMDocument visualDocument, nsIDOMElement visualElement, Object data, int resizeConstrant, int top, int left, int width, int height) {
pageContext.getEditPart().getSourceEditor().getTextViewer().getUndoManager().beginCompoundChange();
- if (VpePreference.isAbsolutePosition() && (
+ if (pageContext.isAbsolutePosition() && (
resizeConstrant == VpeTagDescription.RESIZE_CONSTRAINS_BOTTOMLEFT||
resizeConstrant == VpeTagDescription.RESIZE_CONSTRAINS_LEFT||
resizeConstrant == VpeTagDescription.RESIZE_CONSTRAINS_TOPLEFT||
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/FormatControllerManager.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/FormatControllerManager.java 2007-12-20 18:14:12 UTC (rev 5413)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/FormatControllerManager.java 2007-12-20 19:20:25 UTC (rev 5414)
@@ -82,7 +82,7 @@
ElementImpl elementImpl = (ElementImpl)newNode;
int startOffset = elementImpl.getStartOffset();
int startEndOffset = elementImpl.getStartEndOffset();
- StructuredTextViewer viewer = getVpeController().getSourceBuilder().getStructuredTextViewer();
+ StructuredTextViewer viewer = getVpeController().getPageContext().getSourceBuilder().getStructuredTextViewer();
try {
String newSelectedTagValue = viewer.getDocument().get(startOffset, startEndOffset-startOffset);
if(currentSelectedTagValue!=null && currentSelectedTagValue.equals(newSelectedTagValue)) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/BlockFormatHandler.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/BlockFormatHandler.java 2007-12-20 18:14:12 UTC (rev 5413)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/BlockFormatHandler.java 2007-12-20 19:20:25 UTC (rev 5414)
@@ -47,7 +47,7 @@
Node selectedNode = manager.getCurrentSelectedNodeInfo().getNode();
- StructuredTextViewer viewer = manager.getVpeController().getSourceBuilder().getStructuredTextViewer();
+ StructuredTextViewer viewer = manager.getVpeController().getPageContext().getSourceBuilder().getStructuredTextViewer();
Node replacedNode = null;
Node parentNode = selectedNode.getParentNode();
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/SimpleTagHandler.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/SimpleTagHandler.java 2007-12-20 18:14:12 UTC (rev 5413)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/toolbar/format/handler/SimpleTagHandler.java 2007-12-20 19:20:25 UTC (rev 5414)
@@ -33,7 +33,7 @@
* @see org.jboss.tools.vpe.editor.toolbar.format.handler.FormatHandler#run()
*/
protected void run() {
- StructuredTextViewer viewer = manager.getVpeController().getSourceBuilder().getStructuredTextViewer();
+ StructuredTextViewer viewer = manager.getVpeController().getPageContext().getSourceBuilder().getStructuredTextViewer();
Node selectedNode = manager.getCurrentSelectedNodeInfo().getNode();
if(selectedNode==null) {
return;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java 2007-12-20 18:14:12 UTC (rev 5413)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/selbar/SelectionBar.java 2007-12-20 19:20:25 UTC (rev 5414)
@@ -286,9 +286,9 @@
}
private void setSourceFocus(int offset) {
- vpeController.getSourceBuilder()
+ vpeController.getPageContext().getSourceBuilder()
.getStructuredTextViewer().setSelectedRange(offset, 0);
- vpeController.getSourceBuilder()
+ vpeController.getPageContext().getSourceBuilder()
.getStructuredTextViewer().revealRange(offset, 0);
}
18 years, 3 months
JBoss Tools SVN: r5413 - trunk/common/plugins/org.jboss.tools.common.text.ext.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2007-12-20 13:14:12 -0500 (Thu, 20 Dec 2007)
New Revision: 5413
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/plugin.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-574 OpenOn don't work in JSF and Struts web.xml
This fixes the issue for servlet version 2.5
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/plugin.xml 2007-12-20 18:14:05 UTC (rev 5412)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/plugin.xml 2007-12-20 18:14:12 UTC (rev 5413)
@@ -26,6 +26,9 @@
<contentType id="org.eclipse.jst.j2ee.webDD">
<partitionType id="org.eclipse.wst.xml.XML_DEFAULT"/>
</contentType>
+ <contentType id="org.eclipse.jst.jee.ee5webDD">
+ <partitionType id="org.eclipse.wst.xml.XML_DEFAULT"/>
+ </contentType>
<contentType id="org.eclipse.core.runtime.xml">
<partitionType id="org.eclipse.wst.xml.XML_DEFAULT"/>
</contentType>
@@ -66,6 +69,9 @@
<contentType id="org.eclipse.jst.j2ee.webDD">
<partitionType id="org.jboss.tools.common.text.ext.xml.XML_ROOT" />
</contentType>
+ <contentType id="org.eclipse.jst.jee.ee5webDD">
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_ROOT"/>
+ </contentType>
<contentType id="org.jboss.tools.common.model.ui.xml">
<partitionType id="org.jboss.tools.common.text.ext.xml.XML_ROOT" />
</contentType>
@@ -89,6 +95,9 @@
<contentType id="org.eclipse.jst.j2ee.webDD">
<partitionType id="org.jboss.tools.common.text.ext.xml.XML_ROOT" />
</contentType>
+ <contentType id="org.eclipse.jst.jee.ee5webDD">
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_ROOT"/>
+ </contentType>
<contentType id="org.jboss.tools.common.model.ui.xml">
<partitionType id="org.jboss.tools.common.text.ext.xml.XML_ROOT" />
</contentType>
@@ -112,9 +121,12 @@
<contentType id="org.eclipse.jst.j2ee.webDD">
<partitionType id="org.jboss.tools.common.text.ext.xml.XML_ROOT" />
</contentType>
- <contentType id="org.jboss.tools.common.model.ui.xml">
+ <contentType id="org.eclipse.jst.jee.ee5webDD">
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_ROOT"/>
+ </contentType>
+ <contentType id="org.jboss.tools.common.model.ui.xml">
<partitionType id="org.jboss.tools.common.text.ext.xml.XML_ROOT" />
- </contentType>
+ </contentType>
</hyperlinkPartitioner>
<hyperlinkPartitioner
@@ -135,9 +147,12 @@
<contentType id="org.eclipse.jst.j2ee.webDD">
<partitionType id="org.jboss.tools.common.text.ext.xml.XML_ELEMENT" />
</contentType>
- <contentType id="org.jboss.tools.common.model.ui.xml">
- <partitionType id="org.jboss.tools.common.text.ext.xml.XML_ELEMENT" />
- </contentType>
+ <contentType id="org.eclipse.jst.jee.ee5webDD">
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_ROOT"/>
+ </contentType>
+ <contentType id="org.jboss.tools.common.model.ui.xml">
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_ELEMENT" />
+ </contentType>
</hyperlinkPartitioner>
<hyperlinkPartitioner
@@ -158,9 +173,12 @@
<contentType id="org.eclipse.jst.j2ee.webDD">
<partitionType id="org.jboss.tools.common.text.ext.xml.XML_ELEMENT" />
</contentType>
- <contentType id="org.jboss.tools.common.model.ui.xml">
- <partitionType id="org.jboss.tools.common.text.ext.xml.XML_ELEMENT" />
- </contentType>
+ <contentType id="org.eclipse.jst.jee.ee5webDD">
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_ROOT"/>
+ </contentType>
+ <contentType id="org.jboss.tools.common.model.ui.xml">
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_ELEMENT" />
+ </contentType>
</hyperlinkPartitioner>
<hyperlinkPartitioner
@@ -188,6 +206,10 @@
<partitionType id="org.jboss.tools.common.text.ext.xml.XML_ATTRIBUTE_VALUE">
</partitionType>
</contentType>
+ <contentType id="org.eclipse.jst.jee.ee5webDD">
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_ATTRIBUTE_VALUE"/>
+ </contentType>
+
<contentType id="org.jboss.tools.common.model.ui.xml">
<partitionType id="org.jboss.tools.common.text.ext.xml.XML_ATTRIBUTE_VALUE" />
</contentType>
@@ -441,6 +463,18 @@
<!-- Web.xml -->
</partitionType>
</contentType>
+ <contentType id="org.eclipse.jst.jee.ee5webDD">
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_TEXT">
+ <!-- Web.xml -->
+ <axis path="/web-app/env-entry/env-entry-type/" />
+ <axis path="/web-app/error-page/exception-type/" />
+ <axis path="/web-app/filter/filter-class/" />
+ <axis path="/web-app/servlet/servlet-class/" />
+ <axis path="/web-app/listener/listener-class/" />
+ <axis path="/web-app/resource-env-ref/resource-env-ref-type/" />
+ <!-- Web.xml -->
+ </partitionType>
+ </contentType>
<contentType id="org.jboss.tools.common.model.ui.xml">
<partitionType id="org.jboss.tools.common.text.ext.xml.XML_TEXT">
<!-- Web.xml -->
@@ -486,6 +520,11 @@
<axis path="/web-app/filter-mapping/filter-name/" />
</partitionType>
</contentType>
+ <contentType id="org.eclipse.jst.jee.ee5webDD">
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_TEXT">
+ <axis path="/web-app/filter-mapping/filter-name/" />
+ </partitionType>
+ </contentType>
<contentType id="org.jboss.tools.common.model.ui.xml">
<partitionType id="org.jboss.tools.common.text.ext.xml.XML_TEXT">
<axis path="/web-app/filter-mapping/filter-name/" />
@@ -514,6 +553,13 @@
<axis path="/web-app/servlet-mapping/servlet-name/" />
</partitionType>
</contentType>
+ <contentType id="org.eclipse.jst.jee.ee5webDD">
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_TEXT">
+ <axis path="/web-app/filter-mapping/servlet-name/" />
+ <axis path="/web-app/servlet-mapping/servlet-name/" />
+ </partitionType>
+ </contentType>
+
<contentType id="org.jboss.tools.common.model.ui.xml">
<partitionType id="org.jboss.tools.common.text.ext.xml.XML_TEXT">
<axis path="/web-app/filter-mapping/servlet-name/" />
@@ -546,6 +592,14 @@
<axis path="/web-app/security-constraint/auth-constraint/role-name/" />
</partitionType>
</contentType>
+ <contentType id="org.eclipse.jst.jee.ee5webDD">
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_TEXT">
+ <axis path="/web-app/servlet/security-role-ref/role-link/" />
+ <axis path="/web-app/servlet/run-as/role-name/" />
+ <axis path="/web-app/security-constraint/auth-constraint/role-name/" />
+ </partitionType>
+ </contentType>
+
<contentType id="org.jboss.tools.common.model.ui.xml">
<partitionType id="org.jboss.tools.common.text.ext.xml.XML_TEXT">
<axis path="/web-app/servlet/security-role-ref/role-link/" />
@@ -607,6 +661,10 @@
<contenttypeidentifier id="org.eclipse.jst.j2ee.webDD">
<partitiontype id="org.jboss.tools.common.text.ext.xml.XML_DOCTYPE" />
</contenttypeidentifier>
+ <contenttypeidentifier id="org.eclipse.jst.jee.ee5webDD">
+ <partitiontype id="org.jboss.tools.common.text.ext.xml.XML_DOCTYPE" />
+ </contenttypeidentifier>
+
<contenttypeidentifier id="org.jboss.tools.common.model.ui.xml">
<partitiontype id="org.jboss.tools.common.text.ext.xml.XML_DOCTYPE" />
</contenttypeidentifier>
@@ -689,6 +747,9 @@
<contenttypeidentifier id="org.eclipse.jst.j2ee.webDD">
<partitiontype id="org.jboss.tools.common.text.ext.xml.XML_CLASS" />
</contenttypeidentifier>
+ <contenttypeidentifier id="org.eclipse.jst.jee.ee5webDD">
+ <partitiontype id="org.jboss.tools.common.text.ext.xml.XML_CLASS" />
+ </contenttypeidentifier>
<contenttypeidentifier id="org.jboss.tools.common.model.ui.xml">
<partitiontype id="org.jboss.tools.common.text.ext.xml.XML_CLASS" />
</contenttypeidentifier>
@@ -720,6 +781,9 @@
<contenttypeidentifier id="org.eclipse.jst.j2ee.webDD">
<partitiontype id="org.jboss.tools.common.text.ext.xml.XML_XMLNS" />
</contenttypeidentifier>
+ <contenttypeidentifier id="org.eclipse.jst.jee.ee5webDD">
+ <partitiontype id="org.jboss.tools.common.text.ext.xml.XML_XMLNS" />
+ </contenttypeidentifier>
<contenttypeidentifier id="org.jboss.tools.common.model.ui.xml">
<partitiontype id="org.jboss.tools.common.text.ext.xml.XML_XMLNS" />
</contenttypeidentifier>
@@ -739,6 +803,9 @@
<contenttypeidentifier id="org.eclipse.jst.j2ee.webDD">
<partitiontype id="org.jboss.tools.common.text.ext.xml.XML_FILTER_NAME" />
</contenttypeidentifier>
+ <contenttypeidentifier id="org.eclipse.jst.jee.ee5webDD">
+ <partitiontype id="org.jboss.tools.common.text.ext.xml.XML_FILTER_NAME" />
+ </contenttypeidentifier>
<contenttypeidentifier id="org.jboss.tools.common.model.ui.xml">
<partitiontype id="org.jboss.tools.common.text.ext.xml.XML_FILTER_NAME" />
</contenttypeidentifier>
@@ -756,6 +823,9 @@
<contenttypeidentifier id="org.eclipse.jst.j2ee.webDD">
<partitiontype id="org.jboss.tools.common.text.ext.xml.XML_ROLE_NAME" />
</contenttypeidentifier>
+ <contenttypeidentifier id="org.eclipse.jst.jee.ee5webDD">
+ <partitiontype id="org.jboss.tools.common.text.ext.xml.XML_ROLE_NAME" />
+ </contenttypeidentifier>
<contenttypeidentifier id="org.jboss.tools.common.model.ui.xml">
<partitiontype id="org.jboss.tools.common.text.ext.xml.XML_ROLE_NAME" />
</contenttypeidentifier>
@@ -773,6 +843,9 @@
<contenttypeidentifier id="org.eclipse.jst.j2ee.webDD">
<partitiontype id="org.jboss.tools.common.text.ext.xml.XML_SERVLET_NAME" />
</contenttypeidentifier>
+ <contenttypeidentifier id="org.eclipse.jst.jee.ee5webDD">
+ <partitiontype id="org.jboss.tools.common.text.ext.xml.XML_SERVLET_NAME" />
+ </contenttypeidentifier>
<contenttypeidentifier id="org.jboss.tools.common.model.ui.xml">
<partitiontype id="org.jboss.tools.common.text.ext.xml.XML_SERVLET_NAME" />
</contenttypeidentifier>
18 years, 3 months
JBoss Tools SVN: r5412 - trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2007-12-20 13:14:05 -0500 (Thu, 20 Dec 2007)
New Revision: 5412
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/plugin.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-574 OpenOn don't work in JSF and Struts web.xml
This fixes the issue for servlet version 2.5
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/plugin.xml 2007-12-20 18:13:58 UTC (rev 5411)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/plugin.xml 2007-12-20 18:14:05 UTC (rev 5412)
@@ -110,6 +110,23 @@
<!-- Web.xml -->
</partitionType>
</contentType>
+ <contentType id="org.eclipse.jst.jee.ee5webDD">
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_TEXT">
+ <!-- Web.xml -->
+ <axis path="/web-app/error-page/location/" />
+ <axis path="/web-app/login-config/form-login-config/form-error-page/" />
+ <axis path="/web-app/login-config/form-login-config/form-login-page/" />
+ <axis path="/web-app/servlet/jsp-file/" />
+ <axis path="/web-app/error-page/location/" />
+ <axis path="/web-app/*/icon/large-icon/" />
+ <axis path="/web-app/*/icon/small-icon/" />
+ <axis path="/web-app/taglib/taglib-location/" />
+ <axis path="/web-app/error-page/location/" />
+ <axis path="/web-app/error-page/location/" />
+ <axis path="/web-app/error-page/location/" />
+ <!-- Web.xml -->
+ </partitionType>
+ </contentType>
</hyperlinkPartitioner>
<hyperlinkPartitioner
@@ -135,6 +152,11 @@
<axis path="/web-app/context-param/param-value/" />
</partitionType>
</contentType>
+ <contentType id="org.eclipse.jst.jee.ee5webDD">
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_TEXT">
+ <axis path="/web-app/context-param/param-value/" />
+ </partitionType>
+ </contentType>
</hyperlinkPartitioner>
<hyperlinkPartitioner
@@ -975,6 +997,10 @@
<contenttypeidentifier id="org.eclipse.jst.j2ee.webDD">
<partitiontype id="org.jboss.tools.common.text.ext.xml.JSF_XML_CONTEXT_PARAM_LINK" />
</contenttypeidentifier>
+ <contenttypeidentifier id="org.eclipse.jst.jee.ee5webDD">
+ <partitiontype id="org.jboss.tools.common.text.ext.xml.JSF_XML_CONTEXT_PARAM_LINK" />
+ </contenttypeidentifier>
+
</hyperlink>
<!-- Web.inf File -->
@@ -996,6 +1022,9 @@
<contenttypeidentifier id="org.eclipse.jst.j2ee.webDD">
<partitiontype id="org.jboss.tools.common.text.ext.xml.JSF_XML_LINK" />
</contenttypeidentifier>
+ <contenttypeidentifier id="org.eclipse.jst.jee.ee5webDD">
+ <partitiontype id="org.jboss.tools.common.text.ext.xml.JSF_XML_LINK" />
+ </contenttypeidentifier>
</hyperlink>
<hyperlink
@@ -1016,6 +1045,9 @@
<contenttypeidentifier id="org.eclipse.jst.j2ee.webDD">
<partitiontype id="org.jboss.tools.common.text.ext.xml.XML_PROPERTY" />
</contenttypeidentifier>
+ <contenttypeidentifier id="org.eclipse.jst.jee.ee5webDD">
+ <partitiontype id="org.jboss.tools.common.text.ext.xml.XML_PROPERTY" />
+ </contenttypeidentifier>
</hyperlink>
<hyperlink
@@ -1036,6 +1068,9 @@
<contenttypeidentifier id="org.eclipse.jst.j2ee.webDD">
<partitiontype id="org.jboss.tools.common.text.ext.xml.XML_RENDER_KIT" />
</contenttypeidentifier>
+ <contenttypeidentifier id="org.eclipse.jst.jee.ee5webDD">
+ <partitiontype id="org.jboss.tools.common.text.ext.xml.XML_RENDER_KIT" />
+ </contenttypeidentifier>
</hyperlink>
<hyperlink
@@ -1089,6 +1124,9 @@
<contenttypeidentifier id="org.eclipse.jst.j2ee.webDD">
<partitiontype id="org.jboss.tools.common.text.ext.xml.XML_BUNDLE_BASENAME" />
</contenttypeidentifier>
+ <contenttypeidentifier id="org.eclipse.jst.jee.ee5webDD">
+ <partitiontype id="org.jboss.tools.common.text.ext.xml.XML_BUNDLE_BASENAME" />
+ </contenttypeidentifier>
</hyperlink>
<hyperlink
@@ -1137,6 +1175,9 @@
<contenttypeidentifier id="org.eclipse.jst.j2ee.webDD">
<partitiontype id="org.jboss.tools.common.text.ext.xml.XML_CONVERTER" />
</contenttypeidentifier>
+ <contenttypeidentifier id="org.eclipse.jst.jee.ee5webDD">
+ <partitiontype id="org.jboss.tools.common.text.ext.xml.XML_CONVERTER" />
+ </contenttypeidentifier>
</hyperlink>
<hyperlink
18 years, 3 months
JBoss Tools SVN: r5411 - trunk/struts/plugins/org.jboss.tools.struts.text.ext.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2007-12-20 13:13:58 -0500 (Thu, 20 Dec 2007)
New Revision: 5411
Modified:
trunk/struts/plugins/org.jboss.tools.struts.text.ext/plugin.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-574 OpenOn don't work in JSF and Struts web.xml
This fixes the issue for servlet version 2.5
Modified: trunk/struts/plugins/org.jboss.tools.struts.text.ext/plugin.xml
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.text.ext/plugin.xml 2007-12-20 17:41:54 UTC (rev 5410)
+++ trunk/struts/plugins/org.jboss.tools.struts.text.ext/plugin.xml 2007-12-20 18:13:58 UTC (rev 5411)
@@ -79,6 +79,21 @@
<!-- Web.xml -->
</partitionType>
</contentType>
+ <contentType id="org.eclipse.jst.jee.ee5webDD">
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_TEXT">
+ <!-- Web.xml -->
+ <axis path="/web-app/error-page/location/" />
+ <axis path="/web-app/login-config/form-login-config/form-error-page/" />
+ <axis path="/web-app/login-config/form-login-config/form-login-page/" />
+ <axis path="/web-app/servlet/jsp-file/" />
+ <axis path="/web-app/*/icon/large-icon/" />
+ <axis path="/web-app/*/icon/small-icon/" />
+ <axis path="/web-app/taglib/taglib-location/" />
+ <axis path="/web-app/jsp-config/taglib/taglib-location/" />
+ <axis path="/web-app/welcome-file-list/welcome-file/" />
+ <!-- Web.xml -->
+ </partitionType>
+ </contentType>
</hyperlinkPartitioner>
<hyperlinkPartitioner
@@ -380,6 +395,11 @@
<axis path="/web-app/servlet/init-param/param-value/" />
</partitionType>
</contentType>
+ <contentType id="org.eclipse.jst.jee.ee5webDD">
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_TEXT">
+ <axis path="/web-app/servlet/init-param/param-value/" />
+ </partitionType>
+ </contentType>
</hyperlinkPartitioner>
<hyperlinkPartitioner
@@ -1338,6 +1358,9 @@
<contenttypeidentifier id="org.eclipse.jst.j2ee.webDD">
<partitiontype id="org.jboss.tools.common.text.ext.xml.STRUTS_XML_CONTEXT_PARAM_LINK" />
</contenttypeidentifier>
+ <contenttypeidentifier id="org.eclipse.jst.jee.ee5webDD">
+ <partitiontype id="org.jboss.tools.common.text.ext.xml.STRUTS_XML_CONTEXT_PARAM_LINK" />
+ </contenttypeidentifier>
</hyperlink>
<!-- Web.inf File -->
18 years, 3 months
JBoss Tools SVN: r5410 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/jst/web/tld.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2007-12-20 12:41:54 -0500 (Thu, 20 Dec 2007)
New Revision: 5410
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/jst/web/tld/VpeTaglibManager.java
Log:
code revert for http://jira.jboss.com/jira/browse/JBIDE-1457 & http://jira.jboss.com/jira/browse/JBIDE-788
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/jst/web/tld/VpeTaglibManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/jst/web/tld/VpeTaglibManager.java 2007-12-20 17:41:46 UTC (rev 5409)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/jst/web/tld/VpeTaglibManager.java 2007-12-20 17:41:54 UTC (rev 5410)
@@ -11,7 +11,6 @@
package org.jboss.tools.jst.web.tld;
import java.util.List;
-import java.util.Map;
/**
@@ -36,18 +35,4 @@
* @return
*/
public List<TaglibData> getTagLibs();
-
- /**
- * Return template taglib prefix using prefix as a key.
- * @return
- */
- public String getTemplateTaglibPrefix(String sourceTaglibPrefix);
-
- /**
- * This is a way to use templateTaglibs from
- * org.jboss.tools.vpe.editor.template.VpeTemplateManager;
- * this is just reference to VpeTemplateManager.templateTaglibs
- * getter is prohibited here
- **/
- public void setTemplateTaglibs(Map<String,String> templateTaglibs);
}
\ No newline at end of file
18 years, 3 months
JBoss Tools SVN: r5409 - in trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor: template and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2007-12-20 12:41:46 -0500 (Thu, 20 Dec 2007)
New Revision: 5409
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpePreviewDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSelectionBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSourceDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualKeyHandler.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeBreackerHelper.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeLoadBundleCreator.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java
Log:
code revert for http://jira.jboss.com/jira/browse/JBIDE-1457 & http://jira.jboss.com/jira/browse/JBIDE-788
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2007-12-20 17:41:29 UTC (rev 5408)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2007-12-20 17:41:46 UTC (rev 5409)
@@ -89,7 +89,6 @@
import org.jboss.tools.common.model.util.ModelFeatureFactory;
import org.jboss.tools.common.model.util.XModelTreeListenerSWTSync;
import org.jboss.tools.jst.jsp.editor.IJSPTextEditor;
-import org.jboss.tools.jst.jsp.editor.IVisualContext;
import org.jboss.tools.jst.jsp.editor.IVisualController;
import org.jboss.tools.jst.jsp.preferences.VpePreference;
import org.jboss.tools.jst.web.tld.TLDToPaletteHelper;
@@ -159,6 +158,7 @@
// TODO Max Areshkau figure out with nsISelectionController
private VpeSelectionController visualSelectionController;
VpeDomMapping domMapping;
+ private VpeTemplateManager templateManager;
private VpeSourceDomBuilder sourceBuilder;
public VpeVisualDomBuilder visualBuilder;
private VpeSelectionBuilder selectionBuilder;
@@ -202,17 +202,15 @@
}
this.visualEditor = visualEditor;
visualEditor.setController(this);
+ templateManager = VpeTemplateManager.getInstance();
bundle = new BundleMap();
bundle.init(sourceEditor);
- pageContext = new VpePageContext(bundle, editPart);
- // vitali - temp solution
- pageContext.setVisualContext(getPageContext());
-
+ pageContext = new VpePageContext(templateManager, bundle, editPart);
domMapping = new VpeDomMapping(pageContext);
- sourceBuilder = new VpeSourceDomBuilder(domMapping, this, sourceEditor, pageContext);
- visualBuilder = new VpeVisualDomBuilder(domMapping, this, visualEditor, pageContext);
- pageContext.setSourceBuilder(sourceBuilder);
- pageContext.setVisualBuilder(visualBuilder);
+ sourceBuilder = new VpeSourceDomBuilder(domMapping, this, templateManager, sourceEditor, pageContext);
+ visualBuilder = new VpeVisualDomBuilder(domMapping, this, templateManager, visualEditor, pageContext);
+ pageContext.setSourceDomBuilder(sourceBuilder);
+ pageContext.setVisualDomBuilder(visualBuilder);
IDOMModel sourceModel = (IDOMModel)getModel();
if (sourceModel == null) {
return;
@@ -222,7 +220,6 @@
visualBuilder.refreshExternalLinks();
visualBuilder.buildDom(sourceDocument);
- VpeTemplateManager templateManager = VpeTemplateManager.getInstance();
templateManager.addTemplateListener(this);
xulRunnerEditor = visualEditor.getXulRunnerEditor();
@@ -268,16 +265,15 @@
relativeFolderReferenceListListener = RelativeFolderReferenceList.getInstance();
relativeFolderReferenceListListener.addChangeListener(this);
- //vitali
- //pageContext.fireTaglibsChanged();
+ pageContext.fireTaglibsChanged();
}
public void dispose() {
switcher.destroyActiveEditor();
- VpeTemplateManager templateManager = VpeTemplateManager.getInstance();
- templateManager.removeTemplateListener(this);
-
+ if (templateManager != null) {
+ templateManager.removeTemplateListener(this);
+ }
if (visualBuilder != null) {
visualBuilder.dispose();
visualBuilder = null;
@@ -400,14 +396,10 @@
break;
}
if (visualBuilder.rebuildFlag) {
- //vitali
- //pageContext.fireTaglibsChanged();
- //vitali
- //} else if (pageContext.isTaglibChanged()) {
- } else if (true) {
+ pageContext.fireTaglibsChanged();
+ } else if (pageContext.isTaglibChanged()) {
visualRefreshImpl();
- //vitali
- //pageContext.fireTaglibsChanged();
+ pageContext.fireTaglibsChanged();
}
switcher.stopActiveEditor();
}
@@ -559,8 +551,7 @@
visualBuilder.setSelectionRectangle(null);
IDOMDocument sourceDocument = sourceModel.getDocument();
visualBuilder.rebuildDom(sourceDocument);
- //vitali
- //pageContext.fireTaglibsChanged();
+ pageContext.fireTaglibsChanged();
}
switcher.stopActiveEditor();
}
@@ -698,7 +689,7 @@
return;
}
if (VpeDebug.PRINT_VISUAL_MOUSE_EVENT) {
- System.out.println("<<< mouseUp " + (mouseDownSelectionFlag ? "true" : "false")); //$NON-NLS-1$
+ System.out.println("<<< mouseUp"); //$NON-NLS-1$
}
if (mouseDownSelectionFlag) {
mouseEvent.preventDefault();
@@ -915,9 +906,7 @@
data.setName(actionNode.getNodeName());
}
data = editAnyData(sourceEditor, isCorrectNS, data);
- if (data != null && data.isChanged()) {
- VpeTemplateManager.getInstance().setAnyTemplate(data);
- }
+ if (data != null && data.isChanged()) templateManager.setAnyTemplate(data);
}
});
@@ -1110,8 +1099,7 @@
return;
}
visualRefreshImpl();
- //vitali
- //pageContext.fireTaglibsChanged();
+ pageContext.fireTaglibsChanged();
switcher.stopActiveEditor();
}
@@ -1248,8 +1236,8 @@
}
if (bundle != null) {
bundle.refresh();
- if (getPageContext() != null) {
- getPageContext().refreshBundleValues();
+ if (pageContext != null) {
+ pageContext.refreshBundleValues();
}
}
switcher.stopActiveEditor();
@@ -1259,16 +1247,16 @@
if (includeList.includesRefresh()) {
visualRefresh();
}
- VpeTemplateManager templateManager = VpeTemplateManager.getInstance();
- templateManager.reload();
-
+ if (templateManager != null) {
+ templateManager.reload();
+ }
if (bundle != null) {
bundle.refresh();
- if (getPageContext() != null) {
+ if (pageContext != null) {
if (!switcher.startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
return;
}
- getPageContext().refreshBundleValues();
+ pageContext.refreshBundleValues();
switcher.stopActiveEditor();
}
}
@@ -1654,12 +1642,8 @@
}
}
- public VpeVisualDomBuilder getVisualBuilder(){
- return visualBuilder;
- }
-
public void refreshExternalLinks() {
- getVisualBuilder().refreshExternalLinks();
+ pageContext.getVisualBuilder().refreshExternalLinks();
}
public IPath getPath() {
@@ -1674,7 +1658,7 @@
public void changed(Object source) {
if(cssReferenceListListener == source) {
- getVisualBuilder().refreshExternalLinks();
+ pageContext.getVisualBuilder().refreshExternalLinks();
} else if (absoluteFolderReferenceListListener == source ||
relativeFolderReferenceListListener == source ||
taglibReferenceListListener == source) {
@@ -2175,12 +2159,8 @@
tip = null;
}
- public IVisualContext getPageContext() {
- IVisualContext visualContext = null;
- if (sourceEditor instanceof IJSPTextEditor) {
- visualContext = ((IJSPTextEditor)sourceEditor).getPageContext();
- }
- return visualContext;
+ public VpePageContext getPageContext() {
+ return pageContext;
}
public StructuredTextEditor getSourceEditor() {
@@ -2332,17 +2312,6 @@
public VpeSelectionBuilder getSelectionBuilder() {
return selectionBuilder;
}
-
- /**
- * @return the sourceBuilder
- */
- public VpeSourceDomBuilder getSourceBuilder() {
- return sourceBuilder;
- }
-
- public VpeEditorPart getVpeEditorPart() {
- return editPart;
- }
/**
* @param selectionBuilder the selectionBuilder to set
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeDomBuilder.java 2007-12-20 17:41:29 UTC (rev 5408)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeDomBuilder.java 2007-12-20 17:41:46 UTC (rev 5409)
@@ -20,16 +20,23 @@
public class VpeDomBuilder {
protected VpeDomMapping domMapping;
+
+ protected VpeTemplateManager templateManager;
private INodeAdapter sorceAdapter;
- public VpeDomBuilder(VpeDomMapping domMapping, INodeAdapter sorceAdapter) {
+ public VpeDomBuilder(VpeDomMapping domMapping, INodeAdapter sorceAdapter, VpeTemplateManager templateManager) {
this.domMapping = domMapping;
this.sorceAdapter = sorceAdapter;
+ this.templateManager = templateManager;
}
public VpeDomMapping getDomMapping () {
return domMapping;
}
+
+ public VpeTemplateManager getTemplateManager () {
+ return templateManager;
+ }
public void registerNodes(VpeNodeMapping nodeMapping) {
if (sorceAdapter == null) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2007-12-20 17:41:29 UTC (rev 5408)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2007-12-20 17:41:46 UTC (rev 5409)
@@ -66,11 +66,15 @@
public class VpeEditorPart extends EditorPart implements ITextEditor,
ITextEditorExtension, IReusableEditor, IVisualEditor {
private SashForm container;
+ private StructuredTextEditor sourceEditor = null;
+ private MozillaEditor visualEditor;
private IEditorPart activeEditor;
private XModelTreeListener listener;
XModelObject optionsObject;
private SelectionBar selectionBar = new SelectionBar();
private ActivationListener activationListener = new ActivationListener();
+ private int visualMode = 0;
+ private EditorPart multiPageEditor;
private static final QualifiedName SPLITTER_POSITION_KEY1 = new QualifiedName(
"", "splitter_position1");
private static final QualifiedName SPLITTER_POSITION_KEY2 = new QualifiedName(
@@ -80,27 +84,16 @@
private int controlCount = 0;
- // parent editor
- private EditorPart multiPageEditor;
-
- // 4 tabs - VISUALSOURCE_MODE, VISUAL_MODE, SOURCE_MODE, PREVIEW_MODE
- private int visualMode = 0;
/** default web-browser */
- // visible in Preview tab
private MozillaPreview previewWebBrowser = null;
- // visible in Visual/Source and in Visual tabs
- private MozillaEditor visualEditor = null;
- // visible in Visual/Source and in Source tabs - created in anycase active tab
- private StructuredTextEditor sourceEditor = null;
/** preview content */
- // preview
private Composite previewContent = null;
- // visual
- private Composite visualContent = null;
- // source
- private Composite sourceContent = null;
+ public StructuredTextEditor getSourceEditor() {
+ return sourceEditor;
+ }
+
// returns JSPMultipageEditor for closing by ctrl+F4 and ctrl+shift+F4 keys
public EditorPart getParentEditor() {
return multiPageEditor;
@@ -230,7 +223,7 @@
}
public IAction getAction(String actionID) {
- return getSourceEditor().getAction(actionID);
+ return sourceEditor.getAction(actionID);
}
public VpeEditorPart() {
@@ -257,7 +250,7 @@
public void setInput(IEditorInput input) {
super.setInput(input);
- if (null != visualEditor && visualEditor.getEditorInput() != null
+ if (visualEditor != null && visualEditor.getEditorInput() != null
&& visualEditor.getEditorInput() != getEditorInput()) {
visualEditor.setInput(input);
}
@@ -329,65 +322,80 @@
}
}
- protected void setVisualMode(String showSelBar,
- boolean flagSC, boolean flagVC, boolean flagPC) {
+ Composite sourceContent = null;
+ Composite visualContent = null;
- if (null != selectionBar) {
- if (flagPC) {
- getSourceEditor();
- }
- selectionBar.showBar(showSelBar);
- }
- if (null != sourceContent) {
- sourceContent.setVisible(flagSC);
- //Added by Max Areshkau
- //was fixed bug(border which drawed by iflasher doesn't hide on MACOS when we swith
- // to souce view)
- //if(Platform.getOS().equals(Platform.OS_MACOSX)&&controller!=null) {
- // getVE().getController().visualRefresh();
- //}
- }
- if (null != visualContent) {
- if (flagVC) {
- getVE();
- }
- visualContent.setVisible(flagVC);
- }
- if (null != previewContent) {
- if (flagPC) {
- getWB();
- getWB().rebuildDom();
- }
- previewContent.setVisible(flagPC);
- }
- }
-
public void setVisualMode(int type) {
- String showSelectionBar = VpePreference.SHOW_SELECTION_TAG_BAR.getValue();
+ String showSelectionBar = VpePreference.SHOW_SELECTION_TAG_BAR
+ .getValue();
switch (type) {
case VISUALSOURCE_MODE:
- setVisualMode(showSelectionBar, true, true, false);
+ selectionBar.showBar(showSelectionBar);
+ if (sourceContent != null)
+ sourceContent.setVisible(true);
+ if (visualContent != null)
+ visualContent.setVisible(true);
+ if (previewContent != null) {
+ previewContent.setVisible(false);
+ }
break;
case VISUAL_MODE:
- setVisualMode(showSelectionBar, false, true, false);
+ selectionBar.showBar(showSelectionBar);
+ if (sourceContent != null)
+ sourceContent.setVisible(false);
+ if (visualContent != null)
+ visualContent.setVisible(true);
+ if (previewContent != null) {
+ previewContent.setVisible(false);
+ }
break;
case SOURCE_MODE:
- setVisualMode(showSelectionBar, true, false, false);
+ selectionBar.showBar(showSelectionBar);
+ if (sourceContent != null) {
+ sourceContent.setVisible(true);
+
+ //Added by Max Areshkau
+ //was fixed bug(border which drawed by iflasher doesn't hide on MACOS when we swith
+ // to souce view)
+// if(Platform.getOS().equals(Platform.OS_MACOSX)&&controller!=null) {
+//
+// visualEditor.getController().visualRefresh();
+// }
+ }
+ if (visualContent != null)
+ visualContent.setVisible(false);
+ if (previewContent != null) {
+ previewContent.setVisible(false);
+ }
break;
case PREVIEW_MODE:
- setVisualMode("no", false, false, true);
+ if (selectionBar != null) {
+ selectionBar.showBar("no");
+ }
+ 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) {
visualMode = type;
- if (getVE().getController() != null) {
- getVE().getController().visualRefresh();
- if (type != PREVIEW_MODE) {
- getVE().getController().sourceSelectionChanged();
+ if (visualEditor.getController() != null) {
+ visualEditor.getController().visualRefresh();
+ if(type!=PREVIEW_MODE) {
+ visualEditor.getController().sourceSelectionChanged();
}
}
}
@@ -400,10 +408,10 @@
public void createPartControl(Composite parent) {
controlCount++;
- if (controlCount > 1) {
+ if (controlCount > 1)
return;
- }
// //////////////////////////////////////////////////////////////
+
Composite cmpEdTl = new Composite(parent, SWT.NONE);
GridLayout layoutEdTl = new GridLayout(1, false);
layoutEdTl.verticalSpacing = 0;
@@ -425,21 +433,30 @@
cmpEd.setLayout(layoutEd);
cmpEd.setLayoutData(new GridData(GridData.FILL_BOTH));
// /////////////////////////////////////////////////////////////////
-
container = new SashForm(cmpEd, SWT.VERTICAL);
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
+ sourceContent = new Composite(container, SWT.NONE);
+ 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());
+
// ////////////////////////////////////////////////////
+
selectionBar.createToolBarComposite(cmpEdTl, true);
// ///////////////////////////////////////////////////
-
- getSC();
- getVC();
- getPC();
+ if (sourceEditor == null)
+ sourceEditor = new StructuredTextEditor() {
+ public void safelySanityCheckState(IEditorInput input) {
+ super.safelySanityCheckState(input);
+ }
+ };
int[] weights = loadSplitterPosition();
- if (weights != null) {
+ if (weights != null)
container.setWeights(weights);
- }
container.addWeightsChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
saveSplitterPosition(container.getWeights());
@@ -454,11 +471,106 @@
container.layout();
}
});
- activeEditor = setupSourceEditor();
+ visualEditor = new MozillaEditor();
try {
+ visualEditor.init(getEditorSite(), getEditorInput());
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ }
+
+ previewWebBrowser = new MozillaPreview(this, sourceEditor);
+ try {
+ previewWebBrowser.init(getEditorSite(), getEditorInput());
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ }
+
+ try {
+ sourceEditor.addPropertyListener(new IPropertyListener() {
+ public void propertyChanged(Object source, int propId) {
+ if (propId == IWorkbenchPartConstants.PROP_TITLE) {
+ VpeEditorPart.this.setPartName(sourceEditor.getTitle());
+ }
+ VpeEditorPart.this.firePropertyChange(propId);
+ }
+ });
+ sourceEditor.init(getEditorSite(), getEditorInput());
+
+ if (sourceContent != null) {
+ sourceEditor.createPartControl(sourceContent);
+ }
+ if (visualEditor != null) {
+ visualEditor
+ .setEditorLoadWindowListener(new EditorLoadWindowListener() {
+ public void load() {
+ visualEditor.setEditorLoadWindowListener(null);
+ visualEditor.setController(new VpeController(
+ VpeEditorPart.this));
+ selectionBar.setVpeController(visualEditor.getController());
+ visualEditor.getController().setSelectionBarController(selectionBar);
+ try {
+ visualEditor.getController().init(sourceEditor, visualEditor);
+ } catch (Exception e) {
+ VpePlugin.reportProblem(e);
+ }
+ }
+ });
+ 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() {
+ public void handleEvent(Event event) {
+ if (event.type == SWT.Activate) {
+ if (activeEditor != sourceEditor) {
+ activeEditor = sourceEditor;
+ setFocus();
+ }
+ }
+ }
+ });
+
+ visualContent.addListener(SWT.Activate, new Listener() {
+ public void handleEvent(Event event) {
+ if (event.type == SWT.Activate) {
+ if (visualEditor != null
+ && activeEditor != visualEditor) {
+ activeEditor = visualEditor;
+ setFocus();
+ }
+ }
+ }
+ });
+
+ 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);
+
} catch (Exception e) {
VpePlugin.reportProblem(e);
}
@@ -572,6 +684,9 @@
fIsHandlingActivation = true;
try {
if (sourceEditor != null) {
+ if (visualEditor.getController() != null) {
+ visualEditor.getController().refreshTemplates();
+ }
sourceEditor.safelySanityCheckState(getEditorInput());
}
} finally {
@@ -582,146 +697,7 @@
}
public VpeController getController() {
- return getVE().getController();
+ return visualEditor.getController();
}
- public StructuredTextEditor getSourceEditor() {
- return sourceEditor;
- }
-
- public Composite getSC() {
- if (null != sourceContent) {
- return sourceContent;
- }
- sourceContent = new Composite(container, SWT.NONE);
- sourceContent.setLayout(new FillLayout());
- return sourceContent;
- }
-
- public StructuredTextEditor setupSourceEditor() {
- if (null == sourceEditor) {
- sourceEditor = new StructuredTextEditor() {
- public void safelySanityCheckState(IEditorInput input) {
- super.safelySanityCheckState(input);
- }
- };
- }
- sourceEditor.addPropertyListener(new IPropertyListener() {
- public void propertyChanged(Object source, int propId) {
- if (propId == IWorkbenchPartConstants.PROP_TITLE) {
- VpeEditorPart.this.setPartName(sourceEditor.getTitle());
- }
- VpeEditorPart.this.firePropertyChange(propId);
- }
- });
- try {
- sourceEditor.init(getEditorSite(), getEditorInput());
- } catch (PartInitException e) {
- VpePlugin.reportProblem(e);
- }
- sourceEditor.createPartControl(getSC());
- getSC().addListener(SWT.Activate, new Listener() {
- public void handleEvent(Event event) {
- if (event.type == SWT.Activate) {
- if (activeEditor != sourceEditor) {
- activeEditor = sourceEditor;
- setFocus();
- }
- }
- }
- });
- return sourceEditor;
- }
-
- public Composite getVC() {
- if (null != visualContent) {
- return visualContent;
- }
- visualContent = new Composite(container, SWT.NONE);
- visualContent.setLayout(new FillLayout());
- return visualContent;
- }
-
- public MozillaEditor getVE() {
- if (null != visualEditor) {
- return visualEditor;
- }
- visualEditor = new MozillaEditor();
- try {
- visualEditor.init(getEditorSite(), getEditorInput());
- } catch (Exception e) {
- VpePlugin.reportProblem(e);
- }
- if (null == visualEditor) {
- return visualEditor;
- }
- visualEditor.setEditorLoadWindowListener(new EditorLoadWindowListener() {
- public void load() {
- visualEditor.setEditorLoadWindowListener(null);
- visualEditor.setController(new VpeController(VpeEditorPart.this));
- selectionBar.setVpeController(visualEditor.getController());
- visualEditor.getController().setSelectionBarController(selectionBar);
- try {
- visualEditor.getController().init(sourceEditor, visualEditor);
- } catch (Exception e) {
- VpePlugin.reportProblem(e);
- }
- }
- });
- visualEditor.createPartControl(getVC());
- getVC().addListener(SWT.Activate, new Listener() {
- public void handleEvent(Event event) {
- if (event.type == SWT.Activate) {
- if (null != visualEditor && activeEditor != visualEditor) {
- activeEditor = visualEditor;
- setFocus();
- }
- }
- }
- });
- return visualEditor;
- }
-
- public Composite getPC() {
- if (null != previewContent) {
- return previewContent;
- }
- previewContent = new Composite(container, SWT.NONE);
- previewContent.setLayout(new FillLayout());
- return previewContent;
- }
-
- public MozillaPreview getWB() {
- if (null != previewWebBrowser) {
- return previewWebBrowser;
- }
- previewWebBrowser = new MozillaPreview(this, sourceEditor);
- try {
- previewWebBrowser.init(getEditorSite(), getEditorInput());
- } catch (Exception e) {
- VpePlugin.reportProblem(e);
- }
- if (null == previewWebBrowser) {
- return previewWebBrowser;
- }
- previewWebBrowser.setEditorLoadWindowListener(new EditorLoadWindowListener() {
- public void load() {
- previewWebBrowser.setEditorLoadWindowListener(null);
- previewWebBrowser.buildDom();
- }
- });
- previewWebBrowser.createPartControl(getPC());
- getPC().addListener(SWT.Activate, new Listener() {
- public void handleEvent(Event event) {
- if (event.type == SWT.Activate) {
- if (null != previewWebBrowser && activeEditor != previewWebBrowser) {
- activeEditor = previewWebBrowser;
- setFocus();
- }
- }
- }
- });
- return previewWebBrowser;
- }
-
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpePreviewDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpePreviewDomBuilder.java 2007-12-20 17:41:29 UTC (rev 5408)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpePreviewDomBuilder.java 2007-12-20 17:41:46 UTC (rev 5409)
@@ -50,8 +50,8 @@
* @param visualEditor
* @param pageContext
*/
- public VpePreviewDomBuilder(VpeDomMapping domMapping, INodeAdapter sorceAdapter, MozillaEditor visualEditor, VpePageContext pageContext) {
- super(domMapping, sorceAdapter, visualEditor, pageContext);
+ public VpePreviewDomBuilder(VpeDomMapping domMapping, INodeAdapter sorceAdapter, VpeTemplateManager templateManager, MozillaEditor visualEditor, VpePageContext pageContext) {
+ super(domMapping, sorceAdapter, templateManager, visualEditor, pageContext);
}
@@ -66,14 +66,9 @@
boolean registerFlag = isCurrentMainDocument();
switch (sourceNode.getNodeType()) {
case Node.ELEMENT_NODE:
- /**/
- // vitali TODO: this is wrong temporary way - get rid of it
- //-
Map xmlnsMap = createXmlns((Element)sourceNode);
- /**/
Set ifDependencySet = new HashSet();
getPageContext().setCurrentVisualNode(visualOldContainer);
- VpeTemplateManager templateManager = VpeTemplateManager.getInstance();
VpeTemplate template = templateManager.getTemplate(getPageContext(), (Element)sourceNode, ifDependencySet);
VpeCreationData creationData;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSelectionBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSelectionBuilder.java 2007-12-20 17:41:29 UTC (rev 5408)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSelectionBuilder.java 2007-12-20 17:41:46 UTC (rev 5409)
@@ -69,9 +69,6 @@
}
public void setSelection(nsISelection selection) {
- if (VpeDebug.PRINT_VISUAL_MOUSE_EVENT) {
- System.out.println("VpeSelectionBuilder.setSelection: selection.getIsCollapsed() " + selection.getIsCollapsed());
- }
if (selection.getIsCollapsed()) {
VisualSelectionInfo info = getVisualFocusSelectedInfo(selection);
if (info != null) {
@@ -375,22 +372,12 @@
private Node getSelectedTextOnly(nsIDOMNode element) {
Node selectedText = null;
nsISelection selection = visualSelectionController.getSelection(nsISelectionController.SELECTION_NORMAL);
- if (VpeDebug.PRINT_VISUAL_MOUSE_EVENT) {
- System.out.println("VpeSelectionBuilder.getSelectedTextOnly: selection " +
- (selection) +
- " selection.getIsCollapsed() " +
- (selection.getIsCollapsed()));
- }
if (!selection.getIsCollapsed()) {
nsIDOMNode anchorNode = selection.getAnchorNode();
nsIDOMNode focusNode = selection.getFocusNode();
if (anchorNode != null && anchorNode.getNodeType() == Node.TEXT_NODE && anchorNode.equals(focusNode)) {
nsIDOMNode anchorParent = anchorNode.getParentNode();
if (anchorParent != null) {
- if (VpeDebug.PRINT_VISUAL_MOUSE_EVENT) {
- System.out.println("VpeSelectionBuilder.getSelectedTextOnly: anchorParent.equals(element) " +
- (anchorParent.equals(element)));
- }
if (anchorParent.equals(element)) {
selectedText = domMapping.getSourceNode(anchorNode);
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSourceDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSourceDomBuilder.java 2007-12-20 17:41:29 UTC (rev 5408)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeSourceDomBuilder.java 2007-12-20 17:41:46 UTC (rev 5409)
@@ -28,7 +28,6 @@
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.jboss.tools.vpe.VpeDebug;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
import org.jboss.tools.vpe.editor.mapping.VpeElementMapping;
@@ -37,7 +36,6 @@
import org.jboss.tools.vpe.editor.template.VpeTemplate;
import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
import org.jboss.tools.vpe.editor.util.TextUtil;
-import org.jboss.tools.vpe.editor.util.VpeDebugUtil;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
import org.mozilla.interfaces.nsIDOMNodeList;
@@ -56,8 +54,8 @@
private VpePageContext pageContext;
private StructuredTextEditor sourceEditor;
- public VpeSourceDomBuilder(VpeDomMapping domMapping, INodeAdapter sorceAdapter, StructuredTextEditor sourceEditor, VpePageContext pageContext) {
- super(domMapping, sorceAdapter);
+ public VpeSourceDomBuilder(VpeDomMapping domMapping, INodeAdapter sorceAdapter, VpeTemplateManager templateManager, StructuredTextEditor sourceEditor, VpePageContext pageContext) {
+ super(domMapping, sorceAdapter, templateManager);
this.sourceEditor = sourceEditor;
structuredTextViewer = sourceEditor.getTextViewer();
outline = (IContentOutlinePage)sourceEditor.getAdapter(IContentOutlinePage.class);
@@ -164,10 +162,6 @@
}
void setSelection(Node sourceNode, int offset, int length, boolean innerFlag) {
- if (VpeDebug.PRINT_VISUAL_MOUSE_EVENT) {
- System.out.println("VpeSourceDomBuilder.setSelection: offset " + offset +
- " length " + length + " innerFlag " + innerFlag);
- }
if (sourceNode != null) {
int start = ((IndexedRegion)sourceNode).getStartOffset() + offset;
if (innerFlag && offset == 0 && sourceNode instanceof ElementImpl) {
@@ -225,7 +219,6 @@
Set ifDependencySet = new HashSet();
//VpeVisualDomBuilder visualBuildet =
pageContext.getVisualBuilder();
- VpeTemplateManager templateManager = VpeTemplateManager.getInstance();
VpeTemplate template = templateManager.getTemplate(pageContext, sourceNewElement, ifDependencySet);
registerNodes(new VpeElementMapping(sourceNewElement, (nsIDOMElement)visualNewNode, null, template, ifDependencySet, null));
addChildren(visualNewNode, sourceNewElement);
@@ -386,7 +379,7 @@
return structuredTextViewer;
}
- public Document getSourceDocument() {
+ Document getSourceDocument() {
return sourceDocument;
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2007-12-20 17:41:29 UTC (rev 5408)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2007-12-20 17:41:46 UTC (rev 5409)
@@ -159,8 +159,9 @@
private VpeDnd dropper;
public VpeVisualDomBuilder(VpeDomMapping domMapping,
- INodeAdapter sorceAdapter, MozillaEditor visualEditor, VpePageContext pageContext) {
- super(domMapping, sorceAdapter);
+ INodeAdapter sorceAdapter, VpeTemplateManager templateManager,
+ MozillaEditor visualEditor, VpePageContext pageContext) {
+ super(domMapping, sorceAdapter, templateManager);
this.visualEditor = visualEditor;
xulRunnerEditor = visualEditor.getXulRunnerEditor();
this.visualDocument = visualEditor.getDomDocument();
@@ -185,9 +186,11 @@
if (input instanceof IFileEditorInput) {
IFile file = ((IFileEditorInput) input).getFile();
if (file != null) {
- includeStack.add(new VpeIncludeInfo(null, file, visualEditor.getSourceDocument()));
+ includeStack.add(new VpeIncludeInfo(null, file, pageContext
+ .getSourceBuilder().getSourceDocument()));
}
}
+ pageContext.refreshConnector();
pageContext.installIncludeElements();
addChildren(null, sourceDocument, visualContentArea);
registerNodes(new VpeNodeMapping(sourceDocument, visualContentArea));
@@ -359,14 +362,9 @@
boolean registerFlag = isCurrentMainDocument();
switch (sourceNode.getNodeType()) {
case Node.ELEMENT_NODE:
- /**/
- // vitali TODO: this is wrong temporary way - get rid of it
- //-
Map<?, ?> xmlnsMap = createXmlns((Element) sourceNode);
- /**/
Set<Node> ifDependencySet = new HashSet<Node>();
pageContext.setCurrentVisualNode(visualOldContainer);
- VpeTemplateManager templateManager = VpeTemplateManager.getInstance();
VpeTemplate template = templateManager.getTemplate(pageContext,
(Element) sourceNode, ifDependencySet);
@@ -398,11 +396,7 @@
VpeElementMapping elementMapping = new VpeElementMapping(
(Element) sourceNode, visualNewElement, border,
template, ifDependencySet, creationData.getData());
- /**/
- // vitali TODO: this is wrong temporary way - get rid of it
- //-
elementMapping.setXmlnsMap(xmlnsMap);
- /**/
registerNodes(elementMapping);
}
if (template.isChildren()) {
@@ -682,18 +676,17 @@
}
private void addPseudoElementImpl(nsIDOMNode visualParent) {
- VpeTemplateManager templateManager = VpeTemplateManager.getInstance();
- if (!templateManager.isWithoutPseudoElementContainer(visualParent
- .getNodeName())) {
- if (VpeDebug.VISUAL_ADD_PSEUDO_ELEMENT) {
- System.out.println("-------------------- addPseudoElement: "
- + visualParent.getNodeName());
- }
- nsIDOMElement visualPseudoElement = visualDocument
- .createElement(PSEUDO_ELEMENT);
- visualPseudoElement.setAttribute(PSEUDO_ELEMENT_ATTR, "yes");
- visualParent.appendChild(visualPseudoElement);
- }
+ if (!templateManager.isWithoutPseudoElementContainer(visualParent
+ .getNodeName())) {
+ if (VpeDebug.VISUAL_ADD_PSEUDO_ELEMENT) {
+ System.out.println("-------------------- addPseudoElement: "
+ + visualParent.getNodeName());
+ }
+ nsIDOMElement visualPseudoElement = visualDocument
+ .createElement(PSEUDO_ELEMENT);
+ visualPseudoElement.setAttribute(PSEUDO_ELEMENT_ATTR, "yes");
+ visualParent.appendChild(visualPseudoElement);
+ }
}
public boolean isEmptyElement(nsIDOMNode visualParent) {
@@ -907,11 +900,7 @@
updateElement(sourceElement);
}
}
- /**/
- // vitali TODO: this is wrong temporary way - get rid of it
- //-
setXmlnsAttribute(elementMapping, name, value);
- /**/
template.setAttribute(pageContext, sourceElement,
visualDocument, visualElement, elementMapping
.getData(), name, value);
@@ -1017,11 +1006,7 @@
name, null)) {
updateElement(sourceElement);
} else {
- /**/
- // vitali TODO: this is wrong temporary way - get rid of it
- //-
removeXmlnsAttribute(elementMapping, name);
- /**/
template.removeAttribute(pageContext, sourceElement,
visualDocument, (nsIDOMElement) elementMapping
.getVisualNode(), elementMapping.getData(),
@@ -1887,9 +1872,6 @@
pageContext.dispose();
}
- /**/
- // vitali TODO: this is wrong temporary way - get rid of it
- //-
protected Map createXmlns(Element sourceNode) {
NamedNodeMap attrs = ((Element) sourceNode).getAttributes();
if (attrs != null) {
@@ -1904,11 +1886,7 @@
}
return null;
}
- /**/
- /**/
- // vitali TODO: this is wrong temporary way - get rid of it
- //-
private void setXmlnsAttribute(VpeElementMapping elementMapping,
String name, String value) {
Element sourceElement = (Element) elementMapping.getSourceNode();
@@ -1920,11 +1898,7 @@
elementMapping.setXmlnsMap(xmlnsMap.size() > 0 ? xmlnsMap : null);
}
}
- /**/
- /**/
- // vitali TODO: this is wrong temporary way - get rid of it
- //-
private void removeXmlnsAttribute(VpeElementMapping elementMapping,
String name) {
Element sourceElement = (Element) elementMapping.getSourceNode();
@@ -1941,22 +1915,16 @@
}
}
}
- /**/
- /**/
- // vitali TODO: this is wrong temporary way - get rid of it
- //-
private void addTaglib(Element sourceElement, Map xmlnsMap,
String attrName, boolean ns) {
Attr attr = sourceElement.getAttributeNode(attrName);
if (ATTR_XMLNS.equals(attr.getPrefix())) {
- //vitali
- //xmlnsMap.put(attr.getNodeName(), Integer.valueOf(attr.hashCode()));
+ xmlnsMap.put(attr.getNodeName(), Integer.valueOf(attr.hashCode()));
pageContext.setTaglib(attr.hashCode(), attr.getNodeValue(), attr
.getLocalName(), ns);
}
}
- /**/
/**
* @return the dnd
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualKeyHandler.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualKeyHandler.java 2007-12-20 17:41:29 UTC (rev 5408)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualKeyHandler.java 2007-12-20 17:41:46 UTC (rev 5409)
@@ -113,7 +113,7 @@
case VK_F4:
IWorkbenchPage workbenchPage = VpePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
if(keyEvent.getShiftKey()) workbenchPage.closeAllEditors(true);
- else workbenchPage.closeEditor(getController().getVpeEditorPart().getParentEditor(),true);
+ else workbenchPage.closeEditor(pageContext.getEditPart().getParentEditor(),true);
break;
case VK_HOME:
if (keyEvent.getShiftKey()) {
@@ -379,11 +379,11 @@
if(focusNode.getNodeType() == Node.TEXT_NODE){
IndexedRegion region = (IndexedRegion)focusNode;
try{
- String sourceText = getStructuredTextViewer().getDocument().get(region.getStartOffset(), region.getEndOffset()-region.getStartOffset());
+ String sourceText = sourceEditor.getTextViewer().getDocument().get(region.getStartOffset(), region.getEndOffset()-region.getStartOffset());
String escString = TextUtil.isEcsToRight(sourceText, offset);
if(escString != null){
- Point range = getStructuredTextViewer().getSelectedRange();
- getStructuredTextViewer().getTextWidget().replaceTextRange(range.x, escString.length(), "");
+ Point range = sourceEditor.getTextViewer().getSelectedRange();
+ sourceEditor.getTextViewer().getTextWidget().replaceTextRange(range.x, escString.length(), "");
atLeastOneCharIsDeleted = true;
continue;
}
@@ -410,8 +410,8 @@
while(chars.length > (offset+endPos) && TextUtil.isWhitespace(chars[offset+endPos])){
endPos++;
}
- Point range = getStructuredTextViewer().getSelectedRange();
- getStructuredTextViewer().getTextWidget().replaceTextRange(range.x, endPos, "");
+ Point range = sourceEditor.getTextViewer().getSelectedRange();
+ sourceEditor.getTextViewer().getTextWidget().replaceTextRange(range.x, endPos, "");
selection = sourceSelectionBuilder.getSelection();
atLeastOneCharIsDeleted = true;
break;
@@ -721,12 +721,12 @@
if(focusNode.getNodeType() == Node.TEXT_NODE){
IndexedRegion region = (IndexedRegion)focusNode;
try {
- String sourceText = getStructuredTextViewer().getDocument().get(region.getStartOffset(), region.getEndOffset()-region.getStartOffset());
+ String sourceText = sourceEditor.getTextViewer().getDocument().get(region.getStartOffset(), region.getEndOffset()-region.getStartOffset());
String escString = TextUtil.isEcsToLeft(sourceText,offset);
if(escString != null){
- Point range = getStructuredTextViewer().getSelectedRange();
- getStructuredTextViewer().getTextWidget().replaceTextRange(range.x-escString.length(), escString.length(), "");
+ Point range = sourceEditor.getTextViewer().getSelectedRange();
+ sourceEditor.getTextViewer().getTextWidget().replaceTextRange(range.x-escString.length(), escString.length(), "");
atLeastOneCharIsDeleted = true;
return selection;
@@ -744,8 +744,8 @@
}
endPos--;
if(endPos!=0){
- Point range = getStructuredTextViewer().getSelectedRange();
- getStructuredTextViewer().getTextWidget().replaceTextRange(range.x-endPos, endPos, "");
+ Point range = sourceEditor.getTextViewer().getSelectedRange();
+ sourceEditor.getTextViewer().getTextWidget().replaceTextRange(range.x-endPos, endPos, "");
selection = sourceSelectionBuilder.getSelection();
atLeastOneCharIsDeleted = true;
}
@@ -921,7 +921,7 @@
private boolean isVisualNodeEmpty(Node node) {
try {
nsIDOMNode visualNode = domMapping.getVisualNode(node);
- return getController().getVisualBuilder().isEmptyElement(visualNode);
+ return pageContext.getVisualBuilder().isEmptyElement(visualNode);
} catch (Exception e) {
VpePlugin.getPluginLog().logError(e);
}
@@ -989,18 +989,14 @@
}
}
- private StructuredTextViewer getStructuredTextViewer() {
- return sourceEditor.getTextViewer();
- }
-
private void setSourceFocus(int offset) {
- getStructuredTextViewer().setSelectedRange(offset, 0);
- getStructuredTextViewer().revealRange(offset, 0);
+ pageContext.getSourceBuilder().getStructuredTextViewer().setSelectedRange(offset, 0);
+ pageContext.getSourceBuilder().getStructuredTextViewer().revealRange(offset, 0);
}
private void setSelectionRange(int startOffset, int endOffset) {
- getStructuredTextViewer().setSelectedRange(endOffset, startOffset - endOffset);
- getStructuredTextViewer().revealRange(endOffset, startOffset - endOffset);
+ pageContext.getSourceBuilder().getStructuredTextViewer().setSelectedRange(endOffset, startOffset - endOffset);
+ pageContext.getSourceBuilder().getStructuredTextViewer().revealRange(endOffset, startOffset - endOffset);
}
private void removeNode(Node focusNode) {
@@ -1020,7 +1016,7 @@
if (selection != null) {
Node sourceNode = selection.getFocusNode();
if (sourceNode != null) {
- VpeDomMapping mapping = getController().getDomMapping();
+ VpeDomMapping mapping = pageContext.getDomMapping();
if (mapping != null) {
nsIDOMNode visualNode = mapping.getVisualNode(sourceNode);
if (visualNode != null) {
@@ -1041,11 +1037,11 @@
isEditable = true;
}
if (isEditable) {
- start = getStructuredTextViewer().getSelectedRange().x;
+ start = sourceEditor.getTextViewer().getSelectedRange().x;
}
}
}
- } else if (getController().getSourceBuilder().isEmptyDocument()) {
+ } else if (pageContext.getSourceBuilder().isEmptyDocument()) {
isEditable = true;
start = 0;
}
@@ -1057,9 +1053,9 @@
if(TextUtil.containsKey(s[0])){
str = TextUtil.getValue(s[0]);
}
- getStructuredTextViewer().getTextWidget().replaceTextRange(start, 0, str);
- getStructuredTextViewer().setSelectedRange(start + str.length(), 0);
- getStructuredTextViewer().revealRange(start + str.length(), 0);
+ sourceEditor.getTextViewer().getTextWidget().replaceTextRange(start, 0, str);
+ pageContext.getSourceBuilder().getStructuredTextViewer().setSelectedRange(start + str.length(), 0);
+ pageContext.getSourceBuilder().getStructuredTextViewer().revealRange(start + str.length(), 0);
return true;
}
return false;
@@ -1098,7 +1094,7 @@
}
if (!handled && focusNode.getParentNode().getNodeType() == Node.DOCUMENT_NODE) {
if (focusNode.getNodeType() == Node.TEXT_NODE) {
- Point range = getStructuredTextViewer().getSelectedRange();
+ Point range = sourceEditor.getTextViewer().getSelectedRange();
Node p1 = focusNode.getOwnerDocument().createElement(HTML.TAG_P);
Node p2 = focusNode.getOwnerDocument().createElement(HTML.TAG_P);
Text newNode = ((Text)focusNode).splitText(getSourceNodeOffset(focusNode, range.x));
@@ -1108,7 +1104,7 @@
newNode = (Text)newNode.getParentNode().removeChild(newNode);
p1.appendChild(focusNode);
p2.appendChild(newNode);
- setCursor(newNode);
+ setCursor(pageContext, newNode);
}
}
} else if (focusNode instanceof Comment) {
@@ -1169,7 +1165,7 @@
if (!handled) {
if (focusNode.getNodeType() == Node.TEXT_NODE) {
if (focusNode.getParentNode().getNodeType() == Node.DOCUMENT_NODE) {
- Point range = getStructuredTextViewer().getSelectedRange();
+ Point range = sourceEditor.getTextViewer().getSelectedRange();
Node p1 = focusNode.getOwnerDocument().createElement("p");
Node p2 = focusNode.getOwnerDocument().createElement("p");
Text newNode = ((Text)focusNode).splitText(getSourceNodeOffset(focusNode, range.x));
@@ -1179,7 +1175,7 @@
newNode = (Text)newNode.getParentNode().removeChild(newNode);
p1.appendChild(focusNode);
p2.appendChild(newNode);
- setCursor(newNode);
+ setCursor(pageContext, newNode);
int p1Start = ((IndexedRegion)p1).getStartOffset();
int p2End = ((IndexedRegion)p2).getEndOffset();
@@ -1201,7 +1197,7 @@
Text newNode1 = (Text)focusNode.getParentNode().insertBefore(focusNode.getOwnerDocument().createTextNode("\r\n" + getLinePrefix(n1Start + focusOffset) + newNode.getData()), newNode);
focusNode.getParentNode().removeChild(newNode);
newNode = newNode1;
- setCursor(newNode);
+ setCursor(pageContext, newNode);
int n2End = ((IndexedRegion)newNode).getEndOffset();
region = new Region(n1Start, n2End - n1Start);
}
@@ -1219,10 +1215,10 @@
}
try {
- StructuredTextViewer viewer = getStructuredTextViewer();
+ StructuredTextViewer viewer = sourceEditor.getTextViewer();
if (region != null){
if (sourceEditor instanceof ITextFormatter) {
- ((ITextFormatter)sourceEditor).formatTextRegion(viewer.getDocument(), region);
+ ((ITextFormatter)sourceEditor).formatTextRegion(sourceEditor.getTextViewer().getDocument(), region);
}
}
} catch (Exception x) {
@@ -1235,7 +1231,7 @@
private String getLinePrefix(int offset) {
try {
- final IDocument document = getStructuredTextViewer().getDocument();
+ final IDocument document = sourceEditor.getTextViewer().getDocument();
final int linePrefixBeginning = document.getLineInformationOfOffset(offset).getOffset();
String linePrefix = document.get(linePrefixBeginning, offset - linePrefixBeginning);
int linePrefixLength = 0;
@@ -1323,14 +1319,14 @@
return 0;
}
- private void setCursor(Node node) {
+ private void setCursor(VpePageContext pageContext, Node node) {
int nodeOffset = ((IndexedRegion)node).getStartOffset();
if (node.getNodeType() == Node.ELEMENT_NODE) {
ElementImpl element = (ElementImpl)node;
nodeOffset = element.getStartEndOffset();
}
- getStructuredTextViewer().setSelectedRange(nodeOffset, 0);
- getStructuredTextViewer().revealRange(nodeOffset, 0);
+ pageContext.getSourceBuilder().getStructuredTextViewer().setSelectedRange(nodeOffset, 0);
+ pageContext.getSourceBuilder().getStructuredTextViewer().revealRange(nodeOffset, 0);
}
private boolean moveForward() {
@@ -1340,8 +1336,8 @@
Node node = getNextNode(selection.getStartNode());
if (node != null) {
int nodeOffset = ((IndexedRegion)node).getStartOffset();
- getStructuredTextViewer().setSelectedRange(nodeOffset, 0);
- getStructuredTextViewer().revealRange(nodeOffset, 0);
+ pageContext.getSourceBuilder().getStructuredTextViewer().setSelectedRange(nodeOffset, 0);
+ pageContext.getSourceBuilder().getStructuredTextViewer().revealRange(nodeOffset, 0);
return true;
}
}
@@ -1480,8 +1476,8 @@
Node node = getPrevNode(selection.getStartNode());
if (node != null) {
int nodeOffset = ((IndexedRegion)node).getStartOffset();
- getStructuredTextViewer().setSelectedRange(nodeOffset, 0);
- getStructuredTextViewer().revealRange(nodeOffset, 0);
+ pageContext.getSourceBuilder().getStructuredTextViewer().setSelectedRange(nodeOffset, 0);
+ pageContext.getSourceBuilder().getStructuredTextViewer().revealRange(nodeOffset, 0);
return true;
}
}
@@ -1804,18 +1800,18 @@
}
}
- return nearestElement;
+ return nearestElement;
}
- private VpeController getController() {
- return pageContext.getEditPart().getController();
- }
+
private VpeSelectionBuilder getSelectionBuilder() {
- return getController().getSelectionBuilder();
+
+ return pageContext.getEditPart().getController().getSelectionBuilder();
}
- private nsIDOMElement getSelectedNode() {
- return getController().getXulRunnerEditor().getLastSelectedElement();
+ private nsIDOMElement getSelectedNode() {
+
+ return pageContext.getEditPart().getController().getXulRunnerEditor().getLastSelectedElement();
}
}
\ No newline at end of file
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2007-12-20 17:41:29 UTC (rev 5408)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2007-12-20 17:41:46 UTC (rev 5409)
@@ -340,7 +340,7 @@
case BREAKER_TYPE_IGNORE:
return true;
case BREAKER_TYPE_SELECTITEM:
- return VpeBreackerHelper.selectItem(pageContext.getSourceBuilder(), sourceDocument, sourceNode, visualNode, data, charCode, selection);
+ return VpeBreackerHelper.selectItem(pageContext, sourceDocument, sourceNode, visualNode, data, charCode, selection);
default:
return nonctrlKeyPressHandlerImpl(pageContext, sourceDocument, sourceNode, visualNode, data, charCode, selection, formatter);
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeBreackerHelper.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeBreackerHelper.java 2007-12-20 17:41:29 UTC (rev 5408)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeBreackerHelper.java 2007-12-20 17:41:46 UTC (rev 5409)
@@ -16,14 +16,14 @@
import org.w3c.dom.Document;
import org.w3c.dom.Node;
-import org.jboss.tools.vpe.editor.VpeSourceDomBuilder;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.selection.VpeSourceSelection;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMNode;
public class VpeBreackerHelper {
- public static boolean selectItem(VpeSourceDomBuilder sourceBuilder, Document sourceDocument, Node sourceNode, nsIDOMNode visualNode, Object data, long charCode, VpeSourceSelection selection) {
+ public static boolean selectItem(VpePageContext pageContext, Document sourceDocument, Node sourceNode, nsIDOMNode visualNode, Object data, long charCode, VpeSourceSelection selection) {
Attr attr = selection.getFocusAttribute();
if (attr != null) {
Point range = selection.getFocusAttributeRange();
@@ -43,7 +43,7 @@
if (newAttr != null) {
newAttr.setNodeValue(newAttr.getNodeValue().substring(0, range.x));
}
- sourceBuilder.setAttributeSelection((Attr)attr, 0, 0);
+ pageContext.getSourceBuilder().setAttributeSelection((Attr)attr, 0, 0);
return true;
}
}
@@ -51,7 +51,7 @@
return false;
}
- public static boolean breakInline(VpeSourceDomBuilder sourceBuilder, Document sourceDocument, Node sourceNode, Node visualNode, Object data, int charCode, VpeSourceSelection selection) {
+ public static boolean breakInline(VpePageContext pageContext, Document sourceDocument, Node sourceNode, Node visualNode, Object data, int charCode, VpeSourceSelection selection) {
Attr attr = selection.getFocusAttribute();
if (attr != null) {
Point range = selection.getFocusAttributeRange();
@@ -72,7 +72,7 @@
if (newAttr != null) {
newAttr.setNodeValue(newAttr.getNodeValue().substring(0, range.x));
}
- sourceBuilder.setAttributeSelection((Attr)attr, 0, 0);
+ pageContext.getSourceBuilder().setAttributeSelection((Attr)attr, 0, 0);
}
Node parent = selectItemNode.getParentNode();
if (parent != null) {
@@ -85,7 +85,7 @@
selectItemNode = parent.removeChild(newSelectItemNode);
p2.appendChild(newSelectItemNode);
- sourceBuilder.getStructuredTextViewer()
+ pageContext.getSourceBuilder().getStructuredTextViewer()
.setSelectedRange(((IndexedRegion)p1).getStartOffset(), ((IndexedRegion)p2).getEndOffset() - ((IndexedRegion)p1).getStartOffset());
return true;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java 2007-12-20 17:41:29 UTC (rev 5408)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeHtmlTemplate.java 2007-12-20 17:41:46 UTC (rev 5409)
@@ -307,9 +307,9 @@
private static final String PREFIX_SEPARATOR = ":";
private String getPageLocale(VpePageContext pageContext, IDOMElement sourceElement) {
- try {
- //vitali: temp solution
- List<TaglibData> taglibs = pageContext.getVisualContext().getTagLibs();
+ IStructuredModel model = null;
+ try {
+ List<TaglibData> taglibs = pageContext.getTagLibs();
// Find F tracker
TaglibData fTD = null;
for (int i = 0; i < taglibs.size(); i++) {
@@ -345,6 +345,8 @@
} catch (Exception e) {
VpePlugin.getPluginLog().logError(e);
return null;
+ } finally {
+ if (model != null) model.releaseFromRead();
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeLoadBundleCreator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeLoadBundleCreator.java 2007-12-20 17:41:29 UTC (rev 5408)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeLoadBundleCreator.java 2007-12-20 17:41:46 UTC (rev 5409)
@@ -48,14 +48,12 @@
public void setAttribute(VpePageContext pageContext, Element sourceElement, Map visualNodeMap, String name, String value) {
setBundle(pageContext, sourceElement);
- //vitali: temp solution
- pageContext.getVisualContext().refreshBundleValues();
+ pageContext.refreshBundleValues();
}
public void removeAttribute(VpePageContext pageContext, Element sourceElement, Map visualNodeMap, String name) {
setBundle(pageContext, sourceElement);
- //vitali: temp solution
- pageContext.getVisualContext().refreshBundleValues();
+ pageContext.refreshBundleValues();
}
private void setBundle(VpePageContext pageContext, Element sourceElement) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java 2007-12-20 17:41:29 UTC (rev 5408)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java 2007-12-20 17:41:46 UTC (rev 5409)
@@ -32,7 +32,6 @@
import org.w3c.dom.NodeList;
import org.jboss.tools.common.xml.XMLUtilities;
-import org.jboss.tools.jst.jsp.editor.IVisualContext;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.context.VpePageContext;
@@ -794,8 +793,4 @@
defTemplate.init(createDefTemplateElement(), true);
return defTemplate;
}
-
- public void initVisualContext(IVisualContext visualContext) {
- visualContext.setTemplateTaglibs(templateTaglibs);
- }
}
18 years, 3 months
JBoss Tools SVN: r5408 - in trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp: jspeditor and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2007-12-20 12:41:29 -0500 (Thu, 20 Dec 2007)
New Revision: 5408
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor/IJSPTextEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/VpePreference.java
Log:
code revert for http://jira.jboss.com/jira/browse/JBIDE-1457 & http://jira.jboss.com/jira/browse/JBIDE-788
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor/IJSPTextEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor/IJSPTextEditor.java 2007-12-20 17:41:19 UTC (rev 5407)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor/IJSPTextEditor.java 2007-12-20 17:41:29 UTC (rev 5408)
@@ -19,5 +19,4 @@
public void runDropCommand(String flavor, String data);
public void setVPEController(IVisualController c);
public IVisualController getVPEController();
- public IVisualContext getPageContext();
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2007-12-20 17:41:19 UTC (rev 5407)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2007-12-20 17:41:29 UTC (rev 5408)
@@ -616,9 +616,14 @@
}
public VpeTaglibManager getTaglibManager() {
- sourceEditor.getPageContext();
- if (null != sourceEditor) {
- return sourceEditor.getPageContext();
+ if (visualEditor != null) {
+ IVisualController controller = visualEditor.getController();
+ if (controller != null) {
+ IVisualContext context = controller.getPageContext();
+ if (context != null) {
+ return context;
+ }
+ }
}
return null;
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2007-12-20 17:41:19 UTC (rev 5407)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2007-12-20 17:41:29 UTC (rev 5408)
@@ -78,9 +78,7 @@
import org.eclipse.wst.sse.ui.internal.provisional.extensions.ConfigurationPointCalculator;
import org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration;
import org.eclipse.wst.xml.core.internal.document.AttrImpl;
-import org.eclipse.wst.xml.core.internal.document.DOMModelImpl;
import org.eclipse.wst.xml.core.internal.document.ElementImpl;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.jboss.tools.common.core.resources.XModelObjectEditorInput;
import org.jboss.tools.common.meta.action.XActionInvoker;
import org.jboss.tools.common.model.XModelBuffer;
@@ -111,7 +109,6 @@
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.editor.IJSPTextEditor;
import org.jboss.tools.jst.jsp.editor.ITextFormatter;
-import org.jboss.tools.jst.jsp.editor.IVisualContext;
import org.jboss.tools.jst.jsp.editor.IVisualController;
import org.jboss.tools.jst.jsp.outline.JSPContentOutlineConfiguration;
import org.jboss.tools.jst.jsp.outline.JSPPropertySheetConfiguration;
@@ -126,7 +123,6 @@
import org.w3c.dom.DocumentType;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
/**
@@ -413,9 +409,6 @@
}
public void updateModification() {
- //
- getPageContext().refreshBundleValues();
- //
XModelObject object = getModelObject();
if (object != null && !object.isModified() && isModified()) {
setModified(false);
@@ -608,8 +601,8 @@
}
public VpeTaglibManager getTaglibManager() {
- if (editor != null) {
- return editor.getPageContext();
+ if (provider != null) {
+ return provider.getTaglibManager();
}
return null;
}
@@ -1137,17 +1130,4 @@
}
return false;
}
-
- protected JSPTextEditorPageContext pageContext = null;
-
- public IVisualContext getPageContext() {
- if (null == pageContext) {
- pageContext = new JSPTextEditorPageContext();
- }
- //IDocument document = getTextViewer().getDocument();
- //pageContext.setDocument(document);
- IDOMDocument document = ((DOMModelImpl)getModel()).getDocument();
- pageContext.setDocument(document);
- return pageContext;
- }
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java 2007-12-20 17:41:19 UTC (rev 5407)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java 2007-12-20 17:41:29 UTC (rev 5408)
@@ -38,7 +38,6 @@
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.contentassist.RedHatHtmlContentAssistProcessor;
import org.jboss.tools.jst.jsp.editor.IVisualController;
-import org.jboss.tools.jst.jsp.jspeditor.JSPTextEditorPageContext;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
@@ -78,12 +77,6 @@
public void setTarget(INodeNotifier target) {
if(fNode == target) return;
fNode = (target instanceof Node) ? (Node) target : null;
- // BEGIN
- JSPTextEditorPageContext pageContext = (JSPTextEditorPageContext)valueHelper.getTaglibManager();
- if (null != pageContext) {
- pageContext.setReferenceNode(fNode);
- }
- // END
if (fNode instanceof IDOMNode) {
Document ownerDocument = fNode.getOwnerDocument();
if (ownerDocument == null && fNode instanceof Document) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java 2007-12-20 17:41:19 UTC (rev 5407)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java 2007-12-20 17:41:29 UTC (rev 5408)
@@ -96,8 +96,11 @@
IEditorPart editor = ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
if(!(editor instanceof JSPMultiPageEditor)) return false;
JSPTextEditor jspEditor = ((JSPMultiPageEditor)editor).getJspEditor();
- // vitali: new version - here we use original org.jboss.tools.jst.jsp this plugin page context
- pageContext = jspEditor.getPageContext();
+ IVisualEditor v = ((JSPMultiPageEditor)editor).getVisualEditor();
+ if(v == null) return false;
+ IVisualController c = v.getController();
+ if(c == null) return false;
+ pageContext = c.getPageContext();
editorInput = jspEditor.getEditorInput();
wtpTextJspKbConnector = jspEditor.getWTPTextJspKbConnector();
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/VpePreference.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/VpePreference.java 2007-12-20 17:41:19 UTC (rev 5407)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/VpePreference.java 2007-12-20 17:41:29 UTC (rev 5408)
@@ -39,11 +39,4 @@
protected VpePreference(String optionPath, String attributeName) {
super(optionPath, attributeName);
}
-
- public static boolean isAbsolutePosition() {
- if ("yes".equals(VpePreference.USE_ABSOLUTE_POSITION.getValue())) {
- return true;
- }
- return false;
- }
}
\ No newline at end of file
18 years, 3 months
JBoss Tools SVN: r5407 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2007-12-20 12:41:19 -0500 (Thu, 20 Dec 2007)
New Revision: 5407
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeDefineContainerTemplate.java
Log:
code revert for http://jira.jboss.com/jira/browse/JBIDE-1457 & http://jira.jboss.com/jira/browse/JBIDE-788
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeDefineContainerTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeDefineContainerTemplate.java 2007-12-20 17:36:47 UTC (rev 5406)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeDefineContainerTemplate.java 2007-12-20 17:41:19 UTC (rev 5407)
@@ -99,7 +99,7 @@
Node sourceChild = sourceChildren.item(i);
if (sourceChild.getNodeType() == Node.ELEMENT_NODE && "define".equals(sourceChild.getLocalName())) {
if (template == null) {
- VpeTemplateManager templateManager = VpeTemplateManager.getInstance();
+ VpeTemplateManager templateManager = pageContext.getVisualBuilder().getTemplateManager();
template = templateManager.getTemplate(pageContext, (Element)sourceChild, null);
if (template == null) {
break;
18 years, 3 months
JBoss Tools SVN: r5406 - trunk/seam/plugins/org.jboss.tools.seam.text.ext.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2007-12-20 12:36:47 -0500 (Thu, 20 Dec 2007)
New Revision: 5406
Modified:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-1437 Ctrl+Click/F3 navigation isn't supported for s:button@view and s:link@view attributes
This fix defines a hyperlink partitioner for view attribute of the s:link and s:button tags to process the view attrinute value open-on as jsf-link does.
Modified: trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml 2007-12-20 17:13:13 UTC (rev 5405)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml 2007-12-20 17:36:47 UTC (rev 5406)
@@ -36,6 +36,24 @@
<partitionType id="org.jboss.tools.common.text.ext.xml.XML_TEXT" />
</contentType>
</hyperlinkPartitioner>
+
+ <hyperlinkPartitioner
+ id="org.jboss.tools.seam.text.ext.hyperlink.SeamViewHyperlinkPartitioner"
+ class="org.jboss.tools.jsf.text.ext.hyperlink.JSFJSPLinkHyperlinkPartitioner">
+ <contentType id="org.eclipse.jst.jsp.core.jspsource">
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_ATTRIBUTE_VALUE">
+ <axis path="*/[http://jboss.com/products/seam/taglib]:button/view/" />
+ <axis path="*/[http://jboss.com/products/seam/taglib]:link/view/" />
+ </partitionType>
+ </contentType>
+ <contentType id="org.eclipse.wst.html.core.htmlsource">
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_ATTRIBUTE_VALUE">
+ <axis path="*/[http://jboss.com/products/seam/taglib]:button/view/" />
+ <axis path="*/[http://jboss.com/products/seam/taglib]:link/view/" />
+ </partitionType>
+ </contentType>
+ </hyperlinkPartitioner>
+
</extension>
<extension
18 years, 3 months
JBoss Tools SVN: r5405 - trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2007-12-20 12:13:13 -0500 (Thu, 20 Dec 2007)
New Revision: 5405
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPRootHyperlinkPartitioner.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1435 Ctrl+Click/F3 navigation isn't supported for facelets ui:composition@template and ui:decorate@template attributes
Issue is fixed
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPRootHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPRootHyperlinkPartitioner.java 2007-12-20 16:32:04 UTC (rev 5404)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/jsp/JSPRootHyperlinkPartitioner.java 2007-12-20 17:13:13 UTC (rev 5405)
@@ -154,33 +154,27 @@
}
}
- private static final String JSP_SOURCE_CONTENTTYPE_ID = "org.eclipse.jst.jsp.core.jspsource";
- private static final String JSP_SOURCE_ROOT_ELEMENT = "jsp:root";
- private static final String HTML_SOURCE_CONTENTTYPE_ID = "org.eclipse.wst.html.core.htmlsource";
- private static final String HTML_SOURCE_ROOT_ELEMENT = "html";
-
- // @TODO: alternative trackers map (for use along with xhtml documents)
+ // DONE: alternative trackers map (for use along with xhtml documents)
public static Map<String,String> addAlternativeTrackersMap(Map<String,String> map, IDocument document, int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
-
- String cti = smw.getContentTypeIdentifier();
- NodeList roots = null;
- if (JSP_SOURCE_CONTENTTYPE_ID.equalsIgnoreCase(cti))
- roots = xmlDocument.getElementsByTagName(JSP_SOURCE_ROOT_ELEMENT);
- else if (HTML_SOURCE_CONTENTTYPE_ID.equalsIgnoreCase(cti))
- roots = xmlDocument.getElementsByTagName(HTML_SOURCE_ROOT_ELEMENT);
- if (roots == null)
- return map;
-
if (map == null) map = new HashMap<String,String>();
-
- for (int i = 0; roots != null && i < roots.getLength(); i++) {
- Node n = roots.item(i);
+
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
+ while (n != null) {
+ if (!(n instanceof Element)) {
+ if (n instanceof Attr) {
+ n = ((Attr)n).getOwnerElement();
+ } else {
+ n = n.getParentNode();
+ }
+ continue;
+ }
+
NamedNodeMap attrs = n.getAttributes();
for (int j = 0; attrs != null && j < attrs.getLength(); j++) {
Attr a = (Attr)attrs.item(j);
@@ -191,8 +185,10 @@
map.put(prefix.trim(), uri.trim());
}
}
+
+ n = n.getParentNode();
}
-
+
return map;
} catch (Exception x) {
//ignore
18 years, 3 months