Author: yradtsevich
Date: 2012-08-28 09:59:50 -0400 (Tue, 28 Aug 2012)
New Revision: 43263
Added:
workspace/yradtsevich/ibuziuk/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/.classpath
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/.project
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/.settings/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/.settings/org.eclipse.core.resources.prefs
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/.settings/org.eclipse.jdt.core.prefs
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/META-INF/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/META-INF/MANIFEST.MF
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/build.properties
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/error.html
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/html/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/html/error.html
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/icons/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/icons/configure.gif
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/jsp/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/jsp/serv.jsp
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/jsp/test.jsp
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/jsp/verySimple.jsp
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/lib/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/lib/jericho-html-3.2.jar
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/php/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/php/test.php
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/plugin.xml
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/Activator.java
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/BrowserView.java
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/SelectionListener.java
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/parser/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/parser/TestParser.java
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/parser/type/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/parser/type/jsp/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/parser/type/jsp/EndTagTypeJSPStabdard.java
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/parser/type/jsp/JSPTagType.java
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/parser/type/jsp/StartTagTypeJSPStandard.java
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/server/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/server/Server.java
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/server/ServerCreator.java
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/server/ServerReturnActionExecutor.java
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/util/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/util/EditorUtil.java
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/util/FileUtil.java
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/xml/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/xml/test.out.xml
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/xml/test.xml
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.project
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/.jsdtscope
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/org.eclipse.wst.common.component
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/org.eclipse.wst.common.project.facet.core.xml
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/org.eclipse.wst.jsdt.ui.superType.container
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/org.eclipse.wst.jsdt.ui.superType.name
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/WebContent/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/WebContent/html/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/WebContent/html/test2.html
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/WebContent/images/
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/WebContent/images/configure.gif
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/WebContent/images/logo.png
Log:
https://issues.jboss.org/browse/JBIDE-12501 - Create a prototype of HTML/JSP preview view
- HTML preview view prototype created by Ilya Buziuk - initial commit
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/.classpath
===================================================================
--- workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/.classpath
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/.classpath 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry exported="true" kind="lib"
path="lib/jericho-html-3.2.jar"
sourcepath="C:/Users/ibuziuk/Downloads/jericho-html-3.2/jericho-html-3.2/src/java"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/.project
===================================================================
--- workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/.project
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/.project 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>by.buziuk.browser.view</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/.settings/org.eclipse.core.resources.prefs
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/.settings/org.eclipse.core.resources.prefs
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/.settings/org.eclipse.core.resources.prefs 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding//jsp/verySimple.jsp=UTF-8
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/.settings/org.eclipse.jdt.core.prefs 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/META-INF/MANIFEST.MF
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/META-INF/MANIFEST.MF
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/META-INF/MANIFEST.MF 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: View
+Bundle-SymbolicName: by.buziuk.browser.view;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: by.buziuk.browser.view.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.ui.views,
+ org.eclipse.core.resources,
+ org.eclipse.ui.editors,
+ org.eclipse.jface.text,
+ org.eclipse.wst.html.core,
+ org.eclipse.wst.xml.core,
+
org.eclipse.core.net
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.eclipse.core.resources,
+ org.eclipse.ui
+Bundle-ClassPath: lib/jericho-html-3.2.jar,
+ .
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/build.properties
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/build.properties
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/build.properties 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ lib/jericho-html-3.2.jar
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/error.html
===================================================================
--- workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/error.html
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/error.html 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,10 @@
+<html>
+<head>
+<title>Error - This is not an html/htm file</title>
+</head>
+<body>
+<h1>Error - This is not an html/htm file</h1>
+<p>
+Choose file with correct extension (html/htm)
+</body>
+</html>
\ No newline at end of file
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/html/error.html
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/html/error.html
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/html/error.html 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,10 @@
+<html>
+<head>
+<title>Error - This is not an html/htm file</title>
+</head>
+<body>
+<h1>Error - This is not an html/htm file</h1>
+<p>
+Choose file with correct extension (html/htm)
+</body>
+</html>
\ No newline at end of file
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/icons/configure.gif
===================================================================
(Binary files differ)
Property changes on:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/icons/configure.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/jsp/serv.jsp
===================================================================
--- workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/jsp/serv.jsp
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/jsp/serv.jsp 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,14 @@
+<%@ taglib prefix="blx" uri="/blx.tld" %>
+<jsp:useBean id="user" class="user.UserData"
scope="session"/>
+<HTML>
+<BODY>
+<blx:getProperty name="user" property="*">
+<FORM METHOD=POST ACTION="SaveName.jsp">
+What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR>
+What's your e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20><BR>
+What's your age? <INPUT TYPE=TEXT NAME=age SIZE=4>
+<P><INPUT TYPE=SUBMIT>
+</FORM>
+</blx:getProperty>
+</BODY>
+</HTML>
\ No newline at end of file
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/jsp/test.jsp
===================================================================
--- workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/jsp/test.jsp
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/jsp/test.jsp 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,28 @@
+<jsp:root
+ version="2.0"
+
xmlns:jsp="http://java.sun.com/JSP/Page"
+
xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:t="urn:jsptagdir:/WEB-INF/tags"
+
xmlns:c="http://java.sun.com/jsp/jstl/core"
+ >
+
+<jsp:directive.page contentType="text/html; charset=UTF-8" />
+<html>
+ <head><title>Simple jspx page</title></head>
+ <body>
+ <t:HelloTag start="1" end="10" cycleVar="i">
+ <jsp:body>
+ It's Body. Variable "i" is
+ <c:choose>
+ <c:when test="${i mod 2 eq 0}">
+ Even
+ </c:when>
+ <c:otherwise>
+ Odd
+ </c:otherwise>
+ </c:choose>
+ </jsp:body>
+ </t:HelloTag>
+ </body>
+</html>
+</jsp:root>
\ No newline at end of file
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/jsp/verySimple.jsp
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/jsp/verySimple.jsp
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/jsp/verySimple.jsp 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+ <title>repeated usage JavaBeans in JSP</title>
+</head>
+<body>
+ <h1>repeated usage JavaBeans in JSP</h1>
+ <jsp:useBean id="test" class="hall.SimpleBean" />
+ <jsp:setProperty name="test" property="message"
value="Привет, WWW" />
+ <p>
+ Message
+ <jsp:getProperty name="test" property="message" />
+ </p>
+</body>
+</html>
\ No newline at end of file
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/lib/jericho-html-3.2.jar
===================================================================
(Binary files differ)
Property changes on:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/lib/jericho-html-3.2.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/php/test.php
===================================================================
--- workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/php/test.php
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/php/test.php 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,10 @@
+<html>
+<body>
+
+<?php
+$d=date("D");
+if ($d=="Fri") echo "Have a nice weekend!";
+?>
+
+</body>
+</html>
\ No newline at end of file
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/plugin.xml
===================================================================
--- workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/plugin.xml
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/plugin.xml 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ class="by.buziuk.browser.view.BrowserView"
+ icon="icons/configure.gif"
+ id="by.buziuk.browser.view.view1"
+ name="BrowserView"
+ restorable="true">
+ </view>
+ </extension>
+
+</plugin>
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/Activator.java
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/Activator.java
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/Activator.java 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,52 @@
+package by.buziuk.browser.view;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "by.buziuk.browser.view";
//$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/BrowserView.java
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/BrowserView.java
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/BrowserView.java 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,42 @@
+package by.buziuk.browser.view;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.part.ViewPart;
+
+import by.buziuk.browser.view.server.ServerCreator;
+
+
+
+public class BrowserView extends ViewPart {
+ public final static String BROWSER_VIEW_PART_ID =
"by.buziuk.browser.view.view1";
+ Browser browser;
+ ServerCreator serverCreator;
+ private ISelectionListener selectionListener;
+
+ @Override
+ public void createPartControl(Composite parent) {
+ browser = new Browser(parent, SWT.NONE);
+
+ serverCreator = new ServerCreator();
+ new Thread(serverCreator).start();
+
+ selectionListener = new SelectionListener(browser);
+ getSite().getWorkbenchWindow().getSelectionService()
+ .addPostSelectionListener(selectionListener);
+ }
+
+ @Override
+ public void setFocus() {
+ browser.setFocus();
+ }
+
+ @Override
+ public void dispose() {
+ getSite().getWorkbenchWindow().getSelectionService()
+ .removeSelectionListener(selectionListener);
+ super.dispose();
+ }
+}
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/SelectionListener.java
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/SelectionListener.java
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/SelectionListener.java 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,90 @@
+package by.buziuk.browser.view;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.browser.ProgressAdapter;
+import org.eclipse.swt.browser.ProgressEvent;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.editors.text.TextEditor;
+import org.eclipse.wst.html.core.internal.document.DocumentStyleImpl;
+import org.eclipse.wst.html.core.internal.document.ElementStyleImpl;
+import org.eclipse.wst.xml.core.internal.document.ElementImpl;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import by.buziuk.browser.view.util.EditorUtil;
+import by.buziuk.browser.view.util.FileUtil;
+
+final class SelectionListener implements ISelectionListener {
+ /**
+ *
+ */
+ final String ERROR_PATH =
"C:\\Users\\ibuziuk\\junoWorkspace\\jBossWorkspace\\by.buziuk.browser.view\\html\\error.html";
+ final String LOCALHOST = "http://localhost:8787";
+// final String ERROR_PATH ="error.html";
+ Browser browser;
+
+ public SelectionListener(Browser browser) {
+ this.browser = browser;
+ }
+
+ @Override
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ if (!BrowserView.BROWSER_VIEW_PART_ID.equals(part.getSite().getId())) {
+ showSelection(part, selection);
+ }
+ }
+
+ private void showSelection(IWorkbenchPart part, ISelection selection) {
+ String relativePathToFile;
+// File errorHtmlFile = new File("html/error.html");
+// errorHtmlFile.getAbsolutePath();
+
+
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ssel = (IStructuredSelection) selection;
+ Object firstElement = ssel.getFirstElement();
+
+ if (firstElement != null) {
+ IFile file = (IFile) Platform.getAdapterManager().getAdapter(
+ firstElement, IFile.class);
+ if (file != null && FileUtil.isHtml(file)) {
+ relativePathToFile = file.getFullPath().toString();
+ browser.setUrl(LOCALHOST + relativePathToFile);
+ } else if (firstElement instanceof ElementImpl) {
+ relativePathToFile = FileUtil.getEditorFile(part).getFullPath().toString(); //
It's relative path to file relative
+ browser.setUrl( LOCALHOST+ relativePathToFile);
+ } else {
+ browser.setUrl(ERROR_PATH);
+ }
+ } else {
+ browser.setUrl(ERROR_PATH);
+ }
+ }
+
+ if (part instanceof TextEditor){
+ relativePathToFile = FileUtil.getEditorFile(part).getFullPath().toString();
+ browser.setUrl(LOCALHOST + relativePathToFile);
+ browser.addProgressListener(new ProgressAdapter() {
+ @Override
+ public void completed(ProgressEvent event) {
+ browser.execute(
+ "(function(){" +
+ "var element = document.getElementById('browserViewId');" +
+ "element.scrollIntoView(true);" +
+ "})()"
+ );
+ }
+ });
+ }
+ }
+}
\ No newline at end of file
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/parser/TestParser.java
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/parser/TestParser.java
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/parser/TestParser.java 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,56 @@
+package by.buziuk.browser.view.parser;
+
+import net.htmlparser.jericho.*;
+
+import java.util.*;
+import java.net.*;
+
+public class TestParser {
+
+ public static void main(String[] args) throws Exception {
+ String sourceUrlString = "html/error.html";
+
+ if (sourceUrlString.indexOf(':') == -1)
+ sourceUrlString = "file:" + sourceUrlString;
+
+// MasonTagTypes.register();
+
+ Source source = new Source(new URL(sourceUrlString));
+
+ OutputDocument outputDocument = new OutputDocument(source);
+
+ System.out.println("Primary page");
+ System.out.println(outputDocument);
+ System.out.println("\n*******************************************************************************\n");
+
+ List <Element> rootElements = source.getChildElements();
+ for(Element root : rootElements){
+ replaceAllJSPToDiv(root, outputDocument);
+ }
+
+ System.out.println(outputDocument);
+ }
+
+ private static void replaceAllJSPToDiv(Element parent, OutputDocument outputDocument){
+ if(isJSP(parent)){
+ outputDocument.replace(parent.getStartTag(), "<div>");
+
+// parent.getStartTag().getAttributes().get(3).getName().substring(6,
parent.getStartTag().getAttributes().get(3).getName().length());
+
+ if(parent.getEndTag() != null){
+ outputDocument.replace(parent.getEndTag(), "</div>");
+ }
+ }
+ List<Element> children = parent.getChildElements();
+ for(Element child : children){
+ replaceAllJSPToDiv(child, outputDocument);
+ }
+ }
+
+ private static boolean isJSP(Element parent) {
+ if(parent.getName().startsWith("jsp")){
+ return true;
+ }
+ return false;
+ }
+}
\ No newline at end of file
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/parser/type/jsp/EndTagTypeJSPStabdard.java
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/parser/type/jsp/EndTagTypeJSPStabdard.java
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/parser/type/jsp/EndTagTypeJSPStabdard.java 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,11 @@
+package by.buziuk.browser.view.parser.type.jsp;
+
+import net.htmlparser.jericho.EndTagTypeGenericImplementation;
+
+public class EndTagTypeJSPStabdard extends EndTagTypeGenericImplementation {
+ protected static final EndTagTypeJSPStabdard INSTANCE=new EndTagTypeJSPStabdard();
+
+ private EndTagTypeJSPStabdard(){
+ super("jsp standard end tag","</jsp",">", true,
false);
+ }
+}
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/parser/type/jsp/JSPTagType.java
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/parser/type/jsp/JSPTagType.java
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/parser/type/jsp/JSPTagType.java 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,29 @@
+package by.buziuk.browser.view.parser.type.jsp;
+
+import net.htmlparser.jericho.EndTagType;
+import net.htmlparser.jericho.StartTagType;
+import net.htmlparser.jericho.TagType;
+
+public final class JSPTagType {
+
+ private JSPTagType(){
+
+ }
+
+ public static final StartTagType JSP_STANDARD_START = StartTagTypeJSPStandard.INSTANCE;
+ public static final EndTagType JSP_STANDARD_END = EndTagTypeJSPStabdard.INSTANCE;
+
+ private static final TagType[] TAG_TYPES={
+ JSP_STANDARD_START,
+ JSP_STANDARD_END
+ };
+
+ public static void register() {
+ for (TagType tagType : TAG_TYPES) tagType.register();
+ }
+
+ public static void deregister() {
+ for (TagType tagType : TAG_TYPES) tagType.deregister();
+ }
+
+}
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/parser/type/jsp/StartTagTypeJSPStandard.java
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/parser/type/jsp/StartTagTypeJSPStandard.java
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/parser/type/jsp/StartTagTypeJSPStandard.java 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,12 @@
+package by.buziuk.browser.view.parser.type.jsp;
+import net.htmlparser.jericho.StartTagTypeGenericImplementation;
+
+
+public class StartTagTypeJSPStandard extends StartTagTypeGenericImplementation {
+ protected static final StartTagTypeJSPStandard INSTANCE = new
StartTagTypeJSPStandard();
+
+
+ private StartTagTypeJSPStandard() {
+ super("jsp standard start tag","<jsp" ,">", null,
true);
+ }
+}
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/server/Server.java
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/server/Server.java
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/server/Server.java 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,104 @@
+package by.buziuk.browser.view.server;
+
+import java.io.BufferedReader;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.Socket;
+import java.net.URLDecoder;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.swt.widgets.Display;
+import by.buziuk.browser.view.util.FileUtil;
+
+public class Server implements Runnable {
+
+ private Display display;
+ private Socket connectedClient = null;
+ private BufferedReader inputFromClient = null;
+ private DataOutputStream outputToClient = null;
+
+ public Server(Socket client) {
+ connectedClient = client;
+ }
+
+ @Override
+ public void run() {
+
+ try {
+
+ System.out.println("The Client " + connectedClient.getInetAddress()
+ + ":" + connectedClient.getPort() + " is connected");
+
+ inputFromClient = new BufferedReader(new InputStreamReader(
+ connectedClient.getInputStream()));
+ outputToClient = new DataOutputStream(
+ connectedClient.getOutputStream());
+
+ String requestString = inputFromClient.readLine();
+ String headerLine = requestString;
+
+ StringTokenizer tokenizer = new StringTokenizer(headerLine);
+ String httpMethod = tokenizer.nextToken();
+ String httpQueryString = tokenizer.nextToken();
+
+ StringBuffer responseBuffer = new StringBuffer();
+
+ responseBuffer.append("<b>This is my Simple
Server</b><BR>");
+
+ while (inputFromClient.ready()) {
+ System.out.println(requestString);
+ requestString = inputFromClient.readLine();
+ }
+
+ if (httpMethod.equals("GET")) {
+ if (httpQueryString.equals("/")) {
+ // The default home page
+ sendResponse(responseBuffer.toString(), false);
+ } else {
+ // This is interpreted as a file name
+ Path pathToFile = new Path(httpQueryString);
+ File fileToReturn = ResourcesPlugin.getWorkspace()
+ .getRoot().getFile(pathToFile).getRawLocation()
+ .toFile();
+
+ display = Display.getDefault();
+ display.syncExec(new ServerReturnActionExecutor(
+ fileToReturn, outputToClient));
+ }
+ } else
+ sendResponse("<b>It's not a GET method</b>", false);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void sendResponse(String responseString, boolean isFile)
+ throws Exception {
+ String fileName = null;
+ FileInputStream fin = null;
+ if (isFile) {
+ fileName = responseString;
+ fin = new FileInputStream(fileName);
+ sendFile(fin, outputToClient);
+ } else {
+ outputToClient.writeBytes(responseString);
+ }
+ outputToClient.close();
+ }
+
+ public static void sendFile(FileInputStream fin, DataOutputStream out)
+ throws IOException {
+ byte[] buffer = new byte[1024];
+ int bytesRead;
+ while ((bytesRead = fin.read(buffer)) >= 0) {
+ out.write(buffer, 0, bytesRead);
+ }
+ fin.close();
+ }
+
+}
\ No newline at end of file
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/server/ServerCreator.java
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/server/ServerCreator.java
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/server/ServerCreator.java 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,29 @@
+package by.buziuk.browser.view.server;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+public class ServerCreator implements Runnable {
+
+ ServerSocket serverSocket;
+ Socket connection;
+ Server server;
+
+ @Override
+ public void run() {
+ try {
+ serverSocket = new ServerSocket(8787, 100);
+ System.out.println("Server is waiting for connection");
+ while(true){
+ connection = serverSocket.accept();
+ server = new Server(connection);
+ Thread clientThread = new Thread(server);
+ clientThread.start();
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/server/ServerReturnActionExecutor.java
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/server/ServerReturnActionExecutor.java
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/server/ServerReturnActionExecutor.java 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,147 @@
+package by.buziuk.browser.view.server;
+
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URLDecoder;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.wst.xml.core.internal.document.AttrImpl;
+import org.eclipse.wst.xml.core.internal.document.ElementImpl;
+import org.eclipse.wst.xml.core.internal.document.TextImpl;
+
+
+import by.buziuk.browser.view.Activator;
+import by.buziuk.browser.view.util.EditorUtil;
+
+public class ServerReturnActionExecutor implements Runnable {
+
+ private final String SELECTION_ATTRIBUTE = " id='browserViewId'";
+
+ private File file;
+ private DataOutputStream outputToClient;
+
+ public ServerReturnActionExecutor(File file, DataOutputStream outputToClient) {
+ this.file = file;
+ this.outputToClient = outputToClient;
+ }
+
+
+ @Override
+ public void run() {
+ int positionToPaste = -1;
+ ISelection selection = getCurrentSelection();
+
+ try {
+
+ EditorUtil.getEditors();
+
+ String fileName = file.getAbsolutePath();
+ fileName = URLDecoder.decode(fileName, "UTF-8");
+
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ssel = (IStructuredSelection) selection;
+ Object firstElement = ssel.getFirstElement();
+
+ if (firstElement instanceof TextImpl) {
+ TextImpl text = (TextImpl) firstElement;
+ ElementImpl element = (ElementImpl) text.getParentNode();
+ positionToPaste = element.getStartEndOffset() - 1;
+ } else if (firstElement instanceof ElementImpl) {
+ ElementImpl element = (ElementImpl) firstElement;
+ positionToPaste = element.getStartEndOffset() - 1;
+ } else if (firstElement instanceof AttrImpl){
+ AttrImpl atribute = (AttrImpl) firstElement;
+ ElementImpl element = (ElementImpl) atribute.getOwnerElement();
+ positionToPaste = element.getStartEndOffset() - 1;
+ }
+ }
+
+
+ if (EditorUtil.getActivePart() instanceof ITextEditor &&
file.equals(EditorUtil.getFileOpenedInActiveEditor())) {
+
+ ITextEditor editor = (ITextEditor) EditorUtil.getActivePart();
+
+ IDocumentProvider dp = editor.getDocumentProvider();
+ IDocument doc = dp.getDocument(editor.getEditorInput());
+
+ String docString = doc.get();
+
+ if (positionToPaste > 0) {
+ if (docString.charAt(positionToPaste - 1) == '/') {
+ positionToPaste -= 1;
+ }
+ docString = new StringBuffer(docString).insert(
+ positionToPaste, SELECTION_ATTRIBUTE).toString(); // adding custom
attribute // attribute
+ }
+
+ docString = addHeaderInformation(docString);
+
+ try {
+ outputToClient.writeBytes(docString);
+ outputToClient.close();
+
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ } else {
+
+ IEditorPart part = EditorUtil.getEditorInWitchFileisOpen(file);
+
+ if (part != null && part instanceof ITextEditor) {
+
+ ITextEditor editor = (ITextEditor)part;
+ IDocumentProvider dp = editor.getDocumentProvider();
+ IDocument doc = dp.getDocument(editor.getEditorInput());
+
+ String docString = doc.get();
+ docString = addHeaderInformation(docString);
+
+ outputToClient.writeBytes(docString);
+ outputToClient.close();
+
+
+ } else if (new File(fileName).isFile()) {
+ outputToClient.writeBytes(addHeaderInformation(""));
+ FileInputStream fin = new FileInputStream(fileName);
+ Server.sendFile(fin, outputToClient);
+ outputToClient.close();
+ } else {
+ outputToClient.writeBytes(addHeaderInformation("Error 404"));
+ outputToClient.close();
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public ISelection getCurrentSelection() {
+ Activator activator = Activator.getDefault();
+ IWorkbench workbench = activator.getWorkbench();
+ IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+ ISelectionService selectionService = workbenchWindow.getSelectionService();
+ ISelection selection = selectionService.getSelection();
+ return selection;
+ }
+
+ public static String addHeaderInformation(String responce){
+ String header = "HTTP/1.1 200 OK\r\n" +
+ "Server: Simple Server for BrowserView" +"\r\n"+
+ "Content-Type: text/html\r\n" +
+// "Content-Length: " + responce.length() + "\r\n" +
+ "Connection: close\r\n\r\n";
+
+ return header + responce;
+ }
+}
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/util/EditorUtil.java
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/util/EditorUtil.java
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/util/EditorUtil.java 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,61 @@
+package by.buziuk.browser.view.util;
+
+import java.io.File;
+
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+
+public class EditorUtil {
+
+ public static IFileEditorInput getActiveEditorInput(){
+ IFileEditorInput editorInput = (IFileEditorInput) PlatformUI
+ .getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .getActiveEditor().getEditorInput();
+ return editorInput;
+ }
+
+ public static File getFileOpenedInActiveEditor(){
+ File file = getActiveEditorInput().getFile().getRawLocation().toFile();
+ return file;
+ }
+
+ public static IWorkbenchPart getActivePart(){
+ IWorkbenchPart part = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage()
+ .getActivePart();
+ return part;
+ }
+
+ public static IEditorReference[] getEditors(){
+ IEditorReference[] editorReferences = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().getEditorReferences();
+ return editorReferences;
+ }
+
+// public static boolean isOpenInAnyTextEditor(File file){
+// IEditorReference[] editors = getEditors();
+// for (int i=0; i<editors.length-1; i++){
+// File fileOpenedInEditor =
((IFileEditorInput)editors[i].getEditor(true).getEditorInput()).getFile().getRawLocation().toFile();
+// if(file.equals(fileOpenedInEditor)){
+// return true;
+// }
+// }
+//
+// return false;
+// }
+
+ public static IEditorPart getEditorInWitchFileisOpen(File file){
+ IEditorReference[] editors = getEditors();
+ for (int i=0; i<editors.length-1; i++){
+ File fileOpenedInEditor =
((IFileEditorInput)editors[i].getEditor(true).getEditorInput()).getFile().getRawLocation().toFile();
+ if(file.equals(fileOpenedInEditor)){
+ return editors[i].getEditor(true);
+ }
+ }
+ return null;
+ }
+
+}
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/util/FileUtil.java
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/util/FileUtil.java
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/src/by/buziuk/browser/view/util/FileUtil.java 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,52 @@
+package by.buziuk.browser.view.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPart;
+
+public class FileUtil {
+
+ public static boolean isHtml(IFile file){
+ if(file.getFileExtension().equals("html") ||
file.getFileExtension().equals("htm")){
+ return true;
+ }
+ return false;
+ }
+
+ public static void clearFile(File file) throws FileNotFoundException{
+ PrintWriter writer = new PrintWriter(file);
+ writer.print("");
+ writer.close();
+
+ }
+
+ public static IFile getEditorFile(IWorkbenchPart part) {
+ IFile file = null;
+ if (part instanceof IEditorPart) {
+ IEditorPart editorPart = (IEditorPart) part;
+
+ if (editorPart.getEditorInput() instanceof IFileEditorInput) {
+ IFileEditorInput fileEditorInput = (IFileEditorInput) editorPart
+ .getEditorInput();
+ file = fileEditorInput.getFile();
+ }
+ }
+ return file;
+ }
+
+ public static boolean isEmpty(File file) throws IOException {
+ FileInputStream fileInputStream = new FileInputStream(file);
+ int b = fileInputStream.read();
+ if (b == -1) {
+ return true;
+ }
+ return false;
+ }
+}
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/xml/test.out.xml
===================================================================
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/xml/test.xml
===================================================================
--- workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/xml/test.xml
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/by.buziuk.browser.view/xml/test.xml 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,19 @@
+
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<books>
+ <book isbn="123">
+ <title>Web Servers for Fun and Profit</title>
+ <quantity>10</quantity>
+ <price>$17.95</price>
+ </book>
+ <book isbn="456">
+ <title>Web Programming for Mobile Devices</title>
+ <quantity>2</quantity>
+ <price>$38.95</price>
+ </book>
+ <book isbn="789">
+ <title>Duke: A Biography of the Java Evangelist</title>
+ <quantity>25</quantity>
+ <price>$15.00</price>
+ </book>
+</books>
\ No newline at end of file
Added: workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.project
===================================================================
--- workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.project
(rev 0)
+++ workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.project 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>sample-pages</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+ </natures>
+</projectDescription>
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/.jsdtscope
===================================================================
--- workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/.jsdtscope
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/.jsdtscope 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="WebContent"/>
+ <classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.WebProject">
+ <attributes>
+ <attribute name="hide" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
+ <classpathentry kind="output" path=""/>
+</classpath>
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/org.eclipse.wst.common.component
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/org.eclipse.wst.common.component
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/org.eclipse.wst.common.component 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?><project-modules
id="moduleCoreId" project-version="1.5.0">
+ <wb-module deploy-name="sample-pages">
+ <wb-resource deploy-path="/"
source-path="/WebContent"/>
+ <property name="context-root" value="sample-pages"/>
+ </wb-module>
+</project-modules>
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/org.eclipse.wst.common.project.facet.core.xml
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/org.eclipse.wst.common.project.facet.core.xml
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/org.eclipse.wst.common.project.facet.core.xml 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <fixed facet="wst.web"/>
+ <fixed facet="wst.jsdt.web"/>
+ <installed facet="wst.web" version="1.0"/>
+ <installed facet="wst.jsdt.web" version="1.0"/>
+</faceted-project>
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/org.eclipse.wst.jsdt.ui.superType.container
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/org.eclipse.wst.jsdt.ui.superType.container
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/org.eclipse.wst.jsdt.ui.superType.container 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1 @@
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/org.eclipse.wst.jsdt.ui.superType.name
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/org.eclipse.wst.jsdt.ui.superType.name
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/.settings/org.eclipse.wst.jsdt.ui.superType.name 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1 @@
+Window
\ No newline at end of file
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/WebContent/html/test2.html
===================================================================
---
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/WebContent/html/test2.html
(rev 0)
+++
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/WebContent/html/test2.html 2012-08-28
13:59:50 UTC (rev 43263)
@@ -0,0 +1,71 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;
charset=utf-8">
+ <title>Тег TABLE</title>
+ </head>
+ <body>
+
+ <table width="100%" border="0" cellspacing="0"
cellpadding="4" selection-position="1">
+ <tr align="center" bgcolor="#99999">
+ <td colspan="3" see="font-size: 160%; font-family:
sans-serif">Lem
+ ipsum amet...</td>
+ </tr>
+ <tr>
+ <td><img src="../images/configure.gif" alt=""
width="150" height="70"
+ border="0" style="background: #CC9"></td>
+ <td align="right"><img src="../images/logo.png"
alt="" width="70"
+ height="70" style="background: #CF9"></td>
+ <td>
+ <a href="lorem.ntmk">=a</a><Br>
+ <a href="lorem.html">hhuk</a><Br>
+ <a href="lorem.html"></a>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3">
+ <table width="100%" border="0" cellpadding="0"
+ cellspacing="0" bgcolor="#333333">
+ <tr><td> </td></tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+
+ <a href="lorem.ntmk">Jhnkh</a><Br>
+ <a href="lorem.html">hhuk</a><Br>
+ <a href="lorem.html"></a> <a
href="lorem.ntmk">hnsdsdskh</a><Br>
+ <a href="lorem.html">hhuk</a><Br>
+ <a href="lorem.html"></a> <a
href="lorem.ntmk">Jhnkh</a><Br>
+ <a href="lorem.html">hhuk</a><Br>
+ <a href="lorem.html"></a> <a
href="lorem.ntmk">Jhnkh</a><Br>
+ <a href="lorem.html">hhuk</a><br>
+ <a href="lorem.html"></a><br>
+ <a href="lorem.html">Scrolling test 1</a><br>
+ <a href="lorem.html">Scrolling test 2</a><br>
+ <a href="lorem.html">Scrolling test 3</a><br>
+ <a href="lorem.html">Scrolling test 4</a><br>
+ <a href="lorem.html">Scrolling test 5</a><br>
+ <a href="lorem.html">Scrolling test 6</a><br>
+ <a href="lorem.html">Scrolling test 7</a><br>
+ <a href="lorem.html">Scrolling test 8</a><br>
+ <a href="lorem.html">Scrolling test 9</a><br>
+ <a href="lorem.html">Scrolling test 10</a><br>
+ <a href="lorem.html">Scrolling test 11</a><br>
+ <a href="lorem.html">Scrolling test 12</a><br>
+ <a href="lorem.html">Scrolling test 13</a><br>
+ <a href="lorem.html">Scrolling test 14</a><br>
+ <a href="lorem.html">Scrolling test 15</a><br>
+ <a href="lorem.html">Scrolling test 16</a><br>
+ <a href="lorem.html">Scrolling test 17</a><br>
+ <a href="lorem.html">Scrolling test 18</a><br>
+ <a href="lorem.html">Scrolling test 19</a><br>
+ <a href="lorem.html">Scrolling test 20</a><br>
+ <a href="lorem.html">Scrolling test 21</a><br>
+ <a href="lorem.html">Scrolling test 22</a><br>
+ <a href="lorem.html">Scrolling test 23</a><br>
+ <a href="lorem.html">Scrolling test 24</a><br>
+ <a href="lorem.html">Scrolling test 25</a><br>
+ <a href="lorem.html">Scrolling test 26</a><br>
+ </body>
+</html>
\ No newline at end of file
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/WebContent/images/configure.gif
===================================================================
(Binary files differ)
Property changes on:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/WebContent/images/configure.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/WebContent/images/logo.png
===================================================================
(Binary files differ)
Property changes on:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/sample-pages/WebContent/images/logo.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream