JBoss Tools SVN: r44057 - trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-09-26 15:49:47 -0400 (Wed, 26 Sep 2012)
New Revision: 44057
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsBaseElement.java
Log:
[No JIRA] - Removing unused import
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsBaseElement.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsBaseElement.java 2012-09-26 19:49:20 UTC (rev 44056)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/domain/JaxrsBaseElement.java 2012-09-26 19:49:47 UTC (rev 44057)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain;
-import org.eclipse.core.resources.IResource;
import org.jboss.tools.ws.jaxrs.core.metamodel.IJaxrsElement;
public abstract class JaxrsBaseElement implements IJaxrsElement {
12 years, 3 months
JBoss Tools SVN: r44056 - trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-09-26 15:49:20 -0400 (Wed, 26 Sep 2012)
New Revision: 44056
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsJavaApplicationValidatorDelegate.java
Log:
Fixed - JBIDE-12745 - Bad location for problem marker on JAX-RS Application
https://issues.jboss.org/browse/JBIDE-12745
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsJavaApplicationValidatorDelegate.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsJavaApplicationValidatorDelegate.java 2012-09-26 19:28:26 UTC (rev 44055)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsJavaApplicationValidatorDelegate.java 2012-09-26 19:49:20 UTC (rev 44056)
@@ -49,7 +49,7 @@
if (!application.isOverriden() && applicationPathAnnotation == null) {
addProblem(JaxrsValidationMessages.JAVA_APPLICATION_MISSING_APPLICATION_PATH_ANNOTATION,
JaxrsPreferences.JAVA_APPLICATION_MISSING_APPLICATION_PATH_ANNOTATION, new String[0],
- appJavaElement.getSourceRange().getLength(), appJavaElement.getSourceRange().getOffset(),
+ appJavaElement.getNameRange().getLength(), appJavaElement.getNameRange().getOffset(),
application.getResource(),
JaxrsValidationQuickFixes.JAVA_APPLICATION_MISSING_APPLICATION_PATH_ANNOTATION_ID);
}
12 years, 3 months
JBoss Tools SVN: r44055 - trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-09-26 15:28:26 -0400 (Wed, 26 Sep 2012)
New Revision: 44055
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsValidationMessages.properties
Log:
Fixed - JBIDE-12736 - Parameter substitution in JAX-RS validation messages is broken
https://issues.jboss.org/browse/JBIDE-12736
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsValidationMessages.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsValidationMessages.properties 2012-09-26 19:12:07 UTC (rev 44054)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsValidationMessages.properties 2012-09-26 19:28:26 UTC (rev 44055)
@@ -1,20 +1,20 @@
-SEARCHING_RESOURCES=project '''{0}'''; searching resources for validation (JAX-RS Validator).
-VALIDATING_RESOURCE=project '''{0}'''; resource '''{1}''' (JAX-RS Validator)
-VALIDATING_PROJECT=project '''{0}''' (JAX-RS Validator)
+SEARCHING_RESOURCES=project ''{0}''; searching resources for validation (JAX-RS Validator).
+VALIDATING_RESOURCE=project ''{0}''; resource '''{1}''' (JAX-RS Validator)
+VALIDATING_PROJECT=project ''{0}'' (JAX-RS Validator)
APPLICATION_NO_OCCURRENCE_FOUND=No JAX-RS Activator is defined for the project.
APPLICATION_TOO_MANY_OCCURRENCES=Multiple JAX-RS Activators are defined for the project.
JAVA_APPLICATION_MISSING_APPLICATION_PATH_ANNOTATION=The Application Path should be configured with an @ApplicationPath annotation or in the web deployment descriptor.
-JAVA_APPLICATION_INVALID_TYPE_HIERARCHY=Type '''{0}''' should extend javax.ws.rs.core.Application.
+JAVA_APPLICATION_INVALID_TYPE_HIERARCHY=Type ''{0}'' should extend javax.ws.rs.core.Application.
HTTP_METHOD_MISSING_RETENTION_ANNOTATION=The HTTP Method should have a @Retention(RetentionPolicy.RUNTIME) annotation on its type.
HTTP_METHOD_INVALID_RETENTION_ANNOTATION_VALUE=The @Retention annotation value is not correct. It should be RetentionPolicy.RUNTIME
HTTP_METHOD_MISSING_TARGET_ANNOTATION=The HTTP Method should have a @Target(ElementType.METHOD) annotation on its type.
HTTP_METHOD_INVALID_TARGET_ANNOTATION_VALUE=The @Target annotation value is not correct. It should be ElementType.METHOD
-RESOURCE_METHOD_ILLEGAL_CONTEXT_ANNOTATION=@Context annotation is only allowed on method parameters of type '''{0}'''.
+RESOURCE_METHOD_ILLEGAL_CONTEXT_ANNOTATION=@Context annotation is only allowed on method parameters of type ''{0}''.
RESOURCE_METHOD_MORE_THAN_ONE_UNANNOTATED_PARAMETER=At most one method parameter may be declared without any JAX-RS annotation to map the incoming request entity body.
-RESOURCE_METHOD_UNBOUND_PATHPARAM_ANNOTATION_VALUE=@PathParam value '''{0}''' does not match any @Path annotation template parameters of the java method and the enclosing java type.
-RESOURCE_METHOD_UNBOUND_PATH_ANNOTATION_TEMPLATE_PARAMETER=The @Path template parameter '''{0}''' is not bound to any @Path template parameter.
-RESOURCE_METHOD_INVALID_PATHPARAM_ANNOTATION_VALUE=The @PathParam annotation value '''{0}''' should be alphanumeric.
-RESOURCE_METHOD_NO_PUBLIC_MODIFIER=The method '''{0}''' should be public.
+RESOURCE_METHOD_UNBOUND_PATHPARAM_ANNOTATION_VALUE=@PathParam value ''{0}'' does not match any @Path annotation template parameters of the java method and the enclosing java type.
+RESOURCE_METHOD_UNBOUND_PATH_ANNOTATION_TEMPLATE_PARAMETER=The @Path template parameter ''{0}'' is not bound to any @Path template parameter.
+RESOURCE_METHOD_INVALID_PATHPARAM_ANNOTATION_VALUE=The @PathParam annotation value ''{0}'' should be alphanumeric.
+RESOURCE_METHOD_NO_PUBLIC_MODIFIER=The method ''{0}'' should be public.
12 years, 3 months
JBoss Tools SVN: r44054 - trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation.
by jbosstools-commits@lists.jboss.org
Author: xcoulon
Date: 2012-09-26 15:12:07 -0400 (Wed, 26 Sep 2012)
New Revision: 44054
Modified:
trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidator.java
Log:
In progress - JBIDE-12595 - Disabling JAX-RS validator doesn't affect resources validation - https://issues.jboss.org/browse/JBIDE-12595
Fixed - JBIDE-12729 JAX-RS validation doesn't work at all - https://issues.jboss.org/browse/JBIDE-12729
Modified: trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidator.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidator.java 2012-09-26 18:31:04 UTC (rev 44053)
+++ trunk/ws/plugins/org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/internal/metamodel/validation/JaxrsMetamodelValidator.java 2012-09-26 19:12:07 UTC (rev 44054)
@@ -28,12 +28,15 @@
import org.jboss.tools.common.validation.ContextValidationHelper;
import org.jboss.tools.common.validation.EditorValidationContext;
import org.jboss.tools.common.validation.IAsYouTypeValidator;
+import org.jboss.tools.common.validation.IPreferenceInfo;
import org.jboss.tools.common.validation.IProjectValidationContext;
import org.jboss.tools.common.validation.IValidatingProjectTree;
import org.jboss.tools.common.validation.IValidator;
+import org.jboss.tools.common.validation.PreferenceInfoManager;
import org.jboss.tools.common.validation.TempMarkerManager;
import org.jboss.tools.common.validation.ValidatorManager;
import org.jboss.tools.common.validation.internal.SimpleValidatingProjectTree;
+import org.jboss.tools.ws.jaxrs.core.JBossJaxrsCorePlugin;
import org.jboss.tools.ws.jaxrs.core.configuration.ProjectNatureUtils;
import org.jboss.tools.ws.jaxrs.core.internal.metamodel.builder.JaxrsMetamodelBuilder;
import org.jboss.tools.ws.jaxrs.core.internal.metamodel.domain.JaxrsHttpMethod;
@@ -56,6 +59,10 @@
@SuppressWarnings("restriction")
public class JaxrsMetamodelValidator extends TempMarkerManager implements IValidator, IAsYouTypeValidator {
+ private static final String PREFERENCE_PAGE_ID = "org.jboss.tools.ws.jaxrs.ui";
+
+ private static final String PROPERTY_PAGE_ID = "org.jboss.tools.ws.jaxrs.ui";
+
/** The JAX-RS Validator ID. */
public static final String ID = "org.jboss.tools.ws.jaxrs.JaxrsMetamodelValidator"; //$NON-NLS-1$
@@ -103,7 +110,7 @@
try {
if (!changedFiles.isEmpty()) {
final JaxrsMetamodel jaxrsMetamodel = JaxrsMetamodelLocator.get(project);
- final Set<IResource> allResources = completeValidationSet(jaxrsMetamodel, (IResource[]) changedFiles.toArray(new IResource[0]));
+ final Set<IResource> allResources = completeValidationSet(jaxrsMetamodel, changedFiles.toArray(new IFile[changedFiles.size()]));
for (IResource changedResource : allResources) {
validate(reporter, changedResource, jaxrsMetamodel);
}
@@ -125,7 +132,7 @@
* @param objects
* @return
*/
- private Set<IResource> completeValidationSet(JaxrsMetamodel jaxrsMetamodel, final IResource... changedResources) {
+ private Set<IResource> completeValidationSet(JaxrsMetamodel jaxrsMetamodel, final IFile... changedResources) {
final Set<IResource> resources = new HashSet<IResource>();
for(IResource changedResource : changedResources) {
resources.add(changedResource);
@@ -267,7 +274,7 @@
@Override
protected String getPreferencePageId() {
- return "org.jboss.tools.ws.jaxrs.ui";
+ return PREFERENCE_PAGE_ID;
}
@Override
@@ -297,7 +304,27 @@
@Override
protected void registerPreferenceInfo() {
- // TODO Auto-generated method stub
+ if(PreferenceInfoManager.getPreferenceInfo(JAXRS_PROBLEM_TYPE) == null){
+ PreferenceInfoManager.register(JAXRS_PROBLEM_TYPE, new JaxrsPreferenceInfo());
+ }
+ }
+
+ class JaxrsPreferenceInfo implements IPreferenceInfo{
+
+ @Override
+ public String getPreferencePageId() {
+ return PREFERENCE_PAGE_ID;
+ }
+
+ @Override
+ public String getPropertyPageId() {
+ return PROPERTY_PAGE_ID;
+ }
+
+ @Override
+ public String getPluginId() {
+ return JBossJaxrsCorePlugin.PLUGIN_ID;
+ }
}
12 years, 3 months
JBoss Tools SVN: r44053 - trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/core/util.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2012-09-26 14:31:04 -0400 (Wed, 26 Sep 2012)
New Revision: 44053
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/core/util/XMLMemento.java
Log:
Fixed usage of Integer and Boolean classes.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/core/util/XMLMemento.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/core/util/XMLMemento.java 2012-09-26 17:35:20 UTC (rev 44052)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.core/src/org/jboss/ide/eclipse/as/core/util/XMLMemento.java 2012-09-26 18:31:04 UTC (rev 44053)
@@ -239,7 +239,7 @@
return null;
String strValue = attr.getValue();
try {
- return new Integer(strValue);
+ return Integer.valueOf(strValue);
} catch (NumberFormatException e) {
return null;
}
@@ -364,16 +364,14 @@
if (attr == null)
return null;
String strValue = attr.getValue();
- if ("true".equalsIgnoreCase(strValue)) //$NON-NLS-1$
- return new Boolean(true);
- return new Boolean(false);
+ return Boolean.valueOf(strValue);
}
/*
* @see IMemento#putBoolean(String, boolean)
*/
public void putBoolean(String key, boolean value) {
- element.setAttribute(key, new Boolean(value).toString());
+ element.setAttribute(key, Boolean.toString(value));
}
/**
12 years, 3 months
JBoss Tools SVN: r44051 - in trunk/common/plugins/org.jboss.tools.common.ui: icons and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-09-26 13:16:06 -0400 (Wed, 26 Sep 2012)
New Revision: 44051
Added:
trunk/common/plugins/org.jboss.tools.common.ui/icons/service.png
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/NewServiceCreationWizard.java
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/NewServiceWizardPage.java
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/plugin.xml
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/CommonUIMessages.java
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/messages.properties
Log:
JBIDE-9443
https://issues.jboss.org/browse/JBIDE-9443
New Service Provider wizard.
Added: trunk/common/plugins/org.jboss.tools.common.ui/icons/service.png
===================================================================
(Binary files differ)
Property changes on: trunk/common/plugins/org.jboss.tools.common.ui/icons/service.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/common/plugins/org.jboss.tools.common.ui/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/plugin.xml 2012-09-26 16:52:52 UTC (rev 44050)
+++ trunk/common/plugins/org.jboss.tools.common.ui/plugin.xml 2012-09-26 17:16:06 UTC (rev 44051)
@@ -51,4 +51,23 @@
label="Base Java Hover">
</hover>
</extension>
+
+ <extension point="org.eclipse.ui.newWizards">
+ <wizard
+ category="org.eclipse.jdt.ui.java"
+ class="org.jboss.tools.common.ui.wizard.service.NewServiceCreationWizard"
+ icon="platform:/plugin/org.jboss.tools.common.ui/icons/service.png"
+ id="org.jboss.tools.common.ui.wizard.service.NewServiceCreationWizard"
+ name="Service Provider"
+ project="false">
+ <description>
+ Create a Service Provider Type
+ </description>
+ <!--keywordReference
+ id="xxx">
+ </keywordReference-->
+ </wizard>
+
+ </extension>
+
</plugin>
Modified: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/CommonUIMessages.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/CommonUIMessages.java 2012-09-26 16:52:52 UTC (rev 44050)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/CommonUIMessages.java 2012-09-26 17:16:06 UTC (rev 44051)
@@ -83,6 +83,16 @@
public static String ADD_SUPPRESS_WARNINGS_PROJECT;
public static String ADD_SUPPRESS_WARNINGS_WORKSPACE;
public static String ADD_SUPPRESS_WARNINGS_DISABLE;
+
+ public static String NEW_SERVICE_WIZARD_TITLE;
+ public static String NEW_SERVICE_WIZARD_INTERFACES_LABEL;
+ public static String NEW_SERVICE_WIZARD_DESCRIPTION;
+ public static String NEW_SERVICE_WIZARD_PAGE_NAME;
+ public static String NEW_SERVICE_WIZARD_SERVICE_TYPE_EMPTY;
+ public static String NEW_SERVICE_WIZARD_SERVICE_TYPE_NOT_EXISTS;
+ public static String NEW_SERVICE_WIZARD_SERVICE_TYPE_FINAL;
+ public static String NEW_SERVICE_WIZARD_SERVICE_TYPE_CONCRETE;
+ public static String NEW_SERVICE_WIZARD_SELECT_SERVICE_TYPE_TITLE;
static {
NLS.initializeMessages(BUNDLE_NAME, CommonUIMessages.class);
Modified: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/messages.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/messages.properties 2012-09-26 16:52:52 UTC (rev 44050)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/messages.properties 2012-09-26 17:16:06 UTC (rev 44051)
@@ -41,4 +41,15 @@
ADD_SUPPRESS_WARNINGS_CANCEL=Cancel
ADD_SUPPRESS_WARNINGS_PROJECT=Project
ADD_SUPPRESS_WARNINGS_WORKSPACE=Workspace
-ADD_SUPPRESS_WARNINGS_DISABLE=Disable
\ No newline at end of file
+ADD_SUPPRESS_WARNINGS_DISABLE=Disable
+
+NEW_SERVICE_WIZARD_TITLE=New Service Provider Class
+NEW_SERVICE_WIZARD_INTERFACES_LABEL=Service Type:
+NEW_SERVICE_WIZARD_DESCRIPTION=Create a new Service Provider Java class.
+NEW_SERVICE_WIZARD_PAGE_NAME=Service Provider Type
+NEW_SERVICE_WIZARD_SERVICE_TYPE_EMPTY=Please select service type.
+NEW_SERVICE_WIZARD_SERVICE_TYPE_NOT_EXISTS=Type {0} does not exist.
+NEW_SERVICE_WIZARD_SERVICE_TYPE_FINAL=Service type cannot be final.
+NEW_SERVICE_WIZARD_SERVICE_TYPE_CONCRETE=Non-abstract service type is discouraged.
+NEW_SERVICE_WIZARD_SELECT_SERVICE_TYPE_TITLE=Select Service Type
+
Added: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/NewServiceCreationWizard.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/NewServiceCreationWizard.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/NewServiceCreationWizard.java 2012-09-26 17:16:06 UTC (rev 44051)
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.common.ui.wizard.service;
+
+import java.io.ByteArrayInputStream;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+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.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.internal.ui.wizards.NewElementWizard;
+import org.eclipse.jdt.ui.wizards.NewClassWizardPage;
+import org.eclipse.jdt.ui.wizards.NewTypeWizardPage;
+import org.jboss.tools.common.EclipseUtil;
+import org.jboss.tools.common.ui.CommonUIMessages;
+import org.jboss.tools.common.ui.CommonUIPlugin;
+import org.jboss.tools.common.util.FileUtil;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class NewServiceCreationWizard extends NewElementWizard {
+ protected NewTypeWizardPage fPage;
+
+ public NewServiceCreationWizard() {
+ setWindowTitle(CommonUIMessages.NEW_SERVICE_WIZARD_TITLE);
+ }
+
+ /*
+ * @see Wizard#createPages
+ */
+ public void addPages() {
+ super.addPages();
+ if (fPage == null) {
+ fPage = new NewServiceWizardPage();
+ ((NewClassWizardPage)fPage).init(getSelection());
+ //init page
+ }
+ addPage(fPage);
+ }
+
+ /*(non-Javadoc)
+ * @see org.eclipse.jdt.internal.ui.wizards.NewElementWizard#canRunForked()
+ */
+ protected boolean canRunForked() {
+ return !fPage.isEnclosingTypeSelected();
+ }
+
+ public boolean performFinish() {
+ boolean res = super.performFinish();
+ if(res && ((NewServiceWizardPage)fPage).isToBeRegisteredInMetaInf()) {
+ try {
+ registerService();
+ } catch (CoreException e) {
+ CommonUIPlugin.getDefault().logError(e);
+ }
+ }
+ if (res) {
+ IResource resource= fPage.getModifiedResource();
+ if (resource != null) {
+ selectAndReveal(resource);
+ openResource((IFile) resource);
+ }
+ }
+ return res;
+ }
+
+ private void registerService() throws CoreException {
+ String typeName = fPage.getCreatedType().getFullyQualifiedName();
+ String serviceType = ((NewServiceWizardPage)fPage).getServiceRawType();
+ IContainer f = getServiceFolder();
+ if(f != null) {
+ IFile file = f.getFile(new Path(serviceType));
+ if(file.exists()) {
+ String content = FileUtil.readStream(file);
+ if(content.length() > 0 && !content.endsWith("\n")) { //$NON-NLS-1$
+ content += "\n"; //$NON-NLS-1$
+ }
+ content += typeName;
+ file.setContents(new ByteArrayInputStream(content.getBytes()), true, true, new NullProgressMonitor());
+ } else {
+ String content = typeName;
+ file.create(new ByteArrayInputStream(content.getBytes()), true, new NullProgressMonitor());
+ }
+ }
+ }
+
+ static final String META_INF_FOLDER_NAME = "META-INF"; //$NON-NLS-1$
+ static final String SERVICES_FOLDER_NAME = "services"; //$NON-NLS-1$
+
+ private IFolder getServiceFolder() throws CoreException {
+ IContainer m = getMetaInf();
+ if(m != null) {
+ IFolder ss = m.getFolder(new Path(SERVICES_FOLDER_NAME));
+ if(!ss.exists()) {
+ ss.create(true, true, new NullProgressMonitor());
+ }
+ return ss;
+ }
+ return null;
+ }
+
+ private IContainer getMetaInf() throws CoreException {
+ IProject project = fPage.getCreatedType().getResource().getProject();
+ IResource[] rs = EclipseUtil.getJavaSourceRoots(project);
+ if(rs == null || rs.length == 0) {
+ return null;
+ }
+ for (IResource r: rs) {
+ IFolder f = ((IContainer)r).getFolder(new Path(META_INF_FOLDER_NAME));
+ if(f.exists()) return f;
+ }
+ IFolder f = ((IContainer)rs[0]).getFolder(new Path(META_INF_FOLDER_NAME));
+ f.create(true, true, new NullProgressMonitor());
+ return f;
+ }
+
+ @Override
+ protected void finishPage(IProgressMonitor monitor) throws InterruptedException, CoreException {
+ fPage.createType(monitor); // use the full progress monitor
+ }
+
+ @Override
+ public IJavaElement getCreatedElement() {
+ return fPage.getCreatedType();
+ }
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/NewServiceCreationWizard.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/NewServiceWizardPage.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/NewServiceWizardPage.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/NewServiceWizardPage.java 2012-09-26 17:16:06 UTC (rev 44051)
@@ -0,0 +1,345 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.common.ui.wizard.service;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
+import org.eclipse.jdt.internal.ui.dialogs.OpenTypeSelectionDialog;
+import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
+import org.eclipse.jdt.internal.ui.dialogs.StatusUtil;
+import org.eclipse.jdt.internal.ui.wizards.dialogfields.SelectionButtonDialogFieldGroup;
+import org.eclipse.jdt.ui.wizards.NewClassWizardPage;
+import org.eclipse.jdt.ui.wizards.NewTypeWizardPage;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.common.ui.CommonUIMessages;
+import org.jboss.tools.common.ui.CommonUIPlugin;
+import org.jboss.tools.common.ui.IValidator;
+import org.jboss.tools.common.ui.widget.editor.ButtonFieldEditor.ButtonPressedAction;
+import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.SwtFieldEditorFactory;
+import org.jboss.tools.common.util.EclipseJavaUtil;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class NewServiceWizardPage extends NewClassWizardPage {
+ String defaultTypeName = null;
+
+ protected StatusInfo interfaceNameStatus = new StatusInfo();
+
+ IFieldEditor interfaceField;
+
+ public NewServiceWizardPage() {
+ setTitle(CommonUIMessages.NEW_SERVICE_WIZARD_PAGE_NAME);
+ setDescription(CommonUIMessages.NEW_SERVICE_WIZARD_DESCRIPTION);
+// setImageDescriptor(CDIImages.getImageDescriptor(CDIImages.CDI_CLASS_IMAGE));
+ }
+
+ public void init(IStructuredSelection selection) {
+ super.init(selection);
+ defaultTypeName = null;
+ if (selection != null && !selection.isEmpty()) {
+ Object o = selection.iterator().next();
+ IType type = null;
+ if (o instanceof IType) {
+ type = (IType) o;
+ } else if (o instanceof ICompilationUnit) {
+ ICompilationUnit cu = (ICompilationUnit) o;
+ try {
+ IType[] ts = cu.getTypes();
+ if (ts != null && ts.length > 0)
+ type = ts[0];
+ } catch (JavaModelException e) {
+ CommonUIPlugin.getDefault().logError(e);
+ }
+
+ }
+ boolean isInterface = false;
+ try {
+ isInterface = type != null && type.isInterface();
+ } catch (JavaModelException e) {
+ CommonUIPlugin.getDefault().logError(e);
+ }
+ if (isInterface) {
+ ArrayList<String> interfacesNames = new ArrayList<String>();
+ String name = "";
+ try {
+ name = type.getFullyQualifiedParameterizedName();
+ } catch (JavaModelException e) {
+ name = type.getFullyQualifiedName();
+ }
+ interfacesNames.add(name);
+ setSuperInterfaces(interfacesNames, true);
+ superInterfacesChanged();
+ setDefaultTypeName(name);
+ }
+ }
+ setModifiers(getModifiers(), true);
+ try {
+ Field f = NewTypeWizardPage.class.getDeclaredField("fOtherMdfButtons");
+ if(f != null) {
+ f.setAccessible(true);
+ SelectionButtonDialogFieldGroup g = (SelectionButtonDialogFieldGroup)f.get(this);
+ g.enableSelectionButton(0, false);
+ }
+ } catch (Exception e) {
+ CommonUIPlugin.getDefault().logError(e);
+ }
+ doStatusUpdate();
+ }
+
+ void setDefaultTypeName(String interfaceName) {
+ int d = interfaceName.lastIndexOf('.');
+ int b = interfaceName.indexOf('<');
+ if (b < 0)
+ b = interfaceName.length();
+ String elementName = interfaceName.substring(d + 1, b);
+ String typeName = elementName + "Service";
+// typeName += interfaceName.substring(b);
+
+ String currentTypeName = getTypeName();
+ boolean isDefault = currentTypeName == null || currentTypeName.length() == 0 || currentTypeName.equals(defaultTypeName);
+ if(isDefault) {
+ setTypeName(typeName, true);
+ typeNameChanged();
+ }
+ defaultTypeName = typeName;
+ }
+
+ public void createControl(Composite parent) {
+ initializeDialogUnits(parent);
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setFont(parent.getFont());
+
+ int nColumns = 4;
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = nColumns;
+ composite.setLayout(layout);
+
+ // pick & choose the wanted UI components
+
+ createContainerControls(composite, nColumns);
+ createPackageControls(composite, nColumns);
+ // createEnclosingTypeControls(composite, nColumns);
+
+ createSeparator(composite, nColumns);
+
+ createTypeNameControls(composite, nColumns);
+ createModifierControls(composite, nColumns);
+
+ // createSuperClassControls(composite, nColumns);
+ // createSuperInterfacesControls(composite, nColumns);
+
+ // createMethodStubSelectionControls(composite, nColumns);
+
+ createCustomFields(composite);
+
+ createCommentControls(composite, nColumns);
+ enableCommentControl(true);
+
+ setControl(composite);
+
+ Dialog.applyDialogFont(composite);
+ PlatformUI.getWorkbench().getHelpSystem()
+ .setHelp(composite, IJavaHelpContextIds.NEW_CLASS_WIZARD_PAGE);
+
+ onInterfaceChange();
+ doStatusUpdate();
+ }
+
+ protected void createTypeMembers(IType newType,
+ final ImportsManager imports, IProgressMonitor monitor)
+ throws CoreException {
+ createInheritedMethods(newType, true, true, imports,
+ new SubProgressMonitor(monitor, 1));
+ }
+
+ protected void createCustomFields(Composite composite) {
+ createInterfaceField(composite);
+ }
+
+ protected void createInterfaceField(Composite composite) {
+ interfaceField = SwtFieldEditorFactory.INSTANCE.createButtonFieldEditor("Interface",
+ CommonUIMessages.NEW_SERVICE_WIZARD_INTERFACES_LABEL, "",
+ new ButtonPressedAction(CommonUIMessages.SWT_FIELD_EDITOR_FACTORY_BROWS) {
+ public void run() {
+ OpenTypeSelectionDialog dialog = new OpenTypeSelectionDialog(getShell(), false, getContainer(),
+ getJavaProject() != null
+ ? SearchEngine.createJavaSearchScope(new IJavaProject[] {getJavaProject()})
+ : SearchEngine.createJavaSearchScope(new IJavaProject[0]),
+ IJavaSearchConstants.CLASS_AND_INTERFACE);
+ dialog.setTitle(CommonUIMessages.NEW_SERVICE_WIZARD_SELECT_SERVICE_TYPE_TITLE);
+ if(dialog.open() == IDialogConstants.OK_ID) {
+ Object[] os = dialog.getResult();
+ if(os != null && os.length == 1) {
+ IType t = (IType)os[0];
+ interfaceField.setValue(t.getFullyQualifiedName());
+ }
+ }
+ }
+ },
+ new IValidator() {
+ @Override
+ public Map<String, IStatus> validate(Object value, Object context) {
+ return null;
+ }
+ });
+ interfaceField.doFillIntoGrid(composite);
+ interfaceField.addPropertyChangeListener(new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ onInterfaceChange();
+ }
+ });
+ }
+
+ protected void onInterfaceChange() {
+ interfaceNameStatus = new StatusInfo();
+ String q = interfaceField == null ? "" : interfaceField.getValue().toString().trim();
+
+ boolean isInterface = false, isClass = false;
+
+ if(getJavaProject() != null && q.length() > 0) {
+ String qRaw = q;
+ if(qRaw.indexOf('<') > 0) {
+ qRaw = qRaw.substring(0, qRaw.indexOf('<'));
+ }
+ try {
+ IType t = EclipseJavaUtil.findType(getJavaProject(), qRaw);
+ if(t != null) {
+ isInterface = t.isInterface();
+ isClass = !t.isInterface();
+ if(Flags.isFinal(t.getFlags())) {
+ interfaceNameStatus.setError(CommonUIMessages.NEW_SERVICE_WIZARD_SERVICE_TYPE_FINAL);
+ } else if(isClass && !Flags.isAbstract(t.getFlags())) {
+ interfaceNameStatus.setWarning(CommonUIMessages.NEW_SERVICE_WIZARD_SERVICE_TYPE_CONCRETE);
+ }
+ } else {
+ isInterface = true;
+ interfaceNameStatus.setError(NLS.bind(CommonUIMessages.NEW_SERVICE_WIZARD_SERVICE_TYPE_NOT_EXISTS, q));
+ }
+ } catch (JavaModelException e) {
+ CommonUIPlugin.getDefault().logError(e);
+ interfaceNameStatus.setError(NLS.bind(CommonUIMessages.NEW_SERVICE_WIZARD_SERVICE_TYPE_NOT_EXISTS, q));
+ }
+ }
+ if(q.length() == 0) {
+ interfaceNameStatus.setError(CommonUIMessages.NEW_SERVICE_WIZARD_SERVICE_TYPE_EMPTY);
+ }
+ if(isInterface) {
+ List<String> is = new ArrayList<String>();
+ if(q.length() > 0) is.add(q.trim());
+ setSuperInterfaces(is, true);
+ setSuperClass("", true);
+ } else if(isClass) {
+ setSuperInterfaces(new ArrayList<String>(), true);
+ setSuperClass(q, true);
+ }
+
+ doStatusUpdate();
+ }
+
+ @Override
+ protected IStatus superInterfacesChanged() {
+ List list = getSuperInterfaces();
+ if(list != null && !list.isEmpty()) {
+ setDefaultTypeName(list.get(0).toString());
+ }
+ StatusInfo result = (StatusInfo) super.superInterfacesChanged();
+ return result;
+ }
+
+ @Override
+ protected IStatus superClassChanged() {
+ String n = getSuperClass();
+ if(n != null && n.length() > 0 && !n.endsWith("Object")) {
+ setDefaultTypeName(n);
+ }
+ StatusInfo result = (StatusInfo) super.superClassChanged();
+ return result;
+ }
+
+ private void doStatusUpdate() {
+ // status of all used components
+ IStatus[] status = new IStatus[] {
+ fContainerStatus,
+ isEnclosingTypeSelected() ? fEnclosingTypeStatus
+ : fPackageStatus, fTypeNameStatus, fModifierStatus,
+ fSuperClassStatus, fSuperInterfacesStatus };
+
+ // the mode severe status will be displayed and the OK button
+ // enabled/disabled.
+ updateStatus(status);
+ }
+
+ protected void updateStatus(IStatus[] status) {
+ if(!CommonUIMessages.NEW_SERVICE_WIZARD_DESCRIPTION.equals(getDescription())) {
+ setDescription(CommonUIMessages.NEW_SERVICE_WIZARD_DESCRIPTION);
+ }
+ IStatus[] ns = new IStatus[status.length + 1];
+ System.arraycopy(status, 0, ns, 0, status.length);
+ ns[status.length] = interfaceNameStatus;
+ status = ns;
+ updateStatus(StatusUtil.getMostSevere(status));
+ }
+
+ public boolean isToBeRegisteredInMetaInf() {
+ return true;
+ }
+
+ @Override
+ public void setVisible(boolean visible) {
+ if(!getControl().isVisible() && visible && fSuperInterfacesStatus.matches(IStatus.ERROR) && !fTypeNameStatus.matches(IStatus.ERROR)) {
+ setDescription(fSuperInterfacesStatus.getMessage());
+ }
+ super.setVisible(visible);
+ }
+
+ protected String getSuperInterfacesLabel() {
+ return CommonUIMessages.NEW_SERVICE_WIZARD_INTERFACES_LABEL;
+ }
+
+ public String getServiceRawType() {
+ return (interfaceField == null) ? "" : toRawTypeName(interfaceField.getValueAsString());
+ }
+
+ private static String toRawTypeName(String typeName) {
+ return typeName.indexOf('<') >= 0 ? typeName.substring(0, typeName.indexOf('<')) : typeName;
+ }
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/wizard/service/NewServiceWizardPage.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
12 years, 3 months
JBoss Tools SVN: r44050 - trunk/common/plugins/org.jboss.tools.common.core/src/org/jboss/tools/common/java.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-09-26 12:52:52 -0400 (Wed, 26 Sep 2012)
New Revision: 44050
Modified:
trunk/common/plugins/org.jboss.tools.common.core/src/org/jboss/tools/common/java/ParametedType.java
Log:
JBIDE-12479
https://issues.jboss.org/browse/JBIDE-12479
Reduce initial size of array that normally has no more than 2 elements.
Modified: trunk/common/plugins/org.jboss.tools.common.core/src/org/jboss/tools/common/java/ParametedType.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.core/src/org/jboss/tools/common/java/ParametedType.java 2012-09-26 15:43:35 UTC (rev 44049)
+++ trunk/common/plugins/org.jboss.tools.common.core/src/org/jboss/tools/common/java/ParametedType.java 2012-09-26 16:52:52 UTC (rev 44050)
@@ -37,7 +37,7 @@
protected IType type;
protected int arrayIndex = 0;
protected String signature;
- protected List<ParametedType> parameterTypes = new ArrayList<ParametedType>();
+ protected List<ParametedType> parameterTypes = new ArrayList<ParametedType>(1);
protected boolean primitive;
protected boolean isUpper = false;
12 years, 3 months
JBoss Tools SVN: r44049 - trunk/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-09-26 11:43:35 -0400 (Wed, 26 Sep 2012)
New Revision: 44049
Removed:
trunk/build/product/
Log:
empty folder
12 years, 3 months
JBoss Tools SVN: r44048 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2012-09-26 11:23:39 -0400 (Wed, 26 Sep 2012)
New Revision: 44048
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/JBossASHandler.java
Log:
JBIDE-12733 to trunk
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/JBossASHandler.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/JBossASHandler.java 2012-09-26 15:11:57 UTC (rev 44047)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/runtime/JBossASHandler.java 2012-09-26 15:23:39 UTC (rev 44048)
@@ -70,6 +70,8 @@
SERVER_DEFAULT_NAME.put(IJBossToolingConstants.SERVER_AS_70, Messages.JBossRuntimeStartup_JBoss_Application_Server_7_0);
SERVER_DEFAULT_NAME.put(IJBossToolingConstants.SERVER_AS_71, Messages.JBossRuntimeStartup_JBoss_Application_Server_7_1);
SERVER_DEFAULT_NAME.put(IJBossToolingConstants.SERVER_EAP_60, Messages.JBossRuntimeStartup_JBoss_EAP_Server_6_0);
+
+ // See also JBIDE-12603 (fileset not added for first runtime)
Bundle bundle = Platform.getBundle("org.jboss.ide.eclipse.archives.webtools"); //$NON-NLS-1$
if (bundle != null) {
try {
12 years, 3 months