JBoss Tools SVN: r33354 - trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2011-07-29 11:06:38 -0400 (Fri, 29 Jul 2011)
New Revision: 33354
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el/ELExprPartitionerTest.java
Log:
JBIDE-9422
org.jboss.tools.seam.ui.test JUnit Test failure
Disabling natures check (trying to fix seam-ui tests hang up)
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el/ELExprPartitionerTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el/ELExprPartitionerTest.java 2011-07-29 14:36:17 UTC (rev 33353)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/el/ELExprPartitionerTest.java 2011-07-29 15:06:38 UTC (rev 33354)
@@ -17,6 +17,7 @@
import junit.framework.TestSuite;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.QualifiedName;
import org.jboss.tools.jst.text.ext.hyperlink.ELHyperlink;
import org.jboss.tools.jst.text.ext.hyperlink.ELHyperlinkDetector;
import org.jboss.tools.jst.text.ext.test.HyperlinkTestUtil;
@@ -34,21 +35,34 @@
public static Test suite() {
return new TestSuite(ELExprPartitionerTest.class);
}
-
+ private boolean isKbNatureCheckNeed = false;
+ public static final QualifiedName IS_KB_NATURES_CHECK_NEED = new QualifiedName(
+ "", "Is KB natures check"); //$NON-NLS-1$
+
public void setUp() throws Exception {
+ System.out.println(">>>> ELExprPartitionerTest >>>>");
provider = new TestProjectProvider("org.jboss.tools.seam.ui.test", "projects/" + PROJECT_NAME, PROJECT_NAME, makeCopy);
project = provider.getProject();
Throwable exception = null;
assertNull("An exception caught: " + (exception != null? exception.getMessage() : ""), exception);
-
-
+ isKbNatureCheckNeed = Boolean.valueOf(project.getPersistentProperty(IS_KB_NATURES_CHECK_NEED));
+ System.out.println("Is KB natures check: " + isKbNatureCheckNeed);
+ project.setPersistentProperty(IS_KB_NATURES_CHECK_NEED, //$NON-NLS-1$
+ Boolean.toString(false));
+ System.out.println("Is KB natures check: " + Boolean.valueOf(project.getPersistentProperty(IS_KB_NATURES_CHECK_NEED)));
}
protected void tearDown() throws Exception {
+ if (project != null) {
+ project.setPersistentProperty(IS_KB_NATURES_CHECK_NEED, //$NON-NLS-1$
+ Boolean.toString(isKbNatureCheckNeed));
+ System.out.println("Is KB natures check: " + Boolean.valueOf(project.getPersistentProperty(IS_KB_NATURES_CHECK_NEED)));
+ }
if(provider != null) {
provider.dispose();
}
+ System.out.println("<<<< ELExprPartitionerTest <<<<");
}
public void testELExprPartitioner() throws Exception{
13 years, 5 months
JBoss Tools SVN: r33353 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext.
by jbosstools-commits@lists.jboss.org
Author: psrna
Date: 2011-07-29 10:36:17 -0400 (Fri, 29 Jul 2011)
New Revision: 33353
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/pom.xml
Log:
added junit dependency
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/pom.xml
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/pom.xml 2011-07-29 14:08:40 UTC (rev 33352)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/pom.xml 2011-07-29 14:36:17 UTC (rev 33353)
@@ -8,6 +8,12 @@
</parent>
<groupId>org.jboss.tools.tests.plugins</groupId>
<artifactId>org.jboss.tools.ui.bot.ext</artifactId>
-
<packaging>eclipse-plugin</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.2</version>
+ </dependency>
+ </dependencies>
</project>
13 years, 5 months
JBoss Tools SVN: r33352 - trunk/cdi/tests/org.jboss.tools.cdi.bot.test.
by jbosstools-commits@lists.jboss.org
Author: jlukas(a)redhat.com
Date: 2011-07-29 10:08:40 -0400 (Fri, 29 Jul 2011)
New Revision: 33352
Added:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/todo.txt
Log:
todos
Added: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/todo.txt
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/todo.txt (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/todo.txt 2011-07-29 14:08:40 UTC (rev 33352)
@@ -0,0 +1,18 @@
+UI tests to implement for CDI (based on F2F meeting)
+
+hyperlinks (...open ons etc)
+quickfixes
+completion
+uieditor for seam-config
+.
+.
+(cdi model from can be obtained from tests, check them).
+.
+.
+
+.
+.
+.
+.
+.
+validation
\ No newline at end of file
13 years, 5 months
JBoss Tools SVN: r33351 - trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/META-INF.
by jbosstools-commits@lists.jboss.org
Author: jlukas(a)redhat.com
Date: 2011-07-29 08:42:57 -0400 (Fri, 29 Jul 2011)
New Revision: 33351
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/META-INF/MANIFEST.MF
Log:
export eap related tests
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/META-INF/MANIFEST.MF 2011-07-29 12:18:04 UTC (rev 33350)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/META-INF/MANIFEST.MF 2011-07-29 12:42:57 UTC (rev 33351)
@@ -34,4 +34,5 @@
org.eclipse.core.resources,
org.jboss.tools.ui.bot.ext,
org.osgi.framework,
- org.jboss.tools.ws.ui.bot.test.uiutils.wizards"
+ org.jboss.tools.ws.ui.bot.test.uiutils.wizards",
+ org.jboss.tools.ws.ui.bot.test.eap
13 years, 5 months
JBoss Tools SVN: r33350 - in trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test: smoke and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2011-07-29 08:18:04 -0400 (Fri, 29 Jul 2011)
New Revision: 33350
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/MarkersTest.java
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java
Log:
Added test for Markers
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java 2011-07-29 10:23:27 UTC (rev 33349)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java 2011-07-29 12:18:04 UTC (rev 33350)
@@ -78,6 +78,7 @@
import org.jboss.tools.vpe.ui.bot.test.smoke.CodeCompletionTest;
import org.jboss.tools.vpe.ui.bot.test.smoke.EditorSynchronizationTest;
import org.jboss.tools.vpe.ui.bot.test.smoke.JSPPageCreationTest;
+import org.jboss.tools.vpe.ui.bot.test.smoke.MarkersTest;
import org.jboss.tools.vpe.ui.bot.test.smoke.OpenOnTest;
import org.jboss.tools.vpe.ui.bot.test.smoke.RenameFacesConfigFileTest;
import org.jboss.tools.vpe.ui.bot.test.smoke.RenameJSPFileTest;
@@ -174,6 +175,7 @@
suite.addTestSuite(LogTagTest.class);
suite.addTestSuite(OpenOnTest.class);
suite.addTestSuite(XhtmlFilePerformanceTest.class);
+ suite.addTestSuite(MarkersTest.class);
return new TestSetup(suite);
}
}
Added: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/MarkersTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/MarkersTest.java (rev 0)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/MarkersTest.java 2011-07-29 12:18:04 UTC (rev 33350)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2011 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.ui.bot.test.smoke;
+
+import org.jboss.tools.ui.bot.ext.SWTJBTExt;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ui.bot.ext.helper.MarkerHelper;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
+import org.jboss.tools.vpe.ui.bot.test.VPEAutoTestCase;
+import org.jboss.tools.vpe.ui.bot.test.editor.VPEEditorTestCase;
+/**
+ * Test Markers position and attributes regarding to VPE components within jsp page
+ * @author Vladimir Pakan
+ *
+ */
+public class MarkersTest extends VPEEditorTestCase{
+ private SWTBotEditorExt editor;
+ private String originalEditorText;
+ /**
+ * Test open on functionality of JSF components within jsp page
+ */
+ public void testMarkers(){
+ MarkerHelper markerHelper = new MarkerHelper(TEST_PAGE,
+ VPEAutoTestCase.JBT_TEST_PROJECT_NAME,"WebContent","pages");
+ String textToSelect = "<%@ taglib";
+ String insertText = "yyaddedxx";
+ int[] expectedMarkerLines = new int[4];
+ String[] expectedMarkerDesc = new String[4];
+ SWTJBTExt.selectTextInSourcePane(SWTTestExt.bot,
+ TEST_PAGE,
+ textToSelect,
+ textToSelect.length(),
+ 0,
+ 0);
+ editor.insertText(insertText);
+ expectedMarkerLines[0] = editor.cursorPosition().line;
+ expectedMarkerDesc[0] = "^Unknown tag \\(jsp:directive\\.taglib" + insertText + "\\).*";
+ textToSelect = "<%@ taglib uri=\"http://java.sun.com/jsf/html";
+ SWTJBTExt.selectTextInSourcePane(SWTTestExt.bot,
+ TEST_PAGE,
+ textToSelect,
+ textToSelect.length(),
+ 0,
+ 0);
+ editor.insertText(insertText);
+ expectedMarkerLines[1] = editor.cursorPosition().line;
+ expectedMarkerDesc[1] = "^Can not find the tag library descriptor for \"http://java.sun.com/jsf/html" +
+ insertText +".*";
+ textToSelect = "<h1";
+ SWTJBTExt.selectTextInSourcePane(SWTTestExt.bot,
+ TEST_PAGE,
+ textToSelect,
+ textToSelect.length(),
+ 0,
+ 0);
+ editor.insertText(insertText);
+ expectedMarkerLines[2] = editor.cursorPosition().line;
+ expectedMarkerDesc[2] = "^Unknown tag \\(h1" + insertText + "\\).*";
+ textToSelect = "</h:inputText";
+ SWTJBTExt.selectTextInSourcePane(SWTTestExt.bot,
+ TEST_PAGE,
+ textToSelect,
+ textToSelect.length(),
+ 0,
+ 0);
+ editor.insertText(insertText);
+ expectedMarkerLines[3] = editor.cursorPosition().line;
+ expectedMarkerDesc[3] = "^Missing start tag for \"h:inputText" + insertText + ".*";
+ editor.save();
+ bot.sleep(Timing.time2S());
+ // Check markers
+ for (int index = 0 ; index < expectedMarkerLines.length ; index++){
+ markerHelper.checkForMarker(String.valueOf(expectedMarkerLines[index] + 1),
+ expectedMarkerDesc[index]);
+ }
+ }
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ openPage(TEST_PAGE);
+ editor = SWTTestExt.bot.swtBotEditorExtByTitle(TEST_PAGE);
+ originalEditorText = editor.getText();
+ }
+ @Override
+ protected void tearDown() throws Exception {
+ if (editor != null){
+ editor.setText(originalEditorText);
+ editor.saveAndClose();
+ }
+ super.tearDown();
+ }
+}
\ No newline at end of file
Property changes on: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/smoke/MarkersTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 5 months
JBoss Tools SVN: r33349 - in trunk/as/plugins/org.jboss.ide.eclipse.as.core: jbosscore/org/jboss/ide/eclipse/as/core and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-07-29 06:23:27 -0400 (Fri, 29 Jul 2011)
New Revision: 33349
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/.options
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Trace.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/JBossServerCorePlugin.java
Log:
JBIDE-9425
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/.options
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/.options (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/.options 2011-07-29 10:23:27 UTC (rev 33349)
@@ -0,0 +1,30 @@
+# Debugging options for the org.jboss.ide.eclipse.as.core plugin
+
+# Turn on general debugging
+org.jboss.ide.eclipse.as.core/debug=true
+
+# Tracing options
+org.jboss.ide.eclipse.as.core/config=false
+org.jboss.ide.eclipse.as.core/info=false
+org.jboss.ide.eclipse.as.core/warning=false
+org.jboss.ide.eclipse.as.core/severe=false
+org.jboss.ide.eclipse.as.core/finest=false
+org.jboss.ide.eclipse.as.core/finer=false
+
+# Tracking of server resources
+org.jboss.ide.eclipse.as.core/resources=false
+
+# Loading of extension points
+org.jboss.ide.eclipse.as.core/extension_point=false
+
+# Server listeners
+org.jboss.ide.eclipse.as.core/listeners=false
+
+# runtime targets
+org.jboss.ide.eclipse.as.core/runtime_target=false
+
+# Performance of loading and calling delegates
+org.jboss.ide.eclipse.as.core/performance=false
+
+# Publishing
+org.jboss.ide.eclipse.as.core/publishing=false
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/JBossServerCorePlugin.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/JBossServerCorePlugin.java 2011-07-29 09:21:10 UTC (rev 33348)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/JBossServerCorePlugin.java 2011-07-29 10:23:27 UTC (rev 33349)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
+ * Copyright (c) 2011 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,
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.core;
+import java.util.Hashtable;
+
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
@@ -18,6 +20,8 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.service.debug.DebugOptions;
+import org.eclipse.osgi.service.debug.DebugOptionsListener;
import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent;
import org.eclipse.wst.server.core.IServer;
@@ -42,6 +46,9 @@
super();
plugin = this;
}
+ public static JBossServerCorePlugin getInstance() {
+ return plugin;
+ }
public IExtension[] getExtensions (String extensionPoint) {
IExtensionRegistry reg = Platform.getExtensionRegistry();
@@ -61,6 +68,11 @@
UnitedServerListenerManager.getDefault().addListener(XPathModel.getDefault());
UnitedServerListenerManager.getDefault().addListener(ServerListener.getDefault());
FacetedProjectFramework.addListener( JBoss4xEarFacetInstallListener.getDefault(), IFacetedProjectEvent.Type.POST_INSTALL);
+
+ // register the debug options listener
+ final Hashtable<String, String> props = new Hashtable<String, String>(4);
+ props.put(DebugOptions.LISTENER_SYMBOLICNAME, PLUGIN_ID);
+ context.registerService(DebugOptionsListener.class.getName(), new Trace(), props);
}
/**
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Trace.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Trace.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Trace.java 2011-07-29 10:23:27 UTC (rev 33349)
@@ -0,0 +1,138 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Initial API and implementation
+ *******************************************************************************/
+package org.jboss.ide.eclipse.as.core;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.service.debug.DebugOptions;
+import org.eclipse.osgi.service.debug.DebugOptionsListener;
+
+/**
+ * Helper class to route trace output.
+ */
+public class Trace implements DebugOptionsListener {
+
+ private static final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy HH:mm.ss.SSS"); //$NON-NLS-1$
+
+ private static Set<String> logged = new HashSet<String>();
+
+ // tracing enablement flags
+ public static boolean CONFIG = false;
+ public static boolean INFO = false;
+ public static boolean WARNING = false;
+ public static boolean SEVERE = false;
+ public static boolean FINER = false;
+ public static boolean FINEST = false;
+ public static boolean RESOURCES = false;
+ public static boolean EXTENSION_POINT = false;
+ public static boolean LISTENERS = false;
+ public static boolean RUNTIME_TARGET = false;
+ public static boolean PERFORMANCE = false;
+ public static boolean PUBLISHING = false;
+
+ // tracing levels. One most exist for each debug option
+ public final static String STRING_CONFIG = "/config"; //$NON-NLS-1$
+ public final static String STRING_INFO = "/info"; //$NON-NLS-1$
+ public final static String STRING_WARNING = "/warning"; //$NON-NLS-1$
+ public final static String STRING_SEVERE = "/severe"; //$NON-NLS-1$
+ public final static String STRING_FINER = "/finer"; //$NON-NLS-1$
+ public final static String STRING_FINEST = "/finest"; //$NON-NLS-1$
+ public final static String STRING_RESOURCES = "/resources"; //$NON-NLS-1$
+ public final static String STRING_EXTENSION_POINT = "/extension_point"; //$NON-NLS-1$
+ public final static String STRING_LISTENERS = "/listeners"; //$NON-NLS-1$
+ public final static String STRING_RUNTIME_TARGET = "/runtime_target"; //$NON-NLS-1$
+ public final static String STRING_PERFORMANCE = "/performance"; //$NON-NLS-1$
+ public final static String STRING_PUBLISHING = "/publishing"; //$NON-NLS-1$
+
+ /**
+ * Trace constructor. This should never be explicitly called by clients and is used to register this class with the
+ * {@link DebugOptions} service.
+ */
+ public Trace() {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.osgi.service.debug.DebugOptionsListener#optionsChanged(org.eclipse.osgi.service.debug.DebugOptions)
+ */
+ public void optionsChanged(DebugOptions options) {
+ Trace.CONFIG = options.getBooleanOption(JBossServerCorePlugin.PLUGIN_ID + Trace.STRING_CONFIG, false);
+ Trace.INFO = options.getBooleanOption(JBossServerCorePlugin.PLUGIN_ID + Trace.STRING_INFO, false);
+ Trace.WARNING = options.getBooleanOption(JBossServerCorePlugin.PLUGIN_ID + Trace.STRING_WARNING, false);
+ Trace.SEVERE = options.getBooleanOption(JBossServerCorePlugin.PLUGIN_ID + Trace.STRING_SEVERE, false);
+ Trace.FINER = options.getBooleanOption(JBossServerCorePlugin.PLUGIN_ID + Trace.STRING_FINER, false);
+ Trace.FINEST = options.getBooleanOption(JBossServerCorePlugin.PLUGIN_ID + Trace.STRING_FINEST, false);
+ Trace.RESOURCES = options.getBooleanOption(JBossServerCorePlugin.PLUGIN_ID + Trace.STRING_RESOURCES, false);
+ Trace.EXTENSION_POINT = options.getBooleanOption(JBossServerCorePlugin.PLUGIN_ID + Trace.STRING_EXTENSION_POINT, false);
+ Trace.LISTENERS = options.getBooleanOption(JBossServerCorePlugin.PLUGIN_ID + Trace.STRING_LISTENERS, false);
+ Trace.RUNTIME_TARGET = options.getBooleanOption(JBossServerCorePlugin.PLUGIN_ID + Trace.STRING_RUNTIME_TARGET, false);
+ Trace.PERFORMANCE = options.getBooleanOption(JBossServerCorePlugin.PLUGIN_ID + Trace.STRING_PERFORMANCE, false);
+ Trace.PUBLISHING = options.getBooleanOption(JBossServerCorePlugin.PLUGIN_ID + Trace.STRING_PUBLISHING, false);
+ }
+
+ /**
+ * Trace the given message.
+ *
+ * @param level
+ * The tracing level.
+ * @param s
+ * The message to trace
+ */
+ public static void trace(final String level, String s) {
+
+ Trace.trace(level, s, null);
+ }
+
+ /**
+ * Trace the given message and exception.
+ *
+ * @param level
+ * The tracing level.
+ * @param s
+ * The message to trace
+ * @param t
+ * A {@link Throwable} to trace
+ */
+ public static void trace(final String level, String s, Throwable t) {
+ if (s == null) {
+ return;
+ }
+ if (Trace.STRING_SEVERE.equals(level)) {
+ if (!logged.contains(s)) {
+ JBossServerCorePlugin.log(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, s, t));
+ logged.add(s);
+ }
+ }
+ if (JBossServerCorePlugin.getInstance().isDebugging()) {
+ final StringBuffer sb = new StringBuffer(JBossServerCorePlugin.PLUGIN_ID);
+ sb.append(" "); //$NON-NLS-1$
+ sb.append(level);
+ sb.append(" "); //$NON-NLS-1$
+ sb.append(sdf.format(new Date()));
+ sb.append(" "); //$NON-NLS-1$
+ sb.append(s);
+ System.out.println(sb.toString());
+ if (t != null) {
+ t.printStackTrace();
+ }
+ }
+ }
+
+
+}
\ No newline at end of file
13 years, 5 months
JBoss Tools SVN: r33348 - trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards.
by jbosstools-commits@lists.jboss.org
Author: jlukas(a)redhat.com
Date: 2011-07-29 05:21:10 -0400 (Fri, 29 Jul 2011)
New Revision: 33348
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/CDIWizard.java
Log:
guard tests against lost focus
Modified: trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/CDIWizard.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/CDIWizard.java 2011-07-29 09:18:35 UTC (rev 33347)
+++ trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/wizards/CDIWizard.java 2011-07-29 09:21:10 UTC (rev 33348)
@@ -173,6 +173,7 @@
}
public List<String> getTargets() {
+ setFocus();
return Arrays.asList(bot().comboBoxWithLabel("Target:").items());
}
@@ -189,6 +190,7 @@
}
public List<String> getScopes() {
+ setFocus();
return Arrays.asList(bot().comboBoxWithLabel("Scope:").items());
}
@@ -197,10 +199,12 @@
case INTERCEPTOR_BINDING:
case STEREOTYPE:
case INTERCEPTOR:
+ setFocus();
bot().button("Add", 0).click();
SWTBotShell sh = bot().activeShell();
sh.bot().text().setText(ib);
sh.bot().button("OK").click();
+ setFocus();
break;
default:
throw new UnsupportedOperationException();
@@ -209,16 +213,19 @@
}
public List<String> getIBindings() {
+ setFocus();
return Arrays.asList(bot().listWithLabel("Interceptor Bindings:").getItems());
}
public CDIWizard addStereotype(String stereotype) {
switch (type) {
case STEREOTYPE:
+ setFocus();
bot().button("Add", 1).click();
SWTBotShell sh = bot().activeShell();
sh.bot().text().setText(stereotype);
sh.bot().button("OK").click();
+ setFocus();
break;
default:
throw new UnsupportedOperationException();
@@ -227,6 +234,7 @@
}
public List<String> getStereotypes() {
+ setFocus();
return Arrays.asList(bot().listWithLabel("Stereotypes:").getItems());
}
@@ -235,6 +243,7 @@
case DECORATOR:
case BEAN:
case ANNOTATION_LITERAL:
+ setFocus();
if (isPublic) {
bot().radio("public").click();
} else {
@@ -251,6 +260,7 @@
final Button b = bot().radio("default").widget;
new Radio2(b).click();
}
+ setFocus();
break;
default:
throw new UnsupportedOperationException();
@@ -273,12 +283,14 @@
switch (type) {
case DECORATOR:
case BEAN:
+ setFocus();
bot().button("Add...", 0).click();
SWTBotShell sh = bot().activeShell();
sh.bot().text().setText(intf);
sh.bot().sleep(1000);
sh.bot().table().getTableItem(0).select();
sh.bot().button("OK").click();
+ setFocus();
break;
default:
throw new UnsupportedOperationException();
@@ -287,6 +299,7 @@
}
public CDIWizard addQualifier(String qualifier) {
+ setFocus();
switch (type) {
case BEAN:
bot().button("Add", 0).click();
@@ -302,6 +315,7 @@
sh.bot().sleep(1000);
sh.bot().table().getTableItem(0).select();
sh.bot().button("OK").click();
+ setFocus();
return this;
}
@@ -334,11 +348,13 @@
public CDIWizard setSuperclass(String name) {
switch (type) {
case INTERCEPTOR:
+ setFocus();
bot().button("Browse...", 2).click();
SWTBotShell sh = bot().activeShell();
sh.bot().text().setText(name);
sh.bot().table().getTableItem(0).select();
sh.bot().button("OK").click();
+ setFocus();
break;
default:
throw new UnsupportedOperationException();
@@ -358,6 +374,7 @@
}
private void setCheckbox(String label, boolean set) {
+ setFocus();
SWTBotCheckBox c = bot().checkBox(label);
if (c.isChecked() != set) {
if (set) {
@@ -369,11 +386,13 @@
}
private boolean isCheckboxSet(String label) {
+ setFocus();
SWTBotCheckBox c = bot().checkBox(label);
return c.isChecked();
}
private void setCombo(String label, String value) {
+ setFocus();
SWTBotCombo c = bot().comboBoxWithLabel(label);
c.setSelection(value);
}
13 years, 5 months
JBoss Tools SVN: r33347 - in trunk/as/plugins: org.jboss.ide.eclipse.as.classpath.core/META-INF and 8 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-07-29 05:18:35 -0400 (Fri, 29 Jul 2011)
New Revision: 33347
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/CustomRuntimeClasspathModel.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/containers/
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/containers/custom/
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/containers/custom/CustomClasspathPreferencePage.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/DefaultFilesetPreferencePage.java
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/Fileset.java
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/FilesetContentProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/FilesetDialog.java
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/FilesetUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ClientAllRuntimeClasspathProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/plugin.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/resolvers/ConfigNameResolver.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/preferences/ServerTypePreferencePage.java
Log:
JBIDE-1354 - implementation with a preference page
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/DefaultFilesetPreferencePage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/DefaultFilesetPreferencePage.java 2011-07-29 08:56:15 UTC (rev 33346)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/DefaultFilesetPreferencePage.java 2011-07-29 09:18:35 UTC (rev 33347)
@@ -24,7 +24,6 @@
import org.jboss.ide.eclipse.as.ui.preferences.ServerTypePreferencePage;
public class DefaultFilesetPreferencePage extends ServerTypePreferencePage {
- private FilesetPreferenceComposite rootComp;
@Override
protected Control createContents(Composite parent) {
rootComp = new FilesetPreferenceComposite(parent, SWT.NONE);
@@ -38,7 +37,7 @@
ArrayList<Object> list;
Fileset[] arr;
for( int i = 0; i < changed2.length; i++ ) {
- list = rootComp.getDataForServer(changed2[i]);
+ list = rootComp.getDataForComboSelection(changed2[i]);
arr = (Fileset[]) list.toArray(new Fileset[list.size()]);
IPath fileToWrite = FilesetUtil.DEFAULT_FS_ROOT.append(changed2[i]);
FilesetUtil.saveFilesets(fileToWrite.toFile(), arr);
@@ -72,7 +71,7 @@
super.initializeDataModel();
}
- protected Object[] getCurrentServerDataModel() {
+ protected Object[] getCurrentSelectionDataModel() {
return getCurrentServerSets();
}
@@ -80,7 +79,7 @@
String id = getCurrentId();
ArrayList<Object> list = new ArrayList<Object>();
if( id != null ) {
- list = getDataForServer(id);
+ list = getDataForComboSelection(id);
if( list == null ) {
IPath fileToRead = FilesetUtil.DEFAULT_FS_ROOT.append(id);
Fileset[] sets = FilesetUtil.loadFilesets(fileToRead.toFile(), null);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/Fileset.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/Fileset.java 2011-07-29 08:56:15 UTC (rev 33346)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/Fileset.java 2011-07-29 09:18:35 UTC (rev 33347)
@@ -10,19 +10,26 @@
******************************************************************************/
package org.jboss.ide.eclipse.archives.webtools.filesets;
+import java.io.File;
+
import org.eclipse.core.internal.variables.StringSubstitutionEngine;
import org.eclipse.core.internal.variables.StringVariableManager;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.archives.core.asf.DirectoryScanner;
+import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory;
public class Fileset implements Cloneable {
private static final String HASH_SEPARATOR = "::_::"; //$NON-NLS-1$
private static final String SEP = "\n"; //$NON-NLS-1$
private String name, folder, includesPattern, excludesPattern;
+ private IRuntime runtime;
private IServer server;
+
public Fileset() {
}
public Fileset(String string) {
@@ -45,18 +52,31 @@
public String toString() {
return name + SEP + folder + SEP + includesPattern + SEP + excludesPattern;
}
- /**
+
+ public static final String JBOSS_CONFIG_DIR_ARG = "${jboss_config_dir}"; //$NON-NLS-1$
+ public static final String JBOSS_SERVER_ARG = "${jboss_config}"; //$NON-NLS-1$
+
+ public static final String getConfigDirSubstitute(IRuntime rt) {
+ return "${jboss_config_dir:" + rt.getName() + "}"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public static final String getServerSubstitute(IRuntime rt) {
+ return "${jboss_config:" + rt.getName() + "}"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
* @return the folder
*/
public String getFolder() {
+ return getFolder(folder, runtime);
+ }
+
+ public static String getFolder(String folder, IRuntime runtime) {
String tmp = folder == null ? "" : folder; //$NON-NLS-1$
- if( server != null ) {
- tmp = tmp.replace("${jboss_config_dir}", //$NON-NLS-1$
- "${jboss_config_dir:" + server.getName() + "}"); //$NON-NLS-1$ //$NON-NLS-2$
- tmp = tmp.replace("${jboss_config}", //$NON-NLS-1$
- "${jboss_config:" + server.getName() + "}"); //$NON-NLS-1$ //$NON-NLS-2$
+ if( runtime != null ) {
+ tmp = tmp.replace(JBOSS_CONFIG_DIR_ARG, getConfigDirSubstitute(runtime));
+ tmp = tmp.replace(JBOSS_SERVER_ARG, getServerSubstitute(runtime));
}
-
try {
StringSubstitutionEngine engine = new StringSubstitutionEngine();
tmp = engine.performStringSubstitution(tmp, true,
@@ -64,9 +84,8 @@
} catch( CoreException ce ) {}
IPath p = new Path(tmp);
- if( !p.isAbsolute() && server != null ) {
- if( server.getRuntime() != null )
- p = server.getRuntime().getLocation().append(p);
+ if( !p.isAbsolute() && runtime != null ) {
+ p = runtime.getLocation().append(p);
}
return p.toString();
}
@@ -122,9 +141,22 @@
this.name = name;
}
- public IServer getServer() { return this.server; }
- public void setServer(IServer server) { this.server = server; }
-
+ public IServer getServer() {
+ return this.server;
+ }
+ public void setServer(IServer server) {
+ this.server = server;
+ this.runtime = server == null ? null : server.getRuntime();
+ }
+ public IRuntime getRuntime() {
+ return runtime;
+ }
+ public void setRuntime(IRuntime rt) {
+ runtime = rt;
+ if( server == null || server.getRuntime().equals(rt))
+ server = null;
+ }
+
public Object clone() {
try {
return super.clone();
@@ -142,4 +174,32 @@
public int hashCode() {
return (name + HASH_SEPARATOR + folder + HASH_SEPARATOR + includesPattern + HASH_SEPARATOR + excludesPattern + HASH_SEPARATOR).hashCode();
}
+
+ public IPath[] findPaths() {
+ String dir = getFolder();
+ String includes = getIncludesPattern();
+ String excludes = getExcludesPattern();
+ return findPaths(dir, includes, excludes);
+ }
+ public static IPath[] findPaths(String dir, String includes, String excludes) {
+ IPath[] paths = new IPath[0];
+ try {
+ if (dir != null && new File(dir).exists()) {
+ DirectoryScanner scanner = DirectoryScannerFactory
+ .createDirectoryScanner(dir, null, includes, excludes,
+ null, false, 1, true);
+ if (scanner != null) {
+ String[] files = scanner.getIncludedFiles();
+ paths = new IPath[files.length];
+ for (int i = 0; i < files.length; i++) {
+ paths[i] = new Path(files[i]);
+ }
+ }
+ }
+ } catch (IllegalStateException ise) {
+ }
+ return paths;
+ }
+
+
}
\ No newline at end of file
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/FilesetContentProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/FilesetContentProvider.java 2011-07-29 08:56:15 UTC (rev 33346)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/FilesetContentProvider.java 2011-07-29 09:18:35 UTC (rev 33347)
@@ -21,8 +21,6 @@
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.wst.server.core.IServer;
-import org.jboss.ide.eclipse.archives.core.asf.DirectoryScanner;
-import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory;
import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
public class FilesetContentProvider implements ITreeContentProvider {
@@ -185,8 +183,7 @@
Fileset fs = (Fileset) parentElement;
IPath[] paths = null;
try {
- paths = findPaths(fs.getFolder(), fs.getIncludesPattern(), fs
- .getExcludesPattern());
+ paths = findPaths(fs);
} catch (BuildException be) {
return new Object[] {};
}
@@ -227,24 +224,8 @@
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
- private IPath[] findPaths(String dir, String includes, String excludes) {
- IPath[] paths = new IPath[0];
- try {
- if (dir != null) {
- DirectoryScanner scanner = DirectoryScannerFactory
- .createDirectoryScanner(dir, null, includes, excludes,
- null, false, 1, true);
- if (scanner != null) {
- String[] files = scanner.getIncludedFiles();
- paths = new IPath[files.length];
- for (int i = 0; i < files.length; i++) {
- paths[i] = new Path(files[i]);
- }
- }
- }
- } catch (IllegalStateException ise) {
- }
- return paths;
+ private IPath[] findPaths(Fileset fs) {
+ return fs.findPaths();
}
private static void addPath(ArrayList<PathWrapper> children,
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/FilesetDialog.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/FilesetDialog.java 2011-07-29 08:56:15 UTC (rev 33346)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/FilesetDialog.java 2011-07-29 09:18:35 UTC (rev 33347)
@@ -10,10 +10,6 @@
******************************************************************************/
package org.jboss.ide.eclipse.archives.webtools.filesets;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -36,9 +32,6 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.wst.server.core.IServer;
-import org.jboss.ide.eclipse.archives.core.asf.DirectoryScanner;
-import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory;
-import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension.FileWrapper;
import org.jboss.ide.eclipse.archives.ui.util.composites.FilesetPreviewComposite;
import org.jboss.ide.eclipse.archives.webtools.Messages;
@@ -240,28 +233,7 @@
return fileset;
}
-
private static IPath[] findPaths(String dir, String includes, String excludes) {
- try {
- if( dir != null ) {
- DirectoryScanner scanner =
- DirectoryScannerFactory.createDirectoryScanner(dir, null, includes, excludes, null, false, 1, false);
- if( scanner != null ) {
- Iterator<File> i = scanner.iterator();
- ArrayList<IPath> paths2 = new ArrayList<IPath>();
- while(i.hasNext() && paths2.size() < 30) {
- FileWrapper fw = (FileWrapper)i.next();
- paths2.add(new Path(fw.getFilesetRelative()));
- }
-
- return (IPath[]) paths2.toArray(new IPath[paths2.size()]);
- }
- }
- } catch( IllegalStateException ise ) {}
- catch(Exception e) {
- e.printStackTrace();
- }
- return new IPath[]{};
+ return Fileset.findPaths(dir, includes, excludes);
}
-
}
\ No newline at end of file
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/FilesetUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/FilesetUtil.java 2011-07-29 08:56:15 UTC (rev 33346)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/FilesetUtil.java 2011-07-29 09:18:35 UTC (rev 33347)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.webtools.filesets;
import java.io.File;
@@ -31,6 +41,14 @@
}
public static Fileset[] loadFilesets(InputStream is, IServer server) {
+ Fileset[] sets = loadFilesets(is);
+ for( int i = 0; i < sets.length; i++ ) {
+ sets[i].setServer(server);
+ }
+ return sets;
+ }
+
+ public static Fileset[] loadFilesets(InputStream is) {
Fileset[] filesets = null;
XMLMemento memento = XMLMemento.createReadRoot(is);
IMemento[] categoryMementos = memento.getChildren("fileset");//$NON-NLS-1$
@@ -42,7 +60,6 @@
includes = categoryMementos[i].getString("includes");//$NON-NLS-1$
excludes = categoryMementos[i].getString("excludes");//$NON-NLS-1$
filesets[i] = new Fileset(name, folder, includes, excludes);
- filesets[i].setServer(server);
}
return filesets == null ? new Fileset[] { } : filesets;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/META-INF/MANIFEST.MF 2011-07-29 08:56:15 UTC (rev 33346)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/META-INF/MANIFEST.MF 2011-07-29 09:18:35 UTC (rev 33347)
@@ -12,7 +12,8 @@
org.eclipse.jst.server.core;bundle-version="1.2.101",
org.eclipse.wst.common.project.facet.core;bundle-version="1.4.200",
org.eclipse.jst.common.project.facet.core;bundle-version="1.4.200",
- org.jboss.ide.eclipse.as.core
+ org.jboss.ide.eclipse.as.core,
+ org.jboss.ide.eclipse.archives.webtools;bundle-version="2.2.0"
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.ide.eclipse.as.classpath.core,
org.jboss.ide.eclipse.as.classpath.core.ejb3,
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ClientAllRuntimeClasspathProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ClientAllRuntimeClasspathProvider.java 2011-07-29 08:56:15 UTC (rev 33346)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/ClientAllRuntimeClasspathProvider.java 2011-07-29 09:18:35 UTC (rev 33347)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
+ * Copyright (c) 2011 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,
@@ -16,7 +16,7 @@
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashSet;
+import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -33,6 +33,7 @@
import org.jboss.ide.eclipse.as.classpath.core.ClasspathCorePlugin;
import org.jboss.ide.eclipse.as.classpath.core.Messages;
import org.jboss.ide.eclipse.as.classpath.core.RuntimeKey;
+import org.jboss.ide.eclipse.as.classpath.core.runtime.CustomRuntimeClasspathModel.IDefaultPathProvider;
/**
* This class uses the "throw everything you can find" strategy
@@ -111,34 +112,12 @@
if (runtimeClasspath != null) {
return runtimeClasspath;
}
- IPath loc = key.getLocation();
- IPath configPath = key.getConfigPath();
- String rtID = key.getId();
- Set<Entry> list = new HashSet<Entry>();
- if(AS_32.equals(rtID)) list = get32(loc, configPath);
- if(AS_40.equals(rtID)) list = get40(loc,configPath);
- if(AS_42.equals(rtID)) list = get42(loc,configPath);
- if(AS_50.equals(rtID)) list = get50(loc,configPath);
- if(EAP_43.equals(rtID)) list = getEAP43(loc,configPath);
-
- // Added cautiously, not sure on changes, may change
- if(AS_51.equals(rtID)) list = get50(loc,configPath);
- if(AS_60.equals(rtID)) list = get60(loc,configPath);
- if(EAP_50.equals(rtID)) list = get50(loc,configPath);
-
- if( AS_70.equals(rtID)) list = get70(loc);
-
- if( list == null ) {
- runtimeClasspath = new IClasspathEntry[0];
- } else {
- List<IClasspathEntry> entries = convert(list);
- runtimeClasspath = entries.toArray(new IClasspathEntry[entries.size()]);
- }
+ runtimeClasspath = getClasspathEntriesForRuntime(runtime);
ClasspathCorePlugin.getRuntimeClasspaths().put(key, runtimeClasspath);
return runtimeClasspath;
}
- protected List<IClasspathEntry> convert(Set<Entry> list) {
+ protected List<IClasspathEntry> convert(Collection<Entry> list) {
List<IClasspathEntry> fin = new ArrayList<IClasspathEntry>();
Iterator<Entry> i = list.iterator();
while(i.hasNext()) {
@@ -147,72 +126,17 @@
return fin;
}
- protected Set<Entry> get32(IPath location, IPath configPath) {
- Set<Entry> list = new HashSet<Entry>();
- addPaths(location.append(LIB), list);
- addPaths(configPath.append(LIB), list);
- addPaths(location.append(CLIENT), list);
- return list;
+ protected IClasspathEntry[] getClasspathEntriesForRuntime(IRuntime rt) {
+ IDefaultPathProvider[] sets = CustomRuntimeClasspathModel.getInstance().getEntries(rt.getRuntimeType());
+ IPath[] allPaths = CustomRuntimeClasspathModel.getInstance().getAllEntries(rt, sets);
+ ArrayList<Entry> entries = new ArrayList<Entry>();
+ for( int i = 0; i < allPaths.length; i++ ) {
+ addSinglePath(allPaths[i], entries);
+ }
+ List<IClasspathEntry> ret = convert(entries);
+ return (IClasspathEntry[]) ret.toArray(new IClasspathEntry[ret.size()]);
}
- protected Set<Entry> get40(IPath location, IPath configPath) {
- Set<Entry> list = new HashSet<Entry>();
- addPaths(location.append(LIB), list);
- addPaths(configPath.append(LIB), list);
- IPath deployPath = configPath.append(DEPLOY);
- addPaths(deployPath.append(JBOSS_WEB_DEPLOYER).append(JSF_LIB), list);
- addPaths(deployPath.append(AOP_JDK5_DEPLOYER), list);
- addPaths(deployPath.append(EJB3_DEPLOYER), list);
- addPaths(location.append(CLIENT), list);
- return list;
- }
-
- protected Set<Entry> get42(IPath location, IPath configPath) {
- return get40(location, configPath);
- }
-
- protected Set<Entry> getEAP43(IPath location, IPath configPath) {
- return get40(location, configPath);
- }
-
- protected Set<Entry> get50(IPath location, IPath configPath) {
- Set<Entry> list = new HashSet<Entry>();
- addPaths(location.append(COMMON).append(LIB), list);
- addPaths(location.append(LIB), list);
- addPaths(configPath.append(LIB), list);
- IPath deployerPath = configPath.append(DEPLOYERS);
- IPath deployPath = configPath.append(DEPLOY);
- addPaths(deployPath.append(JBOSSWEB_SAR).append(JSF_LIB),list);
- addPaths(deployPath.append(JBOSSWEB_SAR).append(JBOSS_WEB_SERVICE_JAR),list);
- addPaths(deployPath.append(JBOSSWEB_SAR).append(JSTL_JAR),list);
- addPaths(deployerPath.append(AS5_AOP_DEPLOYER), list);
- addPaths(deployerPath.append(EJB3_DEPLOYER), list);
- addPaths(deployerPath.append(WEBBEANS_DEPLOYER).append(JSR299_API_JAR), list);
- addPaths(location.append(CLIENT), list);
- return list;
- }
-
- protected Set<Entry> get60(IPath location, IPath configPath) {
- Set<Entry> list = new HashSet<Entry>();
- list.addAll(get50(location, configPath));
- addPaths(configPath.append(DEPLOYERS).append(REST_EASY_DEPLOYER), list);
- addPaths(configPath.append(DEPLOYERS).append(JSF_DEPLOYER).append(MOJARRA_20).append(JSF_LIB), list);
- return list;
- }
-
- protected Set<Entry> get70(IPath location) {
- Set<Entry> list = new HashSet<Entry>();
- SimpleFileFilter filter = new SimpleFileFilter(new String[]{"jsf-api-1.2_13.jar", "jsf-impl-1.2_13.jar"}); // Problematic jar //$NON-NLS-1$
- addPaths(location.append(AS7_MODULES).append(JAVAX), list, true, filter);
- addPaths(location.append(AS7_MODULES).append("org/hibernate/validator"),list, true);
- addPaths(location.append(AS7_MODULES).append("org/resteasy"),list, true);
- addPaths(location.append(AS7_MODULES).append("org/picketbox"),list, true);
- addPaths(location.append(AS7_MODULES).append("org/jboss/as/controller-client/main/"),list, true);
- addPaths(location.append(AS7_MODULES).append("org/jboss/dmr/main/"),list, true);
-
- return list;
- }
-
protected IClasspathEntry getEntry(Entry entry) {
return JavaRuntime.newArchiveRuntimeClasspathEntry(entry.getPath()).getClasspathEntry();
}
@@ -261,7 +185,11 @@
return;
}
list.add(new Entry(p, p.lastSegment(), p.toFile().length()));
-
}
-
+ protected void addSinglePath(IPath p, ArrayList<Entry> list) {
+ if (!p.toFile().exists()) {
+ return;
+ }
+ list.add(new Entry(p, p.lastSegment(), p.toFile().length()));
+ }
}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/CustomRuntimeClasspathModel.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/CustomRuntimeClasspathModel.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/CustomRuntimeClasspathModel.java 2011-07-29 09:18:35 UTC (rev 33347)
@@ -0,0 +1,220 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.as.classpath.core.runtime;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.internal.XMLMemento;
+import org.jboss.ide.eclipse.archives.webtools.filesets.Fileset;
+import org.jboss.ide.eclipse.archives.webtools.filesets.FilesetUtil;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+
+public class CustomRuntimeClasspathModel implements IJBossToolingConstants, IJBossRuntimeResourceConstants {
+ protected static IPath DEFAULT_CLASSPATH_FS_ROOT = JBossServerCorePlugin.getGlobalSettingsLocation().append("filesets").append("runtimeClasspaths"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ private static CustomRuntimeClasspathModel instance;
+ public static CustomRuntimeClasspathModel getInstance() {
+ if( instance == null )
+ instance = new CustomRuntimeClasspathModel();
+ return instance;
+ }
+
+ public static interface IDefaultPathProvider {
+ public IPath[] getAbsolutePaths();
+ public void setRuntime(IRuntime rt);
+ }
+
+ public static class PathProviderFileset extends Fileset implements IDefaultPathProvider {
+ public PathProviderFileset(Fileset set) {
+ super(set.getName(), set.getRawFolder(), set.getIncludesPattern(), set.getExcludesPattern());
+ }
+ public PathProviderFileset(String baseFolder) {
+ this("", baseFolder, "**/*.jar", "");
+ }
+ public PathProviderFileset(String name, String folder, String inc, String exc) {
+ super(name, folder, inc, exc);
+ }
+ public IPath[] getAbsolutePaths() {
+ IPath[] setPaths = findPaths();
+ IPath[] absolute = new IPath[setPaths.length];
+ for( int j = 0; j < setPaths.length; j++ ) {
+ absolute[j] = new Path(getFolder()).append(setPaths[j]);
+ }
+ return absolute;
+ }
+ }
+
+ public IDefaultPathProvider[] getEntries(IRuntimeType type) {
+ IDefaultPathProvider[] sets = loadFilesets(type);
+ if( sets == null || sets.length == 0) {
+ return getDefaultEntries(type);
+ }
+ return sets;
+ }
+
+ public IDefaultPathProvider[] getDefaultEntries(IRuntimeType type) {
+ String rtID = type.getId();
+ if(AS_32.equals(rtID))
+ return getDefaultAS3Entries();
+ if(AS_40.equals(rtID))
+ return getDefaultAS40Entries();
+ if(AS_42.equals(rtID))
+ return getDefaultAS40Entries();
+ if(AS_50.equals(rtID))
+ return getDefaultAS50Entries();
+ if(EAP_43.equals(rtID))
+ return getDefaultEAP43Entries();
+ // Added cautiously, not sure on changes, may change
+ if(AS_51.equals(rtID))
+ return getDefaultAS50Entries();
+ if(AS_60.equals(rtID))
+ return getDefaultAS60Entries();
+ if(EAP_50.equals(rtID))
+ return getDefaultAS50Entries();
+
+ if(AS_70.equals(type.getId()))
+ return getDefaultAS70Entries();
+ return new IDefaultPathProvider[]{};
+ }
+
+ public IPath[] getDefaultPaths(IRuntime rt) {
+ return getAllEntries(rt, getDefaultEntries(rt.getRuntimeType()));
+ }
+
+
+ protected IDefaultPathProvider[] getDefaultAS3Entries() {
+ ArrayList<PathProviderFileset> sets = new ArrayList<PathProviderFileset>();
+ String configPath = "${jboss_config_dir}";
+ String deployerPath = configPath + "/" + DEPLOYERS;
+ String deployPath = configPath + "/" + DEPLOY;
+ sets.add(new PathProviderFileset(LIB));
+ sets.add(new PathProviderFileset(configPath + "/" + LIB));
+ sets.add(new PathProviderFileset(CLIENT));
+ return sets.toArray(new PathProviderFileset[sets.size()]);
+ }
+
+ protected IDefaultPathProvider[] getDefaultAS40Entries() {
+ ArrayList<PathProviderFileset> sets = new ArrayList<PathProviderFileset>();
+ String configPath = "${jboss_config_dir}";
+ String deployerPath = configPath + "/" + DEPLOYERS;
+ String deployPath = configPath + "/" + DEPLOY;
+ sets.add(new PathProviderFileset(LIB));
+ sets.add(new PathProviderFileset(configPath + "/" + LIB));
+ sets.add(new PathProviderFileset(deployPath + "/" + JBOSS_WEB_DEPLOYER + "/" + JSF_LIB));
+ sets.add(new PathProviderFileset(deployPath + "/" + AOP_JDK5_DEPLOYER));
+ sets.add(new PathProviderFileset(deployPath + "/" + EJB3_DEPLOYER));
+ sets.add(new PathProviderFileset(CLIENT));
+ return sets.toArray(new PathProviderFileset[sets.size()]);
+ }
+
+ protected IDefaultPathProvider[] get42() {
+ return getDefaultAS40Entries();
+ }
+
+ protected IDefaultPathProvider[] getDefaultEAP43Entries() {
+ return getDefaultAS40Entries();
+ }
+
+ protected IDefaultPathProvider[] getDefaultAS50Entries() {
+ ArrayList<PathProviderFileset> sets = new ArrayList<PathProviderFileset>();
+ String configPath = "${jboss_config_dir}";
+ String deployerPath = configPath + "/" + DEPLOYERS;
+ String deployPath = configPath + "/" + DEPLOY;
+ sets.add(new PathProviderFileset(COMMON + "/" + LIB));
+ sets.add(new PathProviderFileset(LIB));
+ sets.add(new PathProviderFileset(configPath + "/" + LIB));
+
+ sets.add(new PathProviderFileset(deployPath + "/" + JBOSSWEB_SAR + "/" + JSF_LIB));
+ sets.add(new PathProviderFileset(deployPath + "/" + JBOSSWEB_SAR + "/" + JBOSS_WEB_SERVICE_JAR));
+ sets.add(new PathProviderFileset(deployPath + "/" + JBOSSWEB_SAR + "/" + JSTL_JAR));
+ sets.add(new PathProviderFileset(deployerPath + "/" + AS5_AOP_DEPLOYER));
+ sets.add(new PathProviderFileset(deployerPath + "/" + EJB3_DEPLOYER));
+ sets.add(new PathProviderFileset(deployerPath + "/" + WEBBEANS_DEPLOYER + "/" +JSR299_API_JAR));
+ sets.add(new PathProviderFileset(CLIENT));
+ return sets.toArray(new PathProviderFileset[sets.size()]);
+ }
+
+ public IDefaultPathProvider[] getDefaultAS60Entries() {
+ ArrayList<IDefaultPathProvider> sets = new ArrayList<IDefaultPathProvider>();
+ String configPath = "${jboss_config_dir}";
+ sets.addAll(Arrays.asList(getDefaultAS50Entries()));
+ sets.add(new PathProviderFileset(configPath + "/" + DEPLOYERS + "/" + REST_EASY_DEPLOYER));
+ sets.add(new PathProviderFileset(configPath + "/" + DEPLOYERS + "/" + JSF_DEPLOYER + "/" + MOJARRA_20 + "/" + JSF_LIB));
+ return sets.toArray(new PathProviderFileset[sets.size()]);
+ }
+ public IDefaultPathProvider[] getDefaultAS70Entries() {
+ ArrayList<IDefaultPathProvider> sets = new ArrayList<IDefaultPathProvider>();
+ sets.add(new PathProviderFileset("", "modules/javax", "**/*.jar", "**/jsf-api-1.2*.jar"));
+ sets.add(new PathProviderFileset("modules/org/hibernate/validator"));
+ sets.add(new PathProviderFileset("modules/org/resteasy"));
+ sets.add(new PathProviderFileset("modules/org/picketbox"));
+ sets.add(new PathProviderFileset("modules/org/jboss/as/controller-client/main/"));
+ sets.add(new PathProviderFileset("modules/org/jboss/dmr/main/"));
+ sets.add(new PathProviderFileset("modules/org/jboss/logging/main"));
+ sets.add(new PathProviderFileset("modules/org/jboss/resteasy/resteasy-jaxb-provider/main"));
+ sets.add(new PathProviderFileset("modules/org/jboss/resteasy/resteasy-jaxrs/main"));
+ sets.add(new PathProviderFileset("modules/org/jboss/resteasy/resteasy-multipart-provider/main"));
+
+ return (IDefaultPathProvider[]) sets.toArray(new IDefaultPathProvider[sets.size()]);
+ }
+
+ public IPath[] getAllEntries(IRuntime runtime, IDefaultPathProvider[] sets) {
+ ArrayList<IPath> retval = new ArrayList<IPath>();
+ for( int i = 0; i < sets.length; i++ ) {
+ sets[i].setRuntime(runtime);
+ IPath[] absolute = sets[i].getAbsolutePaths();
+ for( int j = 0; j < absolute.length; j++ ) {
+ if( !retval.contains(absolute[j]))
+ retval.add(absolute[j]);
+ }
+ }
+ return (IPath[]) retval.toArray(new IPath[retval.size()]);
+ }
+
+
+ /*
+ * Persistance of the model
+ */
+
+ public static IDefaultPathProvider[] loadFilesets(IRuntimeType rt) {
+ IPath fileToRead = DEFAULT_CLASSPATH_FS_ROOT.append(rt.getId());
+ Fileset[] sets = FilesetUtil.loadFilesets(fileToRead.toFile(), null);
+ PathProviderFileset[] newSets = new PathProviderFileset[sets.length];
+ for( int i = 0; i < sets.length; i++ ) {
+ newSets[i] = new PathProviderFileset(sets[i]);
+ }
+ return newSets;
+ }
+
+ public static void saveFilesets(IRuntimeType runtime, IDefaultPathProvider[] sets) {
+ IPath fileToWrite = DEFAULT_CLASSPATH_FS_ROOT.append(runtime.getId());
+ XMLMemento memento = XMLMemento.createWriteRoot("classpathProviders"); //$NON-NLS-1$
+ for( int i = 0; i < sets.length; i++ ) {
+ if( sets[i] instanceof Fileset) {
+ Fileset fs = (Fileset)sets[i];
+ XMLMemento child = (XMLMemento)memento.createChild("fileset");//$NON-NLS-1$
+ child.putString("name", fs.getName());//$NON-NLS-1$
+ child.putString("folder", fs.getRawFolder());//$NON-NLS-1$
+ child.putString("includes", fs.getIncludesPattern());//$NON-NLS-1$
+ child.putString("excludes", fs.getExcludesPattern());//$NON-NLS-1$
+ } else {
+ // TODO
+ }
+ }
+ }
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/META-INF/MANIFEST.MF 2011-07-29 08:56:15 UTC (rev 33346)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/META-INF/MANIFEST.MF 2011-07-29 09:18:35 UTC (rev 33347)
@@ -12,7 +12,9 @@
org.eclipse.wst.server.ui;bundle-version="1.1.305",
org.eclipse.jdt.ui;bundle-version="3.7.0",
org.eclipse.jdt.core;bundle-version="3.7.0",
- org.eclipse.core.resources;bundle-version="3.7.100"
+ org.eclipse.core.resources;bundle-version="3.7.100",
+ org.jboss.ide.eclipse.as.ui;bundle-version="2.2.0",
+ org.jboss.ide.eclipse.archives.webtools;bundle-version="2.2.0"
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/plugin.xml 2011-07-29 08:56:15 UTC (rev 33346)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/plugin.xml 2011-07-29 09:18:35 UTC (rev 33347)
@@ -34,5 +34,15 @@
id="org.jboss.ide.eclipse.as.classpath.core.javaee-5.0">
</classpathContainerPage>
</extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ id="org.jboss.ide.eclipse.as.classpath.ui.containers.custom"
+ name="Default Classpath Entries"
+ category="org.eclipse.wst.server.ui.runtime.preferencePage"
+ class="org.jboss.ide.eclipse.as.classpath.ui.containers.custom.CustomClasspathPreferencePage">
+ <keywordReference id="org.eclipse.wst.server.preferenceKeywords"/>
+ </page>
+ </extension>
</plugin>
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/containers/custom/CustomClasspathPreferencePage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/containers/custom/CustomClasspathPreferencePage.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.ui/src/org/jboss/ide/eclipse/as/classpath/ui/containers/custom/CustomClasspathPreferencePage.java 2011-07-29 09:18:35 UTC (rev 33347)
@@ -0,0 +1,212 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.as.classpath.ui.containers.custom;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerCore;
+import org.jboss.ide.eclipse.archives.webtools.filesets.Fileset;
+import org.jboss.ide.eclipse.archives.webtools.filesets.FilesetDialog;
+import org.jboss.ide.eclipse.archives.webtools.filesets.FilesetLabelProvider;
+import org.jboss.ide.eclipse.as.classpath.core.runtime.CustomRuntimeClasspathModel;
+import org.jboss.ide.eclipse.as.classpath.core.runtime.CustomRuntimeClasspathModel.IDefaultPathProvider;
+import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
+import org.jboss.ide.eclipse.as.ui.preferences.ServerTypePreferencePage;
+import org.osgi.service.prefs.BackingStoreException;
+
+/*
+ * Should be unified with DefaultFilesetPreferencePage
+ * needs abstract superclass in jboss.as.ui plugin
+ */
+public class CustomClasspathPreferencePage extends ServerTypePreferencePage {
+ private static final String LAST_SELECTED_RUNTIME_TYPE = "org.jboss.ide.eclipse.as.classpath.ui.containers.custom.CustomClasspathPreferencePage.LAST_RUNTIME_SELECTED"; //$NON-NLS-1$
+
+ protected Control createContents(Composite parent) {
+ rootComp = new CustomClasspathPreferenceComposite(parent, SWT.NONE);
+ rootComp.setLayoutData(new GridData(GridData.FILL_BOTH));
+ rootComp.layout();
+ return rootComp;
+ }
+ public boolean performOk() {
+ String[] changed2 = rootComp.getChanged();
+ ArrayList<Object> list;
+ IDefaultPathProvider[] arr;
+ for( int i = 0; i < changed2.length; i++ ) {
+ String runtimeId = changed2[i];
+ IRuntimeType rt = ServerCore.findRuntimeType(runtimeId);
+ list = rootComp.getDataForComboSelection(changed2[i]);
+ arr = (IDefaultPathProvider[]) list.toArray(new IDefaultPathProvider[list.size()]);
+ CustomRuntimeClasspathModel.saveFilesets(rt, arr);
+ }
+
+ // Save the recently selected
+ String lastSelected = rootComp.getCurrentId();
+ IEclipsePreferences prefs = new InstanceScope().getNode(JBossServerUIPlugin.PLUGIN_ID);
+ prefs.put(LAST_SELECTED_RUNTIME_TYPE, lastSelected);
+ try {
+ prefs.flush();
+ } catch(BackingStoreException e) {
+ }
+
+ rootComp.clearChanged();
+ return true;
+ }
+
+ public class CustomClasspathPreferenceComposite extends AbstractComboDataPreferenceComposite {
+ public CustomClasspathPreferenceComposite(Composite parent, int style) {
+ super(parent, style);
+ }
+ protected void initializeSelection() {
+ IEclipsePreferences prefs = new InstanceScope().getNode(JBossServerUIPlugin.PLUGIN_ID);
+ String last =prefs.get(LAST_SELECTED_RUNTIME_TYPE, null);
+ if( last == null )
+ super.initializeSelection();
+ else {
+ IRuntimeType[] types = getRuntimeTypes();
+ for( int i = 0; i < types.length; i++ ) {
+ if( types[i].getId().equals(last)) {
+ combo.select(i);
+ return;
+ }
+ }
+ }
+ }
+
+ protected LabelProvider getLabelProvider() {
+ return new FilesetLabelProvider(){
+ public String getText(Object element) {
+ if( element instanceof Fileset ) {
+ Fileset fs = (Fileset)element;
+ return fs.getRawFolder() + " - [" + fs.getIncludesPattern() + "] - [" + fs.getExcludesPattern() + "]";
+ }
+ return super.getText(element);
+ }
+ };
+ }
+ public String getDescriptionLabel() {
+ return "Set classpath filesets for this runtime type";
+ }
+
+ protected Object[] getCurrentComboSelectionDefaultDataModel() {
+ String id = getCurrentId();
+ IRuntimeType rtType = ServerCore.findRuntimeType(id);
+ CustomRuntimeClasspathModel.IDefaultPathProvider[] sets = CustomRuntimeClasspathModel.getInstance().getDefaultEntries(rtType);
+ return sets;
+ }
+
+ protected IDefaultPathProvider[] getCurrentSelectionDataModel() {
+ String id = getCurrentId();
+ ArrayList<Object> list = new ArrayList<Object>();
+ if( id != null ) {
+ list = getDataForComboSelection(id);
+ if( list == null ) {
+ IRuntimeType rtType = ServerCore.findRuntimeType(id);
+ if( rtType != null ) {
+ CustomRuntimeClasspathModel.IDefaultPathProvider[] sets = CustomRuntimeClasspathModel.getInstance().getEntries(rtType);
+ list = new ArrayList<Object>();
+ list.addAll(Arrays.asList(sets));
+ cacheMap.put(id, list);
+ }
+ }
+ }
+ return (IDefaultPathProvider[]) list.toArray(new IDefaultPathProvider[list.size()]);
+ }
+
+ protected String getAllOptionString() {
+ return "All Runtime Types";
+ }
+
+ private IRuntimeType[] types = null;
+ private IRuntimeType[] getRuntimeTypes() {
+ if( types == null ) {
+ ArrayList<IRuntimeType> retval = new ArrayList<IRuntimeType>();
+ ArrayList<IRuntimeType> all = new ArrayList<IRuntimeType>(
+ Arrays.asList( ServerCore.getRuntimeTypes()));
+ if( !getAllServerTypes()) {
+ Iterator<IRuntimeType> i = all.iterator();
+ IRuntimeType t;
+ while(i.hasNext()) {
+ t = i.next();
+ if( !t.getId().startsWith("org.jboss.ide.eclipse.as.")) {//$NON-NLS-1$
+ i.remove();
+ }
+ }
+ }
+ retval = all;
+ Collections.sort(retval, new Comparator<IRuntimeType>(){
+ public int compare(IRuntimeType o1, IRuntimeType o2) {
+ return o1.getName().compareTo(o2.getName());
+ }});
+ types = (IRuntimeType[]) all.toArray(new IRuntimeType[all.size()]);
+ }
+ return types;
+ }
+ protected boolean showAllOption() {
+ return false;
+ }
+ protected String getIdAtIndex(int index) {
+ IRuntimeType type = getRuntimeTypes()[index];
+ String id = type.getId();
+ return id;
+ }
+
+ protected class EntryFilesetDialog extends FilesetDialog {
+ protected EntryFilesetDialog(Shell parentShell,
+ String defaultLocation, IServer server) {
+ super(parentShell, defaultLocation, server);
+ }
+ public Fileset getFileset() {
+ return new CustomRuntimeClasspathModel.PathProviderFileset(fileset);
+ }
+ }
+
+ @Override
+ protected void addPressed() {
+ FilesetDialog d = new EntryFilesetDialog(addButton.getShell(), "", null); //$NON-NLS-1$
+ d.setShowViewer(false);
+ if( d.open() == Window.OK) {
+ // For now, just add fileset
+ Fileset fs = d.getFileset();
+ addObject(fs);
+ }
+ }
+
+ @Override
+ protected boolean getAllServerTypes() {
+ return false;
+ }
+
+ @Override
+ protected String[] getComboItemNames() {
+ IRuntimeType[] types = getRuntimeTypes();
+ String[] names = new String[types.length];
+ for( int i = 0; i < types.length; i++ )
+ names[i] = types[i].getName();
+ return names;
+ }
+
+ }
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/resolvers/ConfigNameResolver.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/resolvers/ConfigNameResolver.java 2011-07-29 08:56:15 UTC (rev 33346)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/resolvers/ConfigNameResolver.java 2011-07-29 09:18:35 UTC (rev 33347)
@@ -4,6 +4,7 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.variables.IDynamicVariable;
import org.eclipse.core.variables.IDynamicVariableResolver;
+import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerCore;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
@@ -20,35 +21,65 @@
}
protected String handleConfig(IDynamicVariable variable, String argument) {
+ IJBossServerRuntime ajbsrt = null;
IServer[] servers = ServerCore.getServers();
for( int i = 0; i < servers.length; i++ ) {
if( servers[i].getName().equals(argument)) {
- IJBossServerRuntime ajbsrt = (IJBossServerRuntime) servers[i].getRuntime()
- .loadAdapter(IJBossServerRuntime.class,
+ ajbsrt = (IJBossServerRuntime) servers[i].getRuntime()
+ .loadAdapter(IJBossServerRuntime.class,
new NullProgressMonitor());
- String config = null;
- if( ajbsrt != null )
- config = ajbsrt.getJBossConfiguration();
- if( config != null )
- return config;
+ break;
}
}
+ if( ajbsrt == null ) {
+ IRuntime[] runtimes = ServerCore.getRuntimes();
+ for( int i = 0; i < runtimes.length; i++ ) {
+ if( runtimes[i].getName().equals(argument)) {
+ ajbsrt = (IJBossServerRuntime) runtimes[i]
+ .loadAdapter(IJBossServerRuntime.class,
+ new NullProgressMonitor());
+ break;
+ }
+ }
+ }
+ if( ajbsrt != null ) {
+ String config = null;
+ if( ajbsrt != null )
+ config = ajbsrt.getJBossConfiguration();
+ if( config != null )
+ return config;
+ }
return null;
}
protected String handleConfigDir(IDynamicVariable variable, String argument) {
+ IJBossServerRuntime ajbsrt = null;
IServer[] servers = ServerCore.getServers();
for( int i = 0; i < servers.length; i++ ) {
if( servers[i].getName().equals(argument)) {
- IJBossServerRuntime ajbsrt = (IJBossServerRuntime) servers[i].getRuntime()
+ ajbsrt = (IJBossServerRuntime) servers[i].getRuntime()
.loadAdapter(IJBossServerRuntime.class,
new NullProgressMonitor());
- String config = null;
- if( ajbsrt != null )
- config = ajbsrt.getConfigLocationFullPath().append(ajbsrt.getJBossConfiguration()).toString();
- if( config != null )
- return config;
+ break;
}
}
+ if( ajbsrt == null ) {
+ IRuntime[] runtimes = ServerCore.getRuntimes();
+ for( int i = 0; i < runtimes.length; i++ ) {
+ if( runtimes[i].getName().equals(argument)) {
+ ajbsrt = (IJBossServerRuntime) runtimes[i]
+ .loadAdapter(IJBossServerRuntime.class,
+ new NullProgressMonitor());
+ break;
+ }
+ }
+ }
+ if( ajbsrt != null ) {
+ String config = null;
+ if( ajbsrt != null )
+ config = ajbsrt.getConfigLocationFullPath().append(ajbsrt.getJBossConfiguration()).toString();
+ if( config != null )
+ return config;
+ }
return null;
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/preferences/ServerTypePreferencePage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/preferences/ServerTypePreferencePage.java 2011-07-29 08:56:15 UTC (rev 33346)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/preferences/ServerTypePreferencePage.java 2011-07-29 09:18:35 UTC (rev 33347)
@@ -45,7 +45,7 @@
import org.eclipse.wst.server.core.ServerCore;
import org.jboss.ide.eclipse.as.ui.UIUtil;
-public class ServerTypePreferencePage extends PreferencePage implements
+public abstract class ServerTypePreferencePage extends PreferencePage implements
IWorkbenchPreferencePage {
public ServerTypePreferencePage() {
@@ -62,39 +62,51 @@
public void init(IWorkbench workbench) {
}
+ protected AbstractComboDataPreferenceComposite rootComp;
+
@Override
- protected Control createContents(Composite parent) {
- ServerTypePreferenceComposite c = new ServerTypePreferenceComposite(parent, SWT.NONE);
- c.setLayoutData(new GridData(GridData.FILL_BOTH));
- c.layout();
- return c;
- }
+ protected abstract Control createContents(Composite parent);
+// rootComp = new ServerTypePreferenceComposite(parent, SWT.NONE);
+// rootComp.setLayoutData(new GridData(GridData.FILL_BOTH));
+// rootComp.layout();
+// return rootComp;
+// }
+
+ protected void performDefaults() {
+ String id = rootComp.getCurrentId();
+ ArrayList<Object> o = new ArrayList<Object>();
+ o.addAll(Arrays.asList(rootComp.getCurrentComboSelectionDefaultDataModel()));
+ rootComp.cacheMap.put(id, o);
+ rootComp.changed.add(id);
+ rootComp.viewer.refresh();
+ updateApplyButton();
+ }
- public static class ServerTypePreferenceComposite extends Composite {
+ public static abstract class AbstractComboDataPreferenceComposite extends Composite {
protected ArrayList<String> changed;
protected HashMap<String, ArrayList<Object>> cacheMap;
- protected Combo servers;
+ protected Combo combo;
protected TreeViewer viewer;
protected Button addButton;
protected Button removeButton;
protected Button moveUp;
protected Button moveDown;
- public ServerTypePreferenceComposite(Composite parent, int style) {
+ public AbstractComboDataPreferenceComposite(Composite parent, int style) {
super(parent, style);
setLayout(new FormLayout());
Label l = new Label(this, SWT.None);
l.setText(getDescriptionLabel());
l.setLayoutData(createFormData(0,5,null,0,0,5,100,-5));
- servers = new Combo(this, SWT.READ_ONLY);
- servers.setLayoutData(createFormData(l,5,null,0,0,5,null,0));
- servers.setItems(getComboItems());
+ combo = new Combo(this, SWT.READ_ONLY);
+ combo.setLayoutData(createFormData(l,5,null,0,0,5,null,0));
+ combo.setItems(getComboItems());
viewer = new TreeViewer(this);
viewer.getTree().setLayoutData(createFormData(
- servers,5,100,-5,0,5,80,0));
+ combo,5,100,-5,0,5,80,0));
viewer.setLabelProvider(getLabelProvider());
viewer.setContentProvider(getContentProvider());
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@@ -105,25 +117,29 @@
Composite buttonWrapper = new Composite(this, SWT.NONE);
- buttonWrapper.setLayoutData(createFormData(servers,5,null,0,viewer.getTree(),5,100,-5));
+ buttonWrapper.setLayoutData(createFormData(combo,5,null,0,viewer.getTree(),5,100,-5));
buttonWrapper.setLayout(new GridLayout(1, true));
createRightColumnButtons(buttonWrapper);
- servers.addSelectionListener(new SelectionListener() {
+ combo.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
- getCurrentServerDataModel(); // force load
+ getCurrentSelectionDataModel(); // force load
viewer.refresh();
updateMoveUpMoveDown();
} });
- servers.select(0);
+ initializeSelection();
initializeDataModel(); // force load
viewer.setInput(ResourcesPlugin.getWorkspace());
updateMoveUpMoveDown();
}
+ protected void initializeSelection() {
+ combo.select(0);
+ }
+
protected void handleViewerSelectionChanged() {
updateMoveUpMoveDown();
}
@@ -140,7 +156,7 @@
enableUp = enableDown = false;
} else {
Object selected = sel.getFirstElement();
- Object[] arr = getCurrentServerDataModel();
+ Object[] arr = getCurrentSelectionDataModel();
ArrayList<Object> asList = new ArrayList<Object>();
asList.addAll(Arrays.asList(arr));
int index = asList.indexOf(selected);
@@ -161,7 +177,7 @@
protected void initializeDataModel() {
cacheMap = new HashMap<String, ArrayList<Object>>();
changed = new ArrayList<String>();
- getCurrentServerDataModel();
+ getCurrentSelectionDataModel();
}
public String getDescriptionLabel() {
@@ -198,7 +214,7 @@
protected void insertMoveUpDown(Composite c) {
moveUp = new Button(c, SWT.PUSH);
- moveUp.setText("MoveUp");
+ moveUp.setText("Move Up");
moveUp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
moveDown = new Button(c, SWT.PUSH);
moveDown.setText("Move down");
@@ -219,10 +235,22 @@
}
});
}
- protected Object[] getCurrentServerDataModel() {
+
+ /**
+ * Return the current list of objects for the selected server type
+ * @return
+ */
+ protected Object[] getCurrentSelectionDataModel() {
return new Object[]{};
}
+ /**
+ * Get the defaults for this data model
+ * @return
+ */
+ protected Object[] getCurrentComboSelectionDefaultDataModel() {
+ return new Object[]{};
+ }
protected void addObject(Object o) {
if( o != null ) {
@@ -249,15 +277,14 @@
Object o = sel.getFirstElement();
removeObject(o);
}
- protected void addPressed() {
- // TODO
- }
+ protected abstract void addPressed();
+
protected void moveUpPressed() {
IStructuredSelection sel = (IStructuredSelection)viewer.getSelection();
Object fs = (Object)sel.getFirstElement();
String id = getCurrentId();
- Object[] sets = getCurrentServerDataModel();
+ Object[] sets = getCurrentSelectionDataModel();
ArrayList<Object> asList = new ArrayList<Object>();
asList.addAll(Arrays.asList(sets));
int ind = asList.indexOf(fs);
@@ -274,7 +301,7 @@
IStructuredSelection sel = (IStructuredSelection)viewer.getSelection();
Object fs = (Object)sel.getFirstElement();
String id = getCurrentId();
- Object[] sets = getCurrentServerDataModel();
+ Object[] sets = getCurrentSelectionDataModel();
ArrayList<Object> asList = new ArrayList<Object>();
asList.addAll(Arrays.asList(sets));
int ind = asList.indexOf(fs);
@@ -287,20 +314,22 @@
viewer.refresh();
}
- protected String getCurrentId() {
- int index = servers.getSelectionIndex();
- if( showAllServerTypeOption() && index == 0 )
- return "All Servers";
+ protected abstract String getAllOptionString();
+
+ public String getCurrentId() {
+ int index = combo.getSelectionIndex();
+ if( showAllOption() && index == 0 )
+ return getAllOptionString();
if( index == -1 )
return null;
- int i2 = showAllServerTypeOption() ? index - 1 : index;
- IServerType type = getServerTypes()[i2];
- String id = type.getId();
- return id;
+ int i2 = showAllOption() ? index - 1 : index;
+ return getIdAtIndex(i2);
}
- public ArrayList<Object> getDataForServer(String serverId) {
- return cacheMap.get(serverId);
+ protected abstract String getIdAtIndex(int index);
+
+ public ArrayList<Object> getDataForComboSelection(String id) {
+ return cacheMap.get(id);
}
protected LabelProvider getLabelProvider() {
@@ -315,7 +344,7 @@
public void dispose() {
}
public Object[] getElements(Object inputElement) {
- return getCurrentServerDataModel();
+ return getCurrentSelectionDataModel();
}
public boolean hasChildren(Object element) {
return false;
@@ -334,23 +363,51 @@
return true;
}
// Return true if we show a combo option for "all server types" or not
- protected boolean showAllServerTypeOption() {
+ protected boolean showAllOption() {
return true;
}
- private String[] getComboItems() {
+ protected String[] getComboItems() {
ArrayList<String> list = new ArrayList<String>();
- if( showAllServerTypeOption())
+ if( showAllOption())
list.add(0,"All Server Types");
- IServerType[] types = getServerTypes();
- for( int i = 0; i < types.length; i++ )
- list.add(types[i].getName());
+ String[] names = getComboItemNames();
+ list.addAll(Arrays.asList(names));
return (String[]) list.toArray(new String[list.size()]);
}
+ protected abstract String[] getComboItemNames();
+
+ private FormData createFormData(Object topStart, int topOffset,
+ Object bottomStart, int bottomOffset, Object leftStart,
+ int leftOffset, Object rightStart, int rightOffset) {
+ return UIUtil.createFormData2(topStart, topOffset, bottomStart, bottomOffset, leftStart, leftOffset, rightStart, rightOffset);
+ }
+
+ public String[] getChanged() {
+ return (String[]) changed.toArray(new String[changed.size()]);
+ }
+
+ public void clearChanged() {
+ changed.clear();
+ }
+ } // inner class ends
+
+ public static abstract class ServerTypePreferenceComposite extends AbstractComboDataPreferenceComposite {
+ public ServerTypePreferenceComposite(Composite parent, int style) {
+ super(parent, style);
+ }
+ protected String[] getComboItemNames() {
+ IServerType[] types = getComboModel();
+ String[] names = new String[types.length];
+ for( int i = 0; i < types.length; i++ )
+ names[i] = types[i].getName();
+ return names;
+ }
+
private IServerType[] types = null;
- private IServerType[] getServerTypes() {
+ private IServerType[] getComboModel() {
if( types == null ) {
ArrayList<IServerType> retval = new ArrayList<IServerType>();
ArrayList<IServerType> all = new ArrayList<IServerType>(
@@ -374,22 +431,16 @@
}
return types;
}
-
- private FormData createFormData(Object topStart, int topOffset,
- Object bottomStart, int bottomOffset, Object leftStart,
- int leftOffset, Object rightStart, int rightOffset) {
- return UIUtil.createFormData2(topStart, topOffset, bottomStart, bottomOffset, leftStart, leftOffset, rightStart, rightOffset);
+ protected String getIdAtIndex(int index) {
+ IServerType type = getComboModel()[index];
+ String id = type.getId();
+ return id;
}
-
- public String[] getChanged() {
- return (String[]) changed.toArray(new String[changed.size()]);
+ protected String getAllOptionString() {
+ return "All Servers";
}
-
- public void clearChanged() {
- changed.clear();
- }
- } // inner class ends
-
+ }
+
public boolean performOk() {
// TODO do stuff
return true;
13 years, 5 months
JBoss Tools SVN: r33346 - in trunk: jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2011-07-29 04:56:15 -0400 (Fri, 29 Jul 2011)
New Revision: 33346
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/MarkersTest.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/MarkerHelper.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAllBotTests.java
Log:
Added test for Markers
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAllBotTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAllBotTests.java 2011-07-29 08:08:01 UTC (rev 33345)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/JSFAllBotTests.java 2011-07-29 08:56:15 UTC (rev 33346)
@@ -16,6 +16,7 @@
import org.jboss.tools.jsf.ui.bot.test.smoke.CodeCompletionTest;
import org.jboss.tools.jsf.ui.bot.test.smoke.CreateNewJSFProjectTest;
import org.jboss.tools.jsf.ui.bot.test.smoke.FacesConfigCodeCompletionTest;
+import org.jboss.tools.jsf.ui.bot.test.smoke.MarkersTest;
import org.jboss.tools.jsf.ui.bot.test.smoke.OpenOnTest;
import org.jboss.tools.jsf.ui.bot.test.templates.SetTemplateForUnknownTagTest;
import org.jboss.tools.jsf.ui.bot.test.templates.UnknownTemplateTest;
@@ -44,6 +45,7 @@
suite.addTestSuite(OpenOnTest.class);
suite.addTestSuite(CodeCompletionTest.class);
suite.addTestSuite(FacesConfigCodeCompletionTest.class);
+ suite.addTestSuite(MarkersTest.class);
return suite;
}
}
\ No newline at end of file
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/MarkersTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/MarkersTest.java (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/MarkersTest.java 2011-07-29 08:56:15 UTC (rev 33346)
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2011 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.ui.bot.test.smoke;
+
+import org.jboss.tools.jsf.ui.bot.test.JSFAutoTestCase;
+import org.jboss.tools.ui.bot.ext.SWTJBTExt;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ui.bot.ext.helper.MarkerHelper;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
+import org.jboss.tools.vpe.ui.bot.test.VPEAutoTestCase;
+/**
+ * Test Markers position and attributes regarding to JSF components within jsp page
+ * @author Vladimir Pakan
+ *
+ */
+public class MarkersTest extends JSFAutoTestCase{
+ private SWTBotEditorExt editor;
+ private String originalEditorText;
+ /**
+ * Test open on functionality of JSF components within jsp page
+ */
+ public void testMarkers(){
+ MarkerHelper markerHelper = new MarkerHelper(TEST_PAGE,
+ VPEAutoTestCase.JBT_TEST_PROJECT_NAME,"WebContent","pages");
+ String textToSelect = "<h:outputText value=\"#{Message.header";
+ String insertText = "yyaddedxx";
+ int[] expectedMarkerLines = new int[3];
+ String[] expectedMarkerDesc = new String[3];
+ SWTJBTExt.selectTextInSourcePane(SWTTestExt.bot,
+ TEST_PAGE,
+ textToSelect,
+ textToSelect.length(),
+ 0,
+ 0);
+ editor.insertText(insertText);
+ expectedMarkerLines[0] = editor.cursorPosition().line;
+ expectedMarkerDesc[0] = "^\"header" + insertText + "\" cannot be resolved";
+ textToSelect = "<h:outputText value=\"#{Message.prompt_message";
+ SWTJBTExt.selectTextInSourcePane(SWTTestExt.bot,
+ TEST_PAGE,
+ textToSelect,
+ textToSelect.length(),
+ 0,
+ 0);
+ editor.insertText(insertText);
+ expectedMarkerLines[1] = editor.cursorPosition().line;
+ expectedMarkerDesc[1] = "^\"prompt_message" + insertText + "\" cannot be resolved";
+ textToSelect = "<h:inputText value=\"#{user.name";
+ SWTJBTExt.selectTextInSourcePane(SWTTestExt.bot,
+ TEST_PAGE,
+ textToSelect,
+ textToSelect.length(),
+ 0,
+ 0);
+ editor.insertText(insertText);
+ expectedMarkerLines[2] = editor.cursorPosition().line;
+ expectedMarkerDesc[2] = "^\"name" + insertText + "\" cannot be resolved";
+ editor.save();
+ bot.sleep(Timing.time2S());
+ // Check markers
+ for (int index = 0 ; index < expectedMarkerLines.length ; index++){
+ markerHelper.checkForMarker(String.valueOf(expectedMarkerLines[index] + 1),
+ expectedMarkerDesc[index]);
+ }
+ }
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ openPage(TEST_PAGE);
+ editor = SWTTestExt.bot.swtBotEditorExtByTitle(TEST_PAGE);
+ originalEditorText = editor.getText();
+ }
+ @Override
+ protected void tearDown() throws Exception {
+ if (editor != null){
+ editor.setText(originalEditorText);
+ editor.saveAndClose();
+ }
+ super.tearDown();
+ }
+}
\ No newline at end of file
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/MarkersTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/MarkerHelper.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/MarkerHelper.java (rev 0)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/MarkerHelper.java 2011-07-29 08:56:15 UTC (rev 33346)
@@ -0,0 +1,272 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2011 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ui.bot.ext.helper;
+
+import static org.junit.Assert.assertFalse;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+/**
+ * Helper for Marker related tests
+ * @author Vladimir Pakan
+ *
+ */
+public class MarkerHelper {
+ private IResource resource;
+
+ public MarkerHelper (String resourceName, String... pathToResource){
+ this.resource = ResourcesPlugin
+ .getWorkspace()
+ .getRoot()
+ .findMember(MarkerHelper.getPathToResource(resourceName, pathToResource));
+ }
+ /**
+ * Returns Markers for specified resource recursively
+ * @param resourceName
+ * @param pathToResource
+ * @return
+ */
+ public static IMarker[] getResourceMarkers(String resourceName, String... pathToResource){
+ return MarkerHelper.getResourceMarkers(null, resourceName, pathToResource);
+ }
+ /**
+ * Returns Markers of specified type for specified resource recursively
+ * @param type
+ * @param resourceName
+ * @param pathToResource
+ * @return
+ */
+ public static IMarker[] getResourceMarkers(String type , String resourceName, String... pathToResource){
+ try {
+ return ResourcesPlugin
+ .getWorkspace()
+ .getRoot()
+ .findMember(MarkerHelper.getPathToResource(resourceName, pathToResource))
+ .findMarkers(type, true, IResource.DEPTH_INFINITE);
+ } catch (CoreException ce) {
+ throw new RuntimeException(ce);
+ }
+ }
+ /**
+ * Returns Markers of specified type for resource specified within constructor recursively
+ * @param type
+ * @return
+ */
+ public IMarker[] getMarkers(String type){
+ try {
+ return resource.findMarkers(type, true, IResource.DEPTH_INFINITE);
+ } catch (CoreException ce) {
+ throw new RuntimeException(ce);
+ }
+ }
+ /**
+ * Returns Markers for resource specified within constructor recursively
+ * @return
+ */
+ public IMarker[] getMarkers(){
+ return getMarkers(null);
+ }
+ /**
+ * Returns path to specified resource
+ * @param resourceName
+ * @param pathToResource
+ * @return
+ */
+ private static IPath getPathToResource (String resourceName, String... pathToResource){
+ IPath path = new Path("/");
+
+ if (pathToResource != null){
+ for (String pathElement : pathToResource){
+ path = path.append(pathElement);
+ }
+ }
+ return path.append(resourceName);
+
+ }
+ /**
+ * Returns Marker Line Number
+ * @param marker
+ * @return
+ */
+ public static String getMarkerLineNumber (IMarker marker){
+ try {
+ return marker.getAttribute(IMarker.LINE_NUMBER).toString();
+ } catch (CoreException ce) {
+ return "";
+ }
+ }
+ /**
+ * Returns Marker Message
+ * @param marker
+ * @return
+ */
+ public static String getMarkerMessage (IMarker marker){
+ return marker.getAttribute(IMarker.MESSAGE, "");
+ }
+ /**
+ * Returns Marker Resource Name
+ * @param marker
+ * @return
+ */
+ public static String getMarkerResourceName (IMarker marker){
+ return marker.getResource().getName();
+ }
+ /**
+ * Returns Marker Resource Location i.e. path to resource without resource name
+ * @param marker
+ * @return
+ */
+ public static String getMarkerResourceLocation (IMarker marker){
+ return marker.getResource().getParent().getFullPath().toString();
+ }
+ /**
+ * Display all markers of type for resource specified within constructor
+ * @param type
+ */
+ public void displayAllMarkers(String type){
+ displayMarkers(getMarkers(type));
+ }
+ /**
+ * Display all markers for resource specified within constructor
+ */
+ public void displayAllMarkers(){
+ displayAllMarkers(null);
+ }
+ /**
+ * Display all Markers of specified type for specified resource recursively
+ * @param resourceName
+ * @param pathToResource
+ * @param type
+ */
+ public static void displayAllMarkers(String type, String resourceName, String... pathToResource){
+ MarkerHelper.displayMarkers(
+ MarkerHelper.getResourceMarkers(type , resourceName, pathToResource));
+ }
+ /**
+ * Display all Markers for specified resource recursively
+ * @param resourceName
+ * @param pathToResource
+ */
+ public static void displayAllMarkers(String resourceName, String... pathToResource){
+ MarkerHelper.displayAllMarkers(null, resourceName, pathToResource);
+ }
+ /**
+ * Display markers nicely formatted
+ */
+ private static void displayMarkers (IMarker[] markers) {
+ for (IMarker marker : markers){
+ StringBuffer sb = new StringBuffer("");
+ sb.append("Line Number: ");
+ sb.append(MarkerHelper.getMarkerLineNumber(marker));
+ sb.append(" Location: ");
+ sb.append(MarkerHelper.getMarkerResourceLocation(marker));
+ sb.append(" Resource Name: ");
+ sb.append(MarkerHelper.getMarkerResourceName(marker));
+ sb.append(" Message: ");
+ sb.append(MarkerHelper.getMarkerMessage(marker));
+ System.out.println(sb);
+ try {
+ sb = new StringBuffer(" - attributes:");
+ for (Object key : marker.getAttributes().keySet()){
+ sb.append(" ");
+ sb.append(key);
+ sb.append("=");
+ sb.append(marker.getAttribute(key.toString()));
+ }
+ System.out.println(sb);
+ } catch (CoreException ce) {
+ throw new RuntimeException(ce);
+ }
+ }
+ }
+ /**
+ * Check if resource specified within constructor has marker
+ * on specified line of specified type and with message matching decritpionRegex
+ * @param lineNumber
+ * @param descriptionRegex
+ * @param type
+ */
+ public void checkForMarker (String lineNumber , String descriptionRegex , String type){
+ MarkerHelper.checkMarkersForMarker(getMarkers(type),
+ lineNumber,
+ descriptionRegex,
+ resource.getName());
+ }
+ /**
+ * Check if resource specified within constructor has marker
+ * on specified line and with message matching decritpionRegex
+ * @param lineNumber
+ * @param descriptionRegex
+ */
+ public void checkForMarker (String lineNumber , String descriptionRegex ){
+ checkForMarker(lineNumber, descriptionRegex, null);
+ }
+ /**
+ * Check if specified resource has marker
+ * on specified line and with message matching decritpionRegex
+ * @param lineNumber
+ * @param descriptionRegex
+ * @param resourceName
+ * @param pathToResource
+ */
+ public static void checkResourceForMarker (String lineNumber , String descriptionRegex, String resourceName, String... pathToResource){
+ MarkerHelper.checkResourceForMarker(null,
+ lineNumber,
+ descriptionRegex,
+ resourceName,
+ pathToResource);
+ }
+ /**
+ * Check if specified resource has marker
+ * on specified line of specified type and with message matching decritpionRegex
+ * @param type
+ * @param lineNumber
+ * @param descriptionRegex
+ * @param resourceName
+ * @param pathToResource
+ */
+ public static void checkResourceForMarker (String type , String lineNumber , String descriptionRegex, String resourceName, String... pathToResource){
+ MarkerHelper.checkMarkersForMarker(MarkerHelper.getResourceMarkers(type , resourceName, pathToResource),
+ lineNumber,
+ descriptionRegex,
+ resourceName);
+ }
+ /**
+ * Check if markers contains marker
+ * on specified line and with message matching decritpionRegex
+ * @param markers
+ * @param lineNumber
+ * @param descriptionRegex
+ * @param resourceName
+ */
+ private static void checkMarkersForMarker (IMarker[] markers , String lineNumber , String descriptionRegex , String resourceName){
+ boolean notFound = true;
+ int index = 0;
+ while (notFound && index < markers.length){
+ if (MarkerHelper.getMarkerLineNumber(markers[index]).equals(lineNumber)){
+ if (MarkerHelper.getMarkerMessage(markers[index]).matches(descriptionRegex)){
+ notFound = false;
+ }
+ }
+ index++;
+ }
+ assertFalse("Resource: " + resourceName +
+ "doesn't have marker on line " + lineNumber +
+ " with descritpion matching regular expression '" + descriptionRegex + "'",
+ notFound);
+ }
+
+}
Property changes on: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/MarkerHelper.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 5 months
JBoss Tools SVN: r33345 - trunk/build/aggregate/bottests-site/features/org.jboss.tools.bot.test.feature.
by jbosstools-commits@lists.jboss.org
Author: psrna
Date: 2011-07-29 04:08:01 -0400 (Fri, 29 Jul 2011)
New Revision: 33345
Modified:
trunk/build/aggregate/bottests-site/features/org.jboss.tools.bot.test.feature/feature.xml
Log:
added smooks bot test to the bottest update site
Modified: trunk/build/aggregate/bottests-site/features/org.jboss.tools.bot.test.feature/feature.xml
===================================================================
--- trunk/build/aggregate/bottests-site/features/org.jboss.tools.bot.test.feature/feature.xml 2011-07-29 06:53:07 UTC (rev 33344)
+++ trunk/build/aggregate/bottests-site/features/org.jboss.tools.bot.test.feature/feature.xml 2011-07-29 08:08:01 UTC (rev 33345)
@@ -45,10 +45,10 @@
<plugin id="org.jboss.tools.jbpm.ui.bot.test" download-size="0" install-size="0" version="0.0.0" />
<plugin id="org.jboss.tools.jsf.ui.bot.test" download-size="0" install-size="0" version="0.0.0" />
<plugin id="org.jboss.tools.jst.ui.bot.test" download-size="0" install-size="0" version="0.0.0" />
- <plugin id="org.jboss.tools.maven.ui.bot.test" download-size="0" install-size="0" version="0.0.0" />
+ <plugin id="org.jboss.tools.maven.ui.bot.test" download-size="0" install-size="0" version="0.0.0" />
<plugin id="org.jboss.tools.modeshape.rest.ui.bot.test" download-size="0" install-size="0" version="0.0.0" />
<plugin id="org.jboss.tools.seam.ui.bot.test" download-size="0" install-size="0" version="0.0.0" />
-<!-- <plugin id="org.jboss.tools.smooks.ui.bot.test" download-size="0" install-size="0" version="0.0.0" /> -->
+ <plugin id="org.jboss.tools.smooks.ui.bot.test" download-size="0" install-size="0" version="0.0.0" />
<plugin id="org.jboss.tools.struts.ui.bot.test" download-size="0" install-size="0" version="0.0.0" />
<plugin id="org.jboss.tools.vpe.ui.bot.test" download-size="0" install-size="0" version="0.0.0" />
<plugin id="org.jboss.tools.ws.ui.bot.test" download-size="0" install-size="0" version="0.0.0" />
13 years, 5 months