JBoss Tools SVN: r42445 - in trunk/common/plugins/org.jboss.tools.common.el.core: src/org/jboss/tools/common/el/core and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-07-06 18:05:56 -0400 (Fri, 06 Jul 2012)
New Revision: 42445
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ElCoreMessages.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/messages.properties
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELSegmentImpl.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/JavaMemberELSegmentImpl.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/Var.java
Log:
JBIDE-12295
https://issues.jboss.org/browse/JBIDE-12295
Open-on for variable declared by ui:param.
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF 2012-07-06 17:59:16 UTC (rev 42444)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF 2012-07-06 22:05:56 UTC (rev 42445)
@@ -26,6 +26,7 @@
org.eclipse.core.resources;bundle-version="3.7.100",
org.eclipse.jdt.core;bundle-version="3.7.0",
org.eclipse.core.runtime;bundle-version="3.7.0",
- org.jboss.tools.common
+ org.jboss.tools.common,
+ org.eclipse.ui.ide
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: .
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ElCoreMessages.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ElCoreMessages.java 2012-07-06 17:59:16 UTC (rev 42444)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ElCoreMessages.java 2012-07-06 22:05:56 UTC (rev 42445)
@@ -37,6 +37,7 @@
public static String Open;
public static String OpenBundle;
public static String OpenBundleProperty;
+ public static String OpenVarDefinition;
static {
// initialize resource bundle
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java 2012-07-06 17:59:16 UTC (rev 42444)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java 2012-07-06 22:05:56 UTC (rev 42445)
@@ -318,6 +318,7 @@
sufixIsNotResolved = !segment.isResolved();
}
firstSegment = segment;
+ ((ELSegmentImpl)firstSegment).setVar(var);
((ELSegmentImpl)firstSegment).setToken(firstOriginalToken);
((ELSegmentImpl)firstSegment).setResolved(!sufixIsNotResolved);
// if(firstSegment instanceof JavaMemberELSegmentImpl) {
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/messages.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/messages.properties 2012-07-06 17:59:16 UTC (rev 42444)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/messages.properties 2012-07-06 22:05:56 UTC (rev 42445)
@@ -31,3 +31,4 @@
OpenBundle=Open bundle ''{0}''
OpenBundleProperty=Open property ''{0}'' of bundle ''{1}''
+OpenVarDefinition=Open Definition of ''{0}''
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELSegmentImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELSegmentImpl.java 2012-07-06 17:59:16 UTC (rev 42444)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELSegmentImpl.java 2012-07-06 22:05:56 UTC (rev 42445)
@@ -10,10 +10,21 @@
******************************************************************************/
package org.jboss.tools.common.el.core.resolver;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.ide.IDE;
+import org.jboss.tools.common.el.core.ELCorePlugin;
+import org.jboss.tools.common.el.core.ElCoreMessages;
import org.jboss.tools.common.el.core.parser.LexicalToken;
import org.jboss.tools.common.text.ITextSourceReference;
@@ -28,6 +39,7 @@
protected boolean resolved = false;
protected boolean validatable = true;
protected List<IVariable> variables = new ArrayList<IVariable>();
+ protected Var var = null;
public ELSegmentImpl(LexicalToken token) {
this.token = token;
@@ -59,13 +71,44 @@
}
return sourceReference;
}
-
+
/**
* Default empty implementation. Subclasses should override this method.
*
* @return
*/
public IOpenableReference[] getOpenable() {
+ if(var != null) {
+ IOpenableReference result = new IOpenableReference() {
+ @Override
+ public boolean open() {
+ IEditorPart part = null;
+ IWorkbenchWindow window = ELCorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
+ if (window == null) return false;
+ IWorkbenchPage page = window.getActivePage();
+ try {
+ part = IDE.openEditor(page, var.getFile());
+ } catch (PartInitException e) {
+ ELCorePlugin.getDefault().logError(e);
+ }
+ if(part != null) {
+ part.getEditorSite().getSelectionProvider().setSelection(new TextSelection(var.getDeclarationOffset(), var.getDeclarationLength()));
+ }
+ return false;
+ }
+
+ @Override
+ public String getLabel() {
+ return MessageFormat.format(ElCoreMessages.OpenVarDefinition, var.getName());
+ }
+
+ @Override
+ public Image getImage() {
+ return null;
+ }
+ };
+ return new IOpenableReference[]{result};
+ }
return new IOpenableReference[0];
}
@@ -148,4 +191,12 @@
public void setValidatable(boolean validatable) {
this.validatable = validatable;
}
+
+ public void setVar(Var var) {
+ this.var = var;
+ }
+
+ public Var getVar() {
+ return var;
+ }
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java 2012-07-06 17:59:16 UTC (rev 42444)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java 2012-07-06 22:05:56 UTC (rev 42445)
@@ -171,7 +171,9 @@
public static List<Var> findAllVars(ELContext context, int offset, ELResolver resolver) {
Node node = getNode(context.getResource(), offset);
if(node!=null) {
- return findAllVars(node, resolver.getParserFactory());
+ List<Var> result = findAllVars(node, resolver.getParserFactory());
+ for (Var v: result) v.setFile(context.getResource());
+ return result;
}
return Collections.emptyList();
}
@@ -184,7 +186,9 @@
public static List<Var> findAllVars(IFile file, int offset, ELParserFactory factory) {
Node node = getNode(file, offset);
if(node!=null) {
- return findAllVars(node, factory);
+ List<Var> result = findAllVars(node, factory);
+ for (Var v: result) v.setFile(file);
+ return result;
}
return Collections.emptyList();
}
@@ -234,7 +238,9 @@
public Var findVar(IFile file, int offset) {
Node node = getNode(file, offset);
if(node!=null) {
- return findVar(node);
+ Var result = findVar(node);
+ if(result != null) result.setFile(file);
+ return result;
}
return null;
}
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/JavaMemberELSegmentImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/JavaMemberELSegmentImpl.java 2012-07-06 17:59:16 UTC (rev 42444)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/JavaMemberELSegmentImpl.java 2012-07-06 22:05:56 UTC (rev 42445)
@@ -171,6 +171,7 @@
}
public IOpenableReference[] getOpenable() {
+ IOpenableReference[] os = super.getOpenable();
if(getJavaElement() != null && getJavaElement().exists()) {
IOpenableReference openable = new IOpenableReference() {
@Override
@@ -211,9 +212,10 @@
return null;
}
};
+ if(os.length == 1) return new IOpenableReference[]{os[0], openable};
return new IOpenableReference[]{openable};
}
- return new IOpenableReference[0];
+ return os;
}
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/Var.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/Var.java 2012-07-06 17:59:16 UTC (rev 42444)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/Var.java 2012-07-06 22:05:56 UTC (rev 42445)
@@ -12,6 +12,7 @@
import java.util.List;
+import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.Region;
import org.jboss.tools.common.el.core.model.ELExpression;
import org.jboss.tools.common.el.core.model.ELInstance;
@@ -24,6 +25,7 @@
* @author Alexey Kazakov
*/
public class Var {
+ IFile file;
String name;
String value;
ELExpression elToken;
@@ -160,4 +162,12 @@
public void setRegion(Region region) {
this.region = region;
}
+
+ public void setFile(IFile file) {
+ this.file = file;
+ }
+
+ public IFile getFile() {
+ return file;
+ }
}
\ No newline at end of file
13 years, 9 months
JBoss Tools SVN: r42444 - 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-07-06 13:59:16 -0400 (Fri, 06 Jul 2012)
New Revision: 42444
Modified:
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java
Log:
JBIDE-10611
As-you-type CDI validation
CDI-like validators are invoked if text is changed outside of a method.
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-07-06 17:15:52 UTC (rev 42443)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java 2012-07-06 17:59:16 UTC (rev 42444)
@@ -18,6 +18,8 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.compiler.CategorizedProblem;
import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.ProblemAnnotation;
import org.eclipse.jdt.ui.text.IJavaPartitions;
@@ -31,7 +33,7 @@
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.ITypedRegion;
import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.TypedRegion;
+import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.reconciler.DirtyRegion;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.IAnnotationModel;
@@ -60,7 +62,6 @@
@SuppressWarnings("restriction")
final public class JavaDirtyRegionProcessor extends
DirtyRegionProcessor {
-
/**
* This constant is put as value to JavaELProblemReporter.fAnnotations(Annotation, Position)
* to indicate that in JavaELProblemReporter.clearAnnotations(int start, int end)
@@ -78,9 +79,10 @@
private boolean fInRewriteSession = false;
private IDocumentRewriteSessionListener fDocumentRewriteSessionListener = new DocumentRewriteSessionListener();
private Set<ITypedRegion> fPartitionsToProcess = new HashSet<ITypedRegion>();
- private boolean fDoJavaElementProcessing = false;
private int fStartPartitionsToProcess = -1;
private int fEndPartitionsToProcess = -1;
+ private int fStartRegionToProcess = -1;
+ private int fEndRegionToProcess = -1;
// AsYouType EL Validation 'marker type' name.
// marker type is used in the quickFixProcessor extension point
@@ -148,6 +150,10 @@
return fAnnotationModel;
}
+ public ICompilationUnit getCompilationUnit() {
+ return fCompilationUnit;
+ }
+
private void clearAllAnnotations() {
if (fAnnotations.isEmpty()) {
return;
@@ -479,9 +485,10 @@
@Override
protected void beginProcessing() {
fPartitionsToProcess.clear();
+ fStartRegionToProcess = -1;
+ fEndRegionToProcess = -1;
fStartPartitionsToProcess = -1;
fEndPartitionsToProcess = -1;
- fDoJavaElementProcessing = false;
}
protected void process(DirtyRegion dirtyRegion) {
@@ -502,6 +509,9 @@
start = docLen;
if (end >= docLen)
end = docLen - 1;
+
+ fStartRegionToProcess = (fStartRegionToProcess == -1 || fStartRegionToProcess > start) ? start : fStartRegionToProcess;
+ fEndRegionToProcess = (fEndRegionToProcess == -1 || fEndRegionToProcess < end) ? end : fEndRegionToProcess;
/*
* Expand dirtyRegion to partitions boundaries
@@ -537,32 +547,69 @@
if (IJavaPartitions.JAVA_STRING.equals(partition.getType()) && !fPartitionsToProcess.contains(partition)) {
fPartitionsToProcess.add(partition);
}
-
- fDoJavaElementProcessing |= isJavaElementPartition(partition);
}
}
}
@Override
protected void endProcessing() {
- if (fValidatorManager == null || fPartitionsToProcess.isEmpty() || fStartPartitionsToProcess == -1 || fEndPartitionsToProcess == -1)
+ if (fValidatorManager == null || fReporter == null || fStartPartitionsToProcess == -1 || fEndPartitionsToProcess == -1)
return;
- if (fReporter != null) {
- fReporter.clearAnnotations(fStartPartitionsToProcess, fEndPartitionsToProcess);
- }
+ fReporter.clearAnnotations(fStartPartitionsToProcess, fEndPartitionsToProcess);
+
for (ITypedRegion partition : fPartitionsToProcess) {
fValidatorManager.validateString(partition, fHelper, fReporter);
}
- if (fDoJavaElementProcessing) {
- ITypedRegion partition = new TypedRegion(fStartPartitionsToProcess, fEndPartitionsToProcess - fStartPartitionsToProcess, IJavaPartitions.JAVA_PARTITIONING);
- fValidatorManager.validateJavaElement(partition, fHelper, fReporter);
+ if (isJavaElementValidationRequired(fStartRegionToProcess, fEndRegionToProcess)) {
+ fValidatorManager.validateJavaElement(new Region(fStartPartitionsToProcess, fEndPartitionsToProcess - fStartPartitionsToProcess), fHelper, fReporter);
}
}
- private boolean isJavaElementPartition(ITypedRegion partition) {
- return true;
+ private boolean isJavaElementValidationRequired(int start, int end) {
+ ICompilationUnit unit = fReporter.getCompilationUnit();
+ if (unit == null)
+ return false;
+
+ boolean result = false;
+ boolean atLeastOneElementIsProcessed = false;
+ int position = start;
+ try {
+ IJavaElement element = null;
+ while (position >= 0 && (element = unit.getElementAt(position--)) == null)
+ ;
+
+ if (position < 0)
+ position = 0;
+
+ while (position < end) {
+ element = unit.getElementAt(position++);
+ if (element != null) {
+ atLeastOneElementIsProcessed = true;
+ if (element.getElementType() == IJavaElement.METHOD)
+ continue;
+
+ IJavaElement parent = element.getParent();
+ boolean doSkipThisElement = false;
+ while (parent != null && parent.getElementType() != IJavaElement.COMPILATION_UNIT) {
+ if (parent.getElementType() == IJavaElement.METHOD) {
+ doSkipThisElement = true;
+ break;
+ }
+ parent = parent.getParent();
+ }
+
+ if (!doSkipThisElement)
+ return true;
+ }
+ }
+ } catch (JavaModelException e) {
+ LogHelper.logError(CommonValidationPlugin.getDefault(), e);
+ }
+
+ result = atLeastOneElementIsProcessed ? result : true;
+ return result ;
}
}
\ No newline at end of file
13 years, 9 months
JBoss Tools SVN: r42443 - trunk/central/plugins/org.jboss.tools.central.discovery.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-07-06 13:15:52 -0400 (Fri, 06 Jul 2012)
New Revision: 42443
Modified:
trunk/central/plugins/org.jboss.tools.central.discovery/plugin.xml
Log:
JBDS-2220 add connector to Central for 'Mylyn for Subclipse + SVNKit' - JBDS2220-trunk.patch
Modified: trunk/central/plugins/org.jboss.tools.central.discovery/plugin.xml
===================================================================
--- trunk/central/plugins/org.jboss.tools.central.discovery/plugin.xml 2012-07-06 17:13:59 UTC (rev 42442)
+++ trunk/central/plugins/org.jboss.tools.central.discovery/plugin.xml 2012-07-06 17:15:52 UTC (rev 42443)
@@ -298,6 +298,35 @@
url="http://subclipse.tigris.org/">
</overview>
</connectorDescriptor>
+ <connectorDescriptor
+ categoryId="org.jboss.tools.central.discovery.scm"
+ groupId="org.jboss.tools.central.discovery.scm.svn"
+ description="Mylyn support for the Subversion version control system, including SVNKit"
+ id="org.tigris.subversion.subclipse.mylyn"
+ kind="task"
+ license="Free, Subclipse License"
+ name="Mylyn for Subclipse + SVNKit"
+ provider="tigris.org"
+ siteUrl="http://download.jboss.org/jbosstools/updates/development/juno/central/core/">
+ <iu id="org.tigris.subversion.subclipse"/>
+ <iu id="org.tigris.subversion.clientadapter.svnkit.feature"/>
+ <iu id="org.tigris.subversion.subclipse.mylyn"/>
+ <iu id="org.eclipse.mylyn_feature"/>
+ <iu id="org.eclipse.mylyn.ide_feature"/>
+ <iu id="org.eclipse.mylyn.commons"/>
+ <iu id="org.eclipse.mylyn.context_feature"/>
+ <iu id="org.eclipse.mylyn.bugzilla_feature"/>
+ <iu id="org.eclipse.mylyn.java_feature"/>
+ <iu id="org.eclipse.mylyn.pde_feature"/>
+ <iu id="org.eclipse.mylyn.team_feature"/>
+ <iu id="org.eclipse.mylyn.versions"/>
+ <icon
+ image32="images/subclipse_32.gif">
+ </icon>
+ <overview
+ url="http://subclipse.tigris.org/">
+ </overview>
+ </connectorDescriptor>
<!-- Testing -->
13 years, 9 months
JBoss Tools SVN: r42442 - branches/jbosstools-3.3.x/central/plugins/org.jboss.tools.central.discovery.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-07-06 13:13:59 -0400 (Fri, 06 Jul 2012)
New Revision: 42442
Modified:
branches/jbosstools-3.3.x/central/plugins/org.jboss.tools.central.discovery/plugin.xml
Log:
JBDS-2220 add connector to Central for 'Mylyn for Subclipse + SVNKit' - JBDS2220-33x.patch
Modified: branches/jbosstools-3.3.x/central/plugins/org.jboss.tools.central.discovery/plugin.xml
===================================================================
--- branches/jbosstools-3.3.x/central/plugins/org.jboss.tools.central.discovery/plugin.xml 2012-07-06 15:26:33 UTC (rev 42441)
+++ branches/jbosstools-3.3.x/central/plugins/org.jboss.tools.central.discovery/plugin.xml 2012-07-06 17:13:59 UTC (rev 42442)
@@ -298,6 +298,35 @@
url="http://subclipse.tigris.org/">
</overview>
</connectorDescriptor>
+ <connectorDescriptor
+ categoryId="org.jboss.tools.central.discovery.scm"
+ groupId="org.jboss.tools.central.discovery.scm.svn"
+ description="Mylyn support for the Subversion version control system, including SVNKit"
+ id="org.tigris.subversion.subclipse.mylyn"
+ kind="task"
+ license="Free, Subclipse License"
+ name="Mylyn for Subclipse + SVNKit"
+ provider="tigris.org"
+ siteUrl="http://download.jboss.org/jbosstools/updates/stable/indigo/central/core/">
+ <iu id="org.tigris.subversion.subclipse"/>
+ <iu id="org.tigris.subversion.clientadapter.svnkit.feature"/>
+ <iu id="org.tigris.subversion.subclipse.mylyn"/>
+ <iu id="org.eclipse.mylyn_feature"/>
+ <iu id="org.eclipse.mylyn.ide_feature"/>
+ <iu id="org.eclipse.mylyn.commons"/>
+ <iu id="org.eclipse.mylyn.context_feature"/>
+ <iu id="org.eclipse.mylyn.bugzilla_feature"/>
+ <iu id="org.eclipse.mylyn.java_feature"/>
+ <iu id="org.eclipse.mylyn.pde_feature"/>
+ <iu id="org.eclipse.mylyn.team_feature"/>
+ <iu id="org.eclipse.mylyn.versions"/>
+ <icon
+ image32="images/subclipse_32.gif">
+ </icon>
+ <overview
+ url="http://subclipse.tigris.org/">
+ </overview>
+ </connectorDescriptor>
<!-- Testing -->
13 years, 9 months
JBoss Tools SVN: r42441 - 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-07-06 11:26:33 -0400 (Fri, 06 Jul 2012)
New Revision: 42441
Modified:
trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java
Log:
JBIDE-10611
As-you-type CDI validation
CDI-like validators are re-enabled.
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-07-06 13:32:45 UTC (rev 42440)
+++ trunk/common/plugins/org.jboss.tools.common.validation/src/org/jboss/tools/common/validation/java/JavaDirtyRegionProcessor.java 2012-07-06 15:26:33 UTC (rev 42441)
@@ -31,6 +31,7 @@
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.ITypedRegion;
import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.TypedRegion;
import org.eclipse.jface.text.reconciler.DirtyRegion;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.IAnnotationModel;
@@ -77,6 +78,7 @@
private boolean fInRewriteSession = false;
private IDocumentRewriteSessionListener fDocumentRewriteSessionListener = new DocumentRewriteSessionListener();
private Set<ITypedRegion> fPartitionsToProcess = new HashSet<ITypedRegion>();
+ private boolean fDoJavaElementProcessing = false;
private int fStartPartitionsToProcess = -1;
private int fEndPartitionsToProcess = -1;
@@ -235,6 +237,7 @@
this.problem = problem;
}
+ @SuppressWarnings("rawtypes")
public Map getAttributes() {
return problem.getAttributes();
}
@@ -380,6 +383,7 @@
return MARKER_TYPE;
}
+ @SuppressWarnings("rawtypes")
public Map getAttributes(){
return vMessage.getAttributes();
}
@@ -477,6 +481,7 @@
fPartitionsToProcess.clear();
fStartPartitionsToProcess = -1;
fEndPartitionsToProcess = -1;
+ fDoJavaElementProcessing = false;
}
protected void process(DirtyRegion dirtyRegion) {
@@ -528,8 +533,12 @@
fReporter.clearAnnotations(start, end);
}
for (ITypedRegion partition : partitions) {
- if (partition != null && !fIsCanceled && IJavaPartitions.JAVA_STRING.equals(partition.getType()) && !fPartitionsToProcess.contains(partition)) {
- fPartitionsToProcess.add(partition);
+ if (partition != null && !fIsCanceled) {
+ if (IJavaPartitions.JAVA_STRING.equals(partition.getType()) && !fPartitionsToProcess.contains(partition)) {
+ fPartitionsToProcess.add(partition);
+ }
+
+ fDoJavaElementProcessing |= isJavaElementPartition(partition);
}
}
}
@@ -543,7 +552,17 @@
fReporter.clearAnnotations(fStartPartitionsToProcess, fEndPartitionsToProcess);
}
for (ITypedRegion partition : fPartitionsToProcess) {
- fValidatorManager.validate(partition, fHelper, fReporter);
+ fValidatorManager.validateString(partition, fHelper, fReporter);
}
+
+ if (fDoJavaElementProcessing) {
+ ITypedRegion partition = new TypedRegion(fStartPartitionsToProcess, fEndPartitionsToProcess - fStartPartitionsToProcess, IJavaPartitions.JAVA_PARTITIONING);
+ fValidatorManager.validateJavaElement(partition, fHelper, fReporter);
+ }
}
+
+ private boolean isJavaElementPartition(ITypedRegion partition) {
+ return true;
+ }
+
}
\ No newline at end of file
13 years, 9 months
JBoss Tools SVN: r42440 - in trunk/maven/plugins: org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/xpl and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2012-07-06 09:32:45 -0400 (Fri, 06 Jul 2012)
New Revision: 42440
Added:
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/xpl/ArtifactHelper.java
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/xpl/WTPProjectsUtil.java
Modified:
trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF
trunk/maven/plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/configurators/JaxrsProjectConfigurator.java
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/META-INF/MANIFEST.MF
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/JBossPackagingArchiverConfigurator.java
trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/SarProjectConfigurator.java
trunk/maven/plugins/org.jboss.tools.maven.project.examples/META-INF/MANIFEST.MF
Log:
JBIDE-12293 : ensure compatibility with eclipse.org's m2e-wtp
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF 2012-07-06 12:57:02 UTC (rev 42439)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/META-INF/MANIFEST.MF 2012-07-06 13:32:45 UTC (rev 42440)
@@ -15,18 +15,20 @@
org.eclipse.m2e.core;bundle-version="[1.0,1.2)";visibility:=reexport,
org.eclipse.m2e.maven.runtime;bundle-version="[1.0,1.2)";visibility:=reexport,
org.eclipse.jdt.core;visibility:=reexport,
- org.eclipse.m2e.jdt;bundle-version="[1.0,1.2)";visibility:=reexport,
+ org.eclipse.m2e.jdt;bundle-version="[1.0,2.0)";visibility:=reexport,
org.eclipse.jst.j2ee;visibility:=reexport,
org.eclipse.jst.j2ee.web;visibility:=reexport,
org.jboss.tools.common;visibility:=reexport,
org.eclipse.jdt.launching;visibility:=reexport,
org.eclipse.ui.workbench;visibility:=reexport,
- org.eclipse.m2e.model.edit;bundle-version="[1.0,1.2)";visibility:=reexport,
+ org.eclipse.m2e.model.edit;bundle-version="[1.0,2.0)";visibility:=reexport,
org.eclipse.core.expressions,
- org.maven.ide.eclipse.wtp;bundle-version="[0.13.0,0.17.0)";visibility:=reexport,
+ org.maven.ide.eclipse.wtp;bundle-version="[0.13.0,0.16.0)";resolution:=optional;visibility:=reexport,
org.eclipse.jdt.ui;bundle-version="3.7.0",
org.eclipse.jpt.common.core;bundle-version="1.0.0",
- org.eclipse.jpt.jpa.core
+ org.eclipse.jpt.jpa.core,
+ org.eclipse.wst.common.emfworkbench.integration,
+ org.eclipse.m2e.wtp;bundle-version="0.16.0";resolution:=optional
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %Bundle-Vendor
Added: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/xpl/ArtifactHelper.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/xpl/ArtifactHelper.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/xpl/ArtifactHelper.java 2012-07-06 13:32:45 UTC (rev 42440)
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Sonatype, Inc.
+ * 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
+ *******************************************************************************/
+
+package org.jboss.tools.maven.core.xpl;
+
+import java.util.Collection;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.m2e.core.MavenPlugin;
+import org.eclipse.m2e.core.embedder.ArtifactKey;
+import org.eclipse.m2e.core.project.IMavenProjectFacade;
+import org.eclipse.m2e.jdt.internal.BuildPathManager;
+import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
+
+
+/**
+ *
+ * Helper for Maven artifacts. Class copied from m2e-wtp.
+ *
+ * @author Fred Bricon
+ */
+//XXX Should probably be refactored to another Maven helper class.
+@SuppressWarnings("restriction")
+public class ArtifactHelper {
+
+ private static final String M2_REPO_PREFIX = VirtualArchiveComponent.VARARCHIVETYPE + IPath.SEPARATOR
+ + BuildPathManager.M2_REPO + IPath.SEPARATOR;
+
+ /**
+ * Returns an artifact's path relative to the local repository
+ */
+ //XXX Does maven API provide that kind of feature?
+ public static IPath getLocalRepoRelativePath(Artifact artifact) {
+ if (artifact == null) {
+ throw new IllegalArgumentException("artifact must not be null");
+ }
+
+ IPath m2repo = JavaCore.getClasspathVariable(BuildPathManager.M2_REPO); //always set
+ IPath absolutePath = new Path(artifact.getFile().getAbsolutePath());
+ IPath relativePath = absolutePath.removeFirstSegments(m2repo.segmentCount()).makeRelative().setDevice(null);
+ return relativePath;
+ }
+
+ /**
+ * Returns an IProject from a maven artifact
+ * @param artifact
+ * @return an IProject if the artifact is a workspace project or null
+ */
+ public static IProject getWorkspaceProject(Artifact artifact) {
+ IMavenProjectFacade facade = getWorkspaceProjectMavenFacade(artifact);
+ return (facade == null)?null:facade.getProject();
+ }
+
+ /**
+ * Returns an IMavenProjectFacade from a maven artifact
+ * @param artifact
+ * @return an IMavenProjectFacade if the artifact is a workspace project or null
+ */
+ public static IMavenProjectFacade getWorkspaceProjectMavenFacade(Artifact artifact) {
+ IMavenProjectFacade workspaceProject = MavenPlugin.getMavenProjectRegistry()
+ .getMavenProject(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion());
+
+ if(workspaceProject != null && workspaceProject.getFullPath(artifact.getFile()) != null) {
+ return workspaceProject;
+ }
+ return null;
+ }
+
+ /**
+ * Returns the M2_REPO variable path for an artifact. ex : var/M2_REPO/groupid/artifactid/version/filename
+ * @param artifact
+ * @return the M2_REPO variable path for the artifact, null if the artifact is a workspace project
+ */
+ public static String getM2REPOVarPath(Artifact artifact)
+ {
+ if (getWorkspaceProject(artifact) != null)
+ {
+ return null;
+ }
+ return M2_REPO_PREFIX + ArtifactHelper.getLocalRepoRelativePath(artifact).toPortableString();
+ }
+
+ /**
+ * Temporary fix for app-client type artifacts, where the artifactHandler is not correctly loaded
+ * thus the extension and the addtoclasspath value are incorrect.
+ * @param artifactHandler
+ */
+ @Deprecated
+ public static void fixArtifactHandler(ArtifactHandler artifactHandler) {
+ if ("app-client".equals(artifactHandler.getExtension()) && artifactHandler instanceof DefaultArtifactHandler) {
+ ((DefaultArtifactHandler)artifactHandler).setExtension("jar");
+ ((DefaultArtifactHandler)artifactHandler).setAddedToClasspath(true);
+ }
+ }
+
+ public static Artifact getArtifact(Collection<Artifact> artifacts, ArtifactKey key) {
+ if (artifacts == null || key == null || artifacts.isEmpty()) {
+ return null;
+ }
+ for (Artifact a : artifacts) {
+ ArtifactKey ak = toArtifactKey(a);
+ if (key.equals(ak)) {
+ return a;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets an ArtifactKey from an Artifact. This method fixes the flawed ArtifactKey(Artifact a) constructor
+ * which doesn't copy the artifact classifier;
+ */
+ public static ArtifactKey toArtifactKey(Artifact a) {
+ return new ArtifactKey(a.getGroupId(), a.getArtifactId(), a.getBaseVersion(), a.getClassifier());
+ }
+
+}
Added: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/xpl/WTPProjectsUtil.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/xpl/WTPProjectsUtil.java (rev 0)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/xpl/WTPProjectsUtil.java 2012-07-06 13:32:45 UTC (rev 42440)
@@ -0,0 +1,596 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Sonatype, Inc.
+ * 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
+ *******************************************************************************/
+
+package org.jboss.tools.maven.core.xpl;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.project.MavenProject;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IClasspathAttribute;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jst.common.project.facet.core.JavaFacet;
+import org.eclipse.jst.common.project.facet.core.internal.JavaFacetUtil;
+import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
+import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.m2e.core.internal.IMavenConstants;
+import org.eclipse.m2e.core.project.IMavenProjectFacade;
+import org.eclipse.m2e.core.project.MavenProjectUtils;
+import org.eclipse.m2e.jdt.internal.MavenClasspathHelpers;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.common.componentcore.internal.ComponentResource;
+import org.eclipse.wst.common.componentcore.internal.StructureEdit;
+import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
+import org.eclipse.wst.common.componentcore.internal.impl.ResourceTreeNode;
+import org.eclipse.wst.common.componentcore.internal.impl.ResourceTreeRoot;
+import org.eclipse.wst.common.componentcore.internal.util.FacetedProjectUtilities;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject.Action;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+/**
+ * Utility class for WTP projects. Copied from m2e-wtp.
+ *
+ * @author Fred Bricon
+ */
+@SuppressWarnings("restriction")
+public class WTPProjectsUtil {
+
+ public static final IProjectFacet UTILITY_FACET = ProjectFacetsManager.getProjectFacet(IJ2EEFacetConstants.UTILITY);
+
+ public static final IProjectFacetVersion UTILITY_10 = UTILITY_FACET.getVersion("1.0");
+
+ public static final IProjectFacet EJB_FACET = ProjectFacetsManager.getProjectFacet(IJ2EEFacetConstants.EJB);
+
+ public static final IProjectFacet JCA_FACET = ProjectFacetsManager.getProjectFacet(IJ2EEFacetConstants.JCA);
+
+ public static final IProjectFacet WEB_FRAGMENT_FACET = ProjectFacetsManager.getProjectFacet(IJ2EEFacetConstants.WEBFRAGMENT);
+
+ public static final IProjectFacetVersion WEB_FRAGMENT_3_0 = WEB_FRAGMENT_FACET.getVersion("3.0");
+
+ public static final IProjectFacet DYNAMIC_WEB_FACET = ProjectFacetsManager
+ .getProjectFacet(IJ2EEFacetConstants.DYNAMIC_WEB);
+
+ public static final IProjectFacet APP_CLIENT_FACET = ProjectFacetsManager.getProjectFacet(IJ2EEFacetConstants.APPLICATION_CLIENT);
+
+ public static final IClasspathAttribute NONDEPENDENCY_ATTRIBUTE = JavaCore.newClasspathAttribute(
+ IClasspathDependencyConstants.CLASSPATH_COMPONENT_NON_DEPENDENCY, "");
+
+ /**
+ * Defaults Web facet version to 2.5
+ */
+ public static final IProjectFacetVersion DEFAULT_WEB_FACET = DYNAMIC_WEB_FACET.getVersion("2.5");
+
+ public static final IProjectFacet EAR_FACET = ProjectFacetsManager
+ .getProjectFacet(IJ2EEFacetConstants.ENTERPRISE_APPLICATION);
+
+ /**
+ * Checks if a project has a given class in its classpath
+ * @param project : the workspace project
+ * @param className : the fully qualified name of the class to search for
+ * @return true if className is found in the project's classpath (provided the project is a JavaProject and its classpath has been set.)
+ */
+ public static boolean hasInClassPath(IProject project, String className) {
+ boolean result = false;
+ if (project != null){
+ IJavaProject javaProject = JavaCore.create(project);
+ try {
+ if (javaProject!= null && javaProject.findType(className)!=null){
+ result = true;
+ }
+ } catch(JavaModelException ex) {
+ //Ignore this
+ }
+ }
+ return result;
+ }
+
+
+ /**
+ * Checks if the project is one of Dynamic Web, EJB, Application client, EAR or JCA project.
+ * @param project - the project to be checked.
+ * @return true if the project is a JEE - or legacy J2EE - project (but not a utility project).
+ */
+ public static boolean isJavaEEProject(IProject project) {
+ return (J2EEProjectUtilities.isLegacyJ2EEProject(project) || J2EEProjectUtilities.isJEEProject(project)) && !JavaEEProjectUtilities.isUtilityProject(project);
+ }
+
+ /**
+ * Delete a project's component resources having a given runtimePath
+ * @param project - the project to modify
+ * @param runtimePath - the component resource runtime path (i.e. deploy path)
+ * @param monitor - an eclipse monitor
+ * @throws CoreException
+ */
+ public static void deleteLinks(IProject project, IPath runtimePath, IProgressMonitor monitor) throws CoreException {
+ deleteLinks(project, runtimePath, null, monitor);
+ }
+
+ /**
+ * Delete a project's component resources having a given runtimePath
+ * @param project - the project to modify
+ * @param runtimePath - the component resource runtime path (i.e. deploy path)
+ * @param sourcePathToKeep - the list of source paths to keep
+ * @param monitor - an eclipse monitor
+ * @throws CoreException
+ */
+ public static void deleteLinks(IProject project, IPath runtimePath, List<IPath> sourcePathToKeep, IProgressMonitor monitor) throws CoreException {
+ //Looks like WTP'APIS doesn't have such feature, hence this implementation.
+ StructureEdit moduleCore = null;
+ try {
+ moduleCore = StructureEdit.getStructureEditForWrite(project);
+ if (moduleCore == null) {
+ return;
+ }
+ WorkbenchComponent component = moduleCore.getComponent();
+ if (component == null) {
+ return;
+ }
+ ResourceTreeRoot root = ResourceTreeRoot.getDeployResourceTreeRoot(component);
+ ComponentResource[] resources = root.findModuleResources(runtimePath, 0);
+ for (ComponentResource link : resources) {
+ if (runtimePath.equals(link.getRuntimePath()) &&
+ (sourcePathToKeep == null || !sourcePathToKeep.contains(link.getSourcePath()))) {
+ component.getResources().remove(link);
+ }
+ }
+ }
+ finally {
+ if (moduleCore != null) {
+ moduleCore.saveIfNecessary(monitor);
+ moduleCore.dispose();
+ }
+ }
+ }
+
+ public static void insertLinkBefore(IProject project, IPath newSource, IPath referenceSource, IPath runtimePath, IProgressMonitor monitor) throws CoreException {
+ //Looks like WTP'APIS doesn't have such feature, hence this implementation.
+ StructureEdit moduleCore = null;
+ try {
+ moduleCore = StructureEdit.getStructureEditForWrite(project);
+ if (moduleCore == null) {
+ return;
+ }
+ WorkbenchComponent component = moduleCore.getComponent();
+ if (component == null) {
+ return;
+ }
+
+ int i = 0;
+ int refPosition = -1;
+ int newSourcePosition = -1;
+ List<ComponentResource> resources = component.getResources();
+
+ for (ComponentResource resource : resources) {
+ IPath sourcePath = resource.getSourcePath();
+ if (referenceSource.equals(sourcePath)) {
+ refPosition = i;
+ } else if (newSource.equals(sourcePath)) {
+ newSourcePosition = i;
+ }
+ if (refPosition > -1 && newSourcePosition > -1) {
+ break;
+ }
+ i++;
+ }
+ if (refPosition < 0) {
+ refPosition = i;
+ }
+ IResource folder = project.getFolder(newSource);
+ if (newSourcePosition > refPosition) {
+ component.getResources().move(newSourcePosition, refPosition);
+ } else if (newSourcePosition < 0) {
+ ComponentResource componentResource = moduleCore.createWorkbenchModuleResource(folder);
+ componentResource.setRuntimePath(runtimePath);
+ component.getResources().add(refPosition,componentResource);
+ }
+ }
+ finally {
+ if (moduleCore != null) {
+ moduleCore.saveIfNecessary(monitor);
+ moduleCore.dispose();
+ }
+ }
+ }
+
+ public static void insertLinkFirst(IProject project, IPath newSource, IPath runtimePath, IProgressMonitor monitor) throws CoreException {
+ //Looks like WTP'APIS doesn't have such feature, hence this implementation.
+ StructureEdit moduleCore = null;
+ try {
+ moduleCore = StructureEdit.getStructureEditForWrite(project);
+ if (moduleCore == null) {
+ return;
+ }
+ WorkbenchComponent component = moduleCore.getComponent();
+ if (component == null) {
+ return;
+ }
+
+ IResource folder = project.getFolder(newSource);
+ ComponentResource componentResource = moduleCore.createWorkbenchModuleResource(folder);
+ componentResource.setRuntimePath(runtimePath);
+ component.getResources().add(0,componentResource);
+ }
+ finally {
+ if (moduleCore != null) {
+ moduleCore.saveIfNecessary(monitor);
+ moduleCore.dispose();
+ }
+ }
+ }
+
+ public static boolean hasLink(IProject project, IPath runtimePath, IPath aProjectRelativeLocation, IProgressMonitor monitor) throws CoreException {
+ StructureEdit moduleCore = null;
+ try {
+ moduleCore = StructureEdit.getStructureEditForRead(project);
+ if( moduleCore != null ) {
+ WorkbenchComponent component = moduleCore.getComponent();
+ if (component != null) {
+ ResourceTreeRoot root = ResourceTreeRoot.getDeployResourceTreeRoot(component);
+ ComponentResource[] resources = root.findModuleResources(runtimePath, ResourceTreeNode.CREATE_NONE);
+ if (resources.length > 0) {
+ for (int resourceIndx = 0; resourceIndx < resources.length; resourceIndx++) {
+ if (aProjectRelativeLocation.makeAbsolute().equals(resources[resourceIndx].getSourcePath())) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ }
+ finally {
+ if (moduleCore != null) {
+ moduleCore.dispose();
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @param project
+ * @param dir
+ * @return
+ */
+ public static IPath tryProjectRelativePath(IProject project, String resourceLocation) {
+ if(resourceLocation == null) {
+ return null;
+ }
+ IPath projectLocation = project.getLocation();
+ IPath directory = Path.fromOSString(resourceLocation); // this is an absolute path!
+ if(projectLocation == null || !projectLocation.isPrefixOf(directory)) {
+ return directory;
+ }
+ return directory.removeFirstSegments(projectLocation.segmentCount()).makeRelative().setDevice(null);
+ }
+
+
+ public static boolean hasChanged(IVirtualReference[] existingRefs, IVirtualReference[] refArray) {
+
+ if (existingRefs==refArray) {
+ return false;
+ }
+ if (existingRefs == null || existingRefs.length != refArray.length) {
+ return true;
+ }
+ for (int i=0; i<existingRefs.length;i++){
+ IVirtualReference existingRef = existingRefs[i];
+ IVirtualReference newRef = refArray[i];
+ if ((existingRef.getArchiveName() != null && !existingRef.getArchiveName().equals(newRef.getArchiveName())) ||
+ (existingRef.getArchiveName() == null && newRef.getArchiveName() != null) ||
+ !existingRef.getReferencedComponent().equals(newRef.getReferencedComponent()) ||
+ !existingRef.getRuntimePath().equals(newRef.getRuntimePath()))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean hasChanged2(IVirtualReference[] existingRefs, IVirtualReference[] refArray) {
+
+ if (existingRefs==refArray) {
+ return false;
+ }
+ if (existingRefs == null || existingRefs.length != refArray.length) {
+ return true;
+ }
+ for (int i=0; i<existingRefs.length;i++){
+ IVirtualReference existingRef = existingRefs[i];
+ IVirtualReference newRef = refArray[i];
+ if (
+ !existingRef.getReferencedComponent().equals(newRef.getReferencedComponent()) ||
+ !existingRef.getRuntimePath().equals(newRef.getRuntimePath()))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Remove the WTP classpath containers that might conflicts with the Maven Library
+ * classpath container
+ * @param project
+ * @throws JavaModelException
+ */
+ public static void removeWTPClasspathContainer(IProject project) throws JavaModelException {
+ IJavaProject javaProject = JavaCore.create(project);
+ if(javaProject != null) {
+ // remove classpatch container from JavaProject
+ ArrayList<IClasspathEntry> newEntries = new ArrayList<IClasspathEntry>();
+ for(IClasspathEntry entry : javaProject.getRawClasspath()) {
+ String path = entry.getPath().toString();
+ if(!"org.eclipse.jst.j2ee.internal.module.container".equals(path)
+ && !"org.eclipse.jst.j2ee.internal.web.container".equals(path)) {
+ newEntries.add(entry);
+ }
+ }
+ javaProject.setRawClasspath(newEntries.toArray(new IClasspathEntry[newEntries.size()]), null);
+ }
+ }
+
+ /**
+ * Adds uninstall actions of facets from the faceted project that conflict with the given facetVersion.
+ */
+ public static void removeConflictingFacets(IFacetedProject project, IProjectFacetVersion facetVersion, Set<Action> actions) {
+ if (project == null) {
+ throw new IllegalArgumentException("project can not be null");
+ }
+ if (facetVersion == null) {
+ throw new IllegalArgumentException("Facet version can not be null");
+ }
+ if (actions == null) {
+ throw new IllegalArgumentException("actions can not be null");
+ }
+ for (IProjectFacetVersion existingFacetVersion : project.getProjectFacets()) {
+ if (facetVersion.conflictsWith(existingFacetVersion)) {
+ actions.add(new IFacetedProject.Action(IFacetedProject.Action.Type.UNINSTALL, existingFacetVersion, null));
+ }
+ }
+ }
+
+ /**
+ * @param actions
+ * @param project
+ * @param facetedProject
+ */
+ public static void installJavaFacet(Set<Action> actions, IProject project, IFacetedProject facetedProject) {
+ IProjectFacetVersion javaFv = JavaFacet.FACET.getVersion(JavaFacetUtil.getCompilerLevel(project));
+ if(!facetedProject.hasProjectFacet(JavaFacet.FACET)) {
+ actions.add(new IFacetedProject.Action(IFacetedProject.Action.Type.INSTALL, javaFv, null));
+ } else if(!facetedProject.hasProjectFacet(javaFv)) {
+ actions.add(new IFacetedProject.Action(IFacetedProject.Action.Type.VERSION_CHANGE, javaFv, null));
+ }
+ }
+
+ /**
+ * @param project
+ * @return
+ */
+ @SuppressWarnings("restriction")
+ public static boolean hasWebFragmentFacet(IProject project) {
+ return FacetedProjectUtilities.isProjectOfType(project, WTPProjectsUtil.WEB_FRAGMENT_FACET.getId());
+ }
+
+ /**
+ * @param mavenProject
+ * @return
+ */
+ public static boolean isQualifiedAsWebFragment(IMavenProjectFacade facade) {
+ if ("jar".equals(facade.getPackaging())) {
+ IFolder classes = getClassesFolder(facade);
+ if (classes != null && classes.getFile("META-INF/web-fragment.xml").exists()) {
+ return true;
+ } else {
+ //No processed/filtered web-fragment.xml found
+ //fall back : iterate over the resource folders
+ IProject project = facade.getProject();
+ for (IPath resourceFolderPath : facade.getResourceLocations()) {
+ if (resourceFolderPath != null && project.exists(resourceFolderPath.append("META-INF/web-fragment.xml"))) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Return the project's classes folder, a.k.a. output build directory
+ * @param facade
+ * @return the project's classes folder
+ */
+ public static IFolder getClassesFolder(IMavenProjectFacade facade) {
+ final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IFolder output = root.getFolder(facade.getOutputLocation());
+ return output;
+ }
+
+
+ public static void removeTestFolderLinks(IProject project, MavenProject mavenProject, IProgressMonitor monitor,
+ String folder) throws CoreException {
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ if (component == null){
+ return;
+ }
+ IVirtualFolder jsrc = component.getRootFolder().getFolder(folder);
+ for(IPath location : MavenProjectUtils.getSourceLocations(project, mavenProject.getTestCompileSourceRoots())) {
+ if (location == null) continue;
+ jsrc.removeLink(location, 0, monitor);
+ }
+ for(IPath location : MavenProjectUtils.getResourceLocations(project, mavenProject.getTestResources())) {
+ if (location == null) continue;
+ jsrc.removeLink(location, 0, monitor);
+ }
+
+ //MECLIPSEWTP-217 : exclude other test source folders, added by build-helper for instance
+ if (project.hasNature(JavaCore.NATURE_ID)) {
+ IJavaProject javaProject = JavaCore.create(project);
+ if (javaProject == null) {
+ return;
+ }
+ IPath testOutputDirPath = MavenProjectUtils.getProjectRelativePath(project, mavenProject.getBuild().getTestOutputDirectory());
+ if (testOutputDirPath == null) {
+ return;
+ }
+ IPath testPath = project.getFullPath().append(testOutputDirPath);
+ IClasspathEntry[] cpes = javaProject.getRawClasspath();
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ for (IClasspathEntry cpe : cpes) {
+ if (cpe != null && cpe.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
+ IPath outputLocation = cpe.getOutputLocation();
+ if (testPath.equals(outputLocation)) {
+ IPath sourcePath = root.getFolder(cpe.getPath()).getProjectRelativePath();
+ if (sourcePath != null) {
+ jsrc.removeLink(sourcePath, 0, monitor);
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ public static void setNonDependencyAttributeToContainer(IProject project, IProgressMonitor monitor) throws JavaModelException {
+ updateContainerAttributes(project, NONDEPENDENCY_ATTRIBUTE, IClasspathDependencyConstants.CLASSPATH_COMPONENT_DEPENDENCY, monitor);
+ }
+
+ public static void updateContainerAttributes(IProject project, IClasspathAttribute attributeToAdd, String attributeToDelete, IProgressMonitor monitor)
+ throws JavaModelException {
+ IJavaProject javaProject = JavaCore.create(project);
+ if (javaProject == null) return;
+ IClasspathEntry[] cp = javaProject.getRawClasspath();
+ for(int i = 0; i < cp.length; i++ ) {
+ if(IClasspathEntry.CPE_CONTAINER == cp[i].getEntryKind()
+ && MavenClasspathHelpers.isMaven2ClasspathContainer(cp[i].getPath())) {
+ LinkedHashMap<String, IClasspathAttribute> attrs = new LinkedHashMap<String, IClasspathAttribute>();
+ for(IClasspathAttribute attr : cp[i].getExtraAttributes()) {
+ if (!attr.getName().equals(attributeToDelete)) {
+ attrs.put(attr.getName(), attr);
+ }
+ }
+ attrs.put(attributeToAdd.getName(), attributeToAdd);
+ IClasspathAttribute[] newAttrs = attrs.values().toArray(new IClasspathAttribute[attrs.size()]);
+ cp[i] = JavaCore.newContainerEntry(cp[i].getPath(), cp[i].getAccessRules(), newAttrs, cp[i].isExported());
+ break;
+ }
+ }
+ javaProject.setRawClasspath(cp, monitor);
+ }
+
+
+ /**
+ * Add the ModuleCoreNature to a project, if necessary.
+ *
+ * @param project An accessible project.
+ * @param monitor A progress monitor to track the time to completion
+ * @throws CoreException if the ModuleCoreNature cannot be added
+ */
+ public static void fixMissingModuleCoreNature(IProject project, IProgressMonitor monitor) throws CoreException {
+ //MECLIPSEWTP-41 Fix the missing moduleCoreNature
+ if (null == ModuleCoreNature.addModuleCoreNatureIfNecessary(project, monitor)) {
+ //If we can't add the missing nature, then the project is useless, so let's tell the user
+ throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, "Unable to add the ModuleCoreNature to "+project.getName(),null));
+ }
+ }
+
+
+ /**
+ * @return true if the Maven project associated ArtifactHandler's language is java.
+ */
+ public static boolean isJavaProject(IMavenProjectFacade facade) {
+ //Java rocks ... not
+ if (facade == null
+ || facade.getMavenProject() == null
+ || facade.getMavenProject().getArtifact() == null
+ || facade.getMavenProject().getArtifact().getArtifactHandler() == null) {
+ return false;
+ }
+ String language = facade.getMavenProject().getArtifact().getArtifactHandler().getLanguage();
+ return "java".equals(language);
+ }
+
+ /**
+ * Sets the default deployment descriptor folder for Eclipse > Indigo
+ */
+ public static void setDefaultDeploymentDescriptorFolder(IVirtualFolder folder, IPath aProjectRelativeLocation, IProgressMonitor monitor) {
+ try {
+ Method getDefaultDeploymentDescriptorFolder = J2EEModuleVirtualComponent.class.getMethod("getDefaultDeploymentDescriptorFolder",
+ IVirtualFolder.class);
+ IPath currentDefaultLocation =(IPath) getDefaultDeploymentDescriptorFolder.invoke(null, folder);
+ if (aProjectRelativeLocation.equals(currentDefaultLocation)) {
+ return;
+ }
+ Method setDefaultDeploymentDescriptorFolder = J2EEModuleVirtualComponent.class.getMethod("setDefaultDeploymentDescriptorFolder",
+ IVirtualFolder.class,
+ IPath.class,
+ IProgressMonitor.class);
+ setDefaultDeploymentDescriptorFolder.invoke(null, folder, aProjectRelativeLocation, monitor);
+ } catch (NoSuchMethodException nsme) {
+ //Not available in this WTP version, let's ignore it
+ } catch(Exception ex) {
+ //The exception shouldn't halt the configuration process.
+ ex.printStackTrace();
+ }
+ }
+
+
+ /**
+ * Gets the default deployment descriptor folder's relative path.
+ */
+ public static IFolder getDefaultDeploymentDescriptorFolder(IVirtualFolder vFolder) {
+ IPath defaultPath = null;
+ try {
+ Method getDefaultDeploymentDescriptorFolder = J2EEModuleVirtualComponent.class.getMethod("getDefaultDeploymentDescriptorFolder",
+ IVirtualFolder.class);
+ defaultPath =(IPath) getDefaultDeploymentDescriptorFolder.invoke(null, vFolder);
+
+ } catch (NoSuchMethodException nsme) {
+ //Not available in this WTP version, let's ignore it
+ } catch(Exception ex) {
+ //The exception shouldn't halt the configuration process.
+ ex.printStackTrace();
+ }
+
+ IFolder folder;
+ IVirtualComponent component = vFolder.getComponent();
+ if (defaultPath == null) {
+ folder = (IFolder)vFolder.getUnderlyingFolder();
+ } else {
+ folder = component.getProject().getFolder(defaultPath);
+ }
+
+ return folder;
+ }
+}
Modified: trunk/maven/plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/configurators/JaxrsProjectConfigurator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/configurators/JaxrsProjectConfigurator.java 2012-07-06 12:57:02 UTC (rev 42439)
+++ trunk/maven/plugins/org.jboss.tools.maven.jaxrs/src/org/jboss/tools/maven/jaxrs/configurators/JaxrsProjectConfigurator.java 2012-07-06 13:32:45 UTC (rev 42440)
@@ -10,7 +10,9 @@
************************************************************************************/
package org.jboss.tools.maven.jaxrs.configurators;
+import org.apache.maven.model.Plugin;
import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -43,8 +45,8 @@
import org.jboss.tools.maven.core.IJBossMavenConstants;
import org.jboss.tools.maven.core.ProjectUtil;
import org.jboss.tools.maven.core.internal.project.facet.MavenFacetInstallDataModelProvider;
+import org.jboss.tools.maven.core.xpl.WTPProjectsUtil;
import org.jboss.tools.maven.ui.Activator;
-import org.maven.ide.eclipse.wtp.WarPluginConfiguration;
/**
* JAX-RS maven project configurator.
@@ -134,8 +136,7 @@
// see https://issues.jboss.org/browse/JBIDE-10037
ProjectUtil.refreshHierarchy(mavenProject.getBasedir(), IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 1));
IDataModel model = createJaxRsDataModel(fproj,facetVersion);
- WarPluginConfiguration config = new WarPluginConfiguration(mavenProject, fproj.getProject());
- String warSourceDirectory = config.getWarSourceDirectory();
+ String warSourceDirectory = getWarSourceDirectory(mavenProject, fproj.getProject());
model.setProperty(IJAXRSFacetInstallDataModelProperties.WEBCONTENT_DIR, warSourceDirectory);
model.setProperty(IJAXRSFacetInstallDataModelProperties.UPDATEDD, false);
fproj.installProjectFacet(facetVersion, model, monitor);
@@ -148,6 +149,25 @@
}
}
+ //Copied from WarPlugin in m2e-wtp
+ private String getWarSourceDirectory(MavenProject mavenProject, IProject project) {
+ Plugin plugin = mavenProject.getPlugin("org.apache.maven.plugins:maven-war-plugin");
+ if (plugin != null && plugin.getConfiguration() instanceof Xpp3Dom) {
+ Xpp3Dom dom = (Xpp3Dom)plugin.getConfiguration();
+ Xpp3Dom[] warSourceDirectory = dom.getChildren("warSourceDirectory");
+ if(warSourceDirectory != null && warSourceDirectory.length > 0) {
+ // first one wins
+ String dir = warSourceDirectory[0].getValue();
+ if(project != null) {
+ return WTPProjectsUtil.tryProjectRelativePath(project, dir).toOSString();
+ }
+ return dir;
+ }
+ }
+ return "src/main/webapp";
+ }
+
+
private IDataModel createJaxRsDataModel(IFacetedProject fproj,
IProjectFacetVersion facetVersion) {
IDataModel config = (IDataModel) new JAXRSFacetInstallDataModelProvider().create();
Modified: trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/META-INF/MANIFEST.MF 2012-07-06 12:57:02 UTC (rev 42439)
+++ trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/META-INF/MANIFEST.MF 2012-07-06 13:32:45 UTC (rev 42440)
@@ -13,8 +13,7 @@
org.eclipse.jst.j2ee,
org.eclipse.wst.common.emfworkbench.integration;bundle-version="1.2.100",
org.sonatype.m2e.mavenarchiver;bundle-version="0.14.0",
- org.jboss.ide.eclipse.as.ui.mbeans;bundle-version="2.3.0",
- org.maven.ide.eclipse.wtp;bundle-version="[0.13.0,0.17.0)
+ org.jboss.ide.eclipse.as.ui.mbeans;bundle-version="2.3.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %Bundle-Vendor
Modified: trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/JBossPackagingArchiverConfigurator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/JBossPackagingArchiverConfigurator.java 2012-07-06 12:57:02 UTC (rev 42439)
+++ trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/JBossPackagingArchiverConfigurator.java 2012-07-06 13:32:45 UTC (rev 42440)
@@ -1,9 +1,5 @@
package org.jboss.tools.maven.jbosspackaging.configurators;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.m2e.core.project.IMavenProjectFacade;
import org.eclipse.m2e.core.project.configurator.MojoExecutionKey;
import org.sonatype.m2e.mavenarchiver.internal.JarArchiverConfigurator;
@@ -18,16 +14,4 @@
protected abstract String getGoal();
- @Override
- public void generateManifest(IMavenProjectFacade mavenFacade, IFile manifest, IProgressMonitor monitor)
- throws CoreException {
- super.generateManifest(mavenFacade, manifest, monitor);
- }
-
- @Override
- protected boolean needsNewManifest(IFile manifest, IMavenProjectFacade oldFacade, IMavenProjectFacade newFacade,
- IProgressMonitor monitor) {
- // TODO Auto-generated method stub
- return super.needsNewManifest(manifest, oldFacade, newFacade, monitor);
- }
}
Modified: trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/SarProjectConfigurator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/SarProjectConfigurator.java 2012-07-06 12:57:02 UTC (rev 42439)
+++ trunk/maven/plugins/org.jboss.tools.maven.jbosspackaging/src/org/jboss/tools/maven/jbosspackaging/configurators/SarProjectConfigurator.java 2012-07-06 13:32:45 UTC (rev 42440)
@@ -54,8 +54,8 @@
import org.jboss.ide.eclipse.as.ui.mbeans.project.JBossSARFacetDataModelProvider;
import org.jboss.tools.maven.core.IJBossMavenConstants;
import org.jboss.tools.maven.core.internal.project.facet.MavenFacetInstallDataModelProvider;
-import org.maven.ide.eclipse.wtp.ArtifactHelper;
-import org.maven.ide.eclipse.wtp.WTPProjectsUtil;
+import org.jboss.tools.maven.core.xpl.ArtifactHelper;
+import org.jboss.tools.maven.core.xpl.WTPProjectsUtil;
/**
*
Modified: trunk/maven/plugins/org.jboss.tools.maven.project.examples/META-INF/MANIFEST.MF
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.project.examples/META-INF/MANIFEST.MF 2012-07-06 12:57:02 UTC (rev 42439)
+++ trunk/maven/plugins/org.jboss.tools.maven.project.examples/META-INF/MANIFEST.MF 2012-07-06 13:32:45 UTC (rev 42440)
@@ -10,7 +10,7 @@
org.jboss.tools.maven.core,
org.jboss.tools.project.examples,
org.eclipse.ui.ide,
- org.eclipse.m2e.archetype.common;bundle-version="[1.0,1.2)",
+ org.eclipse.m2e.archetype.common;bundle-version="[1.0.0,2.0.0)",
org.eclipse.m2e.core.ui;bundle-version="[1.0,1.2)",
org.eclipse.wst.web.ui;bundle-version="1.1.400",
org.eclipse.ui.forms,
13 years, 9 months
JBoss Tools SVN: r42439 - trunk/maven/plugins/org.jboss.tools.maven.hibernate/src/org/jboss/tools/maven/hibernate/configurators.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2012-07-06 08:57:02 -0400 (Fri, 06 Jul 2012)
New Revision: 42439
Modified:
trunk/maven/plugins/org.jboss.tools.maven.hibernate/src/org/jboss/tools/maven/hibernate/configurators/HibernateProjectConfigurator.java
Log:
Remove unnecessary loop
Modified: trunk/maven/plugins/org.jboss.tools.maven.hibernate/src/org/jboss/tools/maven/hibernate/configurators/HibernateProjectConfigurator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.hibernate/src/org/jboss/tools/maven/hibernate/configurators/HibernateProjectConfigurator.java 2012-07-06 12:10:17 UTC (rev 42438)
+++ trunk/maven/plugins/org.jboss.tools.maven.hibernate/src/org/jboss/tools/maven/hibernate/configurators/HibernateProjectConfigurator.java 2012-07-06 12:57:02 UTC (rev 42439)
@@ -86,23 +86,18 @@
}
private boolean isHibernateProject(MavenProject mavenProject) {
- List<Artifact> artifacts = new ArrayList<Artifact>();
- ArtifactFilter filter = new ScopeArtifactFilter(
- Artifact.SCOPE_TEST);
+ ArtifactFilter filter = new ScopeArtifactFilter(Artifact.SCOPE_TEST);
for (Artifact artifact : mavenProject.getArtifacts()) {
if (filter.include(artifact)) {
- artifacts.add(artifact);
+ String groupId = artifact.getGroupId();
+ if (HIBERNATE_GROUP_ID.equals(groupId)) {
+ String artifactId = artifact.getArtifactId();
+ if (artifactId != null && artifactId.startsWith(HIBERNATE_ARTIFACT_ID_PREFIX)) {
+ return true;
+ }
+ }
}
}
- for (Artifact artifact:artifacts) {
- String groupId = artifact.getGroupId();
- if (HIBERNATE_GROUP_ID.equals(groupId)) {
- String artifactId = artifact.getArtifactId();
- if (artifactId != null && artifactId.startsWith(HIBERNATE_ARTIFACT_ID_PREFIX)) {
- return true;
- }
- }
- }
return false;
}
}
13 years, 9 months
JBoss Tools SVN: r42438 - in trunk/maven/tests/org.jboss.tools.maven.configurators.tests: projects/jboss-sar/jboss-sar-1 and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2012-07-06 08:10:17 -0400 (Fri, 06 Jul 2012)
New Revision: 42438
Modified:
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/.classpath
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/.project
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/plugin_customization.ini
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/pom.xml
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-2/pom.xml
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-3/pom.xml
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/JBossSarConfiguratorTest.java
trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/JpaConfiguratorTest.java
Log:
Fix failing tests in Maven component after the move to Juno
Modified: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/.classpath
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.configurators.tests/.classpath 2012-07-06 09:27:29 UTC (rev 42437)
+++ trunk/maven/tests/org.jboss.tools.maven.configurators.tests/.classpath 2012-07-06 12:10:17 UTC (rev 42438)
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src/"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Modified: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/.project
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.configurators.tests/.project 2012-07-06 09:27:29 UTC (rev 42437)
+++ trunk/maven/tests/org.jboss.tools.maven.configurators.tests/.project 2012-07-06 12:10:17 UTC (rev 42438)
@@ -1,34 +1,34 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.jboss.tools.maven.configurators.tests</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.m2e.core.maven2Builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.m2e.core.maven2Nature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.maven.configurators.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Modified: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/plugin_customization.ini
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.configurators.tests/plugin_customization.ini 2012-07-06 09:27:29 UTC (rev 42437)
+++ trunk/maven/tests/org.jboss.tools.maven.configurators.tests/plugin_customization.ini 2012-07-06 12:10:17 UTC (rev 42438)
@@ -1 +1,2 @@
-org.eclipse.m2e.core/eclipse.m2.updateIndexes=false
\ No newline at end of file
+org.eclipse.m2e.core/eclipse.m2.updateIndexes=false
+org.jboss.tools.central/showJBossCentralOnStartup=false
\ No newline at end of file
Modified: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/pom.xml
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/pom.xml 2012-07-06 09:27:29 UTC (rev 42437)
+++ trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-1/pom.xml 2012-07-06 12:10:17 UTC (rev 42438)
@@ -14,14 +14,19 @@
<!-- Enable packaging types and lifecycle bindings. -->
<extensions>true</extensions>
<configuration>
- <archive>
- <manifest>
- <addClasspath>true</addClasspath>
- </manifest>
- </archive>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ </manifest>
+ </archive>
</configuration>
</plugin>
- </plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.5.1</version>
+ </plugin>
+ </plugins>
</build>
<dependencies>
<dependency>
Modified: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-2/pom.xml
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-2/pom.xml 2012-07-06 09:27:29 UTC (rev 42437)
+++ trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-2/pom.xml 2012-07-06 12:10:17 UTC (rev 42438)
@@ -17,6 +17,11 @@
<excludeAll>true</excludeAll>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.5.1</version>
+ </plugin>
</plugins>
</build>
<dependencies>
Modified: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-3/pom.xml
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-3/pom.xml 2012-07-06 09:27:29 UTC (rev 42437)
+++ trunk/maven/tests/org.jboss.tools.maven.configurators.tests/projects/jboss-sar/jboss-sar-3/pom.xml 2012-07-06 12:10:17 UTC (rev 42438)
@@ -20,6 +20,11 @@
</excludes>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.5.1</version>
+ </plugin>
</plugins>
</build>
<dependencies>
Modified: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/JBossSarConfiguratorTest.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/JBossSarConfiguratorTest.java 2012-07-06 09:27:29 UTC (rev 42437)
+++ trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/JBossSarConfiguratorTest.java 2012-07-06 12:10:17 UTC (rev 42438)
@@ -21,7 +21,7 @@
@Test
public void testBasicSarSupport() throws Exception {
IProject project = importProject("projects/jboss-sar/jboss-sar-1/pom.xml");
- waitForJobsToComplete(new NullProgressMonitor());
+ waitForJobsToComplete();
assertIsSarProject(project);
IVirtualComponent sarComponent = ComponentCore.createComponent(project);
@@ -32,8 +32,9 @@
assertEquals("/lib", references[0].getRuntimePath().toPortableString());
IResource[] underlyingResources = getUnderlyingResources(project);
- assertEquals(1, underlyingResources.length);
+ assertEquals(2, underlyingResources.length);
assertEquals(project.getFolder("/src/main/resources"), underlyingResources[0]);
+ assertEquals(project.getFolder("/src/main/java"), underlyingResources[1]);
}
@Test
Modified: trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/JpaConfiguratorTest.java
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/JpaConfiguratorTest.java 2012-07-06 09:27:29 UTC (rev 42437)
+++ trunk/maven/tests/org.jboss.tools.maven.configurators.tests/src/org/jboss/tools/maven/configurators/tests/JpaConfiguratorTest.java 2012-07-06 12:10:17 UTC (rev 42438)
@@ -23,19 +23,15 @@
assertIsJpaProject(project, JpaFacet.VERSION_2_0);
assertNoErrors(project);
- JpaProjectManager manager = JptJpaCorePlugin.getJpaProjectManager(ResourcesPlugin.getWorkspace());
- JpaProject jpa = (JpaProject)project.getAdapter(JpaProject.class);
- //manager.getJpaProject(project);
- String pid = jpa.getJpaPlatform().getId();
+ String pid = JptJpaCorePlugin.getJpaPlatformId(project);
assertTrue(pid + " is not the expected platform", pid.startsWith("eclipselink") || pid.startsWith("generic"));
project = importProject( "projects/jpa/simple-1.0/pom.xml");
waitForJobsToComplete();
assertIsJpaProject(project, JpaFacet.VERSION_1_0);
assertNoErrors(project);
- jpa = (JpaProject)project.getAdapter(JpaProject.class);
- //jpa = manager.getJpaProject(project);
- pid = jpa.getJpaPlatform().getId();
+
+ pid = JptJpaCorePlugin.getJpaPlatformId(project);
assertTrue(pid + " is not the expected hibernate platform", pid.startsWith("hibernate") || pid.startsWith("generic"));
}
13 years, 9 months
JBoss Tools SVN: r42437 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-07-06 05:27:29 -0400 (Fri, 06 Jul 2012)
New Revision: 42437
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java
Log:
JBIDE-12153 to trunk
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java 2012-07-06 09:27:03 UTC (rev 42436)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java 2012-07-06 09:27:29 UTC (rev 42437)
@@ -204,6 +204,7 @@
String xpath = getAttribute(xpathKey, defaultXPath);
XPathQuery query = XPathModel.getDefault().getQuery(getServer(), new Path(xpath));
if(query!=null) {
+ query.refresh(); // Limited refresh only if files have changed
result = query.getFirstResult();
}
}
13 years, 9 months
JBoss Tools SVN: r42436 - branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-07-06 05:27:03 -0400 (Fri, 06 Jul 2012)
New Revision: 42436
Modified:
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java
Log:
JBIDE-12153 to maintenance
Modified: branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java
===================================================================
--- branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java 2012-07-06 08:46:01 UTC (rev 42435)
+++ branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java 2012-07-06 09:27:03 UTC (rev 42436)
@@ -204,6 +204,7 @@
String xpath = getAttribute(xpathKey, defaultXPath);
XPathQuery query = XPathModel.getDefault().getQuery(getServer(), new Path(xpath));
if(query!=null) {
+ query.refresh(); // Limited refresh only if files have changed
result = query.getFirstResult();
}
}
13 years, 9 months