Author: mareshkau
Date: 2008-08-12 10:23:36 -0400 (Tue, 12 Aug 2008)
New Revision: 9668
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/mozilla/MozillaEditor.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/DocTypeUtil.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java
Log:
JBIDE-924
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 2008-08-12
14:23:25 UTC (rev 9667)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-08-12
14:23:36 UTC (rev 9668)
@@ -3241,7 +3241,7 @@
public void reinit() {
visualBuilder.setSelectionRectangle(null);
- visualEditor.setEditorDomEventListener(this);
+ visualEditor.setEditorDomEventListener(this);
IDOMModel sourceModel = (IDOMModel) getModel();
if (sourceModel != null) {
IDOMDocument sourceDocument = sourceModel.getDocument();
@@ -3249,6 +3249,18 @@
} else {
visualBuilder.rebuildDom(null);
}
+ //reinits selection controller+ controller
+ visualEditor.reinitDesignMode();
+ visualSelectionController = new
VpeSelectionController(visualEditor.getEditor().getSelectionController());
+
+ selectionBuilder = new VpeSelectionBuilder(domMapping, sourceBuilder,
+ visualBuilder, visualSelectionController);
+
+ selectionManager = new SelectionManager(pageContext,
+ sourceEditor, visualSelectionController);
+
+ keyEventHandler = new KeyEventManager(sourceEditor, domMapping,
+ pageContext,visualSelectionController);
}
/**
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 2008-08-12
14:23:25 UTC (rev 9667)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2008-08-12
14:23:36 UTC (rev 9668)
@@ -74,6 +74,8 @@
import org.mozilla.interfaces.nsIHTMLInlineTableEditor;
import org.mozilla.interfaces.nsIHTMLObjectResizer;
import org.mozilla.interfaces.nsIPlaintextEditor;
+import org.mozilla.interfaces.nsISelection;
+import org.mozilla.interfaces.nsISelectionPrivate;
public class MozillaEditor extends EditorPart implements IReusableEditor {
protected static final String INIT_URL = /*"file://" +*/ (new
File(VpePlugin.getDefault().getResourcePath("ve"),
"init.html")).getAbsolutePath(); //$NON-NLS-1$ //$NON-NLS-2$
@@ -668,8 +670,11 @@
private void onReloadWindow() {
removeDomEventListeners();
+ xulRunnerEditor.removeResizerListener();
contentArea = findContentArea();
addDomEventListeners();
+ addSelectionListener();
+ xulRunnerEditor.addResizerListener();
controller.reinit();
}
@@ -678,12 +683,20 @@
*
*/
public void reload() {
-
+
doctype = DocTypeUtil.getDoctype(getEditorInput());
+ //coused page to be refreshed
+ setRefreshPage(true);
xulRunnerEditor.setText(doctype
+ DocTypeUtil.getContentInitFile(new File(INIT_URL)));
-
}
+ /**
+ * Initialized design mode in visual refresh
+ */
+ public void initDesingMode() {
+ editor=null;
+ getEditor();
+ }
/**
* @return Doctype for document
@@ -692,13 +705,18 @@
return doctype;
}
- public boolean isRefreshPage() {
+ private boolean isRefreshPage() {
return isRefreshPage;
}
public void setRefreshPage(boolean isRefreshPage) {
this.isRefreshPage = isRefreshPage;
}
+
+ public void reinitDesignMode() {
+ editor=null;
+ getEditor();
+ }
/**
* Returns Editor for This Document
* @return
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/DocTypeUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/DocTypeUtil.java 2008-08-12
14:23:25 UTC (rev 9667)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/DocTypeUtil.java 2008-08-12
14:23:36 UTC (rev 9668)
@@ -143,7 +143,7 @@
// get file
IFile templateFile = FileUtil.getFile(fileName, file);
- if (templateFile != null)
+ if (templateFile != null) {
//if it's was first call of DOCTYPE function
if(previousFiles==null) {
@@ -155,7 +155,7 @@
previousFiles.add(templateFile);
docTypeValue = getDoctype(templateFile,previousFiles);
}
-
+ }
}
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java 2008-08-12
14:23:25 UTC (rev 9667)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java 2008-08-12
14:23:36 UTC (rev 9668)
@@ -31,6 +31,8 @@
import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.vpe.VpePlugin;
+import org.jboss.tools.vpe.editor.css.AbsoluteFolderReferenceList;
+import org.jboss.tools.vpe.editor.css.ResourceReference;
public class FileUtil {
@@ -77,17 +79,24 @@
*/
public static IFile getFile(String fileName, IFile includeFile) {
IFile file = null;
- if(fileName.startsWith("/")) {
+ if(fileName.startsWith("/")) { //$NON-NLS-1$
try {
- WebArtifactEdit edit =
- WebArtifactEdit.getWebArtifactEditForRead(includeFile.getProject());
- IVirtualComponent com = ComponentCore.createComponent(includeFile.getProject());
- IVirtualFolder webRootFolder = com.getRootFolder().getFolder(new
Path("/"));
- IContainer folder = webRootFolder.getUnderlyingFolder();
- IPath path = folder.getFullPath().append(fileName);
- file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
- } catch (Exception ex) {
- // do nothing that means include will shown as text region with included file name
+ ResourceReference[] resources =
AbsoluteFolderReferenceList.getInstance().getAllResources(includeFile);
+ if(resources!=null && resources.length==1) {
+ String location =resources[0].getLocation()+fileName;
+ IPath path=new Path(location);
+ return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
+ }else {
+ WebArtifactEdit edit =
+ WebArtifactEdit.getWebArtifactEditForRead(includeFile.getProject());
+ IVirtualComponent com = ComponentCore.createComponent(includeFile.getProject());
+ IVirtualFolder webRootFolder = com.getRootFolder().getFolder(new
Path("/"));
+ IContainer folder = webRootFolder.getUnderlyingFolder();
+ IPath path = folder.getFullPath().append(fileName);
+ file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ }
+ }catch (Exception ex) {
+ // do nothing that means include will shown as text region with included file name
}
} else {
IPath currentFolder = includeFile.getParent().getFullPath();
Show replies by date