JBoss Tools SVN: r42989 - trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2012-08-13 03:06:10 -0400 (Mon, 13 Aug 2012)
New Revision: 42989
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/VariousProjectsArchiving.java
Log:
workaround for JBIDE-11878
Modified: trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/VariousProjectsArchiving.java
===================================================================
--- trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/VariousProjectsArchiving.java 2012-08-13 06:52:04 UTC (rev 42988)
+++ trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/VariousProjectsArchiving.java 2012-08-13 07:06:10 UTC (rev 42989)
@@ -54,6 +54,9 @@
/* create archive */
view.createNewJarArchive(project).finish();
+ /* workaround JBIDE-11878 */
+ view = viewForProject(project);
+
/* test if archive was created and no error was thrown*/
assertItemExistsInView(view,
project, project + ".jar [/" + project + "]");
@@ -75,6 +78,9 @@
/* create archive */
view.createNewJarArchive(project).finish();
+ /* workaround JBIDE-11878 */
+ view = viewForProject(project);
+
/* test if archive was created and no error was thrown*/
assertItemExistsInView(view,
project, project + ".jar [/" + project + "]");
13 years, 8 months
JBoss Tools SVN: r42988 - in branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core: util and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-08-13 02:52:04 -0400 (Mon, 13 Aug 2012)
New Revision: 42988
Modified:
branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java
Log:
JBIDE-12419 to maintenance
Modified: branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
===================================================================
--- branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2012-08-13 06:44:55 UTC (rev 42987)
+++ branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2012-08-13 06:52:04 UTC (rev 42988)
@@ -16,15 +16,15 @@
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.osgi.util.NLS;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveStandardFileSet;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension.FileWrapper;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveStandardFileSet;
import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFileSet;
import org.jboss.ide.eclipse.archives.core.util.PathUtils;
+import org.jboss.ide.eclipse.archives.core.xpl.AntNLS;
/**
* An implementation for filesets
@@ -137,7 +137,7 @@
}
} catch( IllegalStateException ise ) {
ArchivesCore.getInstance().getLogger().log(IStatus.WARNING,
- NLS.bind(ArchivesCoreMessages.CouldNotCreateScanner, ise.getMessage()), ise);
+ AntNLS.bind(ArchivesCoreMessages.CouldNotCreateScanner, ise.getMessage()), ise);
matchingPaths = new FileWrapper[0];
matchingMap = new HashMap<String, ArrayList<FileWrapper>>();
}
Modified: branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java
===================================================================
--- branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java 2012-08-13 06:44:55 UTC (rev 42987)
+++ branches/jbosstools-3.3.x/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java 2012-08-13 06:52:04 UTC (rev 42988)
@@ -20,11 +20,11 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModelException;
+import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension.FileWrapper;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
@@ -32,11 +32,11 @@
import org.jboss.ide.eclipse.archives.core.model.IArchiveModelRootNode;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeVisitor;
-import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension.FileWrapper;
import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveModelNode;
import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeImpl;
import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackageNode;
import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackages;
+import org.jboss.ide.eclipse.archives.core.xpl.AntNLS;
/**
* Utility class for matching model elements and stuff
@@ -201,6 +201,8 @@
}
public static void fillArchiveModel( XbPackages node, IArchiveModelRootNode modelNode) throws ArchivesModelException {
+ if( node == null )
+ return;
for (Iterator iter = node.getAllChildren().iterator(); iter.hasNext(); ) {
XbPackageNode child = (XbPackageNode) iter.next();
ArchiveNodeImpl childImpl = (ArchiveNodeImpl)createPackageNodeImpl(child, modelNode);
@@ -234,7 +236,7 @@
} else {
// Log that this node type is unsupported
IStatus status = new Status(IStatus.WARNING, ArchivesCore.PLUGIN_ID,
- NLS.bind(ArchivesCoreMessages.UnsupportedNodeType, node.getNodeType()));
+ AntNLS.bind(ArchivesCoreMessages.UnsupportedNodeType, node.getNodeType()));
ArchivesCore.log(status);
}
return nodeImpl;
13 years, 8 months
JBoss Tools SVN: r42987 - in trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core: util and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-08-13 02:44:55 -0400 (Mon, 13 Aug 2012)
New Revision: 42987
Modified:
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java
Log:
JBIDE-12419 to trunk
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2012-08-11 23:05:20 UTC (rev 42986)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveFileSetImpl.java 2012-08-13 06:44:55 UTC (rev 42987)
@@ -16,15 +16,15 @@
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.osgi.util.NLS;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory;
-import org.jboss.ide.eclipse.archives.core.model.IArchiveStandardFileSet;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension.FileWrapper;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveStandardFileSet;
import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFileSet;
import org.jboss.ide.eclipse.archives.core.util.PathUtils;
+import org.jboss.ide.eclipse.archives.core.xpl.AntNLS;
/**
* An implementation for filesets
@@ -137,7 +137,7 @@
}
} catch( IllegalStateException ise ) {
ArchivesCore.getInstance().getLogger().log(IStatus.WARNING,
- NLS.bind(ArchivesCoreMessages.CouldNotCreateScanner, ise.getMessage()), ise);
+ AntNLS.bind(ArchivesCoreMessages.CouldNotCreateScanner, ise.getMessage()), ise);
matchingPaths = new FileWrapper[0];
matchingMap = new HashMap<String, ArrayList<FileWrapper>>();
}
Modified: trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java
===================================================================
--- trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java 2012-08-11 23:05:20 UTC (rev 42986)
+++ trunk/archives/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java 2012-08-13 06:44:55 UTC (rev 42987)
@@ -20,11 +20,11 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
-import org.eclipse.osgi.util.NLS;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
import org.jboss.ide.eclipse.archives.core.ArchivesCoreMessages;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
import org.jboss.ide.eclipse.archives.core.model.ArchivesModelException;
+import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension.FileWrapper;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
@@ -32,11 +32,11 @@
import org.jboss.ide.eclipse.archives.core.model.IArchiveModelRootNode;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNodeVisitor;
-import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension.FileWrapper;
import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveModelNode;
import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveNodeImpl;
import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackageNode;
import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackages;
+import org.jboss.ide.eclipse.archives.core.xpl.AntNLS;
/**
* Utility class for matching model elements and stuff
@@ -236,7 +236,7 @@
} else {
// Log that this node type is unsupported
IStatus status = new Status(IStatus.WARNING, ArchivesCore.PLUGIN_ID,
- NLS.bind(ArchivesCoreMessages.UnsupportedNodeType, node.getNodeType()));
+ AntNLS.bind(ArchivesCoreMessages.UnsupportedNodeType, node.getNodeType()));
ArchivesCore.log(status);
}
return nodeImpl;
13 years, 8 months
JBoss Tools SVN: r42986 - in trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext: view and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: ldimaggio
Date: 2012-08-11 19:05:20 -0400 (Sat, 11 Aug 2012)
New Revision: 42986
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/ExampleTest.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java
Log:
Updated to run on Eclipse Juno
https://issues.jboss.org/browse/JBQA-6462
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/ExampleTest.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/ExampleTest.java 2012-08-11 22:59:44 UTC (rev 42985)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/ExampleTest.java 2012-08-11 23:05:20 UTC (rev 42986)
@@ -110,7 +110,7 @@
bot.waitForShell("New Project Example");
bot.shell("New Project Example").bot().button(IDELabel.Button.FINISH).click();
- //bot.sleep(Timing.time5S());
+ bot.sleep(Timing.time5S());
/* Temporary fix needed by - https://issues.jboss.org/browse/JBIDE-11781
* Close the Quick Fix shell/dialog - or the project explorer cannot find the
* webservice_producer|client projects in the project explorer - ldimaggi - May 2012 */
@@ -120,7 +120,7 @@
catch (Exception E) {
log.info("Condition from https://issues.jboss.org/browse/JBIDE-11781 not found " + E.getMessage());
}
- //bot.sleep(Timing.time5S());
+ bot.sleep(Timing.time5S());
for (String project : getProjectNames()) {
assertTrue(String.format("Example project '%s' was not found in project explorer",project),projectExplorer.existsResource(project));
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2012-08-11 22:59:44 UTC (rev 42985)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTEclipseExt.java 2012-08-11 23:05:20 UTC (rev 42986)
@@ -66,6 +66,7 @@
import org.jboss.tools.ui.bot.ext.types.ViewType;
import org.jboss.tools.ui.bot.ext.view.PackageExplorer;
import org.jboss.tools.ui.bot.ext.view.RemoteSystems;
+import org.jboss.tools.ui.bot.ext.view.ViewBase;
import org.junit.Assert;
/**
@@ -1239,8 +1240,7 @@
*/
public void runTreeItemAsJavaApplication(SWTBotTreeItem treeItem) {
treeItem.select();
- treeItem.click();
-
+ treeItem.click();
//SWTEclipseExt.getMenuFromSubmenu(
// bot.menu(IDELabel.Menu.RUN).menu(IDELabel.Menu.RUN_AS),
// IDELabel.Menu.RUN_AS_JAVA_APPLICATION).click();
@@ -1248,15 +1248,43 @@
//System.out.println("runJavaApplication!!!");
//bot.sleep(30000l);
//System.out.println (treeItem.contextMenu("Run As").menu("2 Java Application").getText());
-
- bot.sleep(Timing.time30S());
//treeItem.contextMenu("Run As").menu("2 Java Application").click();
+
SWTUtilExt.menuWithRegex("(.*) Java Application", treeItem.contextMenu(IDELabel.Menu.RUN_AS)).click();
-
+
//runJavaApplication("helloworld_testclient","org.jboss.soa.esb.samples.quickstart.helloworld.test.SendJMSMessage"," ");
bot.sleep(Timing.time30S()); // This is needed to enable the test to run successfully to completion
-
}
+
+
+ /**
+ * ldimaggi - Aug 2012 - https://issues.jboss.org/browse/JBQA-6462
+ *
+ * New method written to deal with instability of treeItem.contextMenu with Eclipse Juno
+ *
+ * Initial attempts to us prepareTreeItemForContextMenu also failed with Juno
+ *
+ * // src, package, class
+ * ContextMenuHelper.prepareTreeItemForContextMenu(theTree, theTree.getTreeItem ("helloworld_testclient").getItems()[0].getItems()[0].getItems()[1]);
+ * new SWTBotMenu(ContextMenuHelper.getContextMenu(theTree, IDELabel.Menu.RUN_AS, false)).click();
+ *
+ * This new method creates a new run config for the Java application.
+ *
+ */
+ public void runTreeItemAsJavaApplication2(SWTBotTreeItem treeItem) {
+ treeItem.select();
+ treeItem.click();
+ bot.sleep(Timing.time3S());
+ bot.menu("Run").menu("Run Configurations...").click();
+ bot.sleep(Timing.time3S());
+ bot.tree(0).getTreeItem("Java Application").select().doubleClick();
+ bot.sleep(Timing.time3S());
+ bot.button("Run").click();
+ bot.sleep(Timing.time3S());
+ }
+
+
+
/**
* runs java application (run configuration)
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java 2012-08-11 22:59:44 UTC (rev 42985)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java 2012-08-11 23:05:20 UTC (rev 42986)
@@ -19,6 +19,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarDropDownButton;
import org.hamcrest.core.IsAnything;
+import org.jboss.tools.ui.bot.ext.SWTBotFactory;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.View.GeneralConsole;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
@@ -86,19 +87,33 @@
* String contained in name of console to switch on
*/
public boolean switchConsole(String containedInonsoleName) {
- SWTBotView consoleView = show();
- SWTBotToolbarDropDownButton button = consoleView
- .toolbarDropDownButton(IDELabel.ConsoleView.BUTTON_DISPLAY_SELECTED_CONSOLE_TOOLTIP);
- if (button.isEnabled()) {
- for (SWTBotMenu menu : button.menuItems(new IsAnything<MenuItem>())) {
- if (menu.getText().contains(containedInonsoleName)) {
- log.info("Switching consoleView to display '"
- + menu.getText() + "'. console");
- menu.click();
- return true;
- }
+
+ /*
+ * ldimaggi - Aug 2012 - https://issues.jboss.org/browse/JBQA-6462
+ * Thanks to Lucia Jelinkova for supplying this workaround to the Eclipse bug where SWTBot
+ * cannot handle/find buttons in a toolbar - https://issues.jboss.org/browse/JBQA-6489,
+ * Please see https://bugs.eclipse.org/bugs/show_bug.cgi?id=375598 for a detailed description.
+ */
+ for (SWTBotToolbarButton button : SWTBotFactory.getConsole().getToolbarButtons()){
+ if (button.isEnabled() && IDELabel.ConsoleView.BUTTON_DISPLAY_SELECTED_CONSOLE_TOOLTIP.equals(button.getToolTipText())){
+ button.click(); // To switch the console
+ button.click(); // To switch the console
+ return true;
}
}
+
+// SWTBotView consoleView = show();
+// SWTBotToolbarDropDownButton button = consoleView.toolbarDropDownButton(IDELabel.ConsoleView.BUTTON_DISPLAY_SELECTED_CONSOLE_TOOLTIP);
+// if (button.isEnabled()) {
+// for (SWTBotMenu menu : button.menuItems(new IsAnything<MenuItem>())) {
+// if (menu.getText().contains(containedInonsoleName)) {
+// log.info("Switching consoleView to display '"
+// + menu.getText() + "'. console");
+// menu.click();
+// return true;
+// }
+// }
+// }
return false;
}
13 years, 8 months
JBoss Tools SVN: r42985 - in trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests: examples and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: ldimaggio
Date: 2012-08-11 18:59:44 -0400 (Sat, 11 Aug 2012)
New Revision: 42985
Modified:
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/ESBAllBotTests.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/ESBExampleTest.java
trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/HelloWorld.java
Log:
Updated to run on Eclipse Juno
https://issues.jboss.org/browse/JBQA-6462
Modified: trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/ESBAllBotTests.java
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/ESBAllBotTests.java 2012-08-11 00:22:14 UTC (rev 42984)
+++ trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/ESBAllBotTests.java 2012-08-11 22:59:44 UTC (rev 42985)
@@ -32,7 +32,7 @@
NewProjectUsingRuntime.class,
NewProjectUsingBundledInEAP.class,
Editing.class,
- HelloWorld.class,
+ HelloWorld.class,
HelloWorldAction.class,
HelloWorldFileAction.class,
SmooksCSV2XML.class,
@@ -40,7 +40,7 @@
SmooksXML2XMLDateManipulation.class,
SmooksXML2XMLSimple.class,
WebServiceConsumer1.class,
-// WebServiceProducer.class, // http://lists.jboss.org/pipermail/jbosstools-dev/2008-December/002559.html
+ WebServiceProducer.class, // http://lists.jboss.org/pipermail/jbosstools-dev/2008-December/002559.html
WebServiceProducerHttp.class,
WebServiceProducerSocket.class
//SimpleEAPTest.class
Modified: trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/ESBExampleTest.java
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/ESBExampleTest.java 2012-08-11 00:22:14 UTC (rev 42984)
+++ trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/ESBExampleTest.java 2012-08-11 22:59:44 UTC (rev 42985)
@@ -94,7 +94,11 @@
protected String executeClientGetServerOutput(String... clientClass) {
//String text = console.getConsoleText();
SWTBotTreeItem jmsCall = SWTEclipseExt.selectTreeLocation(packageExplorer.show().bot(),clientClass);
- eclipse.runTreeItemAsJavaApplication(jmsCall);
+ // eclipse.runTreeItemAsJavaApplication(jmsCall);
+
+ /* ldimaggi - Aug 2012 - https://issues.jboss.org/browse/JBQA-6462 */
+ eclipse.runTreeItemAsJavaApplication2(jmsCall);
+
bot.sleep(Timing.time5S());
util.waitForNonIgnoredJobs();
String returnString = consoleWaiting();
@@ -110,7 +114,11 @@
*/
protected String executeClient(String... clientClass) {
SWTBotTreeItem jmsCall = SWTEclipseExt.selectTreeLocation(packageExplorer.show().bot(),clientClass);
- eclipse.runTreeItemAsJavaApplication(jmsCall);
+
+ //eclipse.runTreeItemAsJavaApplication(jmsCall);
+ /* ldimaggi - Aug 2012 - https://issues.jboss.org/browse/JBQA-6462 */
+ eclipse.runTreeItemAsJavaApplication2(jmsCall);
+
bot.sleep(Timing.time5S());
String text = console.getConsoleText(TIME_5S, TIME_20S, false);
console.switchConsole(configuredState.getServer().name); // switch console back for sure
@@ -132,6 +140,7 @@
protected String consoleWaiting () {
// New - the consoles fail to switch....sometimes
+ bot.sleep(60000);
boolean consoleSwitched = false;
int switchLimit = 30;
int switchCounter = 0;
@@ -204,7 +213,7 @@
new SWTBotMenu(ContextMenuHelper.getContextMenu(tree, IDELabel.Menu.PROPERTIES, false)).click();
SWTBotShell shell = bot.activeShell();
- /* ldimagi - July 2012 - added this as all tests were failing - unclear how this EVER worked before the change */
+ /* ldimaggi - July 2012 - added this as all tests were failing - unclear how this EVER worked before the change */
if (lib.contains("ESB")) {
shell.bot().table().select("ESB-" + configuredState.getServer().bundledESBVersion);
}
Modified: trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/HelloWorld.java
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/HelloWorld.java 2012-08-11 00:22:14 UTC (rev 42984)
+++ trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/HelloWorld.java 2012-08-11 22:59:44 UTC (rev 42985)
@@ -36,7 +36,7 @@
assertFalse ("Test fails due to ESB deployment error: NNNN", text.contains("ERROR [org.apache.juddi.v3.client.transport.wrapper.RequestHandler]"));
assertNotNull("Calling ESB Send message failed, nothing appened to server log",text);
assertTrue("Calling ESB Send message failed, unexpected server output :"+text,text.contains("hello world esb"));
-
+
SWTTestExt.servers.removeAllProjectsFromServer();
}
}
13 years, 8 months
JBoss Tools SVN: r42984 - in trunk/cdi/tests/org.jboss.tools.cdi.core.test: resources/tck/tests/lookup/injection/alternative and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-08-10 20:22:14 -0400 (Fri, 10 Aug 2012)
New Revision: 42984
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/A.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/B.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/C.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/D.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/beans.xml
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/SelectedAlternativeTest.java
Log:
JBIDE-12402
https://issues.jboss.org/browse/JBIDE-12402
Test is added.
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/A.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/A.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/A.java 2012-08-11 00:22:14 UTC (rev 42984)
@@ -0,0 +1,14 @@
+package org.jboss.jsr299.tck.tests.lookup.injection.alternative;
+
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Produces;
+
+@Alternative
+public class A {
+
+ @Produces
+ public B getB() {
+ return new B(100);
+ }
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/A.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/B.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/B.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/B.java 2012-08-11 00:22:14 UTC (rev 42984)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.lookup.injection.alternative;
+
+public class B {
+
+ int i;
+
+ public B(int i) {
+ this.i = i;
+ }
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/B.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/C.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/C.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/C.java 2012-08-11 00:22:14 UTC (rev 42984)
@@ -0,0 +1,12 @@
+package org.jboss.jsr299.tck.tests.lookup.injection.alternative;
+
+import javax.enterprise.inject.Produces;
+
+public class C {
+
+ @Produces
+ public B getB() {
+ return new B(200);
+ }
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/C.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/D.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/D.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/D.java 2012-08-11 00:22:14 UTC (rev 42984)
@@ -0,0 +1,18 @@
+package org.jboss.jsr299.tck.tests.lookup.injection.alternative;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+/**
+ * Injection point is resolved to producer bean A.getB().
+ * Bean C.getB() is eliminated, because A.getB() is declared in selected alternative class bean A. *
+ *
+ * @author slava
+ *
+ */
+public class D {
+
+ @Inject
+ B b;
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/D.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/beans.xml
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/beans.xml (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/beans.xml 2012-08-11 00:22:14 UTC (rev 42984)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+ <alternatives>
+ <class>org.jboss.jsr299.tck.tests.lookup.injection.alternative.A</class>
+ </alternatives>
+</beans>
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/lookup/injection/alternative/beans.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/SelectedAlternativeTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/SelectedAlternativeTest.java 2012-08-11 00:18:06 UTC (rev 42983)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/SelectedAlternativeTest.java 2012-08-11 00:22:14 UTC (rev 42984)
@@ -15,6 +15,7 @@
import org.eclipse.core.runtime.Path;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IClassBean;
+import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IProducer;
/**
@@ -58,4 +59,17 @@
assertEquals(2, producerCount);
}
+ /**
+ * Producer declared in a class bean, which is an alternative. There is another bean with the same type.
+ * Test that an injection point with that type is resolved to the producer.
+ */
+ public void testProducerInAlternativeClassBean() {
+ IInjectionPoint p = getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/lookup/injection/alternative/D.java", "b");
+ Set<IBean> unresolved = cdiProject.getBeans(false, p);
+ Set<IBean> resolved = cdiProject.getBeans(true, p);
+ assertEquals(1, resolved.size());
+ assertEquals(2, unresolved.size());
+ System.out.println("");
+ }
+
}
\ No newline at end of file
13 years, 8 months
JBoss Tools SVN: r42983 - in trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java: xpl and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-08-10 20:18:06 -0400 (Fri, 10 Aug 2012)
New Revision: 42983
Added:
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/xpl/
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/xpl/DirtyRegionProcessor.java
Modified:
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java
Log:
JBIDE-12418
Sometimes As-You-Type validation isn't invoked after a Java-String that contains EL is Copy-Pasted in Java editor
Issue is fixed
Modified: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java 2012-08-10 21:40:20 UTC (rev 42982)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java 2012-08-11 00:18:06 UTC (rev 42983)
@@ -42,7 +42,7 @@
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.sse.ui.internal.reconcile.DirtyRegionProcessor;
+import org.jboss.tools.common.validation.java.xpl.DirtyRegionProcessor;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
Added: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/xpl/DirtyRegionProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/xpl/DirtyRegionProcessor.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/xpl/DirtyRegionProcessor.java 2012-08-11 00:18:06 UTC (rev 42983)
@@ -0,0 +1,844 @@
+/*******************************************************************************
+ * Copyright (c) 2001, 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
+ * Jens Lukowski/Innoopract - initial renaming/restructuring
+ *
+ *******************************************************************************/
+package org.jboss.tools.common.validation.java.xpl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.DocumentEvent;
+import org.eclipse.jface.text.DocumentRewriteSessionEvent;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentExtension3;
+import org.eclipse.jface.text.IDocumentExtension4;
+import org.eclipse.jface.text.IDocumentListener;
+import org.eclipse.jface.text.IDocumentRewriteSessionListener;
+import org.eclipse.jface.text.ITextInputListener;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.ITypedRegion;
+import org.eclipse.jface.text.TextUtilities;
+import org.eclipse.jface.text.reconciler.DirtyRegion;
+import org.eclipse.jface.text.reconciler.IReconciler;
+import org.eclipse.jface.text.reconciler.IReconcilerExtension;
+import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
+import org.eclipse.wst.sse.ui.internal.Logger;
+import org.eclipse.wst.sse.ui.internal.reconcile.IConfigurableReconciler;
+
+/**
+ * This Job holds a queue of updates from the editor (DirtyRegions) to
+ * process. When a new request comes in, the current run is canceled, the new
+ * request is added to the queue, then the job is re-scheduled.
+ *
+ * @author pavery
+ *
+ * The class is copied from org.eclipse.jface.text.reconciler package and then
+ * patch from https://bugs.eclipse.org/bugs/show_bug.cgi?id=384776 issue is applied on this class
+ * due to fix https://issues.jboss.org/browse/JBIDE-12418 issue.
+ */
+public class DirtyRegionProcessor implements IReconciler, IReconcilerExtension, IConfigurableReconciler {
+ class DocumentListener implements IDocumentListener {
+ public void documentAboutToBeChanged(DocumentEvent event) {
+ /*
+ * if in rewrite session and already going to reprocess entire
+ * document after rewrite session, do nothing
+ */
+ if (isInRewriteSession() && fReprocessAfterRewrite)
+ return;
+ // save partition type (to see if it changes in documentChanged())
+ fLastPartitions = getPartitionRegions(event.getOffset(), event.getLength());
+ }
+
+ public void documentChanged(DocumentEvent event) {
+ /*
+ * if in rewrite session and already going to reprocess entire
+ * document after rewrite session, do nothing
+ */
+ if (isInRewriteSession() && fReprocessAfterRewrite)
+ return;
+
+ if (partitionsChanged(event)) {
+ // pa_TODO
+ // this is a simple way to ensure old
+ // annotations are removed when partition changes
+
+ // it might be a performance hit though
+ setEntireDocumentDirty(getDocument());
+ }
+ else {
+ /*
+ * bug 384776 - no wrong text may be included
+ */
+ DirtyRegion dr = null;
+ if (event.getLength() == 0) {
+ /*
+ * It's an insert-- we use text length though so that the
+ * new region gets validated...
+ */
+ dr = createDirtyRegion(event.getOffset(), event.getText().length(), DirtyRegion.INSERT);
+ }
+ else {
+ if ("".equals(event.getText())) { //$NON-NLS-1$
+ // it's a delete-- we use text length=0
+ dr = createDirtyRegion(event.getOffset(), 0, DirtyRegion.REMOVE);
+ }
+ else {
+ // it's a replace-- we use text length though so that the new region gets validated...
+ dr = createDirtyRegion(event.getOffset(), event.getText().length(), DirtyRegion.INSERT);
+ }
+ }
+ if (isInRewriteSession()) {
+ /*
+ * while in rewrite session, found a dirty region, so flag
+ * that entire document needs to be reprocesed after
+ * rewrite session
+ */
+ if (!fReprocessAfterRewrite && (dr != null)) {
+ fReprocessAfterRewrite = true;
+ }
+ }
+ else {
+ processDirtyRegion(dr);
+ }
+ }
+ }
+
+ /**
+ * Checks previous partitions from the span of the event w/ the new
+ * partitions from the span of the event. If partitions changed,
+ * return true, else return false
+ *
+ * @param event
+ * @return
+ */
+ private boolean partitionsChanged(DocumentEvent event) {
+ boolean changed = false;
+ int length = event.getText().length(); // In any case we want partitions of the new text (even if its length is zero)
+
+ ITypedRegion[] newPartitions = getPartitionRegions(event.getOffset(), length);
+ if (fLastPartitions != null) {
+ if (fLastPartitions.length != newPartitions.length) {
+ changed = true;
+ }
+ else {
+ for (int i = 0; i < fLastPartitions.length; i++) {
+ if (!fLastPartitions[i].getType().equals(newPartitions[i].getType())) {
+ changed = true;
+ break;
+ }
+ }
+ }
+ }
+ return changed;
+ }
+ }
+
+ /**
+ * Reconciles the entire document when the document in the viewer is
+ * changed. This happens when the document is initially opened, as well as
+ * after a save-as.
+ *
+ * Also see processPostModelEvent(...) for similar behavior when document
+ * for the model is changed.
+ */
+ class TextInputListener implements ITextInputListener {
+ public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
+ // do nothing
+ }
+
+ public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
+ handleInputDocumentChanged(oldInput, newInput);
+
+ startReconciling();
+ }
+ }
+
+ class DocumentRewriteSessionListener implements IDocumentRewriteSessionListener {
+ long time0 = 0;
+
+ public void documentRewriteSessionChanged(DocumentRewriteSessionEvent event) {
+ boolean oldValue = fInRewriteSession;
+ fInRewriteSession = event != null && event.getChangeType().equals(DocumentRewriteSessionEvent.SESSION_START);
+
+ if (event.getChangeType().equals(DocumentRewriteSessionEvent.SESSION_START)) {
+ if (DEBUG) {
+ time0 = System.currentTimeMillis();
+ }
+ // bug 235446 - source validation annotations lost after rewrite session
+ if (!getDirtyRegionQueue().isEmpty()) {
+ flushDirtyRegionQueue();
+ fReprocessAfterRewrite = true;
+ } else {
+ fReprocessAfterRewrite = false;
+ }
+ }
+ else if (event.getChangeType().equals(DocumentRewriteSessionEvent.SESSION_STOP)) {
+ if (fInRewriteSession ^ oldValue && fDocument != null) {
+ if (DEBUG) {
+ Logger.log(Logger.INFO, "Rewrite session lasted " + (System.currentTimeMillis() - time0) + "ms");
+ time0 = System.currentTimeMillis();
+ }
+ if (fReprocessAfterRewrite) {
+ DirtyRegion entireDocument = createDirtyRegion(0, fDocument.getLength(), DirtyRegion.INSERT);
+ processDirtyRegion(entireDocument);
+ }
+ if (DEBUG) {
+ Logger.log(Logger.INFO, "Full document reprocess took " + (System.currentTimeMillis() - time0) + "ms");
+ }
+ fReprocessAfterRewrite = false;
+ }
+ }
+ }
+ }
+
+ /** debug flag */
+ protected static final boolean DEBUG;
+ private static final long UPDATE_DELAY = 500;
+
+ static {
+ String value = Platform.getDebugOption("org.eclipse.wst.sse.ui/debug/reconcilerjob"); //$NON-NLS-1$
+ DEBUG = value != null && value.equalsIgnoreCase("true"); //$NON-NLS-1$
+ }
+
+ private long fDelay;
+
+
+ /** local queue of dirty regions (created here) to be reconciled */
+ private List fDirtyRegionQueue = Collections.synchronizedList(new ArrayList());
+
+ /** document that this reconciler works on */
+ private IDocument fDocument = null;
+
+ private IDocumentListener fDocumentListener = new DocumentListener();
+ private IDocumentRewriteSessionListener fDocumentRewriteSessionListener = new DocumentRewriteSessionListener();
+
+ /**
+ * set true after first install to prevent duplicate work done in the
+ * install method (since install gets called multiple times)
+ */
+ private boolean fIsInstalled = false;
+
+ /**
+ * so we can tell if a partition changed after the last edit
+ */
+ ITypedRegion[] fLastPartitions;
+
+ List fNonIncrementalStrategiesAlreadyProcessed = new ArrayList(1);
+
+ /**
+ * The partitioning this reconciler uses.
+ */
+ private String fPartitioning;
+
+ Map fReconcilingStrategies = null;
+
+ /** for initial reconcile when document is opened */
+ private TextInputListener fTextInputListener = null;
+ /** the text viewer */
+ private ITextViewer fViewer;
+ boolean fInRewriteSession = false;
+ /**
+ * true if entire document needs to be reprocessed after rewrite session
+ */
+ boolean fReprocessAfterRewrite = false;
+
+ /** The job should be reset because of document changes */
+ private boolean fReset = false;
+ private boolean fIsCanceled = false;
+ private boolean fHasReconciled = false;
+ private Object LOCK = new Object();
+
+ private BackgroundThread fThread;
+
+ /**
+ * Creates a new StructuredRegionProcessor
+ */
+ public DirtyRegionProcessor() {
+ // init reconciler stuff
+ setDelay(UPDATE_DELAY);
+ fReconcilingStrategies = new HashMap();
+ }
+
+ /**
+ * Adds the given resource to the set of resources that need refreshing.
+ * Synchronized in order to protect the collection during add.
+ *
+ * @param resource
+ */
+ private synchronized void addRequest(DirtyRegion newDirtyRegion) {
+ // NOTE: This method is called a lot so make sure it's fast
+ List dirtyRegionQueue = getDirtyRegionQueue();
+ synchronized (dirtyRegionQueue) {
+ for (Iterator it = dirtyRegionQueue.iterator(); it.hasNext();) {
+ // go through list of existing dirty regions and check if any
+ // dirty regions need to be discarded
+ DirtyRegion currentExisting = (DirtyRegion) it.next();
+ DirtyRegion outer = getOuterRegion(currentExisting, newDirtyRegion);
+ // if we already have a request which contains the new request,
+ // discard the new request
+ if (outer == currentExisting)
+ return;
+ // if new request contains any existing requests,
+ // remove those
+ if (outer == newDirtyRegion)
+ it.remove();
+ }
+ dirtyRegionQueue.add(newDirtyRegion);
+ }
+ }
+
+ /**
+ * Notifies subclasses that processing of multiple dirty regions has begun
+ */
+ protected void beginProcessing() {
+ // do nothing by default
+ }
+
+ /**
+ * @param dirtyRegion
+ * @return
+ */
+ protected ITypedRegion[] computePartitioning(DirtyRegion dirtyRegion) {
+ int drOffset = dirtyRegion.getOffset();
+ int drLength = dirtyRegion.getLength();
+
+ return computePartitioning(drOffset, drLength);
+ }
+
+ protected ITypedRegion[] computePartitioning(int drOffset, int drLength) {
+ ITypedRegion[] tr = new ITypedRegion[0];
+ IDocument doc = getDocument();
+ if (doc != null){
+ int docLength = doc.getLength();
+
+ if (drOffset > docLength) {
+ drOffset = docLength;
+ drLength = 0;
+ }
+ else if (drOffset + drLength > docLength) {
+ drLength = docLength - drOffset;
+ }
+
+ try {
+ // dirty region may span multiple partitions
+ tr = TextUtilities.computePartitioning(doc, getDocumentPartitioning(), drOffset, drLength, true);
+ }
+ catch (BadLocationException e) {
+ String info = "dr: [" + drOffset + ":" + drLength + "] doc: [" + docLength + "] "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ Logger.logException(info, e);
+ tr = new ITypedRegion[0];
+ }
+ }
+ return tr;
+ }
+
+ /**
+ * Used to determine if one dirty region contains the other and if so,
+ * which is the one that contains it.
+ *
+ * @param root
+ * @param possible
+ * @return the outer dirty region if it contains the other dirty region,
+ * null otherwise
+ */
+ protected DirtyRegion getOuterRegion(DirtyRegion root, DirtyRegion possible) {
+ DirtyRegion outer = null;
+ if (isContained(root, possible))
+ outer = root;
+ else if (isContained(possible, root))
+ outer = possible;
+ return outer;
+ }
+
+ /**
+ * Used to determine of a "possible" dirty region can be discarded in
+ * favor of using just the "root" dirty region.
+ *
+ * @return if the root dirty region contains possible, return true,
+ * otherwise return false
+ */
+ private boolean isContained(DirtyRegion root, DirtyRegion possible) {
+ int rootStart = root.getOffset();
+ int rootEnd = rootStart + root.getLength();
+ int possStart = possible.getOffset();
+ int possEnd = possStart + possible.getLength();
+ if (rootStart <= possStart && rootEnd >= possEnd)
+ return true;
+ return false;
+ }
+
+ protected DirtyRegion createDirtyRegion(int offset, int length, String type) {
+ DirtyRegion durty = null;
+ IDocument doc = getDocument();
+
+ if (doc != null) {
+ // safety for BLE
+ int docLen = doc.getLength();
+ if (offset > docLen) {
+ offset = docLen;
+ length = 0;
+ }
+ else if (offset + length >= docLen)
+ length = docLen - offset;
+ try {
+ durty = new DirtyRegion(offset, length, type, doc.get(offset, length));
+ }
+ catch (BadLocationException e) {
+ String info = "dr: [" + offset + ":" + length + "] doc: [" + docLen + "] "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ Logger.logException(info, e);
+ }
+ }
+ return durty;
+ }
+
+ protected DirtyRegion createDirtyRegion(ITypedRegion tr, String type) {
+ return createDirtyRegion(tr.getOffset(), tr.getLength(), type);
+ }
+
+ protected void flushDirtyRegionQueue() {
+ synchronized (fDirtyRegionQueue) {
+ fDirtyRegionQueue.clear();
+ }
+ }
+
+ /**
+ * Notifies subclasses that processing of multiple dirty regions has
+ * ended, for now
+ */
+ protected void endProcessing() {
+ // do nothing by default
+ }
+
+ /**
+ * Delay between processing of DirtyRegions.
+ *
+ * @return
+ */
+ long getDelay() {
+ return fDelay;
+ }
+
+ List getDirtyRegionQueue() {
+ return fDirtyRegionQueue;
+ }
+
+ /**
+ * The IDocument on which this reconciler operates
+ *
+ * @return
+ */
+ protected IDocument getDocument() {
+ return fDocument;
+ }
+
+ public String getDocumentPartitioning() {
+ if (fPartitioning == null)
+ return IDocumentExtension3.DEFAULT_PARTITIONING;
+ return fPartitioning;
+ }
+
+ protected String[] getPartitions(int drOffset, int drLength) {
+
+ ITypedRegion[] regions = new ITypedRegion[0];
+ int docLength = getDocument().getLength();
+
+ if (drOffset > docLength) {
+ drOffset = docLength;
+ drLength = 0;
+ }
+ else if (drOffset + drLength > docLength) {
+ drLength = docLength - drOffset;
+ }
+
+ try {
+ regions = TextUtilities.computePartitioning(getDocument(), getDocumentPartitioning(), drOffset, drLength, true);
+ }
+ catch (BadLocationException e) {
+ Logger.logException(e);
+ regions = new ITypedRegion[0];
+ }
+ String[] partitions = new String[regions.length];
+ for (int i = 0; i < regions.length; i++)
+ partitions[i] = regions[i].getType();
+ return partitions;
+ }
+
+ ITypedRegion[] getPartitionRegions(int drOffset, int drLength) {
+ ITypedRegion[] regions = new ITypedRegion[0];
+ int docLength = getDocument().getLength();
+
+ if (drOffset > docLength) {
+ drOffset = docLength;
+ drLength = 0;
+ }
+ else if (drOffset + drLength > docLength) {
+ drLength = docLength - drOffset;
+ }
+
+ try {
+ regions = TextUtilities.computePartitioning(getDocument(), getDocumentPartitioning(), drOffset, drLength, true);
+ }
+ catch (BadLocationException e) {
+ Logger.logException(e);
+ regions = new ITypedRegion[0];
+ }
+ return regions;
+ }
+
+
+ /**
+ * Returns the reconciling strategy registered with the reconciler for the
+ * specified partition type.
+ *
+ * @param partitionType
+ * the partition type for which to determine the reconciling
+ * strategy
+ *
+ * @return the reconciling strategy registered for the given partition
+ * type, or <code>null</code> if there is no such strategy
+ *
+ * @see org.eclipse.jface.text.reconciler.IReconciler#getReconcilingStrategy(java.lang.String)
+ */
+ public IReconcilingStrategy getReconcilingStrategy(String partitionType) {
+ if (partitionType == null)
+ return null;
+ return (IReconcilingStrategy) fReconcilingStrategies.get(partitionType);
+ }
+
+ /**
+ * This method also synchronized because it accesses the fRequests queue
+ *
+ * @return an array of the currently requested Nodes to refresh
+ */
+ private synchronized DirtyRegion[] getRequests() {
+ synchronized (fDirtyRegionQueue) {
+ DirtyRegion[] toRefresh = (DirtyRegion[]) fDirtyRegionQueue.toArray(new DirtyRegion[fDirtyRegionQueue.size()]);
+ flushDirtyRegionQueue();
+ return toRefresh;
+ }
+ }
+
+ /**
+ * Returns the text viewer this reconciler is installed on.
+ *
+ * @return the text viewer this reconciler is installed on
+ */
+ protected ITextViewer getTextViewer() {
+ return fViewer;
+ }
+
+ /**
+ *
+ * @param oldInput
+ * @param newInput
+ */
+ void handleInputDocumentChanged(IDocument oldInput, IDocument newInput) {
+ // don't bother if reconciler not installed
+ if (isInstalled()) {
+ setDocument(newInput);
+ }
+ }
+
+ /**
+ * @see org.eclipse.jface.text.reconciler.IReconciler#install(ITextViewer)
+ */
+ public void install(ITextViewer textViewer) {
+ // we might be called multiple times with the same viewe.r,
+ // maybe after being uninstalled as well, so track separately
+ if (!isInstalled()) {
+ fViewer = textViewer;
+ fTextInputListener = new TextInputListener();
+ textViewer.addTextInputListener(fTextInputListener);
+ setInstalled(true);
+ }
+ synchronized (this) {
+ if (fThread == null)
+ fThread = new BackgroundThread(getClass().getName());
+ }
+ }
+
+ /**
+ * The viewer has been set on this Reconciler.
+ *
+ * @return true if the viewer has been set on this Reconciler, false
+ * otherwise.
+ */
+ public boolean isInstalled() {
+ return fIsInstalled;
+ }
+
+ boolean isInRewriteSession() {
+ return fInRewriteSession;
+ }
+
+ /**
+ * Subclasses should implement for specific handling of dirty regions. The
+ * method is invoked for each dirty region in the Job's queue.
+ *
+ * @param dirtyRegion
+ */
+ protected void process(DirtyRegion dirtyRegion) {
+ if (!isInstalled() || isInRewriteSession() || dirtyRegion == null || getDocument() == null || fIsCanceled) {
+ return;
+ }
+ /*
+ * Break the dirty region into a sequence of partitions and find the
+ * corresponding strategy to reconcile those partitions. If a strategy
+ * implements INonIncrementalReconcilingStrategy, only call it once
+ * regardless of the number and types of partitions.
+ */
+ ITypedRegion[] partitions = computePartitioning(dirtyRegion);
+ for (int i = 0; i < partitions.length && !fIsCanceled; i++) {
+ IReconcilingStrategy strategy = getReconcilingStrategy(partitions[i].getType());
+ if (strategy != null) {
+ strategy.reconcile(partitions[i]);
+ }
+ }
+ }
+
+ /**
+ * Invoke dirty region processing.
+ *
+ * @param node
+ */
+ public final void processDirtyRegion(DirtyRegion dr) {
+ if (dr == null || !isInstalled())
+ return;
+
+ addRequest(dr);
+ synchronized (LOCK) {
+ fReset = true;
+ }
+
+ if (DEBUG) {
+ System.out.println("added request for: [" + dr.getText() + "]"); //$NON-NLS-1$ //$NON-NLS-2$
+ System.out.println("queue size is now: " + getDirtyRegionQueue().size()); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Based on {@link org.eclipse.jface.text.reconciler.AbstractReconciler.BackgroundThread}
+ *
+ */
+ class BackgroundThread extends Thread {
+
+ public BackgroundThread(String name) {
+ super(name);
+ setPriority(Thread.MIN_PRIORITY);
+ setDaemon(true);
+ }
+
+ public void cancel() {
+ synchronized (fDirtyRegionQueue) {
+ fDirtyRegionQueue.notifyAll();
+ }
+ }
+
+ public void run() {
+ synchronized (fDirtyRegionQueue) {
+ try {
+ fDirtyRegionQueue.wait(getDelay());
+ } catch (InterruptedException e) {}
+ }
+
+ if (fIsCanceled)
+ return;
+
+ if (!fHasReconciled) {
+ initialReconcile();
+ fHasReconciled = true;
+ }
+
+ while (!fIsCanceled) {
+ synchronized (fDirtyRegionQueue) {
+ try {
+ fDirtyRegionQueue.wait(getDelay());
+ } catch (InterruptedException e) {}
+ }
+
+ if (fIsCanceled)
+ return;
+
+ synchronized (LOCK) {
+ if (fReset) {
+ fReset = false;
+ continue;
+ }
+ }
+
+ boolean processed = false;
+ try {
+ DirtyRegion[] toRefresh = getRequests();
+ if (toRefresh.length > 0) {
+ processed = true;
+ beginProcessing();
+ }
+
+ for (int i = 0; i < toRefresh.length && fDocument != null; i++) {
+ if (fIsCanceled)
+ return;
+ process(toRefresh[i]);
+ }
+ }
+ finally {
+ if (processed)
+ endProcessing();
+ }
+
+ }
+ }
+ }
+
+ public void setDelay(long delay) {
+ fDelay = delay;
+ }
+
+ public void setDocument(IDocument doc) {
+ if (fDocument != null) {
+ // unhook old document listener
+ fDocument.removeDocumentListener(fDocumentListener);
+ if (fDocument instanceof IDocumentExtension4) {
+ ((IDocumentExtension4) fDocument).removeDocumentRewriteSessionListener(fDocumentRewriteSessionListener);
+ }
+ }
+
+ fDocument = doc;
+
+ if (fDocument != null) {
+ if (fDocument instanceof IDocumentExtension4) {
+ ((IDocumentExtension4) fDocument).addDocumentRewriteSessionListener(fDocumentRewriteSessionListener);
+ }
+ // hook up new document listener
+ fDocument.addDocumentListener(fDocumentListener);
+
+ setEntireDocumentDirty(doc);
+ }
+ }
+
+ /**
+ * This method is called before the initial reconciling of the document.
+ */
+ protected void initialReconcile() {
+ }
+
+ /**
+ * Sets the document partitioning for this reconciler.
+ *
+ * @param partitioning
+ * the document partitioning for this reconciler
+ */
+ public void setDocumentPartitioning(String partitioning) {
+ fPartitioning = partitioning;
+ }
+
+ /**
+ * Forces reconciling of the entire document.
+ */
+ protected void forceReconciling() {
+ if (!fHasReconciled)
+ return;
+
+ setEntireDocumentDirty(getDocument());
+ }
+
+ /**
+ * Basically means process the entire document.
+ *
+ * @param document
+ */
+ protected void setEntireDocumentDirty(IDocument document) {
+
+ // make the entire document dirty
+ // this also happens on a "save as"
+ if (document != null && isInstalled()) {
+
+ // since we're marking the entire doc dirty
+ flushDirtyRegionQueue();
+
+ /**
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=199053
+ *
+ * Process the strategies for the last known-good partitions to
+ * ensure all problem annotations are cleared if needed.
+ */
+ if (fLastPartitions != null && document.getLength() == 0) {
+ for (int i = 0; i < fLastPartitions.length; i++) {
+ IReconcilingStrategy strategy = getReconcilingStrategy(fLastPartitions[i].getType());
+ if (strategy != null) {
+ strategy.reconcile(fLastPartitions[i]);
+ }
+ }
+ }
+ else {
+ DirtyRegion entireDocument = createDirtyRegion(0, document.getLength(), DirtyRegion.INSERT);
+ processDirtyRegion(entireDocument);
+ }
+ }
+ }
+
+ /**
+ * @param isInstalled
+ * The isInstalled to set.
+ */
+ void setInstalled(boolean isInstalled) {
+ fIsInstalled = isInstalled;
+ }
+
+ public void setReconcilingStrategy(String partitionType, IReconcilingStrategy strategy) {
+ if (partitionType == null) {
+ throw new IllegalArgumentException();
+ }
+
+ if (strategy == null) {
+ fReconcilingStrategies.remove(partitionType);
+ }
+ else {
+ fReconcilingStrategies.put(partitionType, strategy);
+ }
+ }
+
+ /**
+ * @see org.eclipse.jface.text.reconciler.IReconciler#uninstall()
+ */
+ public void uninstall() {
+ if (isInstalled()) {
+ // removes widget listener
+ getTextViewer().removeTextInputListener(fTextInputListener);
+ setInstalled(false);
+ fIsCanceled = true;
+ synchronized (this) {
+ BackgroundThread bt = fThread;
+ fThread= null;
+ bt.cancel();
+ }
+ }
+ synchronized (fDirtyRegionQueue) {
+ fDirtyRegionQueue.clear();
+ }
+ setDocument(null);
+ }
+
+ protected synchronized void startReconciling() {
+ if (fThread == null)
+ return;
+ if (!fThread.isAlive()) {
+ try {
+ fThread.start();
+ } catch (IllegalThreadStateException e) { }
+ }
+ }
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/xpl/DirtyRegionProcessor.java
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ text/plain
13 years, 8 months
JBoss Tools SVN: r42982 - in trunk: common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2012-08-10 17:40:20 -0400 (Fri, 10 Aug 2012)
New Revision: 42982
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/AsYouTypeValidatorManager.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java
Log:
https://issues.jboss.org/browse/JBIDE-12417 KB validators should report problems in order as they appears in the file.
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java 2012-08-10 21:35:24 UTC (rev 42981)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java 2012-08-10 21:40:20 UTC (rev 42982)
@@ -10,8 +10,8 @@
******************************************************************************/
package org.jboss.tools.common.el.core.resolver;
+import java.util.Collection;
import java.util.List;
-import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.IRegion;
@@ -79,7 +79,7 @@
*
* @return
*/
- Set<ELReference> getELReferences(IRegion region);
+ Collection<ELReference> getELReferences(IRegion region);
/**
* Returns true if the file was modified in some editor and has not been saved yet.
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java 2012-08-10 21:35:24 UTC (rev 42981)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java 2012-08-10 21:40:20 UTC (rev 42982)
@@ -11,10 +11,9 @@
package org.jboss.tools.common.el.core.resolver;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
@@ -145,8 +144,8 @@
}
@Override
- public synchronized Set<ELReference> getELReferences(IRegion region) {
- Set<ELReference> references = new HashSet<ELReference>();
+ public synchronized Collection<ELReference> getELReferences(IRegion region) {
+ List<ELReference> references = new ArrayList<ELReference>();
if(elReferenceSet != null) {
for (ELReference ref: elReferenceSet) {
if(region.getOffset() + region.getLength() >= ref.getStartPosition() && region.getOffset() <= ref.getStartPosition() + ref.getLength()) {
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java 2012-08-10 21:35:24 UTC (rev 42981)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java 2012-08-10 21:40:20 UTC (rev 42982)
@@ -11,9 +11,9 @@
package org.jboss.tools.common.el.core.resolver;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
-import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.IRegion;
@@ -111,8 +111,8 @@
}
@Override
- public Set<ELReference> getELReferences(IRegion region) {
- return Collections.emptySet();
+ public Collection<ELReference> getELReferences(IRegion region) {
+ return Collections.emptyList();
}
/*
Modified: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/AsYouTypeValidatorManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/AsYouTypeValidatorManager.java 2012-08-10 21:35:24 UTC (rev 42981)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/AsYouTypeValidatorManager.java 2012-08-10 21:40:20 UTC (rev 42982)
@@ -55,6 +55,7 @@
private EditorValidationContext context;
private Map<IValidator, IProject> rootProjects;
private int count;
+ private static boolean disabled;
private static Set<IDocument> reporters = new HashSet<IDocument>();
@@ -130,6 +131,9 @@
}
private boolean init(IValidationContext helper, IReporter reporter) {
+ if(disabled) {
+ return false;
+ }
if(context==null) {
synchronized (reporters) {
reporters.add(document);
@@ -222,4 +226,16 @@
@Override
public void validate(IValidationContext helper, IReporter reporter) throws ValidationException {
}
+
+ public static boolean isDisabled() {
+ return disabled;
+ }
+
+ /**
+ * Disable As-you-type validation
+ * @param disabled
+ */
+ public static void setDisabled(boolean disabled) {
+ AsYouTypeValidatorManager.disabled = disabled;
+ }
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java 2012-08-10 21:35:24 UTC (rev 42981)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java 2012-08-10 21:40:20 UTC (rev 42982)
@@ -258,13 +258,10 @@
this.document = validationContext.getDocument();
ELContext elContext = PageContextFactory.createPageContext(validationContext.getDocument(), true);
elContext.setDirty(true);
- Set<ELReference> references = null;
- if(dirtyRegions.size()==1) {
- references = elContext.getELReferences(dirtyRegions.iterator().next());
- } else {
- ELReference[] ref = elContext.getELReferences();
- references = new HashSet<ELReference>(ref.length);
- for (ELReference elReference : ref) {
+ Collection<ELReference> references = new ArrayList<ELReference>();
+ for (IRegion region : dirtyRegions) {
+ Collection<ELReference> regionReferences = elContext.getELReferences(region);
+ for (ELReference elReference : regionReferences) {
references.add(elReference);
}
}
13 years, 8 months
JBoss Tools SVN: r42981 - trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-08-10 17:35:24 -0400 (Fri, 10 Aug 2012)
New Revision: 42981
Modified:
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java
Log:
JBIDE-12405
As-you-type validation works slow when many strings are being added
Partition to process are stored in a list insteado of a set due to allow ordering.
Modified: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java 2012-08-10 19:29:39 UTC (rev 42980)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java 2012-08-10 21:35:24 UTC (rev 42981)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.validation.java;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
@@ -73,7 +74,7 @@
private boolean fIsCanceled = false;
private boolean fInRewriteSession = false;
private IDocumentRewriteSessionListener fDocumentRewriteSessionListener = new DocumentRewriteSessionListener();
- private Set<ITypedRegion> fPartitionsToProcess = new HashSet<ITypedRegion>();
+ private List<ITypedRegion> fPartitionsToProcess = new ArrayList<ITypedRegion>();
private int fStartPartitionsToProcess = -1;
private int fEndPartitionsToProcess = -1;
private int fStartRegionToProcess = -1;
@@ -231,7 +232,6 @@
}
if (message instanceof ValidationMessage && getAnnotationModel() != null) {
ValidationMessage valMessage = (ValidationMessage)message;
-
IEditorInput editorInput= fEditor.getEditorInput();
if (editorInput != null) {
boolean cleanAllAnnotations = Boolean.TRUE.equals(message.getAttribute(TempMarkerManager.CLEAN_ALL_ANNOTATIONS_ATTRIBUTE));
@@ -361,6 +361,7 @@
protected void process(DirtyRegion dirtyRegion) {
IDocument doc = getDocument();
+
if (!isEditorDirty() || !isInstalled() || isInRewrite() || dirtyRegion == null || doc == null || fIsCanceled) {
return;
}
@@ -420,17 +421,13 @@
protected void endProcessing() {
if (fValidatorManager == null || fReporter == null || fStartPartitionsToProcess == -1 || fEndPartitionsToProcess == -1)
return;
-// long t = System.currentTimeMillis();
-// String message = "";
fReporter.clearAnnotations(fStartPartitionsToProcess, fEndPartitionsToProcess);
if (fPartitionsToProcess != null && !fPartitionsToProcess.isEmpty()) {
fValidatorManager.validateString(
Arrays.asList(fPartitionsToProcess.toArray(new IRegion[fPartitionsToProcess.size()])),
fHelper, fReporter);
-// message += "; validateString: " + fPartitionsToProcess.size() + " regions; ";
}
-// else { message += "; validateString: 0 regions; "; }
if (isJavaElementValidationRequired()) {
fReporter.clearAlwaysRemoveAnnotations();
@@ -440,12 +437,10 @@
new Region(fStartRegionToProcess, fEndRegionToProcess - fStartRegionToProcess)
}),
fHelper, fReporter);
-// message += "; validateJavaElement: one region";
}
-// else { message += "; validateJavaElement: 0 regions"; }
-// System.out.println("[" + (System.currentTimeMillis() - t) + "ms]: " + message);
}
+
private boolean isJavaElementValidationRequired() {
ICompilationUnit unit = fReporter.getCompilationUnit();
if (unit == null)
13 years, 8 months
JBoss Tools SVN: r42980 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-08-10 15:29:39 -0400 (Fri, 10 Aug 2012)
New Revision: 42980
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/JarAccess.java
Log:
JBIDE-12416
https://issues.jboss.org/browse/JBIDE-12416
Support jar entries that start with /.
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/JarAccess.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/JarAccess.java 2012-08-10 19:04:17 UTC (rev 42979)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/JarAccess.java 2012-08-10 19:29:39 UTC (rev 42980)
@@ -213,6 +213,9 @@
boolean first = true;
try {
ZipEntry entry = jar.getEntry(path);
+ if(entry == null && fileEntries.containsKey("/" + path)) {
+ entry = jar.getEntry("/" + path);
+ }
if(entry == null) {
String error = "JarAccess: cannot obtain entry for path '" + path + "' from jar '" + location + "'."; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
errors.add(error);
13 years, 8 months