JBoss Tools SVN: r17049 - workspace/yradtsevich.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2009-08-11 12:49:27 -0400 (Tue, 11 Aug 2009)
New Revision: 17049
Added:
workspace/yradtsevich/TagEvaluator/
Removed:
workspace/yradtsevich/mock/
Log:
Renamed folder.
Copied: workspace/yradtsevich/TagEvaluator (from rev 17048, workspace/yradtsevich/mock)
16 years, 4 months
JBoss Tools SVN: r17048 - trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2009-08-11 12:42:03 -0400 (Tue, 11 Aug 2009)
New Revision: 17048
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/HyperlinkPartitionerDefinition.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4424
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/HyperlinkPartitionerDefinition.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/HyperlinkPartitionerDefinition.java 2009-08-11 16:41:44 UTC (rev 17047)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/HyperlinkPartitionerDefinition.java 2009-08-11 16:42:03 UTC (rev 17048)
@@ -356,6 +356,7 @@
private static String ALL_TAGS = "/*/"; //$NON-NLS-1$
private static String DELIM = "/"; //$NON-NLS-1$
+ private static String TAGLIB = "/["; //$NON-NLS-1$
public boolean containtsPath(String path) {
path = getCorrectPath(path);
@@ -364,10 +365,12 @@
}
if(fDelimitedPathElements!=null) {
int lastIndex = -1;
+ int tagLib = -1;
for(int i=0; i<fDelimitedPathElements.length; i++) {
if(i==0 && !fStartDelim) {
if(path.startsWith(fDelimitedPathElements[i])) {
lastIndex = 0;
+ tagLib = 0;
continue;
} else {
return false;
@@ -376,6 +379,8 @@
int currentIndex = path.indexOf(fDelimitedPathElements[i]);
if(currentIndex>-1 && currentIndex>lastIndex) {
lastIndex = currentIndex;
+ if(fDelimitedPathElements[i].startsWith(TAGLIB))
+ tagLib = lastIndex;
continue;
} else {
return false;
@@ -383,7 +388,9 @@
}
}
if(fEndDelim || path.endsWith(fDelimitedPathElements[fDelimitedPathElements.length-1])) {
- return true;
+ int lastTaglib = path.lastIndexOf(TAGLIB);
+ if(lastTaglib <= tagLib)
+ return true;
}
return false;
}
16 years, 4 months
JBoss Tools SVN: r17047 - in workspace/yradtsevich: mock and 11 other directories.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2009-08-11 12:41:44 -0400 (Tue, 11 Aug 2009)
New Revision: 17047
Added:
workspace/yradtsevich/mock/
workspace/yradtsevich/mock/.classpath
workspace/yradtsevich/mock/.project
workspace/yradtsevich/mock/TagEvaluator/
workspace/yradtsevich/mock/lib/
workspace/yradtsevich/mock/lib/jsf-api.jar
workspace/yradtsevich/mock/lib/jsf-impl.jar
workspace/yradtsevich/mock/lib/mockrunner.jar
workspace/yradtsevich/mock/lib/shale-test-1.0.5.jar
workspace/yradtsevich/mock/src/
workspace/yradtsevich/mock/src/org/
workspace/yradtsevich/mock/src/org/apache/
workspace/yradtsevich/mock/src/org/apache/shale/
workspace/yradtsevich/mock/src/org/apache/shale/test/
workspace/yradtsevich/mock/src/org/apache/shale/test/mock/
workspace/yradtsevich/mock/src/org/apache/shale/test/mock/MockHttpServletResponse.java
workspace/yradtsevich/mock/src/org/jboss/
workspace/yradtsevich/mock/src/org/jboss/tools/
workspace/yradtsevich/mock/src/org/jboss/tools/vpe/
workspace/yradtsevich/mock/src/org/jboss/tools/vpe/mock/
workspace/yradtsevich/mock/src/org/jboss/tools/vpe/mock/MockServerEnvironment.java
workspace/yradtsevich/mock/src/org/jboss/tools/vpe/mock/TagEvaluator.java
workspace/yradtsevich/mock/src/org/jboss/tools/vpe/mock/TagEvaluatorSnippet.java
Log:
Example of using mock objects for jsp2html conversion. Initial commit.
Added: workspace/yradtsevich/mock/.classpath
===================================================================
--- workspace/yradtsevich/mock/.classpath (rev 0)
+++ workspace/yradtsevich/mock/.classpath 2009-08-11 16:41:44 UTC (rev 17047)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v6.0"/>
+ <classpathentry kind="lib" path="lib/jsf-api.jar"/>
+ <classpathentry kind="lib" path="lib/jsf-impl.jar"/>
+ <classpathentry kind="lib" path="lib/mockrunner.jar"/>
+ <classpathentry kind="lib" path="lib/shale-test-1.0.5.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: workspace/yradtsevich/mock/.project
===================================================================
--- workspace/yradtsevich/mock/.project (rev 0)
+++ workspace/yradtsevich/mock/.project 2009-08-11 16:41:44 UTC (rev 17047)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>TagEvaluator</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: workspace/yradtsevich/mock/lib/jsf-api.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/mock/lib/jsf-api.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/mock/lib/jsf-impl.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/mock/lib/jsf-impl.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/mock/lib/mockrunner.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/mock/lib/mockrunner.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/mock/lib/shale-test-1.0.5.jar
===================================================================
(Binary files differ)
Property changes on: workspace/yradtsevich/mock/lib/shale-test-1.0.5.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/yradtsevich/mock/src/org/apache/shale/test/mock/MockHttpServletResponse.java
===================================================================
--- workspace/yradtsevich/mock/src/org/apache/shale/test/mock/MockHttpServletResponse.java (rev 0)
+++ workspace/yradtsevich/mock/src/org/apache/shale/test/mock/MockHttpServletResponse.java 2009-08-11 16:41:44 UTC (rev 17047)
@@ -0,0 +1,457 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shale.test.mock;
+
+import java.io.ByteArrayOutputStream;
+import java.io.CharArrayWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.TimeZone;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * <p>Mock implementation of <code>HttpServletResponse</code>.</p>
+ *
+ * Yahor Radtsevich (yradtsevich): this is NOT the original implementation
+ * provided by The Apache Software Foundation,
+ * method {@link #setLocale(Locale)} has been modified.
+ * <P>
+ * $Id$
+ */
+
+public class MockHttpServletResponse implements HttpServletResponse {
+
+
+ // ------------------------------------------------------------ Constructors
+
+
+ /**
+ * <p>Return a default instance.</p>
+ */
+ public MockHttpServletResponse() { }
+
+
+ // ----------------------------------------------------- Mock Object Methods
+
+
+ /**
+ * <p>Retrieve the first value that was set for the specified header,
+ * if any. Otherwise, return <code>null</code>.</p>
+ *
+ * @param name Header name to look up
+ */
+ public String getHeader(String name) {
+ String match = name + ":";
+ Iterator headers = this.headers.iterator();
+ while (headers.hasNext()) {
+ String header = (String) headers.next();
+ if (header.startsWith(match)) {
+ return header.substring(match.length() + 1).trim();
+ }
+ }
+ return null;
+ }
+
+
+ /**
+ * <p>Return the text message for the HTTP status that was set.</p>
+ */
+ public String getMessage() {
+ return this.message;
+ }
+
+
+ /**
+ * <p>Return the HTTP status code that was set.</p>
+ */
+ public int getStatus() {
+ return this.status;
+ }
+
+
+ /**
+ * <p>Set the <code>ServletOutputStream</code> to be returned by a call to
+ * <code>getOutputStream()</code>.</p>
+ *
+ * @param stream The <code>ServletOutputStream</code> instance to use
+ *
+ * @deprecated Let the <code>getOutputStream()</code> method create and
+ * return an instance of <code>MockServletOutputStream</code> for you
+ */
+ public void setOutputStream(ServletOutputStream stream) {
+ this.stream = stream;
+ }
+
+
+ /**
+ * <p>Set the <code>PrintWriter</code> to be returned by a call to
+ * <code>getWriter()</code>.</p>
+ *
+ * @param writer The <code>PrintWriter</code> instance to use
+ *
+ * @deprecated Let the <code>getWriter()</code> method create and return
+ * an instance of <code>MockPrintWriter</code> for you
+ */
+ public void setWriter(PrintWriter writer) {
+ this.writer = writer;
+ }
+
+
+ // ------------------------------------------------------ Instance Variables
+
+
+ private String encoding = "ISO-8859-1";
+ private String contentType = "text/html";
+ private List headers = new ArrayList();
+ private String message = null;
+ private int status = HttpServletResponse.SC_OK;
+ private ServletOutputStream stream = null;
+ private PrintWriter writer = null;
+
+
+ // -------------------------------------------- HttpServletResponse Methods
+
+
+ /** {@inheritDoc} */
+ public void addCookie(Cookie cookie) {
+
+ throw new UnsupportedOperationException();
+
+ }
+
+
+ /** {@inheritDoc} */
+ public void addDateHeader(String name, long value) {
+
+ headers.add(name + ": " + formatDate(value));
+
+ }
+
+
+ /** {@inheritDoc} */
+ public void addHeader(String name, String value) {
+
+ headers.add(name + ": " + value);
+
+ }
+
+
+ /** {@inheritDoc} */
+ public void addIntHeader(String name, int value) {
+
+ headers.add(name + ": " + value);
+
+ }
+
+
+ /** {@inheritDoc} */
+ public boolean containsHeader(String name) {
+
+ return getHeader(name) != null;
+
+ }
+
+
+ /** {@inheritDoc} */
+ public String encodeRedirectUrl(String url) {
+
+ return encodeRedirectURL(url);
+
+ }
+
+
+ /** {@inheritDoc} */
+ public String encodeRedirectURL(String url) {
+
+ return url;
+
+ }
+
+
+ /** {@inheritDoc} */
+ public String encodeUrl(String url) {
+
+ return encodeURL(url);
+
+ }
+
+
+ /** {@inheritDoc} */
+ public String encodeURL(String url) {
+
+ return url;
+
+ }
+
+
+ /** {@inheritDoc} */
+ public void sendError(int status) {
+
+ this.status = status;
+
+ }
+
+
+ /** {@inheritDoc} */
+ public void sendError(int status, String message) {
+
+ this.status = status;
+ this.message = message;
+
+ }
+
+
+ /** {@inheritDoc} */
+ public void sendRedirect(String location) {
+
+ this.status = HttpServletResponse.SC_MOVED_TEMPORARILY;
+ this.message = location;
+
+ }
+
+
+ /** {@inheritDoc} */
+ public void setDateHeader(String name, long value) {
+
+ removeHeader(name);
+ addDateHeader(name, value);
+
+ }
+
+
+ /** {@inheritDoc} */
+ public void setHeader(String name, String value) {
+
+ removeHeader(name);
+ addHeader(name, value);
+
+ }
+
+
+ /** {@inheritDoc} */
+ public void setIntHeader(String name, int value) {
+
+ removeHeader(name);
+ addIntHeader(name, value);
+
+ }
+
+
+ /** {@inheritDoc} */
+ public void setStatus(int status) {
+
+ throw new UnsupportedOperationException();
+
+ }
+
+
+ /** {@inheritDoc} */
+ public void setStatus(int status, String message) {
+
+ throw new UnsupportedOperationException();
+
+ }
+
+
+ // ------------------------------------------------ ServletResponse Methods
+
+
+ /** {@inheritDoc} */
+ public void flushBuffer() {
+
+ throw new UnsupportedOperationException();
+
+ }
+
+
+ /** {@inheritDoc} */
+ public int getBufferSize() {
+
+ throw new UnsupportedOperationException();
+
+ }
+
+
+ /** {@inheritDoc} */
+ public String getCharacterEncoding() {
+
+ return this.encoding;
+
+ }
+
+
+ /** {@inheritDoc} */
+ public String getContentType() {
+
+ return this.contentType;
+
+ }
+
+
+ /** {@inheritDoc} */
+ public Locale getLocale() {
+
+ throw new UnsupportedOperationException();
+
+ }
+
+
+ /** {@inheritDoc} */
+ public ServletOutputStream getOutputStream() throws IOException {
+
+ if (stream == null) {
+ if (writer != null) {
+ throw new IllegalStateException("Cannot call getOutputStream() after getWriter() has been called");
+ }
+ stream = new MockServletOutputStream(new ByteArrayOutputStream());
+ }
+ return stream;
+
+ }
+
+
+ /** {@inheritDoc} */
+ public PrintWriter getWriter() throws IOException {
+
+ if (writer == null) {
+ if (stream != null) {
+ throw new IllegalStateException("Cannot call getWriter() after getOutputStream() was called");
+ }
+ writer = new MockPrintWriter(new CharArrayWriter());
+ }
+ return writer;
+
+ }
+
+
+ /** {@inheritDoc} */
+ public boolean isCommitted() {
+
+ throw new UnsupportedOperationException();
+
+ }
+
+
+ /** {@inheritDoc} */
+ public void reset() {
+
+ throw new UnsupportedOperationException();
+
+ }
+
+
+ /** {@inheritDoc} */
+ public void resetBuffer() {
+
+ throw new UnsupportedOperationException();
+
+ }
+
+
+ /** {@inheritDoc} */
+ public void setBufferSize(int size) {
+
+ throw new UnsupportedOperationException();
+
+ }
+
+
+ /** {@inheritDoc} */
+ public void setCharacterEncoding(String charset) {
+
+ this.encoding = charset;
+
+ }
+
+
+ /** {@inheritDoc} */
+ public void setContentLength(int length) {
+
+ throw new UnsupportedOperationException();
+
+ }
+
+
+ /** {@inheritDoc} */
+ public void setContentType(String type) {
+
+ contentType = type;
+
+ }
+
+
+ /** {@inheritDoc} */
+ public void setLocale(Locale locale) {
+ // commented by Yahor Radtsevich (yradtsevich)
+ // XXX: throw new UnsupportedOperationException();
+ }
+
+
+ // --------------------------------------------------------- Private Methods
+
+
+ /**
+ * <p>The date formatting helper we will use in <code>httpTimestamp()</code>.
+ * Note that usage of this helper must be synchronized.</p>
+ */
+ private static SimpleDateFormat format =
+ new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz");
+ static {
+ format.setTimeZone(TimeZone.getTimeZone("GMT"));
+ }
+
+
+ /**
+ * <p>Return a properly formatted String version of the specified
+ * date/time, formatted as required by the HTTP specification.</p>
+ *
+ * @param date Date/time, expressed as milliseconds since the epoch
+ */
+ private String formatDate(long date) {
+ return format.format(new Date(date));
+ }
+
+
+ /**
+ * <p>Remove any header that has been set with the specific name.</p>
+ *
+ * @param name Header name to look up
+ */
+ private void removeHeader(String name) {
+ String match = name + ":";
+ Iterator headers = this.headers.iterator();
+ while (headers.hasNext()) {
+ String header = (String) headers.next();
+ if (header.startsWith(match)) {
+ headers.remove();
+ return;
+ }
+ }
+ }
+
+
+}
Added: workspace/yradtsevich/mock/src/org/jboss/tools/vpe/mock/MockServerEnvironment.java
===================================================================
--- workspace/yradtsevich/mock/src/org/jboss/tools/vpe/mock/MockServerEnvironment.java (rev 0)
+++ workspace/yradtsevich/mock/src/org/jboss/tools/vpe/mock/MockServerEnvironment.java 2009-08-11 16:41:44 UTC (rev 17047)
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.tools.vpe.mock;
+
+import javax.faces.FactoryFinder;
+import javax.faces.application.ApplicationFactory;
+import javax.faces.component.UIViewRoot;
+import javax.faces.lifecycle.LifecycleFactory;
+import javax.faces.render.RenderKitFactory;
+
+import org.apache.shale.test.mock.MockApplication;
+import org.apache.shale.test.mock.MockExternalContext;
+import org.apache.shale.test.mock.MockFacesContext;
+import org.apache.shale.test.mock.MockFacesContextFactory;
+import org.apache.shale.test.mock.MockHttpServletRequest;
+import org.apache.shale.test.mock.MockHttpServletResponse;
+import org.apache.shale.test.mock.MockHttpSession;
+import org.apache.shale.test.mock.MockLifecycle;
+import org.apache.shale.test.mock.MockLifecycleFactory;
+import org.apache.shale.test.mock.MockRenderKit;
+import org.apache.shale.test.mock.MockResponseWriter;
+import org.apache.shale.test.mock.MockServletConfig;
+import org.apache.shale.test.mock.MockServletContext;
+
+import com.mockrunner.mock.web.MockPageContext;
+
+/**
+ * Provides some mock variables that are available on a real servlet container
+ * including JSF environment variables.
+ *
+ * @author Yahor Radtsevich (yradtsevich). This implementation is based on
+ * org.apache.shale.test.base.AbstractJsfTestCase.
+ */
+public class MockServerEnvironment {
+ protected final MockApplication application;
+ protected final MockServletConfig config;
+ protected final MockExternalContext externalContext;
+ protected final MockFacesContext facesContext;
+ protected final MockFacesContextFactory facesContextFactory;
+ protected final MockLifecycle lifecycle;
+ protected final MockLifecycleFactory lifecycleFactory;
+ protected final MockRenderKit renderKit;
+ protected final MockHttpServletRequest request;
+ protected final MockHttpServletResponse response;
+ protected final MockServletContext servletContext;
+ protected final MockHttpSession session;
+ protected final MockPageContext pageContext;
+ protected final MockResponseWriter mockResponseWriter;
+
+ public MockServerEnvironment(String encoding) {
+// Set up a new thread context class loader
+// Thread.currentThread().setContextClassLoader(
+// new URLClassLoader(new URL[0],
+// this.getClass().getClassLoader()));
+
+ // Set up Servlet API Objects
+ servletContext = new MockServletContext();
+ config = new MockServletConfig(servletContext);
+ session = new MockHttpSession();
+ session.setServletContext(servletContext);
+ request = new MockHttpServletRequest(session);
+ request.setServletContext(servletContext);
+ response = new MockHttpServletResponse();
+
+ // Set up JSF API Objects
+ FactoryFinder.releaseFactories();
+ FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY,
+ "org.apache.shale.test.mock.MockApplicationFactory");
+ FactoryFinder.setFactory(FactoryFinder.FACES_CONTEXT_FACTORY,
+ "org.apache.shale.test.mock.MockFacesContextFactory");
+ FactoryFinder.setFactory(FactoryFinder.LIFECYCLE_FACTORY,
+ "org.apache.shale.test.mock.MockLifecycleFactory");
+ FactoryFinder.setFactory(FactoryFinder.RENDER_KIT_FACTORY,
+ "org.apache.shale.test.mock.MockRenderKitFactory");
+
+// externalContext =
+// new MockExternalContext(servletContext, request, response);
+ lifecycleFactory = (MockLifecycleFactory)
+ FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
+ lifecycle = (MockLifecycle)
+ lifecycleFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
+ facesContextFactory = (MockFacesContextFactory)
+ FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
+ facesContext = (MockFacesContext)
+ facesContextFactory.getFacesContext(servletContext,
+ request,
+ response,
+ lifecycle);
+ externalContext = (MockExternalContext)
+ facesContext.getExternalContext();
+ UIViewRoot root = new UIViewRoot();
+ root.setViewId("/viewId");
+ root.setRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT);
+ facesContext.setViewRoot(root);
+ ApplicationFactory applicationFactory = (ApplicationFactory)
+ FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
+ application = (MockApplication) applicationFactory.getApplication();
+ facesContext.setApplication(application);
+ RenderKitFactory renderKitFactory = (RenderKitFactory)
+ FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+ renderKit = new MockRenderKit();
+ renderKitFactory.addRenderKit(RenderKitFactory.HTML_BASIC_RENDER_KIT,
+ renderKit);
+
+ pageContext = new MockPageContext(this.config,
+ this.request, this.response);
+ mockResponseWriter = new MockResponseWriter(pageContext.getOut(),
+ "text/html", encoding);
+ facesContext.setResponseWriter(mockResponseWriter);
+ }
+
+ public MockApplication getApplication() {
+ return application;
+ }
+
+ public MockServletConfig getConfig() {
+ return config;
+ }
+
+ public MockExternalContext getExternalContext() {
+ return externalContext;
+ }
+
+ public MockFacesContext getFacesContext() {
+ return facesContext;
+ }
+
+ public MockFacesContextFactory getFacesContextFactory() {
+ return facesContextFactory;
+ }
+
+ public MockLifecycle getLifecycle() {
+ return lifecycle;
+ }
+
+ public MockLifecycleFactory getLifecycleFactory() {
+ return lifecycleFactory;
+ }
+
+ public MockRenderKit getRenderKit() {
+ return renderKit;
+ }
+
+ public MockHttpServletRequest getRequest() {
+ return request;
+ }
+
+ public MockHttpServletResponse getResponse() {
+ return response;
+ }
+
+ public MockServletContext getServletContext() {
+ return servletContext;
+ }
+
+ public MockHttpSession getSession() {
+ return session;
+ }
+
+ public MockPageContext getPageContext() {
+ return pageContext;
+ }
+
+ public MockResponseWriter getMockResponseWriter() {
+ return mockResponseWriter;
+ }
+}
Added: workspace/yradtsevich/mock/src/org/jboss/tools/vpe/mock/TagEvaluator.java
===================================================================
--- workspace/yradtsevich/mock/src/org/jboss/tools/vpe/mock/TagEvaluator.java (rev 0)
+++ workspace/yradtsevich/mock/src/org/jboss/tools/vpe/mock/TagEvaluator.java 2009-08-11 16:41:44 UTC (rev 17047)
@@ -0,0 +1,84 @@
+package org.jboss.tools.vpe.mock;
+
+import java.io.IOException;
+
+import javax.faces.render.Renderer;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.BodyContent;
+import javax.servlet.jsp.tagext.BodyTag;
+
+import org.apache.shale.test.mock.MockPrintWriter;
+
+import com.mockrunner.mock.web.MockPageContext;
+import com.sun.faces.taglib.jsf_core.ViewTag;
+
+/**
+ * Simple class that can create JSP tag instances and convert them
+ * to HTML code using {@link MockServerEnvironment}.
+ *
+ * @author Yahor Radtsevich (yradtsevich)
+ *
+ * @see TagEvaluatorSnippet TagEvaluatorSnippet implementation as
+ * an example of using of this class.
+ */
+public class TagEvaluator {
+ protected final MockServerEnvironment serverEnvironment;
+
+ public TagEvaluator(MockServerEnvironment serverEnvironment) {
+ this.serverEnvironment = serverEnvironment;
+ }
+
+ public void initTag(
+ String family,
+ String rendererType,
+ String rendererClass,
+ String componentType,
+ String componentClass)
+ throws JspException, InstantiationException,
+ IllegalAccessException, ClassNotFoundException {
+ Renderer renderer = (Renderer)
+ Class.forName(rendererClass).newInstance();
+ serverEnvironment.getFacesContext().getRenderKit()
+ .addRenderer(family, rendererType, renderer);
+ serverEnvironment.getApplication()
+ .addComponent(componentType, componentClass);
+
+ }
+
+ public <T extends BodyTag> T createBodyTag(Class<T> tagClass)
+ throws JspException,
+ InstantiationException, IllegalAccessException {
+ final MockPageContext pageContext = serverEnvironment.getPageContext();
+ ViewTag viewTag = new ViewTag();
+ viewTag.setPageContext(pageContext);
+ viewTag.doStartTag();
+ viewTag.doInitBody();
+ T bodyTag = tagClass.newInstance();
+ bodyTag.setParent(viewTag);
+ bodyTag.setPageContext(pageContext);
+ return bodyTag;
+ }
+
+ /*
+ * XXX: this implementation does not check the return values of
+ * bodyTag.do* methods. So it can process very specific tags only.
+ */
+ public String evaluateBodyTag(BodyTag bodyTag, BodyContent bodyContent)
+ throws JspException, InstantiationException,
+ IllegalAccessException, IOException
+ {
+ ViewTag viewTag = (ViewTag) bodyTag.getParent();
+ bodyTag.doStartTag();
+ bodyTag.setBodyContent(bodyContent);
+ bodyTag.doInitBody();
+
+ bodyTag.doAfterBody();
+ bodyTag.doEndTag();
+ viewTag.doAfterBody();
+ viewTag.getComponentInstance().encodeAll(
+ serverEnvironment.getFacesContext());
+
+ return String.valueOf(((MockPrintWriter)
+ serverEnvironment.getResponse().getWriter()).content());
+ }
+}
Added: workspace/yradtsevich/mock/src/org/jboss/tools/vpe/mock/TagEvaluatorSnippet.java
===================================================================
--- workspace/yradtsevich/mock/src/org/jboss/tools/vpe/mock/TagEvaluatorSnippet.java (rev 0)
+++ workspace/yradtsevich/mock/src/org/jboss/tools/vpe/mock/TagEvaluatorSnippet.java 2009-08-11 16:41:44 UTC (rev 17047)
@@ -0,0 +1,62 @@
+package org.jboss.tools.vpe.mock;
+
+import org.apache.el.ValueExpressionLiteral;
+import org.apache.jasper.el.JspValueExpression;
+
+import com.mockrunner.mock.web.MockBodyContent;
+import com.mockrunner.mock.web.MockJspWriter;
+import com.sun.faces.taglib.html_basic.OutputTextTag;
+
+/**
+ * Example of using of TagEvaluator. Tested under JRE 1.6.
+ *
+ * @author Yahor Radtsevich (yradtsevich)
+ */
+public class TagEvaluatorSnippet {
+ /**
+ * Creates an equivalent of
+ * <P>
+ * <code>
+ * <h:outputText value="SomeValue "id="SomeId">SomeBody</h:outputText>
+ * </code>
+ * <P>
+ * using mock objects, and prints the evaluated
+ * result to the output stream.
+ * <P>
+ * If all goes well, the output must be:
+ * <code>SomeBody<span id="SomeId">SomeValue</span></code>
+ */
+ public static void main(String[] args) throws Exception {
+ TagEvaluator tagCreator = new TagEvaluator(
+ new MockServerEnvironment("cp1251"));
+
+ // initialize FacesContext and Application
+ // with tag renderer and component
+ tagCreator.initTag("javax.faces.Output",
+ "javax.faces.Text",
+ "com.sun.faces.renderkit.html_basic.TextRenderer",
+ "javax.faces.HtmlOutputText",
+ "javax.faces.component.html.HtmlOutputText");
+
+ // create an instance of the tag
+ OutputTextTag outputTextTag = tagCreator.createBodyTag(
+ OutputTextTag.class);
+
+ // initialize fields of the tag
+ JspValueExpression value = new JspValueExpression(
+ "/index.jsp(0,0) 'Mark'",
+ new ValueExpressionLiteral("SomeValue", Object.class));
+ outputTextTag.setValue(value);
+ outputTextTag.setId("SomeId");
+
+ // create body content of the tag
+ MockBodyContent bodyContent
+ = new MockBodyContent(new MockJspWriter());
+ bodyContent.print("SomeBody");
+
+ // evaluate the tag
+ String html = tagCreator.evaluateBodyTag(outputTextTag, bodyContent);
+
+ System.out.println(html);
+ }
+}
16 years, 4 months
JBoss Tools SVN: r17046 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-08-11 10:40:34 -0400 (Tue, 11 Aug 2009)
New Revision: 17046
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelImpl.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4739
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelImpl.java 2009-08-11 13:37:02 UTC (rev 17045)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelImpl.java 2009-08-11 14:40:34 UTC (rev 17046)
@@ -187,6 +187,10 @@
XModelObject p = o;
while(p != null && !XModelObjectConstants.TRUE.equals(p.get("overlapped"))) p = p.getParent(); //$NON-NLS-1$
if(p == null) return o;
+ String newPath = o.getPath().substring(p.getPath().length());
+ if(path.equals(newPath)) {
+ return o;
+ }
path = o.getPath().substring(p.getPath().length());
if(p.getModelEntity().getName().equals("FileFolder")) { //$NON-NLS-1$
XModelObject fs = findMountedFileSystem(p);
16 years, 4 months
JBoss Tools SVN: r17045 - trunk/as/docs/reference/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2009-08-11 09:37:02 -0400 (Tue, 11 Aug 2009)
New Revision: 17045
Modified:
trunk/as/docs/reference/en/modules/quick_start.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-267 - Added the link to the JBoss AS 5 FAQ;
Modified: trunk/as/docs/reference/en/modules/quick_start.xml
===================================================================
--- trunk/as/docs/reference/en/modules/quick_start.xml 2009-08-11 12:15:18 UTC (rev 17044)
+++ trunk/as/docs/reference/en/modules/quick_start.xml 2009-08-11 13:37:02 UTC (rev 17045)
@@ -263,6 +263,9 @@
<para>The latest documentation builds are available <ulink
url="http://download.jboss.org/jbosstools/nightly-docs/">here</ulink>.</para>
+ <para>Find out the answers on the frequently asked questions about JBoss AS 5 usage in the
+ <ulink url="http://www.jboss.org/community/wiki/jboss5faq">JBoss5FAQ</ulink>.
+ </para>
</section>
</chapter>
16 years, 4 months
JBoss Tools SVN: r17044 - in trunk/hibernatetools/plugins: org.hibernate.eclipse/src/org/hibernate/console/preferences and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2009-08-11 08:15:18 -0400 (Tue, 11 Aug 2009)
New Revision: 17044
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/EclipseLaunchConsoleConfigurationPreferences.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/ConsoleConfigurationPreferences.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4721
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2009-08-11 09:46:12 UTC (rev 17043)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2009-08-11 12:15:18 UTC (rev 17044)
@@ -175,7 +175,7 @@
// refresh profile (refresh jpa connection):
// get fresh information about current db structure and update error markers
if (profile.getConnectionState() == IConnectionProfile.CONNECTED_STATE){
- profile.disconnect();
+ profile.disconnect(null);
}
profile.connect(null);
}
@@ -686,7 +686,7 @@
private Configuration configureConnectionProfile(Configuration localCfg) {
String connectionProfile = prefs.getConnectionProfileName();
- if(connectionProfile==null || "".equals(connectionProfile)) {//$NON-NLS-1$
+ if(connectionProfile==null) {
return localCfg;
}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/ConsoleConfigurationPreferences.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/ConsoleConfigurationPreferences.java 2009-08-11 09:46:12 UTC (rev 17043)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/preferences/ConsoleConfigurationPreferences.java 2009-08-11 12:15:18 UTC (rev 17044)
@@ -125,6 +125,10 @@
public abstract String getNamingStrategy();
+ /**
+ *
+ * @return null if ConnectionProfile was not specified
+ */
public abstract String getConnectionProfileName();
public abstract String getDialectName();
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/EclipseLaunchConsoleConfigurationPreferences.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/EclipseLaunchConsoleConfigurationPreferences.java 2009-08-11 09:46:12 UTC (rev 17043)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/EclipseLaunchConsoleConfigurationPreferences.java 2009-08-11 12:15:18 UTC (rev 17044)
@@ -147,7 +147,7 @@
if (jpaProject != null) {
JpaDataSource ds = jpaProject.getDataSource();
if (ds != null)
- return ds.getConnectionProfileName();
+ return "".equals(ds.getConnectionProfileName()) ? null : ds.getConnectionProfileName();//$NON-NLS-1$
}
}
}
16 years, 4 months
JBoss Tools SVN: r17043 - trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-08-11 05:46:12 -0400 (Tue, 11 Aug 2009)
New Revision: 17043
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/Wrapper.java
Log:
removed comments
Modified: trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/Wrapper.java
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/Wrapper.java 2009-08-11 08:32:24 UTC (rev 17042)
+++ trunk/flow/plugins/org.jboss.tools.flow.common/src/org/jboss/tools/flow/common/wrapper/Wrapper.java 2009-08-11 09:46:12 UTC (rev 17043)
@@ -9,10 +9,6 @@
public interface Wrapper extends IAdaptable, IPropertySource, Element {
-// int ADD_INCOMING_CONNECTION = 1;
-// int REMOVE_INCOMING_CONNECTION = 2;
-// int ADD_OUTGOING_CONNECTION = 3;
-// int REMOVE_OUTGOING_CONNECTION = 4;
int CHANGE_VISUAL = 5;
int ADD_ELEMENT = 6;
int REMOVE_ELEMENT = 7;
16 years, 4 months
JBoss Tools SVN: r17042 - in workspace/yzhishko: org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: yzhishko
Date: 2009-08-11 04:32:24 -0400 (Tue, 11 Aug 2009)
New Revision: 17042
Modified:
workspace/yzhishko/org.jboss.tools.ui.bot.test/src/org/jboss/tools/ui/bot/test/JBTSWTBotTestCase.java
workspace/yzhishko/org.jboss.tools.ui.bot.test/src/org/jboss/tools/ui/bot/test/SWTBotMultiPageEditor.java
workspace/yzhishko/org.jboss.tools.ui.bot.test/src/org/jboss/tools/ui/bot/test/SWTJBTBot.java
workspace/yzhishko/org.jboss.tools.ui.bot.test/src/org/jboss/tools/ui/bot/test/WidgetVariables.java
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/AlwaysHideSelectionBarWithoutPromptTest.java
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/BlockCommentTest.java
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/BorderForUnknownTagsTest.java
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ShowNonVisualTagsTest.java
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ShowResourceBundlesUsageasELexpressionsTest.java
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ShowSelectionTagBarTest.java
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ToggleCommentTest.java
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VerificationOfNameSpacesTest.java
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/jbide/JBIDE4306Test.java
workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/palette/ImportTagsFromTLDFileTest.java
Log:
I've made a little refractoring. Unnecessary try{}/catch(){} blocks were deleted. JavaDoc and comments for main methods were created.
Modified: workspace/yzhishko/org.jboss.tools.ui.bot.test/src/org/jboss/tools/ui/bot/test/JBTSWTBotTestCase.java
===================================================================
--- workspace/yzhishko/org.jboss.tools.ui.bot.test/src/org/jboss/tools/ui/bot/test/JBTSWTBotTestCase.java 2009-08-11 08:07:08 UTC (rev 17041)
+++ workspace/yzhishko/org.jboss.tools.ui.bot.test/src/org/jboss/tools/ui/bot/test/JBTSWTBotTestCase.java 2009-08-11 08:32:24 UTC (rev 17042)
@@ -16,13 +16,21 @@
ILogListener {
private Throwable exception;
- public static final String swtBotProperties = "SWTBot.properties";
+ public static final String PATH_TO_SWT_BOT_PROPERTIES = "SWTBot.properties";
private static Properties SWT_BOT_PROPERTIES;
protected SWTJBTBot bot = new SWTJBTBot();
-
+ private int sleepTime = 500;
+
+ /* (non-Javadoc)
+ * This static block read properties from
+ * org.jboss.tools.ui.bot.test/resources/SWTBot.properties file
+ * and set up parameters for SWTBot tests. You may change a number of parameters
+ * in static block and their values in property file.
+ */
+
static {
try {
- InputStream swtPreferenceIS = Platform.getBundle(Activator.PLUGIN_ID).getResource(swtBotProperties)
+ InputStream swtPreferenceIS = Platform.getBundle(Activator.PLUGIN_ID).getResource(PATH_TO_SWT_BOT_PROPERTIES)
.openStream();
SWT_BOT_PROPERTIES = new Properties();
SWT_BOT_PROPERTIES.load(swtPreferenceIS);
@@ -33,9 +41,9 @@
.getProperty("SWTBotPreferences.TIMEOUT"));
swtPreferenceIS.close();
} catch (IOException e) {
- fail("Can't load properties from " + swtBotProperties + " file");
+ fail("Can't load properties from " + PATH_TO_SWT_BOT_PROPERTIES + " file");
} catch (IllegalStateException e) {
- fail("Property file " + swtBotProperties + " was not found");
+ fail("Property file " + PATH_TO_SWT_BOT_PROPERTIES + " was not found");
}
}
@@ -54,14 +62,36 @@
}
}
+ /**
+ * Getter method for exception that may be thrown during test
+ * execution.<p>
+ * You can call this method from any place of your methods
+ * and verify if any exception was thrown during test executing
+ * including Error Log.
+ * @return exception
+ * @see Throwable
+ */
+
protected Throwable getException() {
return exception;
}
+ /**
+ * Setter method for exception.
+ * If param is not null test will fail and you will see stack trace in JUnit Error Log
+ * @param e - exception, that can be frown during test executing
+ * @see Throwable
+ */
+
protected void setException(Throwable e) {
this.exception = e;
}
+ /**
+ * Delete .log file from junit-workspace .metadata, if it hadn't been deleted before<p>
+ * So we can catch exceptions and errors, which were thrown during current test.
+ */
+
private void deleteLog() {
try {
Platform.getLogFileLocation().toFile().delete();
@@ -69,6 +99,16 @@
}
}
+ /**
+ * Make a default preconditions before test launch
+ * @see #activePerspective()
+ * @see #openErrorLog()
+ * @see #openPackageExplorer()
+ * @see #setException(Throwable)
+ * @see #deleteLog()
+ * @see #delay()
+ */
+
@Override
protected void setUp() throws Exception {
activePerspective();
@@ -85,6 +125,11 @@
delay();
}
+ /**
+ * Tears down the fixture. Verify Error Log.
+ * @see #getException()
+ */
+
@Override
protected void tearDown() throws Exception {
Platform.removeLogListener(this);
@@ -94,20 +139,23 @@
}
}
+ /**
+ * A little delay between test's steps. Use it where necessary.
+ */
+
protected void delay() {
- bot.sleep(500);
+ bot.sleep(sleepTime);
}
- protected void shortDelay(){
- bot.sleep(3000);
- }
-
- protected void longDelay() {
- bot.sleep(10000);
- }
+ /** Defines which kind of perspective should be activated before tests' run.
+ */
abstract protected void activePerspective ();
+ /**
+ * Open and activate Error Log view if it hadn't been opened before
+ */
+
protected void openErrorLog() {
try {
bot.viewByTitle(WidgetVariables.ERROR_LOG);
@@ -121,6 +169,10 @@
}
}
+ /**
+ * Open and activate Package Explorer view if it hadn't been opened before
+ */
+
protected void openPackageExplorer() {
try {
bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER);
@@ -146,6 +198,10 @@
// }
// }
+ /**
+ * Wait until job manager is currently idle
+ */
+
protected void waitForJobs(){
delay();
while (!Job.getJobManager().isIdle()) {
Modified: workspace/yzhishko/org.jboss.tools.ui.bot.test/src/org/jboss/tools/ui/bot/test/SWTBotMultiPageEditor.java
===================================================================
--- workspace/yzhishko/org.jboss.tools.ui.bot.test/src/org/jboss/tools/ui/bot/test/SWTBotMultiPageEditor.java 2009-08-11 08:07:08 UTC (rev 17041)
+++ workspace/yzhishko/org.jboss.tools.ui.bot.test/src/org/jboss/tools/ui/bot/test/SWTBotMultiPageEditor.java 2009-08-11 08:32:24 UTC (rev 17042)
@@ -6,18 +6,44 @@
import org.hamcrest.SelfDescribing;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+/**
+ * This represents Eclipse MultiPageEditor part
+ * @author yzhishko
+ *
+ */
+
public class SWTBotMultiPageEditor extends SWTBotEditor{
+ /**
+ * Constructs an instance for the given editorReference.
+ * @param editorReference - the part reference.
+ * @param bot - the helper bot.
+ * @param description - the description of the editor part.
+ */
+
public SWTBotMultiPageEditor(IEditorReference editorReference,
SWTWorkbenchBot bot, SelfDescribing description) {
super(editorReference, bot, description);
}
+ /**
+ * Constructs an instance for the given editorReference.
+ * @param editorReference - the editor reference
+ * @param bot - the instance of {@link SWTWorkbenchBot} which will be used to drive operations on behalf of this object.
+ */
+
public SWTBotMultiPageEditor(IEditorReference editorReference,
SWTWorkbenchBot bot) {
super(editorReference, bot);
}
+ /**
+ *
+ * @return <b>null</b> if current MultiPageEditor isn't instance of {@link JSPMultiPageEditor}, <i>else</i> <p>
+ * An object that has {@link JSPMultiPageEditor} reference type
+ * @see JSPMultiPageEditor
+ */
+
public JSPMultiPageEditor getJSPMultiPageEditor(){
if (partReference.getPart(true) instanceof JSPMultiPageEditor) {
return (JSPMultiPageEditor)partReference.getPart(true);
Modified: workspace/yzhishko/org.jboss.tools.ui.bot.test/src/org/jboss/tools/ui/bot/test/SWTJBTBot.java
===================================================================
--- workspace/yzhishko/org.jboss.tools.ui.bot.test/src/org/jboss/tools/ui/bot/test/SWTJBTBot.java 2009-08-11 08:07:08 UTC (rev 17041)
+++ workspace/yzhishko/org.jboss.tools.ui.bot.test/src/org/jboss/tools/ui/bot/test/SWTJBTBot.java 2009-08-11 08:32:24 UTC (rev 17042)
@@ -7,18 +7,43 @@
import org.eclipse.swtbot.eclipse.finder.waits.WaitForEditor;
import org.hamcrest.Matcher;
+/**
+ * SWTWorkbenchBot is a {@link SWTWorkbenchBot} with capabilities for
+ * testing Eclipse workbench item like MultiPageEditor
+ * @author yzhishko
+ *
+ */
+
public class SWTJBTBot extends SWTWorkbenchBot{
+ /**
+ *
+ * @param matcher
+ * @return
+ */
+
public SWTBotMultiPageEditor multiPageEditor(Matcher<?> matcher) {
WaitForEditor waitForEditor = waitForEditor(matcher);
waitUntilWidgetAppears(waitForEditor);
return new SWTBotMultiPageEditor(waitForEditor.get(0), this);
}
+ /**
+ * Get editor by title
+ * @param fileName - the name of editor
+ * @return - object with {@link SWTBotMultiPageEditor} reference type and current name
+ */
+
public SWTBotMultiPageEditor multiPageEditorByTitle (String fileName) {
return multiPageEditor(withPartName(fileName));
}
+ /**
+ * Get editor by id
+ * @param id - id of an editor
+ * @return - object with {@link SWTBotMultiPageEditor} reference type and current id
+ */
+
public SWTBotMultiPageEditor multiPageEditorById(String id){
return multiPageEditor(withPartId(id));
}
Modified: workspace/yzhishko/org.jboss.tools.ui.bot.test/src/org/jboss/tools/ui/bot/test/WidgetVariables.java
===================================================================
--- workspace/yzhishko/org.jboss.tools.ui.bot.test/src/org/jboss/tools/ui/bot/test/WidgetVariables.java 2009-08-11 08:07:08 UTC (rev 17041)
+++ workspace/yzhishko/org.jboss.tools.ui.bot.test/src/org/jboss/tools/ui/bot/test/WidgetVariables.java 2009-08-11 08:32:24 UTC (rev 17042)
@@ -1,5 +1,12 @@
package org.jboss.tools.ui.bot.test;
+/**
+ * Class defines constants with editors', shells', views' names.
+ * @author yzhishko
+ *
+ */
+
+
public class WidgetVariables {
public static final String ERROR_LOG = "Error Log";
Modified: workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java
===================================================================
--- workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java 2009-08-11 08:07:08 UTC (rev 17041)
+++ workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAutoTestCase.java 2009-08-11 08:32:24 UTC (rev 17042)
@@ -30,7 +30,20 @@
protected static Properties projectProperties;
protected static final String TEST_PAGE = "inputUserName.jsp";
public static String PROJECT_PROPERTIES = "projectProperties.properties";
+
+ /**
+ * Variable defines JBoss EAP 4.3 server location on a file system
+ */
+
public static String JBOSS_EAP_HOME;
+
+ /* (non-Javadoc)
+ * This static block read properties from
+ * org.jboss.tools.vpe.ui.bot.test/resources/projectProperties.properties file
+ * and set up parameters for project which you would like to create. You may change a number of parameters
+ * in static block and their values in property file.
+ */
+
static {
try {
InputStream is = Platform.getBundle(Activator.PLUGIN_ID).getResource(PROJECT_PROPERTIES).openStream();
@@ -44,6 +57,11 @@
JBOSS_EAP_HOME = System.getProperty("jbosstools.test.jboss.home",projectProperties.getProperty("JBossEap4.3"));
}
+ /**
+ * @see #clearWorkbench()
+ * @see #createJSFProject(String)
+ */
+
protected void setUp() throws Exception {
super.setUp();
clearWorkbench();
@@ -56,12 +74,23 @@
}
}
+ /**
+ * Tears down the fixture. Verify Error Log. Close all dialogs which may be not closed
+ * after test executing.
+ * @see #clearWorkbench()
+ */
+
@Override
protected void tearDown() throws Exception {
clearWorkbench();
super.tearDown();
}
+ /**
+ * Create JSF Project with <b>jsfProjectName</b>
+ * @param jsfProjectName - name of created project
+ */
+
protected void createJSFProject(String jsfProjectName){
bot.menu("File").menu("New").menu("Other...").click();
SWTBotTree tree = bot.tree();
@@ -103,6 +132,18 @@
waitForJobs();
}
+ /**
+ * Test content of elements from <b>editor</b> by IDs.<p>
+ * Tested elements from source editor should have id's attributes that
+ * correspond to expected one from <b>expectedVPEContentFile</b>.
+ * @param expectedVPEContentFile - file name, for example, <i>"ShowNonVisualTags.xml"</i>
+ * with expected VPE DOM Elements and id's attributes correspond to source <b>editor</b> element
+ * @param editor - {@link JSPMultiPageEditor} that contains source code with tested elements and current id.
+ * @throws Throwable
+ * @see SWTBotMultiPageEditor
+ * @see Throwable
+ */
+
protected void performContentTestByIDs(String expectedVPEContentFile, SWTBotMultiPageEditor editor) throws Throwable{
JSPMultiPageEditor multiPageEditor = editor.getJSPMultiPageEditor();
@@ -202,6 +243,13 @@
}
}
+ /**
+ * Close all dialogs and editors, which may be not closed
+ * after test executing.
+ * @see #isUnuseDialogOpened()
+ * @see #closeUnuseDialogs()
+ */
+
protected void clearWorkbench(){
while (isUnuseDialogOpened()) {
closeUnuseDialogs();
@@ -215,6 +263,14 @@
}
}
+ /**
+ * Test content for elements from all VPE DOM that are nested with <i>BODY</i> descriptor
+ * @param expectedVPEContentFile - file name, for example, <i>"VerificationOfNameSpaces.xml"</i>
+ * with expected VPE DOM Elements that are nested with <i>BODY</i> descriptor
+ * @param editor - {@link JSPMultiPageEditor} that contains source code of currently tested page.
+ * @throws Throwable
+ */
+
protected void performContentTestByDocument(String expectedVPEContentFile, SWTBotMultiPageEditor editor) throws Throwable{
JSPMultiPageEditor multiPageEditor = editor.getJSPMultiPageEditor();
assertNotNull(multiPageEditor);
@@ -238,7 +294,15 @@
TestDomUtil.compareNodes(visualBodyNode, testBodyNode);
}
+ /**
+ * Try to close all unnecessary dialogs, that could prevent next tests fails
+ */
+
protected abstract void closeUnuseDialogs();
+
+ /**
+ * Verify if any dialog that should be closed is opened
+ */
protected abstract boolean isUnuseDialogOpened();
Modified: workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/AlwaysHideSelectionBarWithoutPromptTest.java
===================================================================
--- workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/AlwaysHideSelectionBarWithoutPromptTest.java 2009-08-11 08:07:08 UTC (rev 17041)
+++ workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/AlwaysHideSelectionBarWithoutPromptTest.java 2009-08-11 08:32:24 UTC (rev 17042)
@@ -105,17 +105,14 @@
private void openPage(){
SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
SWTBotTree tree = innerBot.tree();
- try {
- tree.expandNode(projectProperties.getProperty("JSFProjectName"))
- .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick();
- } catch (WidgetNotFoundException e) {
- }
+ tree.expandNode(projectProperties.getProperty("JSFProjectName"))
+ .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick();
}
private void checkIsHide(){
WidgetNotFoundException exception = null;
try {
- bot.toolbarButtonWithTooltip("Hide Selection Bar").click();
+ bot.toolbarButtonWithTooltip("Hide Selection Bar");
} catch (WidgetNotFoundException e) {
exception = e;
}
@@ -123,13 +120,19 @@
}
private void checkIsShow(){
- assertNotNull(bot.toolbarButtonWithTooltip("Hide Selection Bar"));
+ WidgetNotFoundException exception = null;
+ try {
+ bot.toolbarButtonWithTooltip("Hide Selection Bar");
+ } catch (WidgetNotFoundException e) {
+ exception = e;
+ }
+ assertNull(exception);
}
@Override
protected void tearDown() throws Exception {
- //Restore page state before tests
+ //Restore page state after tests
try {
bot.toolbarButtonWithTooltip("Preferences").click();
Modified: workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/BlockCommentTest.java
===================================================================
--- workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/BlockCommentTest.java 2009-08-11 08:07:08 UTC (rev 17041)
+++ workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/BlockCommentTest.java 2009-08-11 08:32:24 UTC (rev 17042)
@@ -5,7 +5,6 @@
import org.eclipse.swt.widgets.Event;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.jboss.tools.ui.bot.test.WidgetVariables;
import org.jboss.tools.vpe.ui.bot.test.VPEAutoTestCase;
@@ -21,11 +20,8 @@
SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
SWTBotTree tree = innerBot.tree();
- try {
- tree.expandNode(projectProperties.getProperty("JSFProjectName"))
- .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick();
- } catch (WidgetNotFoundException e) {
- }
+ tree.expandNode(projectProperties.getProperty("JSFProjectName"))
+ .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick();
editor = bot.editorByTitle(TEST_PAGE).toTextEditor();
textEditor = editor.getText();
Modified: workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/BorderForUnknownTagsTest.java
===================================================================
--- workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/BorderForUnknownTagsTest.java 2009-08-11 08:07:08 UTC (rev 17041)
+++ workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/BorderForUnknownTagsTest.java 2009-08-11 08:32:24 UTC (rev 17042)
@@ -19,11 +19,8 @@
SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
SWTBotTree tree = innerBot.tree();
- try {
- tree.expandNode(projectProperties.getProperty("JSFProjectName"))
- .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick();
- } catch (WidgetNotFoundException e) {
- }
+ tree.expandNode(projectProperties.getProperty("JSFProjectName"))
+ .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick();
editor = bot.editorByTitle(TEST_PAGE).toTextEditor();
textEditor = editor.getText();
@@ -108,7 +105,7 @@
checkBox.click();
}
bot.button("OK").click();
- } catch (Exception e) {
+ } catch (WidgetNotFoundException e) {
}
editor.setFocus();
bot.menu("Edit").menu("Select All").click();
Modified: workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ShowNonVisualTagsTest.java
===================================================================
--- workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ShowNonVisualTagsTest.java 2009-08-11 08:07:08 UTC (rev 17041)
+++ workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ShowNonVisualTagsTest.java 2009-08-11 08:32:24 UTC (rev 17042)
@@ -87,11 +87,8 @@
private void openPage(){
SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
SWTBotTree tree = innerBot.tree();
- try {
- tree.expandNode(projectProperties.getProperty("JSFProjectName"))
- .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick();
- } catch (WidgetNotFoundException e) {
- }
+ tree.expandNode(projectProperties.getProperty("JSFProjectName"))
+ .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick();
}
private void selectShowNonVisual(){
Modified: workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ShowResourceBundlesUsageasELexpressionsTest.java
===================================================================
--- workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ShowResourceBundlesUsageasELexpressionsTest.java 2009-08-11 08:07:08 UTC (rev 17041)
+++ workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ShowResourceBundlesUsageasELexpressionsTest.java 2009-08-11 08:32:24 UTC (rev 17042)
@@ -19,11 +19,8 @@
SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
SWTBotTree tree = innerBot.tree();
- try {
- tree.expandNode(projectProperties.getProperty("JSFProjectName"))
- .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick();
- } catch (WidgetNotFoundException e) {
- }
+ tree.expandNode(projectProperties.getProperty("JSFProjectName"))
+ .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick();
editor = bot.editorByTitle(TEST_PAGE).toTextEditor();
textEditor = editor.getText();
Modified: workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ShowSelectionTagBarTest.java
===================================================================
--- workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ShowSelectionTagBarTest.java 2009-08-11 08:07:08 UTC (rev 17041)
+++ workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ShowSelectionTagBarTest.java 2009-08-11 08:32:24 UTC (rev 17042)
@@ -32,7 +32,6 @@
//Test Hide Selection Bar
selectSelection();
- waitForJobs();
checkIsHide();
//Test Hide selection after reopen
@@ -44,7 +43,6 @@
//Test Show Selection Bar
selectSelection();
- waitForJobs();
checkIsShow();
//Test Show Selection Bar after reopen
@@ -69,7 +67,6 @@
//Test Show Selection Bar from dialog
selectSelection();
- waitForJobs();
checkIsShow();
//Test Show Selection Bar after reopen
@@ -135,17 +132,14 @@
private void openPage(){
SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
SWTBotTree tree = innerBot.tree();
- try {
- tree.expandNode(projectProperties.getProperty("JSFProjectName"))
- .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick();
- } catch (WidgetNotFoundException e) {
- }
+ tree.expandNode(projectProperties.getProperty("JSFProjectName"))
+ .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick();
}
private void checkIsHide(){
WidgetNotFoundException exception = null;
try {
- bot.toolbarButtonWithTooltip("Hide Selection Bar").click();
+ bot.toolbarButtonWithTooltip("Hide Selection Bar");
} catch (WidgetNotFoundException e) {
exception = e;
}
@@ -153,7 +147,13 @@
}
private void checkIsShow(){
- assertNotNull(bot.toolbarButtonWithTooltip("Hide Selection Bar"));
+ WidgetNotFoundException exception = null;
+ try {
+ bot.toolbarButtonWithTooltip("Hide Selection Bar");
+ } catch (WidgetNotFoundException e) {
+ exception = e;
+ }
+ assertNull(exception);
}
}
Modified: workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ToggleCommentTest.java
===================================================================
--- workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ToggleCommentTest.java 2009-08-11 08:07:08 UTC (rev 17041)
+++ workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/ToggleCommentTest.java 2009-08-11 08:32:24 UTC (rev 17042)
@@ -5,7 +5,6 @@
import org.eclipse.swt.widgets.Event;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.jboss.tools.ui.bot.test.WidgetVariables;
import org.jboss.tools.vpe.ui.bot.test.VPEAutoTestCase;
@@ -21,13 +20,9 @@
SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
SWTBotTree tree = innerBot.tree();
- try {
- tree.expandNode(projectProperties.getProperty("JSFProjectName"))
- .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick();
- } catch (WidgetNotFoundException e) {
- }
-
-
+ tree.expandNode(projectProperties.getProperty("JSFProjectName"))
+ .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick();
+
editor = bot.editorByTitle(TEST_PAGE).toTextEditor();
textEditor = editor.getText();
Modified: workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VerificationOfNameSpacesTest.java
===================================================================
--- workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VerificationOfNameSpacesTest.java 2009-08-11 08:07:08 UTC (rev 17041)
+++ workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VerificationOfNameSpacesTest.java 2009-08-11 08:32:24 UTC (rev 17042)
@@ -2,7 +2,6 @@
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.jboss.tools.ui.bot.test.WidgetVariables;
import org.jboss.tools.vpe.ui.bot.test.VPEAutoTestCase;
@@ -24,11 +23,8 @@
SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
SWTBotTree tree = innerBot.tree();
- try {
- tree.expandNode(projectProperties.getProperty("JSFProjectName"))
- .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick();
- } catch (WidgetNotFoundException e) {
- }
+ tree.expandNode(projectProperties.getProperty("JSFProjectName"))
+ .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick();
editor = bot.editorByTitle(TEST_PAGE).toTextEditor();
textEditor = editor.getText();
Modified: workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/jbide/JBIDE4306Test.java
===================================================================
--- workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/jbide/JBIDE4306Test.java 2009-08-11 08:07:08 UTC (rev 17041)
+++ workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/jbide/JBIDE4306Test.java 2009-08-11 08:32:24 UTC (rev 17042)
@@ -14,11 +14,8 @@
SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
SWTBotTree tree = innerBot.tree();
- try {
- tree.expandNode(projectProperties.getProperty("JSFProjectName"))
- .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick();
- } catch (Exception e) {
- }
+ tree.expandNode(projectProperties.getProperty("JSFProjectName"))
+ .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick();
//Test set default source tab
@@ -26,20 +23,17 @@
bot.shell("Preferences (Filtered)").activate();
bot.comboBoxWithLabel("Select the default active editor's tab\nfor files that haven't been previously\nopened in the VPE:").setSelection("Source");
bot.button("OK").click();
- try {
- innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
- tree = innerBot.tree();
- bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).setFocus();
- tree.expandNode(projectProperties.getProperty("JSFProjectName"))
- .expandNode("WebContent").expandNode("pages").getNode("hello.jsp").doubleClick();
- } catch (Exception e) {
- }
+ innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
+ tree = innerBot.tree();
+ bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).setFocus();
+ tree.expandNode(projectProperties.getProperty("JSFProjectName"))
+ .expandNode("WebContent").expandNode("pages").getNode("hello.jsp").doubleClick();
//Check if the tab changed
WidgetNotFoundException exception = null;
try {
- bot.toolbarButtonWithTooltip("Preferences").click();
+ bot.toolbarButtonWithTooltip("Refresh").click();
} catch (WidgetNotFoundException e) {
exception = e;
}
@@ -60,7 +54,7 @@
protected void closeUnuseDialogs() {
try {
bot.shell("Preferences (Filtered)").close();
- } catch (Exception e) {
+ } catch (WidgetNotFoundException e) {
}
}
@@ -70,7 +64,7 @@
try {
bot.shell("Preferences (Filtered)").activate();
isOpened = true;
- } catch (Exception e) {
+ } catch (WidgetNotFoundException e) {
}
return isOpened;
}
Modified: workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/palette/ImportTagsFromTLDFileTest.java
===================================================================
--- workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/palette/ImportTagsFromTLDFileTest.java 2009-08-11 08:07:08 UTC (rev 17041)
+++ workspace/yzhishko/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/palette/ImportTagsFromTLDFileTest.java 2009-08-11 08:32:24 UTC (rev 17042)
@@ -43,7 +43,7 @@
event.type = SWT.KeyUp;
event.character = SWT.DEL;
display.post(event);
- } catch (Exception e) {
+ } catch (WidgetNotFoundException e) {
}
}
@@ -51,7 +51,7 @@
bot.shell("Confirmation").activate();
bot.button("OK").click();
- } catch (Exception e) {
+ } catch (WidgetNotFoundException e) {
}
bot.shell("Palette Editor").activate();
bot.button("OK").click();
16 years, 4 months
JBoss Tools SVN: r17041 - in trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks: configuration/navigator and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-08-11 04:07:08 -0400 (Tue, 11 Aug 2009)
New Revision: 17041
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationResourceConfigPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/navigator/DefaultSetting.htm
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
Log:
JBIDE-4712
DONE
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java 2009-08-10 22:42:05 UTC (rev 17040)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java 2009-08-11 08:07:08 UTC (rev 17041)
@@ -20,6 +20,7 @@
import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.command.MoveCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.command.SetCommand;
@@ -56,6 +57,7 @@
import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
import org.jboss.tools.smooks.configuration.SmooksConstants;
import org.jboss.tools.smooks.configuration.validate.ISmooksModelValidateListener;
+import org.jboss.tools.smooks.editor.AbstractSmooksFormEditor;
import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.editor.ISourceSynchronizeListener;
import org.jboss.tools.smooks.model.common.AbstractAnyType;
@@ -91,6 +93,17 @@
private Button downConditionButton;
private Button conditionPropertiesButton;
private Composite defaultSettingComposite;
+ private Button newProfileButton;
+ private Button removeProfileButton;
+ private Button upProfileButton;
+ private Button downProfileButton;
+ private Button profilePropertiesButton;
+ private TableViewer profileViewer;
+ private ModelPanelCreator defaultSettingPanelCreator;
+ private Section generalSettingSection;
+ private Section globalParamSection;
+ private Section conditionSection;
+ private Section profilesSection;
public SmooksConfigurationOverviewPage(FormEditor editor, String id, String title, ISmooksModelProvider provider) {
super(editor, id, title);
@@ -124,7 +137,7 @@
mgl.marginHeight = 13;
mainComposite.setLayout(mgl);
- Section generalSettingSection = toolkit.createSection(mainComposite, Section.DESCRIPTION | Section.TITLE_BAR);
+ generalSettingSection = toolkit.createSection(mainComposite, Section.DESCRIPTION | Section.TITLE_BAR);
generalSettingSection.setLayout(new FillLayout());
generalSettingSection.setText("Default Setting");
defaultSettingComposite = toolkit.createComposite(generalSettingSection);
@@ -142,7 +155,8 @@
createSmooksEditorNavigator(mainComposite, toolkit);
- Section globalParamSection = toolkit.createSection(mainComposite, Section.DESCRIPTION | Section.TITLE_BAR);
+ globalParamSection = toolkit.createSection(mainComposite, Section.DESCRIPTION | Section.TITLE_BAR
+ | Section.TWISTIE | Section.EXPANDED);
globalParamSection.setText("Global Paramters");
globalParamSection.setLayout(new FillLayout());
Composite globalParamComposite = toolkit.createComposite(globalParamSection);
@@ -158,7 +172,7 @@
createGlobalParamterSection(globalParamComposite, toolkit);
- Section conditionSection = toolkit.createSection(mainComposite, Section.DESCRIPTION | Section.TITLE_BAR
+ conditionSection = toolkit.createSection(mainComposite, Section.DESCRIPTION | Section.TITLE_BAR
| Section.TWISTIE);
conditionSection.setText("Conditions");
conditionSection.setLayout(new FillLayout());
@@ -175,8 +189,347 @@
createConditionsSection(conditionComposite, toolkit);
+ profilesSection = toolkit.createSection(mainComposite, Section.DESCRIPTION | Section.TITLE_BAR
+ | Section.TWISTIE);
+ profilesSection.setText("Profiles");
+ profilesSection.setLayout(new FillLayout());
+ Composite profilesComposite = toolkit.createComposite(profilesSection);
+ profilesSection.setClient(profilesComposite);
+ gd = new GridData();
+ gd.verticalAlignment = GridData.BEGINNING;
+ gd.widthHint = 500;
+ profilesSection.setLayoutData(gd);
+
+ GridLayout pgl = new GridLayout();
+ profilesComposite.setLayout(pgl);
+ pgl.numColumns = 2;
+
+ createProfilesSection(profilesComposite, toolkit);
+
}
+ protected void createProfilesSection(Composite profilesComposite, FormToolkit toolkit) {
+ if (smooksModelProvider != null) {
+ AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain) smooksModelProvider
+ .getEditingDomain();
+ EObject profiles = getProfilesType();
+ // if (m == null)
+ // return;
+
+ profileViewer = new TableViewer(profilesComposite);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ profileViewer.getControl().setLayoutData(gd);
+ toolkit.paintBordersFor(profilesComposite);
+ Composite buttonArea = toolkit.createComposite(profilesComposite);
+ gd = new GridData(GridData.FILL_VERTICAL);
+ gd.widthHint = 30;
+ GridLayout bgl = new GridLayout();
+ buttonArea.setLayout(bgl);
+
+ newProfileButton = toolkit.createButton(buttonArea, "New", SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ newProfileButton.setLayoutData(gd);
+
+ removeProfileButton = toolkit.createButton(buttonArea, "Remove", SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ removeProfileButton.setLayoutData(gd);
+
+ upProfileButton = toolkit.createButton(buttonArea, "Up", SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ upProfileButton.setLayoutData(gd);
+
+ downProfileButton = toolkit.createButton(buttonArea, "Down", SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ downProfileButton.setLayoutData(gd);
+
+ profilePropertiesButton = toolkit.createButton(buttonArea, "Properties..", SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ profilePropertiesButton.setLayoutData(gd);
+
+ profileViewer.setContentProvider(new AdapterFactoryContentProvider(editingDomain.getAdapterFactory()) {
+
+ @Override
+ public boolean hasChildren(Object object) {
+ return false;
+ }
+
+ });
+
+ profileViewer.setLabelProvider(new DecoratingLabelProvider(new AdapterFactoryLabelProvider(editingDomain
+ .getAdapterFactory()) {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider
+ * # getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object object) {
+ Object obj = AdapterFactoryEditingDomain.unwrap(object);
+ if (obj instanceof AbstractAnyType) {
+ return super.getText(obj);
+ }
+ return super.getText(object);
+ }
+
+ }, SmooksConfigurationActivator.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator()));
+
+ if (profiles != null) {
+ profileViewer.setInput(profiles);
+ }
+
+ profileViewer.addDoubleClickListener(new IDoubleClickListener() {
+
+ public void doubleClick(DoubleClickEvent event) {
+ openProfilePropertiesModifyDialog();
+ }
+ });
+
+ profileViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateProfilesButtons();
+ }
+ });
+
+ hookProfilesButtons();
+ updateProfilesButtons();
+ }
+ }
+
+ protected void openProfilePropertiesModifyDialog() {
+ IStructuredSelection selection = (IStructuredSelection) profileViewer.getSelection();
+ if (selection == null)
+ return;
+ Object obj = selection.getFirstElement();
+ if (obj instanceof EObject) {
+ EObject profile = (EObject) obj;
+ EObject parent = getProfilesType();
+ EStructuralFeature profileFeature = null;
+ if (SmooksConstants.VERSION_1_0.equals(getSmooksVersion())) {
+ profileFeature = org.jboss.tools.smooks10.model.smooks.SmooksPackage.Literals.PROFILES_TYPE__PROFILE;
+ }
+ if (SmooksConstants.VERSION_1_1.equals(getSmooksVersion())) {
+ profileFeature = SmooksPackage.Literals.PROFILES_TYPE__PROFILE;
+ }
+
+ NewOrModifySmooksElementDialog dialog = new NewOrModifySmooksElementDialog(getEditorSite().getShell(),
+ profileFeature, profile, parent, getManagedForm().getToolkit(), smooksModelProvider,
+ SmooksConfigurationOverviewPage.this, true);
+ dialog.open();
+ }
+ }
+
+ protected void updateProfilesButtons() {
+ if (getSmooksVersion() == null) {
+ profilePropertiesButton.setEnabled(false);
+ newProfileButton.setEnabled(false);
+ removeProfileButton.setEnabled(false);
+ upProfileButton.setEnabled(false);
+ downProfileButton.setEnabled(false);
+ return;
+ }
+ profilePropertiesButton.setEnabled(true);
+ removeProfileButton.setEnabled(true);
+ IStructuredSelection selection = (IStructuredSelection) profileViewer.getSelection();
+ if (selection == null) {
+ profilePropertiesButton.setEnabled(false);
+ removeProfileButton.setEnabled(false);
+ upProfileButton.setEnabled(false);
+ downProfileButton.setEnabled(false);
+ } else {
+ if (selection.getFirstElement() == null) {
+ profilePropertiesButton.setEnabled(false);
+ removeProfileButton.setEnabled(false);
+ upProfileButton.setEnabled(false);
+ downProfileButton.setEnabled(false);
+ return;
+ }
+
+ Object obj = selection.getFirstElement();
+ if (obj instanceof EObject) {
+ EObject profilesType = getProfilesType();
+ if (profilesType == null)
+ return;
+ EObject v = (EObject) AdapterFactoryEditingDomain.unwrap(obj);
+ EObject parent = v.eContainer();
+ int index = parent.eContents().indexOf(v);
+ Command command = MoveCommand.create(smooksModelProvider.getEditingDomain(), parent, null, obj,
+ index - 1);
+ upProfileButton.setEnabled(command.canExecute());
+
+ Command command1 = MoveCommand.create(smooksModelProvider.getEditingDomain(), parent, null, obj,
+ index + 1);
+ downProfileButton.setEnabled(command1.canExecute());
+ }
+
+ if (selection.size() > 1) {
+ profilePropertiesButton.setEnabled(false);
+ removeProfileButton.setEnabled(false);
+ }
+ }
+
+ }
+
+ protected void hookProfilesButtons() {
+ newProfileButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (getSmooksVersion() == null) {
+ return;
+ }
+ EObject model = null;
+ if (SmooksConstants.VERSION_1_0.equals(getSmooksVersion())) {
+ model = org.jboss.tools.smooks10.model.smooks.SmooksFactory.eINSTANCE.createProfileType();
+ }
+ if (SmooksConstants.VERSION_1_1.equals(getSmooksVersion())) {
+ model = SmooksFactory.eINSTANCE.createProfileType();
+ }
+ EObject parent = getProfilesType();
+ boolean newParent = false;
+ if (parent == null) {
+ newParent = true;
+ if (SmooksConstants.VERSION_1_0.equals(getSmooksVersion())) {
+ parent = org.jboss.tools.smooks10.model.smooks.SmooksFactory.eINSTANCE.createProfilesType();
+ }
+ if (SmooksConstants.VERSION_1_1.equals(getSmooksVersion())) {
+ parent = SmooksFactory.eINSTANCE.createProfilesType();
+ }
+ }
+ EStructuralFeature profileFeature = null;
+ if (SmooksConstants.VERSION_1_0.equals(getSmooksVersion())) {
+ profileFeature = org.jboss.tools.smooks10.model.smooks.SmooksPackage.Literals.PROFILES_TYPE__PROFILE;
+ }
+ if (SmooksConstants.VERSION_1_1.equals(getSmooksVersion())) {
+ profileFeature = SmooksPackage.Literals.PROFILES_TYPE__PROFILE;
+ }
+ NewOrModifySmooksElementDialog dialog = new NewOrModifySmooksElementDialog(getEditorSite().getShell(),
+ profileFeature, model, parent, getManagedForm().getToolkit(), smooksModelProvider,
+ SmooksConfigurationOverviewPage.this, false);
+
+ EStructuralFeature profilesFeature = null;
+ if (SmooksConstants.VERSION_1_0.equals(getSmooksVersion())) {
+ profilesFeature = org.jboss.tools.smooks10.model.smooks.SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__PROFILES;
+ }
+ if (SmooksConstants.VERSION_1_1.equals(getSmooksVersion())) {
+ profilesFeature = SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__PROFILES;
+ }
+ if (dialog.open() == Dialog.OK && newParent) {
+ EObject resource = getSmooksResourceList();
+ if (resource == null)
+ return;
+ Command command = SetCommand.create(smooksModelProvider.getEditingDomain(), resource,
+ profilesFeature, parent);
+ if (command.canExecute()) {
+ smooksModelProvider.getEditingDomain().getCommandStack().execute(command);
+ profileViewer.setInput(parent);
+ }
+ }
+ super.widgetSelected(e);
+ }
+
+ });
+ removeProfileButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection) profileViewer.getSelection();
+ if (selection == null)
+ return;
+ Object obj = selection.getFirstElement();
+ if (obj instanceof EObject) {
+ EObject profile = (EObject) obj;
+ EObject parent = getProfilesType();
+ if (parent == null)
+ return;
+ CompoundCommand compoundCommand = new CompoundCommand();
+ Command command = RemoveCommand.create(smooksModelProvider.getEditingDomain(), profile);
+ compoundCommand.append(command);
+ if (parent.eContents().size() == 1) {
+ // remove parent;
+ Command command1 = RemoveCommand.create(smooksModelProvider.getEditingDomain(), parent);
+ compoundCommand.append(command1);
+ }
+ smooksModelProvider.getEditingDomain().getCommandStack().execute(compoundCommand);
+ }
+ }
+
+ });
+ upProfileButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection) profileViewer.getSelection();
+ if (selection == null)
+ return;
+ Object obj = selection.getFirstElement();
+ if (obj instanceof EObject) {
+ EObject profilesType = getProfilesType();
+ if (profilesType == null)
+ return;
+ EObject v = (EObject) AdapterFactoryEditingDomain.unwrap(obj);
+ EObject parent = v.eContainer();
+ int index = parent.eContents().indexOf(v);
+ Command command = MoveCommand.create(smooksModelProvider.getEditingDomain(), parent, null, obj,
+ index - 1);
+ smooksModelProvider.getEditingDomain().getCommandStack().execute(command);
+ }
+ }
+
+ });
+ downProfileButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection) profileViewer.getSelection();
+ if (selection == null)
+ return;
+ Object obj = selection.getFirstElement();
+ if (obj instanceof EObject) {
+ EObject profilesType = getProfilesType();
+ if (profilesType == null)
+ return;
+ EObject v = (EObject) AdapterFactoryEditingDomain.unwrap(obj);
+ EObject parent = v.eContainer();
+ int index = parent.eContents().indexOf(v);
+ Command command = MoveCommand.create(smooksModelProvider.getEditingDomain(), parent, null, obj,
+ index + 1);
+ smooksModelProvider.getEditingDomain().getCommandStack().execute(command);
+ }
+ }
+
+ });
+ profilePropertiesButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ openProfilePropertiesModifyDialog();
+ super.widgetSelected(e);
+ }
+
+ });
+
+ }
+
+ private EObject getProfilesType() {
+ if (smooksModelProvider != null) {
+ EObject smooksModel = smooksModelProvider.getSmooksModel();
+ if (smooksModel instanceof DocumentRoot) {
+ EObject m = ((DocumentRoot) smooksModel).getSmooksResourceList().getProfiles();
+ return m;
+ }
+ if (smooksModel instanceof org.jboss.tools.smooks10.model.smooks.DocumentRoot) {
+ EObject m = ((org.jboss.tools.smooks10.model.smooks.DocumentRoot) smooksModel).getSmooksResourceList()
+ .getProfiles();
+ return m;
+ }
+ }
+ return null;
+ }
+
private ConditionsType getConditionsType() {
if (smooksModelProvider != null) {
EObject smooksModel = smooksModelProvider.getSmooksModel();
@@ -762,7 +1115,7 @@
private void createSmooksEditorNavigator(Composite mainComposite, FormToolkit toolkit) {
Composite mainNavigatorComposite = toolkit.createComposite(mainComposite);
GridData gd = new GridData(GridData.FILL_BOTH);
- gd.verticalSpan = 3;
+ gd.verticalSpan = 4;
mainNavigatorComposite.setLayoutData(gd);
GridLayout gl = new GridLayout();
@@ -821,7 +1174,8 @@
formText.addHyperlinkListener(new HyperlinkAdapter() {
public void linkActivated(HyperlinkEvent e) {
Object href = e.getHref();
- if(href == null) return;
+ if (href == null)
+ return;
activeNavigatorLink(href.toString());
}
});
@@ -829,12 +1183,43 @@
gd = new GridData(GridData.FILL_BOTH);
formText.setLayoutData(gd);
}
-
- protected void activeNavigatorLink(String href){
- if(href == null)return;
- if(href.equals("reader_page")){
- this.getEditor().setActivePage("Reader");
+
+ protected void activeNavigatorLink(String href) {
+ if (href == null)
+ return;
+ if (href.equals("reader_page")) {
+ this.getEditor().setActivePage("reader_page");
}
+ if (href.equals("message_filter_page")) {
+ this.getEditor().setActivePage("message_filter_page");
+ }
+ if (href.equals("source_page")) {
+ this.getEditor().setActiveEditor(((AbstractSmooksFormEditor)getEditor()).getTextEditor());
+ }
+ if (href.equals("overview_default_setting")) {
+ generalSettingSection.setFocus();
+ }
+ if (href.equals("overview_global_param")) {
+ globalParamSection.setFocus();
+ globalParamSection.setExpanded(true);
+ }
+ if (href.equals("overview_condition")) {
+ conditionSection.setFocus();
+ conditionSection.setExpanded(true);
+ }
+ if (href.equals("overview_profile")) {
+ profilesSection.setFocus();
+ profilesSection.setExpanded(true);
+ }
+ if (href.equals("selector_dialog")) {
+ SelectoreSelectionDialog dialog = new SelectoreSelectionDialog(getEditorSite().getShell(),
+ this.smooksModelProvider.getSmooksGraphicsExt(), this.getEditor());
+ try {
+ dialog.open();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
}
private EObject getSmooksResourceList() {
@@ -853,28 +1238,36 @@
}
private void createDefaultSection(Composite parent, FormToolkit toolkit) {
- ModelPanelCreator creator = new ModelPanelCreator();
+ ModelPanelCreator defaultSettingPanelCreator = getDefaultSettingPanelCreator();
EObject model = getSmooksResourceList();
AdapterFactoryEditingDomain editingDomain = (AdapterFactoryEditingDomain) smooksModelProvider
.getEditingDomain();
IItemPropertySource itemPropertySource = (IItemPropertySource) editingDomain.getAdapterFactory().adapt(model,
IItemPropertySource.class);
if (model != null) {
- creator.createModelPanel(model, toolkit, parent, itemPropertySource, smooksModelProvider, getEditor());
+ defaultSettingPanelCreator.createModelPanel(model, toolkit, parent, itemPropertySource,
+ smooksModelProvider, getEditor());
}
}
+ public ModelPanelCreator getDefaultSettingPanelCreator() {
+ if (defaultSettingPanelCreator == null) {
+ defaultSettingPanelCreator = new ModelPanelCreator();
+ }
+ return defaultSettingPanelCreator;
+ }
+
public void saveComplete(SmooksGraphicsExtType extType) {
}
public void validateEnd(List<Diagnostic> diagnosticResult) {
-
+ ModelPanelCreator creator = getDefaultSettingPanelCreator();
+ creator.markPropertyUI(diagnosticResult, getSmooksResourceList());
}
public void validateStart() {
-
}
public void sourceChange(Object model) {
@@ -884,6 +1277,7 @@
paramViewer.setInput(getParamsType());
conditionViewer.setInput(getConditionsType());
+ profileViewer.setInput(getProfilesType());
}
protected void disposeCompositeControls(Composite composite, Control[] ignoreControl) {
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationResourceConfigPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationResourceConfigPage.java 2009-08-10 22:42:05 UTC (rev 17040)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationResourceConfigPage.java 2009-08-11 08:07:08 UTC (rev 17041)
@@ -18,6 +18,7 @@
import org.jboss.tools.smooks.model.smooks.AbstractReader;
import org.jboss.tools.smooks.model.smooks.ConditionsType;
import org.jboss.tools.smooks.model.smooks.ParamsType;
+import org.jboss.tools.smooks.model.smooks.ProfilesType;
/**
* @author Dart
@@ -50,6 +51,12 @@
if(obj instanceof AbstractReader){
return false;
}
+ if(obj instanceof ProfilesType){
+ return false;
+ }
+ if(obj instanceof org.jboss.tools.smooks10.model.smooks.ProfilesType){
+ return false;
+ }
return true;
}
};
@@ -84,7 +91,7 @@
// title = "Smooks 1.0 - " + title;
// }
// }
- form.setText("Desgin");
+ form.setText("Message Filter");
}
@Override
@@ -104,6 +111,6 @@
@Override
protected String getMainSectionTitle() {
- return super.getMainSectionTitle();
+ return "Message Filtering Resources";
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java 2009-08-10 22:42:05 UTC (rev 17040)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java 2009-08-11 08:07:08 UTC (rev 17041)
@@ -77,7 +77,7 @@
addSourceSynchronizeListener(configurationPage);
try {
int index = this.addPage(configurationPage);
- setPageText(index, "Design");
+ setPageText(index, "Message Filter");
} catch (PartInitException e) {
e.printStackTrace();
}
@@ -94,11 +94,11 @@
}
private SmooksConfigurationReaderPage createSmooksConfigurationReaderPage() {
- return new SmooksConfigurationReaderPage(this, "Reader", "Reader Page");
+ return new SmooksConfigurationReaderPage(this, "reader_page", "Reader Page");
}
private SmooksConfigurationOverviewPage createSmooksConfigurationOverviewPage() {
- return new SmooksConfigurationOverviewPage(this, "Overview", "Overview", this);
+ return new SmooksConfigurationOverviewPage(this, "overview_page", "Overview", this);
}
@Override
@@ -117,7 +117,7 @@
}
protected SmooksConfigurationFormPage createSmooksConfigurationFormPage() {
- return new SmooksConfigurationResourceConfigPage(this, "DesignPage", "Design Page");
+ return new SmooksConfigurationResourceConfigPage(this, "message_filter_page", "Design Page");
}
/*
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/navigator/DefaultSetting.htm
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/navigator/DefaultSetting.htm 2009-08-10 22:42:05 UTC (rev 17040)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/navigator/DefaultSetting.htm 2009-08-11 08:07:08 UTC (rev 17041)
@@ -2,10 +2,17 @@
<p>On the 'Overview' page , user can define the <a
href="overview_default_setting">default setting</a> , edit the <a
href="overview_global_param">global paramters</a> and define the <a
- href="overview_condition">condition</a>.</p>
-<p>User can edit the 'reader' of Smooks in the <a href="reader_page">Reader</a>
+ href="overview_condition">condition</a>,<br/> <a
+ href="overview_profile">profile</a>.</p>
+<p><a href="reader_page">Reader</a> : User can edit the 'Reader' of Smooks in this
page. Reader page can also add/remove <a href="reader_input_data">input
message</a>. <br/>
Smooks tools generate the 'selector' via the input data and smooks reader , open the <a href="selector_dialog">SelectorDialog</a>,
User can<br/> select the element node to generate 'selector' for it.</p>
+<p>
+<a href="message_filter_page">Message Filter</a> :
+</p>
+<p>
+<a href="source_page">Source</a> : User can also edit the configuration file directly via source page.
+</p>
</form>
\ No newline at end of file
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2009-08-10 22:42:05 UTC (rev 17040)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2009-08-11 08:07:08 UTC (rev 17041)
@@ -159,6 +159,10 @@
});
}
+ public StructuredTextEditor getTextEditor() {
+ return textEditor;
+ }
+
protected void handleEMFModelChange() {
IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
16 years, 4 months
JBoss Tools SVN: r17040 - in trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui: src/main/org/jboss/ide/eclipse/archives/ui and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-08-10 18:42:05 -0400 (Mon, 10 Aug 2009)
New Revision: 17040
Added:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/BuildCommand.java
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties
Log:
JBIDE-2452 - build project archvies has a shortcut now
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml 2009-08-10 21:24:39 UTC (rev 17039)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/plugin.xml 2009-08-10 22:42:05 UTC (rev 17040)
@@ -222,5 +222,28 @@
</enablement>
</actionProvider>
</extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.jboss.ide.eclipse.archives.ui.commands.projects"
+ defaultHandler="org.jboss.ide.eclipse.archives.ui.actions.BuildCommand"
+ description="This will build the project archives for the selected project"
+ id="org.jboss.ide.eclipse.archives.ui.buildArchiveCommand"
+ name="Build Project Archives">
+ </command>
+ <category
+ description="Commands related to projects"
+ id="org.jboss.ide.eclipse.archives.ui.commands.projects"
+ name="Projects">
+ </category>
+ </extension>
+ <extension
+ point="org.eclipse.ui.bindings">
+ <key
+ sequence=""
+ contextId=""
+ commandId="org.jboss.ide.eclipse.archives.ui.buildArchiveCommand"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
+ </extension>
</plugin>
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.java 2009-08-10 21:24:39 UTC (rev 17039)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.java 2009-08-10 22:42:05 UTC (rev 17040)
@@ -17,6 +17,7 @@
public static String BuildError2;
public static String DoNotShowThisAgain;
public static String BuildArchivesNode;
+ public static String BuildProjectArchives;
public static String SelectAProject;
public static String ProjectArchives;
public static String Loading;
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties 2009-08-10 21:24:39 UTC (rev 17039)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/ArchivesUIMessages.properties 2009-08-10 22:42:05 UTC (rev 17040)
@@ -2,6 +2,7 @@
BuildError2=Error building project archives node {0}
DoNotShowThisAgain=Do not show this message again.
BuildArchivesNode=Build Archive Node
+BuildProjectArchives=Build Project Archives
SelectAProject=Please select a project
ProjectArchives=Project Archives
Loading=Loading...
Added: trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/BuildCommand.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/BuildCommand.java (rev 0)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/actions/BuildCommand.java 2009-08-10 22:42:05 UTC (rev 17040)
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.archives.ui.actions;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.variables.IStringVariableManager;
+import org.eclipse.core.variables.VariablesPlugin;
+import org.jboss.ide.eclipse.archives.core.build.ArchiveBuildDelegate;
+import org.jboss.ide.eclipse.archives.ui.ArchivesUIMessages;
+
+public class BuildCommand extends AbstractHandler implements IHandler {
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
+ String val;
+ try {
+ val = manager.getDynamicVariable("project_name").getValue(null); //$NON-NLS-1$
+ if( val != null ) {
+ final IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(val);
+ if( p.exists() && p.isOpen() ) {
+ Job j = new Job(ArchivesUIMessages.BuildArchivesNode) {
+ protected IStatus run(IProgressMonitor monitor) {
+ return new ArchiveBuildDelegate().fullProjectBuild(p.getLocation(), monitor);
+ }
+ };
+ j.schedule();
+ }
+ }
+ } catch (CoreException e) {
+ }
+ return null;
+ }
+}
16 years, 4 months