JBoss Tools SVN: r43269 - branches/jbosstools-3.3.x/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2012-08-28 12:34:33 -0400 (Tue, 28 Aug 2012)
New Revision: 43269
Modified:
branches/jbosstools-3.3.x/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/TypeImpl.java
Log:
JBIDE-12179 (Invalid Error marker when using Hibernate @Type annotation)
backported fix from trunk
Modified: branches/jbosstools-3.3.x/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/TypeImpl.java
===================================================================
--- branches/jbosstools-3.3.x/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/TypeImpl.java 2012-08-28 16:32:45 UTC (rev 43268)
+++ branches/jbosstools-3.3.x/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/TypeImpl.java 2012-08-28 16:34:33 UTC (rev 43269)
@@ -25,6 +25,8 @@
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.hibernate.type.TypeFactory;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJptPlugin;
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernatePersistenceUnit;
import org.jboss.tools.hibernate.jpt.core.internal.context.Messages;
import org.jboss.tools.hibernate.jpt.core.internal.resource.java.TypeAnnotation;
@@ -140,7 +142,7 @@
messages.add(HibernateJpaValidationMessage.buildMessage(
IMessage.HIGH_SEVERITY,
TYPE_CANT_BE_EMPTY, this, range));
- } else if (!getPersistenceUnit().hasTypeDef(type)) {
+ } else if (TypeFactory.basic(type) == null && !getPersistenceUnit().hasTypeDef(type)) {
IType lwType = null;
try {
lwType = getJpaProject().getJavaProject().findType(type);
@@ -159,7 +161,7 @@
}
}
} catch (JavaModelException e) {
- // just ignore it!
+ HibernateJptPlugin.logException(e);
}
}
}
12 years, 4 months
JBoss Tools SVN: r43268 - workspace/yradtsevich/ibuziuk/HTML-preview-plugin.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2012-08-28 12:32:45 -0400 (Tue, 28 Aug 2012)
New Revision: 43268
Added:
workspace/yradtsevich/ibuziuk/HTML-preview-plugin/info.txt
Log:
https://issues.jboss.org/browse/JBIDE-12501 - Create a prototype of HTML/JSP preview view
- info.txt for HTML preview view prototype created by Ilya Buziuk
Added: workspace/yradtsevich/ibuziuk/HTML-preview-plugin/info.txt
===================================================================
--- workspace/yradtsevich/ibuziuk/HTML-preview-plugin/info.txt (rev 0)
+++ workspace/yradtsevich/ibuziuk/HTML-preview-plugin/info.txt 2012-08-28 16:32:45 UTC (rev 43268)
@@ -0,0 +1,40 @@
+about
+______________________________
+BrowserView eclipse plug-in.
+Simple html WYSIWYG view.
+CSS support.
+
+
+How it works
+______________________________
+1. Add BrowserView to eclipse ("Quick access -> BrowserView")
+2. New "BrowserView" view will appear
+3. User selects html file either in Project explorer or in the editor.
+4. As soon as selection is processed, BrowserView will render html page just like ordinary Browser.
+5. User edits page and immediately see changes in BrowserView.
+
+Thus, user gets simple WYSIWYG view, with carriage navigation.
+BrowserView processes selection via simple Server(to avoid temporary files and show up-to-date data)
+
+
+Environment
+_____________________________
+eclipse 4 juno (32-bit)
+jdk 6
+
+
+
+
+Programming languages
+_______________________________
+java
+
+
+
+how to install
+______________________________
+simply add project to workspace
+set Run Configuration:
+ - Runtime jre: jdk 32-bit
+ - Plugins: all workspace and enabled target plug-ins
+Run project as eclipse application
12 years, 4 months
JBoss Tools SVN: r43267 - in workspace/yradtsevich: simple-WYSWYG-HTML-editor and 13 other directories.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2012-08-28 11:54:38 -0400 (Tue, 28 Aug 2012)
New Revision: 43267
Added:
workspace/yradtsevich/simple-WYSWYG-HTML-editor/
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/.classpath
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/.project
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/.settings/
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/.settings/org.eclipse.jdt.core.prefs
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/META-INF/
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/META-INF/MANIFEST.MF
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/build.properties
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/img/
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/img/bold.png
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/img/favicon.ico
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/img/italic.png
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/img/underline.png
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/lib/
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/lib/commons-io-2.4.jar
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/plugin.xml
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/AbstractBrowserWidgetAction.java
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/ActionsStateListener.java
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/Activator.java
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/BoldAction.java
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/BrowserWidgetEditor.java
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/BrowserWidgetEditorActionBarContributor.java
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/ItalicAction.java
workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/UnderlineAction.java
Log:
https://issues.jboss.org/browse/JBIDE-12276 - Research possibilities to use XULRunner >= 2.0, or WebKit/IE in VPE
- created a prototype of JavaScript to Eclipse interaction via SWT browser widget
Added: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/.classpath
===================================================================
--- workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/.classpath (rev 0)
+++ workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/.classpath 2012-08-28 15:54:38 UTC (rev 43267)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry exported="true" kind="lib" path="lib/commons-io-2.4.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/.project
===================================================================
--- workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/.project (rev 0)
+++ workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/.project 2012-08-28 15:54:38 UTC (rev 43267)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.vpe.javascript.wysiwyg.prototype</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/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/.settings/org.eclipse.jdt.core.prefs 2012-08-28 15:54:38 UTC (rev 43267)
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
Added: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/META-INF/MANIFEST.MF
===================================================================
--- workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/META-INF/MANIFEST.MF (rev 0)
+++ workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/META-INF/MANIFEST.MF 2012-08-28 15:54:38 UTC (rev 43267)
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Pilot
+Bundle-SymbolicName: org.jboss.tools.vpe.javascript.wysiwyg.prototype;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.jboss.tools.vpe.javascript.wysiwyg.prototype.Activator
+Bundle-Vendor: JBoss
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.apache.commons.lang,
+ org.eclipse.core.resources
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: lib/commons-io-2.4.jar,
+ .
Added: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/build.properties
===================================================================
--- workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/build.properties (rev 0)
+++ workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/build.properties 2012-08-28 15:54:38 UTC (rev 43267)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ lib/commons-io-2.4.jar
Added: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/img/bold.png
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/img/bold.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/img/favicon.ico
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/img/favicon.ico
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/img/italic.png
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/img/italic.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/img/underline.png
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/img/underline.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/lib/commons-io-2.4.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/lib/commons-io-2.4.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/plugin.xml
===================================================================
--- workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/plugin.xml (rev 0)
+++ workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/plugin.xml 2012-08-28 15:54:38 UTC (rev 43267)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ class="org.jboss.tools.vpe.javascript.wysiwyg.prototype.BrowserWidgetEditor"
+ contributorClass="org.jboss.tools.vpe.javascript.wysiwyg.prototype.BrowserWidgetEditorActionBarContributor"
+ default="false"
+ extensions="txt"
+ icon="img/favicon.ico"
+ id="org.jboss.tools.vpe.javascript.wysiwyg.prototype.editor"
+ name="Browser Widget Editor">
+ </editor>
+ </extension>
+
+</plugin>
Added: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/AbstractBrowserWidgetAction.java
===================================================================
--- workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/AbstractBrowserWidgetAction.java (rev 0)
+++ workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/AbstractBrowserWidgetAction.java 2012-08-28 15:54:38 UTC (rev 43267)
@@ -0,0 +1,25 @@
+package org.jboss.tools.vpe.javascript.wysiwyg.prototype;
+
+import org.eclipse.jface.action.Action;
+
+public abstract class AbstractBrowserWidgetAction extends Action implements ActionsStateListener {
+ private BrowserWidgetEditor editor;
+
+ public AbstractBrowserWidgetAction() {
+ super(null, AS_CHECK_BOX);
+ }
+
+ public void setEditor(BrowserWidgetEditor editor) {
+ if (this.editor != null) {
+ editor.removeStateListener(this);
+ }
+ this.editor = editor;
+ if (this.editor != null) {
+ editor.addStateListener(this);
+ }
+ }
+
+ public BrowserWidgetEditor getEditor() {
+ return editor;
+ }
+}
Added: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/ActionsStateListener.java
===================================================================
--- workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/ActionsStateListener.java (rev 0)
+++ workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/ActionsStateListener.java 2012-08-28 15:54:38 UTC (rev 43267)
@@ -0,0 +1,7 @@
+package org.jboss.tools.vpe.javascript.wysiwyg.prototype;
+
+import java.util.EventListener;
+
+public interface ActionsStateListener extends EventListener {
+ public void stateChanged(boolean bold, boolean italic, boolean underline);
+}
Added: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/Activator.java
===================================================================
--- workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/Activator.java (rev 0)
+++ workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/Activator.java 2012-08-28 15:54:38 UTC (rev 43267)
@@ -0,0 +1,64 @@
+package org.jboss.tools.vpe.javascript.wysiwyg.prototype;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+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 = "org.jboss.tools.vpe.javascript.wysiwyg.prototype"; //$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)
+ */
+ 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)
+ */
+ 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;
+ }
+
+ public static ImageDescriptor getImageDescriptor(String path) {
+ ImageRegistry imageRegistry = plugin.getImageRegistry();
+ ImageDescriptor imageDescriptor = imageRegistry.getDescriptor(path);
+ if (imageDescriptor == null) {
+ URL url = plugin.getBundle().getResource(path);
+ imageDescriptor = ImageDescriptor.createFromURL(url);
+ imageRegistry.put(path, imageDescriptor);
+ }
+ return imageDescriptor;
+ }
+}
Added: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/BoldAction.java
===================================================================
--- workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/BoldAction.java (rev 0)
+++ workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/BoldAction.java 2012-08-28 15:54:38 UTC (rev 43267)
@@ -0,0 +1,22 @@
+package org.jboss.tools.vpe.javascript.wysiwyg.prototype;
+
+
+public class BoldAction extends AbstractBrowserWidgetAction {
+ public BoldAction() {
+ setText("Bold");
+ setToolTipText("Bold");
+ setImageDescriptor(Activator.getImageDescriptor("img/bold.png"));
+ }
+
+ @Override
+ public void run() {
+ if (getEditor() != null) {
+ getEditor().execute("document.execCommand('bold')");
+ }
+ }
+
+ @Override
+ public void stateChanged(boolean bold, boolean italic, boolean underline) {
+ setChecked(bold);
+ }
+}
Added: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/BrowserWidgetEditor.java
===================================================================
--- workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/BrowserWidgetEditor.java (rev 0)
+++ workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/BrowserWidgetEditor.java 2012-08-28 15:54:38 UTC (rev 43267)
@@ -0,0 +1,173 @@
+package org.jboss.tools.vpe.javascript.wysiwyg.prototype;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.swing.event.EventListenerList;
+
+import org.apache.commons.io.IOUtils;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.browser.BrowserFunction;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.EditorPart;
+
+public class BrowserWidgetEditor extends EditorPart {
+
+ private Browser browser;
+ private BrowserFunction commandsStateCallback;
+ private EventListenerList listenerList = new EventListenerList();
+ private boolean boldState = false;
+ private boolean italicState = false;
+ private boolean underlineState = false;
+ public static final String BOLD_PROPERTY_ID = BrowserWidgetEditor.class.getCanonicalName() + "_BOLD";
+
+ public BrowserWidgetEditor() {
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public void doSave(IProgressMonitor monitor) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void doSaveAs() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void init(IEditorSite site, IEditorInput input)
+ throws PartInitException {
+ setSite(site);
+ setInput(input);
+ }
+
+ @Override
+ public boolean isDirty() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isSaveAsAllowed() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+ browser = new Browser(parent, SWT.NONE);
+ IFile iFile = (IFile) getEditorInput().getAdapter(IFile.class);
+ if (iFile != null && iFile.exists()) {
+ InputStream inputStream = null;
+ try {
+ inputStream = iFile.getContents();
+ String content = IOUtils.toString(inputStream);
+ browser.setText(
+ "<!DOCTYPE html>" +
+ "<html>" +
+ "<head>" +
+ "<script>" +
+ "setInterval(function() {" +
+ "if (window.commandsStateCallback) {" +
+ "var boldValue = document.queryCommandValue('bold');" +
+ "var italicValue = document.queryCommandValue('italic');" +
+ "var underlineValue = document.queryCommandValue('underline');" +
+ "window.commandsStateCallback(boldValue, italicValue, underlineValue);" +
+ "}" +
+ "}, 1000);" +
+ "</script>" +
+ "</head>" +
+ "<body contenteditable='true'>" +
+ content +
+ "</body>" +
+ "</html>"
+ );
+ commandsStateCallback = new BrowserFunction(browser, "commandsStateCallback") {
+ @Override
+ public Object function(Object[] args) {
+ boldState = Boolean.TRUE.equals(args[0]);
+ italicState = Boolean.TRUE.equals(args[1]);
+ underlineState = Boolean.TRUE.equals(args[2]);
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ fireStateChanged();
+ }
+
+ });
+ return super.function(args);
+ }
+ };
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } finally {
+ if (inputStream != null) {
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+ }
+ }
+
+ public void addStateListener(ActionsStateListener listener) {
+ listenerList.add(ActionsStateListener.class, listener);
+ }
+ public void removeStateListener(ActionsStateListener listener) {
+ listenerList.remove(ActionsStateListener.class, listener);
+ }
+
+
+ private void fireStateChanged() {
+ ActionsStateListener[] listeners = listenerList.getListeners(ActionsStateListener.class);
+ for (ActionsStateListener listener :listeners) {
+ listener.stateChanged(boldState, italicState, underlineState);
+ }
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ commandsStateCallback.dispose();
+ }
+
+ @Override
+ public void setFocus() {
+ browser.setFocus();
+ }
+
+ public boolean execute(String script) {
+ return browser.execute(script);
+ }
+
+ public boolean getBoldState() {
+ return boldState;
+ }
+
+ public boolean getItalicState() {
+ return italicState;
+ }
+
+ public boolean getUnderlineState() {
+ return underlineState;
+ }
+}
Added: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/BrowserWidgetEditorActionBarContributor.java
===================================================================
--- workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/BrowserWidgetEditorActionBarContributor.java (rev 0)
+++ workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/BrowserWidgetEditorActionBarContributor.java 2012-08-28 15:54:38 UTC (rev 43267)
@@ -0,0 +1,43 @@
+package org.jboss.tools.vpe.javascript.wysiwyg.prototype;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.part.EditorActionBarContributor;
+
+
+public class BrowserWidgetEditorActionBarContributor extends
+ EditorActionBarContributor {
+
+ private BrowserWidgetEditor editor;
+ private BoldAction boldAction;
+ private ItalicAction italicAction;
+ private UnderlineAction underlineAction;
+
+ public BrowserWidgetEditorActionBarContributor() {
+ }
+
+ @Override
+ public void setActiveEditor(IEditorPart targetEditor) {
+ if (targetEditor instanceof BrowserWidgetEditor) {
+ this.editor = (BrowserWidgetEditor) targetEditor;
+ boldAction.setEditor(editor);
+ italicAction.setEditor(editor);
+ underlineAction.setEditor(editor);
+ }
+ }
+
+ @Override
+ public void init(IActionBars bars) {
+ boldAction = new BoldAction();
+ italicAction = new ItalicAction();
+ underlineAction = new UnderlineAction();
+ super.init(bars);
+ }
+
+ @Override
+ public void contributeToToolBar(IToolBarManager toolBarManager) {
+ toolBarManager.add(boldAction);
+ toolBarManager.add(italicAction);
+ toolBarManager.add(underlineAction);
+ }
+}
Added: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/ItalicAction.java
===================================================================
--- workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/ItalicAction.java (rev 0)
+++ workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/ItalicAction.java 2012-08-28 15:54:38 UTC (rev 43267)
@@ -0,0 +1,21 @@
+package org.jboss.tools.vpe.javascript.wysiwyg.prototype;
+
+public class ItalicAction extends AbstractBrowserWidgetAction {
+ public ItalicAction() {
+ setText("Italic");
+ setToolTipText("Italic");
+ setImageDescriptor(Activator.getImageDescriptor("img/italic.png"));
+ }
+
+ @Override
+ public void run() {
+ if (getEditor() != null) {
+ getEditor().execute("document.execCommand('italic')");
+ }
+ }
+
+ @Override
+ public void stateChanged(boolean bold, boolean italic, boolean underline) {
+ setChecked(italic);
+ }
+}
Added: workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/UnderlineAction.java
===================================================================
--- workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/UnderlineAction.java (rev 0)
+++ workspace/yradtsevich/simple-WYSWYG-HTML-editor/org.jboss.tools.vpe.javascript.wysiwyg.prototype/src/org/jboss/tools/vpe/javascript/wysiwyg/prototype/UnderlineAction.java 2012-08-28 15:54:38 UTC (rev 43267)
@@ -0,0 +1,21 @@
+package org.jboss.tools.vpe.javascript.wysiwyg.prototype;
+
+public class UnderlineAction extends AbstractBrowserWidgetAction {
+ public UnderlineAction() {
+ setText("Underline");
+ setToolTipText("Underline");
+ setImageDescriptor(Activator.getImageDescriptor("img/underline.png"));
+ }
+
+ @Override
+ public void run() {
+ if (getEditor() != null) {
+ getEditor().execute("document.execCommand('underline')");
+ }
+ }
+
+ @Override
+ public void stateChanged(boolean bold, boolean italic, boolean underline) {
+ setChecked(underline);
+ }
+}
12 years, 4 months
JBoss Tools SVN: r43266 - in trunk: jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/JBIDE3247/WebContent/pages and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2012-08-28 11:38:20 -0400 (Tue, 28 Aug 2012)
New Revision: 43266
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCommandButton.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/JBIDE3247/WebContent/pages/index.xhtml.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/5015/login.xhtml.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/5516/jbide5516.xhtml.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/commandButton.jsp.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/toolBar.xhtml.xml
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
Log:
https://issues.jboss.org/browse/JBIDE-3225 - h:commandButton was put into SPAN, type="submit" was added, junits were updated.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCommandButton.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCommandButton.java 2012-08-28 15:23:31 UTC (rev 43265)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCommandButton.java 2012-08-28 15:38:20 UTC (rev 43266)
@@ -13,6 +13,7 @@
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.Constants;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.editor.util.VisualDomUtil;
import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
@@ -36,8 +37,11 @@
input.setAttribute(HTML.ATTR_CLASS, sourceElement.getAttribute(JSF.ATTR_STYLE_CLASS));
}
if (sourceElement.hasAttribute(JSF.ATTR_DISABLED)) {
+ /*
+ * CommandButton is Disabled
+ */
String disabled = sourceElement.getAttribute(JSF.ATTR_DISABLED);
- if ("true".equalsIgnoreCase(disabled)) { //$NON-NLS-1$
+ if (Constants.TRUE.equalsIgnoreCase(disabled)) {
input.setAttribute(JSF.ATTR_DISABLED, JSF.ATTR_DISABLED);
}
}
@@ -45,20 +49,30 @@
input.setAttribute(JSF.ATTR_DIR, sourceElement.getAttribute(JSF.ATTR_DIR));
}
if (sourceElement.hasAttribute(JSF.ATTR_IMAGE)) {
-// 1) attr: +image -> type=image
+ /*
+ * TYPE is IMAGE
+ */
input.setAttribute(JSF.ATTR_TYPE,JSF.ATTR_IMAGE);
input.setAttribute(JSF.ATTR_SRC,
VpeStyleUtil.addFullPathToImgSrc(
sourceElement.getAttribute(JSF.ATTR_IMAGE), pageContext, true));
- } else if (sourceElement.hasAttribute(JSF.ATTR_TYPE)) {
-// 2) attr: +type -> type=type
- input.setAttribute(JSF.ATTR_TYPE, sourceElement.getAttribute(JSF.ATTR_TYPE));
+ } else if (sourceElement.hasAttribute(JSF.ATTR_TYPE)) {
+ /*
+ * TYPE attribute presents
+ */
+ String type = sourceElement.getAttribute(JSF.ATTR_TYPE);
+ if (Constants.EMPTY.equalsIgnoreCase(type)) {
+ type = HTML.VALUE_TYPE_SUBMIT;
+ }
+ input.setAttribute(JSF.ATTR_TYPE, type);
if (sourceElement.hasAttribute(JSF.ATTR_VALUE)) {
input.setAttribute(JSF.ATTR_VALUE, sourceElement.getAttribute(JSF.ATTR_VALUE));
}
} else {
-// 3) attr: -type -> type=button
- input.setAttribute(JSF.ATTR_TYPE, JSF.VALUE_BUTTON);
+ /*
+ * No TYPE attribute is specified
+ */
+ input.setAttribute(HTML.ATTR_TYPE, HTML.VALUE_TYPE_SUBMIT);
if (sourceElement.hasAttribute(JSF.ATTR_VALUE)) {
input.setAttribute(JSF.ATTR_VALUE, sourceElement.getAttribute(JSF.ATTR_VALUE));
}
@@ -69,7 +83,7 @@
* Components should render usual text inside
*/
VpeCreationData creationData = VisualDomUtil.createTemplateWithTextContainer(
- sourceElement, input, HTML.TAG_DIV, visualDocument);
+ sourceElement, input, HTML.TAG_SPAN, visualDocument);
return creationData;
}
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/JBIDE3247/WebContent/pages/index.xhtml.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/JBIDE3247/WebContent/pages/index.xhtml.xml 2012-08-28 15:23:31 UTC (rev 43265)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/JBIDE3247/WebContent/pages/index.xhtml.xml 2012-08-28 15:38:20 UTC (rev 43266)
@@ -4,44 +4,44 @@
<DIV VPE:INCLUDE-ELEMENT="yes" STYLE="-moz-user-modify: read-only;">
<!-- h:inputHidden id="currentPage" replace, because if on page two fields, two elements with equal id has been used, but should be used only one -->
<TABLE BORDER="0"
- STYLE="margin-right: auto; margin-left: auto; -moz-user-modify: read-write;">
- <TBODY>
- <TR>
- <TD>
- <DIV CLASS="vpe-text">
- <DIV CLASS="vpe-text">
- </DIV>
- <INPUT TYPE="submit" VALUE="<<" />
+ STYLE="margin-right: auto; margin-left: auto; -moz-user-modify: read-write;">
+ <TBODY>
+ <TR>
+ <TD>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
+ </SPAN>
+ <INPUT TYPE="submit" VALUE="<<" />
- </DIV>
- </TD>
- <TD>
- <DIV CLASS="vpe-text">
- <DIV CLASS="vpe-text">
- </DIV>
- <INPUT TYPE="submit" VALUE="<" />
+ </SPAN>
+ </TD>
+ <TD>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
+ </SPAN>
+ <INPUT TYPE="submit" VALUE="<" />
- </DIV>
- </TD>
- <TD>
- <DIV CLASS="vpe-text">
- <DIV CLASS="vpe-text">
- </DIV>
- <INPUT TYPE="submit" VALUE=">" />
+ </SPAN>
+ </TD>
+ <TD>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
+ </SPAN>
+ <INPUT TYPE="submit" VALUE=">" />
- </DIV>
- </TD>
- <TD>
- <DIV CLASS="vpe-text">
- <DIV CLASS="vpe-text">
- </DIV>
- <INPUT TYPE="submit" VALUE=">>" />
+ </SPAN>
+ </TD>
+ <TD>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
+ </SPAN>
+ <INPUT TYPE="submit" VALUE=">>" />
- </DIV>
- </TD>
- </TR>
- </TBODY>
- </TABLE>
+ </SPAN>
+ </TD>
+ </TR>
+ </TBODY>
+</TABLE>
</DIV>
<DIV VPE:INCLUDE-ELEMENT="yes" STYLE="-moz-user-modify: read-only;">
<SPAN CLASS="message" STYLE="-moz-user-modify: read-only;">
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/5015/login.xhtml.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/5015/login.xhtml.xml 2012-08-28 15:23:31 UTC (rev 43265)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/5015/login.xhtml.xml 2012-08-28 15:38:20 UTC (rev 43266)
@@ -37,7 +37,7 @@
</P>
<P STYLE="-moz-user-modify: read-only;">
-<INPUT TYPE="button" VALUE="LOgin" STYLE="-moz-user-modify: read-only;"/>
+<INPUT TYPE="submit" VALUE="LOgin"/>
</P>
</DIV>
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/5516/jbide5516.xhtml.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/5516/jbide5516.xhtml.xml 2012-08-28 15:23:31 UTC (rev 43265)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/5516/jbide5516.xhtml.xml 2012-08-28 15:38:20 UTC (rev 43266)
@@ -1,41 +1,43 @@
<tests>
<test id="jbide5516">
<DIV ID="jbide5516">
- <DIV VPE:INCLUDE-ELEMENT="yes" STYLE="-moz-user-modify: read-only;">
- <TABLE BORDER="0" STYLE="margin-right: auto; margin-left: auto;">
+ <DIV VPE:INCLUDE-ELEMENT="yes">
+
+ <TABLE BORDER="0"
+ STYLE="margin-right: auto; margin-left: auto;">
<TBODY>
<TR>
<TD>
- <DIV CLASS="vpe-text">
- <DIV CLASS="vpe-text">
- </DIV>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
+ </SPAN>
<INPUT TYPE="submit" VALUE="1" />
- </DIV>
+ </SPAN>
</TD>
<TD>
- <DIV CLASS="vpe-text">
- <DIV CLASS="vpe-text">
- </DIV>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
+ </SPAN>
<INPUT TYPE="submit" VALUE="2" />
- </DIV>
+ </SPAN>
</TD>
<TD>
- <DIV CLASS="vpe-text">
- <DIV CLASS="vpe-text">
- </DIV>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
+ </SPAN>
<INPUT TYPE="submit" VALUE="3" />
- </DIV>
+ </SPAN>
</TD>
<TD>
- <DIV CLASS="vpe-text">
- <DIV CLASS="vpe-text">
- </DIV>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
+ </SPAN>
<INPUT TYPE="submit" VALUE="4" />
- </DIV>
+ </SPAN>
</TD>
</TR>
</TBODY>
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/commandButton.jsp.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/commandButton.jsp.xml 2012-08-28 15:23:31 UTC (rev 43265)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/components/commandButton.jsp.xml 2012-08-28 15:38:20 UTC (rev 43266)
@@ -1,106 +1,114 @@
<tests>
<test id="div1">
<DIV ID="div1" STYLE="-moz-user-modify: read-write;">
- <INPUT TYPE="button" VALUE="commandButton1" />
+ <INPUT TYPE="submit" VALUE="commandButton1" />
<INPUT TYPE="button" VALUE="commandButton2" />
<INPUT TYPE="reset" VALUE="commandButton3" />
<INPUT TYPE="submit" VALUE="commandButton4" />
<INPUT TYPE="image" SRC="/.*ve/unresolved_image.gif/" />
- <INPUT TYPE="" VALUE="commandButton6" />
+ <INPUT TYPE="submit" VALUE="commandButton6" />
</DIV>
</test>
<test id="div2">
+
<DIV ID="div2" STYLE="-moz-user-modify: read-write;">
- <DIV CLASS="vpe-text">
- <DIV CLASS="vpe-text">
- </DIV>
- <INPUT TYPE="button" VALUE="cb1" />
- </DIV>
- <DIV CLASS="vpe-text">
- <DIV CLASS="vpe-text">
- </DIV>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
+ </SPAN>
+ <INPUT TYPE="submit" VALUE="cb1" />
+
+ </SPAN>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
+ </SPAN>
<INPUT TYPE="button" VALUE="cb2" />
- </DIV>
- <DIV CLASS="vpe-text">
- <DIV CLASS="vpe-text">
- </DIV>
+
+ </SPAN>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
+ </SPAN>
<INPUT TYPE="reset" VALUE="cb3" />
- </DIV>
- <DIV CLASS="vpe-text">
- <DIV CLASS="vpe-text">
- </DIV>
+
+ </SPAN>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
+ </SPAN>
<INPUT TYPE="submit" VALUE="cb4" />
- </DIV>
- <DIV CLASS="vpe-text">
- <DIV CLASS="vpe-text">
- </DIV>
+
+ </SPAN>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
+ </SPAN>
<INPUT TYPE="image" SRC="/.*ve/unresolved_image.gif/" />
- </DIV>
- <DIV CLASS="vpe-text">
- <DIV CLASS="vpe-text">
- </DIV>
- <INPUT TYPE="" VALUE="cb6" />
- </DIV>
+
+ </SPAN>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
+ </SPAN>
+ <INPUT TYPE="submit" VALUE="cb6" />
+
+ </SPAN>
</DIV>
</test>
<test id="div3">
+
<DIV ID="div3" STYLE="-moz-user-modify: read-write;">
- <DIV CLASS="vpe-text">
- <DIV CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
<SPAN CLASS="vpe-text">
with some text
</SPAN>
- </DIV>
- <INPUT TYPE="button" VALUE="cb1" />
+ </SPAN>
+ <INPUT TYPE="submit" VALUE="cb1" />
- </DIV>
- <DIV CLASS="vpe-text">
- <DIV CLASS="vpe-text">
+ </SPAN>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
<SPAN CLASS="vpe-text">
with some text
</SPAN>
- </DIV>
+ </SPAN>
<INPUT TYPE="button" VALUE="cb2" />
- </DIV>
- <DIV CLASS="vpe-text">
- <DIV CLASS="vpe-text">
+ </SPAN>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
<SPAN CLASS="vpe-text">
with some text
</SPAN>
- </DIV>
+ </SPAN>
<INPUT TYPE="reset" VALUE="cb3" />
- </DIV>
- <DIV CLASS="vpe-text">
- <DIV CLASS="vpe-text">
+ </SPAN>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
<SPAN CLASS="vpe-text">
with some text
</SPAN>
- </DIV>
+ </SPAN>
<INPUT TYPE="submit" VALUE="cb4" />
- </DIV>
- <DIV CLASS="vpe-text">
- <DIV CLASS="vpe-text">
+ </SPAN>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
<SPAN CLASS="vpe-text">
with some text
</SPAN>
- </DIV>
+ </SPAN>
<INPUT TYPE="image" SRC="/.*ve/unresolved_image.gif/" />
- </DIV>
- <DIV CLASS="vpe-text">
- <DIV CLASS="vpe-text">
+ </SPAN>
+ <SPAN CLASS="vpe-text">
+ <SPAN CLASS="vpe-text">
<SPAN CLASS="vpe-text">
with some text
</SPAN>
- </DIV>
- <INPUT TYPE="" VALUE="cb6" />
+ </SPAN>
+ <INPUT TYPE="submit" VALUE="cb6" />
- </DIV>
+ </SPAN>
</DIV>
</test>
</tests>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/toolBar.xhtml.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/toolBar.xhtml.xml 2012-08-28 15:23:31 UTC (rev 43265)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/resources/richFacesTest/WebContent/pages/components/toolBar.xhtml.xml 2012-08-28 15:38:20 UTC (rev 43266)
@@ -57,7 +57,7 @@
<INPUT CLASS="barsearch" />
</TD>
<TD CLASS="dr-toolbar-int rich-toolbar-item" STYLE="">
- <INPUT TYPE="button" CLASS="barsearchbutton" VALUE="Search"/>
+ <INPUT TYPE="submit" CLASS="barsearchbutton" VALUE="Search"/>
</TD>
</TR>
</TBODY>
@@ -266,7 +266,7 @@
</TD>
<TD CLASS="dr-toolbar-int rich-toolbar-item"
STYLE="color: PaleVioletRed; font-size: medium; font-style: italic; background-color: FloralWhite; font-family: Arial TUR; font-weight: bolder;">
- <INPUT TYPE="button" CLASS="barsearchbutton" VALUE="Search"/>
+ <INPUT TYPE="submit" CLASS="barsearchbutton" VALUE="Search"/>
</TD>
</TR>
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2012-08-28 15:23:31 UTC (rev 43265)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2012-08-28 15:38:20 UTC (rev 43266)
@@ -141,6 +141,7 @@
public static final String VALUE_TYPE_RADIO = "radio"; //$NON-NLS-1$
public static final String VALUE_TYPE_HIDDEN = "hidden"; //$NON-NLS-1$
public static final String VALUE_TYPE_BUTTON= "button"; //$NON-NLS-1$
+ public static final String VALUE_TYPE_SUBMIT= "submit"; //$NON-NLS-1$
public static final String VALUE_CLEAR_BOTH = "both"; //$NON-NLS-1$
public static final String VALUE_INLINE = "inline"; //$NON-NLS-1$
public static final String VALUE_BLOCK = "block"; //$NON-NLS-1$
12 years, 4 months
JBoss Tools SVN: r43265 - in workspace/yradtsevich/ibuziuk: JSP-to-HTML-converter-plugin and 20 other directories.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2012-08-28 11:23:31 -0400 (Tue, 28 Aug 2012)
New Revision: 43265
Added:
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/.classpath
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/.project
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/.settings/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/.settings/org.eclipse.jdt.core.prefs
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/META-INF/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/META-INF/MANIFEST.MF
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/config/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/config/tagConfig.xml
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/icons/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/icons/tree.jpg
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/annotations-api.jar
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/catalina-ant.jar
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/catalina-ha.jar
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/catalina-tribes.jar
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/catalina.jar
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/ecj-3.7.2.jar
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/el-api.jar
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/jasper-el.jar
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/jasper.jar
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/jsp-api.jar
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/jstl-1.2.jar
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/servlet-api.jar
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-api.jar
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-coyote.jar
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-dbcp.jar
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-i18n-es.jar
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-i18n-fr.jar
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-i18n-ja.jar
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-jdbc.jar
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-util.jar
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/plugin.xml
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/Activator.java
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/TagAttribyteStorage.java
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/XMLParser.java
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/actions/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/actions/SampleAction.java
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/MyJspContext.java
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/MyJspFragment.java
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/MyJspWriter.java
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/MyPageContext.java
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/BodyContentTag.java
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/HelloTag.java
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/MyTag.java
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/ShowDateTag.java
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/TagLifecycle.java
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/simple/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/simple/tag/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/simple/tag/SimpleTagImpl.java
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/util/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/util/EditorUtil.java
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/util/FileUtil.java
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/util/SelectionUtil.java
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/util/WriterOutputStream.java
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/calendar_template.html
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/ccFoo_template.html
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/from_template.html
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/jspBody_template.html
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/test_template.html
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/view_template.html
workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/info.txt
Log:
https://issues.jboss.org/browse/JBIDE-12502 - Create a prototype of a VPE templating system without using JavaXPCOM
- VPE templating system without using JavaXPCOM created by Ilya Buziuk - initial commit
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/.classpath
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/.classpath (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/.classpath 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry exported="true" kind="lib" path="lib/annotations-api.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/catalina-ant.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/catalina-ha.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/catalina-tribes.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/catalina.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/ecj-3.7.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/el-api.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jasper-el.jar" sourcepath="c:/Users/ibuziuk/Downloads/apache-tomcat-7.0.29-src.zip"/>
+ <classpathentry exported="true" kind="lib" path="lib/jasper.jar" sourcepath="C:/Users/ibuziuk/Downloads/apache-tomcat-7.0.29-src.zip"/>
+ <classpathentry exported="true" kind="lib" path="lib/jsp-api.jar" sourcepath="C:/Users/ibuziuk/Downloads/apache-tomcat-7.0.29-src.zip"/>
+ <classpathentry exported="true" kind="lib" path="lib/servlet-api.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/tomcat-api.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/tomcat-coyote.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/tomcat-dbcp.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/tomcat-i18n-es.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/tomcat-i18n-fr.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/tomcat-i18n-ja.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/tomcat-jdbc.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/tomcat-util.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/jstl-1.2.jar" sourcepath="c:/Users/ibuziuk/Downloads/jstl-1.2-sources.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/.project
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/.project (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/.project 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>by.buziuk.dom.parser</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/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/.settings/org.eclipse.jdt.core.prefs 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,7 @@
+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.compliance=1.6
+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/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/META-INF/MANIFEST.MF
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/META-INF/MANIFEST.MF (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/META-INF/MANIFEST.MF 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,33 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Parser
+Bundle-SymbolicName: by.buziuk.dom.parser; singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: by.buziuk.dom.parser.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.ui.editors,
+ org.eclipse.jface.text
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.eclipse.wst.xml.core.internal.document
+Bundle-ClassPath: lib/annotations-api.jar,
+ lib/catalina-ant.jar,
+ lib/catalina-ha.jar,
+ lib/catalina-tribes.jar,
+ lib/catalina.jar,
+ lib/ecj-3.7.2.jar,
+ lib/el-api.jar,
+ lib/jasper-el.jar,
+ lib/jasper.jar,
+ lib/jsp-api.jar,
+ lib/servlet-api.jar,
+ lib/tomcat-api.jar,
+ lib/tomcat-coyote.jar,
+ lib/tomcat-dbcp.jar,
+ lib/tomcat-i18n-es.jar,
+ lib/tomcat-i18n-fr.jar,
+ lib/tomcat-i18n-ja.jar,
+ lib/tomcat-jdbc.jar,
+ lib/tomcat-util.jar,
+ lib/jstl-1.2.jar
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/config/tagConfig.xml
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/config/tagConfig.xml (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/config/tagConfig.xml 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<config>
+ <schemas>
+ <schema prefix="j" uri="http://java.sun.com/JSP/Page" />
+ <schema prefix="" uri="http://www.w3.org/1999/xhtml" />
+ <schema prefix="t" uri="urn:jsptagdir:/WEB-INF/tags" />
+ <schema prefix="cc" uri="http://java.sun.com/jsp/jstl/core" />
+ <schema prefix="c" uri="http://java.sun.com/jsp/jstl/core" />
+
+ </schemas>
+ <tags>
+
+ <tag name="test" file="template/test_template.html"></tag>
+ <tag name="from" file="template/from_template.html"></tag>
+ <tag name="calendar" file="template/calendar_template.html"></tag>
+ <tag name="view" file="template/view_template.html"></tag>
+
+ <tag name="j:body" file="template/jspBody_template.html"></tag>
+ <tag name="cc:foo" file="template/ccFoo_template.html"></tag>
+
+ <tag name="showDate" class="by.buziuk.dom.parser.template.util.body.tag.ShowDateTag"></tag>
+ <tag name="life" class="by.buziuk.dom.parser.template.util.body.tag.TagLifecycle"></tag>
+ <tag name="bodyRepeater" class="by.buziuk.dom.parser.template.util.body.tag.BodyContentTag"></tag>
+ <tag name="myTag" class="by.buziuk.dom.parser.template.util.body.tag.MyTag"></tag>
+ <tag name="helloTag" class="by.buziuk.dom.parser.template.util.body.tag.HelloTag"></tag>
+ <tag name="repeatBody" class="by.buziuk.dom.parser.template.util.simple.tag.SimpleTagImpl"></tag>
+
+ <!--START JSTL core -->
+ <tag name="c:catch" class="org.apache.taglibs.standard.tag.common.core.CatchTag"></tag>
+ <tag name="c:choose" class="org.apache.taglibs.standard.tag.common.core.ChooseTag"></tag>
+ <tag name="c:if" class="org.apache.taglibs.standard.tag.rt.core.IfTag"></tag>
+ <tag name="c:import" class="org.apache.taglibs.standard.tag.rt.core.ImportTag"></tag>
+ <tag name="c:forEach" class="org.apache.taglibs.standard.tag.rt.core.ForEachTag"></tag>
+ <tag name="c:forTokens" class="org.apache.taglibs.standard.tag.rt.core.ForTokensTag"></tag>
+ <tag name="c:out" class="org.apache.taglibs.standard.tag.rt.core.OutTag"></tag>
+ <tag name="c:otherwise" class="org.apache.taglibs.standard.tag.common.core.OtherwiseTag"></tag>
+ <tag name="c:param" class="org.apache.taglibs.standard.tag.rt.core.ParamTag"></tag>
+ <tag name="c:redirect" class="org.apache.taglibs.standard.tag.rt.core.RedirectTag"></tag>
+ <tag name="c:remove" class="org.apache.taglibs.standard.tag.common.core.RemoveTag"></tag>
+ <tag name="c:set" class="org.apache.taglibs.standard.tag.rt.core.SetTag"></tag>
+ <tag name="c:url" class="org.apache.taglibs.standard.tag.rt.core.UrlTag"></tag>
+ <tag name="c:when" class="org.apache.taglibs.standard.tag.rt.core.WhenTag"></tag>
+ <!--END JSTL core -->
+
+ </tags>
+</config>
\ No newline at end of file
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/icons/tree.jpg
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/icons/tree.jpg
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/annotations-api.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/annotations-api.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/catalina-ant.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/catalina-ant.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/catalina-ha.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/catalina-ha.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/catalina-tribes.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/catalina-tribes.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/catalina.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/catalina.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/ecj-3.7.2.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/ecj-3.7.2.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/el-api.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/el-api.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/jasper-el.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/jasper-el.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/jasper.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/jasper.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/jsp-api.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/jsp-api.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/jstl-1.2.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/jstl-1.2.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/servlet-api.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/servlet-api.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-api.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-api.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-coyote.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-coyote.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-dbcp.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-dbcp.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-i18n-es.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-i18n-es.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-i18n-fr.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-i18n-fr.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-i18n-ja.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-i18n-ja.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-jdbc.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-jdbc.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-util.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/lib/tomcat-util.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/plugin.xml
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/plugin.xml (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/plugin.xml 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.actionSets">
+ <actionSet
+ label="Sample Action Set"
+ visible="true"
+ id="by.buziuk.dom.parser.actionSet">
+ <action
+ label="&Sample Action"
+ icon="icons/tree.jpg"
+ class="by.buziuk.dom.parser.actions.SampleAction"
+ tooltip="Parse to DOM"
+ toolbarPath="sampleGroup"
+ id="by.buziuk.dom.parser.actions.SampleAction">
+ </action>
+ </actionSet>
+ </extension>
+
+</plugin>
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/Activator.java
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/Activator.java (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/Activator.java 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,61 @@
+package by.buziuk.dom.parser;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+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.dom.parser"; //$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)
+ */
+ 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)
+ */
+ 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;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/TagAttribyteStorage.java
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/TagAttribyteStorage.java (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/TagAttribyteStorage.java 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,22 @@
+package by.buziuk.dom.parser;
+
+public class TagAttribyteStorage {
+ private String filePath;
+ private String classPath;
+
+ public String getFilePath() {
+ return filePath;
+ }
+
+ public void setFilePath(String filePath) {
+ this.filePath = filePath;
+ }
+
+ public String getClassPath() {
+ return classPath;
+ }
+
+ public void setClassPath(String classPath) {
+ this.classPath = classPath;
+ }
+}
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/XMLParser.java
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/XMLParser.java (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/XMLParser.java 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,66 @@
+package by.buziuk.dom.parser;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class XMLParser {
+
+ public static Map<String, TagAttribyteStorage> getTagAttributes(String fileName,
+ String parentTag, String keyAttribute,
+ String firstOptinalAttributeValue,
+ String secondOptionalAttributeValue) {
+
+ Map<String, TagAttribyteStorage> attributeMap = new HashMap<String, TagAttribyteStorage>();
+
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ File file = new File(fileName);
+
+ if (file.exists()) {
+ Document doc = db.parse(file);
+ Element docElement = doc.getDocumentElement();
+
+ // Print root element of the document
+ System.out.println("Root element of the document: " + docElement.getNodeName());
+
+ NodeList tagList = docElement.getElementsByTagName(parentTag);
+ // Print total tag elements in the document
+
+ System.out.println("Total tags length: " + tagList.getLength());
+
+ if (tagList != null && tagList.getLength() > 0) {
+ for (int i = 0; i < tagList.getLength(); i++) {
+ Node node = tagList.item(i);
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element e = (Element) node;
+
+ if (e.hasAttribute(keyAttribute) && (e.hasAttribute(firstOptinalAttributeValue) || e.hasAttribute(secondOptionalAttributeValue))) {
+
+ String tagName = e.getAttribute(keyAttribute);
+ String firstAttribute = e.getAttribute(firstOptinalAttributeValue);
+ String secondAttribute = e.getAttribute(secondOptionalAttributeValue);
+
+ TagAttribyteStorage tagAttribyteStorage = new TagAttribyteStorage();
+ tagAttribyteStorage.setFilePath(firstAttribute);
+ tagAttribyteStorage.setClassPath(secondAttribute);
+
+ attributeMap.put(tagName, tagAttribyteStorage);
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ return attributeMap;
+ }
+}
\ No newline at end of file
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/actions/SampleAction.java
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/actions/SampleAction.java (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/actions/SampleAction.java 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,420 @@
+package by.buziuk.dom.parser.actions;
+
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.io.File;
+import java.io.IOException;
+import java.io.Writer;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Map;
+import javax.servlet.jsp.JspContext;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.tagext.BodyContent;
+import javax.servlet.jsp.tagext.BodyTag;
+import javax.servlet.jsp.tagext.IterationTag;
+import javax.servlet.jsp.tagext.JspFragment;
+import javax.servlet.jsp.tagext.JspTag;
+import javax.servlet.jsp.tagext.SimpleTag;
+import javax.servlet.jsp.tagext.Tag;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import by.buziuk.dom.parser.TagAttribyteStorage;
+import by.buziuk.dom.parser.XMLParser;
+import by.buziuk.dom.parser.template.util.MyJspContext;
+import by.buziuk.dom.parser.template.util.MyJspWriter;
+import by.buziuk.dom.parser.template.util.MyPageContext;
+import by.buziuk.dom.parser.util.FileUtil;
+import by.buziuk.dom.parser.util.SelectionUtil;
+
+
+/**
+ * Our sample action implements workbench action delegate. The action proxy will
+ * be created by the workbench and shown in the UI. When the user tries to use
+ * the action, this delegate will be created and execution will be delegated to
+ * it.
+ *
+ * @see IWorkbenchWindowActionDelegate
+ */
+public class SampleAction implements IWorkbenchWindowActionDelegate {
+
+ private IWorkbenchWindow window;
+
+ private static final String CHILDREN_INSERT_POINT = "CHILDREN INSERTION POINT";
+ private final String CONTEXT = "config/tagConfig.xml";
+
+ // Tags attributes
+ private final static String TAG = "tag";
+ private final static String NAME = "name";
+ private final static String FILE = "file";
+ private final static String CLASS = "class";
+
+ // Shema attributes
+ private final static String SCHEMA = "schema";
+ private final static String PREFIX = "prefix";
+ private final static String URI = "uri";
+
+ // Maps
+ private Map<String, TagAttribyteStorage> tagAttributeMap = null;
+ private Map<String, TagAttribyteStorage> shemaAttributeMap = null;
+
+ private PageContext context;
+
+ /**
+ * The constructor.
+ */
+ public SampleAction() {
+ }
+
+ /**
+ * The action has been activated. The argument of the method represents the
+ * 'real' action sitting in the workbench UI.
+ *
+ * @see IWorkbenchWindowActionDelegate#run
+ */
+ public void run(IAction action) {
+ ISelection selection = SelectionUtil.getCurrentSelection();
+
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ssel = (IStructuredSelection) selection;
+ Object firstElement = ssel.getFirstElement();
+
+ if (firstElement instanceof Element) {
+
+ shemaAttributeMap = getShemaAttributeMap();
+ tagAttributeMap = getTagAttributeMap();
+ context = new MyPageContext(); // page context - one for the whole page
+
+ NodeList childNodes = ((Element) firstElement).getOwnerDocument().getChildNodes();
+ for (int i = 0; i < childNodes.getLength(); i++) {
+ try {
+ processNode(childNodes.item(i), null);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ }
+ }
+ }
+
+ private Map<String, TagAttribyteStorage> getShemaAttributeMap() {
+ if (shemaAttributeMap == null) {
+ shemaAttributeMap = XMLParser.getTagAttributes(
+ SelectionUtil.getResourcePath(CONTEXT), SCHEMA, URI,
+ PREFIX, "");
+ }
+ return shemaAttributeMap;
+ }
+
+ private Map<String, TagAttribyteStorage> getTagAttributeMap() {
+ if (tagAttributeMap == null) {
+ tagAttributeMap = XMLParser.getTagAttributes(
+ SelectionUtil.getResourcePath(CONTEXT), TAG, NAME, FILE,
+ CLASS);
+ }
+ return tagAttributeMap;
+ }
+
+ private String getFileContextDefinedInTagMap(String tagName,
+ Map<String, TagAttribyteStorage> tagAttributeMap) {
+ if (tagAttributeMap.containsKey(tagName)) {
+ TagAttribyteStorage attributeStorrage = tagAttributeMap.get(tagName);
+ if(attributeStorrage.getFilePath() != null && attributeStorrage.getFilePath().length() != 0){
+ File file = new File(
+ SelectionUtil.getResourcePath(attributeStorrage.getFilePath()));
+ String fileContext = FileUtil.getFilecontext(file);
+ return fileContext;
+ }
+ }
+ return null;
+ }
+
+ private String getClassNameDefinedInTagMap(String tagName,
+ Map<String, TagAttribyteStorage> tagAttributeMap) {
+ if (tagAttributeMap.containsKey(tagName)) {
+ TagAttribyteStorage attributeStorage = tagAttributeMap.get(tagName);
+ if(attributeStorage.getClassPath() != null && attributeStorage.getClassPath().length() != 0){
+ return attributeStorage.getClassPath();
+ }
+
+ }
+ return null;
+ }
+
+ private void processNode(final Node node, JspTag parentTag) throws IOException {
+
+ String tagName;
+
+ if (node.getNamespaceURI() != null && shemaAttributeMap.containsKey(node.getNamespaceURI())) {
+ tagName = shemaAttributeMap.get(node.getNamespaceURI()).getFilePath() + ":" + node.getLocalName();
+ } else {
+ tagName = node.getNodeName();
+ }
+
+ String fileContext = getFileContextDefinedInTagMap(tagName, tagAttributeMap);
+ String className = getClassNameDefinedInTagMap(tagName, tagAttributeMap);
+
+
+ if (fileContext != null) {
+ context.getOut().println(FileUtil.getContextBeforeKeyString(fileContext,CHILDREN_INSERT_POINT));
+ processChildren(node, parentTag);
+ context.getOut().println(FileUtil.getContextAfterKeyString(fileContext, CHILDREN_INSERT_POINT));
+ } else if (className != null) {
+
+ try {
+ Class<?> tagHandlerClass = Class.forName(className);
+ Object object = tagHandlerClass.newInstance();
+
+ if (object instanceof SimpleTag) {
+ SimpleTag simpleTag = (SimpleTag) object;
+ processSimpleTag(node, simpleTag, tagHandlerClass, parentTag);
+ } else if (object instanceof Tag){
+ Tag tag = (Tag) object;
+ processClassicTag(node, tag, tagHandlerClass, parentTag);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ } else {
+
+ short nodeType = node.getNodeType();
+
+ switch (nodeType) {
+ case Node.ELEMENT_NODE:
+ context.getOut().println("<" + node.getNodeName() + ">");
+ processChildren(node, null);
+ context.getOut().println("</" + node.getNodeName() + ">");
+ break;
+
+ case Node.TEXT_NODE:
+ context.getOut().println(node.getTextContent().trim());
+ break;
+
+ case Node.DOCUMENT_TYPE_NODE:
+ context.getOut().println("<!DOCTYPE " + node.getNodeName() + ">");
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+
+ private void processChildren(Node node, JspTag parentTag) throws IOException{
+ NodeList childNodes = node.getChildNodes();
+ for(int i = 0; i < childNodes.getLength(); i++){
+ if(childNodes.item(i).getNodeType() == Node.ELEMENT_NODE){
+ processNode(childNodes.item(i), parentTag);
+ }else{
+ context.getOut().println(childNodes.item(i).getTextContent().trim());
+ }
+ }
+ }
+
+ private boolean processClassicTag(Node node, Tag tag,
+ Class<?> tagHandlerClass, JspTag parentTag) {
+
+ try {
+ JspWriter out = context.getOut();
+ tag.setPageContext(context);
+
+ if (parentTag instanceof Tag) {
+ tag.setParent((Tag) parentTag);
+ } else {
+ tag.setParent(null);
+ }
+
+ if (node.hasAttributes()) {
+ setAttributesToTagHandler(node, tagHandlerClass, tag);
+ }
+
+ int evalTag = tag.doStartTag();
+ if (evalTag != Tag.SKIP_BODY) {
+ if (evalTag != Tag.EVAL_BODY_INCLUDE) {
+ out = context.pushBody();
+ if (tag instanceof BodyTag) {
+ BodyTag bodyTag = (BodyTag) tag;
+ bodyTag.setBodyContent((BodyContent) out);
+ bodyTag.doInitBody();
+ }
+ }
+ if (tag instanceof IterationTag) {
+ IterationTag iterationTag = (IterationTag) tag;
+ do {
+ processChildren(node, tag);
+ int evalDoAfterbody = iterationTag.doAfterBody();
+ if (evalDoAfterbody != BodyTag.EVAL_BODY_AGAIN) {
+ break;
+ }
+ } while (true);
+ if (evalTag != Tag.EVAL_BODY_INCLUDE) {
+ out = context.popBody();
+ }
+ }
+ }
+ if (tag.doEndTag() == Tag.SKIP_PAGE){
+// TagHandlerPool.reuse(tag);
+ return true;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+// TagHandlerPool.reuse(tag);
+ return false;
+ }
+
+ private boolean processSimpleTag(final Node node, final SimpleTag simpleTag,
+ Class<?> testClass, JspTag parentTag) {
+
+ try {
+// JspWriter out = context.getOut();
+
+ final MyJspContext context = new MyJspContext();
+ simpleTag.setJspContext(context);
+
+ if (parentTag != null) {
+ simpleTag.setParent(parentTag);
+ }
+
+ if (node.hasAttributes()) {
+ setAttributesToTagHandler(node, testClass, simpleTag);
+ }
+
+ simpleTag.setJspBody(new JspFragment() {
+
+ @Override
+ public void invoke(Writer out) throws JspException, IOException {
+ // TODO: check .tld for skip_body (minor)
+ processChildren(node, simpleTag);
+ }
+
+ @Override
+ public JspContext getJspContext() {
+ return context;
+ }
+ });
+
+ simpleTag.doTag();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+// _jsp_instancemanager.destroyInstance(_jspx_th_myTag_005fRepeatBody_005f0);
+ return false;
+ }
+
+ private void setAttributesToTagHandler(Node node, Class<?> testClass, JspTag tag) {
+
+ try{
+ NamedNodeMap attributes = node.getAttributes();
+ BeanInfo info = Introspector.getBeanInfo(testClass);
+ PropertyDescriptor[] prop = info.getPropertyDescriptors();
+
+ for (int i = 0; i < attributes.getLength(); i++) {
+ Attr attribute = (Attr) attributes.item(i);
+ String attributeName = attribute.getName();
+
+ for (int j = 0; j < prop.length; j++) {
+ if (attributeName.equals(prop[j].getName())) {
+
+ Method method = prop[j].getWriteMethod();
+ Class<?> parametrType = method.getParameterTypes()[0];
+
+ methodInvocation(method, parametrType, attribute, tag);
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void methodInvocation(Method method, Class<?> parametrType,
+ Attr attribute, JspTag tag) throws IllegalArgumentException,
+ IllegalAccessException, InvocationTargetException {
+
+ if (parametrType == int.class) {
+ int intValue;
+ try {
+ intValue = Integer.parseInt(attribute
+ .getValue());
+ } catch (NumberFormatException e) {
+ intValue = 1;
+ }
+ method.invoke(tag, intValue);
+
+ } else if (parametrType == double.class) {
+ double doubleValue;
+ try {
+ doubleValue = Double.parseDouble(attribute.getValue());
+ }catch (NumberFormatException e){
+ doubleValue = 1;
+ }
+ method.invoke(tag, doubleValue);
+
+ } else if (parametrType == float.class) {
+ float floatValue;
+ try{
+ floatValue = Float.parseFloat(attribute.getValue());
+ }catch(NumberFormatException e){
+ floatValue = 1;
+ }
+ method.invoke(tag, floatValue);
+
+ } else if (parametrType == boolean.class) {
+ boolean booleanValue;
+ try {
+ booleanValue = Boolean.parseBoolean(attribute.getValue());
+ }catch(NumberFormatException e){
+ booleanValue = false;
+ }
+ method.invoke(tag, booleanValue);
+ } else {
+ method.invoke(tag, attribute.getValue());
+ }
+
+ }
+
+ /**
+ * Selection in the workbench has been changed. We can change the state of
+ * the 'real' action here if we want, but this can only happen after the
+ * delegate has been created.
+ *
+ * @see IWorkbenchWindowActionDelegate#selectionChanged
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ /**
+ * We can use this method to dispose of any system resources we previously
+ * allocated.
+ *
+ * @see IWorkbenchWindowActionDelegate#dispose
+ */
+ public void dispose() {
+ }
+
+ /**
+ * We will cache window object in order to be able to provide parent shell
+ * for the message dialog.
+ *
+ * @see IWorkbenchWindowActionDelegate#init
+ */
+ public void init(IWorkbenchWindow window) {
+ this.window = window;
+ }
+}
\ No newline at end of file
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/MyJspContext.java
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/MyJspContext.java (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/MyJspContext.java 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,93 @@
+package by.buziuk.dom.parser.template.util;
+
+import java.util.Enumeration;
+
+import javax.el.ELContext;
+import javax.servlet.jsp.JspContext;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.el.ExpressionEvaluator;
+import javax.servlet.jsp.el.VariableResolver;
+
+
+public class MyJspContext extends JspContext {
+
+ private MyJspWriter out = new MyJspWriter(1000, true);
+
+ @Override
+ public void setAttribute(String name, Object value) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setAttribute(String name, Object value, int scope) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Object getAttribute(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object getAttribute(String name, int scope) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object findAttribute(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void removeAttribute(String name) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void removeAttribute(String name, int scope) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public int getAttributesScope(String name) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public Enumeration<String> getAttributeNamesInScope(int scope) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JspWriter getOut() {
+ return out;
+ }
+
+ @Override
+ public ExpressionEvaluator getExpressionEvaluator() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ELContext getELContext() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public VariableResolver getVariableResolver() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/MyJspFragment.java
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/MyJspFragment.java (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/MyJspFragment.java 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,23 @@
+package by.buziuk.dom.parser.template.util;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import javax.servlet.jsp.JspContext;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.JspFragment;
+
+public class MyJspFragment extends JspFragment {
+ private MyJspContext context = new MyJspContext();
+
+ @Override
+ public void invoke(Writer out) throws JspException, IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public JspContext getJspContext() {
+ return context;
+ }
+}
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/MyJspWriter.java
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/MyJspWriter.java (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/MyJspWriter.java 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,182 @@
+package by.buziuk.dom.parser.template.util;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+import java.io.Writer;
+
+import javax.servlet.jsp.JspWriter;
+
+import by.buziuk.dom.parser.util.WriterOutputStream;
+
+public class MyJspWriter extends JspWriter {
+
+ private PrintStream out = System.out;
+
+ public MyJspWriter(int bufferSize, boolean autoFlush) { // was changed from protected to public
+ super(bufferSize, autoFlush);
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public void newLine() throws IOException {
+ out.println();
+ }
+
+
+
+ public void print(boolean b) {
+ out.print(b);
+ }
+
+
+
+ public void print(char c) {
+ out.print(c);
+ }
+
+
+
+ public void print(int i) {
+ out.print(i);
+ }
+
+
+
+ public void print(long l) {
+ out.print(l);
+ }
+
+
+
+ public void print(float f) {
+ out.print(f);
+ }
+
+
+
+ public void print(double d) {
+ out.print(d);
+ }
+
+
+
+ public void print(char[] s) {
+ out.print(s);
+ }
+
+
+
+ public void print(String s) {
+ out.print(s);
+ }
+
+
+
+ public void print(Object obj) {
+ out.print(obj);
+ }
+
+
+
+ public void println() {
+ out.println();
+ }
+
+
+
+ public void println(boolean x) {
+ out.println(x);
+ }
+
+
+
+ public void println(char x) {
+ out.println(x);
+ }
+
+
+
+ public void println(int x) {
+ out.println(x);
+ }
+
+
+
+ public void println(long x) {
+ out.println(x);
+ }
+
+
+
+ public void println(float x) {
+ out.println(x);
+ }
+
+
+
+ public void println(double x) {
+ out.println(x);
+ }
+
+
+
+ public void println(char[] x) {
+ out.println(x);
+ }
+
+
+
+ public void println(String x) {
+ out.println(x);
+ }
+
+
+
+ public void println(Object x) {
+ out.println(x);
+ }
+
+
+
+ @Override
+ public void clear() throws IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void clearBuffer() throws IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void flush() throws IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void close() throws IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public int getRemaining() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public void write(char[] cbuf, int off, int len) throws IOException {
+ out.write(new String(cbuf).getBytes(), off, len);
+ }
+
+
+ public void setWriter(Writer writer) {
+// out = (PrintStream) new WriterOutputStream(writer, "UTF-8"); // out
+
+ }
+}
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/MyPageContext.java
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/MyPageContext.java (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/MyPageContext.java 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,249 @@
+package by.buziuk.dom.parser.template.util;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Enumeration;
+
+import javax.el.ELContext;
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpSession;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.el.ExpressionEvaluator;
+import javax.servlet.jsp.el.VariableResolver;
+import javax.servlet.jsp.tagext.BodyContent;
+
+import org.apache.jasper.el.ELContextImpl;
+import org.apache.jasper.runtime.BodyContentImpl;
+
+public class MyPageContext extends PageContext {
+
+ private MyJspWriter baseOut;
+ private JspWriter out;
+ private BodyContentImpl[] outs;
+ private int depth;
+
+ public MyPageContext() {
+ baseOut = new MyJspWriter(1000, true);
+ out = baseOut;
+ this.outs = new BodyContentImpl[0];
+ this.depth = -1;
+ }
+
+ @Override
+ public void initialize(Servlet servlet, ServletRequest request,
+ ServletResponse response, String errorPageURL,
+ boolean needsSession, int bufferSize, boolean autoFlush)
+ throws IOException, IllegalStateException, IllegalArgumentException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void release() {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public HttpSession getSession() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object getPage() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ServletRequest getRequest() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ServletResponse getResponse() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Exception getException() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ServletConfig getServletConfig() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ServletContext getServletContext() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void forward(String relativeUrlPath) throws ServletException,
+ IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void include(String relativeUrlPath) throws ServletException,
+ IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void include(String relativeUrlPath, boolean flush)
+ throws ServletException, IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void handlePageException(Exception e) throws ServletException,
+ IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void handlePageException(Throwable t) throws ServletException,
+ IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setAttribute(String name, Object value) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setAttribute(String name, Object value, int scope) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Object getAttribute(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object getAttribute(String name, int scope) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object findAttribute(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void removeAttribute(String name) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void removeAttribute(String name, int scope) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public int getAttributesScope(String name) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public Enumeration<String> getAttributeNamesInScope(int scope) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public JspWriter getOut() {
+ // TODO Auto-generated method stub
+ return out;
+ }
+
+ @Override
+ public ExpressionEvaluator getExpressionEvaluator() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ELContext getELContext() {
+ return new ELContextImpl();
+ }
+
+ @Override
+ public VariableResolver getVariableResolver() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public BodyContent pushBody() {
+ depth++;
+ if (depth >= outs.length) {
+ BodyContentImpl[] newOuts = new BodyContentImpl[depth + 1];
+ for (int i = 0; i < outs.length; i++) {
+ newOuts[i] = outs[i];
+ }
+ newOuts[depth] = new BodyContentImpl(out);
+ outs = newOuts;
+ }
+
+ // outs[depth].setWriter(writer);
+ out = outs[depth];
+
+ // Update the value of the "out" attribute in the page scope
+ // attribute namespace of this PageContext
+ setAttribute(OUT, out);
+
+ return outs[depth];
+ }
+
+ @Override
+ public JspWriter pushBody(Writer writer) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public JspWriter popBody() {
+ depth--;
+ if (depth >= 0) {
+ out = outs[depth];
+ } else {
+ out = baseOut;
+ }
+
+ // Update the value of the "out" attribute in the page scope
+ // attribute namespace of this PageContext
+ setAttribute(OUT, out);
+
+ return out;
+ }
+}
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/BodyContentTag.java
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/BodyContentTag.java (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/BodyContentTag.java 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,52 @@
+package by.buziuk.dom.parser.template.util.body.tag;
+
+import java.io.IOException;
+import javax.servlet.jsp.JspWriter;
+import javax.servlet.jsp.tagext.BodyContent;
+import javax.servlet.jsp.tagext.BodyTagSupport;
+
+public class BodyContentTag extends BodyTagSupport
+{
+ private int iterations, howMany;
+
+ public void setHowMany(int i)
+ {
+ this.howMany = i;
+ }
+
+ public void setBodyContent(BodyContent bc)
+ {
+ super.setBodyContent(bc);
+ System.out.println("BodyContent = '" + bc.getString() + "'");
+ }
+
+ public int doAfterBody()
+ {
+ try
+ {
+ BodyContent bodyContent = super.getBodyContent();
+ String bodyString = bodyContent.getString();
+ JspWriter out = bodyContent.getEnclosingWriter();
+
+ if ( iterations % 2 == 0 )
+ out.print(bodyString.toLowerCase());
+ else
+ out.print(bodyString.toUpperCase());
+
+ iterations++;
+ bodyContent.clear(); // empty buffer for next evaluation
+ }
+ catch (IOException e)
+ {
+ System.out.println("Error in BodyContentTag.doAfterBody()" + e.getMessage());
+ e.printStackTrace();
+ } // end of catch
+
+ int retValue = SKIP_BODY;
+
+ if ( iterations < howMany )
+ retValue = EVAL_BODY_AGAIN;
+
+ return retValue;
+ }
+}
\ No newline at end of file
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/HelloTag.java
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/HelloTag.java (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/HelloTag.java 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,13 @@
+package by.buziuk.dom.parser.template.util.body.tag;
+import java.io.*;
+import javax.servlet.jsp.tagext.*;
+public class HelloTag extends TagSupport {
+ public int doStartTag() {
+ try {
+ pageContext.getOut().write("Hello world!");
+ } catch (IOException e) {
+ System.err.println(e.toString());
+ }
+ return SKIP_BODY;
+ }
+}
\ No newline at end of file
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/MyTag.java
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/MyTag.java (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/MyTag.java 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,24 @@
+package by.buziuk.dom.parser.template.util.body.tag;
+
+import javax.servlet.*;
+import javax.servlet.jsp.*;
+import javax.servlet.jsp.tagext.*;
+import java.util.*;
+import java.io.*;
+
+public class MyTag extends BodyTagSupport {
+ public int doAfterBody() throws JspException {
+ try {
+ BodyContent bodycontent = getBodyContent();
+ String body = bodycontent.getString();
+
+ if (body != null) {
+ System.out.println("This is body context!!!");
+ pageContext.getOut().write(body.toUpperCase());
+ }
+ } catch (IOException ioe) {
+ throw new JspException("Error:" + ioe.getMessage());
+ }
+ return SKIP_BODY;
+ }
+}
\ No newline at end of file
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/ShowDateTag.java
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/ShowDateTag.java (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/ShowDateTag.java 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,50 @@
+package by.buziuk.dom.parser.template.util.body.tag;
+
+import java.io.IOException;
+import java.util.Date;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.tagext.Tag;
+
+
+public class ShowDateTag implements Tag {
+
+ private PageContext pageContext;
+ private Tag parent;
+
+ @Override
+ public void setPageContext(PageContext pc) {
+ this.pageContext = (PageContext) pc;
+
+ }
+
+ @Override
+ public int doStartTag() throws JspException {
+ return SKIP_BODY;
+ }
+
+ @Override
+ public int doEndTag() throws JspException {
+ try {
+ pageContext.getOut().print("" + new Date());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return EVAL_PAGE;
+ }
+
+ @Override
+ public void setParent(Tag tag) {
+ this.parent = tag;
+ }
+
+ @Override
+ public void release() {
+ }
+
+ @Override
+ public Tag getParent() {
+ return this.parent;
+ }
+}
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/TagLifecycle.java
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/TagLifecycle.java (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/body/tag/TagLifecycle.java 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,82 @@
+package by.buziuk.dom.parser.template.util.body.tag;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.tagext.Tag;
+import javax.servlet.jsp.tagext.TagSupport;
+
+public class TagLifecycle extends TagSupport
+{
+ // Code to implement the "attr2" attribute
+
+ private String attr2;
+
+
+ // Constructor
+
+ public TagLifecycle()
+ {
+ System.out.println("TagLifecycle constructor called");
+ }
+
+ // Methods inherited from TagSupport
+
+ public void setPageContext(PageContext p)
+ {
+ super.setPageContext(p);
+ System.out.println("setPageContext() called (" + p + ")");
+ }
+
+ public void setParent(Tag t)
+ {
+ super.setParent(t);
+ System.out.println("setParent() called (" + t + ")");
+ }
+
+ public Tag getParent()
+ {
+ System.out.println("getParent() called");
+ return super.getParent();
+ }
+
+ public void release()
+ {
+ System.out.println("release() called");
+ }
+
+ // Code to implement the "attr1" attribute
+
+ private String attr1;
+ public String getAttr1()
+ {
+ return attr1;
+ }
+ public void setAttr1(String s)
+ {
+ System.out.println("setAttr1() called with value " + s);
+ attr1 = s;
+ }
+
+ public String getAttr2()
+ {
+ return attr2;
+ }
+ public void setAttr2(String s)
+ {
+ System.out.println("setAttr2() called with value " + s);
+ attr2 = s;
+ }
+
+ public int doStartTag() throws JspException
+ {
+ System.out.println("doStartTag() called");
+
+ return SKIP_BODY;
+ }
+
+ public int doEndTag() throws JspException
+ {
+ System.out.println("doEndTag() called");
+ return super.doEndTag();
+ }
+}
\ No newline at end of file
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/simple/tag/SimpleTagImpl.java
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/simple/tag/SimpleTagImpl.java (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/template/util/simple/tag/SimpleTagImpl.java 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,57 @@
+package by.buziuk.dom.parser.template.util.simple.tag;
+
+import java.io.IOException;
+
+import javax.servlet.jsp.JspContext;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.JspFragment;
+import javax.servlet.jsp.tagext.JspTag;
+import javax.servlet.jsp.tagext.SimpleTag;
+
+import by.buziuk.dom.parser.template.util.MyPageContext;
+
+public class SimpleTagImpl implements SimpleTag {
+
+ private JspTag parentTag;
+ private JspContext jspContext;
+ private JspFragment jspBody;
+
+ private int howMany;
+
+ @Override
+ public void doTag() throws JspException, IOException {
+
+ for(int i =0; i < howMany; i++){
+ jspBody.invoke(jspContext.getOut());
+ }
+ }
+
+ @Override
+ public void setParent(JspTag parent) {
+ this.parentTag = parent;
+
+ }
+
+ @Override
+ public JspTag getParent() {
+ return this.parentTag;
+ }
+
+ @Override
+ public void setJspContext(JspContext context) {
+ this.jspContext = context;
+ }
+
+ @Override
+ public void setJspBody(JspFragment jspBody) {
+ this.jspBody = jspBody;
+ }
+
+ public int getHowMany() {
+ return howMany;
+ }
+
+ public void setHowMany(int howMany) {
+ this.howMany = howMany;
+ }
+}
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/util/EditorUtil.java
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/util/EditorUtil.java (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/util/EditorUtil.java 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,12 @@
+package by.buziuk.dom.parser.util;
+
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+
+public class EditorUtil {
+ public static IWorkbenchPart getActivePart() {
+ IWorkbenchPart part = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().getActivePart();
+ return part;
+ }
+}
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/util/FileUtil.java
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/util/FileUtil.java (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/util/FileUtil.java 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,45 @@
+package by.buziuk.dom.parser.util;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+public class FileUtil {
+
+ public static String getFilecontext(File file) {
+
+ String line = null;
+ StringBuffer lines = new StringBuffer();
+
+ try{
+ FileReader reader = new FileReader(file);
+ BufferedReader bufferedReader = new BufferedReader(reader);
+ while ( (line = bufferedReader.readLine()) != null) {
+ lines.append(line);
+ lines.append("\n");
+ }
+ bufferedReader.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ return lines.toString();
+
+ }
+
+ public static String getContextBeforeKeyString(String primaryString, String keyString){
+ StringBuilder stringBuilder = new StringBuilder(primaryString);
+ int index = stringBuilder.indexOf(keyString);
+ return stringBuilder.substring(0, index);
+ }
+
+ public static String getContextAfterKeyString(String primaryString, String keyString){
+ int primaryStringLength = primaryString.length();
+
+ StringBuilder stringBuilder = new StringBuilder(primaryString);
+ int index = stringBuilder.indexOf(keyString) + keyString.length();
+ return stringBuilder.substring(index, primaryStringLength);
+ }
+
+}
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/util/SelectionUtil.java
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/util/SelectionUtil.java (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/util/SelectionUtil.java 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,47 @@
+package by.buziuk.dom.parser.util;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.osgi.framework.Bundle;
+
+import by.buziuk.dom.parser.Activator;
+
+
+public class SelectionUtil {
+
+
+ public static 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 getResourcePath(String resourceName) {
+ Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
+
+ if (bundle != null) {
+ URL url = bundle.getEntry(resourceName);
+
+ if (url != null) {
+ try {
+ return FileLocator.resolve(url).getPath();
+ } catch (IOException ioe) {
+ ioe.printStackTrace();
+ }
+ }
+ }
+
+ return null;
+ }
+}
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/util/WriterOutputStream.java
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/util/WriterOutputStream.java (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/src/by/buziuk/dom/parser/util/WriterOutputStream.java 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,62 @@
+package by.buziuk.dom.parser.util;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+
+
+public class WriterOutputStream extends OutputStream
+{
+ protected Writer _writer;
+ protected String _encoding;
+ private byte[] _buf=new byte[1];
+
+ public WriterOutputStream(Writer writer, String encoding)
+ {
+ _writer=writer;
+ _encoding=encoding;
+ }
+
+ public WriterOutputStream(Writer writer)
+ {
+ _writer=writer;
+ }
+
+ public void close()
+ throws IOException
+ {
+ _writer.close();
+ _writer=null;
+ _encoding=null;
+ }
+
+ public void flush()
+ throws IOException
+ {
+ _writer.flush();
+ }
+
+ public void write(byte[] b)
+ throws IOException
+ {
+ if (_encoding==null)
+ _writer.write(new String(b));
+ else
+ _writer.write(new String(b,_encoding));
+ }
+
+ public void write(byte[] b, int off, int len)
+ throws IOException
+ {
+ if (_encoding==null)
+ _writer.write(new String(b,off,len));
+ else
+ _writer.write(new String(b,off,len,_encoding));
+ }
+
+ public synchronized void write(int b)
+ throws IOException
+ {
+ _buf[0]=(byte)b;
+ write(_buf);
+ }
+}
\ No newline at end of file
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/calendar_template.html
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/calendar_template.html (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/calendar_template.html 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,3 @@
+<new Calendar>
+ <span>CHILDREN INSERTION POINT</span>
+</new Calendar>
\ No newline at end of file
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/ccFoo_template.html
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/ccFoo_template.html (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/ccFoo_template.html 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,3 @@
+<newFoo>
+ <spanFoo>CHILDREN INSERTION POINT</spanFoo>
+</newFoo>
\ No newline at end of file
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/from_template.html
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/from_template.html (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/from_template.html 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,3 @@
+<div>
+ <span>CHILDREN INSERTION POINT</span>
+</div>
\ No newline at end of file
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/jspBody_template.html
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/jspBody_template.html (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/jspBody_template.html 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,3 @@
+<newbody>
+ <spanBody>CHILDREN INSERTION POINT</spanBody>
+</newbody>
\ No newline at end of file
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/test_template.html
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/test_template.html (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/test_template.html 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,3 @@
+<div>
+ <span>CHILDREN INSERTION POINT</span>
+</div>
\ No newline at end of file
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/view_template.html
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/view_template.html (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/by.buziuk.dom.parser/template/view_template.html 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,3 @@
+<div>
+ <span>CHILDREN INSERTION POINT</span>
+</div>
\ No newline at end of file
Added: workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/info.txt
===================================================================
--- workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/info.txt (rev 0)
+++ workspace/yradtsevich/ibuziuk/JSP-to-HTML-converter-plugin/info.txt 2012-08-28 15:23:31 UTC (rev 43265)
@@ -0,0 +1,36 @@
+about
+______________________________
+DOM parser for tags resolving
+jsp tags support
+shema support
+
+
+How it works
+______________________________
+Simply select in the text editor some tag (must be instanceof Element(org.w3c.dom)) -->
+press plug-in button -> DOM parser will parse the document and output the result to the console
+all resolving config is in "/config/tagConfig.xml" file
+(some tags will be replaced --> see folder "template")
+
+
+Environment
+_____________________________
+eclipse 4 juno (32-bit)
+jdk 6
+
+
+
+
+Programming languages
+_______________________________
+java
+
+
+
+how to install
+______________________________
+simply add project to workspace
+set Run Configuration:
+ - Runtime jre: jdk 32-bit
+ - Plugins: all workspace and enabled target plug-ins
+Run project as eclipse application
12 years, 4 months
JBoss Tools SVN: r43264 - in trunk/central/plugins/org.jboss.tools.central: css and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mickael_istria
Date: 2012-08-28 10:20:40 -0400 (Tue, 28 Aug 2012)
New Revision: 43264
Added:
trunk/central/plugins/org.jboss.tools.central/css/jboss.css
Modified:
trunk/central/plugins/org.jboss.tools.central/plugin.xml
Log:
JBDS-2250: Added a JBoss community theme following advices from JBoss branding corporate page
Added: trunk/central/plugins/org.jboss.tools.central/css/jboss.css
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/css/jboss.css (rev 0)
+++ trunk/central/plugins/org.jboss.tools.central/css/jboss.css 2012-08-28 14:20:40 UTC (rev 43264)
@@ -0,0 +1,113 @@
+/*
+ * Chrome Theme generate css dynamically, So do not inspect this file, See "ChromeCSSGenerator.xtend" instead
+ */
+.jeeeyul-chrome-theme{
+ /*
+ * This selector rule is exist for detect Chrome Theme to find rewrite target.
+ * See "RewriteChormeCSS.java"
+ */
+}
+
+.MTrimmedWindow.topLevel {
+ margin-top: 7px;
+ margin-bottom: 2px;
+ margin-left: 2px;
+ margin-right: 2px;
+}
+
+.MPartStack {
+ font-size: 11;
+ font-family: 'Arial';
+ swt-simple: true;
+ swt-tab-renderer:
+ url('bundleclass://net.jeeeyul.eclipse.themes/net.jeeeyul.eclipse.themes.rendering.ChromeTabRendering');
+
+ padding: 1px 6px 8px 6px; /* top left bottom right */
+ swt-tab-outline: #94b0bd;
+ swt-outer-keyline-color: #94b0bd;
+ swt-unselected-tabs-color: #e1eef4 #94b0bd #ffffff 99% 100%;
+ swt-shadow-visible: true;
+
+ swt-selected-tab-fill: #ffffff;
+ chrome-selected-tab-fill-highlight: #ffffff;
+
+ chrome-selected-tab-color: #754a4a;
+ chrome-unselected-tab-color: #000000;
+
+ swt-shadow-color: #e1eef4;
+
+ chrome-shiney-shadow: true;
+ swt-mru-visible: true;
+}
+
+.MPartStack.active {
+ swt-inner-keyline-color: #FFFFFF;
+ swt-tab-outline: #4a6575;
+ swt-outer-keyline-color: #4a6575;
+ swt-unselected-tabs-color: #94aebd #4a6575 #ffffff 99% 100%;
+
+ swt-selected-tab-fill: #ffffff;
+ chrome-selected-tab-fill-highlight: #e1eef4;
+
+ chrome-selected-tab-color: #4a5d75;
+ chrome-unselected-tab-color: #ffffff;
+ chrome-shiney-shadow: false;
+}
+
+.MPartStack.empty {
+ swt-unselected-tabs-color: #94aebd #94aebd #94aebd 99% 100%;
+ swt-tab-outline: #94aebd;
+ swt-outer-keyline-color: #94aebd;
+}
+
+.MToolControl.TrimStack {
+ frame-image: url("./winXPTSFrame.png");
+ handle-image: url("./winXPHandle.png");
+ frame-cuts: 5px 1px 5px 16px;
+}
+
+.MTrimmedWindow {
+ margin-top: 2px;
+ margin-bottom: 2px;
+ margin-left: 0px;
+ margin-right: 0px;
+ background-color: #e1eefa;
+}
+
+.MTrimBar {
+ background-color: #e1eefa;
+}
+
+.MTrimBar#org-eclipse-ui-main-toolbar {
+ background-color: #e1eef4 #94aebd;
+}
+
+.MToolControl.TrimStack {
+ frame-image: url("./jeeeyul-TSFrame.png");
+ handle-image: url("./jeeeyul-Handle.png");
+}
+
+#PerspectiveSwitcher {
+ eclipse-perspective-keyline-color: #4a5d75;
+ background-color: #9aaebd #e1eefa 100%;
+}
+
+CTabFolder.MArea .MPartStack,CTabFolder.MArea .MPartStack.active {
+ swt-shadow-visible: false;
+}
+
+CTabFolder Canvas {
+ background-color: #F8F8F8;
+}
+
+#org-eclipse-ui-editorss {
+ swt-tab-renderer:
+ url('bundleclass://org.eclipse.e4.ui.workbench.renderers.swt/org.eclipse.e4.ui.workbench.renderers.swt.CTabRendering');
+ swt-unselected-tabs-color: #F0F0F0 #F0F0F0 #F0F0F0 100% 100%;
+ swt-outer-keyline-color: #B4B4B4;
+ swt-inner-keyline-color: #F0F0F0;
+ swt-tab-outline: #F0F0F0;
+ color: #F0F0F0;
+ swt-tab-height: 8px;
+ padding: 0px 5px 7px;
+}
Property changes on: trunk/central/plugins/org.jboss.tools.central/css/jboss.css
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/central/plugins/org.jboss.tools.central/plugin.xml
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/plugin.xml 2012-08-28 13:59:50 UTC (rev 43263)
+++ trunk/central/plugins/org.jboss.tools.central/plugin.xml 2012-08-28 14:20:40 UTC (rev 43264)
@@ -271,6 +271,11 @@
id="org.jboss.tools.central.theme"
label="JBoss Tools & Developer Studio">
</theme>
+ <theme
+ basestylesheeturi="css/jboss.css"
+ id="org.jboss.tools.central.communityTheme"
+ label="JBoss Community Theme">
+ </theme>
</extension>
</plugin>
12 years, 4 months
JBoss Tools SVN: r43263 - in workspace/yradtsevich: ibuziuk and 25 other directories.
by jbosstools-commits@lists.jboss.org
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
12 years, 4 months
JBoss Tools SVN: r43262 - in trunk/maven/tests: org.jboss.tools.maven.common.test and 10 other directories.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2012-08-28 05:40:03 -0400 (Tue, 28 Aug 2012)
New Revision: 43262
Added:
trunk/maven/tests/org.jboss.tools.maven.common.test/
trunk/maven/tests/org.jboss.tools.maven.common.test/.classpath
trunk/maven/tests/org.jboss.tools.maven.common.test/.project
trunk/maven/tests/org.jboss.tools.maven.common.test/.settings/
trunk/maven/tests/org.jboss.tools.maven.common.test/.settings/org.eclipse.jdt.core.prefs
trunk/maven/tests/org.jboss.tools.maven.common.test/.settings/org.eclipse.m2e.core.prefs
trunk/maven/tests/org.jboss.tools.maven.common.test/META-INF/
trunk/maven/tests/org.jboss.tools.maven.common.test/META-INF/MANIFEST.MF
trunk/maven/tests/org.jboss.tools.maven.common.test/build.properties
trunk/maven/tests/org.jboss.tools.maven.common.test/plugin_customization.ini
trunk/maven/tests/org.jboss.tools.maven.common.test/pom.xml
trunk/maven/tests/org.jboss.tools.maven.common.test/resources/
trunk/maven/tests/org.jboss.tools.maven.common.test/resources/arquillian-core-spi.jar
trunk/maven/tests/org.jboss.tools.maven.common.test/resources/jansi-1.6.jar
trunk/maven/tests/org.jboss.tools.maven.common.test/resources/junit_4_10.jar
trunk/maven/tests/org.jboss.tools.maven.common.test/src/
trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/
trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/
trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/
trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/
trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/
trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/
trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/AbstractIdentificationTest.java
trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/FileIdentificationManagerTest.java
trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/IdentificationUtilTest.java
trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/MavenPropertiesIdentifierTest.java
trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/NexusRepositoryIdentifierTest.java
Modified:
trunk/maven/tests/pom.xml
Log:
JBIDE-12314 : Add JUnit tests for the identification part
Added: trunk/maven/tests/org.jboss.tools.maven.common.test/.classpath
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.common.test/.classpath (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.common.test/.classpath 2012-08-28 09:40:03 UTC (rev 43262)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: trunk/maven/tests/org.jboss.tools.maven.common.test/.project
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.common.test/.project (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.common.test/.project 2012-08-28 09:40:03 UTC (rev 43262)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.maven.common.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</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.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/maven/tests/org.jboss.tools.maven.common.test/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.common.test/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.common.test/.settings/org.eclipse.jdt.core.prefs 2012-08-28 09:40:03 UTC (rev 43262)
@@ -0,0 +1,7 @@
+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.compliance=1.6
+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: trunk/maven/tests/org.jboss.tools.maven.common.test/.settings/org.eclipse.m2e.core.prefs
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.common.test/.settings/org.eclipse.m2e.core.prefs (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.common.test/.settings/org.eclipse.m2e.core.prefs 2012-08-28 09:40:03 UTC (rev 43262)
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
Added: trunk/maven/tests/org.jboss.tools.maven.common.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.common.test/META-INF/MANIFEST.MF (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.common.test/META-INF/MANIFEST.MF 2012-08-28 09:40:03 UTC (rev 43262)
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: JBoss Maven (Core+UI) Tests
+Bundle-SymbolicName: org.jboss.tools.maven.common.test;singleton:=true
+Bundle-Version: 1.4.0.qualifier
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.apache.log4j,
+ org.junit4,
+ org.jboss.tools.maven.core,
+ org.jboss.tools.common,
+ org.jboss.tools.tests,
+ org.eclipse.m2e.launching,
+ org.eclipse.m2e.tests.common,
+ org.eclipse.ui.ide
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Eclipse-RegisterBuddy: org.apache.log4j
+
Added: trunk/maven/tests/org.jboss.tools.maven.common.test/build.properties
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.common.test/build.properties (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.common.test/build.properties 2012-08-28 09:40:03 UTC (rev 43262)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Added: trunk/maven/tests/org.jboss.tools.maven.common.test/plugin_customization.ini
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.common.test/plugin_customization.ini (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.common.test/plugin_customization.ini 2012-08-28 09:40:03 UTC (rev 43262)
@@ -0,0 +1,2 @@
+org.eclipse.m2e.core/eclipse.m2.updateIndexes=false
+org.jboss.tools.central/showJBossCentralOnStartup=false
\ No newline at end of file
Added: trunk/maven/tests/org.jboss.tools.maven.common.test/pom.xml
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.common.test/pom.xml (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.common.test/pom.xml 2012-08-28 09:40:03 UTC (rev 43262)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools.maven</groupId>
+ <artifactId>tests</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.maven.tests</groupId>
+ <artifactId>org.jboss.tools.maven.common.test</artifactId>
+
+ <packaging>eclipse-test-plugin</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tychoVersion}</version>
+ <configuration>
+ <useUIThread>false</useUIThread>
+ <useUIHarness>true</useUIHarness>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Added: trunk/maven/tests/org.jboss.tools.maven.common.test/resources/arquillian-core-spi.jar
===================================================================
(Binary files differ)
Property changes on: trunk/maven/tests/org.jboss.tools.maven.common.test/resources/arquillian-core-spi.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/maven/tests/org.jboss.tools.maven.common.test/resources/jansi-1.6.jar
===================================================================
(Binary files differ)
Property changes on: trunk/maven/tests/org.jboss.tools.maven.common.test/resources/jansi-1.6.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/maven/tests/org.jboss.tools.maven.common.test/resources/junit_4_10.jar
===================================================================
(Binary files differ)
Property changes on: trunk/maven/tests/org.jboss.tools.maven.common.test/resources/junit_4_10.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/AbstractIdentificationTest.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/AbstractIdentificationTest.java (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/AbstractIdentificationTest.java 2012-08-28 09:40:03 UTC (rev 43262)
@@ -0,0 +1,29 @@
+package org.jboss.tools.maven.core.identification;
+
+import java.io.File;
+
+import org.junit.After;
+import org.junit.Before;
+
+public abstract class AbstractIdentificationTest {
+
+ protected File arquillian;//Has maven properties
+ protected File junit;//Has no maven properties
+ protected File jansi;//Has multiple maven properties
+
+ @Before
+ public void initFiles() {
+ junit = new File("resources/junit_4_10.jar");
+ arquillian = new File("resources/arquillian-core-spi.jar");
+ jansi = new File("resources/jansi-1.6.jar");
+ }
+
+ @After
+ public void disposeFiles() {
+ junit = null;
+ arquillian = null;
+ jansi = null;
+ }
+
+
+}
Added: trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/FileIdentificationManagerTest.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/FileIdentificationManagerTest.java (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/FileIdentificationManagerTest.java 2012-08-28 09:40:03 UTC (rev 43262)
@@ -0,0 +1,57 @@
+package org.jboss.tools.maven.core.identification;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.util.Collections;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.m2e.core.embedder.ArtifactKey;
+import org.jboss.tools.maven.core.internal.identification.FileIdentificationManager;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class FileIdentificationManagerTest extends AbstractIdentificationTest {
+
+ private FileIdentificationManager fileIdentificationManager;
+
+ private IProgressMonitor monitor;
+
+ @Before
+ public void setUp() {
+ ArtifactIdentifier identifier1 = new ArtifactIdentifier() {
+ @Override
+ public ArtifactKey identify(File file) throws CoreException {
+ return null;
+ }
+ };
+ monitor = new NullProgressMonitor();
+ fileIdentificationManager = new FileIdentificationManager(Collections.singleton(identifier1));
+ }
+
+ @Test
+ public void testIdentify() throws Exception {
+
+ assertNull(fileIdentificationManager.identify(junit, monitor));
+
+ fileIdentificationManager.addArtifactIdentifier(
+ new ArtifactIdentifier() {
+ @Override
+ public ArtifactKey identify(File file) throws CoreException {
+ return new ArtifactKey("junit", "junit", "4.10", null);
+ }
+ }
+ );
+ assertNotNull(fileIdentificationManager.identify(junit, monitor));
+
+ }
+
+ @After
+ public void tearDown() {
+ fileIdentificationManager = null;
+ }
+
+}
Added: trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/IdentificationUtilTest.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/IdentificationUtilTest.java (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/IdentificationUtilTest.java 2012-08-28 09:40:03 UTC (rev 43262)
@@ -0,0 +1,21 @@
+package org.jboss.tools.maven.core.identification;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.jboss.tools.maven.core.identification.IdentificationUtil.getSHA1;
+import java.io.File;
+
+import org.junit.Test;
+
+public class IdentificationUtilTest {
+
+ @Test
+ public void testSHA1() throws Exception {
+
+ assertNull(getSHA1(null));
+
+ assertEquals("e4f1766ce7404a08f45d859fb9c226fc9e41a861",
+ getSHA1(new File("resources/junit_4_10.jar")));
+ }
+
+}
Added: trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/MavenPropertiesIdentifierTest.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/MavenPropertiesIdentifierTest.java (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/MavenPropertiesIdentifierTest.java 2012-08-28 09:40:03 UTC (rev 43262)
@@ -0,0 +1,26 @@
+package org.jboss.tools.maven.core.identification;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import org.eclipse.m2e.core.embedder.ArtifactKey;
+import org.jboss.tools.maven.core.internal.identification.MavenPropertiesIdentifier;
+import org.junit.Test;
+
+public class MavenPropertiesIdentifierTest extends AbstractIdentificationTest {
+
+ @Test
+ public void testIdentify() throws Exception {
+ MavenPropertiesIdentifier identifier = new MavenPropertiesIdentifier();
+ //Has No Maven Properties
+ assertNull(identifier.identify(junit));
+
+ //Has Multiple Maven Properties
+ assertNull(identifier.identify(jansi));
+
+ ArtifactKey key = identifier.identify(arquillian);
+ assertEquals("arquillian-core-spi", key.getArtifactId());
+ assertEquals("1.0.1.Final", key.getVersion());
+ }
+
+}
Added: trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/NexusRepositoryIdentifierTest.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/NexusRepositoryIdentifierTest.java (rev 0)
+++ trunk/maven/tests/org.jboss.tools.maven.common.test/src/org/jboss/tools/maven/core/identification/NexusRepositoryIdentifierTest.java 2012-08-28 09:40:03 UTC (rev 43262)
@@ -0,0 +1,60 @@
+package org.jboss.tools.maven.core.identification;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.m2e.core.embedder.ArtifactKey;
+import org.jboss.tools.maven.core.MavenCoreActivator;
+import org.jboss.tools.maven.core.internal.identification.NexusRepositoryIdentifier;
+import org.jboss.tools.maven.core.repositories.NexusRepository;
+import org.jboss.tools.maven.core.repositories.RemoteRepositoryManager;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class NexusRepositoryIdentifierTest extends AbstractIdentificationTest {
+
+ Map<NexusRepository, Boolean> initialRepoState = new HashMap<NexusRepository, Boolean>();
+
+ @Before
+ public void setupRepositories() {
+ RemoteRepositoryManager repoManager = MavenCoreActivator.getDefault().getRepositoryManager();
+ for (NexusRepository repo : repoManager.getDefaultRepositories()) {
+ initialRepoState.put(repo, repo.isEnabled());
+ if (repo.getName().toLowerCase().contains("jboss")) {
+ repo.setEnabled(true);
+ }
+ else {
+ repo.setEnabled(false);
+ }
+ }
+ }
+
+ @After
+ public void restoreRepos() {
+ for (Map.Entry<NexusRepository, Boolean> entry : initialRepoState.entrySet()) {
+ entry.getKey().setEnabled(entry.getValue());
+ }
+ }
+
+ @Test
+ public void testIdentify() throws Exception {
+ NexusRepositoryIdentifier identifier = new NexusRepositoryIdentifier();
+ ArtifactKey key;
+ key= identifier.identify(junit);
+ assertEquals("junit", key.getArtifactId());
+ assertEquals("4.10", key.getVersion());
+
+ key= identifier.identify(jansi);
+ assertEquals("jansi", key.getArtifactId());
+ assertEquals("1.6", key.getVersion());
+
+ key = identifier.identify(arquillian);
+ assertEquals("arquillian-core-spi", key.getArtifactId());
+ assertEquals("1.0.1.Final", key.getVersion());
+ }
+
+
+}
Modified: trunk/maven/tests/pom.xml
===================================================================
--- trunk/maven/tests/pom.xml 2012-08-28 09:34:41 UTC (rev 43261)
+++ trunk/maven/tests/pom.xml 2012-08-28 09:40:03 UTC (rev 43262)
@@ -14,6 +14,7 @@
<packaging>pom</packaging>
<modules>
<module>org.jboss.tools.maven.configurators.tests</module>
+ <module>org.jboss.tools.maven.common.test</module>
<module>org.jboss.tools.maven.profiles.test</module>
<module>org.jboss.tools.maven.ui.bot.test</module>
</modules>
12 years, 4 months
JBoss Tools SVN: r43261 - in trunk/maven/plugins: org.jboss.tools.maven.conversion.ui/src/org/jboss/tools/maven/conversion/ui/dialog and 24 other directories.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2012-08-28 05:34:41 -0400 (Tue, 28 Aug 2012)
New Revision: 43261
Added:
trunk/maven/plugins/org.jboss.tools.maven.core/.settings/org.eclipse.m2e.core.prefs
trunk/maven/plugins/org.jboss.tools.maven.core/lib/
trunk/maven/plugins/org.jboss.tools.maven.core/lib/nexus-indexer-lucene-rest-api-client.jar
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/identification/
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/AbstractArtifactIdentifier.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/FileIdentificationManager.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/MavenPropertiesIdentifier.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/NexusIndexIdentifier.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/NexusRepositoryIdentifier.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/repositories/
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/repositories/NexusRepository.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/repositories/RemoteRepositoryManager.java
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/repositories/
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/repositories/EditNexusRepositoryDialog.java
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/preferences/AutoResizeTableLayout.java
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/preferences/RemoteRepositoriesPreferencePage.java
Removed:
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/FileIdentificationManager.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/MavenPropertiesIdentifier.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/NexusIndexIdentifier.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/NexusRepositoryIdentifier.java
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/lib/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/NexusRepository.java
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/identification/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/internal/
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/browsers/EditNexusRepositoryDialog.java
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/preferences/AutoResizeTableLayout.java
Modified:
trunk/maven/plugins/org.jboss.tools.maven.conversion.ui/META-INF/MANIFEST.MF
trunk/maven/plugins/org.jboss.tools.maven.conversion.ui/src/org/jboss/tools/maven/conversion/ui/dialog/IdentifyMavenDependencyPage.java
trunk/maven/plugins/org.jboss.tools.maven.conversion.ui/src/org/jboss/tools/maven/conversion/ui/handlers/IdentifyJarJob.java
trunk/maven/plugins/org.jboss.tools.maven.core/.classpath
trunk/maven/plugins/org.jboss.tools.maven.core/.project
trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF
trunk/maven/plugins/org.jboss.tools.maven.core/build.properties
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/identification/ArtifactIdentifier.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/identification/IFileIdentificationManager.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/identification/IdentificationUtil.java
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.classpath
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/META-INF/MANIFEST.MF
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/SourceLookupActivator.java
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/containers/JBossSourceContainer.java
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/META-INF/MANIFEST.MF
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/actions/AttachSourcesActionDelegate.java
trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/preferences/SourceLookupPreferencePage.java
trunk/maven/plugins/org.jboss.tools.maven.ui/.settings/org.eclipse.jdt.core.prefs
trunk/maven/plugins/org.jboss.tools.maven.ui/.settings/org.eclipse.m2e.core.prefs
trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.xml
trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/wizard/ConfigureMavenRepositoriesWizardPage.java
Log:
JBIDE-12314 : move all the identification and remote repository management parts to the maven core/ui plugins.
Modified: trunk/maven/plugins/org.jboss.tools.maven.conversion.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.conversion.ui/META-INF/MANIFEST.MF 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.conversion.ui/META-INF/MANIFEST.MF 2012-08-28 09:34:41 UTC (rev 43261)
@@ -12,8 +12,8 @@
org.eclipse.core.resources,
org.eclipse.jst.j2ee.ui;bundle-version="1.1.500",
org.eclipse.ui.ide;bundle-version="3.7.0",
- org.jboss.tools.maven.sourcelookup.core;bundle-version="1.4.0",
- org.eclipse.m2e.core.ui;bundle-version="1.1.0"
+ org.eclipse.m2e.core.ui;bundle-version="1.1.0",
+ org.jboss.tools.maven.core;bundle-version="1.4.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: %BundleVendor
Bundle-Localization: plugin
Modified: trunk/maven/plugins/org.jboss.tools.maven.conversion.ui/src/org/jboss/tools/maven/conversion/ui/dialog/IdentifyMavenDependencyPage.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.conversion.ui/src/org/jboss/tools/maven/conversion/ui/dialog/IdentifyMavenDependencyPage.java 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.conversion.ui/src/org/jboss/tools/maven/conversion/ui/dialog/IdentifyMavenDependencyPage.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -57,9 +57,9 @@
import org.jboss.tools.maven.conversion.ui.handlers.IdentifyJarJob;
import org.jboss.tools.maven.conversion.ui.internal.CellListener;
import org.jboss.tools.maven.conversion.ui.internal.MavenDependencyConversionActivator;
-import org.jboss.tools.maven.sourcelookup.identification.IFileIdentificationManager;
-import org.jboss.tools.maven.sourcelookup.identification.IdentificationUtil;
-import org.jboss.tools.maven.sourcelookup.internal.identification.FileIdentificationManager;
+import org.jboss.tools.maven.core.identification.IFileIdentificationManager;
+import org.jboss.tools.maven.core.identification.IdentificationUtil;
+import org.jboss.tools.maven.core.internal.identification.FileIdentificationManager;
public class IdentifyMavenDependencyPage extends WizardPage {
Modified: trunk/maven/plugins/org.jboss.tools.maven.conversion.ui/src/org/jboss/tools/maven/conversion/ui/handlers/IdentifyJarJob.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.conversion.ui/src/org/jboss/tools/maven/conversion/ui/handlers/IdentifyJarJob.java 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.conversion.ui/src/org/jboss/tools/maven/conversion/ui/handlers/IdentifyJarJob.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -10,7 +10,7 @@
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.m2e.core.embedder.ArtifactKey;
import org.jboss.tools.maven.conversion.ui.internal.MavenDependencyConversionActivator;
-import org.jboss.tools.maven.sourcelookup.identification.IFileIdentificationManager;
+import org.jboss.tools.maven.core.identification.IFileIdentificationManager;
public class IdentifyJarJob extends Job {
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/.classpath
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/.classpath 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/.classpath 2012-08-28 09:34:41 UTC (rev 43261)
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry exported="true" kind="lib" path="lib/nexus-indexer-lucene-rest-api-client.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/.project
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/.project 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/.project 2012-08-28 09:34:41 UTC (rev 43261)
@@ -1,34 +1,40 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.jboss.tools.maven.core</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>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.maven.core</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>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/maven/plugins/org.jboss.tools.maven.core/.settings/org.eclipse.m2e.core.prefs
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/.settings/org.eclipse.m2e.core.prefs (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/.settings/org.eclipse.m2e.core.prefs 2012-08-28 09:34:41 UTC (rev 43261)
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF 2012-08-28 09:34:41 UTC (rev 43261)
@@ -32,6 +32,11 @@
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: %Bundle-Vendor
Export-Package: org.jboss.tools.maven.core,
+ org.jboss.tools.maven.core.identification,
+ org.jboss.tools.maven.core.internal.identification;x-friends:="org.jboss.tools.maven.common.test",
org.jboss.tools.maven.core.internal.project.facet,
org.jboss.tools.maven.core.libprov,
+ org.jboss.tools.maven.core.repositories,
org.jboss.tools.maven.core.xpl
+Bundle-ClassPath: lib/nexus-indexer-lucene-rest-api-client.jar,
+ .
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/build.properties
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/build.properties 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/build.properties 2012-08-28 09:34:41 UTC (rev 43261)
@@ -5,4 +5,5 @@
plugin.xml,\
poms/,\
plugin.properties,\
- about.html
+ about.html,\
+ lib/nexus-indexer-lucene-rest-api-client.jar
Added: trunk/maven/plugins/org.jboss.tools.maven.core/lib/nexus-indexer-lucene-rest-api-client.jar
===================================================================
(Binary files differ)
Property changes on: trunk/maven/plugins/org.jboss.tools.maven.core/lib/nexus-indexer-lucene-rest-api-client.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -41,6 +41,8 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.jdt.core.IClasspathAttribute;
@@ -70,7 +72,9 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.jboss.tools.maven.core.repositories.RemoteRepositoryManager;
import org.osgi.framework.BundleContext;
+import org.osgi.service.prefs.BackingStoreException;
/**
* The activator class controls the plug-in life cycle
@@ -101,6 +105,8 @@
private static PomResourceImpl resource;
+ private RemoteRepositoryManager repositoryManager;
+
/**
* The constructor
*/
@@ -745,4 +751,27 @@
}
}
+
+ public RemoteRepositoryManager getRepositoryManager() {
+ if (repositoryManager == null) {
+ repositoryManager = new RemoteRepositoryManager();
+ }
+ return repositoryManager;
+ }
+
+ public static IEclipsePreferences getPreferences() {
+ IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(PLUGIN_ID);
+ return prefs;
+ }
+
+ public void savePreferences() {
+ IEclipsePreferences prefs = getPreferences();
+ try {
+ prefs.flush();
+ } catch (BackingStoreException e) {
+ log(e);
+ }
+ }
+
+
}
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/identification/ArtifactIdentifier.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/identification/ArtifactIdentifier.java 2012-08-23 06:59:05 UTC (rev 43185)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/identification/ArtifactIdentifier.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -8,7 +8,7 @@
* Contributors:
* JBoss by Red Hat - Initial implementation.
************************************************************************************/
-package org.jboss.tools.maven.sourcelookup.identification;
+package org.jboss.tools.maven.core.identification;
import java.io.File;
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/identification/IFileIdentificationManager.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/identification/IFileIdentificationManager.java 2012-08-23 06:59:05 UTC (rev 43185)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/identification/IFileIdentificationManager.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -8,7 +8,7 @@
* Contributors:
* JBoss by Red Hat - Initial implementation.
************************************************************************************/
-package org.jboss.tools.maven.sourcelookup.identification;
+package org.jboss.tools.maven.core.identification;
import java.io.File;
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/identification/IdentificationUtil.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/identification/IdentificationUtil.java 2012-08-23 06:59:05 UTC (rev 43185)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/identification/IdentificationUtil.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -8,7 +8,7 @@
* Contributors:
* JBoss by Red Hat - Initial implementation.
************************************************************************************/
-package org.jboss.tools.maven.sourcelookup.identification;
+package org.jboss.tools.maven.core.identification;
import java.io.File;
import java.io.FileInputStream;
@@ -27,7 +27,9 @@
public static String getSHA1(File file) throws IOException,
NoSuchAlgorithmException {
-
+ if (file == null) {
+ return null;
+ }
InputStream inputStream = null;
StringBuilder sb = new StringBuilder();
try {
Copied: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/AbstractArtifactIdentifier.java (from rev 43221, trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/internal/identification/AbstractArtifactIdentifier.java)
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/AbstractArtifactIdentifier.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/AbstractArtifactIdentifier.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -0,0 +1,40 @@
+/*************************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.core.internal.identification;
+
+import org.jboss.tools.maven.core.identification.ArtifactIdentifier;
+
+abstract class AbstractArtifactIdentifier implements ArtifactIdentifier {
+
+ private String name;
+
+ AbstractArtifactIdentifier() {
+ }
+
+ AbstractArtifactIdentifier(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ if (name == null) {
+ name = getClass().getSimpleName();
+ }
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String toString() {
+ return (name == null)? super.toString():name;
+ }
+}
Deleted: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/FileIdentificationManager.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/internal/identification/FileIdentificationManager.java 2012-08-23 06:59:05 UTC (rev 43185)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/FileIdentificationManager.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -1,62 +0,0 @@
-/*************************************************************************************
- * Copyright (c) 2008-2012 Red Hat, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * JBoss by Red Hat - Initial implementation.
- ************************************************************************************/
-package org.jboss.tools.maven.sourcelookup.internal.identification;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.m2e.core.embedder.ArtifactKey;
-import org.jboss.tools.maven.sourcelookup.identification.ArtifactIdentifier;
-import org.jboss.tools.maven.sourcelookup.identification.IFileIdentificationManager;
-
-/**
- *
- * @author Fred Bricon
- *
- */
-public class FileIdentificationManager implements IFileIdentificationManager {
-
- private List<ArtifactIdentifier> artifactIdentifiers;
-
- public FileIdentificationManager() {
- initArtifactIdentifiers();
- }
-
- private void initArtifactIdentifiers() {
- //TODO read from extension points?
- artifactIdentifiers = new ArrayList<ArtifactIdentifier>(3);
- artifactIdentifiers.add(new MavenPropertiesIdentifier());
- artifactIdentifiers.add(new NexusIndexIdentifier());
- artifactIdentifiers.add(new NexusRepositoryIdentifier());
- }
-
- @Override
- public ArtifactKey identify(File file, IProgressMonitor monitor) throws CoreException {
- ArtifactKey artifactKey = null;
- long start = System.currentTimeMillis();
- for (ArtifactIdentifier identifier : artifactIdentifiers) {
- if (monitor.isCanceled()) {
- return null;
- }
- artifactKey = identifier.identify(file);
- if (artifactKey != null) {
- long stop = System.currentTimeMillis();
- System.err.println(file.getName() + " identified as " + artifactKey + " in " + (stop-start) + " ms");
- break;
- }
- }
- return artifactKey;
- }
-
-}
Copied: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/FileIdentificationManager.java (from rev 43221, trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/internal/identification/FileIdentificationManager.java)
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/FileIdentificationManager.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/FileIdentificationManager.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -0,0 +1,100 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2012 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.core.internal.identification;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.m2e.core.embedder.ArtifactKey;
+import org.jboss.tools.maven.core.identification.ArtifactIdentifier;
+import org.jboss.tools.maven.core.identification.IFileIdentificationManager;
+
+/**
+ *
+ * @author Fred Bricon
+ *
+ */
+public class FileIdentificationManager implements IFileIdentificationManager {
+
+ private List<ArtifactIdentifier> artifactIdentifiers;
+
+ public FileIdentificationManager() {
+ initArtifactIdentifiers();
+ }
+
+ public FileIdentificationManager(Collection<ArtifactIdentifier> identifiers) {
+ for (ArtifactIdentifier identifier : identifiers) {
+ addArtifactIdentifier(identifier);
+ }
+ }
+
+ protected void initArtifactIdentifiers() {
+ //TODO read from extension points?
+ addArtifactIdentifier(new MavenPropertiesIdentifier());
+ addArtifactIdentifier(new NexusIndexIdentifier());
+ addArtifactIdentifier(new NexusRepositoryIdentifier());
+ }
+
+ public synchronized void addArtifactIdentifier(ArtifactIdentifier identifier) {
+ Assert.isNotNull(identifier, "Artifact identifier can not be null");
+ if (artifactIdentifiers == null) {
+ artifactIdentifiers = new ArrayList<ArtifactIdentifier>();
+ }
+ artifactIdentifiers.add(identifier);
+ //System.err.println("Added "+ identifier);
+ }
+
+ public synchronized void removeArtifactIdentifier(ArtifactIdentifier identifier) {
+ if (identifier != null) {
+ getArtifactIdentifiers().remove(identifier);
+ }
+ }
+
+ protected List<ArtifactIdentifier> getArtifactIdentifiers() {
+ if (artifactIdentifiers == null) {
+ initArtifactIdentifiers();
+ }
+ return artifactIdentifiers;
+ }
+
+ public ArtifactKey identify(File file, IProgressMonitor monitor) throws CoreException {
+ if (file == null) {
+ return null;
+ }
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
+ }
+ ArtifactKey artifactKey = null;
+ //long start = System.currentTimeMillis();
+ for (ArtifactIdentifier identifier : artifactIdentifiers) {
+ if (monitor.isCanceled()) {
+ return null;
+ }
+ artifactKey = identifier.identify(file);
+ if (artifactKey != null) {
+ //long stop = System.currentTimeMillis();
+ //System.err.println(file.getName() + " identified as " + artifactKey + " in " + (stop-start) + " ms");
+ break;
+ }
+ }
+ //if (artifactKey == null)
+ //System.err.println("Could not identify "+file);
+ return artifactKey;
+ }
+
+
+}
Deleted: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/MavenPropertiesIdentifier.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/internal/identification/MavenPropertiesIdentifier.java 2012-08-23 06:59:05 UTC (rev 43185)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/MavenPropertiesIdentifier.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -1,72 +0,0 @@
-package org.jboss.tools.maven.sourcelookup.internal.identification;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Properties;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipException;
-import java.util.zip.ZipFile;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.m2e.core.embedder.ArtifactKey;
-import org.jboss.tools.maven.sourcelookup.identification.ArtifactIdentifier;
-
-public class MavenPropertiesIdentifier implements ArtifactIdentifier {
-
- @Override
- public ArtifactKey identify(File file) throws CoreException {
- ZipFile jar;
- try {
-// try {
-// Random r = new Random();
-// Thread.sleep(r.nextInt(10)*1000);
-// } catch (InterruptedException e) {
-// }
- jar = new ZipFile(file);
- return getArtifactFromMetaInf(jar);
- } catch (ZipException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- protected static ArtifactKey getArtifactFromMetaInf(ZipFile jar) throws IOException {
- ZipEntry mavenEntry = jar.getEntry("META-INF/maven");//$NON-NLS-1$
- if (mavenEntry == null) {
- return null;
- }
- String entryName = mavenEntry.getName();
- Enumeration<? extends ZipEntry> zipEntries = jar.entries();
- ArtifactKey artifact = null;
-
-
- while (zipEntries.hasMoreElements()) {
- ZipEntry zipEntry = zipEntries.nextElement();
- if (zipEntry.getName().endsWith("pom.properties")
- && zipEntry.getName().startsWith(entryName)) {
- if (artifact != null) {
- //org.fusesource.jansi:jansi:1.6 is an OSGi bundle containing several maven pom files.
- //The first properties being found is wrong.
- //So for the moment we bail but should try to look at the MANIFEST.MF
- return null;
- }
- Properties props = new Properties();
- props.load(jar.getInputStream(zipEntry));
- String groupId = props.getProperty("groupId");
- String artifactId = props.getProperty("artifactId");
- String version = props.getProperty("version");
- String classifier = props.getProperty("classifier");
- if (groupId != null && artifactId != null && version != null) {
- artifact = new ArtifactKey(groupId, artifactId, version,
- classifier);
- }
- }
- }
-
- return artifact;
- }
-}
Copied: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/MavenPropertiesIdentifier.java (from rev 43221, trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/internal/identification/MavenPropertiesIdentifier.java)
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/MavenPropertiesIdentifier.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/MavenPropertiesIdentifier.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -0,0 +1,79 @@
+/*************************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.core.internal.identification;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.m2e.core.embedder.ArtifactKey;
+
+public class MavenPropertiesIdentifier extends AbstractArtifactIdentifier {
+
+ public MavenPropertiesIdentifier() {
+ super("Maven Properties identifier");
+ }
+
+ public ArtifactKey identify(File file) throws CoreException {
+ ZipFile jar;
+ try {
+ jar = new ZipFile(file);
+ return getArtifactFromMetaInf(jar);
+ } catch (ZipException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ //System.err.println(getName() + " could not identify "+file);
+ return null;
+ }
+
+ protected static ArtifactKey getArtifactFromMetaInf(ZipFile jar) throws IOException {
+ ZipEntry mavenEntry = jar.getEntry("META-INF/maven");//$NON-NLS-1$
+ if (mavenEntry == null) {
+ return null;
+ }
+ String entryName = mavenEntry.getName();
+ Enumeration<? extends ZipEntry> zipEntries = jar.entries();
+ ArtifactKey artifact = null;
+
+
+ while (zipEntries.hasMoreElements()) {
+ ZipEntry zipEntry = zipEntries.nextElement();
+ if (zipEntry.getName().endsWith("pom.properties")
+ && zipEntry.getName().startsWith(entryName)) {
+ if (artifact != null) {
+ //org.fusesource.jansi:jansi:1.6 is an OSGi bundle containing several maven pom files.
+ //The first properties being found is wrong.
+ //So for the moment we bail but should try to look at the MANIFEST.MF
+ return null;
+ }
+ Properties props = new Properties();
+ props.load(jar.getInputStream(zipEntry));
+ String groupId = props.getProperty("groupId");
+ String artifactId = props.getProperty("artifactId");
+ String version = props.getProperty("version");
+ String classifier = props.getProperty("classifier");
+ if (groupId != null && artifactId != null && version != null) {
+ artifact = new ArtifactKey(groupId, artifactId, version,
+ classifier);
+ }
+ }
+ }
+
+ return artifact;
+ }
+}
Deleted: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/NexusIndexIdentifier.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/internal/identification/NexusIndexIdentifier.java 2012-08-23 06:59:05 UTC (rev 43185)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/NexusIndexIdentifier.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -1,74 +0,0 @@
-package org.jboss.tools.maven.sourcelookup.internal.identification;
-
-import java.io.File;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.m2e.core.MavenPlugin;
-import org.eclipse.m2e.core.embedder.ArtifactKey;
-import org.eclipse.m2e.core.internal.index.IIndex;
-import org.eclipse.m2e.core.internal.index.IndexManager;
-import org.eclipse.m2e.core.internal.index.IndexedArtifactFile;
-import org.eclipse.m2e.core.internal.index.nexus.NexusIndex;
-import org.eclipse.m2e.core.internal.index.nexus.NexusIndexManager;
-import org.eclipse.m2e.core.repository.IRepository;
-import org.eclipse.m2e.core.repository.IRepositoryRegistry;
-import org.jboss.tools.maven.sourcelookup.identification.ArtifactIdentifier;
-
-@SuppressWarnings("restriction")
-public class NexusIndexIdentifier implements ArtifactIdentifier {
-
- private List<IRepository> globalRepositories;
-
- public NexusIndexIdentifier() {
- globalRepositories = initGlobalRepositories();
- }
-
- @Override
- public ArtifactKey identify(File file) throws CoreException {
- IndexManager indexManager = MavenPlugin.getIndexManager();
- IIndex index = indexManager.getAllIndexes();
- IndexedArtifactFile info = null;
- try {
- info = index.identify(file);
- } catch (Throwable e) {
- // ignore
- }
- ArtifactKey artifact = null;
- if (info != null) {
- artifact = info.getArtifactKey();
- if (artifact != null) {
- return artifact;
- }
- }
- if (indexManager instanceof NexusIndexManager) {
- NexusIndexManager nexusIndexManager = (NexusIndexManager) indexManager;
- for (IRepository repository : globalRepositories) {
- NexusIndex nexusIndex = nexusIndexManager.getIndex(repository);
- if (nexusIndex != null) {
- try {
- info = nexusIndex.identify(file);
- } catch (Throwable t) {
- // ignore
- }
- if (info != null) {
- artifact = info.getArtifactKey();
- if (artifact != null) {
- return artifact;
- }
- }
- }
- }
- }
- return artifact;
- }
-
- private List<IRepository> initGlobalRepositories() {
- IRepositoryRegistry repositoryRegistry = MavenPlugin.getRepositoryRegistry();
- List<IRepository> repositories = repositoryRegistry.
- getRepositories(IRepositoryRegistry.SCOPE_SETTINGS);
- return repositories == null? Collections.<IRepository>emptyList():repositories;
- }
-
-}
Copied: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/NexusIndexIdentifier.java (from rev 43221, trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/internal/identification/NexusIndexIdentifier.java)
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/NexusIndexIdentifier.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/NexusIndexIdentifier.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -0,0 +1,84 @@
+/*************************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.core.internal.identification;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.m2e.core.MavenPlugin;
+import org.eclipse.m2e.core.embedder.ArtifactKey;
+import org.eclipse.m2e.core.internal.index.IIndex;
+import org.eclipse.m2e.core.internal.index.IndexManager;
+import org.eclipse.m2e.core.internal.index.IndexedArtifactFile;
+import org.eclipse.m2e.core.internal.index.nexus.NexusIndex;
+import org.eclipse.m2e.core.internal.index.nexus.NexusIndexManager;
+import org.eclipse.m2e.core.repository.IRepository;
+import org.eclipse.m2e.core.repository.IRepositoryRegistry;
+
+@SuppressWarnings("restriction")
+public class NexusIndexIdentifier extends AbstractArtifactIdentifier {
+
+ private List<IRepository> globalRepositories;
+
+ public NexusIndexIdentifier() {
+ super("Nexus Index identifier");
+ globalRepositories = initGlobalRepositories();
+ }
+
+ public ArtifactKey identify(File file) throws CoreException {
+ IndexManager indexManager = MavenPlugin.getIndexManager();
+ IIndex index = indexManager.getAllIndexes();
+ IndexedArtifactFile info = null;
+ try {
+ info = index.identify(file);
+ } catch (Throwable e) {
+ // ignore
+ }
+ ArtifactKey artifact = null;
+ if (info != null) {
+ artifact = info.getArtifactKey();
+ if (artifact != null) {
+ return artifact;
+ }
+ }
+ if (indexManager instanceof NexusIndexManager) {
+ NexusIndexManager nexusIndexManager = (NexusIndexManager) indexManager;
+ for (IRepository repository : globalRepositories) {
+ NexusIndex nexusIndex = nexusIndexManager.getIndex(repository);
+ if (nexusIndex != null) {
+ try {
+ info = nexusIndex.identify(file);
+ } catch (Throwable t) {
+ // ignore
+ }
+ if (info != null) {
+ artifact = info.getArtifactKey();
+ if (artifact != null) {
+ return artifact;
+ }
+ }
+ }
+ }
+ }
+ //System.err.println(getName() + " could not identify "+file);
+ return artifact;
+ }
+
+ private List<IRepository> initGlobalRepositories() {
+ IRepositoryRegistry repositoryRegistry = MavenPlugin.getRepositoryRegistry();
+ List<IRepository> repositories = repositoryRegistry.
+ getRepositories(IRepositoryRegistry.SCOPE_SETTINGS);
+ return repositories == null? Collections.<IRepository>emptyList():repositories;
+ }
+
+}
Deleted: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/NexusRepositoryIdentifier.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/internal/identification/NexusRepositoryIdentifier.java 2012-08-23 06:59:05 UTC (rev 43185)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/NexusRepositoryIdentifier.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -1,148 +0,0 @@
-package org.jboss.tools.maven.sourcelookup.internal.identification;
-
-import static org.jboss.tools.maven.sourcelookup.identification.IdentificationUtil.getSHA1;
-import static org.jboss.tools.maven.sourcelookup.identification.IdentificationUtil.getSourcesClassifier;
-
-import java.io.File;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.util.Set;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Unmarshaller;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.m2e.core.embedder.ArtifactKey;
-import org.jboss.tools.maven.sourcelookup.NexusRepository;
-import org.jboss.tools.maven.sourcelookup.SourceLookupActivator;
-import org.jboss.tools.maven.sourcelookup.identification.ArtifactIdentifier;
-import org.sonatype.nexus.rest.model.NexusArtifact;
-import org.sonatype.nexus.rest.model.SearchResponse;
-
-public class NexusRepositoryIdentifier implements ArtifactIdentifier {
-
- private static final String PATH_SEPARATOR = "/";
-
- @Override
- public ArtifactKey identify(File file) throws CoreException {
- return getArtifactFromRemoteNexusRepository(file);
- }
-
- private static ArtifactKey getArtifactFromRemoteNexusRepository(File file) {
- String sha1;
- try {
- sha1 = getSHA1(file);
- } catch (Exception e) {
- return null;
- }
- Set<NexusRepository> nexusRepositories = SourceLookupActivator
- .getNexusRepositories();
- for (NexusRepository repository : nexusRepositories) {
- if (!repository.isEnabled()) {
- continue;
- }
- ArtifactKey key = getArtifactFromRemoteNexusRepository(sha1, repository);
- if (key != null) {
- ArtifactKey sourcesArtifact = new ArtifactKey(
- key.getGroupId(), key.getArtifactId(),
- key.getVersion(),
- getSourcesClassifier(key.getClassifier()));
- ArtifactKey resolvedKey = getSourcesArtifactFromJBossNexusRepository(sourcesArtifact, repository);
- if (resolvedKey != null) {
- return key;
- }
- }
- }
- return null;
- }
-
- private static ArtifactKey getArtifactFromRemoteNexusRepository(String sha1,
- NexusRepository nexusRepository) {
- if (sha1 == null || nexusRepository == null || nexusRepository.getUrl() == null) {
- return null;
- }
- HttpURLConnection connection = null;
- try {
- String base = nexusRepository.getUrl();
- if (!base.endsWith(PATH_SEPARATOR)) {
- base = base + PATH_SEPARATOR;
- }
- // String url =
- // "https://repository.jboss.org/nexus/service/local/data_index?sha1=";
- String url = base + "service/local/data_index?sha1=";
- url = url + URLEncoder.encode(sha1, "UTF-8");
- JAXBContext context = JAXBContext.newInstance(SearchResponse.class);
- Unmarshaller unmarshaller = context.createUnmarshaller();
- connection = (HttpURLConnection) new URL(url).openConnection();
- connection.connect();
- Object object = unmarshaller.unmarshal(connection.getInputStream());
- if (object instanceof SearchResponse) {
- SearchResponse searchResponse = (SearchResponse) object;
- for (NexusArtifact nexusArtifact : searchResponse.getData()) {
- String groupId = nexusArtifact.getGroupId();
- String artifactId = nexusArtifact.getArtifactId();
- String version = nexusArtifact.getVersion();
- String classifier = nexusArtifact.getClassifier();
- ArtifactKey artifact = new ArtifactKey(groupId, artifactId,
- version, classifier);
- return artifact;
- }
- }
- } catch (Exception e) {
- return null;
- } finally {
- if (connection != null) {
- connection.disconnect();
- }
- }
- return null;
- }
-
- private static ArtifactKey getSourcesArtifactFromJBossNexusRepository(ArtifactKey key,
- NexusRepository nexusRepository) {
- if (key == null || nexusRepository == null
- || nexusRepository.getUrl() == null) {
- return null;
- }
- HttpURLConnection connection = null;
- try {
- String base = nexusRepository.getUrl();
- if (!base.endsWith(PATH_SEPARATOR)) {
- base = base + PATH_SEPARATOR;
- }
- // String url =
- // "https://repository.jboss.org/nexus/service/local/data_index?g=groupId&a=a...";
- String url = base + "service/local/data_index?";
- url= url + "g=" + URLEncoder.encode(key.getGroupId(), "UTF-8") + "&";
- url= url + "a=" + URLEncoder.encode(key.getArtifactId(), "UTF-8") + "&";
- url= url + "v=" + URLEncoder.encode(key.getVersion(), "UTF-8") + "&";
- url= url + "c=" + URLEncoder.encode(key.getClassifier(), "UTF-8");
- JAXBContext context = JAXBContext.newInstance(SearchResponse.class);
- Unmarshaller unmarshaller = context.createUnmarshaller();
- connection = (HttpURLConnection) new URL(url).openConnection();
- connection.connect();
- Object object = unmarshaller.unmarshal(connection.getInputStream());
- if (object instanceof SearchResponse) {
- SearchResponse searchResponse = (SearchResponse) object;
- for (NexusArtifact nexusArtifact : searchResponse.getData()) {
- String groupId = nexusArtifact.getGroupId();
- String artifactId = nexusArtifact.getArtifactId();
- String version = nexusArtifact.getVersion();
- String classifier = nexusArtifact.getClassifier();
- ArtifactKey artifact = new ArtifactKey(groupId, artifactId,
- version, classifier);
- return artifact;
- }
- }
- } catch (Exception e) {
- return null;
- } finally {
- if (connection != null) {
- connection.disconnect();
- }
- }
- return null;
- }
-
-}
Copied: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/NexusRepositoryIdentifier.java (from rev 43221, trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/internal/identification/NexusRepositoryIdentifier.java)
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/NexusRepositoryIdentifier.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/internal/identification/NexusRepositoryIdentifier.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -0,0 +1,122 @@
+/*************************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.core.internal.identification;
+
+import static org.jboss.tools.maven.core.identification.IdentificationUtil.getSHA1;
+
+import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.Set;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.m2e.core.embedder.ArtifactKey;
+import org.jboss.tools.maven.core.MavenCoreActivator;
+import org.jboss.tools.maven.core.repositories.NexusRepository;
+import org.jboss.tools.maven.core.repositories.RemoteRepositoryManager;
+import org.sonatype.nexus.rest.model.NexusArtifact;
+import org.sonatype.nexus.rest.model.SearchResponse;
+
+public class NexusRepositoryIdentifier extends AbstractArtifactIdentifier {
+
+ public NexusRepositoryIdentifier() {
+ super("Nexus repository identifier");
+ }
+
+ public ArtifactKey identify(File file) throws CoreException {
+ return getArtifactFromRemoteNexusRepository(file);
+ }
+
+ private ArtifactKey getArtifactFromRemoteNexusRepository(File file) {
+ String sha1;
+ try {
+ sha1 = getSHA1(file);
+ } catch (Exception e) {
+ return null;
+ }
+ RemoteRepositoryManager repoManager = MavenCoreActivator.getDefault().getRepositoryManager();
+ Set<NexusRepository> nexusRepositories = repoManager .getNexusRepositories();
+ for (NexusRepository repository : nexusRepositories) {
+ if (!repository.isEnabled()) {
+ continue;
+ }
+ try {
+ ArtifactKey key = searchArtifactFromRemoteNexusRepository(repository.getSearchUrl(sha1));
+ if (key != null) {
+ /*
+ Searching for sources here makes no sense here :
+ ex : guice.jar (from seam 2.3) is found in jboss nexus via a SHA1 search but subsequent search
+ of its sources on this repo returns null => guice.jar can never be identified in that case!
+ Source resolution / Missing sources should be dealt upstream from here
+
+ String searchSourcesUrl = repository.getSearchUrl(key.getArtifactId(),
+ key.getGroupId(),
+ key.getVersion(),
+ getSourcesClassifier(key.getClassifier()));
+
+ ArtifactKey resolvedKey = searchArtifactFromRemoteNexusRepository(searchSourcesUrl);
+
+ if (resolvedKey != null) {
+ return key;
+ }
+ */
+ return key;
+ }
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ }
+ //System.err.println(getName()+ "Couldn't find match for SHA1="+sha1);
+ return null;
+ }
+
+ private static ArtifactKey searchArtifactFromRemoteNexusRepository(String searchUrl) {
+ if (searchUrl == null) {
+ return null;
+ }
+ HttpURLConnection connection = null;//TODO use eclipse connections to handle proxies
+ try {
+ JAXBContext context = JAXBContext.newInstance(SearchResponse.class);
+ Unmarshaller unmarshaller = context.createUnmarshaller();
+ connection = (HttpURLConnection) new URL(searchUrl).openConnection();
+ connection.connect();
+ Object object = unmarshaller.unmarshal(connection.getInputStream());
+ if (object instanceof SearchResponse) {
+ return extractArtifactKey((SearchResponse)object);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
+ return null;
+ }
+
+ private static ArtifactKey extractArtifactKey(SearchResponse searchResponse) {
+ for (NexusArtifact nexusArtifact : searchResponse.getData()) {
+ String groupId = nexusArtifact.getGroupId();
+ String artifactId = nexusArtifact.getArtifactId();
+ String version = nexusArtifact.getVersion();
+ String classifier = nexusArtifact.getClassifier();
+ ArtifactKey artifact = new ArtifactKey(groupId, artifactId,
+ version, classifier);
+ return artifact;
+ }
+ return null;
+ }
+
+}
Copied: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/repositories/NexusRepository.java (from rev 43221, trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/NexusRepository.java)
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/repositories/NexusRepository.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/repositories/NexusRepository.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -0,0 +1,111 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2012 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.core.repositories;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import org.eclipse.core.runtime.Assert;
+
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class NexusRepository {
+ private String name;
+ private String url;
+ private boolean enabled;
+
+ private static final String PATH_SEPARATOR = "/";
+
+ public NexusRepository() {
+ super();
+ }
+
+ public NexusRepository(String name, String url, boolean enabled) {
+ super();
+ this.name = name;
+ this.url = url;
+ this.enabled = enabled;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(boolean checked) {
+ this.enabled = checked;
+ }
+
+ @Override
+ public String toString() {
+ return "NexusRepository [name=" + name + ", url=" + url + ", enabled="
+ + enabled + "]";
+ }
+
+ public String getSearchUrl(String sha1) throws UnsupportedEncodingException {
+ // "https://repository.jboss.org/nexus/service/local/data_index?sha1=";
+ Assert.isNotNull(sha1);
+ StringBuilder searchUrl = getBaseUrl()
+ .append("service/local/data_index?sha1=")
+ .append(URLEncoder.encode(sha1, "UTF-8"));
+ return searchUrl.toString();
+ }
+
+ public String getSearchUrl(String groupId, String artifactId, String version, String classifier) throws UnsupportedEncodingException {
+ Assert.isNotNull(artifactId);
+ StringBuilder searchUrl = getBaseUrl().append("service/local/data_index?");
+ searchUrl.append("a=").append(URLEncoder.encode(artifactId, "UTF-8")).append("&");
+ if (groupId != null) {
+ searchUrl.append("g=").append(URLEncoder.encode(groupId, "UTF-8")).append("&");
+ }
+ if (version != null) {
+ searchUrl.append("v=").append(URLEncoder.encode(version, "UTF-8")).append("&");
+ }
+ if (classifier != null) {
+ searchUrl.append("c=").append(URLEncoder.encode(classifier, "UTF-8"));
+ }
+ return searchUrl.toString();
+ }
+
+ private StringBuilder getBaseUrl() {
+ StringBuilder sb = new StringBuilder();
+ String base = getUrl();
+ sb.append(base);
+ if (!base.endsWith(PATH_SEPARATOR)) {
+ sb.append(PATH_SEPARATOR);
+ }
+ return sb;
+ }
+
+
+
+
+
+}
Added: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/repositories/RemoteRepositoryManager.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/repositories/RemoteRepositoryManager.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/repositories/RemoteRepositoryManager.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -0,0 +1,130 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2012 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.core.repositories;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.WorkbenchException;
+import org.eclipse.ui.XMLMemento;
+import org.jboss.tools.maven.core.MavenCoreActivator;
+
+public class RemoteRepositoryManager {
+
+ private static final String NEXUS_REPOSITORIES = "nexusRepositories";
+ private static final String NEXUS_REPOSITORY = "nexusRepository";
+ private static final String NAME = "name";
+ private static final String URL = "url";
+ private static final String ENABLED = "enabled";
+
+ private Set<NexusRepository> nexusRepositories;
+
+ public Set<NexusRepository> getNexusRepositories() {
+ if (nexusRepositories == null) {
+ try {
+ nexusRepositories = loadNexusRepositoriesFromPreferences();
+ } catch (WorkbenchException e) {
+ MavenCoreActivator.log(e);
+ }
+ if (nexusRepositories == null) {
+ getDefaultRepositories();
+ }
+ }
+ return nexusRepositories;
+ }
+
+ public Set<NexusRepository> loadNexusRepositoriesFromPreferences() throws WorkbenchException {
+ String repositories = getPreferences().get(NEXUS_REPOSITORIES, null);
+ if (repositories == null || repositories.isEmpty()) {
+ return null;
+ }
+ Reader reader = new StringReader(repositories);
+ XMLMemento memento = XMLMemento.createReadRoot(reader);
+ IMemento[] nodes = memento.getChildren(NEXUS_REPOSITORY);
+ for (IMemento node:nodes) {
+ if (nexusRepositories == null) {
+ nexusRepositories = new LinkedHashSet<NexusRepository>();
+ }
+ String name = node.getString(NAME);
+ String url = node.getString(URL);
+ boolean enabled = node.getBoolean(ENABLED);
+ NexusRepository repository = new NexusRepository(name, url, enabled);
+ nexusRepositories.add(repository);
+ }
+ return nexusRepositories;
+ }
+
+ public Set<NexusRepository> getDefaultRepositories() {
+ nexusRepositories = new LinkedHashSet<NexusRepository>();
+ addRepository("JBoss Nexus Repository", "https://repository.jboss.org/nexus", true);
+ addRepository("Sonatype Nexus Repository", "http://repository.sonatype.org", false);
+ addRepository("Apache Nexus Repository", "https://repository.apache.org", false);
+ addRepository("Sonatype OSS Repository", "http://oss.sonatype.org", false);
+ addRepository("Codehaus Repository", "https://nexus.codehaus.org", false);
+ addRepository("Java.net Repository", "https://maven.java.net", false);
+ return nexusRepositories;
+ }
+
+ private void addRepository(String name, String url, boolean enabled) {
+ NexusRepository repository = new NexusRepository(name, url, enabled);
+ nexusRepositories.add(repository);
+ }
+
+ public void setNexusRepositories(Set<NexusRepository> nexusRepositories) {
+ this.nexusRepositories = nexusRepositories;
+ }
+
+ public void saveNexusRepositories() {
+ if (nexusRepositories == null || nexusRepositories.size() == 0) {
+ return;
+ }
+ XMLMemento memento = XMLMemento.createWriteRoot(NEXUS_REPOSITORIES);
+ Writer writer = null;
+ try {
+ for (NexusRepository repository : nexusRepositories) {
+ IMemento repositoryNode = memento.createChild(NEXUS_REPOSITORY);
+ repositoryNode.putString(NAME, repository.getName());
+ repositoryNode.putString(URL, repository.getUrl());
+ repositoryNode.putBoolean(ENABLED, repository.isEnabled());
+ }
+ writer = new StringWriter();
+ memento.save(writer);
+ writer.flush();
+ String repositories = writer.toString();
+ getPreferences().put(NEXUS_REPOSITORIES, repositories);
+ getPreferences().flush();
+ } catch (Exception e) {
+ MavenCoreActivator.log(e);
+ } finally {
+ if (writer != null) {
+ try {
+ writer.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ }
+
+ public static IEclipsePreferences getPreferences() {
+ IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(MavenCoreActivator.PLUGIN_ID);
+ return prefs;
+ }
+
+}
Modified: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.classpath
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.classpath 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/.classpath 2012-08-28 09:34:41 UTC (rev 43261)
@@ -3,6 +3,5 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/>
- <classpathentry exported="true" kind="lib" path="lib/nexus-indexer-lucene-rest-api-client.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/META-INF/MANIFEST.MF 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/META-INF/MANIFEST.MF 2012-08-28 09:34:41 UTC (rev 43261)
@@ -14,14 +14,12 @@
org.eclipse.m2e.core;bundle-version="1.0.0";visibility:=reexport,
org.eclipse.m2e.maven.runtime;bundle-version="1.0.0";visibility:=reexport,
org.apache.commons.codec;bundle-version="1.3.0",
- org.eclipse.ui;bundle-version="3.7.0"
+ org.eclipse.ui;bundle-version="3.7.0",
+ org.jboss.tools.maven.core;bundle-version="1.4.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: %BundleVendor
Bundle-Localization: plugin
Export-Package: org.jboss.tools.maven.sourcelookup,
- org.jboss.tools.maven.sourcelookup.containers,
- org.jboss.tools.maven.sourcelookup.identification,
- org.jboss.tools.maven.sourcelookup.internal.identification
-Bundle-ClassPath: .,
- lib/nexus-indexer-lucene-rest-api-client.jar
+ org.jboss.tools.maven.sourcelookup.containers
+Bundle-ClassPath: .
Deleted: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/NexusRepository.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/NexusRepository.java 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/NexusRepository.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -1,111 +0,0 @@
-/*************************************************************************************
- * Copyright (c) 2008-2012 Red Hat, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * JBoss by Red Hat - Initial implementation.
- ************************************************************************************/
-package org.jboss.tools.maven.sourcelookup;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-
-import org.eclipse.core.runtime.Assert;
-
-
-/**
- *
- * @author snjeza
- *
- */
-public class NexusRepository {
- private String name;
- private String url;
- private boolean enabled;
-
- private static final String PATH_SEPARATOR = "/";
-
- public NexusRepository() {
- super();
- }
-
- public NexusRepository(String name, String url, boolean enabled) {
- super();
- this.name = name;
- this.url = url;
- this.enabled = enabled;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public void setEnabled(boolean checked) {
- this.enabled = checked;
- }
-
- @Override
- public String toString() {
- return "NexusRepository [name=" + name + ", url=" + url + ", enabled="
- + enabled + "]";
- }
-
- public String getSearchUrl(String sha1) throws UnsupportedEncodingException {
- // "https://repository.jboss.org/nexus/service/local/data_index?sha1=";
- Assert.isNotNull(sha1);
- StringBuilder searchUrl = getBaseUrl()
- .append("service/local/data_index?sha1=")
- .append(URLEncoder.encode(sha1, "UTF-8"));
- return searchUrl.toString();
- }
-
- public String getSearchUrl(String groupId, String artifactId, String version, String classifier) throws UnsupportedEncodingException {
- Assert.isNotNull(artifactId);
- StringBuilder searchUrl = getBaseUrl().append("service/local/data_index?");
- searchUrl.append("a=").append(URLEncoder.encode(artifactId, "UTF-8")).append("&");
- if (groupId != null) {
- searchUrl.append("g=").append(URLEncoder.encode(groupId, "UTF-8")).append("&");
- }
- if (version != null) {
- searchUrl.append("v=").append(URLEncoder.encode(version, "UTF-8")).append("&");
- }
- if (classifier != null) {
- searchUrl.append("c=").append(URLEncoder.encode(classifier, "UTF-8"));
- }
- return searchUrl.toString();
- }
-
- private StringBuilder getBaseUrl() {
- StringBuilder sb = new StringBuilder();
- String base = getUrl();
- sb.append(base);
- if (!base.endsWith(PATH_SEPARATOR)) {
- sb.append(PATH_SEPARATOR);
- }
- return sb;
- }
-
-
-
-
-
-}
Modified: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/SourceLookupActivator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/SourceLookupActivator.java 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/SourceLookupActivator.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -10,14 +10,6 @@
************************************************************************************/
package org.jboss.tools.maven.sourcelookup;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
import org.eclipse.core.internal.runtime.InternalPlatform;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
@@ -28,9 +20,6 @@
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.WorkbenchException;
-import org.eclipse.ui.XMLMemento;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
@@ -50,14 +39,7 @@
public static final String JBOSS_LAUNCH_SOURCE_PATH_COMPUTER_ID = "org.jboss.tools.maven.sourcelookup.SourcePathComputer"; //$NON-NLS-1$
public static final String AUTO_ADD_JBOSS_SOURCE_CONTAINER = "autoAddJBossSourceContainer";
public static final boolean AUTO_ADD_JBOSS_SOURCE_CONTAINER_DEFAULT = false;
- private static final String NEXUS_REPOSITORIES = "nexusRepositories";
- private static final String NEXUS_REPOSITORY = "nexusRepository";
- private static final String NAME = "name";
- private static final String URL = "url";
- private static final String ENABLED = "enabled";
- private static Set<NexusRepository> nexusRepositories;
-
// The shared instance
private static SourceLookupActivator plugin;
@@ -148,90 +130,4 @@
.equals(configuration.getType().getIdentifier());
}
- public static Set<NexusRepository> getNexusRepositories() {
- if (nexusRepositories == null) {
- try {
- nexusRepositories = loadNexusRepositoriesFromPreferences();
- } catch (WorkbenchException e) {
- log(e);
- }
- if (nexusRepositories == null) {
- getDefaultRepositories();
- }
- }
- return nexusRepositories;
- }
-
- public static Set<NexusRepository> loadNexusRepositoriesFromPreferences() throws WorkbenchException {
- String repositories = getPreferences().get(NEXUS_REPOSITORIES, null);
- if (repositories == null || repositories.isEmpty()) {
- return null;
- }
- Reader reader = new StringReader(repositories);
- XMLMemento memento = XMLMemento.createReadRoot(reader);
- IMemento[] nodes = memento.getChildren(NEXUS_REPOSITORY);
- for (IMemento node:nodes) {
- if (nexusRepositories == null) {
- nexusRepositories = new LinkedHashSet<NexusRepository>();
- }
- String name = node.getString(NAME);
- String url = node.getString(URL);
- boolean enabled = node.getBoolean(ENABLED);
- NexusRepository repository = new NexusRepository(name, url, enabled);
- nexusRepositories.add(repository);
- }
- return nexusRepositories;
- }
-
- public static Set<NexusRepository> getDefaultRepositories() {
- nexusRepositories = new LinkedHashSet<NexusRepository>();
- addRepository("JBoss Nexus Repository", "https://repository.jboss.org/nexus", true);
- addRepository("Sonatype Nexus Repository", "http://repository.sonatype.org", false);
- addRepository("Apache Nexus Repository", "https://repository.apache.org", false);
- addRepository("Sonatype OSS Repository", "http://oss.sonatype.org", false);
- addRepository("Codehaus Repository", "https://nexus.codehaus.org", false);
- addRepository("Java.net Repository", "https://maven.java.net", false);
- return nexusRepositories;
- }
-
- private static void addRepository(String name, String url, boolean enabled) {
- NexusRepository repository = new NexusRepository(name, url, enabled);
- nexusRepositories.add(repository);
- }
-
- public static void setNexusRepositories(Set<NexusRepository> nexusRepositories) {
- SourceLookupActivator.nexusRepositories = nexusRepositories;
- }
-
- public static void saveNexusRepositories() {
- if (nexusRepositories == null || nexusRepositories.size() == 0) {
- return;
- }
- XMLMemento memento = XMLMemento.createWriteRoot(NEXUS_REPOSITORIES);
- Writer writer = null;
- try {
- for (NexusRepository repository:nexusRepositories) {
- IMemento repositoryNode = memento.createChild(NEXUS_REPOSITORY);
- repositoryNode.putString(NAME, repository.getName());
- repositoryNode.putString(URL, repository.getUrl());
- repositoryNode.putBoolean(ENABLED, repository.isEnabled());
- }
- writer = new StringWriter();
- memento.save(writer);
- writer.flush();
- String repositories = writer.toString();
- getPreferences().put(NEXUS_REPOSITORIES, repositories);
- getPreferences().flush();
- } catch (Exception e) {
- log(e);
- } finally {
- if (writer != null) {
- try {
- writer.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
- }
}
Modified: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/containers/JBossSourceContainer.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/containers/JBossSourceContainer.java 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.core/src/org/jboss/tools/maven/sourcelookup/containers/JBossSourceContainer.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -10,8 +10,6 @@
************************************************************************************/
package org.jboss.tools.maven.sourcelookup.containers;
-import static org.jboss.tools.maven.sourcelookup.identification.IdentificationUtil.getSourcesClassifier;
-
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -49,9 +47,10 @@
import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.tools.maven.core.identification.IFileIdentificationManager;
+import org.jboss.tools.maven.core.identification.IdentificationUtil;
+import org.jboss.tools.maven.core.internal.identification.FileIdentificationManager;
import org.jboss.tools.maven.sourcelookup.SourceLookupActivator;
-import org.jboss.tools.maven.sourcelookup.identification.IFileIdentificationManager;
-import org.jboss.tools.maven.sourcelookup.internal.identification.FileIdentificationManager;
/**
*
@@ -302,7 +301,7 @@
final ArtifactKey sourcesArtifact = new ArtifactKey(
artifact.getGroupId(), artifact.getArtifactId(),
artifact.getVersion(),
- getSourcesClassifier(artifact.getClassifier()));
+ IdentificationUtil.getSourcesClassifier(artifact.getClassifier()));
resolvedFile = null;
Job job = new Job("Downloading sources for " + file.getName()) {
@@ -348,7 +347,7 @@
public static IPath getSourcePath(ArtifactKey a) {
File file = getAttachedArtifactFile(a,
- getSourcesClassifier(a.getClassifier()));
+ IdentificationUtil.getSourcesClassifier(a.getClassifier()));
if (file != null) {
return Path.fromOSString(file.getAbsolutePath());
Modified: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/META-INF/MANIFEST.MF 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/META-INF/MANIFEST.MF 2012-08-28 09:34:41 UTC (rev 43261)
@@ -7,6 +7,7 @@
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.jboss.tools.maven.sourcelookup.core;bundle-version="1.0.0",
+ org.jboss.tools.maven.core;bundle-version="1.4.0",
org.eclipse.debug.ui;bundle-version="3.7.0",
org.eclipse.jdt.ui;bundle-version="3.7.1"
Bundle-ActivationPolicy: lazy
Modified: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/actions/AttachSourcesActionDelegate.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/actions/AttachSourcesActionDelegate.java 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/actions/AttachSourcesActionDelegate.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -37,10 +37,10 @@
import org.eclipse.m2e.core.embedder.ArtifactKey;
import org.eclipse.ui.IEditorActionDelegate;
import org.eclipse.ui.IEditorPart;
+import org.jboss.tools.maven.core.identification.IFileIdentificationManager;
+import org.jboss.tools.maven.core.internal.identification.FileIdentificationManager;
import org.jboss.tools.maven.sourcelookup.SourceLookupActivator;
import org.jboss.tools.maven.sourcelookup.containers.JBossSourceContainer;
-import org.jboss.tools.maven.sourcelookup.identification.IFileIdentificationManager;
-import org.jboss.tools.maven.sourcelookup.internal.identification.FileIdentificationManager;
import org.jboss.tools.maven.sourcelookup.ui.SourceLookupUIActivator;
/**
Deleted: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/browsers/EditNexusRepositoryDialog.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/browsers/EditNexusRepositoryDialog.java 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/browsers/EditNexusRepositoryDialog.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -1,122 +0,0 @@
-/*************************************************************************************
- * Copyright (c) 2010-2011 Red Hat, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * JBoss by Red Hat - Initial implementation.
- ************************************************************************************/
-package org.jboss.tools.maven.sourcelookup.ui.browsers;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.jboss.tools.maven.sourcelookup.NexusRepository;
-
-/**
- * @author snjeza
- *
- */
-public class EditNexusRepositoryDialog extends Dialog {
-
- private NexusRepository nexusRepository;
- private String title;
-
- public EditNexusRepositoryDialog(Shell parentShell, NexusRepository repository) {
- super(parentShell);
- setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER
- | SWT.RESIZE | getDefaultOrientation());
- this.nexusRepository = repository;
- if (this.nexusRepository == null) {
- this.nexusRepository = new NexusRepository("", "", true);
- this.title = "New Repository";
- } else {
- this.title = "Edit Repository";
- }
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- getShell().setText(title);
- Composite area = (Composite) super.createDialogArea(parent);
- Composite contents = new Composite(area, SWT.NONE);
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = 100;
- gd.widthHint = 400;
- contents.setLayoutData(gd);
- contents.setLayout(new GridLayout(2, false));
- applyDialogFont(contents);
- initializeDialogUnits(area);
-
- Label nameLabel = new Label(contents, SWT.NONE);
- nameLabel.setText("Name:");
-
- final Text nameText = new Text(contents, SWT.BORDER);
- gd = new GridData(SWT.FILL, SWT.FILL, true, false);
- nameText.setLayoutData(gd);
- nameText.setText(nexusRepository.getName());
-
- nameText.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- nexusRepository.setName(nameText.getText());
- }
- });
-
- Label urlLabel = new Label(contents, SWT.NONE);
- urlLabel.setText("URL:");
-
- final Text urlText = new Text(contents, SWT.BORDER);
- gd = new GridData(SWT.FILL, SWT.FILL, true, false);
- urlText.setLayoutData(gd);
- urlText.setText(nexusRepository.getUrl());
-
- urlText.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- nexusRepository.setUrl(urlText.getText());
- }
- });
-
- final Button enabledButton = new Button(contents, SWT.CHECK);
- gd = new GridData(SWT.FILL, SWT.FILL, true, false);
- gd.horizontalSpan = 2;
- enabledButton.setLayoutData(gd);
- enabledButton.setText("Enabled");
- enabledButton.setSelection(nexusRepository.isEnabled());
- enabledButton.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- nexusRepository.setEnabled(enabledButton.getSelection());
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
-
- }
- });
-
- return area;
- }
-
- public NexusRepository getNexusRepository() {
- return nexusRepository;
- }
-
-}
Deleted: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/preferences/AutoResizeTableLayout.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/preferences/AutoResizeTableLayout.java 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/preferences/AutoResizeTableLayout.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -1,129 +0,0 @@
-/*************************************************************************************
- * Copyright (c) 2010-2011 Red Hat, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are 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:
- * JBoss by Red Hat - Initial implementation.
- ************************************************************************************/
-package org.jboss.tools.maven.sourcelookup.ui.preferences;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnPixelData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-
-public class AutoResizeTableLayout extends TableLayout implements
- ControlListener {
-
- private final Table table;
- private List<ColumnLayoutData> columns = new ArrayList<ColumnLayoutData>();
- private boolean autosizing = false;
-
- public AutoResizeTableLayout(Table table) {
- this.table = table;
- table.addControlListener(this);
- }
-
- public void addColumnData(ColumnLayoutData data) {
- columns.add(data);
- super.addColumnData(data);
- }
-
- public void controlMoved(ControlEvent e) {
- }
-
- public void controlResized(ControlEvent e) {
- if (autosizing) {
- return;
- }
- autosizing = true;
- try {
- autoSizeColumns();
- } finally {
- autosizing = false;
- }
- }
-
- private void autoSizeColumns() {
- int width = table.getClientArea().width;
- if (width <= 1) {
- return;
- }
-
- TableColumn[] tableColumns = table.getColumns();
- int size =
- Math.min(columns.size(), tableColumns.length);
- int[] widths = new int[size];
- int fixedWidth = 0;
- int numberOfWeightColumns = 0;
- int totalWeight = 0;
-
- // First calc space occupied by fixed columns.
- for (int i = 0; i < size; i++) {
- ColumnLayoutData col = (ColumnLayoutData)columns.get(i);
- if (col instanceof ColumnPixelData) {
- int pixels = ((ColumnPixelData)col).width;
- widths[i] = pixels;
- fixedWidth += pixels;
- } else if (col instanceof ColumnWeightData) {
- ColumnWeightData cw = (ColumnWeightData)col;
- numberOfWeightColumns++;
- int weight = cw.weight;
- totalWeight += weight;
- } else {
- throw new IllegalStateException("Unknown column layout data");
- }
- }
-
- // Do we have columns that have a weight?
- if (numberOfWeightColumns > 0) {
- // Now, distribute the rest
- // to the columns with weight.
- int rest = width - fixedWidth;
- int totalDistributed = 0;
- for (int i = 0; i < size; i++) {
- ColumnLayoutData col = (ColumnLayoutData)columns.get(i);
- if (col instanceof ColumnWeightData) {
- ColumnWeightData cw = (ColumnWeightData)col;
- int weight = cw.weight;
- int pixels = totalWeight == 0 ? 0 : weight * rest / totalWeight;
- totalDistributed += pixels;
- widths[i] = pixels;
- }
- }
-
- // Distribute any remaining pixels
- // to columns with weight.
- int diff = rest - totalDistributed;
- for (int i = 0; diff > 0; i++) {
- if (i == size) {
- i = 0;
- }
- ColumnLayoutData col = (ColumnLayoutData)columns.get(i);
- if (col instanceof ColumnWeightData) {
- ++widths[i];
- --diff;
- }
- }
- }
-
- for (int i = 0; i < size; i++) {
- if (tableColumns[i].getWidth() != widths[i]) {
- tableColumns[i].setWidth(widths[i]);
- }
-
- }
-
- }
-
-}
Modified: trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/preferences/SourceLookupPreferencePage.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/preferences/SourceLookupPreferencePage.java 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/preferences/SourceLookupPreferencePage.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -10,44 +10,17 @@
************************************************************************************/
package org.jboss.tools.maven.sourcelookup.ui.preferences;
-import java.util.Iterator;
-import java.util.Set;
-
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.jboss.tools.maven.sourcelookup.NexusRepository;
import org.jboss.tools.maven.sourcelookup.SourceLookupActivator;
-import org.jboss.tools.maven.sourcelookup.ui.browsers.EditNexusRepositoryDialog;
/**
*
@@ -58,8 +31,6 @@
IWorkbenchPreferencePage {
private Button autoAddButton;
- private CheckboxTableViewer tableViewer;
- private Set<NexusRepository> nexusRepositories;
@Override
public void init(IWorkbench workbench) {
@@ -67,6 +38,7 @@
@Override
protected Control createContents(Composite parent) {
+
initializeDialogUnits(parent);
Composite composite = new Composite(parent, SWT.NONE);
@@ -82,62 +54,6 @@
autoAddButton
.setText("Automatically add the JBoss Maven source container to all JBoss AS launch configurations");
- // Nexus Repositories
- Group group = new Group(composite, SWT.NONE);
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
- group.setLayoutData(gd);
- layout = new GridLayout(2, false);
- group.setLayout(layout);
- group.setText("Nexus Index Repositories");
- tableViewer = CheckboxTableViewer
- .newCheckList(group, SWT.BORDER | SWT.V_SCROLL | SWT.SINGLE);
- Table table = tableViewer.getTable();
- gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = 300;
- table.setLayoutData(gd);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
-
- String[] columnNames = new String[] { "Name", "URL" };
- int[] columnWidths = new int[] { 200, 200 };
-
- for (int i = 0; i < columnNames.length; i++) {
- TableColumn tc = new TableColumn(table, SWT.LEFT);
- tc.setText(columnNames[i]);
- tc.setWidth(columnWidths[i]);
- }
-
- ColumnLayoutData[] layouts = {
- new ColumnWeightData(200,200),
- new ColumnWeightData(200,200)
- };
-
- TableLayout tableLayout = new AutoResizeTableLayout(table);
- for (int i = 0; i < layouts.length; i++) {
- tableLayout.addColumnData(layouts[i]);
- }
-
- nexusRepositories = SourceLookupActivator
- .getNexusRepositories();
- tableViewer.setLabelProvider(new NexusRepositoryLabelProvider());
- tableViewer.setContentProvider(new NexusRepositoryContentProvider(
- nexusRepositories));
-
- tableViewer.setInput(nexusRepositories);
- for (NexusRepository nexusRepository : nexusRepositories) {
- tableViewer.setChecked(nexusRepository,
- nexusRepository.isEnabled());
- }
- tableViewer.addCheckStateListener(new ICheckStateListener() {
-
- public void checkStateChanged(CheckStateChangedEvent event) {
- NexusRepository repository = (NexusRepository) event
- .getElement();
- repository.setEnabled(!repository.isEnabled());
- }
- });
-
- createButtons(group, tableViewer);
return composite;
}
@@ -146,226 +62,6 @@
super.dispose();
}
- private void createButtons(Composite parent, final TableViewer viewer) {
- Composite buttonComposite = new Composite(parent, SWT.NONE);
- buttonComposite.setLayout(new GridLayout(1,false));
- buttonComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
-
- Button addButton = new Button(buttonComposite, SWT.PUSH);
- addButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- addButton.setText("Add...");
- addButton.addSelectionListener(new SelectionListener(){
-
- public void widgetDefaultSelected(SelectionEvent e) {
-
- }
-
- public void widgetSelected(SelectionEvent e) {
- EditNexusRepositoryDialog dialog = new EditNexusRepositoryDialog(getShell(), null);
- int ok = dialog.open();
- if (ok == Window.OK) {
- NexusRepository repository = dialog.getNexusRepository();
- nexusRepositories.add(repository);
- viewer.refresh();
- tableViewer.setChecked(repository,
- repository.isEnabled());
- }
- viewer.refresh();
- }
-
- });
-
- final Button editButton = new Button(buttonComposite, SWT.PUSH);
- editButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- editButton.setText("Edit...");
- editButton.setEnabled(false);
-
- editButton.addSelectionListener(new SelectionListener(){
-
- public void widgetSelected(SelectionEvent e) {
- ISelection sel = viewer.getSelection();
- if (sel instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection) sel;
- Object object = selection.getFirstElement();
- if (object instanceof NexusRepository) {
- NexusRepository repository = (NexusRepository) object;
- NexusRepository edit = new NexusRepository(repository.getName(), repository.getUrl(), repository.isEnabled());
- EditNexusRepositoryDialog dialog = new EditNexusRepositoryDialog(getShell(), edit);
- int ok = dialog.open();
- if (ok == Window.OK) {
- repository.setName(edit.getName());
- repository.setUrl(edit.getUrl());
- repository.setEnabled(edit.isEnabled());
- viewer.refresh();
- tableViewer.setChecked(repository,
- repository.isEnabled());
- }
- }
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
-
- }
- });
-
- final Button removeButton = new Button(buttonComposite, SWT.PUSH);
- removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- removeButton.setText("Remove");
- removeButton.setEnabled(false);
-
- removeButton.addSelectionListener(new SelectionListener(){
-
- public void widgetSelected(SelectionEvent e) {
- ISelection sel = viewer.getSelection();
- if (sel instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection) sel;
- Object object = selection.getFirstElement();
- if (object instanceof NexusRepository) {
- nexusRepositories.remove(object);
- viewer.refresh();
- }
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
-
- }
- });
-
- final Button upButton = new Button(buttonComposite, SWT.PUSH);
- upButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- upButton.setText("Up");
- upButton.setEnabled(false);
-
- final Button downButton = new Button(buttonComposite, SWT.PUSH);
- downButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- downButton.setText("Down");
- downButton.setEnabled(false);
-
- upButton.addSelectionListener(new SelectionListener(){
-
- public void widgetSelected(SelectionEvent e) {
- ISelection sel = viewer.getSelection();
- if (sel instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection) sel;
- Object object = selection.getFirstElement();
- if (object instanceof NexusRepository) {
- NexusRepository selected = (NexusRepository) object;
- NexusRepository[] reps = nexusRepositories.toArray(new NexusRepository[0]);
- int selectedIndex = -1;
- for (int i = 0; i < reps.length; i++) {
- NexusRepository rep = reps[i];
- if (selected.equals(rep)) {
- selectedIndex = i;
- break;
- }
- }
- if (selectedIndex > 0) {
- NexusRepository temp = reps[selectedIndex-1];
- reps[selectedIndex - 1] = selected;
- reps[selectedIndex] = temp;
- nexusRepositories.clear();
- for (NexusRepository repository:reps) {
- nexusRepositories.add(repository);
- }
- viewer.refresh();
- int newIndex = selectedIndex - 1;
- downButton.setEnabled( newIndex < (reps.length - 1));
- upButton.setEnabled(newIndex > 0);
-
- }
- }
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
-
- }
- });
-
- downButton.addSelectionListener(new SelectionListener(){
-
- public void widgetSelected(SelectionEvent e) {
- ISelection sel = viewer.getSelection();
- if (sel instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection) sel;
- Object object = selection.getFirstElement();
- if (object instanceof NexusRepository) {
- NexusRepository selected = (NexusRepository) object;
- NexusRepository[] reps = nexusRepositories.toArray(new NexusRepository[0]);
- int selectedIndex = -1;
- for (int i = 0; i < reps.length; i++) {
- NexusRepository rep = reps[i];
- if (selected.equals(rep)) {
- selectedIndex = i;
- break;
- }
- }
- if (selectedIndex >= 0 && selectedIndex < reps.length) {
- NexusRepository temp = reps[selectedIndex + 1];
- reps[selectedIndex + 1] = selected;
- reps[selectedIndex] = temp;
- nexusRepositories.clear();
- for (NexusRepository repository:reps) {
- nexusRepositories.add(repository);
- }
- viewer.refresh();
- int newIndex = selectedIndex + 1;
- downButton.setEnabled( newIndex < (reps.length - 1));
- upButton.setEnabled(newIndex > 0);
- }
- }
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
-
- }
- });
-
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection sel = viewer.getSelection();
- if (sel instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection) sel;
- Object object = selection.getFirstElement();
- editButton.setEnabled(object instanceof NexusRepository);
- removeButton.setEnabled(object instanceof NexusRepository);
- upButton.setEnabled(false);
- downButton.setEnabled(false);
- if (object instanceof NexusRepository && nexusRepositories.size() > 1) {
- NexusRepository repository = (NexusRepository) object;
- Iterator<NexusRepository> iterator = nexusRepositories.iterator();
- NexusRepository first = null;
- if (iterator.hasNext()) {
- first = iterator.next();
- }
- NexusRepository last = null;
- while (iterator.hasNext()) {
- last = iterator.next();
- }
- if (repository.equals(last)) {
- upButton.setEnabled(true);
- } else if (repository.equals(first)) {
- downButton.setEnabled(true);
- } else {
- upButton.setEnabled(true);
- downButton.setEnabled(true);
- }
-
- }
- } else {
- editButton.setEnabled(false);
- removeButton.setEnabled(false);
- upButton.setEnabled(false);
- downButton.setEnabled(false);
- }
- }
- });
- }
-
@Override
protected void performApply() {
IEclipsePreferences preferences = SourceLookupActivator.getDefault()
@@ -373,14 +69,7 @@
preferences.putBoolean(
SourceLookupActivator.AUTO_ADD_JBOSS_SOURCE_CONTAINER,
autoAddButton.getSelection());
- SourceLookupActivator.setNexusRepositories(nexusRepositories);
- SourceLookupActivator.saveNexusRepositories();
SourceLookupActivator.getDefault().savePreferences();
- tableViewer.setInput(nexusRepositories);
- for (NexusRepository nexusRepository : nexusRepositories) {
- tableViewer.setChecked(nexusRepository,
- nexusRepository.isEnabled());
- }
}
@Override
@@ -392,15 +81,6 @@
preferences.putBoolean(
SourceLookupActivator.AUTO_ADD_JBOSS_SOURCE_CONTAINER,
SourceLookupActivator.AUTO_ADD_JBOSS_SOURCE_CONTAINER_DEFAULT);
- SourceLookupActivator.setNexusRepositories(null);
- nexusRepositories = SourceLookupActivator.getDefaultRepositories();
- SourceLookupActivator.saveNexusRepositories();
- SourceLookupActivator.getDefault().savePreferences();
- tableViewer.setInput(nexusRepositories);
- for (NexusRepository nexusRepository : nexusRepositories) {
- tableViewer.setChecked(nexusRepository,
- nexusRepository.isEnabled());
- }
super.performDefaults();
}
@@ -409,53 +89,4 @@
performApply();
return super.performOk();
}
-
- private class NexusRepositoryLabelProvider extends LabelProvider implements
- ITableLabelProvider {
-
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- if (element instanceof NexusRepository) {
- NexusRepository nr = (NexusRepository) element;
- if (columnIndex == 0) {
- return nr.getName();
- }
- if (columnIndex == 1) {
- return nr.getUrl();
- }
- }
- return null;
- }
- }
-
- private class NexusRepositoryContentProvider implements
- IStructuredContentProvider {
-
- private Set<NexusRepository> repositories;
-
- public NexusRepositoryContentProvider(Set<NexusRepository> repositories) {
- this.repositories = repositories;
- }
-
- public Object[] getElements(Object inputElement) {
- return repositories.toArray();
- }
-
- public void dispose() {
-
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- repositories = (Set<NexusRepository>) newInput;
- }
- }
-
- @Override
- public boolean performCancel() {
- SourceLookupActivator.setNexusRepositories(null);
- return super.performCancel();
- }
}
Modified: trunk/maven/plugins/org.jboss.tools.maven.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/.settings/org.eclipse.jdt.core.prefs 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/.settings/org.eclipse.jdt.core.prefs 2012-08-28 09:34:41 UTC (rev 43261)
@@ -1,9 +1,8 @@
-#Thu May 28 22:27:10 CEST 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.6
Modified: trunk/maven/plugins/org.jboss.tools.maven.ui/.settings/org.eclipse.m2e.core.prefs
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/.settings/org.eclipse.m2e.core.prefs 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/.settings/org.eclipse.m2e.core.prefs 2012-08-28 09:34:41 UTC (rev 43261)
@@ -1,5 +1,4 @@
-#Tue Jun 28 11:43:06 CEST 2011
-activeProfiles=
-eclipse.preferences.version=1
-resolveWorkspaceProjects=true
-version=1
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
Modified: trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.xml
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.xml 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/plugin.xml 2012-08-28 09:34:41 UTC (rev 43261)
@@ -159,4 +159,15 @@
name="%Configure_Maven_Repositories">
</wizard>
</extension>
+
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.jboss.tools.common.model.ui.MainPreferencePage"
+ class="org.jboss.tools.maven.ui.preferences.RemoteRepositoriesPreferencePage"
+ id="org.jboss.tools.maven.ui.preferences.RemoteRepositoriesPreferencePage"
+ name="Remote Repositories"/>
+ </extension>
+
+
</plugin>
Copied: trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/repositories/EditNexusRepositoryDialog.java (from rev 43185, trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/browsers/EditNexusRepositoryDialog.java)
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/repositories/EditNexusRepositoryDialog.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/internal/repositories/EditNexusRepositoryDialog.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -0,0 +1,123 @@
+/*************************************************************************************
+ * Copyright (c) 2010-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.ui.internal.repositories;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.maven.core.repositories.NexusRepository;
+
+/**
+ * @author snjeza
+ *
+ */
+public class EditNexusRepositoryDialog extends Dialog {
+
+ private NexusRepository nexusRepository;
+ private String title;
+
+ public EditNexusRepositoryDialog(Shell parentShell,
+ NexusRepository repository) {
+ super(parentShell);
+ setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER | SWT.RESIZE
+ | getDefaultOrientation());
+ this.nexusRepository = repository;
+ if (this.nexusRepository == null) {
+ this.nexusRepository = new NexusRepository("", "", true);
+ this.title = "New Repository";
+ } else {
+ this.title = "Edit Repository";
+ }
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ getShell().setText(title);
+ Composite area = (Composite) super.createDialogArea(parent);
+ Composite contents = new Composite(area, SWT.NONE);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 100;
+ gd.widthHint = 400;
+ contents.setLayoutData(gd);
+ contents.setLayout(new GridLayout(2, false));
+ applyDialogFont(contents);
+ initializeDialogUnits(area);
+
+ Label nameLabel = new Label(contents, SWT.NONE);
+ nameLabel.setText("Name:");
+
+ final Text nameText = new Text(contents, SWT.BORDER);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ nameText.setLayoutData(gd);
+ nameText.setText(nexusRepository.getName());
+
+ nameText.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ nexusRepository.setName(nameText.getText());
+ }
+ });
+
+ Label urlLabel = new Label(contents, SWT.NONE);
+ urlLabel.setText("URL:");
+
+ final Text urlText = new Text(contents, SWT.BORDER);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ urlText.setLayoutData(gd);
+ urlText.setText(nexusRepository.getUrl());
+
+ urlText.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ nexusRepository.setUrl(urlText.getText());
+ }
+ });
+
+ final Button enabledButton = new Button(contents, SWT.CHECK);
+ gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ gd.horizontalSpan = 2;
+ enabledButton.setLayoutData(gd);
+ enabledButton.setText("Enabled");
+ enabledButton.setSelection(nexusRepository.isEnabled());
+ enabledButton.addSelectionListener(new SelectionListener() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ nexusRepository.setEnabled(enabledButton.getSelection());
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+
+ return area;
+ }
+
+ public NexusRepository getNexusRepository() {
+ return nexusRepository;
+ }
+
+}
Copied: trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/preferences/AutoResizeTableLayout.java (from rev 43185, trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/preferences/AutoResizeTableLayout.java)
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/preferences/AutoResizeTableLayout.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/preferences/AutoResizeTableLayout.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -0,0 +1,129 @@
+/*************************************************************************************
+ * Copyright (c) 2010-2011 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.ui.preferences;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.ColumnLayoutData;
+import org.eclipse.jface.viewers.ColumnPixelData;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+
+public class AutoResizeTableLayout extends TableLayout implements
+ ControlListener {
+
+ private final Table table;
+ private List<ColumnLayoutData> columns = new ArrayList<ColumnLayoutData>();
+ private boolean autosizing = false;
+
+ public AutoResizeTableLayout(Table table) {
+ this.table = table;
+ table.addControlListener(this);
+ }
+
+ public void addColumnData(ColumnLayoutData data) {
+ columns.add(data);
+ super.addColumnData(data);
+ }
+
+ public void controlMoved(ControlEvent e) {
+ }
+
+ public void controlResized(ControlEvent e) {
+ if (autosizing) {
+ return;
+ }
+ autosizing = true;
+ try {
+ autoSizeColumns();
+ } finally {
+ autosizing = false;
+ }
+ }
+
+ private void autoSizeColumns() {
+ int width = table.getClientArea().width;
+ if (width <= 1) {
+ return;
+ }
+
+ TableColumn[] tableColumns = table.getColumns();
+ int size =
+ Math.min(columns.size(), tableColumns.length);
+ int[] widths = new int[size];
+ int fixedWidth = 0;
+ int numberOfWeightColumns = 0;
+ int totalWeight = 0;
+
+ // First calc space occupied by fixed columns.
+ for (int i = 0; i < size; i++) {
+ ColumnLayoutData col = (ColumnLayoutData)columns.get(i);
+ if (col instanceof ColumnPixelData) {
+ int pixels = ((ColumnPixelData)col).width;
+ widths[i] = pixels;
+ fixedWidth += pixels;
+ } else if (col instanceof ColumnWeightData) {
+ ColumnWeightData cw = (ColumnWeightData)col;
+ numberOfWeightColumns++;
+ int weight = cw.weight;
+ totalWeight += weight;
+ } else {
+ throw new IllegalStateException("Unknown column layout data");
+ }
+ }
+
+ // Do we have columns that have a weight?
+ if (numberOfWeightColumns > 0) {
+ // Now, distribute the rest
+ // to the columns with weight.
+ int rest = width - fixedWidth;
+ int totalDistributed = 0;
+ for (int i = 0; i < size; i++) {
+ ColumnLayoutData col = (ColumnLayoutData)columns.get(i);
+ if (col instanceof ColumnWeightData) {
+ ColumnWeightData cw = (ColumnWeightData)col;
+ int weight = cw.weight;
+ int pixels = totalWeight == 0 ? 0 : weight * rest / totalWeight;
+ totalDistributed += pixels;
+ widths[i] = pixels;
+ }
+ }
+
+ // Distribute any remaining pixels
+ // to columns with weight.
+ int diff = rest - totalDistributed;
+ for (int i = 0; diff > 0; i++) {
+ if (i == size) {
+ i = 0;
+ }
+ ColumnLayoutData col = (ColumnLayoutData)columns.get(i);
+ if (col instanceof ColumnWeightData) {
+ ++widths[i];
+ --diff;
+ }
+ }
+ }
+
+ for (int i = 0; i < size; i++) {
+ if (tableColumns[i].getWidth() != widths[i]) {
+ tableColumns[i].setWidth(widths[i]);
+ }
+
+ }
+
+ }
+
+}
Copied: trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/preferences/RemoteRepositoriesPreferencePage.java (from rev 43185, trunk/maven/plugins/org.jboss.tools.maven.sourcelookup.ui/src/org/jboss/tools/maven/sourcelookup/ui/preferences/SourceLookupPreferencePage.java)
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/preferences/RemoteRepositoriesPreferencePage.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/preferences/RemoteRepositoriesPreferencePage.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -0,0 +1,451 @@
+/*************************************************************************************
+ * Copyright (c) 2008-2012 Red Hat, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * JBoss by Red Hat - Initial implementation.
+ ************************************************************************************/
+package org.jboss.tools.maven.ui.preferences;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ColumnLayoutData;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.jboss.tools.maven.core.MavenCoreActivator;
+import org.jboss.tools.maven.core.repositories.NexusRepository;
+import org.jboss.tools.maven.core.repositories.RemoteRepositoryManager;
+import org.jboss.tools.maven.ui.internal.repositories.EditNexusRepositoryDialog;
+
+/**
+ *
+ * @author snjeza
+ *
+ */
+public class RemoteRepositoriesPreferencePage extends PreferencePage implements
+ IWorkbenchPreferencePage {
+
+ private CheckboxTableViewer tableViewer;
+ private Set<NexusRepository> nexusRepositories;
+
+ private RemoteRepositoryManager remoteRepositoryManager;
+
+ @Override
+ public void init(IWorkbench workbench) {
+ remoteRepositoryManager = MavenCoreActivator.getDefault().getRepositoryManager();
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ initializeDialogUnits(parent);
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(1, false);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ composite.setLayout(layout);
+
+ Label label = new Label(composite, SWT.FILL);
+ label.setText("Remote repositories used for dependency identification (only Nexus repositories are supported).");
+
+ // Nexus Repositories
+ Group group = new Group(composite, SWT.NONE);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
+ group.setLayoutData(gd);
+ layout = new GridLayout(2, false);
+ group.setLayout(layout);
+ group.setText("Remote Repositories");
+ tableViewer = CheckboxTableViewer
+ .newCheckList(group, SWT.BORDER | SWT.V_SCROLL | SWT.SINGLE);
+ Table table = tableViewer.getTable();
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 300;
+ table.setLayoutData(gd);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ String[] columnNames = new String[] { "Name", "URL" };
+ int[] columnWidths = new int[] { 200, 200 };
+
+ for (int i = 0; i < columnNames.length; i++) {
+ TableColumn tc = new TableColumn(table, SWT.LEFT);
+ tc.setText(columnNames[i]);
+ tc.setWidth(columnWidths[i]);
+ }
+
+ ColumnLayoutData[] layouts = {
+ new ColumnWeightData(200,200),
+ new ColumnWeightData(200,200)
+ };
+
+ TableLayout tableLayout = new AutoResizeTableLayout(table);
+ for (int i = 0; i < layouts.length; i++) {
+ tableLayout.addColumnData(layouts[i]);
+ }
+
+ nexusRepositories = remoteRepositoryManager.getNexusRepositories();
+ tableViewer.setLabelProvider(new NexusRepositoryLabelProvider());
+ tableViewer.setContentProvider(new NexusRepositoryContentProvider(
+ nexusRepositories));
+
+ tableViewer.setInput(nexusRepositories);
+ for (NexusRepository nexusRepository : nexusRepositories) {
+ tableViewer.setChecked(nexusRepository,
+ nexusRepository.isEnabled());
+ }
+ tableViewer.addCheckStateListener(new ICheckStateListener() {
+
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ NexusRepository repository = (NexusRepository) event
+ .getElement();
+ repository.setEnabled(!repository.isEnabled());
+ }
+ });
+
+ createButtons(group, tableViewer);
+ return composite;
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+ private void createButtons(Composite parent, final TableViewer viewer) {
+ Composite buttonComposite = new Composite(parent, SWT.NONE);
+ buttonComposite.setLayout(new GridLayout(1,false));
+ buttonComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));
+
+ Button addButton = new Button(buttonComposite, SWT.PUSH);
+ addButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ addButton.setText("Add...");
+ addButton.addSelectionListener(new SelectionListener(){
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ EditNexusRepositoryDialog dialog = new EditNexusRepositoryDialog(getShell(), null);
+ int ok = dialog.open();
+ if (ok == Window.OK) {
+ NexusRepository repository = dialog.getNexusRepository();
+ nexusRepositories.add(repository);
+ viewer.refresh();
+ tableViewer.setChecked(repository,
+ repository.isEnabled());
+ }
+ viewer.refresh();
+ }
+
+ });
+
+ final Button editButton = new Button(buttonComposite, SWT.PUSH);
+ editButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ editButton.setText("Edit...");
+ editButton.setEnabled(false);
+
+ editButton.addSelectionListener(new SelectionListener(){
+
+ public void widgetSelected(SelectionEvent e) {
+ ISelection sel = viewer.getSelection();
+ if (sel instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) sel;
+ Object object = selection.getFirstElement();
+ if (object instanceof NexusRepository) {
+ NexusRepository repository = (NexusRepository) object;
+ NexusRepository edit = new NexusRepository(repository.getName(), repository.getUrl(), repository.isEnabled());
+ EditNexusRepositoryDialog dialog = new EditNexusRepositoryDialog(getShell(), edit);
+ int ok = dialog.open();
+ if (ok == Window.OK) {
+ repository.setName(edit.getName());
+ repository.setUrl(edit.getUrl());
+ repository.setEnabled(edit.isEnabled());
+ viewer.refresh();
+ tableViewer.setChecked(repository,
+ repository.isEnabled());
+ }
+ }
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+
+ final Button removeButton = new Button(buttonComposite, SWT.PUSH);
+ removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ removeButton.setText("Remove");
+ removeButton.setEnabled(false);
+
+ removeButton.addSelectionListener(new SelectionListener(){
+
+ public void widgetSelected(SelectionEvent e) {
+ ISelection sel = viewer.getSelection();
+ if (sel instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) sel;
+ Object object = selection.getFirstElement();
+ if (object instanceof NexusRepository) {
+ nexusRepositories.remove(object);
+ viewer.refresh();
+ }
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+
+ final Button upButton = new Button(buttonComposite, SWT.PUSH);
+ upButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ upButton.setText("Up");
+ upButton.setEnabled(false);
+
+ final Button downButton = new Button(buttonComposite, SWT.PUSH);
+ downButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ downButton.setText("Down");
+ downButton.setEnabled(false);
+
+ upButton.addSelectionListener(new SelectionListener(){
+
+ public void widgetSelected(SelectionEvent e) {
+ ISelection sel = viewer.getSelection();
+ if (sel instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) sel;
+ Object object = selection.getFirstElement();
+ if (object instanceof NexusRepository) {
+ NexusRepository selected = (NexusRepository) object;
+ NexusRepository[] reps = nexusRepositories.toArray(new NexusRepository[0]);
+ int selectedIndex = -1;
+ for (int i = 0; i < reps.length; i++) {
+ NexusRepository rep = reps[i];
+ if (selected.equals(rep)) {
+ selectedIndex = i;
+ break;
+ }
+ }
+ if (selectedIndex > 0) {
+ NexusRepository temp = reps[selectedIndex-1];
+ reps[selectedIndex - 1] = selected;
+ reps[selectedIndex] = temp;
+ nexusRepositories.clear();
+ for (NexusRepository repository:reps) {
+ nexusRepositories.add(repository);
+ }
+ viewer.refresh();
+ int newIndex = selectedIndex - 1;
+ downButton.setEnabled( newIndex < (reps.length - 1));
+ upButton.setEnabled(newIndex > 0);
+
+ }
+ }
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+
+ downButton.addSelectionListener(new SelectionListener(){
+
+ public void widgetSelected(SelectionEvent e) {
+ ISelection sel = viewer.getSelection();
+ if (sel instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) sel;
+ Object object = selection.getFirstElement();
+ if (object instanceof NexusRepository) {
+ NexusRepository selected = (NexusRepository) object;
+ NexusRepository[] reps = nexusRepositories.toArray(new NexusRepository[0]);
+ int selectedIndex = -1;
+ for (int i = 0; i < reps.length; i++) {
+ NexusRepository rep = reps[i];
+ if (selected.equals(rep)) {
+ selectedIndex = i;
+ break;
+ }
+ }
+ if (selectedIndex >= 0 && selectedIndex < reps.length) {
+ NexusRepository temp = reps[selectedIndex + 1];
+ reps[selectedIndex + 1] = selected;
+ reps[selectedIndex] = temp;
+ nexusRepositories.clear();
+ for (NexusRepository repository:reps) {
+ nexusRepositories.add(repository);
+ }
+ viewer.refresh();
+ int newIndex = selectedIndex + 1;
+ downButton.setEnabled( newIndex < (reps.length - 1));
+ upButton.setEnabled(newIndex > 0);
+ }
+ }
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ ISelection sel = viewer.getSelection();
+ if (sel instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) sel;
+ Object object = selection.getFirstElement();
+ editButton.setEnabled(object instanceof NexusRepository);
+ removeButton.setEnabled(object instanceof NexusRepository);
+ upButton.setEnabled(false);
+ downButton.setEnabled(false);
+ if (object instanceof NexusRepository && nexusRepositories.size() > 1) {
+ NexusRepository repository = (NexusRepository) object;
+ Iterator<NexusRepository> iterator = nexusRepositories.iterator();
+ NexusRepository first = null;
+ if (iterator.hasNext()) {
+ first = iterator.next();
+ }
+ NexusRepository last = null;
+ while (iterator.hasNext()) {
+ last = iterator.next();
+ }
+ if (repository.equals(last)) {
+ upButton.setEnabled(true);
+ } else if (repository.equals(first)) {
+ downButton.setEnabled(true);
+ } else {
+ upButton.setEnabled(true);
+ downButton.setEnabled(true);
+ }
+
+ }
+ } else {
+ editButton.setEnabled(false);
+ removeButton.setEnabled(false);
+ upButton.setEnabled(false);
+ downButton.setEnabled(false);
+ }
+ }
+ });
+ }
+
+ @Override
+ protected void performApply() {
+ IEclipsePreferences preferences = MavenCoreActivator.getDefault().getPreferences();
+
+ remoteRepositoryManager.setNexusRepositories(nexusRepositories);
+ remoteRepositoryManager.saveNexusRepositories();
+ MavenCoreActivator.getDefault().savePreferences();
+ tableViewer.setInput(nexusRepositories);
+ for (NexusRepository nexusRepository : nexusRepositories) {
+ tableViewer.setChecked(nexusRepository,
+ nexusRepository.isEnabled());
+ }
+ }
+
+ @Override
+ protected void performDefaults() {
+ IEclipsePreferences preferences = MavenCoreActivator.getPreferences();
+
+ remoteRepositoryManager.setNexusRepositories(null);
+ nexusRepositories = remoteRepositoryManager.getDefaultRepositories();
+ remoteRepositoryManager.saveNexusRepositories();
+ MavenCoreActivator.getDefault().savePreferences();
+ tableViewer.setInput(nexusRepositories);
+ for (NexusRepository nexusRepository : nexusRepositories) {
+ tableViewer.setChecked(nexusRepository,
+ nexusRepository.isEnabled());
+ }
+ super.performDefaults();
+ }
+
+ @Override
+ public boolean performOk() {
+ performApply();
+ return super.performOk();
+ }
+
+ private class NexusRepositoryLabelProvider extends LabelProvider implements
+ ITableLabelProvider {
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof NexusRepository) {
+ NexusRepository nr = (NexusRepository) element;
+ if (columnIndex == 0) {
+ return nr.getName();
+ }
+ if (columnIndex == 1) {
+ return nr.getUrl();
+ }
+ }
+ return null;
+ }
+ }
+
+ private class NexusRepositoryContentProvider implements
+ IStructuredContentProvider {
+
+ private Set<NexusRepository> repositories;
+
+ public NexusRepositoryContentProvider(Set<NexusRepository> repositories) {
+ this.repositories = repositories;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return repositories.toArray();
+ }
+
+ public void dispose() {
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ repositories = (Set<NexusRepository>) newInput;
+ }
+ }
+
+ @Override
+ public boolean performCancel() {
+ remoteRepositoryManager.setNexusRepositories(null);
+ return super.performCancel();
+ }
+}
Modified: trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/wizard/ConfigureMavenRepositoriesWizardPage.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/wizard/ConfigureMavenRepositoriesWizardPage.java 2012-08-28 01:09:13 UTC (rev 43260)
+++ trunk/maven/plugins/org.jboss.tools.maven.ui/src/org/jboss/tools/maven/ui/wizard/ConfigureMavenRepositoriesWizardPage.java 2012-08-28 09:34:41 UTC (rev 43261)
@@ -55,7 +55,6 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -80,7 +79,6 @@
import org.eclipse.m2e.core.embedder.ArtifactKey;
import org.eclipse.m2e.core.embedder.IMaven;
import org.eclipse.m2e.core.embedder.IMavenConfiguration;
-import org.eclipse.m2e.core.internal.IMavenConstants;
import org.eclipse.m2e.core.internal.index.IndexManager;
import org.eclipse.m2e.core.project.IMavenProjectFacade;
import org.eclipse.m2e.core.project.MavenUpdateRequest;
12 years, 4 months
JBoss Tools SVN: r43260 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-08-27 21:09:13 -0400 (Mon, 27 Aug 2012)
New Revision: 43260
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
Log:
Added necessary check for null.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2012-08-28 00:02:01 UTC (rev 43259)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2012-08-28 01:09:13 UTC (rev 43260)
@@ -958,7 +958,7 @@
affectedComponents.add(c);
}
} else {
- if(loaded instanceof ISeamXmlComponentDeclaration) {
+ if(loaded instanceof ISeamXmlComponentDeclaration && c != null) {
ISeamXmlComponentDeclaration xml = (ISeamXmlComponentDeclaration)loaded;
onXMLLoadedDeclaration(c, oldClassName, xml);
}
12 years, 4 months