JBoss Tools SVN: r37631 - trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-01-04 04:12:06 -0500 (Wed, 04 Jan 2012)
New Revision: 37631
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriMappingsContentProvider.java
Log:
Working on JBIDE-10425
Sometimes, the 'JAX-RS REST Web Services' node remains in a 'Building..' state(https://issues.jboss.org/browse/JBIDE-10425)
Preventing reentrant call while viewer is busy
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriMappingsContentProvider.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriMappingsContentProvider.java 2012-01-04 09:08:21 UTC (rev 37630)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/cnf/UriMappingsContentProvider.java 2012-01-04 09:12:06 UTC (rev 37631)
@@ -19,9 +19,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.jdt.internal.ui.util.CoreUtility;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.TreePath;
@@ -56,21 +54,13 @@
if (parentElement instanceof IProject) {
long startTime = new Date().getTime();
- IProject project = (IProject) parentElement;
+ final IProject project = (IProject) parentElement;
try {
if (!uriPathTemplateCategories.containsKey(project)) {
if (JaxrsMetamodelLocator.get(project) == null) {
Logger.debug("JAX-RS Metamodel needs to be built for project '" + project.getName() + "'");
Job buildJob = CoreUtility.getBuildJob(project);
buildJob.setRule(ResourcesPlugin.getWorkspace().getRoot());
- // be notified when job is done to refresh navigator
- // content.
- buildJob.addJobChangeListener(new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- refreshContent((IProject) parentElement);
- }
- });
buildJob.schedule();
return new Object[] { new WaitWhileBuildingElement() };
}
@@ -138,26 +128,18 @@
Logger.debug("Refreshing navigator view");
final Object target = uriPathTemplateCategories.containsKey(project) ? uriPathTemplateCategories.get(project)
: project;
- if (Display.getCurrent() != null) {
- if (viewer != null) {
- TreePath[] treePaths = viewer.getExpandedTreePaths();
- viewer.refresh(target);
- viewer.setExpandedTreePaths(treePaths);
- }
- } else {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- if (viewer != null) {
- TreePath[] treePaths = viewer.getExpandedTreePaths();
- viewer.refresh(target);
- viewer.setExpandedTreePaths(treePaths);
- }
+ // this piece of code must run in an async manner to avoid reentrant call while viewer is busy.
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (viewer != null) {
+ TreePath[] treePaths = viewer.getExpandedTreePaths();
+ viewer.refresh(target);
+ viewer.setExpandedTreePaths(treePaths);
}
- });
- }
+ }
+ });
}
-
@Override
/**
* Subscriber ID
12 years, 11 months
JBoss Tools SVN: r37630 - in trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal: utils and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-01-04 04:08:21 -0500 (Wed, 04 Jan 2012)
New Revision: 37630
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuildJob.java
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/Logger.java
Log:
Handling Cancelled Operation
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuildJob.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuildJob.java 2012-01-04 08:43:37 UTC (rev 37629)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JaxrsMetamodelBuildJob.java 2012-01-04 09:08:21 UTC (rev 37630)
@@ -42,24 +42,32 @@
try {
progressMonitor.beginTask("Building JAX-RS Metamodel", 4 * SCALE);
progressMonitor.worked(SCALE);
- Logger.debug("Building JAX-RS Metamodel...", event);
+ Logger.debug("Building JAX-RS Metamodel...");
+ if (progressMonitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
// create fake event at the JavaProject level:
// scan and filter delta, retrieve a list of java changes
final List<JavaElementChangedEvent> events = new JavaElementChangedEventScanner().scanAndFilterEvent(event,
new SubProgressMonitor(progressMonitor, SCALE));
- if (events == null || events.isEmpty()) {
- Logger.debug("** No Java change to apply on the JAX-RS Metamodel **");
+ if (progressMonitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ final List<JaxrsElementChangedEvent> jaxrsElementChanges = javaElementChangedProcessor.processEvents(
+ events, new SubProgressMonitor(progressMonitor, SCALE));
+ if (progressMonitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ final List<JaxrsEndpointChangedEvent> jaxrsEndpointChanges = jaxrsElementChangedProcessor.processEvents(
+ jaxrsElementChanges, new SubProgressMonitor(progressMonitor, SCALE));
+ if (progressMonitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ if (jaxrsEndpointChanges == null || jaxrsEndpointChanges.isEmpty()) {
+ Logger.debug("*** No JAX-RS change to publish to the UI ***");
} else {
- final List<JaxrsElementChangedEvent> jaxrsElementChanges = javaElementChangedProcessor.processEvents(
- events, new SubProgressMonitor(progressMonitor, SCALE));
- final List<JaxrsEndpointChangedEvent> jaxrsEndpointChanges = jaxrsElementChangedProcessor
- .processEvents(jaxrsElementChanges, new SubProgressMonitor(progressMonitor, SCALE));
- if (jaxrsEndpointChanges == null || jaxrsEndpointChanges.isEmpty()) {
- Logger.debug("*** No JAX-RS change to publish to the UI ***");
- } else {
- for (JaxrsEndpointChangedEvent change : jaxrsEndpointChanges) {
- EventService.getInstance().publish(change);
- }
+ for (JaxrsEndpointChangedEvent change : jaxrsEndpointChanges) {
+ EventService.getInstance().publish(change);
}
}
} catch (Throwable e) {
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/Logger.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/Logger.java 2012-01-04 08:43:37 UTC (rev 37629)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/utils/Logger.java 2012-01-04 09:08:21 UTC (rev 37630)
@@ -63,8 +63,13 @@
* the throwable cause
*/
public static void error(final String message, final Throwable t) {
+ if(JBossJaxrsCorePlugin.getDefault() != null) {
JBossJaxrsCorePlugin.getDefault().getLog()
.log(new Status(Status.ERROR, JBossJaxrsCorePlugin.PLUGIN_ID, message, t));
+ } else {
+ // at least write in the .log file
+ t.printStackTrace();
+ }
}
/**
12 years, 11 months
JBoss Tools SVN: r37629 - trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-01-04 03:43:37 -0500 (Wed, 04 Jan 2012)
New Revision: 37629
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedEvent.java
Log:
Reverting a refactoring that caused a test failure :-/
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedEvent.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedEvent.java 2012-01-04 02:59:36 UTC (rev 37628)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/builder/JavaElementChangedEvent.java 2012-01-04 08:43:37 UTC (rev 37629)
@@ -173,7 +173,8 @@
int result = 1;
result = prime * result + deltaKind;
result = prime * result + eventType;
- result = prime * result + ((element == null) ? 0 : element.getHandleIdentifier().hashCode());
+ result = prime * result + ((element == null) ? 0 : element.getElementType());
+ result = prime * result + ((element == null) ? 0 : element.getElementName().hashCode());
result = prime * result + flags;
return result;
}
@@ -206,7 +207,8 @@
} else if (this.element != null && other.element == null) {
return false;
} else if (this.element != null && other.element != null
- && !element.getHandleIdentifier().equals(other.element.getHandleIdentifier())) {
+ && (!element.getElementName().equals(other.element.getElementName())
+ || element.getElementType() != other.element.getElementType())) {
return false;
}
if (flags != other.flags) {
12 years, 11 months
JBoss Tools SVN: r37628 - trunk/openshift/docs/reference/en-US.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2012-01-03 21:59:36 -0500 (Tue, 03 Jan 2012)
New Revision: 37628
Modified:
trunk/openshift/docs/reference/en-US/Book_Info.xml
Log:
updated for brew
Modified: trunk/openshift/docs/reference/en-US/Book_Info.xml
===================================================================
--- trunk/openshift/docs/reference/en-US/Book_Info.xml 2012-01-04 02:55:39 UTC (rev 37627)
+++ trunk/openshift/docs/reference/en-US/Book_Info.xml 2012-01-04 02:59:36 UTC (rev 37628)
@@ -13,7 +13,7 @@
<edition>5.0.0</edition>
- <pubsnumber>4</pubsnumber>
+ <pubsnumber>5</pubsnumber>
<abstract>
<para>
12 years, 11 months
JBoss Tools SVN: r37627 - trunk/documentation/guides/GettingStartedGuide/en-US.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2012-01-03 21:55:39 -0500 (Tue, 03 Jan 2012)
New Revision: 37627
Modified:
trunk/documentation/guides/GettingStartedGuide/en-US/Book_Info.xml
trunk/documentation/guides/GettingStartedGuide/en-US/getting_started.xml
Log:
updated to add info about wizards creating maven projects
Modified: trunk/documentation/guides/GettingStartedGuide/en-US/Book_Info.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en-US/Book_Info.xml 2012-01-04 01:51:31 UTC (rev 37626)
+++ trunk/documentation/guides/GettingStartedGuide/en-US/Book_Info.xml 2012-01-04 02:55:39 UTC (rev 37627)
@@ -8,7 +8,7 @@
<productname>JBoss Developer Studio</productname>
<productnumber>5.0</productnumber>
<edition>5.0.0</edition>
-<pubsnumber>3</pubsnumber>
+<pubsnumber>4</pubsnumber>
<abstract>
<para>The Getting Started Guide explains the JBoss Developer Studio.</para>
</abstract>
Modified: trunk/documentation/guides/GettingStartedGuide/en-US/getting_started.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en-US/getting_started.xml 2012-01-04 01:51:31 UTC (rev 37626)
+++ trunk/documentation/guides/GettingStartedGuide/en-US/getting_started.xml 2012-01-04 02:55:39 UTC (rev 37627)
@@ -159,6 +159,11 @@
</imageobject>
</inlinemediaobject>.
</para>
+ <note>
+ <para>
+ All wizards generate Maven based projects, except for the <guilabel>Dynamic Web Project</guilabel> wizard.
+ </para>
+ </note>
<figure>
<title>Creating a Project</title>
<mediaobject>
12 years, 11 months
JBoss Tools SVN: r37626 - trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2012-01-03 20:51:31 -0500 (Tue, 03 Jan 2012)
New Revision: 37626
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/RenameNamedBeanWizard.java
Log:
EL refactoring for @Named beans doesn't work properly https://issues.jboss.org/browse/JBIDE-10210
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/RenameNamedBeanWizard.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/RenameNamedBeanWizard.java 2012-01-04 01:48:55 UTC (rev 37625)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/RenameNamedBeanWizard.java 2012-01-04 01:51:31 UTC (rev 37626)
@@ -12,16 +12,11 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.util.Map;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
-import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -29,7 +24,6 @@
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.internal.core.refactoring.RenameNamedBeanProcessor;
import org.jboss.tools.cdi.ui.CDIUIMessages;
-import org.jboss.tools.common.ui.IValidator;
import org.jboss.tools.common.ui.refactoring.JBDSRefactoringWizard;
import org.jboss.tools.common.ui.widget.editor.CompositeEditor;
import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
12 years, 11 months
JBoss Tools SVN: r37625 - trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2012-01-03 20:48:55 -0500 (Tue, 03 Jan 2012)
New Revision: 37625
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/RenameNamedBeanWizard.java
Log:
EL refactoring for @Named beans doesn't work properly https://issues.jboss.org/browse/JBIDE-10210
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/RenameNamedBeanWizard.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/RenameNamedBeanWizard.java 2012-01-04 01:44:46 UTC (rev 37624)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/RenameNamedBeanWizard.java 2012-01-04 01:48:55 UTC (rev 37625)
@@ -30,6 +30,7 @@
import org.jboss.tools.cdi.internal.core.refactoring.RenameNamedBeanProcessor;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.common.ui.IValidator;
+import org.jboss.tools.common.ui.refactoring.JBDSRefactoringWizard;
import org.jboss.tools.common.ui.widget.editor.CompositeEditor;
import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
import org.jboss.tools.common.ui.widget.editor.IFieldEditorFactory;
@@ -37,7 +38,7 @@
/**
* @author Daniel Azarov
*/
-public class RenameNamedBeanWizard extends RefactoringWizard {
+public class RenameNamedBeanWizard extends JBDSRefactoringWizard {
private IBean bean;
private String componentName;
12 years, 11 months
JBoss Tools SVN: r37624 - in trunk/hibernatetools/docs/reference/en-US: images/plugins and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2012-01-03 20:44:46 -0500 (Tue, 03 Jan 2012)
New Revision: 37624
Modified:
trunk/hibernatetools/docs/reference/en-US/images/plugins/plugins_2.png
trunk/hibernatetools/docs/reference/en-US/plugins.xml
Log:
updated with new screenshot and screenshot description changes
Modified: trunk/hibernatetools/docs/reference/en-US/images/plugins/plugins_2.png
===================================================================
(Binary files differ)
Modified: trunk/hibernatetools/docs/reference/en-US/plugins.xml
===================================================================
--- trunk/hibernatetools/docs/reference/en-US/plugins.xml 2012-01-04 01:35:40 UTC (rev 37623)
+++ trunk/hibernatetools/docs/reference/en-US/plugins.xml 2012-01-04 01:44:46 UTC (rev 37624)
@@ -178,7 +178,7 @@
<para>Description</para>
</entry>
<entry align="center">
- <para>Auto detected value</para>
+ <para>Default value</para>
</entry>
</row>
</thead>
@@ -200,11 +200,14 @@
</entry>
<entry>
<para>
- Choose between "Core", "Annotations" and "JPA". Note that the two latter requires running Eclipse IDE with a JDK 5 runtime, otherwise you will get class loading and/or version errors.
+ Choose between "Core", "Annotations" and "JPA". Note that the two latter requires running Eclipse IDE with a JDK 5 runtime, otherwise you will get class loading and version errors.
</para>
+ <para>
+ You will also need to select the version of Hibernate your application server has. Select a version from the drop-down box labelled <guilabel>Hibernate Version</guilabel>.
+ </para>
</entry>
<entry>
- <para>No default value</para>
+ <para><guilabel>Hibernate Version:</guilabel> 3.5</para>
</entry>
</row>
<row>
12 years, 11 months
JBoss Tools SVN: r37623 - in trunk: common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2012-01-03 20:35:40 -0500 (Tue, 03 Jan 2012)
New Revision: 37623
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationErrorManager.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/EclipseUIUtil.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
Log:
https://issues.jboss.org/browse/JBIDE-10536 Java Seam and CDI quick fixes: after quick fix, editor is scrolled to the beginning. If Undo/Redo commands are used, the entire file content gets selected
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2012-01-04 00:40:06 UTC (rev 37622)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2012-01-04 01:35:40 UTC (rev 37623)
@@ -34,7 +34,6 @@
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.ISourceRange;
@@ -94,7 +93,6 @@
import org.jboss.tools.common.java.IParametedType;
import org.jboss.tools.common.java.ITypeDeclaration;
import org.jboss.tools.common.java.ParametedType;
-import org.jboss.tools.common.java.TypeDeclaration;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.text.INodeReference;
@@ -360,7 +358,7 @@
Set<IFile> filesToValidate = new HashSet<IFile>();
for (IPath linkedResource : resources) {
IFile file = root.getFile(linkedResource);
- if(file.isAccessible()) {
+ if(shouldBeValidated(file)) {
IProject pr = file.getProject();
if(!validationHelper.getValidationContextManager().projectHasBeenValidated(this, pr)) {
filesToValidate.add(file);
@@ -2361,6 +2359,9 @@
boolean shouldValidateResourceOfElement(IResource resource) {
// validate existing sources only
+ if(resource instanceof IFile && !shouldBeValidated((IFile)resource)) {
+ return false;
+ }
return resource != null && resource.exists() && resource.getName().toLowerCase().endsWith(".java");
}
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/EclipseUIUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/EclipseUIUtil.java 2012-01-04 00:40:06 UTC (rev 37622)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/util/EclipseUIUtil.java 2012-01-04 01:35:40 UTC (rev 37623)
@@ -10,6 +10,9 @@
******************************************************************************/
package org.jboss.tools.common.util;
+import java.util.HashSet;
+import java.util.Set;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
@@ -69,4 +72,27 @@
}
return false;
}
+
+ /**
+ * Returns all the modified but not saved files which are opened with all the editors.
+ * @return
+ */
+ public static Set<IFile> getDirtyFiles() {
+ Set<IFile> dirtyFiles = new HashSet<IFile>();
+ IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
+ for (IWorkbenchWindow window : windows) {
+ IWorkbenchPage page = window.getActivePage();
+ if (page != null) {
+ IEditorPart[] editors = page.getDirtyEditors();
+ for (IEditorPart editor : editors) {
+ IEditorInput input = editor.getEditorInput();
+ if(input instanceof IFileEditorInput) {
+ IFile file = ((IFileEditorInput)input).getFile();
+ dirtyFiles.add(file);
+ }
+ }
+ }
+ }
+ return dirtyFiles;
+ }
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationErrorManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationErrorManager.java 2012-01-04 00:40:06 UTC (rev 37622)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/ValidationErrorManager.java 2012-01-04 01:35:40 UTC (rev 37623)
@@ -14,6 +14,7 @@
import java.util.HashSet;
import java.util.Set;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -38,6 +39,7 @@
import org.jboss.tools.common.preferences.SeverityPreferences;
import org.jboss.tools.common.text.ITextSourceReference;
import org.jboss.tools.common.util.EclipseJavaUtil;
+import org.jboss.tools.common.util.EclipseUIUtil;
/**
* @author Alexey Kazakov
@@ -61,6 +63,7 @@
protected String markerId;
protected IProjectValidationContext validationContext;
protected TextFileDocumentProvider documentProvider;
+ protected Set<IFile> dirtyFiles;
private String messageIdQuickFixAttributeName;
@@ -90,6 +93,7 @@
setReporter(reporter);
setValidationContext(validationContext);
setMarkerId(org.jboss.tools.common.validation.IValidator.MARKED_RESOURCE_MESSAGE_GROUP);
+ dirtyFiles = EclipseUIUtil.getDirtyFiles();
}
public void init(IProject project, ContextValidationHelper validationHelper, IProjectValidationContext validationContext, IValidator manager, IReporter reporter, String messageIdQuickFixAttributeName) {
@@ -97,6 +101,10 @@
setMessageIdQuickFixAttributeName(messageIdQuickFixAttributeName);
}
+ protected boolean shouldBeValidated(IFile file) {
+ return file.isAccessible() && !dirtyFiles.contains(file);
+ }
+
/**
* @param validationManager the validationManager to set
*/
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-01-04 00:40:06 UTC (rev 37622)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java 2012-01-04 01:35:40 UTC (rev 37623)
@@ -160,7 +160,7 @@
Set<IFile> filesToValidate = new HashSet<IFile>();
boolean containsJavaOrComponentsXml = false;
for (IFile file : changedFiles) {
- if(file.isAccessible() && notValidatedYet(file)) {
+ if(shouldBeValidated(file) && notValidatedYet(file)) {
filesToValidate.add(file);
if(!containsJavaOrComponentsXml) {
String fileName = file.getName().toLowerCase();
@@ -174,7 +174,7 @@
Set<IPath> unnamedResources = validationContext.getUnnamedElResources();
for (IPath path : unnamedResources) {
IFile file = wsRoot.getFile(path);
- if(file.isAccessible() && notValidatedYet(file)) {
+ if(shouldBeValidated(file) && notValidatedYet(file)) {
filesToValidate.add(file);
}
}
@@ -224,7 +224,7 @@
Set<IFile> files = validationHelper.getProjectSetRegisteredFiles();
Set<IFile> filesToValidate = new HashSet<IFile>();
for (IFile file : files) {
- if(file.isAccessible()) {
+ if(shouldBeValidated(file)) {
if(notValidatedYet(file)) {
filesToValidate.add(file);
}
@@ -271,7 +271,7 @@
}
private void validateEL(ELReference el) {
- if(!reporter.isCancelled()) {
+ if(!reporter.isCancelled() && shouldBeValidated(el.getResource())) {
displaySubtask(ELValidationMessages.VALIDATING_EL_FILE, new String[]{el.getResource().getProject().getName(), el.getResource().getName()});
el.deleteMarkers();
for (ELExpression expresion : el.getEl()) {
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2012-01-04 00:40:06 UTC (rev 37622)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2012-01-04 01:35:40 UTC (rev 37623)
@@ -298,7 +298,7 @@
// We have to remove markers from all collected source files first
for (IPath linkedResource : resources) {
IFile file = root.getFile(linkedResource);
- if(file!=null && file.isAccessible()) {
+ if(file!=null && shouldBeValidated(file)) {
filesToValidate.add(file);
removeAllMessagesFromResource(file);
}
12 years, 11 months
JBoss Tools SVN: r37622 - in trunk/jst/tests/org.jboss.tools.jst.web.test: src/org/jboss/tools/jst/web/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-03 19:40:06 -0500 (Tue, 03 Jan 2012)
New Revision: 37622
Added:
trunk/jst/tests/org.jboss.tools.jst.web.test/projects/testWebProject/WebContent/WEB-INF/web30.xml
trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebAppHelperTest.java
Modified:
trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/JstWebAllTests.java
Log:
JBIDE-10579
https://issues.joss.org/browse/JBIDE-10579
Tests are added.
Added: trunk/jst/tests/org.jboss.tools.jst.web.test/projects/testWebProject/WebContent/WEB-INF/web30.xml
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.test/projects/testWebProject/WebContent/WEB-INF/web30.xml (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.web.test/projects/testWebProject/WebContent/WEB-INF/web30.xml 2012-01-04 00:40:06 UTC (rev 37622)
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<web-app version="3.0" 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/web-app_3_0.xsd">
+ <display-name>jsf2</display-name>
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.htm</welcome-file>
+ <welcome-file>index.jsp</welcome-file>
+ <welcome-file>default.html</welcome-file>
+ <welcome-file>default.htm</welcome-file>
+ <welcome-file>default.jsp</welcome-file>
+ </welcome-file-list>
+<filter-mapping>
+ <filter-name>compressionFilter</filter-name>
+ <url-pattern>*</url-pattern>
+ </filter-mapping>
+
+ <filter>
+ <display-name>CompressionFilter</display-name>
+ <filter-name>compressionFilter</filter-name>
+ <filter-class>demo.CompressionFilter</filter-class>
+ <init-param>
+ <param-name>compressionThreshold</param-name>
+ <param-value>500</param-value> <!-- compress anything above 1kb -->
+ </init-param>
+ <init-param>
+ <param-name>ignoreURLPattern</param-name>
+ <param-value>.*\.(flv|mp3|mpg)</param-value> <!-- regex -->
+ </init-param>
+ <init-param>
+ <param-name>ignoreMimes</param-name>
+ <param-value>images/*,video/*, multipart/x-gzip</param-value> <!-- ignore -->
+ </init-param>
+ <init-param>
+ <param-name>ignoreUserAgentsPattern</param-name>
+ <param-value>.*MSIE.*</param-value> <!-- regex -->
+ </init-param>
+ </filter>
+</web-app>
Property changes on: trunk/jst/tests/org.jboss.tools.jst.web.test/projects/testWebProject/WebContent/WEB-INF/web30.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/JstWebAllTests.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/JstWebAllTests.java 2012-01-04 00:38:59 UTC (rev 37621)
+++ trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/JstWebAllTests.java 2012-01-04 00:40:06 UTC (rev 37622)
@@ -25,7 +25,8 @@
suite.addTestSuite(WebContentAssistProviderTest.class);
// suite.addTestSuite(BuilderTest.class);
suite.addTest(new WebValidationTestSetup(new TestSuite(
- WebUtilTest.class,
+ WebUtilTest.class,
+ WebAppHelperTest.class,
WebXMLValidationTest.class)));
return suite;
}
Added: trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebAppHelperTest.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebAppHelperTest.java (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebAppHelperTest.java 2012-01-04 00:40:06 UTC (rev 37622)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * 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.tools.jst.web.test;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.jboss.tools.common.base.test.validation.TestUtil;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.jst.web.WebUtils;
+import org.jboss.tools.jst.web.model.helpers.WebAppHelper;
+import org.jboss.tools.test.util.ProjectImportTestSetup;
+import org.jboss.tools.test.util.ResourcesUtils;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class WebAppHelperTest extends TestCase {
+
+ private IProject project;
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ project = getTestProject();
+ }
+
+ public IProject getTestProject() {
+ if(project==null) {
+ try {
+ project = findTestProject();
+ if(project==null || !project.exists()) {
+ project = ResourcesUtils.importProject(JstWebAllTests.PLUGIN_ID, JstWebAllTests.PROJECT_PATH);
+ TestUtil._waitForValidation(project);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Can't import CDI test project: " + e.getMessage());
+ }
+ }
+ return project;
+ }
+
+ public static IProject findTestProject() {
+ return ResourcesPlugin.getWorkspace().getRoot().getProject(JstWebAllTests.PROJECT_NAME);
+ }
+
+ /**
+ * See https://issues.jboss.org/browse/JBIDE-10579
+ * @throws Exception
+ */
+ public void testFilters() throws Exception {
+ XModelObject o = getWebXML30();
+
+ assertEquals("3.0", WebAppHelper.getServletVersion(o));
+
+ XModelObject[] fs = WebAppHelper.getFilters(o);
+ assertEquals(1, fs.length);
+
+ XModelObject[] ms = WebAppHelper.getFilterMappings(o);
+ assertEquals(1, ms.length);
+ }
+
+ public void testServlets() throws Exception {
+ XModelObject o = getWebXML30();
+
+ XModelObject s = WebAppHelper.findOrCreateServlet(o, "a.b.C", "C", 0);
+
+ XModelObject[] ss = WebAppHelper.getServlets(o);
+ assertEquals(1, ss.length);
+ assertTrue(s == ss[0]);
+
+ }
+
+ private XModelObject getWebXML30() {
+ IFile f = project.getFile("WebContent/WEB-INF/web30.xml");
+ assertTrue(f.exists());
+ XModelObject o = EclipseResourceUtil.createObjectForResource(f);
+ assertNotNull(o);
+ return o;
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/tests/org.jboss.tools.jst.web.test/src/org/jboss/tools/jst/web/test/WebAppHelperTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
12 years, 11 months