JBoss Tools SVN: r27528 - trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/META-INF.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2010-12-15 16:26:15 -0500 (Wed, 15 Dec 2010)
New Revision: 27528
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/META-INF/MANIFEST.MF
Log:
JBIDE-7040 added plugins that seem to be required for UI to work with RSE. Need to be optional though.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/META-INF/MANIFEST.MF 2010-12-15 21:09:12 UTC (rev 27527)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/META-INF/MANIFEST.MF 2010-12-15 21:26:15 UTC (rev 27528)
@@ -26,6 +26,10 @@
org.eclipse.rse.files.ui,
org.eclipse.rse.ui,
org.eclipse.wst.server.ui,
+ org.eclipse.tm.terminal,
+ org.eclipse.tm.terminal.view,
+ org.eclipse.tm.terminal.telnet,
+ org.eclipse.tm.terminal.ssh,
org.eclipse.debug.ui;bundle-version="[3.6.0,4.0.0)"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
14 years
JBoss Tools SVN: r27527 - trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/src/org/jboss/ide/eclipse/as/rse/ui.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2010-12-15 16:09:12 -0500 (Wed, 15 Dec 2010)
New Revision: 27527
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/src/org/jboss/ide/eclipse/as/rse/ui/RSEDeploymentPreferenceUI.java
Log:
JBIDE-7588 minimal fix to stop text field to gain focus
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/src/org/jboss/ide/eclipse/as/rse/ui/RSEDeploymentPreferenceUI.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/src/org/jboss/ide/eclipse/as/rse/ui/RSEDeploymentPreferenceUI.java 2010-12-15 21:03:11 UTC (rev 27526)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/src/org/jboss/ide/eclipse/as/rse/ui/RSEDeploymentPreferenceUI.java 2010-12-15 21:09:12 UTC (rev 27527)
@@ -283,14 +283,20 @@
public void propertyChange(PropertyChangeEvent evt) {
updatingFromModelChange = true;
if( evt.getPropertyName().equals(RSEUtils.RSE_SERVER_HOME_DIR)) {
- rseServerHome.setText(evt.getNewValue().toString());
+ updateTextIfChanges(rseServerHome, evt.getNewValue().toString());
} else if( evt.getPropertyName().equals(RSEUtils.RSE_SERVER_CONFIG)) {
- rseServerConfig.setText(evt.getNewValue().toString());
+ updateTextIfChanges(rseServerConfig, evt.getNewValue().toString());
} else if( evt.getPropertyName().equals(RSEUtils.RSE_SERVER_HOST)) {
combo.setHostName(evt.getNewValue().toString());
}
updatingFromModelChange = false;
}
+
+ private void updateTextIfChanges(Text control, String newValue) {
+ if(!control.getText().equals(newValue)) {
+ control.setText(newValue);
+ }
+ }
protected void browseClicked() {
SystemRemoteFileDialog d = new SystemRemoteFileDialog(
14 years
JBoss Tools SVN: r27526 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui: src/org/jboss/tools/deltacloud/ui/commands and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-15 16:03:11 -0500 (Wed, 15 Dec 2010)
New Revision: 27526
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java
Log:
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-12-15 20:31:23 UTC (rev 27525)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-12-15 21:03:11 UTC (rev 27526)
@@ -113,65 +113,48 @@
<handler
class="org.jboss.tools.deltacloud.ui.commands.EditConnectionHandler"
commandId="org.jboss.tools.deltacloud.ui.editconnection">
- <activeWhen>
- <with
- variable="selection">
- <iterate>
- <instanceof
- value="org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudViewItem">
- </instanceof>
- </iterate>
- </with>
- </activeWhen>
<enabledWhen>
<with
variable="selection">
- <count value="+" />
+ <and>
+ <count value="1" />
+ <iterate operator="and">
+ <adapt
+ type="org.jboss.tools.deltacloud.core.DeltaCloud" />
+ </iterate>
+ </and>
</with>
</enabledWhen>
</handler>
<handler
class="org.jboss.tools.deltacloud.ui.commands.DisconnectCloudHandler"
commandId="org.eclipse.ui.edit.delete">
- <activeWhen>
- <with
- variable="selection">
- <iterate>
- <instanceof
- value="org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudViewItem">
- </instanceof>
- </iterate>
- </with>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
+ <enabledWhen>
+ <with
+ variable="selection">
+ <and>
<count value="+" />
- </with>
- </enabledWhen>
+ <iterate operator="and">
+ <adapt
+ type="org.jboss.tools.deltacloud.core.DeltaCloud" />
+ </iterate>
+ </and>
+ </with>
+ </enabledWhen>
</handler>
<handler
class="org.jboss.tools.deltacloud.ui.commands.RefreshCloudHandler"
commandId="org.eclipse.ui.file.refresh">
- <activeWhen>
- <with
- variable="selection">
- <and>
- <count value="+" />
- <iterate>
- <instanceof
- value="org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudViewItem">
- </instanceof>
- </iterate>
- </and>
- </with>
- </activeWhen>
- <enabledWhen>
+ <enabledWhen>
<with
variable="selection">
- <count value="+" />
+ <and>
+ <count value="1" />
+ <adapt
+ type="org.jboss.tools.deltacloud.core.DeltaCloud" />
+ </and>
</with>
- </enabledWhen>
+ </enabledWhen>
</handler>
<handler
class="org.jboss.tools.deltacloud.ui.commands.RefreshInstancesHandler"
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java 2010-12-15 20:31:23 UTC (rev 27525)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java 2010-12-15 21:03:11 UTC (rev 27526)
@@ -38,8 +38,7 @@
import org.jboss.tools.deltacloud.core.DeltaCloudManager;
import org.jboss.tools.deltacloud.ui.ErrorUtils;
import org.jboss.tools.deltacloud.ui.views.CVMessages;
-import org.jboss.tools.deltacloud.ui.views.cloud.CloudItem;
-import org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudViewItem;
+import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
/**
* @author Andre Dietisheim
@@ -109,8 +108,15 @@
}
} catch (DeltaCloudException e) {
// TODO internationalize strings
+ String message = "";
+ if (deltaCloud != null) {
+ message = MessageFormat.format("Could not disconnect cloud {0}", deltaCloud.getName());
+ } else {
+ // TODO: internationalize strings
+ message = "Could not disconnect cloud";
+ }
ErrorUtils.handleError("Error",
- MessageFormat.format("Could not disconnect cloud {0}", deltaCloud.getName()), e, shell);
+ message, e, shell);
}
}
@@ -132,12 +138,7 @@
DeltaCloud deltaCloud = null;
if (selectedElements.size() > 0) {
Object object = selectedElements.get(0);
- if (object instanceof CloudItem) {
- Object element = ((CloudItem) object).getModel();
- if (element instanceof DeltaCloud) {
- deltaCloud = (DeltaCloud) element;
- }
- }
+ deltaCloud = UIUtils.adapt(object, DeltaCloud.class);
}
return deltaCloud;
}
@@ -145,7 +146,7 @@
private Collection<DeltaCloud> getSelectedClouds(List<?> selectedElements) {
Set<DeltaCloud> selectedClouds = new HashSet<DeltaCloud>();
for (Object element : selectedElements) {
- DeltaCloud deltaCloud = getDeltaCloud(element);
+ DeltaCloud deltaCloud = UIUtils.adapt(element, DeltaCloud.class);
if (deltaCloud != null) {
selectedClouds.add(deltaCloud);
}
@@ -153,31 +154,6 @@
return selectedClouds;
}
- private DeltaCloud getDeltaCloud(Object item) {
- if (!(item instanceof DeltaCloudViewItem)) {
- return null;
- }
-
- DeltaCloud cloud = getDeltaCloud((DeltaCloudViewItem<?>) item);
-
- if (cloud == null) {
- return null;
- }
- return cloud;
- }
-
- private DeltaCloud getDeltaCloud(DeltaCloudViewItem<?> element) {
- if (element == null) {
- return null;
- }
- Object cloud = element.getModel();
- if (cloud instanceof DeltaCloud) {
- return (DeltaCloud) cloud;
- }
-
- return getDeltaCloud((DeltaCloudViewItem<?>) element.getParent());
- }
-
private void removeDeltaClouds(Object[] deltaClouds) throws DeltaCloudException {
for (Object deltaCloud : deltaClouds) {
removeDeltaCloud((DeltaCloud) deltaCloud);
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java 2010-12-15 20:31:23 UTC (rev 27525)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java 2010-12-15 21:03:11 UTC (rev 27526)
@@ -21,8 +21,6 @@
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.handlers.HandlerUtil;
import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.ui.views.cloud.CloudItem;
-import org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudViewItem;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
import org.jboss.tools.internal.deltacloud.ui.wizards.EditCloudConnectionWizard;
@@ -35,13 +33,8 @@
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
if (selection instanceof IStructuredSelection) {
- DeltaCloudViewItem<?> element = UIUtils.getFirstAdaptedElement(selection, DeltaCloudViewItem.class);
- while (element != null && !(element instanceof CloudItem)) {
- element = (DeltaCloudViewItem<?>) element.getParent();
- }
- if (element != null) {
- CloudItem cloudElement = (CloudItem) element;
- DeltaCloud cloud = (DeltaCloud) cloudElement.getModel();
+ DeltaCloud cloud = UIUtils.getFirstAdaptedElement(selection, DeltaCloud.class);
+ if (cloud != null) {
IWizard wizard = new EditCloudConnectionWizard(cloud);
WizardDialog dialog = new WizardDialog(UIUtils.getActiveWorkbenchWindow().getShell(), wizard);
dialog.create();
14 years
JBoss Tools SVN: r27525 - in trunk/deltacloud/plugins: org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-15 15:31:23 -0500 (Wed, 15 Dec 2010)
New Revision: 27525
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/Driver.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudDriverValidator.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/Url2DriverConverter.java
Removed:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudTypeValidator.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/Url2DeltaCloudTypeConverter.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionModel.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
Log:
[JBIDE-7864]
* DeltaCloud: replaced cloud type strings by Driver enum
* removing references to DeltaCloudClient#DeltaCloudServerType, replacing by DeltaCloud#Type
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-12-15 20:24:34 UTC (rev 27524)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-12-15 20:31:23 UTC (rev 27525)
@@ -1,6 +1,9 @@
2010-12-15 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/DeltaCloud.java
+ (Driver):
+ [JBIDE-7864] replacing cloud type strings by Driver enum
+ * src/org/jboss/tools/deltacloud/core/DeltaCloud.java
(getInstanceJob):
(waitWhilePending):
(registerInstanceJob):
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-12-15 20:24:34 UTC (rev 27524)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-12-15 20:31:23 UTC (rev 27525)
@@ -21,6 +21,7 @@
import org.jboss.tools.deltacloud.core.client.DeltaCloudAuthException;
import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
+import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl.DeltaCloudServerType;
import org.jboss.tools.deltacloud.core.client.DeltaCloudNotFoundClientException;
import org.jboss.tools.deltacloud.core.client.HardwareProfile;
import org.jboss.tools.deltacloud.core.client.Image;
@@ -35,9 +36,6 @@
*/
public class DeltaCloud extends ObservablePojo {
- public final static String MOCK_TYPE = "MOCK"; //$NON-NLS-1$
- public final static String EC2_TYPE = "EC2"; //$NON-NLS-1$
-
public static final String PROP_INSTANCES = "instances";
public static final String PROP_INSTANCES_ADDED = "instancesAdded";
public static final String PROP_INSTANCES_REMOVED = "instancesRemoved";
@@ -47,7 +45,7 @@
private String name;
private String username;
private String url;
- private String type;
+ private Driver driver;
private String lastKeyname = "";
private String lastImageId = "";
@@ -69,31 +67,31 @@
this(name, url, username, passwd, null);
}
- public DeltaCloud(String name, String url, String username, String password, String type)
+ public DeltaCloud(String name, String url, String username, String password, Driver driver)
throws DeltaCloudException {
- this(name, url, username, password, type, IImageFilter.ALL_STRING, IInstanceFilter.ALL_STRING);
+ this(name, url, username, password, driver, IImageFilter.ALL_STRING, IInstanceFilter.ALL_STRING);
}
- public DeltaCloud(String name, String url, String username, String type, String imageFilterRules,
+ public DeltaCloud(String name, String url, String username, Driver driver, String imageFilterRules,
String instanceFilterRules) throws DeltaCloudException {
- this(name, url, username, null, type, imageFilterRules, instanceFilterRules);
+ this(name, url, username, null, driver, imageFilterRules, instanceFilterRules);
}
public DeltaCloud(String name, String url, String username, String password,
- String type, String imageFilterRules, String instanceFilterRules) throws DeltaCloudException {
+ Driver driver, String imageFilterRules, String instanceFilterRules) throws DeltaCloudException {
this.url = url;
this.name = name;
this.username = username;
- this.type = type;
+ this.driver = driver;
this.passwordStore = createSecurePasswordStore(name, username, password);
this.client = createClient(name, url, username, passwordStore.getPassword());
imageFilter = createImageFilter(imageFilterRules);
instanceFilter = createInstanceFilter(instanceFilterRules);
}
- public void update(String name, String url, String username, String password, String type)
+ public void update(String name, String url, String username, String password, Driver driver)
throws DeltaCloudException {
- this.type = type;
+ this.driver = driver;
boolean nameChanged = updateName(name);
boolean connectionPropertiesChanged = updateConnectionProperties(url, username, password);
@@ -170,8 +168,8 @@
return passwordStore.getPassword();
}
- public String getType() {
- return type;
+ public Driver getDriver() {
+ return driver;
}
public String getLastImageId() {
@@ -576,4 +574,14 @@
public String toString() {
return name;
}
+
+ public static Driver getServerDriver(String url) throws DeltaCloudException {
+ try {
+ DeltaCloudServerType serverType = new DeltaCloudClientImpl(url, "", "").getServerType();
+ return Driver.valueOf(serverType);
+ } catch (Exception e) {
+ // TODO internationalize strings
+ throw new DeltaCloudException("Could not determine the driver of the server on url " + url, e);
+ }
+ }
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java 2010-12-15 20:24:34 UTC (rev 27524)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java 2010-12-15 20:31:23 UTC (rev 27525)
@@ -30,6 +30,10 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+/**
+ * @author Jeff Johnston
+ * @author André Dietisheim
+ */
public class DeltaCloudManager {
private static final DeltaCloudManager INSTANCE = new DeltaCloudManager();
@@ -80,12 +84,12 @@
name = attrs.getNamedItem("name").getNodeValue(); // $NON-NLS-1$
String url = attrs.getNamedItem("url").getNodeValue(); // $NON-NLS-1$
String username = attrs.getNamedItem("username").getNodeValue(); // $NON-NLS-1$
- String type = attrs.getNamedItem("type").getNodeValue(); // $NON-NLS-1$
+ Driver driver = Driver.checkedValueOf(attrs.getNamedItem("type").getNodeValue()); // $NON-NLS-1$
String imageFilterRules = getImageFilterRules(attrs.getNamedItem("imagefilter")); // $NON-NLS-1$
String instanceFilterRules = getInstanceFilterRules(attrs.getNamedItem("instancefilter")); // $NON-NLS-1$
String lastKeyName = getLastKeyName(attrs.getNamedItem("lastkeyname")); // $NON-NLS-1$
String lastImageId = getLastKeyName(attrs.getNamedItem("lastimage")); // $NON-NLS-1$
- cloud = new DeltaCloud(name, url, username, type, imageFilterRules, instanceFilterRules);
+ cloud = new DeltaCloud(name, url, username, driver, imageFilterRules, instanceFilterRules);
clouds.add(cloud);
cloud.setLastImageId(lastImageId);
cloud.setLastKeyname(lastKeyName);
@@ -144,7 +148,7 @@
private String createCloudXML(DeltaCloud d) {
return "<cloud name=\"" + d.getName() + "\" url=\"" //$NON-NLS-1$ //$NON-NLS-2$
+ d.getURL() + "\" username=\"" + d.getUsername() + //$NON-NLS-1$ //$NON-NLS-2$
- "\" type=\"" + d.getType() + //$NON-NLS-1$ //$NON-NLS-2$
+ "\" type=\"" + d.getDriver() + //$NON-NLS-1$ //$NON-NLS-2$
"\" imagefilter=\"" + d.getImageFilter() + //$NON-NLS-1$ //$NON-NLS-2$
"\" instancefilter=\"" + d.getInstanceFilter() + //$NON-NLS-1$ //$NON-NLS-2$
"\" lastkeyname=\"" + d.getLastKeyname() + //$NON-NLS-1$ //$NON-NLS-2$
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/Driver.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/Driver.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/Driver.java 2010-12-15 20:31:23 UTC (rev 27525)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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.deltacloud.core;
+
+import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl.DeltaCloudServerType;
+
+/**
+ * @author André Dietisheim
+ */
+public enum Driver {
+
+ MOCK(DeltaCloudServerType.MOCK), EC2(DeltaCloudServerType.EC2), UNKNOWN(DeltaCloudServerType.UNKNOWN);
+
+ private DeltaCloudServerType deltaCloudServerType;
+
+ private Driver(DeltaCloudServerType deltaCloudServerType) {
+ this.deltaCloudServerType = deltaCloudServerType;
+ }
+
+ public static Driver valueOf(DeltaCloudServerType deltaCloudServerType) {
+ for(Driver type : values()) {
+ if (type.deltaCloudServerType.equals(deltaCloudServerType)) {
+ return type;
+ }
+ }
+ return UNKNOWN;
+ }
+
+ public static Driver checkedValueOf(String name) {
+ for (Driver type : values()) {
+ if (type.name().equals(name)) {
+ return type;
+ }
+ }
+ return UNKNOWN;
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/Driver.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-12-15 20:24:34 UTC (rev 27524)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-12-15 20:31:23 UTC (rev 27525)
@@ -1,5 +1,12 @@
2010-12-15 André Dietisheim <adietish(a)redhat.com>
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java:
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java:
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java:
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudTypeValidator.java:
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java:
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionModel.java:
+ [JBIDE-7864] removing references to DeltaCloudClient#DeltaCloudServerType, replacing by DeltaCloud#Type
* src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java (WatchCreateJob):
[JBIDE-7912] replaced custom WatchCreateJob and replaced with InstanceStateJob to have consistent scheduling across jobs
in the client
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionModel.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionModel.java 2010-12-15 20:24:34 UTC (rev 27524)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionModel.java 2010-12-15 20:31:23 UTC (rev 27525)
@@ -12,8 +12,7 @@
import java.net.MalformedURLException;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl.DeltaCloudServerType;
+import org.jboss.tools.deltacloud.core.Driver;
import org.jboss.tools.internal.deltacloud.core.observable.ObservablePojo;
/**
@@ -25,7 +24,7 @@
public static final String PROPERTY_NAME = "name"; //$NON-NLS-1$
public static final String PROPERTY_PASSWORD = "password"; //$NON-NLS-1$
public static final String PROPERTY_USERNAME = "username"; //$NON-NLS-1$
- public static final String PROPERTY_TYPE = "type"; //$NON-NLS-1$
+ public static final String PROPERTY_DRIVER = "type"; //$NON-NLS-1$
public static final String UNKNOWN_TYPE_LABEL = "UnknownType.label"; //$NON-NLS-1$
public static final String INVALID_URL = "ErrorInvalidURL.text"; //$NON-NLS-1$
@@ -36,46 +35,26 @@
private String username;
private String password;
- private DeltaCloudClientImpl.DeltaCloudServerType cloudType;
+ private Driver driver;
private String initialName;
public CloudConnectionModel() {
- this("", "", "", "", (DeltaCloudServerType) null);
+ this("", "", "", "", (Driver) null);
}
- public CloudConnectionModel(String name, String url, String username, String password, String cloudType) throws MalformedURLException {
- this(name, url, username, password, getDeltaCloudType(cloudType, url));
- }
-
public CloudConnectionModel(String name, String url, String username, String password) throws MalformedURLException {
- this(name, url, username, password, getDeltaCloudTypeFromUrl(url));
+ this(name, url, username, password, (Driver) null);
}
- public CloudConnectionModel(String name, String url, String username, String password, DeltaCloudServerType deltaCloudType) {
+ public CloudConnectionModel(String name, String url, String username, String password, Driver cloudType) {
this.name = name;
this.initialName = name;
this.url = url;
this.username = username;
this.password = password;
- this.cloudType = deltaCloudType;
+ this.driver = cloudType;
}
-
- private static DeltaCloudServerType getDeltaCloudTypeFromUrl(String url) throws MalformedURLException {
- return new DeltaCloudClientImpl(url, "", "").getServerType();
- }
- private static DeltaCloudServerType getDeltaCloudType(String cloudType, String url) throws MalformedURLException {
- if (cloudType == null) {
- return null;
- }
-
- try {
- return DeltaCloudServerType.valueOf(cloudType);
- } catch (IllegalArgumentException e) {
- return getDeltaCloudTypeFromUrl(url);
- }
- }
-
public String getUsername() {
return username;
}
@@ -112,11 +91,11 @@
getPropertyChangeSupport().firePropertyChange(PROPERTY_URL, this.url, this.url = url);
}
- public DeltaCloudClientImpl.DeltaCloudServerType getType() {
- return cloudType;
+ public Driver getDriver() {
+ return driver;
}
- public void setType(DeltaCloudClientImpl.DeltaCloudServerType cloudType) {
- getPropertyChangeSupport().firePropertyChange(PROPERTY_TYPE, this.cloudType, this.cloudType = cloudType);
+ public void setType(Driver cloudType) {
+ getPropertyChangeSupport().firePropertyChange(PROPERTY_DRIVER, this.driver, this.driver = cloudType);
}
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java 2010-12-15 20:24:34 UTC (rev 27524)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java 2010-12-15 20:31:23 UTC (rev 27525)
@@ -25,6 +25,7 @@
import org.eclipse.core.databinding.observable.value.ValueChangeEvent;
import org.eclipse.core.databinding.validation.IValidator;
import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.databinding.fieldassist.ControlDecorationSupport;
@@ -56,6 +57,7 @@
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudManager;
+import org.jboss.tools.deltacloud.core.Driver;
import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl.DeltaCloudServerType;
import org.jboss.tools.deltacloud.ui.Activator;
import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
@@ -123,12 +125,12 @@
private Label typeLabel;
- public DeltaCloudTypeLabelAdapter(DeltaCloudServerType cloudType, Label typeLabel) {
+ public DeltaCloudTypeLabelAdapter(Driver cloudType, Label typeLabel) {
this.typeLabel = typeLabel;
init(cloudType);
}
- private void init(DeltaCloudServerType cloudType) {
+ private void init(Driver cloudType) {
setLabelText(cloudType);
}
@@ -139,7 +141,7 @@
}
private void setLabelText(Object cloudType) {
- if (cloudType != null && !DeltaCloudServerType.UNKNOWN.equals(cloudType)) {
+ if (cloudType != null && !Driver.UNKNOWN.equals(cloudType)) {
typeLabel.setText(cloudType.toString());
} else {
typeLabel.setText("?"); // $NON-NLS-1$
@@ -278,15 +280,15 @@
throws MalformedURLException, DeltaCloudException {
this(pageName, initial.getName(), initial.getURL(), initial.getUsername(),
- initial.getPassword(), initial.getType(), connection);
+ initial.getPassword(), initial.getDriver(), connection);
}
public CloudConnectionPage(String pageName, String defaultName, String defaultUrl,
- String defaultUsername, String defaultPassword, String defaultType,
+ String defaultUsername, String defaultPassword, Driver defaultDriver,
CloudConnection cloudConnection) throws MalformedURLException {
super(pageName);
this.connectionModel = new CloudConnectionModel(defaultName, defaultUrl, defaultUsername, defaultPassword,
- defaultType);
+ defaultDriver);
this.cloudConnection = cloudConnection;
setDescription(WizardMessages.getString(DESCRIPTION));
setTitle(WizardMessages.getString(TITLE));
@@ -318,12 +320,14 @@
urlLabel.setText(WizardMessages.getString(URL_LABEL));
Point p1 = urlLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
Text urlText = new Text(container, SWT.BORDER | SWT.SINGLE);
+
dbc.bindValue(
WidgetProperties.text(SWT.Modify).observe(urlText),
BeanProperties.value(
CloudConnectionModel.class, CloudConnectionModel.PROPERTY_URL).observe(connectionModel),
- new UpdateValueStrategy().setAfterGetValidator(
- new MandatoryStringValidator(WizardMessages.getString(MUST_ENTER_A_URL))), null);
+ new UpdateValueStrategy()
+ .setAfterGetValidator(new MandatoryStringValidator(WizardMessages.getString(MUST_ENTER_A_URL))),
+ null);
String url = new TextPreferenceValue(IPreferenceKeys.LAST_URL, Activator.getDefault())
.get(urlText.getText());
@@ -497,15 +501,15 @@
*/
private Binding bindCloudType(DataBindingContext dbc, Text urlText, final Label typeLabel) {
UpdateValueStrategy updateStrategy = new UpdateValueStrategy();
- Url2DeltaCloudTypeConverter urlToCloudTypeConverter = new Url2DeltaCloudTypeConverter();
+ Url2DriverConverter urlToCloudTypeConverter = new Url2DriverConverter();
updateStrategy.setConverter(urlToCloudTypeConverter);
- updateStrategy.setBeforeSetValidator(new CloudTypeValidator());
+ updateStrategy.setBeforeSetValidator(new CloudDriverValidator());
// bind url to cloud type in model
Binding urlTypeBinding = dbc.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(CLOUDTYPE_CHECK_DELAY,
urlText),
- BeanProperties.value(CloudConnectionModel.PROPERTY_TYPE).observe(connectionModel),
+ BeanProperties.value(CloudConnectionModel.PROPERTY_DRIVER).observe(connectionModel),
updateStrategy,
new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
/*
@@ -517,8 +521,9 @@
* in the model.
*/
IObservableValue cloudTypeObservable = urlToCloudTypeConverter.getCloudTypeObservable();
- DeltaCloudTypeLabelAdapter cloudTypeAdapter =
- new DeltaCloudTypeLabelAdapter((DeltaCloudServerType) cloudTypeObservable.getValue(), typeLabel);
+ Object value = cloudTypeObservable.getValue();
+ Assert.isTrue(value == null || value instanceof Driver);
+ DeltaCloudTypeLabelAdapter cloudTypeAdapter = new DeltaCloudTypeLabelAdapter((Driver) value, typeLabel);
cloudTypeObservable.addValueChangeListener(cloudTypeAdapter);
ControlDecorationSupport.create(urlTypeBinding, SWT.LEFT | SWT.TOP);
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudDriverValidator.java (from rev 27490, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudTypeValidator.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudDriverValidator.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudDriverValidator.java 2010-12-15 20:31:23 UTC (rev 27525)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.internal.deltacloud.ui.wizards;
+
+import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.IStatus;
+import org.jboss.tools.deltacloud.core.Driver;
+
+/**
+ * @author André Dietisheim
+ */
+public class CloudDriverValidator implements IValidator {
+
+ @Override
+ public IStatus validate(Object value) {
+ if (value != null
+ && !Driver.UNKNOWN.equals(value)) {
+ return ValidationStatus.ok();
+ } else {
+ return ValidationStatus.warning(WizardMessages.getString("IllegalCloudUrl.msg")); //$NON-NLS-1$
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudDriverValidator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudTypeValidator.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudTypeValidator.java 2010-12-15 20:24:34 UTC (rev 27524)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudTypeValidator.java 2010-12-15 20:31:23 UTC (rev 27525)
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * 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.internal.deltacloud.ui.wizards;
-
-import org.eclipse.core.databinding.validation.IValidator;
-import org.eclipse.core.databinding.validation.ValidationStatus;
-import org.eclipse.core.runtime.IStatus;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
-
-public class CloudTypeValidator implements IValidator {
-
- @Override
- public IStatus validate(Object value) {
- if (value != null
- && !DeltaCloudClientImpl.DeltaCloudServerType.UNKNOWN.equals(value)) {
- return ValidationStatus.ok();
- } else {
- return ValidationStatus.warning(WizardMessages.getString("IllegalCloudUrl.msg")); //$NON-NLS-1$
- }
- }
-}
\ No newline at end of file
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java 2010-12-15 20:24:34 UTC (rev 27524)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java 2010-12-15 20:31:23 UTC (rev 27525)
@@ -14,8 +14,13 @@
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudManager;
+import org.jboss.tools.deltacloud.core.Driver;
import org.jboss.tools.deltacloud.ui.ErrorUtils;
+/**
+ * @author Jeff Johnston
+ * @author André Dietisheim
+ */
public class EditCloudConnectionWizard extends NewCloudConnectionWizard {
private static final String MAINPAGE_NAME = "EditCloudConnection.name"; //$NON-NLS-1$
@@ -30,9 +35,9 @@
String url = mainPage.getModel().getUrl();
String username = mainPage.getModel().getUsername();
String password = mainPage.getModel().getPassword();
- String type = getServerType();
+ Driver driver = mainPage.getModel().getDriver();
try {
- initialCloud.update(name, url, username, password, type);
+ initialCloud.update(name, url, username, password, driver);
DeltaCloudManager.getDefault().saveClouds();
} catch (Exception e) {
// TODO internationalize strings
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java 2010-12-15 20:24:34 UTC (rev 27524)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java 2010-12-15 20:31:23 UTC (rev 27525)
@@ -19,12 +19,17 @@
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudManager;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl.DeltaCloudServerType;
+import org.jboss.tools.deltacloud.core.Driver;
import org.jboss.tools.deltacloud.ui.Activator;
import org.jboss.tools.deltacloud.ui.ErrorUtils;
import org.jboss.tools.internal.deltacloud.ui.preferences.IPreferenceKeys;
import org.jboss.tools.internal.deltacloud.ui.preferences.TextPreferenceValue;
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ *
+ */
public class NewCloudConnectionWizard extends Wizard implements INewWizard, CloudConnection {
private static final String MAINPAGE_NAME = "NewCloudConnection.name"; //$NON-NLS-1$
@@ -92,15 +97,6 @@
}
}
- protected String getServerType() {
- DeltaCloudServerType type = mainPage.getModel().getType();
- if (type == null) {
- return null;
- }
-
- return type.toString();
- }
-
@Override
public boolean needsProgressMonitor() {
return true;
@@ -116,10 +112,10 @@
String username = mainPage.getModel().getUsername();
String password = mainPage.getModel().getPassword();
- String type = getServerType();
+ Driver driver = mainPage.getModel().getDriver();
try {
- DeltaCloud newCloud = new DeltaCloud(name, url, username, password, type);
+ DeltaCloud newCloud = new DeltaCloud(name, url, username, password, driver);
DeltaCloudManager.getDefault().addCloud(newCloud);
DeltaCloudManager.getDefault().saveClouds();
} catch (Exception e) {
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-15 20:24:34 UTC (rev 27524)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2010-12-15 20:31:23 UTC (rev 27525)
@@ -63,6 +63,7 @@
import org.jboss.tools.deltacloud.core.DeltaCloudHardwareProfile;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
import org.jboss.tools.deltacloud.core.DeltaCloudRealm;
+import org.jboss.tools.deltacloud.core.Driver;
import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob;
import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob.CLOUDELEMENT;
import org.jboss.tools.deltacloud.ui.ErrorUtils;
@@ -287,7 +288,7 @@
Button keyManageButton = new Button(container, SWT.NULL);
keyManageButton.setText(WizardMessages.getString(MANAGE_BUTTON_LABEL));
keyManageButton.addSelectionListener(manageListener);
- if (cloud.getType().equals(DeltaCloud.MOCK_TYPE)) {
+ if (Driver.MOCK.equals(cloud.getDriver())) {
keyManageButton.setEnabled(false);
}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/Url2DeltaCloudTypeConverter.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/Url2DeltaCloudTypeConverter.java 2010-12-15 20:24:34 UTC (rev 27524)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/Url2DeltaCloudTypeConverter.java 2010-12-15 20:31:23 UTC (rev 27525)
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * 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.internal.deltacloud.ui.wizards;
-
-import java.net.MalformedURLException;
-
-import org.eclipse.core.databinding.conversion.IConverter;
-import org.eclipse.core.databinding.observable.value.IObservableValue;
-import org.eclipse.core.databinding.observable.value.WritableValue;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl;
-import org.jboss.tools.deltacloud.core.client.DeltaCloudClientImpl.DeltaCloudServerType;
-
-/**
- * A class that converts an url (string) to a DeltaCloudType (enum). The state
- * of the converter may be tracked by tracking its observable value cloudType
- * observable.
- *
- * @author Andre Dietisheim
- *
- * @see IConverter
- * @see IObservableValue
- * @see #getCloudTypeObservable()
- */
-public class Url2DeltaCloudTypeConverter implements IConverter {
-
- IObservableValue cloudTypeObservable = new WritableValue();
-
- @Override
- public Object getFromType() {
- return String.class;
- }
-
- @Override
- public Object getToType() {
- return DeltaCloudClientImpl.DeltaCloudServerType.class;
- }
-
- @Override
- public Object convert(Object fromObject) {
- String deltaCloudUrl = (String) fromObject;
- DeltaCloudServerType cloudType = getCloudType(deltaCloudUrl);
- cloudTypeObservable.setValue(cloudType);
- return cloudType;
- }
-
- private DeltaCloudServerType getCloudType(String deltaCloudUrl) {
- try {
- return new DeltaCloudClientImpl(deltaCloudUrl, "", "").getServerType();
- } catch (MalformedURLException e) {
- return null;
- }
- }
-
- public IObservableValue getCloudTypeObservable() {
- return cloudTypeObservable;
- }
-}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/Url2DriverConverter.java (from rev 27490, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/Url2DeltaCloudTypeConverter.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/Url2DriverConverter.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/Url2DriverConverter.java 2010-12-15 20:31:23 UTC (rev 27525)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * 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.internal.deltacloud.ui.wizards;
+
+import org.eclipse.core.databinding.conversion.Converter;
+import org.eclipse.core.databinding.conversion.IConverter;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.core.databinding.observable.value.WritableValue;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.core.Driver;
+
+/**
+ * A class that converts an url (string) to a DeltaCloudType (enum). The state
+ * of the converter may be tracked by tracking its observable value cloudType
+ * observable.
+ *
+ * @author Andre Dietisheim
+ *
+ * @see IConverter
+ * @see IObservableValue
+ * @see #getCloudTypeObservable()
+ */
+public class Url2DriverConverter extends Converter {
+
+ IObservableValue cloudTypeObservable = new WritableValue();
+
+ public Url2DriverConverter() {
+ super(String.class, Driver.class);
+ }
+
+ @Override
+ public Object convert(Object fromObject) {
+ String deltaCloudUrl = (String) fromObject;
+ Driver cloudType = getCloudType(deltaCloudUrl);
+ cloudTypeObservable.setValue(cloudType);
+ return cloudType;
+ }
+
+ private Driver getCloudType(String url) {
+ try {
+ return DeltaCloud.getServerDriver(url);
+ } catch (DeltaCloudException e) {
+ return Driver.UNKNOWN;
+ }
+ }
+
+ public IObservableValue getCloudTypeObservable() {
+ return cloudTypeObservable;
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/Url2DriverConverter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years
JBoss Tools SVN: r27524 - trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/src/org/jboss/ide/eclipse/as/rse/ui.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2010-12-15 15:24:34 -0500 (Wed, 15 Dec 2010)
New Revision: 27524
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/src/org/jboss/ide/eclipse/as/rse/ui/RSEDeploymentPreferenceUI.java
Log:
JBIDE-7915 giving error messages more context to be able to track problem down
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/src/org/jboss/ide/eclipse/as/rse/ui/RSEDeploymentPreferenceUI.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/src/org/jboss/ide/eclipse/as/rse/ui/RSEDeploymentPreferenceUI.java 2010-12-15 20:02:53 UTC (rev 27523)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.ui/src/org/jboss/ide/eclipse/as/rse/ui/RSEDeploymentPreferenceUI.java 2010-12-15 20:24:34 UTC (rev 27524)
@@ -182,14 +182,14 @@
s[0] = new Status(IStatus.ERROR, org.jboss.ide.eclipse.as.rse.core.RSECorePlugin.PLUGIN_ID, e.getMessage(), e);
}
rseTest.setEnabled(true);
- showMessageDialog(s[0]);
+ showMessageDialog("Test of Remote System", s[0]);
}
- private void showMessageDialog(IStatus s) {
+ private void showMessageDialog(String title, IStatus s) {
if( s.isOK() )
s = new Status(IStatus.INFO, org.jboss.ide.eclipse.as.rse.core.RSECorePlugin.PLUGIN_ID,
"The remote server is properly configured.");
- ErrorDialog d = new ErrorDialog(rseServerHome.getShell(), "Title", null, s, IStatus.INFO | IStatus.ERROR);
+ ErrorDialog d = new ErrorDialog(rseServerHome.getShell(), title, null, s, IStatus.INFO | IStatus.ERROR);
d.open();
}
@@ -198,14 +198,14 @@
IHost host = combo.getHost();
if( host == null ) {
pm.done();
- return getTestFailStatus("NoHost");
+ return getTestFailStatus("Host is empty!");
}
pm.worked(100);
IFileServiceSubSystem fileSubSystem = RSEPublishMethod.findFileTransferSubSystem(host);
if( fileSubSystem == null ) {
pm.done();
- return getTestFailStatus("No File Sub System");
+ return getTestFailStatus("No File Sub System found on " + host.getName());
}
pm.worked(100);
@@ -214,7 +214,7 @@
fileSubSystem.connect(new NullProgressMonitor(), false);
} catch (Exception e) {
pm.done();
- return getTestFailStatus(e.getLocalizedMessage());
+ return getTestFailStatus("Error when connecting to file system: " + e.getLocalizedMessage());
}
}
pm.worked(300);
@@ -222,7 +222,7 @@
IFileService service = fileSubSystem.getFileService();
if( service == null ) {
pm.done();
- return getTestFailStatus("No File Service");
+ return getTestFailStatus("No File Service for " + host.getName());
}
pm.worked(100);
@@ -232,7 +232,7 @@
IHostFile file = service.getFile(root2.removeLastSegments(1).toOSString(), root2.lastSegment(), new NullProgressMonitor());
if( file == null || !file.exists()) {
pm.done();
- return getTestFailStatus("Folder Home does not exist");
+ return getTestFailStatus("Server's Home folder " + root2 + " not found on " + service.getName() + " for " + host.getName());
}
pm.worked(300);
@@ -240,12 +240,12 @@
file = service.getFile(root2.removeLastSegments(1).toOSString(), root2.lastSegment(), new NullProgressMonitor());
if( file == null || !file.exists()) {
pm.done();
- return getTestFailStatus("Server's config folder does not exist");
+ return getTestFailStatus("Server's config folder " + root2 + " does not exist");
}
pm.worked(300);
} catch(SystemMessageException sme) {
pm.done();
- return getTestFailStatus(sme.getLocalizedMessage());
+ return getTestFailStatus("Error while checking remote folders: " + sme.getLocalizedMessage());
}
pm.done();
return Status.OK_STATUS;
@@ -288,7 +288,7 @@
rseServerConfig.setText(evt.getNewValue().toString());
} else if( evt.getPropertyName().equals(RSEUtils.RSE_SERVER_HOST)) {
combo.setHostName(evt.getNewValue().toString());
- }
+ }
updatingFromModelChange = false;
}
14 years
JBoss Tools SVN: r27523 - trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-12-15 15:02:53 -0500 (Wed, 15 Dec 2010)
New Revision: 27523
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/AnnotationValidationDelegate.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
Log:
https://issues.jboss.org/browse/JBIDE-7895
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/AnnotationValidationDelegate.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/AnnotationValidationDelegate.java 2010-12-15 19:26:48 UTC (rev 27522)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/AnnotationValidationDelegate.java 2010-12-15 20:02:53 UTC (rev 27523)
@@ -22,6 +22,7 @@
import org.jboss.tools.cdi.core.CDIUtil;
import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.cdi.core.ICDIAnnotation;
+import org.jboss.tools.cdi.core.IInterceptorBinding;
import org.jboss.tools.cdi.core.IInterceptorBindingDeclaration;
import org.jboss.tools.cdi.core.IQualifier;
import org.jboss.tools.cdi.core.IScope;
@@ -54,6 +55,7 @@
static final String[][] STEREOTYPE_F_VARIANTS = {{TARGET_FIELD}};
static final String[][] TYPE_VARIANTS = {{TARGET_TYPE}};
+ static final String[][] TYPE__METHOD_VARIANTS = {{TARGET_TYPE, TARGET_METHOD}};
public AnnotationValidationDelegate(CDICoreValidator validator) {
super(validator);
@@ -129,6 +131,29 @@
}
}
+ public void validateInterceptorBindingAnnotationTypeAnnotations(IInterceptorBinding binding) throws JavaModelException {
+ /*
+ * 9.1.1. Interceptor binding types with additional interceptor bindings
+ * - Interceptor binding types declared @Target(TYPE) may not be applied to interceptor binding types declared
+ * @Target({TYPE, METHOD}).
+ */
+ Set<IInterceptorBindingDeclaration> declarations = binding.getInterceptorBindingDeclarations(false);
+ if(!declarations.isEmpty()) {
+ IAnnotationDeclaration target = binding.getAnnotationDeclaration(CDIConstants.TARGET_ANNOTATION_TYPE_NAME);
+ if(target!=null) {
+ if(CDIUtil.checkTargetAnnotation(target, TYPE__METHOD_VARIANTS)) {
+ for (IInterceptorBindingDeclaration declaration : declarations) {
+ ICDIAnnotation superBinding = declaration.getAnnotation();
+ Boolean result = CDIUtil.checkTargetAnnotation(superBinding, TYPE_VARIANTS);
+ if(result!=null && result) {
+ validator.addError(CDIValidationMessages.ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE, CDIPreferences.MISSING_OR_INCORRECT_TARGET_OR_RETENTION_IN_ANNOTATION_TYPE, new String[]{superBinding.getSourceType().getElementName(), binding.getSourceType().getElementName()}, declaration, binding.getResource());
+ }
+ }
+ }
+ }
+ }
+ }
+
/**
* Validates a scope type.
*
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-15 19:26:48 UTC (rev 27522)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-12-15 20:02:53 UTC (rev 27523)
@@ -2110,19 +2110,23 @@
}
private void validateInterceptorBinding(IInterceptorBinding binding) {
- if(binding==null) {
+ if(binding==null || (binding.getSourceType() == null && binding.getSourceType().isReadOnly())) {
return;
}
- IResource resource = binding.getResource();
- if (resource == null || !resource.getName().toLowerCase().endsWith(".java")) {
- // validate sources only
- return;
- }
+
+ addLinkedInterceptorBindings(binding.getSourcePath().toOSString(), binding);
+
/*
* 9.5.2. Interceptor binding types with members
* array-valued or annotation-valued member of an interceptor binding type is not annotated @Nonbinding (Non-Portable behavior)
*/
validateAnnotationMembers(binding, CDIValidationMessages.MISSING_NONBINDING_FOR_ARRAY_VALUE_IN_INTERCEPTOR_BINDING_TYPE_MEMBER, CDIValidationMessages.MISSING_NONBINDING_FOR_ANNOTATION_VALUE_IN_INTERCEPTOR_BINDING_TYPE_MEMBER, CDIPreferences.MISSING_NONBINDING_IN_INTERCEPTOR_BINDING_TYPE_MEMBER);
+
+ try {
+ annotationValidator.validateInterceptorBindingAnnotationTypeAnnotations(binding);
+ } catch (JavaModelException e) {
+ CDICorePlugin.getDefault().logError(e);
+ }
}
/**
14 years
JBoss Tools SVN: r27522 - in trunk/cdi: tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-12-15 14:26:48 -0500 (Wed, 15 Dec 2010)
New Revision: 27522
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/AnnotationValidationDelegate.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AnnotationsValidationTest.java
Log:
https://issues.jboss.org/browse/JBIDE-7894
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/AnnotationValidationDelegate.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/AnnotationValidationDelegate.java 2010-12-15 18:28:01 UTC (rev 27521)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/AnnotationValidationDelegate.java 2010-12-15 19:26:48 UTC (rev 27522)
@@ -22,6 +22,7 @@
import org.jboss.tools.cdi.core.CDIUtil;
import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.cdi.core.ICDIAnnotation;
+import org.jboss.tools.cdi.core.IInterceptorBindingDeclaration;
import org.jboss.tools.cdi.core.IQualifier;
import org.jboss.tools.cdi.core.IScope;
import org.jboss.tools.cdi.core.IStereotype;
@@ -70,19 +71,19 @@
*/
validateRetentionAnnotation(stereotype, CDIValidationMessages.MISSING_RETENTION_ANNOTATION_IN_STEREOTYPE_TYPE, resource);
- /*
- * 2.7.1.5. Stereotypes with additional stereotypes
- * - Stereotypes declared @Target(TYPE) may not be applied to stereotypes declared @Target({TYPE, METHOD, FIELD}),
- * @Target(METHOD), @Target(FIELD) or @Target({METHOD, FIELD}).
- */
- Set<IStereotypeDeclaration> stereotypes = stereotype.getStereotypeDeclarations();
- for (IStereotypeDeclaration stereotypeDeclaration : stereotypes) {
- IStereotype superStereotype = stereotypeDeclaration.getStereotype();
- if(superStereotype!=null) {
- Boolean result = CDIUtil.checkTargetAnnotation(superStereotype, TYPE_VARIANTS);
- if(result!=null && result) {
- IAnnotationDeclaration target = stereotype.getAnnotationDeclaration(CDIConstants.TARGET_ANNOTATION_TYPE_NAME);
- if(target!=null) {
+ IAnnotationDeclaration target = stereotype.getAnnotationDeclaration(CDIConstants.TARGET_ANNOTATION_TYPE_NAME);
+ if(target!=null) {
+ /*
+ * 2.7.1.5. Stereotypes with additional stereotypes
+ * - Stereotypes declared @Target(TYPE) may not be applied to stereotypes declared @Target({TYPE, METHOD, FIELD}),
+ * @Target(METHOD), @Target(FIELD) or @Target({METHOD, FIELD}).
+ */
+ Set<IStereotypeDeclaration> stereotypes = stereotype.getStereotypeDeclarations();
+ for (IStereotypeDeclaration stereotypeDeclaration : stereotypes) {
+ IStereotype superStereotype = stereotypeDeclaration.getStereotype();
+ if(superStereotype!=null) {
+ Boolean result = CDIUtil.checkTargetAnnotation(superStereotype, TYPE_VARIANTS);
+ if(result!=null && result) {
result = CDIUtil.checkTargetAnnotation(target, STEREOTYPE_TMF_VARIANTS);
String stName = stereotype.getSourceType().getElementName();
String superStName = superStereotype.getSourceType().getElementName();
@@ -107,6 +108,24 @@
}
}
}
+ /*
+ * 9.1.2. Interceptor bindings for stereotypes
+ * - If a stereotype declares interceptor bindings, it must be defined as @Target(TYPE).
+ */
+ Set<IInterceptorBindingDeclaration> interceptorBindingDeclarations = stereotype.getInterceptorBindingDeclarations(false);
+ if(!interceptorBindingDeclarations.isEmpty() && !CDIUtil.checkTargetAnnotation(target, TYPE_VARIANTS)) {
+ StringBuffer bindings = new StringBuffer();
+ boolean first = true;
+ for (IInterceptorBindingDeclaration binding : interceptorBindingDeclarations) {
+ if(!first) {
+ bindings.append(", ");
+ }
+ bindings.append(binding.getType().getElementName());
+ first = false;
+ }
+ String stName = stereotype.getSourceType().getElementName();
+ validator.addError(CDIValidationMessages.ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE_FOR_STEREOTYPE, CDIPreferences.MISSING_OR_INCORRECT_TARGET_OR_RETENTION_IN_ANNOTATION_TYPE, new String[]{stName, bindings.toString()}, target, resource);
+ }
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-12-15 18:28:01 UTC (rev 27521)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-12-15 19:26:48 UTC (rev 27522)
@@ -257,5 +257,5 @@
- Interceptor binding types declared @Target(TYPE) may not be applied to interceptor binding types declared
@Target({TYPE, METHOD}).
-9.1.2. Interceptor bindings for stereotypes
+9.1.2. Interceptor bindings for stereotypes
- If a stereotype declares interceptor bindings, it must be defined as @Target(TYPE).
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-12-15 18:28:01 UTC (rev 27521)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-12-15 19:26:48 UTC (rev 27522)
@@ -38,11 +38,11 @@
MISSING_RETENTION_ANNOTATION_IN_STEREOTYPE_TYPE=Stereotype annotation type must be annotated with @Retention(RUNTIME) [JSR-299 �2.7.1]
MISSING_TARGET_ANNOTATION_IN_SCOPE_TYPE=Scope annotation type must be annotated with @Target('{'TYPE, METHOD, FIELD'}') [JSR-299 �2.4.2]
MISSING_RETENTION_ANNOTATION_IN_SCOPE_TYPE=Scope annotation type must be annotated with @Retention(RUNTIME) [JSR-299 �2.4.2]
-ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_TMF=Stereotype {0} is declared @Target(TYPE) and may not be applied to stereotype {1} which is declared @Target('{TYPE, METHOD, FIELD}') [JSR-299 �2.7.1.5]
-ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_M=Stereotype {0} is declared @Target(TYPE) may not be applied to stereotype {1} which is declared @Target(METHOD) [JSR-299 �2.7.1.5]
-ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_F=Stereotype {0} is declared @Target(TYPE) may not be applied to stereotype {1} which is declared @Target(FIELD) [JSR-299 �2.7.1.5]
-ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_MF=Stereotype {0} is declared @Target(TYPE) may not be applied to stereotype {1} which is declared @Target('{METHOD, FIELD}') [JSR-299 �2.7.1.5]
-ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE=Interceptor binding type {0} is declared @Target(TYPE) and may not be applied to interceptor binding type {1} which is declared @Target('{TYPE, METHOD}') [JSR-299 �9.1.1]
+ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_TMF=Stereotype {0} is defined as @Target(TYPE) and may not be applied to stereotype {1} which is defined as @Target('{TYPE, METHOD, FIELD}') [JSR-299 �2.7.1.5]
+ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_M=Stereotype {0} is defined as @Target(TYPE) and may not be applied to stereotype {1} which is defined as @Target(METHOD) [JSR-299 �2.7.1.5]
+ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_F=Stereotype {0} is defined as @Target(TYPE) and may not be applied to stereotype {1} which is defined as @Target(FIELD) [JSR-299 �2.7.1.5]
+ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_MF=Stereotype {0} is defined as @Target(TYPE) and may not be applied to stereotype {1} which is defined as @Target('{METHOD, FIELD}') [JSR-299 �2.7.1.5]
+ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE=Interceptor binding type {0} is defined as @Target(TYPE) and may not be applied to interceptor binding type {1} which is defined as @Target('{TYPE, METHOD}') [JSR-299 �9.1.1]
ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE_FOR_STEREOTYPE=Stereotype {0} must be defined as @Target(TYPE) since it declares interceptor bindings ({1}) [JSR-299 �9.1.2]
MULTIPLE_SCOPE_TYPE_ANNOTATIONS=Bean class or producer method or field specifies multiple scope type annotations [JSR-299 �2.4.3]
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AnnotationsValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AnnotationsValidationTest.java 2010-12-15 18:28:01 UTC (rev 27521)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AnnotationsValidationTest.java 2010-12-15 19:26:48 UTC (rev 27522)
@@ -113,11 +113,11 @@
public void testInterceptorBindingsForStereotypes() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/target/StereotypeWithInterceptorBindingBroken.java");
- assertMarkerIsCreated(file, MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE_FOR_STEREOTYPE, "StereotypeWithInterceptorBindingBroken", "InterceptorBindingWTypeTarget"), 15);
+ assertMarkerIsCreated(file, MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE_FOR_STEREOTYPE, "StereotypeWithInterceptorBindingBroken", "InterceptorBindingWTypeTarget"), 16);
}
public void testInterceptorBindingsForStereotypesOk() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/target/StereotypeOk.java");
- assertMarkerIsNotCreated(file, MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE_FOR_STEREOTYPE, "StereotypeOk", "InterceptorBindingWTypeTarget"), 14);
+ assertMarkerIsNotCreated(file, MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE_FOR_STEREOTYPE, "StereotypeOk", "InterceptorBindingWTypeTarget"), 15);
}
}
\ No newline at end of file
14 years
JBoss Tools SVN: r27521 - in trunk/cdi: tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-12-15 13:28:01 -0500 (Wed, 15 Dec 2010)
New Revision: 27521
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/InterceptorBindingBroken.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/InterceptorBindingOk.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/InterceptorBindingWTypeTarget.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeFBroken.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeMBroken.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeMFBroken.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeOk.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeTMFBroken.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeWTypeTarget.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeWithInterceptorBindingBroken.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/AnnotationValidationDelegate.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/CDIValidationMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AnnotationsValidationTest.java
Log:
https://issues.jboss.org/browse/JBIDE-7897 https://issues.jboss.org/browse/JBIDE-7895 https://issues.jboss.org/browse/JBIDE-7894
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/AnnotationValidationDelegate.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/AnnotationValidationDelegate.java 2010-12-15 17:59:31 UTC (rev 27520)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/AnnotationValidationDelegate.java 2010-12-15 18:28:01 UTC (rev 27521)
@@ -11,7 +11,7 @@
package org.jboss.tools.cdi.internal.core.validation;
-import java.util.HashSet;
+import java.text.MessageFormat;
import java.util.Set;
import org.eclipse.core.resources.IResource;
@@ -25,6 +25,7 @@
import org.jboss.tools.cdi.core.IQualifier;
import org.jboss.tools.cdi.core.IScope;
import org.jboss.tools.cdi.core.IStereotype;
+import org.jboss.tools.cdi.core.IStereotypeDeclaration;
import org.jboss.tools.cdi.core.preferences.CDIPreferences;
/**
@@ -34,6 +35,25 @@
*/
public class AnnotationValidationDelegate extends CDICoreValidationDelegate {
+ static final String TARGET_METHOD = "METHOD";
+ static final String TARGET_FIELD = "FIELD";
+ static final String TARGET_PARAMETER = "PARAMETER";
+ static final String TARGET_TYPE = "TYPE";
+
+ static final String[] TMF = {TARGET_METHOD, TARGET_FIELD, TARGET_TYPE};
+ static final String[] MF = {TARGET_METHOD, TARGET_FIELD};
+ static final String[][] STEREOTYPE_GENERAL_TARGET_VARAINTS = {TMF, MF,
+ {TARGET_TYPE}, {TARGET_METHOD}, {TARGET_FIELD}};
+ static final String[][] QUALIFIER_GENERAL_TARGET_VARIANTS = {{TARGET_METHOD, TARGET_FIELD, TARGET_PARAMETER, TARGET_TYPE},
+ {TARGET_FIELD, TARGET_PARAMETER}};
+ static final String[][] SCOPE_GENERAL_TARGET_VARIANTS = {TMF};
+ static final String[][] STEREOTYPE_TMF_VARIANTS = {TMF};
+ static final String[][] STEREOTYPE_MF_VARIANTS = {MF};
+ static final String[][] STEREOTYPE_M_VARIANTS = {{TARGET_METHOD}};
+ static final String[][] STEREOTYPE_F_VARIANTS = {{TARGET_FIELD}};
+
+ static final String[][] TYPE_VARIANTS = {{TARGET_TYPE}};
+
public AnnotationValidationDelegate(CDICoreValidator validator) {
super(validator);
}
@@ -43,15 +63,51 @@
* Stereotype annotation type should be annotated with @Target with correct targets [JSR-299 §2.7.1]
* Stereotype annotation type should be annotated with @Retention(RUNTIME)
*/
- String[][] variants = {{TARGET_METHOD, TARGET_FIELD, TARGET_TYPE},
- {TARGET_METHOD, TARGET_FIELD},
- {TARGET_TYPE}, {TARGET_METHOD}, {TARGET_FIELD}};
- validateTargetAnnotation(stereotype, variants, CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_STEREOTYPE_TYPE, resource);
+ validateTargetAnnotation(stereotype, STEREOTYPE_GENERAL_TARGET_VARAINTS, CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_STEREOTYPE_TYPE, resource);
/*
* Stereotype annotation type should be annotated with @Retention(RUNTIME)
*/
validateRetentionAnnotation(stereotype, CDIValidationMessages.MISSING_RETENTION_ANNOTATION_IN_STEREOTYPE_TYPE, resource);
+
+ /*
+ * 2.7.1.5. Stereotypes with additional stereotypes
+ * - Stereotypes declared @Target(TYPE) may not be applied to stereotypes declared @Target({TYPE, METHOD, FIELD}),
+ * @Target(METHOD), @Target(FIELD) or @Target({METHOD, FIELD}).
+ */
+ Set<IStereotypeDeclaration> stereotypes = stereotype.getStereotypeDeclarations();
+ for (IStereotypeDeclaration stereotypeDeclaration : stereotypes) {
+ IStereotype superStereotype = stereotypeDeclaration.getStereotype();
+ if(superStereotype!=null) {
+ Boolean result = CDIUtil.checkTargetAnnotation(superStereotype, TYPE_VARIANTS);
+ if(result!=null && result) {
+ IAnnotationDeclaration target = stereotype.getAnnotationDeclaration(CDIConstants.TARGET_ANNOTATION_TYPE_NAME);
+ if(target!=null) {
+ result = CDIUtil.checkTargetAnnotation(target, STEREOTYPE_TMF_VARIANTS);
+ String stName = stereotype.getSourceType().getElementName();
+ String superStName = superStereotype.getSourceType().getElementName();
+ if(result) {
+ validator.addError(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_TMF, CDIPreferences.MISSING_OR_INCORRECT_TARGET_OR_RETENTION_IN_ANNOTATION_TYPE, new String[]{superStName, stName}, stereotypeDeclaration, resource);
+ continue;
+ }
+ result = CDIUtil.checkTargetAnnotation(target, STEREOTYPE_M_VARIANTS);
+ if(result) {
+ validator.addError(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_M, CDIPreferences.MISSING_OR_INCORRECT_TARGET_OR_RETENTION_IN_ANNOTATION_TYPE, new String[]{superStName, stName}, stereotypeDeclaration, resource);
+ continue;
+ }
+ result = CDIUtil.checkTargetAnnotation(target, STEREOTYPE_F_VARIANTS);
+ if(result) {
+ validator.addError(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_F, CDIPreferences.MISSING_OR_INCORRECT_TARGET_OR_RETENTION_IN_ANNOTATION_TYPE, new String[]{superStName, stName}, stereotypeDeclaration, resource);
+ continue;
+ }
+ result = CDIUtil.checkTargetAnnotation(target, STEREOTYPE_MF_VARIANTS);
+ if(result) {
+ validator.addError(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_MF, CDIPreferences.MISSING_OR_INCORRECT_TARGET_OR_RETENTION_IN_ANNOTATION_TYPE, new String[]{superStName, stName}, stereotypeDeclaration, resource);
+ }
+ }
+ }
+ }
+ }
}
/**
@@ -80,8 +136,7 @@
/*
* Scope annotation type should be annotated with @Target({TYPE, METHOD, FIELD})
*/
- String[][] variants = {{TARGET_TYPE, TARGET_METHOD, TARGET_FIELD}};
- validateTargetAnnotation(scope, variants, CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_SCOPE_TYPE, resource);
+ validateTargetAnnotation(scope, SCOPE_GENERAL_TARGET_VARIANTS, CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_SCOPE_TYPE, resource);
/*
* Scope annotation type should be annotated with @Retention(RUNTIME)
@@ -113,43 +168,12 @@
}
}
- Set<String> getTargetAnnotationValues(IAnnotationDeclaration target) throws JavaModelException {
- Set<String> result = new HashSet<String>();
- IMemberValuePair[] ps = target.getDeclaration().getMemberValuePairs();
- for (IMemberValuePair p: ps) {
- if(!"value".equals(p.getMemberName())) continue;
- Object o = p.getValue();
- if(o instanceof Object[]) {
- Object[] os = (Object[])o;
- for (Object q: os) {
- String s = q.toString();
- int i = s.lastIndexOf('.');
- if(i >= 0) s = s.substring(i + 1);
- result.add(s);
- }
- } else if(o != null) {
- String s = o.toString();
- int i = s.lastIndexOf('.');
- if(i >= 0) s = s.substring(i + 1);
- result.add(s);
- }
- }
- return result;
- }
-
- static String TARGET_METHOD = "METHOD";
- static String TARGET_FIELD = "FIELD";
- static String TARGET_PARAMETER = "PARAMETER";
- static String TARGET_TYPE = "TYPE";
-
public void validateQualifierAnnotationTypeAnnotations(IQualifier qualifier, IResource resource) throws JavaModelException {
/*
* Qualifier annotation type should be annotated with @Target({METHOD, FIELD, PARAMETER, TYPE}) or @Target({"FIELD", "PARAMETER"})
* Qualifier annotation type should be annotated with @Retention(RUNTIME)
*/
- String[][] variants = {{TARGET_METHOD, TARGET_FIELD, TARGET_PARAMETER, TARGET_TYPE},
- {TARGET_FIELD, TARGET_PARAMETER}};
- validateTargetAnnotation(qualifier, variants, CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_QUALIFIER_TYPE, resource);
+ validateTargetAnnotation(qualifier, QUALIFIER_GENERAL_TARGET_VARIANTS, CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_QUALIFIER_TYPE, resource);
/*
* Qualifier annotation type should be annotated with @Retention(RUNTIME)
@@ -159,30 +183,10 @@
private void validateTargetAnnotation(ICDIAnnotation annotationType, String[][] variants, String message, IResource resource) throws JavaModelException {
IAnnotationDeclaration target = annotationType.getAnnotationDeclaration(CDIConstants.TARGET_ANNOTATION_TYPE_NAME);
- if(target == null) {
+ if(target==null) {
validator.addError(message, CDIPreferences.MISSING_OR_INCORRECT_TARGET_OR_RETENTION_IN_ANNOTATION_TYPE, CDIUtil.convertToSourceReference(annotationType.getSourceType().getNameRange()), resource);
- } else {
- Set<String> vs = getTargetAnnotationValues(target);
- boolean ok = false;
- for (int i = 0; i < variants.length; i++) {
- if(vs.size() == variants[i].length) {
- boolean ok2 = true;
- String[] values = variants[i];
- for (String s: values) {
- if(!vs.contains(s)) {
- ok2 = false;
- break;
- }
- }
- if(ok2) {
- ok = true;
- break;
- }
- }
- }
- if(!ok) {
- validator.addError(message, CDIPreferences.MISSING_OR_INCORRECT_TARGET_OR_RETENTION_IN_ANNOTATION_TYPE, target, resource);
- }
+ } else if(!CDIUtil.checkTargetAnnotation(target, variants)) {
+ validator.addError(message, CDIPreferences.MISSING_OR_INCORRECT_TARGET_OR_RETENTION_IN_ANNOTATION_TYPE, target, resource);
}
}
}
\ No newline at end of file
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-15 17:59:31 UTC (rev 27520)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-12-15 18:28:01 UTC (rev 27521)
@@ -2057,6 +2057,7 @@
// validate sources only
return;
}
+ addLinkedStereotypes(stereotype.getResource().getFullPath().toOSString(), stereotype);
List<IAnnotationDeclaration> as = stereotype.getAnnotationDeclarations();
// 1. non-empty name
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java 2010-12-15 17:59:31 UTC (rev 27520)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java 2010-12-15 18:28:01 UTC (rev 27521)
@@ -59,6 +59,12 @@
public static String MISSING_RETENTION_ANNOTATION_IN_STEREOTYPE_TYPE;
public static String MISSING_TARGET_ANNOTATION_IN_SCOPE_TYPE;
public static String MISSING_RETENTION_ANNOTATION_IN_SCOPE_TYPE;
+ public static String ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_TMF;
+ public static String ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_M;
+ public static String ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_F;
+ public static String ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_MF;
+ public static String ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE;
+ public static String ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE_FOR_STEREOTYPE;
public static String MULTIPLE_SCOPE_TYPE_ANNOTATIONS;
public static String MULTIPLE_SCOPE_TYPE_ANNOTATIONS_IN_BEAN_CLASS;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-12-15 17:59:31 UTC (rev 27520)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt 2010-12-15 18:28:01 UTC (rev 27521)
@@ -243,4 +243,19 @@
the class with the specified name is not an interceptor class, the container automatically detects the problem and treats it as
a deployment problem.
- If the same class is listed twice under the <interceptors> element, the container automatically detects the problem and treats it as
- a deployment problem.
\ No newline at end of file
+ a deployment problem.
+
+
+Other errors.
+
+
+2.7.1.5. Stereotypes with additional stereotypes
+- Stereotypes declared @Target(TYPE) may not be applied to stereotypes declared @Target({TYPE, METHOD, FIELD}),
+ @Target(METHOD), @Target(FIELD) or @Target({METHOD, FIELD}).
+
+9.1.1. Interceptor binding types with additional interceptor bindings
+- Interceptor binding types declared @Target(TYPE) may not be applied to interceptor binding types declared
+ @Target({TYPE, METHOD}).
+
+9.1.2. Interceptor bindings for stereotypes
+- If a stereotype declares interceptor bindings, it must be defined as @Target(TYPE).
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-12-15 17:59:31 UTC (rev 27520)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties 2010-12-15 18:28:01 UTC (rev 27521)
@@ -38,6 +38,12 @@
MISSING_RETENTION_ANNOTATION_IN_STEREOTYPE_TYPE=Stereotype annotation type must be annotated with @Retention(RUNTIME) [JSR-299 �2.7.1]
MISSING_TARGET_ANNOTATION_IN_SCOPE_TYPE=Scope annotation type must be annotated with @Target('{'TYPE, METHOD, FIELD'}') [JSR-299 �2.4.2]
MISSING_RETENTION_ANNOTATION_IN_SCOPE_TYPE=Scope annotation type must be annotated with @Retention(RUNTIME) [JSR-299 �2.4.2]
+ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_TMF=Stereotype {0} is declared @Target(TYPE) and may not be applied to stereotype {1} which is declared @Target('{TYPE, METHOD, FIELD}') [JSR-299 �2.7.1.5]
+ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_M=Stereotype {0} is declared @Target(TYPE) may not be applied to stereotype {1} which is declared @Target(METHOD) [JSR-299 �2.7.1.5]
+ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_F=Stereotype {0} is declared @Target(TYPE) may not be applied to stereotype {1} which is declared @Target(FIELD) [JSR-299 �2.7.1.5]
+ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_MF=Stereotype {0} is declared @Target(TYPE) may not be applied to stereotype {1} which is declared @Target('{METHOD, FIELD}') [JSR-299 �2.7.1.5]
+ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE=Interceptor binding type {0} is declared @Target(TYPE) and may not be applied to interceptor binding type {1} which is declared @Target('{TYPE, METHOD}') [JSR-299 �9.1.1]
+ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE_FOR_STEREOTYPE=Stereotype {0} must be defined as @Target(TYPE) since it declares interceptor bindings ({1}) [JSR-299 �9.1.2]
MULTIPLE_SCOPE_TYPE_ANNOTATIONS=Bean class or producer method or field specifies multiple scope type annotations [JSR-299 �2.4.3]
MULTIPLE_SCOPE_TYPE_ANNOTATIONS_IN_BEAN_CLASS=Bean class specifies multiple scope type annotations [JSR-299 �2.4.3]
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/InterceptorBindingBroken.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/InterceptorBindingBroken.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/InterceptorBindingBroken.java 2010-12-15 18:28:01 UTC (rev 27521)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.target;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@InterceptorBinding
+@Inherited
+@InterceptorBindingWTypeTarget
+@Target({ TYPE, METHOD })
+@Retention(RUNTIME)
+@Documented
+public @interface InterceptorBindingBroken {
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/InterceptorBindingBroken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/InterceptorBindingOk.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/InterceptorBindingOk.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/InterceptorBindingOk.java 2010-12-15 18:28:01 UTC (rev 27521)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.target;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@InterceptorBinding
+@Inherited
+@InterceptorBindingWTypeTarget
+@Target({ TYPE })
+@Retention(RUNTIME)
+@Documented
+public @interface InterceptorBindingOk {
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/InterceptorBindingOk.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/InterceptorBindingWTypeTarget.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/InterceptorBindingWTypeTarget.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/InterceptorBindingWTypeTarget.java 2010-12-15 18:28:01 UTC (rev 27521)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.target;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.interceptor.InterceptorBinding;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@InterceptorBinding
+@Inherited
+@Target({ TYPE })
+@Retention(RUNTIME)
+@Documented
+public @interface InterceptorBindingWTypeTarget {
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/InterceptorBindingWTypeTarget.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeFBroken.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeFBroken.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeFBroken.java 2010-12-15 18:28:01 UTC (rev 27521)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.target;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Stereotype;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Stereotype
+@StereotypeWTypeTarget
+@Target({ FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface StereotypeFBroken {
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeFBroken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeMBroken.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeMBroken.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeMBroken.java 2010-12-15 18:28:01 UTC (rev 27521)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.target;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Stereotype;
+
+@Stereotype
+@StereotypeWTypeTarget
+@Target({METHOD})
+@Retention(RUNTIME)
+@Documented
+public @interface StereotypeMBroken {
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeMBroken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeMFBroken.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeMFBroken.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeMFBroken.java 2010-12-15 18:28:01 UTC (rev 27521)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.target;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Stereotype;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Stereotype
+@StereotypeWTypeTarget
+@Target({ METHOD, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface StereotypeMFBroken {
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeMFBroken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeOk.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeOk.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeOk.java 2010-12-15 18:28:01 UTC (rev 27521)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.target;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Stereotype;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Stereotype
+@StereotypeWTypeTarget
+@InterceptorBindingWTypeTarget
+@Target({ TYPE })
+@Retention(RUNTIME)
+@Documented
+public @interface StereotypeOk {
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeOk.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeTMFBroken.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeTMFBroken.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeTMFBroken.java 2010-12-15 18:28:01 UTC (rev 27521)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.target;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Stereotype;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Stereotype
+@StereotypeWTypeTarget
+@Target({ TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface StereotypeTMFBroken {
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeTMFBroken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeWTypeTarget.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeWTypeTarget.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeWTypeTarget.java 2010-12-15 18:28:01 UTC (rev 27521)
@@ -0,0 +1,18 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.target;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Stereotype;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Stereotype
+@Target({ TYPE })
+@Retention(RUNTIME)
+@Documented
+public @interface StereotypeWTypeTarget {
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeWTypeTarget.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeWithInterceptorBindingBroken.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeWithInterceptorBindingBroken.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeWithInterceptorBindingBroken.java 2010-12-15 18:28:01 UTC (rev 27521)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.target;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Stereotype;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Stereotype
+@InterceptorBindingWTypeTarget
+@Target({ TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface StereotypeWithInterceptorBindingBroken {
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/target/StereotypeWithInterceptorBindingBroken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AnnotationsValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AnnotationsValidationTest.java 2010-12-15 17:59:31 UTC (rev 27520)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/AnnotationsValidationTest.java 2010-12-15 18:28:01 UTC (rev 27521)
@@ -11,6 +11,8 @@
package org.jboss.tools.cdi.core.test.tck.validation;
+import java.text.MessageFormat;
+
import org.eclipse.core.resources.IFile;
import org.jboss.tools.cdi.internal.core.validation.CDIValidationMessages;
@@ -70,4 +72,52 @@
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/annotations/scope/broken/FooScoped_WrongTarget.java");
assertMarkerIsCreated(file, CDIValidationMessages.MISSING_TARGET_ANNOTATION_IN_SCOPE_TYPE.substring(0, 52) + ".*", 30);
}
+
+ public void testStereotypesWithAdditionalStereotypesWithTMFTarget() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/target/StereotypeTMFBroken.java");
+ assertMarkerIsCreated(file, MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_TMF, "StereotypeWTypeTarget", "StereotypeTMFBroken"), 15);
+ }
+
+ public void testStereotypesWithAdditionalStereotypesWithMTarget() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/target/StereotypeMBroken.java");
+ assertMarkerIsCreated(file, MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_M, "StereotypeWTypeTarget", "StereotypeMBroken"), 13);
+ }
+
+ public void testStereotypesWithAdditionalStereotypesWithFTarget() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/target/StereotypeFBroken.java");
+ assertMarkerIsCreated(file, MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_F, "StereotypeWTypeTarget", "StereotypeFBroken"), 13);
+ }
+
+ public void testStereotypesWithAdditionalStereotypesWithMFTarget() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/target/StereotypeMFBroken.java");
+ assertMarkerIsCreated(file, MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_MF, "StereotypeWTypeTarget", "StereotypeMFBroken"), 14);
+ }
+
+ public void testStereotypesWithAdditionalStereotypesOk() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/target/StereotypeOk.java");
+ assertMarkerIsNotCreated(file, MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_TMF, "StereotypeWTypeTarget", "StereotypeOk"), 13);
+ assertMarkerIsNotCreated(file, MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_M, "StereotypeWTypeTarget", "StereotypeOk"), 13);
+ assertMarkerIsNotCreated(file, MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_F, "StereotypeWTypeTarget", "StereotypeOk"), 13);
+ assertMarkerIsNotCreated(file, MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_STEREOTYPE_TYPE_MF, "StereotypeWTypeTarget", "StereotypeOk"), 13);
+ }
+
+ public void testInterceptorBindingWithAdditionalInterceptorBindings() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/target/InterceptorBindingBroken.java");
+ assertMarkerIsCreated(file, MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE, "InterceptorBindingWTypeTarget", "InterceptorBindingBroken"), 16);
+ }
+
+ public void testInterceptorBindingWithAdditionalInterceptorBindingsOk() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/target/InterceptorBindingOk.java");
+ assertMarkerIsNotCreated(file, MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE, "InterceptorBindingWTypeTarget", "InterceptorBindingOk"), 15);
+ }
+
+ public void testInterceptorBindingsForStereotypes() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/target/StereotypeWithInterceptorBindingBroken.java");
+ assertMarkerIsCreated(file, MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE_FOR_STEREOTYPE, "StereotypeWithInterceptorBindingBroken", "InterceptorBindingWTypeTarget"), 15);
+ }
+
+ public void testInterceptorBindingsForStereotypesOk() throws Exception {
+ IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/target/StereotypeOk.java");
+ assertMarkerIsNotCreated(file, MessageFormat.format(CDIValidationMessages.ILLEGAL_TARGET_IN_INTERCEPTOR_BINDING_TYPE_FOR_STEREOTYPE, "StereotypeOk", "InterceptorBindingWTypeTarget"), 14);
+ }
}
\ No newline at end of file
14 years
JBoss Tools SVN: r27520 - in trunk/cdi/tests: org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-12-15 12:59:31 -0500 (Wed, 15 Dec 2010)
New Revision: 27520
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NonStaticProducerOfSessionBeanBroken.qfxresult
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NotBusinessMethod_BrokenNoInterface.qfxresult
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NotBusinessMethod_Broken.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NotBusinessMethod_BrokenNoInterface.java
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
Log:
https://issues.jboss.org/browse/JBIDE-7673
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NonStaticProducerOfSessionBeanBroken.qfxresult
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NonStaticProducerOfSessionBeanBroken.qfxresult (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NonStaticProducerOfSessionBeanBroken.qfxresult 2010-12-15 17:59:31 UTC (rev 27520)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import javax.ejb.Stateless;
+import javax.enterprise.inject.Produces;
+
+@Stateless
+public class NonStaticProducerOfSessionBeanBroken {
+
+ @Produces public static FunnelWeaver<String> anotherFunnelWeaver;
+}
\ No newline at end of file
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NotBusinessMethod_Broken.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NotBusinessMethod_Broken.java 2010-12-15 17:37:11 UTC (rev 27519)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NotBusinessMethod_Broken.java 2010-12-15 17:59:31 UTC (rev 27520)
@@ -2,11 +2,19 @@
import javax.ejb.Stateful;
import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
@Stateful
public class NotBusinessMethod_Broken implements LocalInt {
+ @PersistenceContext EntityManager em;
+ @Produces
+ public EntityManager retrieveEntityManager() {
+ return em;
+ }
+
void disposeEntityManager(@Disposes EntityManager em) {
}
}
\ No newline at end of file
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NotBusinessMethod_BrokenNoInterface.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NotBusinessMethod_BrokenNoInterface.java 2010-12-15 17:37:11 UTC (rev 27519)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NotBusinessMethod_BrokenNoInterface.java 2010-12-15 17:59:31 UTC (rev 27520)
@@ -2,11 +2,19 @@
import javax.ejb.Stateful;
import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
@Stateful
-public class NotBusinessMethod_BrokenNoInterface {
+public class NotBusinessMethod_BrokenNoInterface{
+ @PersistenceContext EntityManager em;
+ @Produces
+ public EntityManager retrieveEntityManager() {
+ return em;
+ }
+
void disposeEntityManager(@Disposes EntityManager em) {
}
}
\ No newline at end of file
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NotBusinessMethod_BrokenNoInterface.qfxresult
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NotBusinessMethod_BrokenNoInterface.qfxresult (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NotBusinessMethod_BrokenNoInterface.qfxresult 2010-12-15 17:59:31 UTC (rev 27520)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import javax.ejb.Stateful;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+@Stateful
+public class NotBusinessMethod_BrokenNoInterface{
+ @PersistenceContext EntityManager em;
+
+ @Produces
+ public EntityManager retrieveEntityManager() {
+ return em;
+ }
+
+ public void disposeEntityManager(@Disposes EntityManager em) {
+ }
+}
\ No newline at end of file
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-15 17:37:11 UTC (rev 27519)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2010-12-15 17:59:31 UTC (rev 27520)
@@ -162,6 +162,9 @@
new String[]{
"JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/NonStaticProducerOfSessionBeanBroken.java"
},
+ new String[]{
+ "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/NonStaticProducerOfSessionBeanBroken.qfxresult"
+ },
MARKER_TYPE,
CDIValidationErrorManager.MESSAGE_ID_ATTRIBUTE_NAME,
CDIValidationErrorManager.ILLEGAL_PRODUCER_FIELD_IN_SESSION_BEAN_ID,
@@ -275,6 +278,9 @@
new String[]{
"JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/NotBusinessMethod_BrokenNoInterface.java"
},
+ new String[]{
+ "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/NotBusinessMethod_BrokenNoInterface.qfxresult"
+ },
MARKER_TYPE,
CDIValidationErrorManager.MESSAGE_ID_ATTRIBUTE_NAME,
CDIValidationErrorManager.ILLEGAL_DISPOSER_IN_SESSION_BEAN_ID,
14 years
JBoss Tools SVN: r27519 - in trunk/cdi/tests: org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-12-15 12:37:11 -0500 (Wed, 15 Dec 2010)
New Revision: 27519
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/FooProducerNoInterface.qfxresult
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TibetanTerrier_BrokenNoInterface.qfxresult
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
Log:
https://issues.jboss.org/browse/JBIDE-7673
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/FooProducerNoInterface.qfxresult
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/FooProducerNoInterface.qfxresult (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/FooProducerNoInterface.qfxresult 2010-12-15 17:37:11 UTC (rev 27519)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import javax.ejb.Stateful;
+import javax.enterprise.inject.Produces;
+
+@Stateful
+public class FooProducerNoInterface
+{
+ @Produces public Foo createFoo() { return new Foo(); }
+}
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TibetanTerrier_BrokenNoInterface.qfxresult
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TibetanTerrier_BrokenNoInterface.qfxresult (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TibetanTerrier_BrokenNoInterface.qfxresult 2010-12-15 17:37:11 UTC (rev 27519)
@@ -0,0 +1,12 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import javax.ejb.Stateless;
+import javax.enterprise.event.Observes;
+
+@Stateless
+class TibetanTerrier_BrokenNoInterface
+{
+ public void observeSomeEvent(@Observes String someEvent)
+ {
+ }
+}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java 2010-12-15 17:10:29 UTC (rev 27518)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java 2010-12-15 17:37:11 UTC (rev 27519)
@@ -209,7 +209,7 @@
static class JavaFileFilter implements FileFilter {
public boolean accept(File pathname) {
String name = pathname.getName();
- return (pathname.isDirectory() && !name.endsWith(".svn")) || ((name.endsWith(".java") || name.equals("beans.xml")) && !name.endsWith("Test.java"));
+ return (pathname.isDirectory() && !name.endsWith(".svn")) || ((name.endsWith(".java") || name.endsWith(".qfxresult") || name.equals("beans.xml")) && !name.endsWith("Test.java"));
}
}
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-15 17:10:29 UTC (rev 27518)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2010-12-15 17:37:11 UTC (rev 27519)
@@ -29,6 +29,7 @@
import org.jboss.tools.cdi.ui.marker.MakeFieldStaticMarkerResolution;
import org.jboss.tools.cdi.ui.marker.MakeMethodBusinessMarkerResolution;
import org.jboss.tools.cdi.ui.marker.MakeMethodPublicMarkerResolution;
+import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.test.util.JobUtils;
/**
@@ -39,6 +40,10 @@
public static final String MARKER_TYPE = "org.jboss.tools.cdi.core.cdiproblem";
private void checkResolution(IProject project, String[] fileNames, String markerType, String idName, int id, Class<? extends IMarkerResolution> resolutionClass) throws CoreException {
+ checkResolution(project, fileNames, new String[]{}, markerType, idName, id, resolutionClass);
+ }
+
+ private void checkResolution(IProject project, String[] fileNames, String[] results, String markerType, String idName, int id, Class<? extends IMarkerResolution> resolutionClass) throws CoreException {
IFile file = project.getFile(fileNames[0]);
assertTrue("File - "+file.getFullPath()+" must be exist",file.exists());
@@ -69,6 +74,8 @@
assertTrue("Marker resolution did not decrease number of problems. was: "+markers.length+" now: "+newMarkers.length, newMarkers.length < markers.length);
+ checkResults(project, fileNames, results);
+
return;
}
}
@@ -137,6 +144,19 @@
}
}
+ private void checkResults(IProject project, String[] fileNames, String[] results) throws CoreException{
+ for(int i = 0; i < results.length; i++){
+ IFile file = project.getFile(fileNames[i]);
+ IFile resultFile = project.getFile(results[i]);
+
+ String fileContent = FileUtil.readStream(file);
+ String resultContent = FileUtil.readStream(resultFile);
+
+ assertEquals("Wrong result of resolution", resultContent, fileContent);
+ }
+
+ }
+
public void testMakeProducerFieldStaticResolution() throws CoreException {
checkResolution(tckProject,
new String[]{
@@ -179,6 +199,9 @@
new String[]{
"JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/FooProducerNoInterface.java"
},
+ new String[]{
+ "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/FooProducerNoInterface.qfxresult"
+ },
MARKER_TYPE,
CDIValidationErrorManager.MESSAGE_ID_ATTRIBUTE_NAME,
CDIValidationErrorManager.ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN_ID,
@@ -214,6 +237,9 @@
new String[]{
"JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/TibetanTerrier_BrokenNoInterface.java"
},
+ new String[]{
+ "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/TibetanTerrier_BrokenNoInterface.qfxresult"
+ },
MARKER_TYPE,
CDIValidationErrorManager.MESSAGE_ID_ATTRIBUTE_NAME,
CDIValidationErrorManager.ILLEGAL_OBSERVER_IN_SESSION_BEAN_ID,
14 years