JBoss Tools SVN: r27237 - trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2010-12-08 11:15:32 -0500 (Wed, 08 Dec 2010)
New Revision: 27237
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java
Log:
https://jira.jboss.org/browse/JBIDE-7817 - fixed
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java 2010-12-08 15:54:27 UTC (rev 27236)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java 2010-12-08 16:15:32 UTC (rev 27237)
@@ -294,7 +294,7 @@
if (getExporterDefinitionId().equals("org.hibernate.tools.query")) { //$NON-NLS-1$
QueryExporter queryExporter = (QueryExporter) exporter;
List<String> queryStrings = new ArrayList<String>();
- queryStrings.add(extract.getProperty(ExporterFactoryStrings.QUERY_STRING));
+ queryStrings.add(extract.getProperty(ExporterFactoryStrings.QUERY_STRING, "")); //$NON-NLS-1$
queryExporter.setQueries(queryStrings);
queryExporter.setFilename(extract.getProperty(ExporterFactoryStrings.OUTPUTFILENAME));
}
14 years
JBoss Tools SVN: r27236 - in trunk: cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-12-08 10:54:27 -0500 (Wed, 08 Dec 2010)
New Revision: 27236
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodBusinessMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodPublicMarkerResolution.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
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/CDIValidationErrorManager.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseJavaUtil.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/AbstractSeamMarkerResolution.java
Log:
https://jira.jboss.org/browse/JBIDE-7669
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java 2010-12-08 15:46:33 UTC (rev 27235)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIConstants.java 2010-12-08 15:54:27 UTC (rev 27236)
@@ -57,6 +57,7 @@
public String STATELESS_ANNOTATION_TYPE_NAME = "javax.ejb.Stateless";
public String SINGLETON_ANNOTATION_TYPE_NAME = "javax.ejb.Singleton";
public String LOCAL_ANNOTATION_TYPE_NAME = "javax.ejb.Local";
+ public String LOCAL_BEAN_SIMPLE_NAME = "LocalBean";
public String LOCAL_BEAN_ANNOTATION_TYPE_NAME = "javax.ejb.LocalBean";
public String RESOURCE_ANNOTATION_TYPE_NAME = "javax.annotation.Resource";
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 2010-12-08 15:46:33 UTC (rev 27235)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-12-08 15:54:27 UTC (rev 27236)
@@ -1170,7 +1170,7 @@
IMethod method = CDIUtil.getBusinessMethodDeclaration((SessionBean)classBean, producerMethod);
if(method==null) {
String bindedErrorMessage = NLS.bind(CDIValidationMessages.ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN, new String[]{producerMethod.getMethod().getElementName(), producer.getBeanClass().getElementName()});
- addError(bindedErrorMessage, CDIPreferences.ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN, producer.getProducesAnnotation(), producer.getResource());
+ addError(bindedErrorMessage, CDIPreferences.ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN, producer.getProducesAnnotation(), producer.getResource(), ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN_ID);
saveAllSuperTypesAsLinkedResources(classBean);
} else if (method != producerMethod.getMethod()) {
getValidationContext().addLinkedCoreResource(classBean.getSourcePath().toOSString(), method.getResource().getFullPath(), false);
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java 2010-12-08 15:46:33 UTC (rev 27235)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java 2010-12-08 15:54:27 UTC (rev 27236)
@@ -19,6 +19,7 @@
public static final String MESSAGE_ID_ATTRIBUTE_NAME = "CDI_message_id"; //$NON-NLS-1$
public static final int ILLEGAL_PRODUCER_FIELD_IN_SESSION_BEAN_ID = 1;
+ public static final int ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN_ID = 2;
/*
* (non-Javadoc)
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2010-12-08 15:46:33 UTC (rev 27235)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2010-12-08 15:54:27 UTC (rev 27236)
@@ -62,8 +62,10 @@
public static String MESSAGE_INTERCEPTOR_BINDINGS_EMPTY;
public static String MAKE_FIELD_STATIC_MARKER_RESOLUTION_TITLE;
-
+ public static String MAKE_METHOD_PUBLIC_MARKER_RESOLUTION_TITLE;
+ public static String MAKE_METHOD_BUSINESS_MARKER_RESOLUTION_TITLE;
+
public static String CDI_GENERATE_BEANS_XML;
public static String CDI_INSTALL_WIZARD_PAGE_FACET;
public static String CDI_INSTALL_WIZARD_PAGE_CONFIGURE;
-}
\ No newline at end of file
+}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2010-12-08 15:46:33 UTC (rev 27235)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2010-12-08 15:54:27 UTC (rev 27236)
@@ -51,7 +51,9 @@
MESSAGE_INTERCEPTOR_BINDINGS_EMPTY=Interceptor Bindings list is empty
MAKE_FIELD_STATIC_MARKER_RESOLUTION_TITLE=Make ''{0}'' field static
+MAKE_METHOD_PUBLIC_MARKER_RESOLUTION_TITLE=Make ''{0}'' method public
+MAKE_METHOD_BUSINESS_MARKER_RESOLUTION_TITLE=Make ''{0}'' method business method of the session bean and add it to ''{1}'' interface
CDI_GENERATE_BEANS_XML=Generate beans.xml file:
CDI_INSTALL_WIZARD_PAGE_FACET=Context and Dependency Injection (CDI) Facet
-CDI_INSTALL_WIZARD_PAGE_CONFIGURE=Configure Context and Dependency Injection (CDI) Facet Settings
\ No newline at end of file
+CDI_INSTALL_WIZARD_PAGE_CONFIGURE=Configure Context and Dependency Injection (CDI) Facet Settings>>>>>>> .r27235
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2010-12-08 15:46:33 UTC (rev 27235)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2010-12-08 15:54:27 UTC (rev 27236)
@@ -10,20 +10,29 @@
******************************************************************************/
package org.jboss.tools.cdi.ui.marker;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.Flags;
+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.IMethod;
import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IMarkerResolutionGenerator2;
+import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.internal.core.validation.CDIValidationErrorManager;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
import org.jboss.tools.common.EclipseUtil;
+import org.jboss.tools.common.model.util.EclipseJavaUtil;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
/**
* @author Daniel Azarov
@@ -70,25 +79,72 @@
new MakeFieldStaticMarkerResolution(field, file)
};
}
+ }else if (messageId == CDIValidationErrorManager.ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN_ID) {
+ IMethod method = findMethod(file, start);
+ if(method != null){
+ List<IType> types = findLocalAnnotattedInterfaces(method);
+ if(types.size() == 0){
+ return new IMarkerResolution[] {
+ new MakeMethodPublicMarkerResolution(method, file)
+ };
+ }else{
+ IMarkerResolution[] resolutions = new IMarkerResolution[types.size()];
+ for(int i = 0; i < types.size(); i++){
+ resolutions[i] = new MakeMethodBusinessMarkerResolution(method, types.get(i), file);
+ }
+ return resolutions;
+ }
+ }
}
}
return new IMarkerResolution[] {};
}
+ private IMethod findMethod(IFile file, int start){
+ try{
+ ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
+
+ IJavaElement javaElement = compilationUnit.getElementAt(start);
+ if(javaElement != null && javaElement instanceof IMethod){
+ IMethod method = (IMethod)javaElement;
+ if(!method.isBinary())
+ return method;
+ }
+ }catch(CoreException ex){
+ CDIUIPlugin.getDefault().logError(ex);
+ }
+ return null;
+ }
+
+ private List<IType> findLocalAnnotattedInterfaces(IMethod method) throws JavaModelException{
+ ArrayList<IType> types = new ArrayList<IType>();
+ IType type = method.getDeclaringType();
+ String[] is = type.getSuperInterfaceNames();
+ for(int i = 0; i < is.length; i++){
+ String f = EclipseJavaUtil.resolveType(type, is[i]);
+ IType t = EclipseResourceUtil.getValidType(type.getJavaProject().getProject(), f);
+ if(t != null && t.isInterface()){
+ IAnnotation localAnnotation = EclipseJavaUtil.findAnnotation(t, t, CDIConstants.LOCAL_ANNOTATION_TYPE_NAME);
+ if(localAnnotation != null)
+ types.add(t);
+ }
+ }
+ return types;
+ }
+
private IField findNonStaticField(IFile file, int start){
try{
- ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
- ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
-
- IJavaElement javaElement = compilationUnit.getElementAt(start);
- IType type = compilationUnit.findPrimaryType();
- if(javaElement != null && type != null){
- if(javaElement instanceof IField){
+ ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
+
+ IJavaElement javaElement = compilationUnit.getElementAt(start);
+
+ if(javaElement != null && javaElement instanceof IField){
IField field = (IField)javaElement;
- if((field.getFlags() & Flags.AccStatic) == 0)
+ if((field.getFlags() & Flags.AccStatic) == 0 && !field.isBinary())
return field;
}
- }
}catch(CoreException ex){
CDIUIPlugin.getDefault().logError(ex);
}
Added: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodBusinessMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodBusinessMarkerResolution.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodBusinessMarkerResolution.java 2010-12-08 15:54:27 UTC (rev 27236)
@@ -0,0 +1,217 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.cdi.ui.marker;
+
+import java.text.MessageFormat;
+import java.util.HashSet;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IBuffer;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IImportDeclaration;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageDeclaration;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IMarkerResolution2;
+import org.jboss.tools.cdi.core.CDIConstants;
+import org.jboss.tools.cdi.ui.CDIUIMessages;
+import org.jboss.tools.cdi.ui.CDIUIPlugin;
+import org.jboss.tools.common.EclipseUtil;
+import org.jboss.tools.common.model.util.EclipseJavaUtil;
+
+/**
+ * @author Daniel Azarov
+ */
+public class MakeMethodBusinessMarkerResolution implements IMarkerResolution2 {
+ private static final String PUBLIC = "public"; //$NON-NLS-1$
+ private static final String PRIVATE = "private"; //$NON-NLS-1$
+ private static final String PROTECTED = "protected"; //$NON-NLS-1$
+ private static final String SPACE = " "; //$NON-NLS-1$
+ private static final String DOT = "."; //$NON-NLS-1$
+
+ static final HashSet<String> primitives = new HashSet<String>();
+ static{
+ primitives.add("int"); //$NON-NLS-1$
+ primitives.add("java.lang.Integer"); //$NON-NLS-1$
+ primitives.add("char"); //$NON-NLS-1$
+ primitives.add("java.lang.Character"); //$NON-NLS-1$
+ primitives.add("boolean"); //$NON-NLS-1$
+ primitives.add("java.lang.Boolean"); //$NON-NLS-1$
+ primitives.add("short"); //$NON-NLS-1$
+ primitives.add("java.lang.Short"); //$NON-NLS-1$
+ primitives.add("long"); //$NON-NLS-1$
+ primitives.add("java.lang.Long"); //$NON-NLS-1$
+ primitives.add("float"); //$NON-NLS-1$
+ primitives.add("java.lang.Float"); //$NON-NLS-1$
+ primitives.add("double"); //$NON-NLS-1$
+ primitives.add("java.lang.Double"); //$NON-NLS-1$
+ primitives.add("byte"); //$NON-NLS-1$
+ primitives.add("java.lang.Byte"); //$NON-NLS-1$
+ primitives.add("java.lang.String"); //$NON-NLS-1$
+ }
+
+ private String label;
+ private IMethod method;
+ private IType localInterface;
+ private IFile file;
+
+ public MakeMethodBusinessMarkerResolution(IMethod method, IType localInterface, IFile file){
+ this.label = MessageFormat.format(CDIUIMessages.MAKE_METHOD_BUSINESS_MARKER_RESOLUTION_TITLE, new Object[]{method.getElementName(), localInterface.getElementName()});
+ this.method = method;
+ this.localInterface = localInterface;
+ this.file = file;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void run(IMarker marker) {
+ try{
+ ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
+
+ IBuffer buffer = compilationUnit.getBuffer();
+
+ int flag = method.getFlags();
+
+ String text = buffer.getText(method.getSourceRange().getOffset(), method.getSourceRange().getLength());
+
+ // make method public
+ int position = method.getSourceRange().getOffset();
+ if((flag & Flags.AccPublic) != 0){
+ // do nothing
+ }else if((flag & Flags.AccPrivate) != 0){
+ position += text.indexOf(PRIVATE);
+ buffer.replace(position, PRIVATE.length(), PUBLIC);
+ }else if((flag & Flags.AccProtected) != 0){
+ position += text.indexOf(PROTECTED);
+ buffer.replace(position, PROTECTED.length(), PUBLIC);
+ }else{
+ String type = Signature.getSignatureSimpleName(method.getReturnType());
+ position += text.indexOf(type);
+ buffer.replace(position, 0, PUBLIC+SPACE);
+ }
+
+ synchronized(compilationUnit) {
+ compilationUnit.reconcile(ICompilationUnit.NO_AST, true, null, null);
+ }
+
+ // add @LocalBean annotation
+ IType type = compilationUnit.getType(method.getDeclaringType().getElementName());
+
+ IAnnotation localAnnotation = EclipseJavaUtil.findAnnotation(type, type, CDIConstants.LOCAL_BEAN_ANNOTATION_TYPE_NAME);
+ if(localAnnotation == null){
+ addImport(CDIConstants.LOCAL_BEAN_ANNOTATION_TYPE_NAME, compilationUnit);
+
+ final String lineDelim= compilationUnit.findRecommendedLineSeparator();
+
+ buffer = compilationUnit.getBuffer();
+
+ buffer.replace(type.getSourceRange().getOffset(), 0, "@"+CDIConstants.LOCAL_BEAN_SIMPLE_NAME+lineDelim);
+ }
+
+ // add method to interface
+
+ compilationUnit.commitWorkingCopy(false, new NullProgressMonitor());
+ compilationUnit.discardWorkingCopy();
+
+ original = localInterface.getCompilationUnit();
+ compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
+
+ IType interfaceType = compilationUnit.getType(localInterface.getElementName());
+
+ StringBuffer content = new StringBuffer();
+
+ content.append(PUBLIC+SPACE);
+
+ String simpleType = Signature.getSignatureSimpleName(method.getReturnType());
+ content.append(simpleType);
+ content.append(SPACE);
+ content.append(method.getElementName());
+ content.append("("); //$NON-NLS-1$
+
+ IType originalType = method.getDeclaringType();
+
+ addImport(originalType, simpleType, compilationUnit);
+
+ String[] types = method.getParameterTypes();
+ String[] names = method.getParameterNames();
+
+ for(int i = 0; i < method.getNumberOfParameters(); i++){
+ if(i > 0)
+ content.append(", "); //$NON-NLS-1$
+
+ simpleType = Signature.getSignatureSimpleName(types[i]);
+
+ addImport(originalType, simpleType, compilationUnit);
+
+ content.append(simpleType);
+ content.append(SPACE);
+ content.append(names[i]);
+ }
+
+ content.append(");"); //$NON-NLS-1$
+
+ interfaceType.createMethod(content.toString(), null, false, new NullProgressMonitor());
+
+ compilationUnit.commitWorkingCopy(false, new NullProgressMonitor());
+ compilationUnit.discardWorkingCopy();
+ }catch(CoreException ex){
+ CDIUIPlugin.getDefault().logError(ex);
+ }
+ }
+
+ private void addImport(IType originalType, String simpleName, ICompilationUnit compilationUnit) throws JavaModelException{
+ String qualifiedName = EclipseJavaUtil.resolveType(originalType, simpleName);
+ addImport(qualifiedName, compilationUnit);
+ }
+
+ private void addImport(String qualifiedName, ICompilationUnit compilationUnit) throws JavaModelException{
+ if(primitives.contains(qualifiedName))
+ return;
+
+ IPackageDeclaration[] packages = compilationUnit.getPackageDeclarations();
+
+ if(qualifiedName.indexOf(DOT) >= 0){
+ String typePackage = qualifiedName.substring(0,qualifiedName.lastIndexOf(DOT));
+
+ for(IPackageDeclaration packageDeclaration : packages){
+ if(packageDeclaration.getElementName().equals(typePackage))
+ return;
+ }
+ }
+
+ if(qualifiedName != null){
+ IImportDeclaration importDeclaration = compilationUnit.getImport(qualifiedName);
+ if(importDeclaration == null || !importDeclaration.exists())
+ compilationUnit.createImport(qualifiedName, null, new NullProgressMonitor());
+ }
+
+ }
+
+ public String getDescription() {
+ return null;
+ }
+
+ public Image getImage() {
+ return null;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodBusinessMarkerResolution.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodPublicMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodPublicMarkerResolution.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodPublicMarkerResolution.java 2010-12-08 15:54:27 UTC (rev 27236)
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.cdi.ui.marker;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IBuffer;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IMarkerResolution2;
+import org.jboss.tools.cdi.ui.CDIUIMessages;
+import org.jboss.tools.cdi.ui.CDIUIPlugin;
+import org.jboss.tools.common.EclipseUtil;
+
+/**
+ * @author Daniel Azarov
+ */
+public class MakeMethodPublicMarkerResolution implements IMarkerResolution2 {
+ private static final String PUBLIC = "public"; //$NON-NLS-1$
+ private static final String PRIVATE = "private"; //$NON-NLS-1$
+ private static final String PROTECTED = "protected"; //$NON-NLS-1$
+ private static final String SPACE = " "; //$NON-NLS-1$
+
+ private String label;
+ private IMethod method;
+ private IFile file;
+
+ public MakeMethodPublicMarkerResolution(IMethod method, IFile file){
+ this.label = MessageFormat.format(CDIUIMessages.MAKE_METHOD_PUBLIC_MARKER_RESOLUTION_TITLE, new Object[]{method.getElementName()});
+ this.method = method;
+ this.file = file;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void run(IMarker marker) {
+ try{
+ ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
+
+ IBuffer buffer = compilationUnit.getBuffer();
+
+ int flag = method.getFlags();
+
+ String text = buffer.getText(method.getSourceRange().getOffset(), method.getSourceRange().getLength());
+
+ // make method public
+ int position = method.getSourceRange().getOffset();
+ if((flag & Flags.AccPublic) != 0){
+ // do nothing
+ }else if((flag & Flags.AccPrivate) != 0){
+ position += text.indexOf(PRIVATE);
+ buffer.replace(position, PRIVATE.length(), PUBLIC);
+ }else if((flag & Flags.AccProtected) != 0){
+ position += text.indexOf(PROTECTED);
+ buffer.replace(position, PROTECTED.length(), PUBLIC);
+ }else{
+ String type = Signature.getSignatureSimpleName(method.getReturnType());
+ position += text.indexOf(type);
+ buffer.replace(position, 0, PUBLIC+SPACE);
+ }
+
+ compilationUnit.commitWorkingCopy(false, new NullProgressMonitor());
+ compilationUnit.discardWorkingCopy();
+ }catch(CoreException ex){
+ CDIUIPlugin.getDefault().logError(ex);
+ }
+ }
+
+ public String getDescription() {
+ return null;
+ }
+
+ public Image getImage() {
+ return null;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodPublicMarkerResolution.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2010-12-08 15:46:33 UTC (rev 27235)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2010-12-08 15:54:27 UTC (rev 27236)
@@ -19,6 +19,7 @@
import org.eclipse.ui.ide.IDE;
import org.jboss.tools.cdi.core.test.tck.validation.ValidationTest;
import org.jboss.tools.cdi.ui.marker.MakeFieldStaticMarkerResolution;
+import org.jboss.tools.cdi.ui.marker.MakeMethodBusinessMarkerResolution;
/**
* @author Daniel Azarov
@@ -53,5 +54,30 @@
assertTrue("Quick fix: \"Make field static\" doesn't exist.", found);
}
+ public void testMakeMethodBusinessResolution() throws CoreException {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/enterprise/nonbusiness/FooProducer.java");
+
+ assertTrue("File - "+file.getFullPath()+" must be exist",file.exists());
+
+ IMarker[] markers = file.findMarkers(MARKER_TYPE, true, IResource.DEPTH_INFINITE);
+
+ boolean found = false;
+ for (int i = 0; i < markers.length; i++) {
+ IMarker marker = markers[i];
+ IMarkerResolution[] resolutions = IDE.getMarkerHelpRegistry()
+ .getResolutions(marker);
+ for (int j = 0; j < resolutions.length; j++) {
+ IMarkerResolution resolution = resolutions[j];
+ if (resolution instanceof MakeMethodBusinessMarkerResolution) {
+ found = true;
+ break;
+ }
+ }
+ if (found) {
+ break;
+ }
+ }
+ assertTrue("Quick fix: \"Make method business\" doesn't exist.", found);
+ }
}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseJavaUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseJavaUtil.java 2010-12-08 15:46:33 UTC (rev 27235)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseJavaUtil.java 2010-12-08 15:54:27 UTC (rev 27236)
@@ -20,6 +20,8 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IAnnotatable;
+import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaProject;
@@ -221,4 +223,29 @@
}
return suppers;
}
+
+ public static IAnnotation findAnnotation(IType sourceType, IAnnotatable member, String qulifiedAnnotationName) throws JavaModelException{
+ IAnnotation[] annotations = member.getAnnotations();
+ String simpleAnnotationTypeName = qulifiedAnnotationName;
+ int lastDot = qulifiedAnnotationName.lastIndexOf('.');
+ if(lastDot>-1) {
+ simpleAnnotationTypeName = simpleAnnotationTypeName.substring(lastDot + 1);
+ }
+ for (IAnnotation annotation : annotations) {
+ if(qulifiedAnnotationName.equals(annotation.getElementName())) {
+ return annotation;
+ }
+ if(simpleAnnotationTypeName.equals(annotation.getElementName())) {
+ String fullAnnotationclassName = EclipseJavaUtil.resolveType(sourceType, simpleAnnotationTypeName);
+ if(fullAnnotationclassName!=null) {
+ IType annotationType = sourceType.getJavaProject().findType(fullAnnotationclassName);
+ if(annotationType!=null && annotationType.getFullyQualifiedName().equals(qulifiedAnnotationName)) {
+ return annotation;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/AbstractSeamMarkerResolution.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/AbstractSeamMarkerResolution.java 2010-12-08 15:46:33 UTC (rev 27235)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/AbstractSeamMarkerResolution.java 2010-12-08 15:54:27 UTC (rev 27236)
@@ -28,7 +28,6 @@
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.common.EclipseUtil;
@@ -66,7 +65,7 @@
IType type = compilationUnit.findPrimaryType();
if(javaElement != null && type != null){
if(javaElement instanceof IAnnotatable){
- IAnnotation annotation = findAnnotation(type, (IAnnotatable)javaElement);
+ IAnnotation annotation = EclipseJavaUtil.findAnnotation(type, (IAnnotatable)javaElement, qualifiedName);
if(annotation != null){
IBuffer buffer = compilationUnit.getBuffer();
@@ -224,7 +223,7 @@
IJavaElement javaElement = compilationUnit.getElementAt(start);
IType type = getType(javaElement);
if(type != null){
- IAnnotation annotation = findAnnotation(type, type);
+ IAnnotation annotation = EclipseJavaUtil.findAnnotation(type, type, qualifiedName);
if(annotation != null){
IImportDeclaration importDeclaration = compilationUnit.getImport(qualifiedName);
if(importDeclaration == null || !importDeclaration.exists())
@@ -253,33 +252,6 @@
}
- private IAnnotation findAnnotation(IType sourceType, IAnnotatable member) {
- try {
- IAnnotation[] annotations = member.getAnnotations();
- String simpleAnnotationTypeName = qualifiedName;
- int lastDot = qualifiedName.lastIndexOf('.');
- if(lastDot>-1) {
- simpleAnnotationTypeName = simpleAnnotationTypeName.substring(lastDot + 1);
- }
- for (IAnnotation annotation : annotations) {
- if(qualifiedName.equals(annotation.getElementName())) {
- return annotation;
- }
- if(simpleAnnotationTypeName.equals(annotation.getElementName())) {
- String fullAnnotationclassName = EclipseJavaUtil.resolveType(sourceType, simpleAnnotationTypeName);
- if(fullAnnotationclassName!=null) {
- IType annotationType = sourceType.getJavaProject().findType(fullAnnotationclassName);
- if(annotationType!=null && annotationType.getFullyQualifiedName().equals(qualifiedName)) {
- return annotation;
- }
- }
- }
- }
- } catch (JavaModelException e) {
- SeamGuiPlugin.getDefault().logError(e);
- }
- return null;
- }
public String getLabel() {
return label;
14 years
JBoss Tools SVN: r27235 - in trunk/hibernatetools/plugins: org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2010-12-08 10:46:33 -0500 (Wed, 08 Dec 2010)
New Revision: 27235
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/SchemaExportAction.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
Log:
https://jira.jboss.org/browse/JBIDE-7805 - fixed
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2010-12-08 15:20:54 UTC (rev 27234)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2010-12-08 15:46:33 UTC (rev 27235)
@@ -32,7 +32,6 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import org.hibernate.Session;
@@ -247,7 +246,7 @@
int execcount;
- List<ConsoleConfigurationListener> consoleCfgListeners = new ArrayList<ConsoleConfigurationListener>();
+ ArrayList<ConsoleConfigurationListener> consoleCfgListeners = new ArrayList<ConsoleConfigurationListener>();
public QueryPage executeHQLQuery(final String hql) {
return executeHQLQuery(hql, new QueryInputModel());
@@ -281,32 +280,38 @@
});
}
+ @SuppressWarnings("unchecked")
+ // clone listeners to thread safe iterate over array
+ private ArrayList<ConsoleConfigurationListener> cloneConsoleCfgListeners() {
+ return (ArrayList<ConsoleConfigurationListener>)consoleCfgListeners.clone();
+ }
+
private void fireConfigurationBuilt() {
- for (ConsoleConfigurationListener view : consoleCfgListeners) {
+ for (ConsoleConfigurationListener view : cloneConsoleCfgListeners()) {
view.configurationBuilt(this);
}
}
private void fireConfigurationReset() {
- for (ConsoleConfigurationListener view : consoleCfgListeners) {
+ for (ConsoleConfigurationListener view : cloneConsoleCfgListeners()) {
view.configurationReset(this);
}
}
private void fireQueryPageCreated(QueryPage qp) {
- for (ConsoleConfigurationListener view : consoleCfgListeners) {
+ for (ConsoleConfigurationListener view : cloneConsoleCfgListeners()) {
view.queryPageCreated(qp);
}
}
private void fireFactoryBuilt() {
- for (ConsoleConfigurationListener view : consoleCfgListeners) {
+ for (ConsoleConfigurationListener view : cloneConsoleCfgListeners()) {
view.sessionFactoryBuilt(this, sessionFactory);
}
}
private void fireFactoryClosing(SessionFactory sessionFactory2) {
- for (ConsoleConfigurationListener view : consoleCfgListeners) {
+ for (ConsoleConfigurationListener view : cloneConsoleCfgListeners()) {
view.sessionFactoryClosing(this, sessionFactory2);
}
}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/SchemaExportAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/SchemaExportAction.java 2010-12-08 15:20:54 UTC (rev 27234)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/SchemaExportAction.java 2010-12-08 15:46:33 UTC (rev 27235)
@@ -21,16 +21,23 @@
*/
package org.hibernate.eclipse.console.views;
+import java.util.HashSet;
import java.util.Iterator;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Shell;
import org.hibernate.HibernateException;
+import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.ConsoleConfigurationListener;
+import org.hibernate.console.KnownConfigurations;
+import org.hibernate.console.KnownConfigurationsListener;
+import org.hibernate.console.QueryPage;
import org.hibernate.console.execution.ExecutionContext.Command;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
@@ -41,11 +48,13 @@
* @author max
*
*/
-public class SchemaExportAction extends ConsoleConfigurationBasedAction {
+public class SchemaExportAction extends ConsoleConfigurationBasedAction implements ConsoleConfigurationListener, KnownConfigurationsListener {
public static final String SCHEMAEXPORT_ACTIONID = "actionid.schemaexport"; //$NON-NLS-1$
private StructuredViewer viewer;
+
+ private HashSet<ConsoleConfiguration> vecMonitorConsoleConfigs = new HashSet<ConsoleConfiguration>();
/**
* @param text
@@ -53,6 +62,7 @@
protected SchemaExportAction(String text) {
super( text );
setId(SCHEMAEXPORT_ACTIONID);
+ KnownConfigurations.getInstance().addConsoleConfigurationListener(this);
}
/**
@@ -62,6 +72,7 @@
super( HibernateConsoleMessages.SchemaExportAction_run_schemaexport );
this.viewer = selectionProvider;
setId(SCHEMAEXPORT_ACTIONID);
+ KnownConfigurations.getInstance().addConsoleConfigurationListener(this);
}
/**
@@ -130,13 +141,69 @@
}
}
}
+
+ @SuppressWarnings("unchecked")
+ private HashSet<ConsoleConfiguration> cloneMonitorConsoleConfigs() {
+ return (HashSet<ConsoleConfiguration>)vecMonitorConsoleConfigs.clone();
+ }
+
+ @SuppressWarnings("rawtypes")
+ protected void clearCache() {
+ final IStructuredSelection selection = getStructuredSelection();
+ HashSet<ConsoleConfiguration> vecMonitorConsoleConfigsTmp =
+ cloneMonitorConsoleConfigs();
+ for (ConsoleConfiguration consoleConfig : vecMonitorConsoleConfigsTmp) {
+ consoleConfig.removeConsoleConfigurationListener(this);
+ }
+ vecMonitorConsoleConfigsTmp.clear();
+ for (Iterator i = selection.iterator(); i.hasNext(); ) {
+ Object obj = i.next();
+ if (obj instanceof ConsoleConfiguration) {
+ ConsoleConfiguration consoleConfig = (ConsoleConfiguration)obj;
+ vecMonitorConsoleConfigsTmp.add(consoleConfig);
+ consoleConfig.addConsoleConfigurationListener(this);
+ }
+ }
+ vecMonitorConsoleConfigs = vecMonitorConsoleConfigsTmp;
+ super.clearCache();
+ }
/*
* (non-Javadoc)
*
* @see org.hibernate.eclipse.console.actions.SessionFactoryBasedAction#updateState(org.hibernate.console.ConsoleConfiguration)
*/
- protected boolean updateState(ConsoleConfiguration consoleConfiguration) {
- return consoleConfiguration.hasConfiguration();
+ protected boolean updateState(ConsoleConfiguration ccfg) {
+ return ccfg.hasConfiguration();
}
+
+ public void updateEnableState() {
+ selectionChanged(getStructuredSelection());
+ }
+
+ public void queryPageCreated(QueryPage qp) {
+ }
+
+ public void sessionFactoryBuilt(ConsoleConfiguration ccfg, SessionFactory builtSessionFactory) {
+ }
+
+ public void sessionFactoryClosing(ConsoleConfiguration ccfg, SessionFactory aboutToCloseFactory) {
+ }
+
+ public void configurationBuilt(ConsoleConfiguration ccfg) {
+ updateEnableState();
+ }
+
+ public void configurationReset(ConsoleConfiguration ccfg) {
+ updateEnableState();
+ }
+
+ public void configurationAdded(ConsoleConfiguration root) {
+ }
+
+ public void configurationRemoved(ConsoleConfiguration ccfg, boolean forUpdate) {
+ if (vecMonitorConsoleConfigs.remove(ccfg)) {
+ ccfg.removeConsoleConfigurationListener(this);
+ }
+ }
}
14 years
JBoss Tools SVN: r27234 - in trunk/cdi/tests/org.jboss.tools.cdi.core.test: projects/jarproject and 14 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-12-08 10:20:54 -0500 (Wed, 08 Dec 2010)
New Revision: 27234
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/.classpath
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/.project
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/.settings/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/.settings/org.eclipse.wst.common.component
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/.settings/org.eclipse.wst.common.project.facet.core.xml
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/build/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/build/classes/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/build/classes/META-INF/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/build/classes/META-INF/MANIFEST.MF
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/ejbModule/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/ejbModule/META-INF/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/ejbModule/META-INF/MANIFEST.MF
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.classpath
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.project
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/.jsdtscope
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/org.eclipse.wst.common.component
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/org.eclipse.wst.common.project.facet.core.xml
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/org.eclipse.wst.jsdt.ui.superType.container
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/org.eclipse.wst.jsdt.ui.superType.name
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/WebContent/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/WebContent/META-INF/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/WebContent/META-INF/MANIFEST.MF
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/WebContent/WEB-INF/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/WebContent/WEB-INF/lib/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/build/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/build/classes/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/src/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/project/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/project/EnableCDISupportForJarTest.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/project/EnableCDISupportForWarTest.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java
Log:
https://jira.jboss.org/browse/JBIDE-7803
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/.classpath
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/.classpath (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/.classpath 2010-12-08 15:20:54 UTC (rev 27234)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="ejbModule"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_20">
+ <attributes>
+ <attribute name="owner.project.facets" value="java"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.jboss.ide.eclipse.as.core.server.runtime.runtimeTarget/JBoss 6.0 Runtime CR1">
+ <attributes>
+ <attribute name="owner.project.facets" value="jst.ejb"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
+ <classpathentry kind="output" path="build/classes"/>
+</classpath>
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/.project
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/.project (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/.project 2010-12-08 15:20:54 UTC (rev 27234)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jarproject</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/.settings/org.eclipse.wst.common.component
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/.settings/org.eclipse.wst.common.component (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/.settings/org.eclipse.wst.common.component 2010-12-08 15:20:54 UTC (rev 27234)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-modules id="moduleCoreId" project-version="1.5.0">
+ <wb-module deploy-name="jarproject">
+ <wb-resource deploy-path="/" source-path="/ejbModule"/>
+ <property name="java-output-path" value="/jarproject/build/classes"/>
+ </wb-module>
+</project-modules>
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/.settings/org.eclipse.wst.common.project.facet.core.xml
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/.settings/org.eclipse.wst.common.project.facet.core.xml (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/.settings/org.eclipse.wst.common.project.facet.core.xml 2010-12-08 15:20:54 UTC (rev 27234)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <runtime name="JBoss 6.0 Runtime CR1"/>
+ <fixed facet="jst.ejb"/>
+ <fixed facet="java"/>
+ <installed facet="java" version="1.6"/>
+ <installed facet="jst.ejb" version="3.1"/>
+</faceted-project>
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/.settings/org.eclipse.wst.common.project.facet.core.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/build/classes/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/build/classes/META-INF/MANIFEST.MF (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/build/classes/META-INF/MANIFEST.MF 2010-12-08 15:20:54 UTC (rev 27234)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/build/classes/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/ejbModule/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/ejbModule/META-INF/MANIFEST.MF (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/ejbModule/META-INF/MANIFEST.MF 2010-12-08 15:20:54 UTC (rev 27234)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/jarproject/ejbModule/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.classpath
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.classpath (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.classpath 2010-12-08 15:20:54 UTC (rev 27234)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_20">
+ <attributes>
+ <attribute name="owner.project.facets" value="java"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.jboss.ide.eclipse.as.core.server.runtime.runtimeTarget/JBoss 6.0 Runtime CR1">
+ <attributes>
+ <attribute name="owner.project.facets" value="jst.web"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
+ <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
+ <classpathentry kind="output" path="build/classes"/>
+</classpath>
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.project
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.project (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.project 2010-12-08 15:20:54 UTC (rev 27234)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>warproject</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/.jsdtscope
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/.jsdtscope (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/.jsdtscope 2010-12-08 15:20:54 UTC (rev 27234)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="WebContent"/>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
+ <attributes>
+ <attribute name="hide" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
+ <classpathentry kind="output" path=""/>
+</classpath>
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/org.eclipse.wst.common.component
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/org.eclipse.wst.common.component (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/org.eclipse.wst.common.component 2010-12-08 15:20:54 UTC (rev 27234)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-modules id="moduleCoreId" project-version="1.5.0">
+ <wb-module deploy-name="warproject">
+ <wb-resource deploy-path="/" source-path="/WebContent"/>
+ <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
+ <property name="java-output-path" value="/webproject/build/classes"/>
+ <property name="context-root" value="warproject"/>
+ </wb-module>
+</project-modules>
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/org.eclipse.wst.common.project.facet.core.xml
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/org.eclipse.wst.common.project.facet.core.xml (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/org.eclipse.wst.common.project.facet.core.xml 2010-12-08 15:20:54 UTC (rev 27234)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <runtime name="JBoss 6.0 Runtime CR1"/>
+ <fixed facet="wst.jsdt.web"/>
+ <fixed facet="java"/>
+ <fixed facet="jst.web"/>
+ <installed facet="java" version="1.6"/>
+ <installed facet="jst.web" version="3.0"/>
+ <installed facet="wst.jsdt.web" version="1.0"/>
+</faceted-project>
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/org.eclipse.wst.common.project.facet.core.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/org.eclipse.wst.jsdt.ui.superType.container
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/org.eclipse.wst.jsdt.ui.superType.container (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/org.eclipse.wst.jsdt.ui.superType.container 2010-12-08 15:20:54 UTC (rev 27234)
@@ -0,0 +1 @@
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/org.eclipse.wst.jsdt.ui.superType.name
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/org.eclipse.wst.jsdt.ui.superType.name (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/.settings/org.eclipse.wst.jsdt.ui.superType.name 2010-12-08 15:20:54 UTC (rev 27234)
@@ -0,0 +1 @@
+Window
\ No newline at end of file
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/WebContent/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/WebContent/META-INF/MANIFEST.MF (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/WebContent/META-INF/MANIFEST.MF 2010-12-08 15:20:54 UTC (rev 27234)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/warproject/WebContent/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java 2010-12-08 14:58:05 UTC (rev 27233)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreAllTests.java 2010-12-08 15:20:54 UTC (rev 27234)
@@ -15,6 +15,8 @@
import org.eclipse.jdt.internal.core.JavaModelManager;
import org.jboss.tools.cdi.core.test.ca.BeansXmlCATest;
+import org.jboss.tools.cdi.core.test.project.EnableCDISupportForJarTest;
+import org.jboss.tools.cdi.core.test.project.EnableCDISupportForWarTest;
import org.jboss.tools.cdi.core.test.tck.AssignabilityOfRawAndParameterizedTypesTest;
import org.jboss.tools.cdi.core.test.tck.BeanDefinitionTest;
import org.jboss.tools.cdi.core.test.tck.BeanSpecializationTest;
@@ -52,8 +54,7 @@
public static Test suite() {
// it could be done here because it is not needed to be enabled back
JavaModelManager.getIndexManager().disable();
-
-
+
TestSuite suiteAll = new TestSuite("CDI Core Tests");
TestSuite suite = new TestSuite("TCK Tests");
@@ -87,9 +88,11 @@
suite.addTestSuite(AnnotationsValidationTest.class);
suite.addTestSuite(CoreValidationTest.class);
suite.addTestSuite(SelectedAlternativeTest.class);
-
+
suiteAll.addTestSuite(BeansXMLTest.class);
suiteAll.addTestSuite(DependentProjectTest.class);
+ suiteAll.addTestSuite(EnableCDISupportForWarTest.class);
+ suiteAll.addTestSuite(EnableCDISupportForJarTest.class);
suiteAll.addTest(new CDICoreTestSetup(suite));
return suiteAll;
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/project/EnableCDISupportForJarTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/project/EnableCDISupportForJarTest.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/project/EnableCDISupportForJarTest.java 2010-12-08 15:20:54 UTC (rev 27234)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.cdi.core.test.project;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.ResourcesUtils;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class EnableCDISupportForJarTest extends EnableCDISupportForWarTest {
+
+ @Override
+ public void setUp() throws Exception {
+ project = ResourcesUtils.importProject(PLUGIN_ID, "/projects/jarproject");
+ project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ JobUtils.waitForIdle();
+ }
+
+ @Override
+ protected String getBeansXmlPath() {
+ return "ejbModule/META-INF/beans.xml";
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/project/EnableCDISupportForJarTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/project/EnableCDISupportForWarTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/project/EnableCDISupportForWarTest.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/project/EnableCDISupportForWarTest.java 2010-12-08 15:20:54 UTC (rev 27234)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.cdi.core.test.project;
+
+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.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.jboss.tools.cdi.core.CDICorePlugin;
+import org.jboss.tools.cdi.core.CDIUtil;
+import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.ResourcesUtils;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class EnableCDISupportForWarTest extends TestCase {
+
+ protected static String PLUGIN_ID = "org.jboss.tools.cdi.core.test";
+ protected IProject project = null;
+
+ public void setUp() throws Exception {
+ project = ResourcesUtils.importProject(PLUGIN_ID, "/projects/warproject");
+ project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ JobUtils.waitForIdle();
+ }
+
+ protected String getBeansXmlPath() {
+ return "WebContent/WEB-INF/beans.xml";
+ }
+
+ public void testEnableCDISupport() {
+ CDIUtil.enableCDI(project, true, new NullProgressMonitor());
+ JobUtils.waitForIdle();
+ assertNotNull("CDI is not enabled", CDICorePlugin.getCDI(project, false));
+
+ IFile beansXml = project.getFile(new Path(getBeansXmlPath()));
+ assertNotNull("Can't find beans.xml", beansXml);
+ assertTrue("Can't find beans.xml", beansXml.isAccessible());
+
+ CDIUtil.disableCDI(project);
+ JobUtils.waitForIdle();
+ assertNull("CDI is enabled", CDICorePlugin.getCDI(project, false));
+ }
+
+ public void tearDown() throws Exception {
+ boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
+ JobUtils.waitForIdle();
+ project.delete(true, true, null);
+ JobUtils.waitForIdle();
+ ResourcesUtils.setBuildAutomatically(saveAutoBuild);
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/project/EnableCDISupportForWarTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years
JBoss Tools SVN: r27233 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-12-08 09:58:05 -0500 (Wed, 08 Dec 2010)
New Revision: 27233
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/PaletteDropCommand.java
Log:
JBIDE-7830
https://jira.jboss.org/browse/JBIDE-7830
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/PaletteDropCommand.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/PaletteDropCommand.java 2010-12-08 14:37:06 UTC (rev 27232)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/dnd/PaletteDropCommand.java 2010-12-08 14:58:05 UTC (rev 27233)
@@ -223,7 +223,10 @@
AttributeDescriptorValue[] vs = getDefaultModel().getAttributeValueDescriptors();
for (int i = 0; i < vs.length; i++) {
String v = initialValues.getProperty(vs[i].getName());
- if(v != null) vs[i].setValue(v);
+ if(v != null) {
+ vs[i].setPreferable(true);
+ vs[i].setValue(v);
+ }
}
}
@@ -239,6 +242,7 @@
int ATT_VALUE = 2;
char quote = '\0';
int state = NOTHING;
+ boolean whitespace = false;
String name = null;
String value = null;
for (int i = 0; i < header.length(); i++) {
@@ -247,16 +251,26 @@
if(Character.isJavaIdentifierStart(c)) {
name = "" + c; //$NON-NLS-1$
state = ATT_NAME;
+ whitespace = false;
}
} else if(state == ATT_NAME) {
if(Character.isJavaIdentifierPart(c) || c == ':') {
+ if(whitespace) {
+ whitespace = false;
+ name = "";
+ }
name += c;
} else if(c == '=') {
state = ATT_VALUE;
quote = '\0';
+ whitespace = false;
+ } else if(Character.isWhitespace(c)) {
+ whitespace = true;
}
} else if(state == ATT_VALUE) {
if(c == quote) {
+ int q = value.indexOf("|");
+ if(q >= 0) value = value.substring(0, q) + value.substring(q + 1);
initialValues.setProperty(name, value);
name = null;
value = null;
14 years
JBoss Tools SVN: r27232 - trunk/modeshape/plugins/org.jboss.tools.modeshape.rest.
by jbosstools-commits@lists.jboss.org
Author: elvisisking
Date: 2010-12-08 09:37:06 -0500 (Wed, 08 Dec 2010)
New Revision: 27232
Modified:
trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/modeshape-client.jar
Log:
JBDS-1343, JBIDE-6984 ModeShape and Teiid Designer plugins referenced libraries need to be updated to the ModeShape SOA-P ER5 JARs: Updated to new JARs from SOA ER5. Tested Designer's DDL Importer and publishing via ModeShape Tools plugin. Checking in the 4 ModeShape JARs.
Modified: trunk/modeshape/plugins/org.jboss.tools.modeshape.rest/modeshape-client.jar
===================================================================
(Binary files differ)
14 years
JBoss Tools SVN: r27231 - trunk/vpe/tests/org.jboss.tools.vpe.docbook.test.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-12-08 09:28:27 -0500 (Wed, 08 Dec 2010)
New Revision: 27231
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/plugin.xml
Log:
https://jira.jboss.org/browse/JBIDE-7840
Modified: trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/plugin.xml
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/plugin.xml 2010-12-08 13:51:55 UTC (rev 27230)
+++ trunk/vpe/tests/org.jboss.tools.vpe.docbook.test/plugin.xml 2010-12-08 14:28:27 UTC (rev 27231)
@@ -2,7 +2,7 @@
<?eclipse version="3.3"?>
<plugin>
<extension
- point="org.jboss.tools.vpe.ui.tests">
+ point="org.jboss.tools.vpe.ui.test">
<tests
description="Unit tests for Docbook support in VPE"
name="Docbook Tests"
14 years
JBoss Tools SVN: r27230 - in trunk/cdi/plugins/org.jboss.tools.cdi.core: META-INF and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-12-08 08:51:55 -0500 (Wed, 08 Dec 2010)
New Revision: 27230
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/templates/
trunk/cdi/plugins/org.jboss.tools.cdi.core/templates/beans.xml
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/META-INF/MANIFEST.MF
trunk/cdi/plugins/org.jboss.tools.cdi.core/build.properties
trunk/cdi/plugins/org.jboss.tools.cdi.core/plugin.xml
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/project/facet/CDIFacetInstallDataModelProvider.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/project/facet/CDIFacetInstallDelegate.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/project/facet/ICDIFacetDataModelProperties.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/BeansXmlValidationDelegate.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
Log:
https://jira.jboss.org/browse/JBIDE-7803
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/META-INF/MANIFEST.MF 2010-12-08 13:43:12 UTC (rev 27229)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/META-INF/MANIFEST.MF 2010-12-08 13:51:55 UTC (rev 27230)
@@ -15,13 +15,15 @@
org.eclipse.wst.common.modulecore,
org.eclipse.wst.common.frameworks,
org.eclipse.wst.validation,
+ org.eclipse.jst.j2ee,
org.jboss.tools.jst.web.kb,
org.jboss.tools.common.el.core,
org.eclipse.ltk.core.refactoring,
org.eclipse.jface.text,
org.eclipse.equinox.preferences,
org.eclipse.wst.sse.core,
- org.eclipse.jdt.ui
+ org.eclipse.jdt.ui,
+ org.apache.ant
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: JBoss by Red Hat
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/build.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/build.properties 2010-12-08 13:43:12 UTC (rev 27229)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/build.properties 2010-12-08 13:51:55 UTC (rev 27230)
@@ -5,7 +5,8 @@
.,\
images/,\
plugin.properties,\
- about.html
+ about.html,\
+ templates/
src.includes = src/,\
plugin.xml,\
about.html,\
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/plugin.xml
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/plugin.xml 2010-12-08 13:43:12 UTC (rev 27229)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/plugin.xml 2010-12-08 13:51:55 UTC (rev 27230)
@@ -42,10 +42,22 @@
facet="jst.cdi"
version="1.0">
<constraint>
- <requires
- facet="jst.java"
- version="[5.0">
- </requires>
+ <or>
+ <requires soft="true"
+ facet="jst.ejb"
+ version="[3.0">
+ </requires>
+ <and>
+ <requires soft="true"
+ facet="jst.web"
+ version="[2.5">
+ </requires>
+ <requires
+ facet="jst.java"
+ version="[5.0">
+ </requires>
+ </and>
+ </or>
</constraint>
</project-facet-version>
<action
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2010-12-08 13:43:12 UTC (rev 27229)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2010-12-08 13:51:55 UTC (rev 27230)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.cdi.core;
+import java.io.File;
+import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collections;
@@ -19,9 +21,17 @@
import java.util.Map;
import java.util.Set;
+import org.apache.tools.ant.util.FileUtils;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IAnnotatable;
import org.eclipse.jdt.core.IAnnotation;
@@ -35,33 +45,58 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
import org.jboss.tools.cdi.internal.core.impl.ClassBean;
import org.jboss.tools.common.EclipseUtil;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.text.ITextSourceReference;
+import org.jboss.tools.common.zip.UnzipOperation;
import org.jboss.tools.jst.web.kb.IKbProject;
+import org.osgi.framework.Bundle;
/**
* @author Alexey Kazakov
*/
public class CDIUtil {
+ private static File TEMPLATE_FOLDER;
+
/**
* Adds CDI and KB builders to the project.
*
* @param project
+ * @param genearteBeansXml
*/
- public static void enableCDI(IProject project) {
+ public static void enableCDI(IProject project, boolean genearteBeansXml, IProgressMonitor monitor) {
try {
- EclipseUtil.addNatureToProject(project, CDICoreNature.NATURE_ID);
if (!project.hasNature(IKbProject.NATURE_ID)) {
EclipseResourceUtil.addNatureToProject(project, IKbProject.NATURE_ID);
}
+ EclipseUtil.addNatureToProject(project, CDICoreNature.NATURE_ID);
EclipseResourceUtil.addBuilderToProject(project, ValidationPlugin.VALIDATION_BUILDER_ID);
+ if(genearteBeansXml) {
+ File beansXml = getBeansXml(project);
+ if(beansXml!=null && !beansXml.exists()) {
+ // Create an empty beans.xml
+ beansXml.getParentFile().mkdir();
+ try {
+ FileUtils.getFileUtils().copyFile(new File(getTemplatesFolder(), "beans.xml"), beansXml, null, false, false);
+ } catch (IOException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
+ }
+ project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ }
} catch (CoreException e) {
CDICorePlugin.getDefault().logError(e);
}
@@ -81,6 +116,80 @@
}
/**
+ * Calculate path to templates folder
+ *
+ * @return path to templates
+ * @throws IOException if templates folder not found
+ */
+ public static File getTemplatesFolder() throws IOException {
+ if(TEMPLATE_FOLDER==null) {
+ Bundle bundle = CDICorePlugin.getDefault().getBundle();
+ String version = bundle.getVersion().toString();
+ IPath stateLocation = Platform.getStateLocation(bundle);
+ File templatesDir = FileLocator.getBundleFile(bundle);
+ if(templatesDir.isFile()) {
+ File toCopy = new File(stateLocation.toFile(),version);
+ if(!toCopy.exists()) {
+ toCopy.mkdirs();
+ UnzipOperation unZip = new UnzipOperation(templatesDir.getAbsolutePath());
+ unZip.execute(toCopy,"templates.*");
+ }
+ templatesDir = toCopy;
+ }
+ TEMPLATE_FOLDER = new File(templatesDir,"templates");
+ }
+ return TEMPLATE_FOLDER;
+ }
+
+ private static final String BEANS_XML_FILE_NAME = "beans.xml"; //$NON-NLS-1$
+
+ /**
+ * Returns java.io.File which represents beans.xml for the project.
+ * If the project is a faceted Java project then <src>/META-INF/beans.xml will be return.
+ * If there are a few source folders then the folder which contains META-INF folder will be return.
+ * If there are a few source folders but no any META-INF in them then null will be return.
+ * If the project is a faceted WAR then /<WebContent>/WEB-INF/beans.xml will be return.
+ * The beans.xml may or may not exist.
+ * @param project the project
+ * @return java.io.File which represents beans.xml for the project.
+ * @throws CoreException
+ */
+ public static File getBeansXml(IProject project) throws CoreException {
+ IFacetedProject facetedProject = ProjectFacetsManager.create(project);
+ if(facetedProject!=null) {
+ IProjectFacetVersion webVersion = facetedProject.getProjectFacetVersion(IJ2EEFacetConstants.DYNAMIC_WEB_FACET);
+ if(webVersion!=null) {
+ // WAR
+ IVirtualComponent com = ComponentCore.createComponent(project);
+ if(com!=null && com.getRootFolder()!=null) {
+ IVirtualFolder webInf = com.getRootFolder().getFolder(new Path("/WEB-INF")); //$NON-NLS-1$
+ if(webInf!=null) {
+ IContainer webInfFolder = webInf.getUnderlyingFolder();
+ if(webInfFolder.isAccessible()) {
+ File file = new File(webInfFolder.getLocation().toFile(), BEANS_XML_FILE_NAME);
+ return file;
+ }
+ }
+ }
+ } else if(facetedProject.getProjectFacetVersion(ProjectFacetsManager.getProjectFacet(IJ2EEFacetConstants.JAVA))!=null) {
+ // JAR
+ Set<IFolder> sources = EclipseResourceUtil.getSourceFolders(project);
+ if(sources.size()==1) {
+ return new File(sources.iterator().next().getLocation().toFile(), "META-INF/beans.xml"); //$NON-NLS-1$
+ } else {
+ for (IFolder src : sources) {
+ IFolder metaInf = src.getFolder("META-INF");
+ if(metaInf!=null && metaInf.isAccessible()) {
+ return new File(metaInf.getLocation().toFile(), BEANS_XML_FILE_NAME);
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
* Finds CDI injected point in beans for particular java element.
*
* @param beans
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/project/facet/CDIFacetInstallDataModelProvider.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/project/facet/CDIFacetInstallDataModelProvider.java 2010-12-08 13:43:12 UTC (rev 27229)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/project/facet/CDIFacetInstallDataModelProvider.java 2010-12-08 13:51:55 UTC (rev 27230)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.project.facet;
+import java.util.Set;
+
import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
/**
@@ -19,6 +21,13 @@
*
*/
public class CDIFacetInstallDataModelProvider extends FacetInstallDataModelProvider implements ICDIFacetDataModelProperties {
+
+ public Set getPropertyNames() {
+ Set<String> names = super.getPropertyNames();//super.getPropertyNames();
+ names.add(GENERATE_BEANS_XML);
+ return names;
+ }
+
/**
* Returns default value for a given property
*
@@ -28,6 +37,8 @@
public Object getDefaultProperty(String propertyName) {
if (propertyName.equals(FACET_ID)) {
return ICDIFacetDataModelProperties.CDI_FACET_ID;
+ } else if (GENERATE_BEANS_XML.equals(propertyName)) {
+ return Boolean.TRUE;
}
return super.getDefaultProperty(propertyName);
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/project/facet/CDIFacetInstallDelegate.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/project/facet/CDIFacetInstallDelegate.java 2010-12-08 13:43:12 UTC (rev 27229)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/project/facet/CDIFacetInstallDelegate.java 2010-12-08 13:51:55 UTC (rev 27230)
@@ -18,6 +18,7 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IDelegate;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.jboss.tools.cdi.core.CDICoreMessages;
@@ -48,7 +49,9 @@
*/
public void execute(IProject project, IProjectFacetVersion fv,
Object config, IProgressMonitor monitor) throws CoreException {
- CDIUtil.enableCDI(project);
+ IDataModel model = (IDataModel) config;
+ boolean generateBeansXml = model.getBooleanProperty(GENERATE_BEANS_XML);
+ CDIUtil.enableCDI(project, generateBeansXml, monitor);
if(errorOccurs) {
errorOccurs = false;
Display.getDefault().syncExec(
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/project/facet/ICDIFacetDataModelProperties.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/project/facet/ICDIFacetDataModelProperties.java 2010-12-08 13:43:12 UTC (rev 27229)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/project/facet/ICDIFacetDataModelProperties.java 2010-12-08 13:51:55 UTC (rev 27230)
@@ -29,4 +29,10 @@
* CDI 1.0 Facet Version constant
*/
String CDI_FACET_VERSION_1 = "1.0"; //$NON-NLS-1$
+
+ /**
+ * Generate beans.xml
+ */
+ String GENERATE_BEANS_XML = "cdi.project.generateBeansXml"; //$NON-NLS-1$
+
}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/BeansXmlValidationDelegate.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/BeansXmlValidationDelegate.java 2010-12-08 13:43:12 UTC (rev 27229)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/BeansXmlValidationDelegate.java 2010-12-08 13:51:55 UTC (rev 27230)
@@ -46,6 +46,7 @@
import org.jboss.tools.cdi.core.preferences.CDIPreferences;
import org.jboss.tools.common.EclipseUtil;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -268,7 +269,7 @@
IStatus status = JavaConventions.validateJavaTypeName(typeName, CompilerOptions.VERSION_1_7, CompilerOptions.VERSION_1_7);
if(status.getSeverity()!=IStatus.ERROR) {
String packagePath = typeName.replace('.', '/');
- Set<IFolder> sources = validator.getSourceFolders(beansXml.getProject());
+ Set<IFolder> sources = EclipseResourceUtil.getSourceFolders(beansXml.getProject());
for (IFolder source : sources) {
IPath path = source.getFullPath().append(packagePath + ".java"); //$NON-NLS-1$
validator.getValidationContext().addLinkedCoreResource(beansXml.getFullPath().toOSString(), path, false);
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 2010-12-08 13:43:12 UTC (rev 27229)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-12-08 13:51:55 UTC (rev 27230)
@@ -34,10 +34,8 @@
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMemberValuePair;
import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.ITypeParameter;
@@ -89,8 +87,8 @@
import org.jboss.tools.cdi.internal.core.impl.ParametedType;
import org.jboss.tools.cdi.internal.core.impl.Parameter;
import org.jboss.tools.cdi.internal.core.impl.SessionBean;
-import org.jboss.tools.common.EclipseUtil;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.text.ITextSourceReference;
import org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper;
import org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager;
@@ -359,33 +357,12 @@
Set<IFolder> sourceFolders = null;
- static Set<IFolder> getSourceFolders(IProject project) {
- Set<IFolder> folders = new HashSet<IFolder>();
- IPackageFragmentRoot[] roots;
- try {
- // From source folders
- IJavaProject javaProject = EclipseUtil.getJavaProject(project);
- roots = javaProject.getPackageFragmentRoots();
- for (int i = 0; i < roots.length; i++) {
- if (roots[i].getKind() == IPackageFragmentRoot.K_SOURCE) {
- IResource source = roots[i].getCorrespondingResource();
- if(source instanceof IFolder) {
- folders.add((IFolder)source);
- }
- }
- }
- } catch (JavaModelException e) {
- CDICorePlugin.getDefault().logError(e);
- }
- return folders;
- }
-
Set<IFolder> getSourceFoldersForProjectsSet() {
if(sourceFolders==null) {
sourceFolders = new HashSet<IFolder>();
List<IProject> projects = projectSet.getAllProjests();
for (IProject project : projects) {
- sourceFolders.addAll(getSourceFolders(project));
+ sourceFolders.addAll(EclipseResourceUtil.getSourceFolders(project));
}
}
return sourceFolders;
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/templates/beans.xml
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/templates/beans.xml (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/templates/beans.xml 2010-12-08 13:51:55 UTC (rev 27230)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://docs.jboss.org/cdi/beans_1_0.xsd">
+
+</beans>
\ No newline at end of file
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/templates/beans.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years
JBoss Tools SVN: r27229 - in trunk: cdi/plugins/org.jboss.tools.cdi.ui/META-INF and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-12-08 08:43:12 -0500 (Wed, 08 Dec 2010)
New Revision: 27229
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/facet/
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/facet/CDIInstallWizardPage.java
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/preferences/
Removed:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/references/
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/META-INF/MANIFEST.MF
trunk/cdi/plugins/org.jboss.tools.cdi.ui/plugin.xml
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDISettingsPreferencePage.java
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/CDIUIAllTests.java
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/preferences/CDIPreferencePageTest.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
Log:
https://jira.jboss.org/browse/JBIDE-7803
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/META-INF/MANIFEST.MF 2010-12-08 12:56:33 UTC (rev 27228)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/META-INF/MANIFEST.MF 2010-12-08 13:43:12 UTC (rev 27229)
@@ -18,17 +18,18 @@
org.eclipse.jface.text,
org.eclipse.wst.sse.ui,
org.jboss.tools.jst.web.kb,
- org.eclipse.jdt.core;bundle-version="3.5.0",
- org.eclipse.search;bundle-version="3.5.0",
- org.eclipse.wst.sse.core;bundle-version="1.1.400",
- org.eclipse.ltk.ui.refactoring;bundle-version="3.4.100",
- org.eclipse.ui.ide;bundle-version="3.5.0",
- org.jboss.tools.common.model;bundle-version="2.0.0",
- org.jboss.tools.common.model.ui;bundle-version="2.0.0",
- org.jboss.tools.jst.web.ui;bundle-version="2.0.0",
- org.eclipse.core.expressions;bundle-version="3.4.100",
- org.eclipse.ltk.core.refactoring;bundle-version="3.5.0",
- org.jboss.tools.jst.jsp;bundle-version="3.2.0"
+ org.eclipse.jdt.core,
+ org.eclipse.search,
+ org.eclipse.wst.sse.core,
+ org.eclipse.ltk.ui.refactoring,
+ org.eclipse.ui.ide,
+ org.jboss.tools.common.model,
+ org.jboss.tools.common.model.ui,
+ org.jboss.tools.jst.web.ui,
+ org.eclipse.core.expressions,
+ org.eclipse.ltk.core.refactoring,
+ org.jboss.tools.jst.jsp,
+ org.eclipse.wst.common.project.facet.ui
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %Bundle-Vendor.0
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/plugin.xml
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/plugin.xml 2010-12-08 12:56:33 UTC (rev 27228)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/plugin.xml 2010-12-08 13:43:12 UTC (rev 27229)
@@ -231,6 +231,13 @@
</extension>
+ <extension
+ point="org.eclipse.wst.common.project.facet.ui.wizardPages">
+ <wizard-pages action="jst.cdi.1.0.install">
+ <page class="org.jboss.tools.cdi.ui.wizard.facet.CDIInstallWizardPage"/>
+ </wizard-pages>
+ </extension>
+
<extension
point="org.eclipse.wst.sse.ui.completionProposal">
<proposalCategory
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2010-12-08 12:56:33 UTC (rev 27228)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2010-12-08 13:43:12 UTC (rev 27229)
@@ -62,5 +62,8 @@
public static String MESSAGE_INTERCEPTOR_BINDINGS_EMPTY;
public static String MAKE_FIELD_STATIC_MARKER_RESOLUTION_TITLE;
-
-}
+
+ public static String CDI_GENERATE_BEANS_XML;
+ public static String CDI_INSTALL_WIZARD_PAGE_FACET;
+ public static String CDI_INSTALL_WIZARD_PAGE_CONFIGURE;
+}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2010-12-08 12:56:33 UTC (rev 27228)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2010-12-08 13:43:12 UTC (rev 27229)
@@ -51,3 +51,7 @@
MESSAGE_INTERCEPTOR_BINDINGS_EMPTY=Interceptor Bindings list is empty
MAKE_FIELD_STATIC_MARKER_RESOLUTION_TITLE=Make ''{0}'' field static
+
+CDI_GENERATE_BEANS_XML=Generate beans.xml file:
+CDI_INSTALL_WIZARD_PAGE_FACET=Context and Dependency Injection (CDI) Facet
+CDI_INSTALL_WIZARD_PAGE_CONFIGURE=Configure Context and Dependency Injection (CDI) Facet Settings
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDISettingsPreferencePage.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDISettingsPreferencePage.java 2010-12-08 12:56:33 UTC (rev 27228)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDISettingsPreferencePage.java 2010-12-08 13:43:12 UTC (rev 27229)
@@ -15,6 +15,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -22,6 +23,7 @@
import org.eclipse.swt.widgets.Control;
import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.CDIUtil;
+import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.common.ui.preferences.SettingsPage;
import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
import org.jboss.tools.common.ui.widget.editor.IFieldEditorFactory;
@@ -35,6 +37,8 @@
private IProject project;
private boolean cdiEnabled;
+ private boolean initialState;
+ private boolean generateBeansXml;
/*
* (non-Javadoc)
@@ -69,8 +73,9 @@
generalGroup.setLayout(gridLayout);
+ initialState = isCDIEnabled(project);
IFieldEditor cdiSupportCheckBox = IFieldEditorFactory.INSTANCE.createCheckboxEditor(
- CDIPreferencesMessages.CDI_SETTINGS_PREFERENCE_PAGE_CDI_SUPPORT, CDIPreferencesMessages.CDI_SETTINGS_PREFERENCE_PAGE_CDI_SUPPORT, isCDIEnabled(project));
+ CDIPreferencesMessages.CDI_SETTINGS_PREFERENCE_PAGE_CDI_SUPPORT, CDIPreferencesMessages.CDI_SETTINGS_PREFERENCE_PAGE_CDI_SUPPORT, initialState);
cdiSupportCheckBox.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
Object value = evt.getNewValue();
@@ -83,11 +88,32 @@
cdiEnabled = isCDIEnabled(project);
registerEditor(cdiSupportCheckBox, generalGroup);
+ generateBeansXml = false;
+
+// IFieldEditor generateBeansXmlCheckBox = IFieldEditorFactory.INSTANCE.createCheckboxEditor(
+// CDIUIMessages.CDI_GENERATE_BEANS_XML, CDIUIMessages.CDI_GENERATE_BEANS_XML, generateBeansXml);
+// generateBeansXmlCheckBox.addPropertyChangeListener(new PropertyChangeListener() {
+// public void propertyChange(PropertyChangeEvent evt) {
+// Object value = evt.getNewValue();
+// if (value instanceof Boolean) {
+// boolean v = ((Boolean) value).booleanValue();
+// generateBeansXml = v;
+// }
+// }
+// });
+
+// registerEditor(generateBeansXmlCheckBox, generalGroup);
+
validate();
+ checkGenerateBeansXml();
return root;
}
+ private void checkGenerateBeansXml() {
+// getEditor(CDIUIMessages.CDI_GENERATE_BEANS_XML).setEnabled(!initialState && cdiEnabled);
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#performDefaults()
@@ -95,6 +121,7 @@
@Override
protected void performDefaults() {
getEditor(CDIPreferencesMessages.CDI_SETTINGS_PREFERENCE_PAGE_CDI_SUPPORT).setValue(isCDIEnabled(project));
+ getEditor(CDIUIMessages.CDI_GENERATE_BEANS_XML).setValue(true);
validate();
}
@@ -104,10 +131,12 @@
*/
@Override
public boolean performOk() {
- if(isCDIEnabled()) {
- addCDISupport(project);
- } else {
- removeCDISupport(project);
+ if(isCDIEnabled()!=initialState) {
+ if(isCDIEnabled()) {
+ addCDISupport(project);
+ } else {
+ removeCDISupport(project);
+ }
}
return true;
}
@@ -116,7 +145,7 @@
if(project==null) {
return;
}
- CDIUtil.enableCDI(project);
+ CDIUtil.enableCDI(project, generateBeansXml, new NullProgressMonitor());
}
private void removeCDISupport(IProject project) {
@@ -134,6 +163,7 @@
public void setEnabledCDISuport(boolean enabled) {
cdiEnabled = enabled;
editorRegistry.get(CDIPreferencesMessages.CDI_SETTINGS_PREFERENCE_PAGE_CDI_SUPPORT).setValue(enabled);
+ checkGenerateBeansXml();
}
/*
Added: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/facet/CDIInstallWizardPage.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/facet/CDIInstallWizardPage.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/facet/CDIInstallWizardPage.java 2010-12-08 13:43:12 UTC (rev 27229)
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.cdi.ui.wizard.facet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
+import org.eclipse.wst.common.project.facet.ui.AbstractFacetWizardPage;
+import org.eclipse.wst.common.project.facet.ui.IFacetWizardPage;
+import org.jboss.tools.cdi.internal.core.project.facet.ICDIFacetDataModelProperties;
+import org.jboss.tools.cdi.ui.CDIUIMessages;
+import org.jboss.tools.cdi.ui.CDIUiImages;
+import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.IFieldEditorFactory;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class CDIInstallWizardPage extends AbstractFacetWizardPage implements IFacetWizardPage, IDataModelListener {
+
+ private boolean generateBeansXml;
+ private IDataModel model = null;
+
+ protected Map<String,IFieldEditor> editorRegistry = new HashMap<String,IFieldEditor>();
+
+ public CDIInstallWizardPage() {
+ super(CDIUIMessages.CDI_INSTALL_WIZARD_PAGE_FACET);
+ setTitle(CDIUIMessages.CDI_INSTALL_WIZARD_PAGE_FACET);
+ setImageDescriptor(CDIUiImages.getImageDescriptor(CDIUiImages.WELD_WIZARD_IMAGE_PATH));
+ setDescription(CDIUIMessages.CDI_INSTALL_WIZARD_PAGE_CONFIGURE);
+ }
+
+ public void propertyChanged(DataModelEvent event) {
+ }
+
+ public void createControl(Composite parent) {
+ initializeDialogUnits(parent);
+
+ Composite root = new Composite(parent, SWT.NONE);
+
+ GridData gd = new GridData();
+
+ gd.horizontalSpan = 1;
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = true;
+ gd.grabExcessVerticalSpace = false;
+
+ GridLayout gridLayout = new GridLayout(1, false);
+ root.setLayout(gridLayout);
+
+ Composite generalGroup = new Composite(root, SWT.NONE);
+ generalGroup.setLayoutData(gd);
+ gridLayout = new GridLayout(4, false);
+
+ generalGroup.setLayout(gridLayout);
+
+ generateBeansXml = true;
+
+ IFieldEditor generateBeansXmlCheckBox = IFieldEditorFactory.INSTANCE.createCheckboxEditor(
+ CDIUIMessages.CDI_GENERATE_BEANS_XML, CDIUIMessages.CDI_GENERATE_BEANS_XML, generateBeansXml);
+ generateBeansXmlCheckBox.addPropertyChangeListener(new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ Object value = evt.getNewValue();
+ if (value instanceof Boolean) {
+ boolean v = ((Boolean) value).booleanValue();
+ setGenerateBeansXml(v);
+ }
+ }
+ });
+ editorRegistry.put(generateBeansXmlCheckBox.getName(), generateBeansXmlCheckBox);
+ generateBeansXmlCheckBox.doFillIntoGrid(generalGroup);
+
+ setControl(root);
+ }
+
+ public void setGenerateBeansXml(boolean generate) {
+ generateBeansXml = generate;
+ model.setProperty(ICDIFacetDataModelProperties.GENERATE_BEANS_XML, generateBeansXml);
+ }
+
+ public void setConfig(Object config) {
+ model = (IDataModel) config;
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/facet/CDIInstallWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/CDIUIAllTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/CDIUIAllTests.java 2010-12-08 12:56:33 UTC (rev 27228)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/CDIUIAllTests.java 2010-12-08 13:43:12 UTC (rev 27229)
@@ -12,7 +12,7 @@
import org.eclipse.jdt.internal.core.JavaModelManager;
import org.jboss.tools.cdi.ui.test.marker.CDIMarkerResolutionTest;
-import org.jboss.tools.cdi.ui.test.references.CDIPreferencePageTest;
+import org.jboss.tools.cdi.ui.test.preferences.CDIPreferencePageTest;
import org.jboss.tools.cdi.ui.test.wizard.NewCDIWizardTest;
import junit.framework.Test;
Copied: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/preferences (from rev 27220, trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/references)
Modified: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/preferences/CDIPreferencePageTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/references/CDIPreferencePageTest.java 2010-12-08 08:57:20 UTC (rev 27220)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/preferences/CDIPreferencePageTest.java 2010-12-08 13:43:12 UTC (rev 27229)
@@ -1,4 +1,4 @@
-package org.jboss.tools.cdi.ui.test.references;
+package org.jboss.tools.cdi.ui.test.preferences;
import junit.framework.TestCase;
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2010-12-08 12:56:33 UTC (rev 27228)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2010-12-08 13:43:12 UTC (rev 27229)
@@ -23,6 +23,7 @@
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -38,6 +39,7 @@
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaModelMarker;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
@@ -58,7 +60,6 @@
import org.jboss.tools.common.model.filesystems.XFileObject;
import org.jboss.tools.common.model.filesystems.impl.FileSystemImpl;
import org.jboss.tools.common.model.filesystems.impl.FileSystemsImpl;
-import org.jboss.tools.common.model.filesystems.impl.FileSystemsLoader;
import org.jboss.tools.common.model.filesystems.impl.JarSystemImpl;
import org.jboss.tools.common.model.icons.impl.XModelObjectIcon;
import org.jboss.tools.common.model.impl.XModelObjectImpl;
@@ -835,6 +836,29 @@
return null;
}
+ public static Set<IFolder> getSourceFolders(IProject project) {
+ Set<IFolder> folders = new HashSet<IFolder>();
+ IPackageFragmentRoot[] roots;
+ try {
+ // From source folders
+ IJavaProject javaProject = EclipseUtil.getJavaProject(project);
+ if(javaProject!=null) {
+ roots = javaProject.getPackageFragmentRoots();
+ for (int i = 0; i < roots.length; i++) {
+ if (roots[i].getKind() == IPackageFragmentRoot.K_SOURCE) {
+ IResource source = roots[i].getCorrespondingResource();
+ if(source instanceof IFolder) {
+ folders.add((IFolder)source);
+ }
+ }
+ }
+ }
+ } catch (JavaModelException e) {
+ ModelPlugin.getDefault().logError(e);
+ }
+ return folders;
+ }
+
public static void openResource(IResource resource) {
XModelObject o = getObjectByResource(resource);
if(o == null) o = createObjectForResource(resource);
14 years
JBoss Tools SVN: r27228 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-08 07:56:33 -0500 (Wed, 08 Dec 2010)
New Revision: 27228
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
Log:
[JBIDE-7836] corrected tab order (bad widget creation order)
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2010-12-08 12:47:34 UTC (rev 27227)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2010-12-08 12:56:33 UTC (rev 27228)
@@ -95,8 +95,6 @@
private Text imageText;
private Text keyText;
private Combo hardware;
- private Button keyManage;
- private Button findImageButton;
private Combo realmCombo;
private ProfileComposite currPage;
private Map<String, ProfileComposite> profilePages;
@@ -324,14 +322,7 @@
Label imageLabel = new Label(container, SWT.NULL);
imageLabel.setText(WizardMessages.getString(IMAGE_LABEL));
imageText = new Text(container, SWT.BORDER | SWT.SINGLE);
-
- Label realmLabel = new Label(container, SWT.NULL);
- realmLabel.setText(WizardMessages.getString(REALM_LABEL));
-
- // createRealmsControl(container, getRealmNames(realms));
- createRealmsControl(container);
-
- findImageButton = new Button(container, SWT.NULL);
+ Button findImageButton = new Button(container, SWT.NULL);
findImageButton.setText(WizardMessages.getString(FIND_BUTTON_LABEL));
findImageButton.addSelectionListener(findListener);
@@ -339,9 +330,23 @@
archLabel.setText(WizardMessages.getString(ARCH_LABEL));
arch = new Label(container, SWT.NULL);
+ Label realmLabel = new Label(container, SWT.NULL);
+ realmLabel.setText(WizardMessages.getString(REALM_LABEL));
+ // createRealmsControl(container, getRealmNames(realms));
+ createRealmsControl(container);
+
+ Label keyLabel = new Label(container, SWT.NULL);
+ keyLabel.setText(WizardMessages.getString(KEY_LABEL));
+ keyText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ Button keyManageButton = new Button(container, SWT.NULL);
+ keyManageButton.setText(WizardMessages.getString(MANAGE_BUTTON_LABEL));
+ keyManageButton.addSelectionListener(manageListener);
+ if (cloud.getType().equals(DeltaCloud.MOCK_TYPE)) {
+ keyManageButton.setEnabled(false);
+ }
+
Label hardwareLabel = new Label(container, SWT.NULL);
hardwareLabel.setText(WizardMessages.getString(HARDWARE_LABEL));
-
hardware = new Combo(container, SWT.READ_ONLY);
hardware.setEnabled(false);
hardware.setItems(new String[] { WizardMessages.getString(LOADING_VALUE) });
@@ -362,12 +367,6 @@
dummyLabel.setLayoutData(dummyData);
dummyLabel.setVisible(false);
- keyManage = new Button(container, SWT.NULL);
- keyManage.setText(WizardMessages.getString(MANAGE_BUTTON_LABEL));
- keyManage.addSelectionListener(manageListener);
- if (cloud.getType().equals(DeltaCloud.MOCK_TYPE))
- keyManage.setEnabled(false);
-
Point p1 = nameLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
Point p2 = nameText.computeSize(SWT.DEFAULT, SWT.DEFAULT);
Point p3 = findImageButton.computeSize(SWT.DEFAULT, SWT.DEFAULT);
@@ -388,7 +387,7 @@
int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
Point minSize1 = findImageButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- Point minSize2 = keyManage.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ Point minSize2 = keyManageButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
int buttonWidth = Math.max(widthHint, minSize1.x);
buttonWidth = Math.max(buttonWidth, minSize2.x);
@@ -415,11 +414,6 @@
Control control = realmCombo;
- Label keyLabel = new Label(container, SWT.NULL);
- keyLabel.setText(WizardMessages.getString(KEY_LABEL));
-
- keyText = new Text(container, SWT.BORDER | SWT.SINGLE);
-
f = UIUtils.createFormData(realmCombo, 8 + centering + centering2, null, 0, 0, 0, null, 0);
keyLabel.setLayoutData(f);
@@ -427,9 +421,9 @@
f.width = buttonWidth;
f.top = new FormAttachment(realmCombo, 8);
f.right = new FormAttachment(realmCombo, 0, SWT.RIGHT);
- keyManage.setLayoutData(f);
+ keyManageButton.setLayoutData(f);
- f = UIUtils.createFormData(realmCombo, 8 + centering2, null, 0, hardwareLabel, 5, keyManage, -10);
+ f = UIUtils.createFormData(realmCombo, 8 + centering2, null, 0, hardwareLabel, 5, keyManageButton, -10);
keyText.setLayoutData(f);
control = keyText;
14 years