JBoss Tools SVN: r27558 - in trunk/deltacloud: plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-16 13:18:39 -0500 (Thu, 16 Dec 2010)
New Revision: 27558
Added:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/DeltaCloudFake.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/tests/org.jboss.tools.deltacloud.test/DeltaCloudMockIntegrationTest.launch
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/DeltaCloudMockIntegrationTest.java
Log:
[JBIDE-7911] corrected: throws exceptions on error (internal server error, connection error etc)
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-12-16 17:51:15 UTC (rev 27557)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-12-16 18:18:39 UTC (rev 27558)
@@ -1,3 +1,8 @@
+2010-12-16 André Dietisheim <adietish(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (testCredentials):
+ [JBIDE-7911] corrected: throws exceptions on error (internal server error, connection error etc)
+
2010-12-15 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/DeltaCloud.java
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-16 17:51:15 UTC (rev 27557)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-12-16 18:18:39 UTC (rev 27558)
@@ -513,7 +513,18 @@
}
- public boolean testConnection() throws DeltaCloudException {
+ /**
+ * Tests the credentials defined in this DeltaCloud instance by connecting
+ * to the server defined by the url in this instance. Returns
+ * <code>true</code> if the credentials are valid, <code>false</code>
+ * otherwise.
+ *
+ * @return <code>true</code>, if successful
+ * @throws DeltaCloudClientException
+ * if any other error occurs while trying to connect to the
+ * server
+ */
+ public boolean testCredentials() throws DeltaCloudClientException {
String instanceId = "nonexistingInstance"; //$NON-NLS-1$
try {
client.listInstances(instanceId);
@@ -522,8 +533,6 @@
return true;
} catch (DeltaCloudAuthException e) {
return false;
- } catch (DeltaCloudClientException e) {
- return false;
}
}
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/DeltaCloudMockIntegrationTest.launch
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/DeltaCloudMockIntegrationTest.launch 2010-12-16 17:51:15 UTC (rev 27557)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/DeltaCloudMockIntegrationTest.launch 2010-12-16 18:18:39 UTC (rev 27558)
@@ -12,7 +12,7 @@
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
<booleanAttribute key="default" value="false"/>
-<stringAttribute key="deselected_workspace_plugins" value="org.eclipse.epp.usagedata.recording,org.eclipse.epp.usagedata.gathering,org.mozilla.xulrunner.cocoa.macosx,org.jboss.tools.common,org.jboss.tools.deltacloud.docs,org.mozilla.xulrunner.gtk.linux.x86_64,org.jboss.tools.usage,org.mozilla.xulrunner.win32.win32.x86,com.jboss.jbds.usage.branding,org.jboss.tools.usage.test,org.mozilla.xulrunner.gtk.linux.x86,org.eclipse.epp.usagedata.ui,org.mozilla.xulrunner.carbon.macosx,org.mozilla.xpcom,org.jboss.tools.tests,org.jboss.tools.deltacloud.ui,org.jruby.jruby"/>
+<stringAttribute key="deselected_workspace_plugins" value="org.jboss.tools.gwt.ui,org.eclipse.epp.usagedata.recording,org.jboss.tools.deltacloud.integration,org.eclipse.epp.usagedata.gathering,org.jboss.tools.deltacloud.docs,org.jboss.tools.usage,org.jboss.tools.usage.test,com.jboss.jbds.usage.branding,org.jboss.tools.gwt.core,org.eclipse.epp.usagedata.ui,org.jboss.tools.deltacloud.ui,org.jboss.tools.tests"/>
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
@@ -29,7 +29,7 @@
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.jboss.tools.internal.deltacloud.core.observable.test.core.DeltaCloudMockIntegrationTest"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.jboss.tools.internal.deltacloud.test.core.DeltaCloudMockIntegrationTest"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.jboss.tools.deltacloud.test"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
@@ -37,8 +37,8 @@
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
<booleanAttribute key="run_in_ui_thread" value="true"/>
-<stringAttribute key="selected_target_plugins" value="org.eclipse.help@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.debug.core@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.emf.common@default:default,org.eclipse.jface@default:default,org.eclipse.ui@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.swt.gtk.linux.x86_64@default:false,org.eclipse.ant.core@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.wst.xml.core@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.text@default:default,org.eclipse.wst.validation@default:default,org.jboss.tools.xulrunner.initializer@default:false,org.eclipse.jdt.debug@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.equinox.security@default:default,org.eclipse.equinox.app@defau!
lt:default,org.eclipse.core.runtime@default:true,org.eclipse.core.expressions@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.wst.common.frameworks@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.ui.forms@default:default,org.eclipse.core.jobs@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.ecf.ssl@default:false,org.apache.xml.resolver@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.osgi.util@default:default,org.eclipse.equinox.common@2:true,org.eclipse.jem.util@default:default,org.eclipse.ecf.identity@default:default,org.hamcrest.core@default:default,com.ibm.icu@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.core.databinding@default:default,org.eclipse.swt@default:default,org.apache.xerces@default:default,org.eclipse.equinox.concurrent@defau!
lt:default,org.eclipse.core.filebuffers@default:default,org.ec!
lipse.em
f.ecore@default:default,org.eclipse.osgi.services@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.ui.editors@default:default,org.apache.xml.serializer@default:default,org.eclipse.search@default:default,org.apache.commons.logging*1.0.4.v201005080501@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.wst.sse.core@default:default,org.eclipse.wst.common.core@default:default,org.eclipse.wst.common.project.facet.core@default:default,org.eclipse.core.resources@default:default,org.eclipse.ecf@default:default,org.eclipse.jdt.compiler.apt@default:false,org.apache.commons.httpclient*3.1.0.v201005080502@default:default,org.eclipse.team.core@default:default,org.eclipse.jdt.core.manipulation@default:default,com.instantiations.designer.jdt.fragment@default:false,org.eclipse.core.net@default:default,org.eclipse.jface.text@default:default,org.eclipse.core.net.linux.x86_64@default:false,org.eclipse.wst.common.emf@default:default,org.eclip!
se.ui.views.properties.tabbed@default:default,javax.servlet@default:default,org.eclipse.compare@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.wst.common.uriresolver@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ui.console@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.ui.views@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.wst.common.environment@default:default,org.eclipse.debug.ui@default:default,org.eclipse.osgi@-1:true,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.edit@default:default,org.eclipse.ui.ide@default:default,org.eclipse.team.ui@default:default,org.eclipse.core.filesystem.linux.x86_64@default:false,org.eclipse.wst.common.emfworkbench.integration@default:default,org.eclipse.jdt.compiler.tool@default:false,org.apache.commons.codec*1.3.0.v20100518-1140@default:default,org.eclipse.core.runt!
ime.compatibility.registry@default:false,org.eclipse.equinox.p!
2.reposi
tory@default:default,javax.xml@default:default,org.eclipse.jdt.ui@default:default,org.eclipse.compare.core@default:default,org.junit*4.8.1.v4_8_1_v20100427-1100@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.core.variables@default:default,org.eclipse.jdt.launching@default:default,org.eclipse.jdt.core@default:default"/>
-<stringAttribute key="selected_workspace_plugins" value="org.jboss.tools.deltacloud.test@default:default,org.jboss.tools.deltacloud.core@default:default"/>
+<stringAttribute key="selected_target_plugins" value="org.eclipse.swt.gtk.linux.x86_64@default:false,org.eclipse.ant.core@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.compare@default:default,org.eclipse.core.commands@default:default,org.eclipse.wst.common.environment@default:default,org.eclipse.ui.editors@default:default,org.eclipse.jem.util@default:default,org.eclipse.ui.console@default:default,org.apache.commons.codec*1.3.0.v20100518-1140@default:default,org.eclipse.wst.common.project.facet.core@default:default,org.eclipse.debug.ui@default:default,org.eclipse.equinox.security@default:default,org.eclipse.ui.ide@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.core.variables@default:default,org.eclipse.equinox.concurrent@default:default,org.apache.xml.serializer@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.jdt.debug@default:default,!
org.eclipse.wst.common.uriresolver@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.wst.sse.core@default:default,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.core.jobs@default:default,org.eclipse.wst.validation@default:default,org.eclipse.team.core@default:default,org.eclipse.wst.common.frameworks@default:default,org.eclipse.ecf@default:default,org.eclipse.core.resources@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.jdt.compiler.apt@default:false,org.eclipse.jdt.ui@default:default,org.eclipse.equinox.common@default:default,org.eclipse.core.net@default:default,org.apache.xerces@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.search@default:default,javax.servlet@default:default,org.eclipse.osgi.util@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.debug.core@default:default,org.eclipse.core.databinding@default:default,org.eclipse.osgi,org.eclipse.core.fi!
lesystem.linux.x86_64@default:false,org.eclipse.ui.navigator.r!
esources
@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.equinox.p2.core@default:default,org.apache.commons.httpclient*3.1.0.v201005080502@default:default,org.eclipse.ui.views@default:default,org.eclipse.wst.common.core@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.jdt.compiler.tool@default:false,org.junit*4.8.1.v4_8_1_v20100427-1100@default:default,org.eclipse.jdt.core@default:default,org.eclipse.osgi.services@default:default,org.eclipse.wst.xml.core@default:default,org.eclipse.core.databinding.observable@default:default,org.jboss.tools.xulrunner.initializer@default:false,org.eclipse.jface@default:default,org.eclipse.emf.edit@default:default,org.eclipse.wst.common.emf@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.core.runtime@default:true,org.eclipse.emf.ecore.change@default:default,javax.xml@!
default:default,org.eclipse.ui@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.swt@default:default,org.eclipse.help@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.jdt.launching@default:default,org.apache.commons.logging*1.0.4.v201005080501@default:default,org.apache.xml.resolver@default:default,org.eclipse.emf.ecore.xmi@default:default,com.ibm.icu@default:default,org.eclipse.equinox.app@default:default,org.eclipse.jface.text@default:default,org.eclipse.team.ui@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.ltk.core.refactoring@default:default,org.hamcrest.core@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ui.forms@default:default,org.eclipse.wst.common.emfworkbench.integration@default:default,org.eclipse.ecf.ssl@default:false,com.instantiations.designer.jdt.fragme!
nt@default:false,org.eclipse.core.net.linux.x86_64@default:fal!
se,org.e
clipse.compare.core@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.text@default:default,org.eclipse.core.expressions@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.ui.workbench.texteditor@default:default"/>
+<stringAttribute key="selected_workspace_plugins" value="org.jboss.tools.deltacloud.test@default:default,org.jboss.tools.common@default:default,org.jboss.tools.deltacloud.core@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/DeltaCloudMockIntegrationTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/DeltaCloudMockIntegrationTest.java 2010-12-16 17:51:15 UTC (rev 27557)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/DeltaCloudMockIntegrationTest.java 2010-12-16 18:18:39 UTC (rev 27558)
@@ -19,6 +19,7 @@
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
import org.jboss.tools.internal.deltacloud.test.context.MockIntegrationTestContext;
+import org.jboss.tools.internal.deltacloud.test.fakes.DeltaCloudFake;
import org.jboss.tools.internal.deltacloud.test.fakes.ServerFake;
import org.junit.After;
import org.junit.Before;
@@ -29,7 +30,7 @@
*
* @author Andre Dietisheim
*
- * @see DeltaCloud#testConnection()
+ * @see DeltaCloud#testCredentials()
*
*/
public class DeltaCloudMockIntegrationTest {
@@ -48,15 +49,15 @@
}
@Test
- public void testConnectionReportsFalseOnAuthFailure() throws MalformedURLException, DeltaCloudClientException, DeltaCloudException {
+ public void testConnectionReportsFalseOnAuthFailure() throws MalformedURLException, DeltaCloudClientException,
+ DeltaCloudException {
ServerFake serverFake = setupServerFake("HTTP/1.1 403 Forbidden\n\n\n");
try {
- DeltaCloud deltaCloud = new DeltaCloud(
- "aName",
- "http://localhost:" + ServerFake.DEFAULT_PORT,
- "badUser",
+ DeltaCloud deltaCloud = new DeltaCloudFake(
+ "http://localhost:" + ServerFake.DEFAULT_PORT,
+ "badUser",
"badPassword");
- assertFalse(deltaCloud.testConnection());
+ assertFalse(deltaCloud.testCredentials());
} finally {
serverFake.stop();
}
@@ -66,9 +67,9 @@
public void testConnectionThrowsOnGeneralFailure() throws MalformedURLException, DeltaCloudClientException, DeltaCloudException {
ServerFake serverFake = setupServerFake("HTTP/1.1 501 Some Error\ndummy dummy dummy\n\n");
try {
- DeltaCloud deltaCloud = new DeltaCloud("aName", "http://localhost:" + ServerFake.DEFAULT_PORT, "badUser",
- "badPassword");
- deltaCloud.testConnection();
+ DeltaCloud deltaCloud =
+ new DeltaCloudFake("http://localhost:" + ServerFake.DEFAULT_PORT, "badUser", "badPassword");
+ deltaCloud.testCredentials();
} finally {
serverFake.stop();
}
Added: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/DeltaCloudFake.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/DeltaCloudFake.java (rev 0)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/DeltaCloudFake.java 2010-12-16 18:18:39 UTC (rev 27558)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * 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.test.fakes;
+
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.core.SecurePasswordStore;
+
+/**
+ * @author André Dietisheim
+ */
+public class DeltaCloudFake extends DeltaCloud {
+
+ public DeltaCloudFake() throws DeltaCloudException {
+ this("http://dummy.org", "aUser", "aPassword");
+ }
+
+ public DeltaCloudFake(String url, String username, String password) throws DeltaCloudException {
+ super("fake", url, username, password);
+ }
+
+ @Override
+ protected SecurePasswordStore createSecurePasswordStore(String name, String username, String password) {
+ return new SecurePasswordStoreFake("dummyPassword");
+ }
+
+ private static class SecurePasswordStoreFake extends SecurePasswordStore {
+
+ private String password;
+
+ public SecurePasswordStoreFake(String password) {
+ super(null, password);
+ this.password = password;
+ }
+
+ @Override
+ public String getPassword() throws DeltaCloudException {
+ return password;
+ }
+
+ @Override
+ public void setPassword(String password) throws DeltaCloudException {
+ this.password = password;
+ }
+
+ @Override
+ public void update(IStorageKey key, String password) throws DeltaCloudException {
+ setPassword(password);
+ }
+
+ @Override
+ public void remove() throws DeltaCloudException {
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/DeltaCloudFake.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years
JBoss Tools SVN: r27557 - trunk/documentation/qa/docs/Test_Cases.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2010-12-16 12:51:15 -0500 (Thu, 16 Dec 2010)
New Revision: 27557
Modified:
trunk/documentation/qa/docs/Test_Cases/VPEtests.doc
Log:
Added GlobalELVariablesTest.
Modified: trunk/documentation/qa/docs/Test_Cases/VPEtests.doc
===================================================================
(Binary files differ)
14 years
JBoss Tools SVN: r27556 - in trunk: vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2010-12-16 12:39:44 -0500 (Thu, 16 Dec 2010)
New Revision: 27556
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/GlobalELVariablesTest.java
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java
Log:
Added GlobalELVariablesTest.
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2010-12-16 16:22:49 UTC (rev 27555)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2010-12-16 17:39:44 UTC (rev 27556)
@@ -319,7 +319,7 @@
public static final class NewXHTMLFileDialog {
- public static final String NAME = "Name*";
+ public static final String FILE_NAME = "Name*";
public static final String TEMPLATE = "Template";
public static final String TEMPLATE_FACELET_FORM_XHTML = "FaceletForm.xhtml";
public static final String TEMPLATE_FACELET_FORM_XHTML_NAME = "Form Facelet Page";
@@ -380,6 +380,7 @@
public static final String JBOSS_TOOLS_WEB_EDITORS = "Editors";
public static final String JBOSS_TOOLS_WEB_EDITORS_VPE = "Visual Page Editor";
public static final String JBOSS_TOOLS_WEB_EDITORS_VPE_VISUAL_TEMPLATES = "Visual Templates";
+ public static final String JBOSS_TOOLS_EL_VARIABLES = "El Variables";
}
public static class JBossServerRuntimeDialog {
@@ -646,4 +647,11 @@
public static final String FILE_NAME = "File name:";
}
+ public static class AddELReferenceDialog{
+
+ public static final String EL_NAME = "El Name*";
+ public static final String VALUE = "Value";
+
+ }
+
}
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java 2010-12-16 16:22:49 UTC (rev 27555)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/VPEAllBotTests.java 2010-12-16 17:39:44 UTC (rev 27556)
@@ -24,6 +24,7 @@
import org.jboss.tools.vpe.ui.bot.test.editor.preferences.AlwaysHideSelectionBarWithoutPromptTest;
import org.jboss.tools.vpe.ui.bot.test.editor.preferences.BorderForUnknownTagsTest;
import org.jboss.tools.vpe.ui.bot.test.editor.preferences.ChangeEditorTabForTheFirstOpenPageTest;
+import org.jboss.tools.vpe.ui.bot.test.editor.preferences.GlobalELVariablesTest;
import org.jboss.tools.vpe.ui.bot.test.editor.preferences.PromptForTagAttributesDuringTagInsertTest;
import org.jboss.tools.vpe.ui.bot.test.editor.preferences.ShowNonVisualTagsTest;
import org.jboss.tools.vpe.ui.bot.test.editor.preferences.ShowResourceBundlesUsageasELexpressionsTest;
@@ -88,6 +89,7 @@
suite.addTestSuite(ManipulatingELValueTest.class);
suite.addTestSuite(SelectionBarTest.class);
suite.addTestSuite(IncludedCssFilesTest.class);
+ suite.addTestSuite(GlobalELVariablesTest.class);
return new TestSetup(suite);
}
Added: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/GlobalELVariablesTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/GlobalELVariablesTest.java (rev 0)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/GlobalELVariablesTest.java 2010-12-16 17:39:44 UTC (rev 27556)
@@ -0,0 +1,106 @@
+package org.jboss.tools.vpe.ui.bot.test.editor.preferences;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTableItem;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotTableExt;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.types.JobName;
+import org.jboss.tools.vpe.ui.bot.test.VPEAutoTestCase;
+import org.jboss.tools.vpe.ui.bot.test.editor.VPEEditorTestCase;
+import org.jboss.tools.vpe.ui.bot.test.tools.SWTBotWebBrowser;
+/**
+ * Tests Global EL Variables Definition
+ * @author vpakan
+ *
+ */
+public class GlobalELVariablesTest extends VPEEditorTestCase{
+
+ private static final String elName = "user.name";
+ private static final String elValue = "!!TestELValue!!";
+ private static String FACELET_PROJECT_XHTML_FILE_NAME = "globalELVariablesTest.xhtml";
+ private SWTBotExt botExt = null;
+
+ public GlobalELVariablesTest() {
+ super();
+ botExt = new SWTBotExt();
+ }
+
+ public void testGlobalELVariables() throws Throwable{
+ bot.menu(IDELabel.Menu.WINDOW).menu(IDELabel.Menu.PREFERENCES).click();
+ bot.shell(IDELabel.Shell.PREFERENCES).activate();
+ SWTBotTree preferenceTree = this.bot.tree();
+ preferenceTree
+ .expandNode(IDELabel.PreferencesDialog.JBOSS_TOOLS)
+ .expandNode(IDELabel.PreferencesDialog.JBOSS_TOOLS_WEB)
+ .select(IDELabel.PreferencesDialog.JBOSS_TOOLS_EL_VARIABLES);
+ bot.button(IDELabel.Button.ADD_WITHOUT_DOTS).click();
+ bot.shell(IDELabel.Shell.ADD_EL_REFERENCE).activate();
+ bot.textWithLabel(IDELabel.AddELReferenceDialog.EL_NAME).setText(GlobalELVariablesTest.elName);
+ bot.textWithLabel(IDELabel.AddELReferenceDialog.VALUE).setText(GlobalELVariablesTest.elValue);
+ bot.button(IDELabel.Button.FINISH).click();
+ bot.shell(IDELabel.Shell.PREFERENCES).activate();
+ bot.button(IDELabel.Button.OK).click();
+ openPage(VPEAutoTestCase.TEST_PAGE);
+ // Create XHTML File in Facelet Project
+ SWTBotTree tree = packageExplorer.show().bot().tree();
+ tree.expandNode(VPEAutoTestCase.FACELETS_TEST_PROJECT_NAME)
+ .expandNode("WebContent")
+ .getNode("pages")
+ .select();
+ // add JSP
+ open.newObject(ActionItem.NewObject.JBossToolsWebXHTMLFile.LABEL);
+ bot.shell(IDELabel.Shell.NEW_XHTML_FILE).activate(); //$NON-NLS-1$
+ bot.textWithLabel(ActionItem.NewObject.JBossToolsWebXHTMLFile.TEXT_FILE_NAME)
+ .setText(GlobalELVariablesTest.FACELET_PROJECT_XHTML_FILE_NAME); //$NON-NLS-1$
+ bot.button(IDELabel.Button.FINISH).click(); //$NON-NLS-1$
+ bot.sleep(Timing.time3S());
+ util.waitForJobs(JobName.BUILDING_WS);
+ SWTBotEditor xhtmlEditor = bot.editorByTitle(GlobalELVariablesTest.FACELET_PROJECT_XHTML_FILE_NAME);
+ xhtmlEditor.toTextEditor().setText("<html xmlns=\"http://www.w3.org/1999/xhtml\"\n" +
+ " xmlns:h=\"http://java.sun.com/jsf/html\">\n" +
+ " <body>\n" +
+ " <h:outputText value=\"#{user.name}\"/>\n" +
+ " </body>\n" +
+ "</html>");
+ xhtmlEditor.save();
+ bot.sleep(Timing.time5S());
+ assertVisualEditorContainsNodeWithValue(new SWTBotWebBrowser(GlobalELVariablesTest.FACELET_PROJECT_XHTML_FILE_NAME, botExt),
+ GlobalELVariablesTest.elValue,
+ GlobalELVariablesTest.FACELET_PROJECT_XHTML_FILE_NAME);
+ xhtmlEditor.close();
+ SWTBotEditor jspEditor = bot.editorByTitle(VPEAutoTestCase.TEST_PAGE);
+ jspEditor.show();
+ bot.sleep(Timing.time5S());
+ assertVisualEditorContains(new SWTBotWebBrowser(VPEAutoTestCase.TEST_PAGE, botExt),
+ "INPUT",
+ new String[] {"value"},
+ new String[] {GlobalELVariablesTest.elValue},
+ VPEAutoTestCase.TEST_PAGE);
+ jspEditor.close();
+
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ bot.menu(IDELabel.Menu.WINDOW).menu(IDELabel.Menu.PREFERENCES).click();
+ SWTBotTree preferenceTree = this.bot.tree();
+ preferenceTree.expandNode(IDELabel.PreferencesDialog.JBOSS_TOOLS)
+ .expandNode(IDELabel.PreferencesDialog.JBOSS_TOOLS_WEB)
+ .select(IDELabel.PreferencesDialog.JBOSS_TOOLS_EL_VARIABLES);
+
+ SWTBotTableItem tiEL = new SWTBotTableExt(bot.table()).getTableItem(new String[] {"Global",
+ GlobalELVariablesTest.elName,
+ GlobalELVariablesTest.elValue});
+ if (tiEL != null){
+ tiEL.select();
+ bot.sleep(Timing.time2S());
+ bot.button(IDELabel.Button.REMOVE).click();
+ }
+ bot.button(IDELabel.Button.OK).click();
+ super.tearDown();
+ }
+}
Property changes on: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/preferences/GlobalELVariablesTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years
JBoss Tools SVN: r27555 - in trunk/cdi: plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-12-16 11:22:49 -0500 (Thu, 16 Dec 2010)
New Revision: 27555
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerAnnotationsProcessor.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerDuplicantMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeletePreviewWizard.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Spider.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TimestampLogger_Broken.java
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/CDIValidationErrorManager.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
Log:
https://issues.jboss.org/browse/JBIDE-7673
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-16 16:17:20 UTC (rev 27554)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-12-16 16:22:49 UTC (rev 27555)
@@ -850,7 +850,7 @@
for (IBeanMethod disposerMethod : disposerMethods) {
Set<ITextSourceReference> disposerDeclarations = CDIUtil.getAnnotationPossitions(disposerMethod, CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME);
for (ITextSourceReference declaration : disposerDeclarations) {
- addError(CDIValidationMessages.MULTIPLE_DISPOSERS_FOR_PRODUCER, CDIPreferences.MULTIPLE_DISPOSERS_FOR_PRODUCER, declaration, bean.getResource());
+ addError(CDIValidationMessages.MULTIPLE_DISPOSERS_FOR_PRODUCER, CDIPreferences.MULTIPLE_DISPOSERS_FOR_PRODUCER, declaration, bean.getResource(), MULTIPLE_DISPOSERS_FOR_PRODUCER_ID);
}
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java 2010-12-16 16:17:20 UTC (rev 27554)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java 2010-12-16 16:22:49 UTC (rev 27555)
@@ -22,6 +22,7 @@
public static final int ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN_ID = 2;
public static final int ILLEGAL_DISPOSER_IN_SESSION_BEAN_ID = 3;
public static final int ILLEGAL_OBSERVER_IN_SESSION_BEAN_ID = 4;
+ public static final int MULTIPLE_DISPOSERS_FOR_PRODUCER_ID = 5;
/*
* (non-Javadoc)
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2010-12-16 16:17:20 UTC (rev 27554)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2010-12-16 16:22:49 UTC (rev 27555)
@@ -82,6 +82,7 @@
public static String MAKE_METHOD_PUBLIC_MARKER_RESOLUTION_TITLE;
public static String MAKE_METHOD_BUSINESS_MARKER_RESOLUTION_TITLE;
public static String ADD_LOCAL_BEAN_MARKER_RESOLUTION_TITLE;
+ public static String DELETE_ALL_DISPOSER_DUPLICANT_MARKER_RESOLUTION_TITLE;
public static String CDI_GENERATE_BEANS_XML;
public static String CDI_INSTALL_WIZARD_PAGE_FACET;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2010-12-16 16:17:20 UTC (rev 27554)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2010-12-16 16:22:49 UTC (rev 27555)
@@ -66,10 +66,11 @@
MAKE_METHOD_PUBLIC_MARKER_RESOLUTION_TITLE=Make ''{0}'' method public
MAKE_METHOD_BUSINESS_MARKER_RESOLUTION_TITLE=Add ''{0}'' method to ''{1}'' interface
ADD_LOCAL_BEAN_MARKER_RESOLUTION_TITLE=Add @LocalBean annotation to ''{0}'' class
+DELETE_ALL_DISPOSER_DUPLICANT_MARKER_RESOLUTION_TITLE=Delete @Disposes annotations from all methods except ''{0}'' method
CDI_GENERATE_BEANS_XML=Generate beans.xml file:
CDI_INSTALL_WIZARD_PAGE_FACET=Context and Dependency Injection (CDI) Facet
-CDI_INSTALL_WIZARD_PAGE_CONFIGURE=Configure Context and Dependency Injection (CDI) Facet Settings>>>>>>> .r27235
+CDI_INSTALL_WIZARD_PAGE_CONFIGURE=Configure Context and Dependency Injection (CDI) Facet Settings
NEW_BEANS_XML_WIZARD_TITLE=New beans.xml File
NEW_BEANS_XML_WIZARD_PAGE_NAME=beans.xml File
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2010-12-16 16:17:20 UTC (rev 27554)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2010-12-16 16:22:49 UTC (rev 27555)
@@ -93,6 +93,13 @@
return resolutions;
}
}
+ }else if (messageId == CDIValidationErrorManager.MULTIPLE_DISPOSERS_FOR_PRODUCER_ID) {
+ IMethod method = findMethod(file, start);
+ if(method != null){
+ return new IMarkerResolution[] {
+ new DeleteAllDisposerDuplicantMarkerResolution(method, file)
+ };
+ }
}
}
return new IMarkerResolution[] {};
Added: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerAnnotationsProcessor.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerAnnotationsProcessor.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerAnnotationsProcessor.java 2010-12-16 16:22:49 UTC (rev 27555)
@@ -0,0 +1,190 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.ui.marker;
+
+import java.text.MessageFormat;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
+import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
+import org.eclipse.ltk.internal.core.refactoring.Messages;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.text.edits.TextEdit;
+import org.jboss.tools.cdi.core.CDIConstants;
+import org.jboss.tools.cdi.core.CDICoreMessages;
+import org.jboss.tools.cdi.core.CDICoreNature;
+import org.jboss.tools.cdi.core.CDICorePlugin;
+import org.jboss.tools.cdi.core.CDIUtil;
+import org.jboss.tools.cdi.core.IBean;
+import org.jboss.tools.cdi.core.IBeanMethod;
+import org.jboss.tools.cdi.core.ICDIProject;
+import org.jboss.tools.cdi.core.IClassBean;
+import org.jboss.tools.cdi.core.IProducer;
+import org.jboss.tools.cdi.core.IProducerMethod;
+import org.jboss.tools.cdi.ui.CDIUIMessages;
+import org.jboss.tools.common.text.ITextSourceReference;
+
+public class DeleteAllDisposerAnnotationsProcessor extends RefactoringProcessor {
+ protected static final RefactoringParticipant[] EMPTY_REF_PARTICIPANT = new RefactoringParticipant[0];
+ private IFile file;
+ private IMethod method;
+ private RefactoringStatus status;
+
+ private CompositeChange rootChange;
+ private TextFileChange change;
+ private IClassBean bean;
+
+
+ public DeleteAllDisposerAnnotationsProcessor(IFile file, IMethod method){
+ this.file = file;
+ this.method = method;
+ }
+
+ private IClassBean findClassBean(){
+ CDICoreNature cdiNature = CDICorePlugin.getCDI(file.getProject(), true);
+ if(cdiNature == null)
+ return null;
+
+ ICDIProject cdiProject = cdiNature.getDelegate();
+
+ if(cdiProject == null)
+ return null;
+
+ Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
+
+ for(IBean bean : beans){
+ if(bean instanceof IClassBean)
+ return (IClassBean)bean;
+ }
+
+ return null;
+ }
+
+ private void changeDisposers(IClassBean bean) {
+ Set<IBeanMethod> disposers = bean.getDisposers();
+ if (disposers.isEmpty()) {
+ return;
+ }
+
+ Set<IBeanMethod> boundDisposers = new HashSet<IBeanMethod>();
+ Set<IProducer> producers = bean.getProducers();
+ for (IProducer producer : producers) {
+ if (producer instanceof IProducerMethod) {
+ IProducerMethod producerMethod = (IProducerMethod) producer;
+ Set<IBeanMethod> disposerMethods = producer.getCDIProject().resolveDisposers(producerMethod);
+ boundDisposers.addAll(disposerMethods);
+ if (disposerMethods.size() > 1) {
+ for (IBeanMethod disposerMethod : disposerMethods) {
+ if(!disposerMethod.getMethod().isSimilar(method)){
+ Set<ITextSourceReference> disposerDeclarations = CDIUtil.getAnnotationPossitions(disposerMethod, CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME);
+ for (ITextSourceReference declaration : disposerDeclarations) {
+ TextEdit edit = new ReplaceEdit(declaration.getStartPosition(), declaration.getLength(), "");
+ change.addEdit(edit);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private boolean isFileCorrect(IFile file){
+ if(!file.isSynchronized(IResource.DEPTH_ZERO)){
+ status.addFatalError(Messages.format(CDICoreMessages.CDI_RENAME_PROCESSOR_OUT_OF_SYNC_FILE, file.getFullPath().toString()));
+ return false;
+ }else if(file.isPhantom()){
+ status.addFatalError(Messages.format(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_PHANTOM_FILE, file.getFullPath().toString()));
+ return false;
+ }else if(file.isReadOnly()){
+ status.addFatalError(Messages.format(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_READ_ONLY_FILE, file.getFullPath().toString()));
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public Object[] getElements() {
+ return null;
+ }
+
+ @Override
+ public String getIdentifier() {
+ return "";
+ }
+
+ @Override
+ public String getProcessorName() {
+ return MessageFormat.format(CDIUIMessages.DELETE_ALL_DISPOSER_DUPLICANT_MARKER_RESOLUTION_TITLE, new Object[]{method.getElementName()});
+ }
+
+ @Override
+ public boolean isApplicable() throws CoreException {
+ return true;
+ }
+
+ @Override
+ public RefactoringStatus checkInitialConditions(IProgressMonitor pm)
+ throws CoreException, OperationCanceledException {
+ status = new RefactoringStatus();
+
+ if(isFileCorrect(file)){
+ bean = findClassBean();
+ }else
+ status.addFatalError("CDI Bean Class not found");
+
+ return status;
+ }
+
+ @Override
+ public RefactoringStatus checkFinalConditions(IProgressMonitor pm,
+ CheckConditionsContext context) throws CoreException,
+ OperationCanceledException {
+
+ rootChange = new CompositeChange(MessageFormat.format(CDIUIMessages.DELETE_ALL_DISPOSER_DUPLICANT_MARKER_RESOLUTION_TITLE, new Object[]{method.getElementName()}));
+ change = new TextFileChange(file.getName(), file);
+ MultiTextEdit root = new MultiTextEdit();
+ change.setEdit(root);
+ rootChange.add(change);
+
+ if(bean != null)
+ changeDisposers(bean);
+
+ return status;
+ }
+
+ @Override
+ public Change createChange(IProgressMonitor pm) throws CoreException,
+ OperationCanceledException {
+ return rootChange;
+ }
+
+ @Override
+ public RefactoringParticipant[] loadParticipants(RefactoringStatus status,
+ SharableParticipants sharedParticipants) throws CoreException {
+ return EMPTY_REF_PARTICIPANT;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerAnnotationsProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerDuplicantMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerDuplicantMarkerResolution.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerDuplicantMarkerResolution.java 2010-12-16 16:22:49 UTC (rev 27555)
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.ui.marker;
+
+import java.text.MessageFormat;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IMarkerResolution2;
+import org.eclipse.ui.internal.Workbench;
+import org.jboss.tools.cdi.core.CDIConstants;
+import org.jboss.tools.cdi.core.CDIUtil;
+import org.jboss.tools.cdi.core.IBeanMethod;
+import org.jboss.tools.cdi.core.IClassBean;
+import org.jboss.tools.cdi.core.IProducer;
+import org.jboss.tools.cdi.core.IProducerMethod;
+import org.jboss.tools.cdi.ui.CDIUIMessages;
+import org.jboss.tools.common.text.ITextSourceReference;
+
+/**
+ * @author Daniel Azarov
+ */
+public class DeleteAllDisposerDuplicantMarkerResolution implements IMarkerResolution2 {
+ private String label;
+ private IMethod method;
+ private IFile file;
+
+ public DeleteAllDisposerDuplicantMarkerResolution(IMethod method, IFile file){
+ this.label = MessageFormat.format(CDIUIMessages.DELETE_ALL_DISPOSER_DUPLICANT_MARKER_RESOLUTION_TITLE, new Object[]{method.getElementName()});
+ this.method = method;
+ this.file = file;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+
+ public void run(IMarker marker) {
+ DeleteAllDisposerAnnotationsProcessor processor = new DeleteAllDisposerAnnotationsProcessor(file, method);
+ ProcessorBasedRefactoring refactoring = new ProcessorBasedRefactoring(processor);
+ DeletePreviewWizard wizard = new DeletePreviewWizard(refactoring, RefactoringWizard.WIZARD_BASED_USER_INTERFACE);
+ RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
+ Shell shell = Workbench.getInstance().getActiveWorkbenchWindow().getShell();
+ try {
+ String titleForFailedChecks = CDIUIMessages.CDI_REFACTOR_CONTRIBUTOR_ERROR;
+ op.run(shell, titleForFailedChecks);
+ } catch (final InterruptedException irex) {
+ // operation was canceled
+ }
+
+ }
+
+ public String getDescription() {
+ return null;
+ }
+
+ public Image getImage() {
+ return null;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerDuplicantMarkerResolution.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeletePreviewWizard.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeletePreviewWizard.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeletePreviewWizard.java 2010-12-16 16:22:49 UTC (rev 27555)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.ui.marker;
+
+import org.eclipse.ltk.core.refactoring.Refactoring;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+
+public class DeletePreviewWizard extends RefactoringWizard {
+
+ public DeletePreviewWizard(Refactoring refactoring, int flags) {
+ super(refactoring, flags);
+ }
+
+ @Override
+ protected void addUserInputPages() {
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeletePreviewWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Spider.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Spider.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Spider.java 2010-12-16 16:22:49 UTC (rev 27555)
@@ -0,0 +1,4 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+class Spider {
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Spider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TimestampLogger_Broken.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TimestampLogger_Broken.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TimestampLogger_Broken.java 2010-12-16 16:22:49 UTC (rev 27555)
@@ -0,0 +1,18 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+
+public class TimestampLogger_Broken {
+
+ @Produces
+ public static Spider getSpider() {
+ return new Spider();
+ }
+
+ public static void destorySpider(@Disposes Spider spider) {
+ }
+
+ public static void destorySpiderAgain(@Disposes Spider spider) {
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/TimestampLogger_Broken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years
JBoss Tools SVN: r27554 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-16 11:17:20 -0500 (Thu, 16 Dec 2010)
New Revision: 27554
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/AbstractDeltaCloudRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/AbstractListObjectsRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateInstanceRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/DeleteKeyRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/DeltaCloudRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListHardwareProfileRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListHardwareProfilesRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListImageRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListImagesRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListInstanceRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListInstancesRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListKeyRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListRealmRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListRealmsRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/PerformInstanceActionRequest.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/TypeRequest.java
Log:
added author
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/AbstractDeltaCloudRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/AbstractDeltaCloudRequest.java 2010-12-16 15:55:17 UTC (rev 27553)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/AbstractDeltaCloudRequest.java 2010-12-16 16:17:20 UTC (rev 27554)
@@ -15,7 +15,9 @@
import org.jboss.tools.deltacloud.core.client.utils.UrlBuilder;
-
+/**
+ * @author André Dietisheim
+ */
public abstract class AbstractDeltaCloudRequest implements DeltaCloudRequest {
private URL url;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/AbstractListObjectsRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/AbstractListObjectsRequest.java 2010-12-16 15:55:17 UTC (rev 27553)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/AbstractListObjectsRequest.java 2010-12-16 16:17:20 UTC (rev 27554)
@@ -22,6 +22,8 @@
* @see ListHardwareProfilesRequest
* @see ListHardwareProfilesRequest
* @see ListInstancesRequest
+ *
+ * @author André Dietisheim
*/
public abstract class AbstractListObjectsRequest extends AbstractDeltaCloudRequest {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateInstanceRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateInstanceRequest.java 2010-12-16 15:55:17 UTC (rev 27553)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/CreateInstanceRequest.java 2010-12-16 16:17:20 UTC (rev 27554)
@@ -16,6 +16,8 @@
/**
* Creates a new instance
+ *
+ * @author André Dietisheim
*/
public class CreateInstanceRequest extends AbstractDeltaCloudRequest {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/DeleteKeyRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/DeleteKeyRequest.java 2010-12-16 15:55:17 UTC (rev 27553)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/DeleteKeyRequest.java 2010-12-16 16:17:20 UTC (rev 27554)
@@ -17,6 +17,8 @@
/**
* Deletes a key on the deltacloud server
+ *
+ * @author André Dietisheim
*/
public class DeleteKeyRequest extends AbstractDeltaCloudRequest {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/DeltaCloudRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/DeltaCloudRequest.java 2010-12-16 15:55:17 UTC (rev 27553)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/DeltaCloudRequest.java 2010-12-16 16:17:20 UTC (rev 27554)
@@ -13,6 +13,9 @@
import java.net.MalformedURLException;
import java.net.URL;
+/**
+ * @author André Dietisheim
+ */
public interface DeltaCloudRequest {
public static final char PATH_SEPARATOR = '/';
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListHardwareProfileRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListHardwareProfileRequest.java 2010-12-16 15:55:17 UTC (rev 27553)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListHardwareProfileRequest.java 2010-12-16 16:17:20 UTC (rev 27554)
@@ -17,6 +17,8 @@
/**
* A request for a hardware profile on a deltacloud server.
+ *
+ * @author André Dietisheim
*/
public class ListHardwareProfileRequest extends AbstractDeltaCloudRequest {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListHardwareProfilesRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListHardwareProfilesRequest.java 2010-12-16 15:55:17 UTC (rev 27553)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListHardwareProfilesRequest.java 2010-12-16 16:17:20 UTC (rev 27554)
@@ -15,6 +15,8 @@
/**
* Lists profiles on the deltacloud server.
+ *
+ * @author André Dietisheim
*/
public class ListHardwareProfilesRequest extends AbstractListObjectsRequest {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListImageRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListImageRequest.java 2010-12-16 15:55:17 UTC (rev 27553)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListImageRequest.java 2010-12-16 16:17:20 UTC (rev 27554)
@@ -17,6 +17,8 @@
/**
* A request for an image on a deltacloud server.
+ *
+ * @author André Dietisheim
*/
public class ListImageRequest extends AbstractDeltaCloudRequest {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListImagesRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListImagesRequest.java 2010-12-16 15:55:17 UTC (rev 27553)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListImagesRequest.java 2010-12-16 16:17:20 UTC (rev 27554)
@@ -15,6 +15,8 @@
/**
* Lists images on the deltacloud server.
+ *
+ * @author André Dietisheim
*/
public class ListImagesRequest extends AbstractListObjectsRequest {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListInstanceRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListInstanceRequest.java 2010-12-16 15:55:17 UTC (rev 27553)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListInstanceRequest.java 2010-12-16 16:17:20 UTC (rev 27554)
@@ -17,6 +17,8 @@
/**
* Lists an instance on the deltacloud server
+ *
+ * @author André Dietisheim
*/
public class ListInstanceRequest extends AbstractDeltaCloudRequest {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListInstancesRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListInstancesRequest.java 2010-12-16 15:55:17 UTC (rev 27553)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListInstancesRequest.java 2010-12-16 16:17:20 UTC (rev 27554)
@@ -14,7 +14,9 @@
/**
- * Lists instances on the deltacloud server.
+ * Lists instances on the deltacloud server.
+ *
+ * @author André Dietisheim
*/
public class ListInstancesRequest extends AbstractListObjectsRequest {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListKeyRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListKeyRequest.java 2010-12-16 15:55:17 UTC (rev 27553)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListKeyRequest.java 2010-12-16 16:17:20 UTC (rev 27554)
@@ -17,6 +17,8 @@
/**
* Lists a key on the deltacloud server
+ *
+ * @author André Dietisheim
*/
public class ListKeyRequest extends AbstractDeltaCloudRequest {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListRealmRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListRealmRequest.java 2010-12-16 15:55:17 UTC (rev 27553)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListRealmRequest.java 2010-12-16 16:17:20 UTC (rev 27554)
@@ -17,6 +17,8 @@
/**
* Lists a realm on the deltacloud server
+ *
+ * @author André Dietisheim
*/
public class ListRealmRequest extends AbstractDeltaCloudRequest {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListRealmsRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListRealmsRequest.java 2010-12-16 15:55:17 UTC (rev 27553)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/ListRealmsRequest.java 2010-12-16 16:17:20 UTC (rev 27554)
@@ -15,6 +15,8 @@
/**
* Lists realms on the deltacloud server.
+ *
+ * @author André Dietisheim
*/
public class ListRealmsRequest extends AbstractListObjectsRequest {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/PerformInstanceActionRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/PerformInstanceActionRequest.java 2010-12-16 15:55:17 UTC (rev 27553)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/PerformInstanceActionRequest.java 2010-12-16 16:17:20 UTC (rev 27554)
@@ -17,6 +17,8 @@
/**
* Performs an action on a instance on the deltacloud server
+ *
+ * @author André Dietisheim
*/
public class PerformInstanceActionRequest extends AbstractDeltaCloudRequest {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/TypeRequest.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/TypeRequest.java 2010-12-16 15:55:17 UTC (rev 27553)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/request/TypeRequest.java 2010-12-16 16:17:20 UTC (rev 27554)
@@ -17,6 +17,8 @@
/**
* A request for the type of deltacloud server.
+ *
+ * @author André Dietisheim
*/
public class TypeRequest extends AbstractDeltaCloudRequest {
14 years
JBoss Tools SVN: r27553 - trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-12-16 10:55:17 -0500 (Thu, 16 Dec 2010)
New Revision: 27553
Modified:
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java
Log:
Modified: trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java 2010-12-16 15:33:45 UTC (rev 27552)
+++ trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java 2010-12-16 15:55:17 UTC (rev 27553)
@@ -137,8 +137,8 @@
resource, type, errorMessage, pattern);
if(lines.isEmpty()) {
- IMarker[] allMarkers = findMarkers(resource, null, "*", true);
- StringBuffer sb = new StringBuffer("Marker matches the '"); //$NON-NLS-1$
+ IMarker[] allMarkers = findMarkers(resource, null, ".*", true);
+ StringBuffer sb = new StringBuffer("Marker matches the '"); //$NON-NLS-1$
sb.append(errorMessage).append("' pattern wasn't found. Here is a list of found markers in ").append(resource.getFullPath().toOSString()).append(" : [\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
int i=0;
for (IMarker marker : allMarkers) {
@@ -146,10 +146,10 @@
marker.getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$
int line = marker.getAttribute(IMarker.LINE_NUMBER, -1);
String mType = marker.getType();
- sb.append(i).append(") line: \"").append(line).append("\"; type: \"").append(mType).append("\"; message: \"").append(message).append("\";\r\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ sb.append(i).append(") line=\"").append(line).append("\"; type=\"").append(mType).append("\"; message=\"").append(message).append("\";\r\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
i++;
}
- sb.append("\r\n]"); //$NON-NLS-1$
+ sb.append("]"); //$NON-NLS-1$
fail(sb.toString());
}
14 years
JBoss Tools SVN: r27552 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-16 10:33:45 -0500 (Thu, 16 Dec 2010)
New Revision: 27552
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
Log:
[JBIDE-7926] corrected enablement expression
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-12-16 15:24:16 UTC (rev 27551)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-12-16 15:33:45 UTC (rev 27552)
@@ -150,8 +150,10 @@
variable="selection">
<and>
<count value="1" />
- <adapt
- type="org.jboss.tools.deltacloud.core.DeltaCloud" />
+ <iterate operator="and">
+ <adapt
+ type="org.jboss.tools.deltacloud.core.DeltaCloud" />
+ </iterate>
</and>
</with>
</enabledWhen>
14 years
JBoss Tools SVN: r27551 - in trunk: cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-12-16 10:24:16 -0500 (Thu, 16 Dec 2010)
New Revision: 27551
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSetup.java
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/validation/CoreValidationTest.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java
Log:
https://issues.jboss.org/browse/JBIDE-7919
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSetup.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSetup.java 2010-12-16 14:34:43 UTC (rev 27550)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/CDICoreTestSetup.java 2010-12-16 15:24:16 UTC (rev 27551)
@@ -14,9 +14,6 @@
import junit.framework.Test;
import org.eclipse.core.resources.IProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.internal.core.JavaModelManager;
-import org.eclipse.jdt.internal.core.search.indexing.IndexManager;
import org.jboss.tools.cdi.core.test.tck.TCKTest;
import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ResourcesUtils;
@@ -26,7 +23,7 @@
*/
public class CDICoreTestSetup extends TestSetup {
- protected IProject tckProject;
+ protected IProject tckProject;
public CDICoreTestSetup(Test test) {
super(test);
@@ -34,7 +31,7 @@
@Override
protected void setUp() throws Exception {
- tckProject = TCKTest .importPreparedProject("/");
+ tckProject = TCKTest.importPreparedProject("/");
}
@Override
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-16 14:34:43 UTC (rev 27550)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/TCKTest.java 2010-12-16 15:24:16 UTC (rev 27551)
@@ -31,11 +31,13 @@
import org.jboss.tools.cdi.core.IParametedType;
import org.jboss.tools.cdi.core.IQualifier;
import org.jboss.tools.cdi.core.IQualifierDeclaration;
+import org.jboss.tools.cdi.core.test.tck.validation.CoreValidationTest;
import org.jboss.tools.cdi.internal.core.impl.CDIProject;
import org.jboss.tools.common.EclipseUtil;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
import org.jboss.tools.common.text.ITextSourceReference;
import org.jboss.tools.common.util.FileUtil;
+import org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager;
import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ResourcesUtils;
import org.osgi.framework.Bundle;
@@ -69,6 +71,7 @@
try {
tckProject = findTestProject();
if(tckProject==null || !tckProject.exists()) {
+ ValidatorManager.setStatus(CoreValidationTest.VALIDATION_STATUS);
tckProject = importPreparedProject("/");
}
} catch (Exception e) {
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/CoreValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/CoreValidationTest.java 2010-12-16 14:34:43 UTC (rev 27550)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/CoreValidationTest.java 2010-12-16 15:24:16 UTC (rev 27551)
@@ -8,19 +8,21 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-
package org.jboss.tools.cdi.core.test.tck.validation;
import org.eclipse.jface.preference.IPersistentPreferenceStore;
import org.eclipse.jface.preference.IPreferenceStore;
import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.common.preferences.SeverityPreferences;
+import org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager;
/**
* @author Alexey Kazakov
*/
public class CoreValidationTest extends ValidationTest {
+ public static final String VALIDATION_STATUS = "Testing CDI";
+
/**
* https://jira.jboss.org/browse/JBIDE-6507
*
@@ -28,14 +30,25 @@
*/
public void testDisabledValidator() throws Exception {
IPreferenceStore preferenceStore = CDICorePlugin.getDefault().getPreferenceStore();
- preferenceStore.setValue(SeverityPreferences.ENABLE_BLOCK_PREFERENCE_NAME, false);
- ((IPersistentPreferenceStore)preferenceStore).save();
-
- assertNull("CDICoreValidator is still enabled.", getCDIValidator());
-
- preferenceStore.setValue(SeverityPreferences.ENABLE_BLOCK_PREFERENCE_NAME, true);
- ((IPersistentPreferenceStore)preferenceStore).save();
-
+ try {
+ preferenceStore.setValue(SeverityPreferences.ENABLE_BLOCK_PREFERENCE_NAME, false);
+ ((IPersistentPreferenceStore)preferenceStore).save();
+
+ assertNull("CDICoreValidator is still enabled.", getCDIValidator());
+ } finally {
+ preferenceStore.setValue(SeverityPreferences.ENABLE_BLOCK_PREFERENCE_NAME, true);
+ ((IPersistentPreferenceStore)preferenceStore).save();
+ }
assertNotNull("CDICoreValidator is disabled.", getCDIValidator());
}
+
+ /**
+ * https://issues.jboss.org/browse/JBIDE-7919
+ *
+ * @throws Exception
+ */
+ public void testValidatorInvoked() throws Exception {
+ String status = ValidatorManager.getStatus();
+ assertNotSame("Validation job has not been run (validation status: " + status + ")", VALIDATION_STATUS, status);
+ }
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java 2010-12-16 14:34:43 UTC (rev 27550)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidatorManager.java 2010-12-16 15:24:16 UTC (rev 27551)
@@ -35,7 +35,10 @@
*/
public class ValidatorManager implements IValidatorJob {
- private static Set<IProject> validatingProjects = new HashSet<IProject>();
+ private static Set<IProject> validatingProjects = new HashSet<IProject>();
+ private static final String SLEEPING = "Sleeping"; //$NON-NLS-1$
+ private static final String RUNNING = "Running"; //$NON-NLS-1$
+ private static String STATUS = SLEEPING;
public ValidatorManager() {
super();
@@ -53,41 +56,46 @@
* @see org.eclipse.wst.validation.internal.provisional.core.IValidatorJob#validateInJob(org.eclipse.wst.validation.internal.provisional.core.IValidationContext, org.eclipse.wst.validation.internal.provisional.core.IReporter)
*/
public IStatus validateInJob(IValidationContext helper, IReporter reporter) throws ValidationException {
- ContextValidationHelper validationHelper = (ContextValidationHelper)helper;
- IProject project = validationHelper.getProject();
- if(project==null) {
- return OK_STATUS;
- }
- IProject rootProject = validationHelper.getValidationContext().getRootProject();
- IStatus status = OK_STATUS;
- synchronized (validatingProjects) {
- if(validatingProjects.contains(rootProject)) {
+ STATUS = RUNNING;
+ try {
+ ContextValidationHelper validationHelper = (ContextValidationHelper)helper;
+ IProject project = validationHelper.getProject();
+ if(project==null) {
return OK_STATUS;
}
- validatingProjects.add(rootProject);
- }
- synchronized (validatingProjects) {
- org.jboss.tools.jst.web.kb.validation.IValidationContext validationContext = null;
- try {
- validationContext = new ValidationContext(project);
- validationHelper.setValidationContext(validationContext);
-
- List<IValidator> validators = validationHelper.getValidationContext().getValidators();
- Set<IFile> changedFiles = validationHelper.getChangedFiles();
- if(!changedFiles.isEmpty()) {
- status = validate(validators, changedFiles, rootProject, validationHelper, reporter);
- } else if(!validationContext.getRegisteredFiles().isEmpty()) {
- validationContext.clearAllResourceLinks();
- status = validateAll(validators, rootProject, validationHelper, reporter);
+ IProject rootProject = validationHelper.getValidationContext().getRootProject();
+ IStatus status = OK_STATUS;
+ synchronized (validatingProjects) {
+ if(validatingProjects.contains(rootProject)) {
+ return OK_STATUS;
}
- } finally {
- if(validationContext!=null) {
- validationContext.clearRegisteredFiles();
+ validatingProjects.add(rootProject);
+ }
+ synchronized (validatingProjects) {
+ org.jboss.tools.jst.web.kb.validation.IValidationContext validationContext = null;
+ try {
+ validationContext = new ValidationContext(project);
+ validationHelper.setValidationContext(validationContext);
+
+ List<IValidator> validators = validationHelper.getValidationContext().getValidators();
+ Set<IFile> changedFiles = validationHelper.getChangedFiles();
+ if(!changedFiles.isEmpty()) {
+ status = validate(validators, changedFiles, rootProject, validationHelper, reporter);
+ } else if(!validationContext.getRegisteredFiles().isEmpty()) {
+ validationContext.clearAllResourceLinks();
+ status = validateAll(validators, rootProject, validationHelper, reporter);
+ }
+ } finally {
+ if(validationContext!=null) {
+ validationContext.clearRegisteredFiles();
+ }
+ validatingProjects.remove(rootProject);
}
- validatingProjects.remove(rootProject);
}
+ return status;
+ } finally {
+ STATUS = SLEEPING;
}
- return status;
}
private IStatus validate(List<IValidator> validators, Set<IFile> changedFiles, IProject rootProject, ContextValidationHelper validationHelper, IReporter reporter) throws ValidationException {
@@ -133,4 +141,20 @@
public void validate(IValidationContext helper, IReporter reporter) throws ValidationException {
validateInJob(helper, reporter);
}
+
+ /**
+ * This method returns a string with status message of the validator. This method is supposed to be used in unit tests.
+ * @return
+ */
+ public static String getStatus() {
+ return STATUS;
+ }
+
+ /**
+ * This method is supposed to be used in unit tests.
+ * @param status
+ */
+ public static void setStatus(String status) {
+ STATUS = status;
+ }
}
\ No newline at end of file
Modified: trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java 2010-12-16 14:34:43 UTC (rev 27550)
+++ trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java 2010-12-16 15:24:16 UTC (rev 27551)
@@ -136,8 +136,22 @@
List<Integer> lines = findMarkerLines(
resource, type, errorMessage, pattern);
- assertFalse("Marker matches the '" + errorMessage + "' pattern wasn't found", //$NON-NLS-1$ //$NON-NLS-2$
- lines.isEmpty());
+ if(lines.isEmpty()) {
+ IMarker[] allMarkers = findMarkers(resource, null, "*", true);
+ StringBuffer sb = new StringBuffer("Marker matches the '"); //$NON-NLS-1$
+ sb.append(errorMessage).append("' pattern wasn't found. Here is a list of found markers in ").append(resource.getFullPath().toOSString()).append(" : [\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ int i=0;
+ for (IMarker marker : allMarkers) {
+ String message = marker.getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$
+ marker.getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$
+ int line = marker.getAttribute(IMarker.LINE_NUMBER, -1);
+ String mType = marker.getType();
+ sb.append(i).append(") line: \"").append(line).append("\"; type: \"").append(mType).append("\"; message: \"").append(message).append("\";\r\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ i++;
+ }
+ sb.append("\r\n]"); //$NON-NLS-1$
+ fail(sb.toString());
+ }
assertEquals("Wrong number of found marker matches the '" + errorMessage + "' pattern", //$NON-NLS-1$//$NON-NLS-2$
expectedLines.length, lines.size());
14 years
JBoss Tools SVN: r27550 - trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-12-16 09:34:43 -0500 (Thu, 16 Dec 2010)
New Revision: 27550
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/NewCDIWizardTest.java
Log:
JBIDE-7909
https://issues.jboss.org/browse/JBIDE-7909
Modified: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/NewCDIWizardTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/NewCDIWizardTest.java 2010-12-16 14:33:00 UTC (rev 27549)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/NewCDIWizardTest.java 2010-12-16 14:34:43 UTC (rev 27550)
@@ -37,6 +37,7 @@
import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.ICDIAnnotation;
import org.jboss.tools.cdi.core.ICDIProject;
+import org.jboss.tools.cdi.core.IInterceptorBinding;
import org.jboss.tools.cdi.core.IStereotype;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
@@ -67,6 +68,7 @@
static String STEREOTYPE2_NAME = "MyStereotype2";
static String SCOPE_NAME = "MyScope";
static String INTERCEPTOR_BINDING_NAME = "MyInterceptorBinding";
+ static String INTERCEPTOR_BINDING2_NAME = "MyInterceptorBinding2";
static String INTERCEPTOR_NAME = "MyInterceptor";
static String DECORATOR_NAME = "MapDecorator<K,V>";
@@ -206,6 +208,7 @@
WizardContext context = new WizardContext();
context.init("org.jboss.tools.cdi.ui.wizard.NewStereotypeCreationWizard",
PACK_NAME, STEREOTYPE2_NAME);
+ JobUtils.waitForIdle(2000);
ICDIProject cdi = CDICorePlugin.getCDIProject(context.tck, true);
IStereotype s = cdi.getStereotype(PACK_NAME + "." + STEREOTYPE_NAME);
IStereotype d = cdi.getStereotype(CDIConstants.DECORATOR_STEREOTYPE_TYPE_NAME);
@@ -267,6 +270,7 @@
try {
NewInterceptorBindingWizardPage page = (NewInterceptorBindingWizardPage)context.page;
+ page.setTarget("TYPE");
context.wizard.performFinish();
@@ -274,7 +278,7 @@
assertTrue(text.contains("@InterceptorBinding"));
assertTrue(text.contains("@Inherited"));
- assertTrue(text.contains("@Target({ TYPE, METHOD })"));
+ assertTrue(text.contains("@Target({ TYPE })"));
assertTrue(text.contains("@Retention(RUNTIME)"));
} finally {
@@ -282,6 +286,40 @@
}
}
+ public void testNewInterceptorBindingWizardWithBinding() {
+ WizardContext context = new WizardContext();
+ context.init("org.jboss.tools.cdi.ui.wizard.NewInterceptorBindingCreationWizard",
+ PACK_NAME, INTERCEPTOR_BINDING2_NAME);
+ JobUtils.waitForIdle(2000);
+
+ try {
+ NewInterceptorBindingWizardPage page = (NewInterceptorBindingWizardPage)context.page;
+ ICDIProject cdi = CDICorePlugin.getCDIProject(context.tck, true);
+ IInterceptorBinding s = cdi.getInterceptorBinding(PACK_NAME + "." + INTERCEPTOR_BINDING_NAME);
+ assertNotNull(s);
+
+ page.addInterceptorBinding(s);
+ String message = page.getErrorMessage();
+ assertNull(message);
+ message = page.getMessage();
+ assertNotNull(message);
+ int messageType = page.getMessageType();
+ assertEquals(IMessageProvider.WARNING, messageType);
+ String testmessage = NLS.bind(CDIUIMessages.MESSAGE_INTERCEPTOR_BINDING_IS_NOT_COMPATIBLE, s.getSourceType().getElementName());
+ assertEquals(testmessage, message);
+
+ page.setTarget("TYPE");
+
+ message = page.getErrorMessage();
+ assertNull(message);
+ message = page.getMessage();
+ assertNull(message);
+
+ } finally {
+ context.close();
+ }
+ }
+
public void testNewInterceptorWizard() {
WizardContext context = new WizardContext();
context.init("org.jboss.tools.cdi.ui.wizard.NewInterceptorCreationWizard",
14 years
JBoss Tools SVN: r27549 - in trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui: wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-12-16 09:33:00 -0500 (Thu, 16 Dec 2010)
New Revision: 27549
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewInterceptorBindingWizardPage.java
Log:
JBIDE-7909
https://issues.jboss.org/browse/JBIDE-7909
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2010-12-16 14:20:35 UTC (rev 27548)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2010-12-16 14:33:00 UTC (rev 27549)
@@ -74,6 +74,7 @@
public static String MESSAGE_STEREOTYPE_CANNOT_BE_APPLIED_TO_TYPE;
public static String MESSAGE_STEREOTYPE_IS_NOT_COMPATIBLE;
+ public static String MESSAGE_INTERCEPTOR_BINDING_IS_NOT_COMPATIBLE;
public static String MESSAGE_QUALIFIER_NOT_SET;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2010-12-16 14:20:35 UTC (rev 27548)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2010-12-16 14:33:00 UTC (rev 27549)
@@ -58,6 +58,7 @@
MESSAGE_STEREOTYPE_CANNOT_BE_APPLIED_TO_TYPE={0} cannot be applied to a type.
MESSAGE_STEREOTYPE_IS_NOT_COMPATIBLE={0} annotated with '''@Target({TYPE})''' is not compatible with target.
+MESSAGE_INTERCEPTOR_BINDING_IS_NOT_COMPATIBLE={0} annotated with '''@Target({TYPE})''' is not compatible with target.
MESSAGE_QUALIFIER_NOT_SET=Qualifier is not set
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewInterceptorBindingWizardPage.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewInterceptorBindingWizardPage.java 2010-12-16 14:20:35 UTC (rev 27548)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewInterceptorBindingWizardPage.java 2010-12-16 14:33:00 UTC (rev 27549)
@@ -10,17 +10,30 @@
******************************************************************************/
package org.jboss.tools.cdi.ui.wizard;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
+import org.eclipse.jdt.internal.ui.dialogs.StatusUtil;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Composite;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDICorePlugin;
+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.ICDIProject;
+import org.jboss.tools.cdi.core.IInterceptorBinding;
+import org.jboss.tools.cdi.core.IStereotype;
import org.jboss.tools.cdi.ui.CDIUIMessages;
+import org.jboss.tools.cdi.ui.CDIUIPlugin;
import org.jboss.tools.common.ui.widget.editor.ListFieldEditor;
/**
@@ -32,6 +45,7 @@
protected InterceptorBindingSelectionProvider interceptorBindingsProvider = new InterceptorBindingSelectionProvider();
protected ListFieldEditor interceptorBindings = null;
+ protected StatusInfo targetStatus = new StatusInfo();
public NewInterceptorBindingWizardPage() {
setTitle(CDIUIMessages.NEW_INTERCEPTOR_BINDING_WIZARD_PAGE_NAME);
@@ -76,6 +90,10 @@
targetOptions.add("TYPE,METHOD");
targetOptions.add("TYPE");
createTargetField(composite, targetOptions);
+ target.addPropertyChangeListener(new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ validateTargetAndInterceptorBinding();
+ }});
}
protected void createInterceptorBindingField(Composite composite) {
@@ -84,6 +102,10 @@
interceptorBindingsProvider.setEditorField(interceptorBindings);
interceptorBindings.doFillIntoGrid(composite);
setInterceptorBindings(getPackageFragmentRoot());
+ interceptorBindings.addPropertyChangeListener(new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ validateTargetAndInterceptorBinding();
+ }});
}
public void setPackageFragmentRoot(IPackageFragmentRoot root, boolean canBeModified) {
@@ -102,4 +124,68 @@
}
}
+ void validateTargetAndInterceptorBinding() {
+ try {
+ getTargetAndInterceptorBindingError();
+ } catch (JavaModelException e) {
+ CDIUIPlugin.getDefault().logError(e);
+ }
+ doStatusUpdate();
+ }
+
+ private void doStatusUpdate() {
+ // status of all used components
+ IStatus[] status= new IStatus[] {
+ fContainerStatus,
+ isEnclosingTypeSelected() ? fEnclosingTypeStatus : fPackageStatus,
+ fTypeNameStatus,
+ fModifierStatus,
+ fSuperClassStatus,
+ fSuperInterfacesStatus
+ };
+
+ // the mode severe status will be displayed and the OK button enabled/disabled.
+ updateStatus(status);
+ }
+
+ protected void updateStatus(IStatus[] status) {
+ IStatus[] ns = new IStatus[status.length + 1];
+ System.arraycopy(status, 0, ns, 0, status.length);
+ ns[status.length] = targetStatus;
+ status = ns;
+ updateStatus(StatusUtil.getMostSevere(status));
+ }
+
+ void getTargetAndInterceptorBindingError() throws JavaModelException {
+ targetStatus = new StatusInfo();
+ if(interceptorBindings != null && target != null) {
+ String value = (String)target.getValue();
+ boolean hasMethodOrField = value != null && (value.indexOf("METHOD") >= 0 || value.indexOf("FIELD") >= 0);
+ List list = (List)interceptorBindings.getValue();
+ for (Object o: list) {
+ if(o instanceof IInterceptorBinding) {
+ IInterceptorBinding a = (IInterceptorBinding)o;
+ IAnnotationDeclaration target = a.getAnnotationDeclaration(CDIConstants.TARGET_ANNOTATION_TYPE_NAME);
+ if(target != null) {
+ Set<String> targets = CDIUtil.getTargetAnnotationValues(target);
+ if(targets != null && targets.size() == 1 && targets.contains("TYPE") && hasMethodOrField) {
+ String message = NLS.bind(CDIUIMessages.MESSAGE_INTERCEPTOR_BINDING_IS_NOT_COMPATIBLE, a.getSourceType().getElementName());
+// String message = a.getSourceType().getElementName() + " annotated with @Target({TYPE}) is not compatible with target";
+ targetStatus.setWarning(message);
+ }
+ //targets always contain TYPE
+ }
+ }
+ }
+ }
+ }
+
+ public void addInterceptorBinding(IInterceptorBinding s) {
+ List vs = (List)interceptorBindings.getValue();
+ List nvs = new ArrayList();
+ if(vs != null) nvs.addAll(vs);
+ nvs.add(s);
+ interceptorBindings.setValue(nvs);
+ }
+
}
14 years