JBoss Tools SVN: r36752 - in trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime: handlers and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-11-29 17:45:34 -0500 (Tue, 29 Nov 2011)
New Revision: 36752
Modified:
trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/IJBossRuntimePluginConstants.java
trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/Messages.java
trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/messages.properties
trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/handlers/JBossASHandler.java
Log:
JBIDE-10279 runtime detection detects 7.1 but set it up as if its a 7.0
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/IJBossRuntimePluginConstants.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/IJBossRuntimePluginConstants.java 2011-11-29 22:13:35 UTC (rev 36751)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/IJBossRuntimePluginConstants.java 2011-11-29 22:45:34 UTC (rev 36752)
@@ -37,7 +37,8 @@
"org.jboss.ide.eclipse.as.runtime.60", //$NON-NLS-1$
"org.jboss.ide.eclipse.as.runtime.eap.43", //$NON-NLS-1$
"org.jboss.ide.eclipse.as.runtime.eap.50", //$NON-NLS-1$
- "org.jboss.ide.eclipse.as.runtime.70" //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.runtime.70", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.runtime.71" //$NON-NLS-1$
};
public static final String HSQLDB_DRIVER_JAR_NAME = "hsqldb.jar"; //$NON-NLS-1$
@@ -67,7 +68,8 @@
"org.jboss.ide.eclipse.as.60", //$NON-NLS-1$
"org.jboss.ide.eclipse.as.eap.43", //$NON-NLS-1$
"org.jboss.ide.eclipse.as.eap.50", //$NON-NLS-1$
- "org.jboss.ide.eclipse.as.70" //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.70", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.71" //$NON-NLS-1$
};
public static final String JBOSS_AS_NAME[] = {
@@ -79,7 +81,8 @@
Messages.JBossRuntimeStartup_JBoss_Application_Server_6_0,
Messages.JBossRuntimeStartup_JBoss_EAP_Server_4_3,
Messages.JBossRuntimeStartup_JBoss_EAP_Server_5_0,
- Messages.JBossRuntimeStartup_JBoss_Application_Server_7_0
+ Messages.JBossRuntimeStartup_JBoss_Application_Server_7_0,
+ Messages.JBossRuntimeStartup_JBoss_Application_Server_7_1
};
public static final String JBOSS_AS_HOST = "localhost"; //$NON-NLS-1$
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/Messages.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/Messages.java 2011-11-29 22:13:35 UTC (rev 36751)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/Messages.java 2011-11-29 22:45:34 UTC (rev 36752)
@@ -16,6 +16,7 @@
private static final String BUNDLE_NAME = "org.jboss.tools.runtime.as.detector.messages"; //$NON-NLS-1$
public static String JBossRuntimeStartup_JBoss_Application_Server_6_0;
public static String JBossRuntimeStartup_JBoss_Application_Server_7_0;
+ public static String JBossRuntimeStartup_JBoss_Application_Server_7_1;
public static String JBossRuntimeStartup_Cannot_create_new_JBoss_Server;
public static String JBossRuntimeStartup_Cannott_create_new_DTP_Connection_Profile;
public static String JBossRuntimeStartup_Cannott_create_new_HSQL_DB_Driver;
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/messages.properties
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/messages.properties 2011-11-29 22:13:35 UTC (rev 36751)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/messages.properties 2011-11-29 22:45:34 UTC (rev 36752)
@@ -8,6 +8,7 @@
JBossRuntimeStartup_JBoss_Application_Server_5_1=JBoss Application Server 5.1
JBossRuntimeStartup_JBoss_Application_Server_6_0=JBoss Application Server 6.0
JBossRuntimeStartup_JBoss_Application_Server_7_0=JBoss Application Server 7.0
+JBossRuntimeStartup_JBoss_Application_Server_7_1=JBoss Application Server 7.1
JBossRuntimeStartup_JBoss_EAP_Server_4_3=JBoss EAP Server 4.3
JBossRuntimeStartup_JBoss_EAP_Server_5_0=JBoss EAP Server 5.0
JBossRuntimeStartup_Runtime=Runtime
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/handlers/JBossASHandler.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/handlers/JBossASHandler.java 2011-11-29 22:13:35 UTC (rev 36751)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/handlers/JBossASHandler.java 2011-11-29 22:45:34 UTC (rev 36752)
@@ -61,7 +61,8 @@
public class JBossASHandler extends AbstractRuntimeDetector implements IJBossRuntimePluginConstants {
- private static final int JBOSS_AS7_INDEX = 8;
+ private static final int JBOSS_AS70_INDEX = 8;
+ private static final int JBOSS_AS71_INDEX = 9;
private static String[] hasIncludedRuntimes = new String[] {SOA_P, EAP, EPP, EWP, SOA_P_STD};
private static final String DROOLS = "DROOLS"; // NON-NLS-1$
private static final String ESB = "ESB"; //$NON-NLS-1$
@@ -119,8 +120,10 @@
index = 4;
} else if ("6.0".equals(version) || "6.1".equals(version)) { //$NON-NLS-1$
index = 5;
- } else if ("7.0".equals(version) || "7.1".equals(version)) { //$NON-NLS-1$
- index = 8;
+ } else if ("7.0".equals(version)) { //$NON-NLS-1$
+ index = JBOSS_AS70_INDEX;
+ } else if ("7.1".equals(version)) { //$NON-NLS-1$
+ index = JBOSS_AS71_INDEX;
}
createJBossServer(serverDefinition.getLocation(),index,serverDefinition.getName(),serverDefinition.getName() + " " + RUNTIME); //$NON-NLS-1$
}
@@ -249,7 +252,7 @@
// Don't create the driver a few times
return;
}
- if (index == 8) {
+ if (index == JBOSS_AS70_INDEX || index == JBOSS_AS71_INDEX) {
// AS 7
return;
}
13 years, 1 month
JBoss Tools SVN: r36751 - trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-11-29 17:13:35 -0500 (Tue, 29 Nov 2011)
New Revision: 36751
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckClass.java
Log:
JBIDE-10190
https://issues.jboss.org/browse/JBIDE-10190
Partially migrated validation for struts-config.xml.
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckClass.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckClass.java 2011-11-29 22:13:05 UTC (rev 36750)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/validation/CheckClass.java 2011-11-29 22:13:35 UTC (rev 36751)
@@ -162,7 +162,7 @@
fireMessage(object, NLS.bind(WebXMLValidatorMessages.CLASS_NOT_EXISTS, attr, value));
}
- public IType getValidType(String className, XModelObject o) {
+ public static IType getValidType(String className, XModelObject o) {
IProject project = EclipseResourceUtil.getProject(o);
if(project == null) return null;
IType type = EclipseResourceUtil.getValidType(project, className);
13 years, 1 month
JBoss Tools SVN: r36750 - in trunk/struts/plugins/org.jboss.tools.struts: META-INF and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-11-29 17:13:05 -0500 (Tue, 29 Nov 2011)
New Revision: 36750
Added:
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ActionForwardCheck.java
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ActionNameCheck.java
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ActionRefsCheck.java
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ActionTypeCheck.java
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/CheckInitParam.java
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/GlobalExceptionCheck.java
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/GlobalForwardCheck.java
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ResourceCheck.java
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsConfigCheck.java
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsConfigControllerCheck.java
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsCoreValidator.java
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsPreferenceInitializer.java
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsPreferences.java
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsValidatorMessages.java
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ValidateTypeUtil.java
trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/messages.properties
Modified:
trunk/struts/plugins/org.jboss.tools.struts/META-INF/MANIFEST.MF
trunk/struts/plugins/org.jboss.tools.struts/plugin.properties
trunk/struts/plugins/org.jboss.tools.struts/plugin.xml
Log:
JBIDE-10190
https://issues.jboss.org/browse/JBIDE-10190
Partially migrated validation for struts-config.xml.
Modified: trunk/struts/plugins/org.jboss.tools.struts/META-INF/MANIFEST.MF
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/META-INF/MANIFEST.MF 2011-11-29 21:52:18 UTC (rev 36749)
+++ trunk/struts/plugins/org.jboss.tools.struts/META-INF/MANIFEST.MF 2011-11-29 22:13:05 UTC (rev 36750)
@@ -29,6 +29,7 @@
org.jboss.tools.struts.validators.model,
org.jboss.tools.struts.validators.model.handlers,
org.jboss.tools.struts.validators.model.helpers,
+ org.jboss.tools.struts.validation,
org.jboss.tools.struts.webprj.model,
org.jboss.tools.struts.webprj.model.handlers,
org.jboss.tools.struts.webprj.model.helpers,
@@ -44,10 +45,12 @@
org.jboss.tools.common.model,
org.jboss.tools.jst.web,
org.jboss.tools.jst.web.tiles,
+ org.jboss.tools.common.validation,
org.eclipse.ui;bundle-version="3.7.0",
org.eclipse.debug.core;bundle-version="3.7.0",
org.eclipse.wst.sse.core;bundle-version="1.1.600",
org.eclipse.wst.xml.core;bundle-version="1.1.600",
+ org.eclipse.wst.validation,
org.jboss.tools.common.projecttemplates,
org.eclipse.ltk.core.refactoring;bundle-version="3.5.200",
org.eclipse.ltk.ui.refactoring;bundle-version="3.5.100",
Modified: trunk/struts/plugins/org.jboss.tools.struts/plugin.properties
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/plugin.properties 2011-11-29 21:52:18 UTC (rev 36749)
+++ trunk/struts/plugins/org.jboss.tools.struts/plugin.properties 2011-11-29 22:13:05 UTC (rev 36750)
@@ -1,2 +1,4 @@
providerName=JBoss by Red Hat
-Bundle-Name.0 = JBoss Tools Struts
\ No newline at end of file
+Bundle-Name.0 = JBoss Tools Struts
+
+StrutsCoreValidator=Struts Core Validator
\ No newline at end of file
Modified: trunk/struts/plugins/org.jboss.tools.struts/plugin.xml
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/plugin.xml 2011-11-29 21:52:18 UTC (rev 36749)
+++ trunk/struts/plugins/org.jboss.tools.struts/plugin.xml 2011-11-29 22:13:05 UTC (rev 36750)
@@ -411,4 +411,16 @@
</contribution>
</extension>
+ <extension point="org.eclipse.core.runtime.preferences">
+ <initializer class="org.jboss.tools.struts.validation.StrutsPreferenceInitializer"/>
+ </extension>
+ <extension
+ point="org.jboss.tools.common.validation.validator">
+ <validator
+ class="org.jboss.tools.struts.validation.StrutsCoreValidator"
+ name="%StrutsCoreValidator"
+ id="org.jboss.tools.struts.validation.StrutsCoreValidator">
+ </validator>
+ </extension>
+
</plugin>
Added: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ActionForwardCheck.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ActionForwardCheck.java (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ActionForwardCheck.java 2011-11-29 22:13:05 UTC (rev 36750)
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.struts.validation;
+
+import java.util.*;
+
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.common.validation.ValidationErrorManager;
+import org.jboss.tools.common.meta.action.impl.handlers.DefaultCreateHandler;
+import org.jboss.tools.common.model.*;
+import org.jboss.tools.jst.web.validation.Check;
+import org.jboss.tools.struts.*;
+import org.jboss.tools.struts.model.helpers.*;
+import org.jboss.tools.struts.webprj.model.helpers.WebModulesHelper;
+import org.jboss.tools.struts.webprj.pattern.UrlPattern;
+import org.jboss.tools.struts.model.handlers.*;
+
+public class ActionForwardCheck extends Check {
+ XModelObject object;
+ protected XModel model;
+ protected XModelObject forward;
+ protected XModelObject config;
+ protected String path;
+ protected String module;
+ protected Set modules;
+ protected String pathModule = null;
+ protected static StrutsProcessStructureHelper h = new StrutsProcessStructureHelper();
+
+ protected String pathEmpty = StrutsValidatorMessages.ACTION_FORWARD_PATH_EMPTY;
+ protected String pathExists = StrutsValidatorMessages.ACTION_FORWARD_PATH_EXISTS;
+ protected String classNameExists = StrutsValidatorMessages.ACTION_FORWARD_CLASSNAME_EXISTS;
+ protected String contextRelativeCross = StrutsValidatorMessages.ACTION_FORWARD_CONTEXT_RELATIVE_CROSS;
+ protected String contextRelativeMono = StrutsValidatorMessages.ACTION_FORWARD_CONTEXT_RELATIVE_MONO;
+
+ public ActionForwardCheck(ValidationErrorManager manager, String preference) {
+ super(manager, preference, "");
+ }
+
+ protected boolean isRelevant(XModelObject object) {
+ return object.getParent() != null && object.getParent().getModelEntity().getName().startsWith("StrutsAction");
+ }
+
+ public void check(XModelObject object) {
+ this.object = object;
+ if(!isRelevant(object)) {
+ return;
+ }
+ forward = object;
+ model = forward.getModel();
+ path = JumpByForwardPathHandler.getResourcePath("" + forward.getAttributeValue("path"));
+ if(!checkPath()) return;
+ checkClasses();
+ }
+
+ protected void checkClasses() {
+ checkClass("className", classNameExists);
+ }
+
+ // compare find with JumpByForwardPathHandler
+
+ protected boolean isAllowedEmptyPath() {
+ return false;
+ }
+
+ protected boolean checkPath() {
+ if(path.length() == 0) {
+ if(isAllowedEmptyPath()) {
+ return true;
+ } else {
+ fire(pathEmpty, "path", null);
+ return false;
+ }
+ }
+ config = StrutsProcessStructureHelper.instance.getParentFile(forward);
+ WebModulesHelper wh = WebModulesHelper.getInstance(model);
+ if(TilesHelper.findTile(config, path) != null) return true;
+ module = StrutsProcessStructureHelper.instance.getProcessModule(forward);
+ modules = wh.getModules();
+ pathModule = wh.getModuleForPath(path, module);
+ if(pathModule == null) pathModule = "";
+ if(StrutsProcessHelper.isHttp(path)) return true;
+ UrlPattern up = wh.getUrlPattern(module);
+ boolean isFolder = path.endsWith("/") && path.startsWith("/");
+ boolean isAction = !isFolder && up.isActionUrl(path);
+ boolean isPage = path.endsWith(".jsp") || path.indexOf(".htm") > 0 || path.endsWith(".css");
+ String s = forward.getAttributeValue("contextRelative");
+ boolean cR = ("true".equals(s) || "yes".equals(s));
+ if(isFolder || isAction || isPage) {
+ if(forward.getModelEntity().getAttribute("contextRelative") != null) {
+ if(!cR && pathModule.length() > 0 && path.startsWith(pathModule + "/")) {
+ fire(contextRelativeCross, "contextRelative", null);
+ return false;
+ }
+ if(cR && pathModule.length() > 0 && !path.startsWith(pathModule + "/")) {
+ fire(contextRelativeMono, "contextRelative", null);
+ return false;
+ }
+ } else {
+ if(!pathModule.equals(module) || (pathModule.length() > 0 && path.startsWith(pathModule + "/"))) {
+ fire(contextRelativeMono, "path", null);
+ return false;
+ }
+ }
+ }
+ XModelObject target = null;
+ String kind = "tile";
+ if(isFolder) {
+ kind = "resource folder";
+ target = model.getByPath(path.substring(0, path.length() - 1));
+ } else if(isAction) {
+ kind = "action";
+ path = up.getActionPath(path);
+ if(!cR) {
+ target = config.getChildByPath(StrutsConstants.ELM_ACTIONMAP + "/" + path.replace('/', '#'));
+ if(target == null) {
+ XModelObject[] cgs = wh.getConfigsForModule(model, pathModule);
+ for (int i = 0; i < cgs.length && target == null; i++) {
+ if(cgs[i] == config) continue;
+ target = cgs[i].getChildByPath(StrutsConstants.ELM_ACTIONMAP + "/" + path.replace('/', '#'));
+ }
+ }
+ } else {
+ XModelObject[] cgs = wh.getConfigsForModule(model, pathModule);
+ if(cgs.length > 0) {
+ if(pathModule.length() > 0 && path.startsWith(pathModule)) path = path.substring(pathModule.length());
+ }
+ for (int i = 0; i < cgs.length && target == null; i++) {
+ target = cgs[i].getChildByPath(StrutsConstants.ELM_ACTIONMAP + "/" + path.replace('/', '#'));
+ }
+ }
+ } else /*if(isPage) */{
+ kind = (isPage) ? "page" : "tile or page";
+ if(path.endsWith(".css")) kind = "resource";
+ XModelObject fs = wh.getRootFileSystemForModule(model, pathModule);
+ if(fs != null) {
+ if(pathModule.length() > 0 && path.startsWith(pathModule)) path = path.substring(pathModule.length());
+ if(path.startsWith("/")) path = path.substring(1);
+ target = fs.getChildByPath(path);
+ }
+ }
+ if(target != null) {
+ return true;
+ }
+ fire(pathExists, "path", kind);
+ return false;
+ }
+
+ protected boolean checkClass(String attr, String id) {
+ ValidateTypeUtil tv = new ValidateTypeUtil();
+ int tvr = tv.checkClass(object, attr, "org.apache.struts.action.ActionForward");
+ if(tvr == ValidateTypeUtil.NOT_FOUND) {
+ fire(id, attr, null);
+ return false;
+ } else if(tvr == ValidateTypeUtil.NOT_UPTODATE) {
+ //not implemented
+ }
+ return true;
+ }
+
+ protected void fire(String id, String attr, String info) {
+ this.attr = attr;
+ String oTitle = DefaultCreateHandler.title(object, true);
+ String pTitle = DefaultCreateHandler.title(object.getParent(), true);
+ Object[] os = (info == null) ? new Object[] {oTitle, pTitle}
+ : new Object[] {oTitle, pTitle, info};
+ String message = NLS.bind(id, os);
+ fireMessage(object, message);
+ }
+
+}
+
Property changes on: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ActionForwardCheck.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ActionNameCheck.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ActionNameCheck.java (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ActionNameCheck.java 2011-11-29 22:13:05 UTC (rev 36750)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.struts.validation;
+
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.common.meta.action.impl.handlers.DefaultCreateHandler;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.validation.ValidationErrorManager;
+import org.jboss.tools.jst.web.validation.Check;
+
+/**
+ *
+ * @author valera
+ */
+public class ActionNameCheck extends Check {
+
+ /** Creates a new instance of ActionNameCheck */
+ public ActionNameCheck(ValidationErrorManager manager, String preference) {
+ super(manager, preference, "name");
+ }
+
+ public void check(XModelObject object) {
+ String name = (String)object.getAttributeValue("name");
+ if (name.length() == 0) {
+ String valid = (String)object.getAttributeValue("validate");
+ if ("yes".equals(valid) || "true".equals(valid)) {
+ String message = NLS.bind(StrutsValidatorMessages.ACTION_NAME_EMPTY, new Object[] {DefaultCreateHandler.title(object, true)});
+ fireMessage(object, message);
+ }
+ } else {
+ XModelObject bean = object.getParent().getParent()
+ .getChildByPath("form-beans").getChildByPath(name);
+ if (bean == null) {
+ String message = NLS.bind(StrutsValidatorMessages.ACTION_NAME_EXISTS, new Object[] {DefaultCreateHandler.title(object, true), name});
+ fireMessage(object, message);
+ }
+ }
+ }
+
+}
Property changes on: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ActionNameCheck.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ActionRefsCheck.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ActionRefsCheck.java (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ActionRefsCheck.java 2011-11-29 22:13:05 UTC (rev 36750)
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.struts.validation;
+
+import java.util.*;
+
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.common.validation.ValidationErrorManager;
+import org.jboss.tools.common.meta.action.impl.handlers.DefaultCreateHandler;
+import org.jboss.tools.common.model.*;
+import org.jboss.tools.jst.web.validation.Check;
+import org.jboss.tools.struts.webprj.model.helpers.WebModulesHelper;
+import org.jboss.tools.struts.webprj.pattern.UrlPattern;
+import org.jboss.tools.struts.model.helpers.*;
+import org.jboss.tools.struts.*;
+
+/**
+ *
+ * @author valera
+ */
+public class ActionRefsCheck extends Check {
+ protected XModelObject object;
+ protected XModel model;
+ protected XModelObject action;
+ protected XModelObject config;
+ protected String path;
+ protected String module;
+ protected Set modules;
+ protected String pathModule = null;
+ protected static StrutsProcessStructureHelper h = new StrutsProcessStructureHelper();
+
+ /** Creates a new instance of ActionRefsCheck */
+ public ActionRefsCheck(ValidationErrorManager manager, String preference) {
+ super(manager, preference, "");
+ }
+
+ public void check(XModelObject object) {
+ this.object = object;
+ action = object;
+ model = action.getModel();
+
+ if(!isInputReferencingForwardOrEmpty()) {
+ checkPath(StrutsValidatorMessages.ACTION_INPUT, "input");
+ }
+ checkPath(StrutsValidatorMessages.ACTION_FORWARD, "forward");
+ checkPath(StrutsValidatorMessages.ACTION_INCLUDE, "include");
+ }
+
+ boolean isInputReferencingForwardOrEmpty() {
+ String v = action.getAttributeValue("input");
+ if(v == null || v.length() == 0) return true;
+ if(v.indexOf('/') < 0 && v.indexOf('.') < 0) {
+ XModelObject f = action.getChildByPath(v);
+ if(f != null) return true;
+ XModelObject cfg = action.getParent().getParent();
+ f = cfg.getChildByPath("global-forwards/" + v);
+ if(f != null) return true;
+ WebModulesHelper h = WebModulesHelper.getInstance(action.getModel());
+ XModelObject[] cfgs = h.getConfigsForModule(cfg.getModel(), h.getModuleForConfig(cfg));
+ if(cfgs == null || cfgs.length < 2) return false;
+ for (int i = 0; i < cfgs.length; i++) {
+ f = cfgs[i].getChildByPath("global-forwards/" + v);
+ if(f != null) return true;
+ }
+ }
+ return false;
+ }
+
+ protected void checkPath(String id, String attr) {
+ this.attr = attr;
+ path = action.getAttributeValue(attr);
+ if(path == null || path.length() == 0) return;
+ config = StrutsProcessStructureHelper.instance.getParentFile(action);
+ WebModulesHelper wh = WebModulesHelper.getInstance(model);
+ if(TilesHelper.findTile(config, path) != null) return;
+ module = StrutsProcessStructureHelper.instance.getProcessModule(action);
+ modules = wh.getModules();
+ pathModule = wh.getModuleForPath(path, module);
+ if(StrutsProcessHelper.isHttp(path)) return;
+ UrlPattern up = wh.getUrlPattern(module);
+ boolean isFolder = path.endsWith("/") && path.startsWith("/");
+ boolean isAction = !isFolder && up.isActionUrl(path);
+ boolean isPage = path.endsWith(".jsp") || path.indexOf(".htm") > 0 || path.endsWith(".css");
+ XModelObject target = null;
+ String kind = "tile";
+ if(isFolder) {
+ kind = "resource folder";
+ path = path.substring(0, path.length() - 1);
+ target = model.getByPath(path);
+ } else if(isAction) {
+ kind = "action";
+ path = up.getActionPath(path);
+ XModelObject[] cgs = wh.getConfigsForModule(model, pathModule);
+ if(cgs.length > 0) {
+ if(pathModule.length() > 0 && path.startsWith(pathModule)) path = path.substring(pathModule.length());
+ }
+ for (int i = 0; i < cgs.length && target == null; i++) {
+ target = cgs[i].getChildByPath(StrutsConstants.ELM_ACTIONMAP + "/" + path.replace('/', '#'));
+ }
+ } else /*if(isPage) */{
+ kind = (isPage) ? "page" : "tile or page";
+ if(path.endsWith(".css")) kind = "resource";
+ XModelObject fs = wh.getRootFileSystemForModule(model, pathModule);
+ if(fs != null) {
+ if(pathModule.length() > 0 && path.startsWith(pathModule)) path = path.substring(pathModule.length());
+ if(path.startsWith("/")) path = path.substring(1);
+ target = fs.getChildByPath(path);
+ }
+ }
+ if(target == null) {
+ fire(id, attr, kind + " " + path);
+ }
+ }
+
+ protected void fire(String id, String attr, String value) {
+ Object[] os = new Object[] {DefaultCreateHandler.title(object, true), value};
+ String message = NLS.bind(id, os);
+ fireMessage(object, message);
+ }
+
+}
Property changes on: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ActionRefsCheck.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ActionTypeCheck.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ActionTypeCheck.java (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ActionTypeCheck.java 2011-11-29 22:13:05 UTC (rev 36750)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.struts.validation;
+
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.common.meta.action.impl.handlers.DefaultCreateHandler;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.validation.ValidationErrorManager;
+import org.jboss.tools.jst.web.validation.Check;
+
+/**
+ *
+ * @author valera
+ */
+public class ActionTypeCheck extends Check {
+
+ /** Creates a new instance of ActionTypeCheck */
+ public ActionTypeCheck(ValidationErrorManager manager, String preference) {
+ super(manager, preference, "type");
+ }
+
+ public void check(XModelObject object) {
+ String forward = (String)object.getAttributeValue("forward");
+ String include = (String)object.getAttributeValue("include");
+ if (forward.length() > 0 || include.length() > 0) return;
+ String type = (String)object.getAttributeValue("type");
+ String sup = "org.apache.struts.action.Action";
+ ValidateTypeUtil tv = new ValidateTypeUtil();
+ int tvr = tv.checkClass(object, "type", sup);
+ String oTitle = DefaultCreateHandler.title(object, true);
+ if(tvr == ValidateTypeUtil.EMPTY) {
+ String message = NLS.bind(StrutsValidatorMessages.ACTION_TYPE_EMPTY, oTitle);
+ fireMessage(object, message);
+ } else if(tvr == ValidateTypeUtil.NOT_FOUND) {
+ String message = NLS.bind(StrutsValidatorMessages.ACTION_TYPE_EXISTS, new Object[] {oTitle, type});
+ fireMessage(object, message);
+ } else if(tvr == ValidateTypeUtil.WRONG_SUPER) {
+ String message = NLS.bind(StrutsValidatorMessages.ACTION_TYPE_EXTENDS, new Object[] {oTitle, type, sup});
+ fireMessage(object, message);
+ } else if(tvr == ValidateTypeUtil.NOT_UPTODATE) {
+ String message = NLS.bind(StrutsValidatorMessages.ACTION_TYPE_UPTODATE, new Object[] {oTitle, type});
+ fireMessage(object, message);
+ }
+ }
+
+}
Property changes on: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ActionTypeCheck.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/CheckInitParam.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/CheckInitParam.java (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/CheckInitParam.java 2011-11-29 22:13:05 UTC (rev 36750)
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.struts.validation;
+
+import java.util.StringTokenizer;
+
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.impl.XModelImpl;
+import org.jboss.tools.common.validation.ValidationErrorManager;
+import org.jboss.tools.jst.web.validation.Check;
+
+public class CheckInitParam extends Check {
+
+ public CheckInitParam(ValidationErrorManager manager, String preference) {
+ super(manager, preference, "param-value");
+ }
+
+ public void check(XModelObject object) {
+ XModelObject o = object;
+ String paramName = object.getAttributeValue("param-name");
+ if(paramName == null) return;
+ XModelObject parent = object.getParent();
+ if(parent == null || !"WebAppServlet".equals(parent.getModelEntity().getName())) {
+ return;
+ }
+ if(!paramName.equals("config") && !paramName.startsWith("config/")) return;
+
+ String value = o.getAttributeValue("param-value");
+ if(value == null || value.length() == 0) return;
+ XModel model = object.getModel();
+ XModelObject webRoot = model == null ? null : model.getByPath("FileSystems/WEB-ROOT");
+ if(webRoot == null) return;
+ StringTokenizer st = new StringTokenizer(value, ",");
+ while(st.hasMoreTokens()) {
+ String path = st.nextToken().trim();
+ if(path.length() == 0) continue;
+ XModelObject fc = XModelImpl.getByRelativePath(model, path);
+ if(fc == null) {
+ String message = NLS.bind(StrutsValidatorMessages.RESOURCE_EXISTS, path);
+ fireMessage(object, message);
+ }
+ String path2 = path.startsWith("/") ? path.substring(1) : path;
+ XModelObject fc2 = webRoot.getChildByPath(path2);
+ if(fc2 == null) {
+ String message = NLS.bind(StrutsValidatorMessages.RESOURCE_EXISTS, path);
+ fireMessage(object, message);
+ } else if(!fc2.getModelEntity().getName().startsWith("StrutsConfig")) {
+ String message = NLS.bind(StrutsValidatorMessages.CONFIG_VALID, "param-value", path);
+ fireMessage(object, message);
+ }
+ }
+ }
+
+}
Property changes on: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/CheckInitParam.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/GlobalExceptionCheck.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/GlobalExceptionCheck.java (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/GlobalExceptionCheck.java 2011-11-29 22:13:05 UTC (rev 36750)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.struts.validation;
+
+import org.jboss.tools.common.validation.ValidationErrorManager;
+
+public class GlobalExceptionCheck extends GlobalForwardCheck {
+
+ public GlobalExceptionCheck(ValidationErrorManager manager, String preference) {
+ super(manager, preference);
+ }
+
+ protected void checkClasses() {
+ boolean b = checkClass("className", StrutsValidatorMessages.GLOBAL_EXCEPTION_CLASSNAME_EXISTS);
+ if(b) {
+ checkClass("handler", StrutsValidatorMessages.GLOBAL_EXCEPTION_HANDLER_EXISTS);
+ }
+ }
+
+ protected boolean isAllowedEmptyPath() {
+ return true;
+ }
+
+}
Property changes on: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/GlobalExceptionCheck.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/GlobalForwardCheck.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/GlobalForwardCheck.java (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/GlobalForwardCheck.java 2011-11-29 22:13:05 UTC (rev 36750)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.struts.validation;
+
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.common.meta.action.impl.handlers.DefaultCreateHandler;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.validation.ValidationErrorManager;
+
+public class GlobalForwardCheck extends ActionForwardCheck {
+
+ public GlobalForwardCheck(ValidationErrorManager manager, String preference) {
+ super(manager, preference);
+ pathEmpty = StrutsValidatorMessages.GLOBAL_FORWARD_PATH_EMPTY;
+ pathExists = StrutsValidatorMessages.GLOBAL_FORWARD_PATH_EXISTS;
+ classNameExists = StrutsValidatorMessages.GLOBAL_FORWARD_CLASSNAME_EXISTS;
+ contextRelativeCross = StrutsValidatorMessages.GLOBAL_FORWARD_CONTEXT_RELATIVE_CROSS;
+ contextRelativeMono = StrutsValidatorMessages.GLOBAL_FORWARD_CONTEXT_RELATIVE_MONO;
+ }
+
+ protected boolean isRelevant(XModelObject object) {
+ return object.getParent() != null && !object.getParent().getModelEntity().getName().startsWith("StrutsAction");
+ }
+
+ protected void fire(String id, String attr, String info) {
+ this.attr = attr;
+ String oTitle = DefaultCreateHandler.title(object, true);
+ Object[] os = (info == null) ? new Object[] {oTitle}
+ : new Object[] {oTitle, info};
+ String message = NLS.bind(id, os);
+ fireMessage(object, message);
+ }
+}
Property changes on: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/GlobalForwardCheck.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ResourceCheck.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ResourceCheck.java (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ResourceCheck.java 2011-11-29 22:13:05 UTC (rev 36750)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.struts.validation;
+
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.validation.ValidationErrorManager;
+import org.jboss.tools.struts.model.handlers.OpenMessageResourcesHandler;
+
+public class ResourceCheck extends StrutsConfigControllerCheck {
+
+ public ResourceCheck(ValidationErrorManager manager, String preference) {
+ super(manager, preference);
+ attr = "parameter";
+ }
+
+ public void check(XModelObject object) {
+ this.object = object;
+ if(!OpenMessageResourcesHandler.isReferencingResourceObject(object)) return;
+ if(OpenMessageResourcesHandler.getResourceObject(object) != null) return;
+ String message = NLS.bind(StrutsValidatorMessages.RESOURCE_EXISTS, object.getAttributeValue("parameter"));
+ fireMessage(object, message);
+ }
+}
Property changes on: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ResourceCheck.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsConfigCheck.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsConfigCheck.java (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsConfigCheck.java 2011-11-29 22:13:05 UTC (rev 36750)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.struts.validation;
+
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.common.meta.action.impl.handlers.DefaultCreateHandler;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.validation.ValidationErrorManager;
+import org.jboss.tools.jst.web.model.AbstractWebFileImpl;
+import org.jboss.tools.jst.web.validation.Check;
+
+public class StrutsConfigCheck extends Check {
+
+ public StrutsConfigCheck(ValidationErrorManager manager, String preference) {
+ super(manager, preference, null);
+ }
+
+ public void check(XModelObject object) {
+ if(!(object instanceof AbstractWebFileImpl)) return;
+ AbstractWebFileImpl f = (AbstractWebFileImpl)object;
+ if(!f.isIncorrect()) return;
+ String oTitle = DefaultCreateHandler.title(object, true);
+ String errors = "\n" + f.get("errors");
+ String message = NLS.bind(StrutsValidatorMessages.CONFIG_VALID, oTitle, errors);
+ fireMessage(object, message);
+ }
+
+}
Property changes on: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsConfigCheck.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsConfigControllerCheck.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsConfigControllerCheck.java (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsConfigControllerCheck.java 2011-11-29 22:13:05 UTC (rev 36750)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.struts.validation;
+
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.common.meta.action.impl.handlers.DefaultCreateHandler;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.validation.ValidationErrorManager;
+import org.jboss.tools.jst.web.validation.Check;
+
+public class StrutsConfigControllerCheck extends Check {
+ XModelObject object;
+
+ public StrutsConfigControllerCheck(ValidationErrorManager manager, String preference) {
+ super(manager, preference, "");
+ }
+
+ public void check(XModelObject object) {
+ this.object = object;
+ ValidateTypeUtil tv = new ValidateTypeUtil();
+ int tvr = tv.checkClass(object, "className", null);
+ if(ValidateTypeUtil.NOT_FOUND == tvr) {
+ fire(StrutsValidatorMessages.CONTROLLER_CLASSNAME_EXISTS, "className");
+ return;
+ }
+ tvr = tv.checkClass(object, "multipartClass", null);
+ if(ValidateTypeUtil.NOT_FOUND == tvr) {
+ fire(StrutsValidatorMessages.CONTROLLER_MULTIPART_CLASS_EXISTS, "multipartClass");
+ return;
+ }
+ tvr = tv.checkClass(object, "processorClass", null);
+ if(ValidateTypeUtil.NOT_FOUND == tvr) {
+ fire(StrutsValidatorMessages.CONTROLLER_PROCESSOR_CLASS_EXISTS, "processorClass");
+ return;
+ }
+ }
+
+ protected void fire(String id, String attr) {
+ this.attr = attr;
+ String oTitle = DefaultCreateHandler.title(object, true);
+ String pTitle = DefaultCreateHandler.title(object.getParent(), true);
+ Object[] os = new Object[] {oTitle, pTitle};
+ String message = NLS.bind(id, os);
+ fireMessage(object, message);
+ }
+
+}
Property changes on: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsConfigControllerCheck.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsCoreValidator.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsCoreValidator.java (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsCoreValidator.java 2011-11-29 22:13:05 UTC (rev 36750)
@@ -0,0 +1,278 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.struts.validation;
+
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.validation.ContextValidationHelper;
+import org.jboss.tools.common.validation.IProjectValidationContext;
+import org.jboss.tools.common.validation.IValidatingProjectSet;
+import org.jboss.tools.common.validation.IValidatingProjectTree;
+import org.jboss.tools.common.validation.IValidator;
+import org.jboss.tools.common.validation.ValidationErrorManager;
+import org.jboss.tools.common.validation.ValidatorManager;
+import org.jboss.tools.common.validation.internal.ProjectValidationContext;
+import org.jboss.tools.common.validation.internal.SimpleValidatingProjectTree;
+import org.jboss.tools.common.validation.internal.ValidatingProjectSet;
+import org.jboss.tools.common.web.WebUtils;
+import org.jboss.tools.jst.web.WebModelPlugin;
+import org.jboss.tools.jst.web.model.helpers.WebAppHelper;
+import org.jboss.tools.jst.web.validation.Check;
+import org.jboss.tools.jst.web.validation.CheckClass;
+import org.jboss.tools.jst.web.validation.CheckResource;
+import org.jboss.tools.jst.web.webapp.model.WebAppConstants;
+import org.jboss.tools.struts.StrutsConstants;
+import org.jboss.tools.struts.StrutsModelPlugin;
+import org.jboss.tools.struts.StrutsProject;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class StrutsCoreValidator extends ValidationErrorManager implements IValidator, StrutsConstants {
+ public static final String ID = "org.jboss.tools.struts.validation.StrutsCoreValidator"; //$NON-NLS-1$
+ public static final String PROBLEM_TYPE = "org.jboss.tools.jst.web.webxmlproblem"; //$NON-NLS-1$
+ public static final String PREFERENCE_PAGE_ID = "org.jboss.tools.struts.ui.StrutsValidatorPreferencePage"; //$NON-NLS-1$
+
+ public static String SHORT_ID = "verification"; //$NON-NLS-1$
+
+ static String XML_EXT = ".xml"; //$NON-NLS-1$
+
+ String projectName;
+ Map<IProject, IProjectValidationContext> contexts = new HashMap<IProject, IProjectValidationContext>();
+
+ Map<String, Set<Check>> checks = new HashMap<String, Set<Check>>();
+
+ public StrutsCoreValidator() {
+ createChecks();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#getPreference(org.eclipse.core.resources.IProject, java.lang.String)
+ */
+ @Override
+ protected String getPreference(IProject project, String preferenceKey) {
+ return StrutsPreferences.getInstance().getProjectPreference(project, preferenceKey);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#getMaxNumberOfMarkersPerFile(org.eclipse.core.resources.IProject)
+ */
+ @Override
+ public int getMaxNumberOfMarkersPerFile(IProject project) {
+ return StrutsPreferences.getMaxNumberOfProblemMarkersPerFile(project);
+ }
+
+ private void addCheck(Check check, String... entities) {
+ for (String entity: entities) {
+ Set<Check> cs = checks.get(entity);
+ if(cs == null) {
+ cs = new HashSet<Check>();
+ checks.put(entity, cs);
+ }
+ cs.add(check);
+ }
+ }
+
+ void createChecks() {
+ addCheck(new ActionForwardCheck(this, StrutsPreferences.INVALID_ACTION_FORWARD),
+ ENT_FORWARD + VER_SUFFIX_10, ENT_FORWARD + VER_SUFFIX_11, ENT_FORWARD + VER_SUFFIX_12);
+ addCheck(new ActionNameCheck(this, StrutsPreferences.INVALID_ACTION_NAME),
+ ENT_ACTION + VER_SUFFIX_10, ENT_ACTION + VER_SUFFIX_11, ENT_ACTION + VER_SUFFIX_12);
+ addCheck(new ActionRefsCheck(this, StrutsPreferences.INVALID_ACTION_REFERENCE_ATTRIBUTE),
+ ENT_ACTION + VER_SUFFIX_10, ENT_ACTION + VER_SUFFIX_11, ENT_ACTION + VER_SUFFIX_12);
+ addCheck(new ActionTypeCheck(this, StrutsPreferences.INVALID_ACTION_TYPE),
+ ENT_ACTION + VER_SUFFIX_10, ENT_ACTION + VER_SUFFIX_11, ENT_ACTION + VER_SUFFIX_12);
+ addCheck(new GlobalExceptionCheck(this, StrutsPreferences.INVALID_GLOBAL_EXCEPTION),
+ ENT_EXCEPTION + VER_SUFFIX_11);
+ addCheck(new GlobalForwardCheck(this, StrutsPreferences.INVALID_GLOBAL_FORWARD),
+ ENT_FORWARD + VER_SUFFIX_10, ENT_FORWARD + VER_SUFFIX_11, ENT_FORWARD + VER_SUFFIX_12);
+ addCheck(new StrutsConfigControllerCheck(this, StrutsPreferences.INVALID_CONTROLLER),
+ "StrutsController11", "StrutsController12");
+ addCheck(new ResourceCheck(this, StrutsPreferences.INVALID_MESSAGE_RESOURCES),
+ "StrutsMessageResources11");
+
+ addCheck(new StrutsConfigCheck(this, StrutsPreferences.INVALID_INIT_PARAM),
+ ENT_STRUTSCONFIG + VER_SUFFIX_10, ENT_STRUTSCONFIG + VER_SUFFIX_11, ENT_STRUTSCONFIG + VER_SUFFIX_12);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#getMarkerType()
+ */
+ @Override
+ public String getMarkerType() {
+ return PROBLEM_TYPE;
+ }
+
+ public String getId() {
+ return ID;
+ }
+
+ public String getBuilderId() {
+ return null;
+ }
+
+ public IValidatingProjectTree getValidatingProjects(IProject project) {
+ IProjectValidationContext rootContext = contexts.get(project);
+ if(rootContext == null) {
+ rootContext = new ProjectValidationContext();
+ contexts.put(project, rootContext);
+ }
+
+ Set<IProject> projects = new HashSet<IProject>();
+ projects.add(project);
+
+ IValidatingProjectSet projectSet = new ValidatingProjectSet(project, projects, rootContext);
+ return new SimpleValidatingProjectTree(projectSet);
+ }
+
+ public boolean shouldValidate(IProject project) {
+ if(!project.isAccessible()) {
+ return false;
+ }
+
+ try {
+ return project.hasNature(StrutsProject.NATURE_ID);
+ } catch (CoreException e) {
+ WebModelPlugin.getDefault().logError(e);
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.internal.validation.ValidationErrorManager#init(org.eclipse.core.resources.IProject, org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper, org.jboss.tools.jst.web.kb.validation.IProjectValidationContext, org.eclipse.wst.validation.internal.provisional.core.IValidator, org.eclipse.wst.validation.internal.provisional.core.IReporter)
+ */
+ @Override
+ public void init(IProject project, ContextValidationHelper validationHelper, IProjectValidationContext context, org.eclipse.wst.validation.internal.provisional.core.IValidator manager, IReporter reporter) {
+ super.init(project, validationHelper, context, manager, reporter);
+ projectName = project.getName();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidator#validate(java.util.Set, org.eclipse.core.resources.IProject, org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper, org.jboss.tools.jst.web.kb.validation.IProjectValidationContext, org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager, org.eclipse.wst.validation.internal.provisional.core.IReporter)
+ */
+ public IStatus validate(Set<IFile> changedFiles, IProject project,
+ ContextValidationHelper validationHelper, IProjectValidationContext context, ValidatorManager manager,
+ IReporter reporter) throws ValidationException {
+ init(project, validationHelper, context, manager, reporter);
+
+ for (IFile file: changedFiles) {
+ if(file.getName().endsWith(XML_EXT)) {
+ XModelObject o = EclipseResourceUtil.createObjectForResource(file);
+ if(o != null && o.getModelEntity().getName().startsWith(ENT_STRUTSCONFIG)) {
+ validateStrutsConfigFile(o, file);
+ } else if(o != null && o.getModelEntity().getName().startsWith("FileWebApp")) {
+ validateWebXMLFile(o);
+ }
+ }
+ }
+ return OK_STATUS;
+ }
+
+ private void validateStrutsConfigFile(XModelObject object, IFile file) {
+ validateObject(object);
+ }
+
+ private void validateWebXMLFile(XModelObject object) {
+ XModelObject[] ss = WebAppHelper.getServlets(object);
+ for (XModelObject servlet: ss) {
+ for(XModelObject p: servlet.getChildren()) {
+ new CheckInitParam(this, StrutsPreferences.INVALID_INIT_PARAM).check(p);
+ }
+ }
+ }
+
+ private void validateObject(XModelObject object) {
+ String entity = object.getModelEntity().getName();
+ Set<Check> ch = checks.get(entity);
+ if(ch != null) {
+ for (Check c: ch) {
+ c.check(object);
+ }
+ }
+ XModelObject[] cs = object.getChildren();
+ for (XModelObject c: cs) {
+ validateObject(c);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.jst.web.kb.validation.IValidator#validateAll(org.eclipse.core.resources.IProject, org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper, org.jboss.tools.jst.web.kb.validation.IProjectValidationContext, org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager, org.eclipse.wst.validation.internal.provisional.core.IReporter)
+ */
+ public IStatus validateAll(IProject project,
+ ContextValidationHelper validationHelper, IProjectValidationContext context, ValidatorManager manager,
+ IReporter reporter) throws ValidationException {
+ init(project, validationHelper, context, manager, reporter);
+ displaySubtask(StrutsValidatorMessages.VALIDATING_PROJECT, new String[]{projectName});
+
+ IPath webContentPath = WebUtils.getFirstWebContentPath(project);
+ IFolder webInf = null;
+ try {
+
+ // This code line never return null
+ webInf = project.getFolder(webContentPath.removeFirstSegments(1).append("WEB-INF")); //$NON-NLS-1$
+ // so never check it for null
+ if(webInf.isAccessible()) {
+ IResource[] rs = webInf.members();
+ // exception is not required here because if esbContent is not exist control
+ // never gets here
+ for (IResource r: rs) {
+ if(r instanceof IFile) {
+ IFile file = (IFile)r;
+ String name = file.getName();
+ if(name.endsWith(XML_EXT)) {
+ XModelObject o = EclipseResourceUtil.createObjectForResource(file);
+ if(o != null && o.getModelEntity().getName().startsWith(StrutsConstants.ENT_STRUTSCONFIG)) {
+ validateStrutsConfigFile(o, file);
+ }
+ }
+ }
+ }
+ }
+ } catch (CoreException e) {
+ // hiding exceptions is the evil so lets return EROOR Status with exception
+ return new Status(IStatus.ERROR,StrutsModelPlugin.PLUGIN_ID,MessageFormat.format("Validation error for project {0}",project.getLocation().toString()),e);
+ }
+
+ return OK_STATUS;
+ }
+
+ public boolean isEnabled(IProject project) {
+ return StrutsPreferences.isValidationEnabled(project);
+ }
+
+ @Override
+ protected String getPreferencePageId() {
+ return PREFERENCE_PAGE_ID;
+ }
+
+}
Property changes on: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsCoreValidator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsPreferenceInitializer.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsPreferenceInitializer.java (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsPreferenceInitializer.java 2011-11-29 22:13:05 UTC (rev 36750)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.struts.validation;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.jboss.tools.common.preferences.SeverityPreferences;
+import org.jboss.tools.jst.web.WebModelPlugin;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class StrutsPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ IEclipsePreferences defaultPreferences = ((IScopeContext) new DefaultScope()).getNode(WebModelPlugin.PLUGIN_ID);
+ defaultPreferences.putBoolean(SeverityPreferences.ENABLE_BLOCK_PREFERENCE_NAME, true);
+ for (String name : StrutsPreferences.SEVERITY_OPTION_NAMES) {
+ defaultPreferences.put(name, SeverityPreferences.WARNING);
+ }
+ defaultPreferences.putInt(SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME, SeverityPreferences.DEFAULT_MAX_NUMBER_OF_MARKERS_PER_FILE);
+ }
+}
Property changes on: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsPreferenceInitializer.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsPreferences.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsPreferences.java (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsPreferences.java 2011-11-29 22:13:05 UTC (rev 36750)
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.struts.validation;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.common.preferences.SeverityPreferences;
+import org.jboss.tools.jst.web.WebModelPlugin;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class StrutsPreferences extends SeverityPreferences {
+
+ public static final Set<String> SEVERITY_OPTION_NAMES = new HashSet<String>();
+
+ private static StrutsPreferences INSTANCE = new StrutsPreferences();
+
+ public static final String INVALID_ACTION_FORWARD = INSTANCE.createSeverityOption("invalidActionForward"); //$NON-NLS-1$
+
+ public static final String INVALID_ACTION_NAME = INSTANCE.createSeverityOption("invalidActionName"); //$NON-NLS-1$
+ public static final String INVALID_ACTION_REFERENCE_ATTRIBUTE = INSTANCE.createSeverityOption("invalidActionReferenceAttribute"); //$NON-NLS-1$
+ public static final String INVALID_ACTION_TYPE = INSTANCE.createSeverityOption("invalidActionType"); //$NON-NLS-1$
+
+ public static final String INVALID_GLOBAL_FORWARD = INSTANCE.createSeverityOption("invalidGlobalForward"); //$NON-NLS-1$
+ public static final String INVALID_GLOBAL_EXCEPTION = INSTANCE.createSeverityOption("invalidGlobalException"); //$NON-NLS-1$
+
+ public static final String INVALID_CONTROLLER = INSTANCE.createSeverityOption("invalidController"); //$NON-NLS-1$
+ public static final String INVALID_MESSAGE_RESOURCES = INSTANCE.createSeverityOption("invalidMessageResources"); //$NON-NLS-1$
+
+ public static final String INVALID_INIT_PARAM = INSTANCE.createSeverityOption("invalidInitParam"); //$NON-NLS-1$
+
+ /**
+ * @return the only instance of CDIPreferences
+ */
+ public static StrutsPreferences getInstance() {
+ return INSTANCE;
+ }
+
+ private StrutsPreferences() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.preferences.SeverityPreferences#createSeverityOption(java.lang.String)
+ */
+ @Override
+ protected String createSeverityOption(String shortName) {
+ String name = getPluginId() + ".validator.problem." + shortName; //$NON-NLS-1$
+ SEVERITY_OPTION_NAMES.add(name);
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.preferences.SeverityPreferences#getPluginId()
+ */
+ @Override
+ protected String getPluginId() {
+ return WebModelPlugin.PLUGIN_ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.common.preferences.SeverityPreferences#getSeverityOptionNames()
+ */
+ @Override
+ protected Set<String> getSeverityOptionNames() {
+ return SEVERITY_OPTION_NAMES;
+ }
+
+ public static boolean shouldValidateCore(IProject project) {
+ return true;
+ }
+
+ public static boolean isValidationEnabled(IProject project) {
+ return INSTANCE.isEnabled(project);
+ }
+
+ public static int getMaxNumberOfProblemMarkersPerFile(IProject project) {
+ return INSTANCE.getMaxNumberOfProblemMarkersPerResource(project);
+ }
+}
\ No newline at end of file
Property changes on: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsPreferences.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsValidatorMessages.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsValidatorMessages.java (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsValidatorMessages.java 2011-11-29 22:13:05 UTC (rev 36750)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.struts.validation;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class StrutsValidatorMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.tools.struts.validation.messages"; //$NON-NLS-1$
+
+ public static String WEB_XML_PLUGIN_NO_MESSAGE;
+
+ public static String VALIDATING_RESOURCE;
+ public static String VALIDATING_PROJECT;
+
+ public static String ACTION_TYPE_EMPTY;
+ public static String ACTION_TYPE_EXISTS;
+ public static String ACTION_TYPE_EXTENDS;
+ public static String ACTION_TYPE_UPTODATE;
+ public static String ACTION_NAME_EXISTS;
+ public static String ACTION_NAME_EMPTY;
+ public static String ACTION_INPUT;
+
+ public static String ACTION_FORWARD;
+ public static String ACTION_INCLUDE;
+ public static String ACTION_FORWARD_PATH_EMPTY;
+ public static String ACTION_FORWARD_PATH_EXISTS;
+ public static String ACTION_FORWARD_CLASSNAME_EXISTS;
+ public static String ACTION_FORWARD_CONTEXT_RELATIVE_CROSS;
+ public static String ACTION_FORWARD_CONTEXT_RELATIVE_MONO;
+ public static String GLOBAL_FORWARD_PATH_EMPTY;
+ public static String GLOBAL_FORWARD_PATH_EXISTS;
+ public static String GLOBAL_FORWARD_CLASSNAME_EXISTS;
+ public static String GLOBAL_FORWARD_CONTEXT_RELATIVE_CROSS;
+ public static String GLOBAL_FORWARD_CONTEXT_RELATIVE_MONO;
+ public static String GLOBAL_EXCEPTION_PATH_EXISTS;
+ public static String GLOBAL_EXCEPTION_CLASSNAME_EXISTS;
+ public static String GLOBAL_EXCEPTION_HANDLER_EXISTS;
+ public static String GLOBAL_EXCEPTION_MODULE_RELATIVE;
+ public static String CONFIG_FILE_XML;
+ public static String CONTROLLER_CLASSNAME_EXISTS;
+ public static String CONTROLLER_MULTIPART_CLASS_EXISTS;
+ public static String CONTROLLER_PROCESSOR_CLASS_EXISTS;
+ public static String RESOURCE_EXISTS;
+ public static String CONFIG_VALID;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, StrutsValidatorMessages.class);
+ }
+}
Property changes on: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/StrutsValidatorMessages.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ValidateTypeUtil.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ValidateTypeUtil.java (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ValidateTypeUtil.java 2011-11-29 22:13:05 UTC (rev 36750)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.struts.validation;
+
+import org.eclipse.jdt.core.IType;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.jst.web.validation.CheckClass;
+import org.jboss.tools.struts.StrutsModelPlugin;
+
+public class ValidateTypeUtil {
+ public static int OK = 0;
+ public static int EMPTY = 1;
+ public static int NOT_FOUND = 2;
+ public static int WRONG_SUPER = 3;
+ public static int NOT_UPTODATE = 4;
+
+ public ValidateTypeUtil() {}
+
+ public int checkClass(XModelObject o, String attr, String sup) {
+ String type = "" + o.getAttributeValue(attr);
+ if(type.length() == 0) return EMPTY;
+ IType c = CheckClass.getValidType(type, o);
+ if(c == null) return NOT_FOUND;
+ if(sup != null) try {
+// IType sc = o.getModel().getValidType(sup);
+
+ ///if(!sc.isAssignableFrom(c)) return WRONG_SUPER;
+ } catch (Exception t) {
+ StrutsModelPlugin.getPluginLog().logError(t);
+ }
+/*
+ VObject cls = model.getObjectByPath("/"+type.replace('.', '/')+".class");
+ src = model.getObjectByPath("/"+type.replace('.', '/')+".java");
+ if (cls != null && src != null) {
+ if (cls.getTimeStamp() < src.getTimeStamp()) {
+ VResult result = factory.getResult("uptodate", object,
+ "type", src, null, new Object[] {object, type});
+ return NOT_UPTODATE;
+ }
+ }
+*/
+ return OK;
+ }
+
+}
Property changes on: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/ValidateTypeUtil.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/messages.properties
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/messages.properties (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/messages.properties 2011-11-29 22:13:05 UTC (rev 36750)
@@ -0,0 +1,33 @@
+WEB_XML_PLUGIN_NO_MESSAGE=No message
+VALIDATING_RESOURCE=project "{0}"; resource "{1}"
+VALIDATING_PROJECT=project "{0}"
+
+ACTION_TYPE_EMPTY={0} should have type attribute filled when input or forward attribute are empty
+ACTION_TYPE_EXISTS=class {1} referenced in {0} type attribute is not compiled
+ACTION_TYPE_EXTENDS={0} action type class {1} must be inherited from {2}
+ACTION_TYPE_UPTODATE={0} action type class {1} is modified, but not yet compiled
+ACTION_NAME_EXISTS={0} name attribute references Form-Bean {1} that does not exist
+ACTION_NAME_EMPTY={0} name attribute is empty, but validate attribute is set to true (yes)
+ACTION_INPUT=Attribute input of {0} references to non-existent {1}
+ACTION_FORWARD=Attribute forward of {0} references to non-existent {1}
+ACTION_INCLUDE=Attribute include of {0} references to non-existent {1}
+ACTION_FORWARD_PATH_EMPTY={0} of {1} path attribute must be defined
+ACTION_FORWARD_PATH_EXISTS={0} of {1} path attribute reference to non-existent {2}
+ACTION_FORWARD_CLASSNAME_EXISTS={0} of {1} className attribute reference to non-existent class
+ACTION_FORWARD_CONTEXT_RELATIVE_CROSS={0} of {1} contextRelative must be set to yes(true) for cross-modular reference
+ACTION_FORWARD_CONTEXT_RELATIVE_MONO={0} of {1} contextRelative must be set to no(false) for mono-modular reference
+GLOBAL_FORWARD_PATH_EMPTY={0} path attribute must be defined
+GLOBAL_FORWARD_PATH_EXISTS={0} path attribute reference to non-existent {1}
+GLOBAL_FORWARD_CLASSNAME_EXISTS={0} className attribute reference to non-existent class
+GLOBAL_FORWARD_CONTEXT_RELATIVE_CROSS={0} contextRelative must be set to yes(true) for cross-modular reference
+GLOBAL_FORWARD_CONTEXT_RELATIVE_MONO={0} contextRelative must be set to no(false) for mono-modular reference
+GLOBAL_EXCEPTION_PATH_EXISTS={0} path attribute reference to non-existent {1}
+GLOBAL_EXCEPTION_CLASSNAME_EXISTS={0} className attribute reference to non-existent class
+GLOBAL_EXCEPTION_HANDLER_EXISTS={0} handler attribute reference to non-existent class
+GLOBAL_EXCEPTION_MODULE_RELATIVE={0} path attribute should be module-relative
+CONFIG_FILE_XML=Configuration file {0} is invalid. {1}
+CONTROLLER_CLASSNAME_EXISTS={0} className attribute of configuration file {1} reference to non-existent class
+CONTROLLER_MULTIPART_CLASS_EXISTS={0} multipartClass attribute of configuration file {1} reference to non-existent class
+CONTROLLER_PROCESSOR_CLASS_EXISTS={0} processorClass attribute of configuration file {1} reference to non-existent class
+RESOURCE_EXISTS=resource {0} does not exist
+CONFIG_VALID=Attribute {0} references to {1} that is not a valid struts config file
\ No newline at end of file
Property changes on: trunk/struts/plugins/org.jboss.tools.struts/src/org/jboss/tools/struts/validation/messages.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 1 month
JBoss Tools SVN: r36749 - in trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central: dialogs and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-11-29 16:52:18 -0500 (Tue, 29 Nov 2011)
New Revision: 36749
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/configurators/DefaultJBossCentralConfigurator.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/dialogs/ProjectExamplesDialog.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/AbstractRefreshJob.java
Log:
JBIDE-10273 Clicking install on plugins seem to block the UI and no information about progress or way to cancel
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/configurators/DefaultJBossCentralConfigurator.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/configurators/DefaultJBossCentralConfigurator.java 2011-11-29 21:12:26 UTC (rev 36748)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/configurators/DefaultJBossCentralConfigurator.java 2011-11-29 21:52:18 UTC (rev 36749)
@@ -24,7 +24,7 @@
public class DefaultJBossCentralConfigurator implements
IJBossCentralConfigurator {
- private static final String JBOSS_DISCOVERY_DIRECTORY_3_3_0_XML = "http://download.jboss.org/jbosstools/updates/nightly/trunk/jbosstools-dir...";
+ private static final String JBOSS_DISCOVERY_DIRECTORY_3_3_0_XML = "http://download.jboss.org/jbosstools/updates/nightly/core/trunk/jbosstool...";
private static final String TWITTER_LINK ="http://twitter.com/#!/jbosstools";
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/dialogs/ProjectExamplesDialog.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/dialogs/ProjectExamplesDialog.java 2011-11-29 21:12:26 UTC (rev 36748)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/dialogs/ProjectExamplesDialog.java 2011-11-29 21:52:18 UTC (rev 36749)
@@ -21,12 +21,14 @@
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.operation.ModalContext;
import org.eclipse.jface.window.ToolTip;
-import org.eclipse.mylyn.commons.core.DelegatingProgressMonitor;
+import org.eclipse.jface.wizard.ProgressMonitorPart;
import org.eclipse.mylyn.internal.discovery.core.model.BundleDiscoveryStrategy;
import org.eclipse.mylyn.internal.discovery.core.model.ConnectorDescriptor;
import org.eclipse.mylyn.internal.discovery.core.model.ConnectorDiscovery;
@@ -36,6 +38,7 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -77,15 +80,17 @@
private FormToolkit toolkit;
private ScrolledForm form;
private Composite fixesComposite;
- private IProgressMonitor monitor;
private Section reqSection;
+ private ProgressMonitorPart fProgressMonitorPart;
+ private Control fLastControl;
+ private Set<Button> controls = new HashSet<Button>();
public ProjectExamplesDialog(Shell parentShell, Tutorial tutorial) {
super(parentShell);
setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER
| SWT.RESIZE | getDefaultOrientation());
this.tutorial = tutorial;
- this.monitor = new DelegatingProgressMonitor();
+ //setHelpAvailable(false);
}
@Override
@@ -132,6 +137,9 @@
}
protected void refreshFixes() {
+ controls.clear();
+ addButtons();
+
Project project = tutorial.getProjectExamples();
List<ProjectFix> fixes = project.getFixes();
List<ProjectFix> unsatisfiedFixes = new ArrayList<ProjectFix>();
@@ -182,6 +190,14 @@
}
}
+ protected void addButtons() {
+ Button cancelButton = getButton(IDialogConstants.CANCEL_ID);
+ if (getButton(IDialogConstants.CANCEL_ID) != null) {
+ controls.add(cancelButton);
+ controls.add(getButton(IDialogConstants.OK_ID));
+ }
+ }
+
private void disposeChildren(Composite composite) {
Control[] children = composite.getChildren();
for (Control child : children) {
@@ -234,6 +250,7 @@
refresh();
}
});
+ controls.add(install);
final String downloadId = projectFix.getProperties().get(ProjectFix.DOWNLOAD_ID);
boolean haveDownloadId = false;
if (downloadId != null) {
@@ -246,7 +263,7 @@
ToolTip tip = new DescriptionToolTip(download, "Download and install " + downloadRuntime.getName());
tip.activate();
//download.setImage(JBossCentralActivator.getDefault().getImage("/icons/repository-submit.gif"));
-
+ controls.add(download);
download.addSelectionListener(new SelectionAdapter() {
@Override
@@ -282,7 +299,7 @@
refresh();
}
});
-
+ controls.add(install);
}
Button p2install = toolkit.createButton(fixesComposite, "Install New Software", SWT.PUSH);
ToolTip tip = new DescriptionToolTip(p2install, "P2 Install New Software");
@@ -303,42 +320,61 @@
refresh();
}
});
-
+ controls.add(p2install);
if (connectorIds.size() == 0) {
new Label(fixesComposite, SWT.NONE);
}
}
protected void install(final Set<String> connectorIds) throws InvocationTargetException, InterruptedException {
- run(true, true, new IRunnableWithProgress() {
+ final IStatus[] results = new IStatus[1];
+ final ConnectorDiscovery[] connectorDiscoveries = new ConnectorDiscovery[1];
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- ConnectorDiscovery connectorDiscovery = new ConnectorDiscovery();
+ connectorDiscoveries[0] = new ConnectorDiscovery();
// look for descriptors from installed bundles
- connectorDiscovery.getDiscoveryStrategies().add(new BundleDiscoveryStrategy());
+ connectorDiscoveries[0].getDiscoveryStrategies().add(new BundleDiscoveryStrategy());
RemoteBundleDiscoveryStrategy remoteDiscoveryStrategy = new RemoteBundleDiscoveryStrategy();
remoteDiscoveryStrategy.setDirectoryUrl(JBossCentralActivator.getDefault().getJBossDiscoveryDirectory());
- connectorDiscovery.getDiscoveryStrategies().add(remoteDiscoveryStrategy);
+ connectorDiscoveries[0].getDiscoveryStrategies().add(remoteDiscoveryStrategy);
- connectorDiscovery.setEnvironment(JBossCentralActivator.getEnvironment());
- connectorDiscovery.setVerifyUpdateSiteAvailability(true);
- IStatus result = connectorDiscovery.performDiscovery(monitor);
+ connectorDiscoveries[0].setEnvironment(JBossCentralActivator.getEnvironment());
+ connectorDiscoveries[0].setVerifyUpdateSiteAvailability(true);
+ results[0] = connectorDiscoveries[0].performDiscovery(monitor);
if (monitor.isCanceled()) {
- throw new InterruptedException();
+ results[0] = Status.CANCEL_STATUS;
}
- if (result.isOK()) {
- List<DiscoveryConnector> connectors = connectorDiscovery.getConnectors();
- List<ConnectorDescriptor> installableConnectors = new ArrayList<ConnectorDescriptor>();
- for (DiscoveryConnector connector:connectors) {
- if (connectorIds.contains(connector.getId())) {
- installableConnectors.add(connector);
- }
- }
- DiscoveryUi.install(installableConnectors, ProjectExamplesDialog.this);
+ }
+ };
+ run(true, true, runnable);
+ if (results[0] == null) {
+ return;
+ }
+ if (results[0].isOK()) {
+ List<DiscoveryConnector> connectors = connectorDiscoveries[0].getConnectors();
+ List<ConnectorDescriptor> installableConnectors = new ArrayList<ConnectorDescriptor>();
+ for (DiscoveryConnector connector:connectors) {
+ if (connectorIds.contains(connector.getId())) {
+ installableConnectors.add(connector);
}
}
- });
+ DiscoveryUi.install(installableConnectors, ProjectExamplesDialog.this);
+ } else {
+ String message = results[0].toString();
+ switch (results[0].getSeverity()) {
+ case IStatus.ERROR:
+ MessageDialog.openError(getShell(), "Error", message);
+ break;
+ case IStatus.WARNING:
+ MessageDialog.openWarning(getShell(), "Warning", message);
+ break;
+ case IStatus.INFO:
+ MessageDialog.openInformation(getShell(), "Information", message);
+ break;
+ }
+ }
}
@@ -346,9 +382,43 @@
public void run(boolean fork, boolean cancelable,
IRunnableWithProgress runnable) throws InvocationTargetException,
InterruptedException {
- ModalContext.run(runnable, false, monitor, getDisplay());
+ //ModalContext.run(runnable, cancelable, monitor, getDisplay());
+ if (getShell() != null && getShell().isVisible()) {
+ // Save focus control
+ fLastControl = getShell().getDisplay().getFocusControl();
+ if (fLastControl != null && fLastControl.getShell() != getShell()) {
+ fLastControl = null;
+ }
+ // Attach the progress monitor part to the cancel button
+ fProgressMonitorPart.attachToCancelComponent(null);
+ fProgressMonitorPart.getParent().setVisible(true);
+
+ try {
+ updateControls(false);
+ ModalContext.run(runnable, fork, fProgressMonitorPart, getShell().getDisplay());
+ }
+ finally {
+ updateControls(true);
+ if (getShell() != null) {
+ fProgressMonitorPart.getParent().setVisible(false);
+ fProgressMonitorPart.removeFromCancelComponent(null);
+ if (fLastControl != null) {
+ fLastControl.setFocus();
+ }
+ }
+ }
+ }
+ else {
+ PlatformUI.getWorkbench().getProgressService().run(fork, cancelable, runnable);
+ }
}
+ private void updateControls(boolean enabled) {
+ for (Button control:controls) {
+ control.setEnabled(enabled);
+ }
+ }
+
protected Display getDisplay() {
Display display = Display.getCurrent();
if (display == null) {
@@ -357,12 +427,73 @@
return display;
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createButtonBar(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createButtonBar(Composite parent) {
+ Font font = parent.getFont();
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginHeight= 0;
+ layout.marginWidth= 0;
+ layout.marginLeft = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ composite.setFont(font);
+ Label sep = new Label(composite, SWT.HORIZONTAL|SWT.SEPARATOR);
+ sep.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ Composite buttonComposite = new Composite(composite, SWT.NULL);
+ layout = new GridLayout();
+ if (isHelpAvailable()) {
+ layout.numColumns = 3;
+ } else {
+ layout.numColumns = 2;
+ }
+ layout.marginHeight= 0;
+ layout.marginWidth= 0;
+ layout.marginLeft = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ buttonComposite.setLayout(layout);
+ buttonComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ buttonComposite.setFont(font);
+
+ if (isHelpAvailable()) {
+ createHelpControl(buttonComposite);
+ }
+ Composite monitorComposite = new Composite(buttonComposite, SWT.NULL);
+ layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.numColumns = 2;
+ monitorComposite.setLayout(layout);
+ monitorComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ GridLayout pmLayout = new GridLayout();
+ fProgressMonitorPart= new ProgressMonitorPart(monitorComposite, pmLayout, true);
+ fProgressMonitorPart.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ fProgressMonitorPart.setFont(font);
+ monitorComposite.setVisible(false);
+
+ boolean helpAvailable = isHelpAvailable();
+ setHelpAvailable(false);
+ super.createButtonBar(buttonComposite);
+ Control[] children = buttonComposite.getChildren();
+ for (Control child:children) {
+ if (child instanceof Label) {
+ child.setVisible(false);
+ child.dispose();
+ }
+ }
+ setHelpAvailable(helpAvailable);
+ return composite;
+ }
+
@Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.OK_ID, "Start",
true);
createButton(parent, IDialogConstants.CANCEL_ID,
IDialogConstants.CANCEL_LABEL, false);
+ addButtons();
}
protected void refresh() {
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java 2011-11-29 21:12:26 UTC (rev 36748)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java 2011-11-29 21:52:18 UTC (rev 36749)
@@ -346,17 +346,6 @@
Image image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
formText.setImage("image", image);
- formText.addHyperlinkListener(new HyperlinkAdapter() {
- public void linkActivated(HyperlinkEvent e) {
- if ("networkConnections".equals(e.data)) {
- PreferenceDialog dialog = PreferencesUtil
- .createPreferenceDialogOn(null,
- "org.eclipse.ui.net.NetPreferences", null,
- null);
- dialog.open();
- }
- }
- });
return formText;
}
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/AbstractRefreshJob.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/AbstractRefreshJob.java 2011-11-29 21:12:26 UTC (rev 36748)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/AbstractRefreshJob.java 2011-11-29 21:52:18 UTC (rev 36749)
@@ -176,7 +176,7 @@
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
- if (forcedDownload || urlModified != cacheModified) {
+ if (forcedDownload || cacheModified == 0 || urlModified != cacheModified) {
try {
File tempFile = File.createTempFile("news", ".xml");
tempFile.deleteOnExit();
13 years, 1 month
JBoss Tools SVN: r36748 - in trunk/cdi: plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2011-11-29 16:12:26 -0500 (Tue, 29 Nov 2011)
New Revision: 36748
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/AddQualifiersToBeanProcessor.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRefactoringProcessor.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/DeleteAllDisposerAnnotationsProcessor.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/DeleteAllInjectedConstructorsProcessor.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/MarkerResolutionUtils.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/ValuedQualifier.java
Removed:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddQualifiersToBeanProcessor.java
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/DeleteAllInjectedConstructorsProcessor.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/CDIRefactoringProcessor.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/CDISeamResourceLoadingHyperlinkDetector.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddAnnotationMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddRetentionAnnotationMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddSerializableInterfaceMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddTargetAnnotationMarkerResolution.java
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/ChangeAnnotationMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CreateCDIElementMarkerResolution.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/DeleteAllInjectedConstructorsMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAnnotationMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeInjectedPointUnambiguousMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodBusinessMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/SelectBeanMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AbstractModifyInjectionPointWizard.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanWizard.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanWizardPage.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/SelectBeanWizard.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/AddQualifiersToBeanWizardTest.java
Log:
Quickfix and Wizard for fixing ambigious injection warning is confusing https://issues.jboss.org/browse/JBIDE-9940
Copied: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/AddQualifiersToBeanProcessor.java (from rev 36738, trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddQualifiersToBeanProcessor.java)
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/AddQualifiersToBeanProcessor.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/AddQualifiersToBeanProcessor.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.internal.core.refactoring;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+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.text.edits.MultiTextEdit;
+import org.jboss.tools.cdi.core.CDICoreMessages;
+import org.jboss.tools.cdi.core.IBean;
+import org.jboss.tools.cdi.core.IInjectionPoint;
+import org.jboss.tools.common.EclipseUtil;
+
+public class AddQualifiersToBeanProcessor extends CDIRefactoringProcessor {
+ protected IBean selectedBean;
+ protected IInjectionPoint injectionPoint;
+ protected List<IBean> beans;
+ protected ArrayList<ValuedQualifier> qualifiers;
+
+ public AddQualifiersToBeanProcessor(String label, IInjectionPoint injectionPoint, List<IBean> beans, IBean bean) {
+ super(label);
+ this.selectedBean = bean;
+ this.injectionPoint = injectionPoint;
+ this.beans = beans;
+ }
+
+ @Override
+ public RefactoringStatus checkInitialConditions(IProgressMonitor pm)
+ throws CoreException, OperationCanceledException {
+ status = new RefactoringStatus();
+
+ if(injectionPoint == null){
+ status.addFatalError(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_INJECTION_POINT_NOT_FOUND);
+ return status;
+ }
+
+ IFile injectionPointFile = (IFile)injectionPoint.getClassBean().getResource();
+
+ isFileCorrect(injectionPointFile);
+
+ return status;
+ }
+
+ @Override
+ public RefactoringStatus checkFinalConditions(IProgressMonitor pm,
+ CheckConditionsContext context) throws CoreException,
+ OperationCanceledException {
+
+ if(selectedBean == null){
+ status.addFatalError(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_BEAN_NOT_FOUND);
+ return status;
+ }
+
+ IFile beanFile = (IFile)selectedBean.getBeanClass().getResource();
+
+ if(!isFileCorrect(beanFile)){
+ return status;
+ }
+ return status;
+ }
+
+ private ICompilationUnit getCompilationUnit(IFile file) throws CoreException{
+ IProject project = file.getProject();
+ IJavaProject javaProject = (IJavaProject)project.getNature(JavaCore.NATURE_ID);
+ IJavaElement element = javaProject.findElement(file.getProjectRelativePath());
+ if(element instanceof ICompilationUnit)
+ return (ICompilationUnit)element;
+
+ return null;
+ }
+
+ @Override
+ public Change createChange(IProgressMonitor pm) throws CoreException,
+ OperationCanceledException {
+ rootChange = new CompositeChange(label);
+
+ IFile file = (IFile)selectedBean.getBeanClass().getResource();
+ ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+
+ ICompilationUnit compilationUnit = original.getWorkingCopy(pm);
+
+ TextFileChange fileChange = new CDIFileChange(file.getName(), file);
+ if(getEditor(file) != null)
+ fileChange.setSaveMode(TextFileChange.LEAVE_DIRTY);
+ else
+ fileChange.setSaveMode(TextFileChange.FORCE_SAVE);
+
+ MultiTextEdit edit = new MultiTextEdit();
+
+ MarkerResolutionUtils.addQualifiersToBean(qualifiers, selectedBean, compilationUnit, edit);
+
+ IFile file2 = (IFile)injectionPoint.getClassBean().getResource();
+ ICompilationUnit original2 = injectionPoint.getClassBean().getBeanClass().getCompilationUnit();
+ ICompilationUnit compilationUnit2 = original2.getWorkingCopy(pm);
+
+ if(!original.equals(original2)){
+ compilationUnit.discardWorkingCopy();
+ if(edit.getChildrenSize() > 0){
+ fileChange.setEdit(edit);
+ rootChange.add(fileChange);
+ }
+ fileChange = new CDIFileChange(file2.getName(), file2);
+ if(getEditor(file2) != null)
+ fileChange.setSaveMode(TextFileChange.LEAVE_DIRTY);
+ else
+ fileChange.setSaveMode(TextFileChange.FORCE_SAVE);
+
+ edit = new MultiTextEdit();
+ }else{
+ compilationUnit2 = compilationUnit;
+ }
+
+ MarkerResolutionUtils.addQualifiersToInjectionPoint(qualifiers, injectionPoint, compilationUnit2, edit);
+
+ if(edit.getChildrenSize() > 0){
+ fileChange.setEdit(edit);
+ rootChange.add(fileChange);
+ }
+ compilationUnit.discardWorkingCopy();
+ return rootChange;
+ }
+
+ protected void createRootChange(){
+
+ }
+
+ public IBean getSelectedBean(){
+ return selectedBean;
+ }
+
+ public IInjectionPoint getInjectionPoint(){
+ return injectionPoint;
+ }
+
+ public List<IBean> getBeans(){
+ return beans;
+ }
+
+ public void setSelectedBean(IBean bean){
+ selectedBean = bean;
+ }
+
+ public void setDeployedQualifiers(ArrayList<ValuedQualifier> qualifiers){
+ this.qualifiers = qualifiers;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/AddQualifiersToBeanProcessor.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRefactoringProcessor.java (from rev 36744, trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/CDIRefactoringProcessor.java)
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRefactoringProcessor.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRefactoringProcessor.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -0,0 +1,193 @@
+/*******************************************************************************
+ * 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.internal.core.refactoring;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
+import org.eclipse.jface.text.IDocument;
+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.RefactoringParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
+import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchWindow;
+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.IBean;
+import org.jboss.tools.cdi.core.ICDIProject;
+import org.jboss.tools.cdi.core.IClassBean;
+
+public abstract class CDIRefactoringProcessor extends RefactoringProcessor {
+ protected static final RefactoringParticipant[] EMPTY_REF_PARTICIPANT = new RefactoringParticipant[0];
+ protected IFile file;
+ protected RefactoringStatus status;
+ protected String label;
+
+ protected CompositeChange rootChange;
+ protected TextFileChange change;
+ protected IClassBean bean;
+
+
+ public CDIRefactoringProcessor(IFile file, String label){
+ this(label);
+ this.file = file;
+ }
+
+ public CDIRefactoringProcessor(String label){
+ this.label = label;
+ }
+
+ protected void createRootChange(){
+ rootChange = new CompositeChange(label);
+ change = new CDIFileChange(file.getName(), file);
+
+ if(getEditor(file) != null)
+ change.setSaveMode(TextFileChange.LEAVE_DIRTY);
+ else
+ change.setSaveMode(TextFileChange.FORCE_SAVE);
+
+ MultiTextEdit root = new MultiTextEdit();
+ change.setEdit(root);
+ rootChange.add(change);
+ rootChange.markAsSynthetic();
+ }
+
+ protected IEditorPart getEditor(IFile file){
+ IEditorInput ii = EditorUtility.getEditorInput(file);
+
+ IWorkbenchWindow[] windows = CDICorePlugin.getDefault().getWorkbench().getWorkbenchWindows();
+ for(IWorkbenchWindow window : windows){
+ IEditorPart editor = window.getActivePage().findEditor(ii);
+ if(editor != null)
+ return editor;
+ }
+ return null;
+ }
+
+ 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;
+ }
+
+ protected boolean isFileCorrect(IFile file){
+ if(file == null){
+ status.addFatalError(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_FILE_NOT_FOUND);
+ return false;
+ }else if(!file.isSynchronized(IResource.DEPTH_ZERO)){
+ status.addFatalError(NLS.bind(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_OUT_OF_SYNC_PROJECT, file.getProject().getFullPath().toString()));
+ return false;
+ }else if(file.isPhantom()){
+ status.addFatalError(NLS.bind(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_PHANTOM_FILE, file.getFullPath().toString()));
+ return false;
+ }else if(file.isReadOnly()){
+ status.addFatalError(NLS.bind(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_READ_ONLY_FILE, file.getFullPath().toString()));
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public Object[] getElements() {
+ return new Object[]{file};
+ }
+
+ @Override
+ public String getIdentifier() {
+ return "";
+ }
+
+ @Override
+ public String getProcessorName() {
+ return label;
+ }
+
+ @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(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_BEAN_NOT_FOUND);
+
+ 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;
+ }
+
+ protected class CDIFileChange extends TextFileChange{
+
+ public CDIFileChange(String name, IFile file) {
+ super(name, file);
+ }
+
+ @Override
+ protected void releaseDocument(final IDocument document, IProgressMonitor pm)
+ throws CoreException {
+ super.releaseDocument(document, pm);
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ IEditorPart editor = getEditor(getFile());
+ if(editor != null){
+ editor.doSave(new NullProgressMonitor());
+ }
+ }
+
+ });
+ }
+ }
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRefactoringProcessor.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/DeleteAllDisposerAnnotationsProcessor.java (from rev 36738, trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerAnnotationsProcessor.java)
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/DeleteAllDisposerAnnotationsProcessor.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/DeleteAllDisposerAnnotationsProcessor.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * 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.internal.core.refactoring;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+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.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+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.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.common.text.ITextSourceReference;
+
+public class DeleteAllDisposerAnnotationsProcessor extends CDIRefactoringProcessor {
+ private IMethod method;
+
+ public DeleteAllDisposerAnnotationsProcessor(IFile file, IMethod method, String label){
+ super(file, label);
+ this.method = method;
+ }
+
+ 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);
+ 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);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public RefactoringStatus checkFinalConditions(IProgressMonitor pm,
+ CheckConditionsContext context) throws CoreException,
+ OperationCanceledException {
+
+ createRootChange();
+
+ if(bean != null)
+ changeDisposers(bean);
+
+ return status;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/DeleteAllDisposerAnnotationsProcessor.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/DeleteAllInjectedConstructorsProcessor.java (from rev 36738, trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsProcessor.java)
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/DeleteAllInjectedConstructorsProcessor.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/DeleteAllInjectedConstructorsProcessor.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * 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.internal.core.refactoring;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+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.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+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.IBeanMethod;
+import org.jboss.tools.cdi.core.IClassBean;
+import org.jboss.tools.common.java.IAnnotationDeclaration;
+
+public class DeleteAllInjectedConstructorsProcessor extends CDIRefactoringProcessor {
+ private IMethod method;
+
+ public DeleteAllInjectedConstructorsProcessor(IFile file, IMethod method, String label){
+ super(file, label);
+ this.method = method;
+ }
+
+ private void changeConstructors(IClassBean bean) {
+ Set<IBeanMethod> constructors = bean.getBeanConstructors();
+ if(constructors.size()>1) {
+ Set<IAnnotationDeclaration> injects = new HashSet<IAnnotationDeclaration>();
+ for (IBeanMethod constructor : constructors) {
+ if(!constructor.getMethod().isSimilar(method)){
+ IAnnotationDeclaration inject = constructor.getAnnotation(CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
+ if(inject!=null) {
+ injects.add(inject);
+ }
+ }
+ }
+ for (IAnnotationDeclaration inject : injects) {
+ TextEdit edit = new ReplaceEdit(inject.getStartPosition(), inject.getLength(), "");
+ change.addEdit(edit);
+ }
+ }
+ }
+
+
+ @Override
+ public RefactoringStatus checkFinalConditions(IProgressMonitor pm,
+ CheckConditionsContext context) throws CoreException,
+ OperationCanceledException {
+
+ createRootChange();
+
+ if(bean != null)
+ changeConstructors(bean);
+
+ return status;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/DeleteAllInjectedConstructorsProcessor.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/MarkerResolutionUtils.java (from rev 36744, trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java)
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/MarkerResolutionUtils.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/MarkerResolutionUtils.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -0,0 +1,887 @@
+/*******************************************************************************
+ * 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.internal.core.refactoring;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IAnnotatable;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IBuffer;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IImportContainer;
+import org.eclipse.jdt.core.IImportDeclaration;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.ILocalVariable;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageDeclaration;
+import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jdt.core.ISourceReference;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeParameter;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.InsertEdit;
+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.CDICorePlugin;
+import org.jboss.tools.cdi.core.IBean;
+import org.jboss.tools.cdi.core.IBeanField;
+import org.jboss.tools.cdi.core.IBeanMethod;
+import org.jboss.tools.cdi.core.IInjectionPoint;
+import org.jboss.tools.cdi.core.IInjectionPointField;
+import org.jboss.tools.cdi.core.IInjectionPointParameter;
+import org.jboss.tools.cdi.core.IQualifier;
+import org.jboss.tools.cdi.core.IQualifierDeclaration;
+import org.jboss.tools.common.model.util.EclipseJavaUtil;
+import org.jboss.tools.common.util.BeanUtil;
+
+/**
+ * @author Daniel Azarov
+ */
+public class MarkerResolutionUtils {
+ public static final String DOT = "."; //$NON-NLS-1$
+ public static final String COMMA = ","; //$NON-NLS-1$
+ public static final String SEMICOLON = ";"; //$NON-NLS-1$
+ public static final String SPACE = " "; //$NON-NLS-1$
+ public static final String AT = "@"; //$NON-NLS-1$
+ public static final String IMPLEMENTS = "implements"; //$NON-NLS-1$
+ public static final String IMPORT = "import"; //$NON-NLS-1$
+ public static final String EXTENDS = "extends"; //$NON-NLS-1$
+ public static final String OPEN_BRACE = "{"; //$NON-NLS-1$
+ public static final String CLOSE_BRACE = "}"; //$NON-NLS-1$
+
+ static final HashSet<String> primitives = new HashSet<String>();
+ static{
+ primitives.add("void"); //$NON-NLS-1$
+ primitives.add("int"); //$NON-NLS-1$
+ primitives.add("java.lang.Integer"); //$NON-NLS-1$
+ primitives.add("char"); //$NON-NLS-1$
+ primitives.add("java.lang.Character"); //$NON-NLS-1$
+ primitives.add("boolean"); //$NON-NLS-1$
+ primitives.add("java.lang.Boolean"); //$NON-NLS-1$
+ primitives.add("short"); //$NON-NLS-1$
+ primitives.add("java.lang.Short"); //$NON-NLS-1$
+ primitives.add("long"); //$NON-NLS-1$
+ primitives.add("java.lang.Long"); //$NON-NLS-1$
+ primitives.add("float"); //$NON-NLS-1$
+ primitives.add("java.lang.Float"); //$NON-NLS-1$
+ primitives.add("double"); //$NON-NLS-1$
+ primitives.add("java.lang.Double"); //$NON-NLS-1$
+ primitives.add("byte"); //$NON-NLS-1$
+ primitives.add("java.lang.Byte"); //$NON-NLS-1$
+ primitives.add("java.lang.String"); //$NON-NLS-1$
+ }
+
+ /**
+ *
+ * @param qualifiedName
+ * @param compilationUnit
+ * @return true if there is import in compilation unit with the same short name
+ * @throws JavaModelException
+ */
+ public static boolean addImport(String qualifiedName, ICompilationUnit compilationUnit) throws JavaModelException{
+ return addImport(qualifiedName, compilationUnit, false, null);
+ }
+
+ public static boolean addImport(String qualifiedName, ICompilationUnit compilationUnit, MultiTextEdit rootEdit) throws JavaModelException{
+ return addImport(qualifiedName, compilationUnit, false, rootEdit);
+ }
+
+ /**
+ *
+ * @param qualifiedName
+ * @param compilationUnit
+ * @param staticFlag
+ * @return true if there is import in compilation unit with the same short name
+ * @throws JavaModelException
+ */
+ public static boolean addImport(String qualifiedName, ICompilationUnit compilationUnit, boolean staticFlag) throws JavaModelException{
+ return addImport(qualifiedName, compilationUnit, staticFlag, null);
+ }
+
+ public static boolean addImport(String qualifiedName, ICompilationUnit compilationUnit, boolean staticFlag, MultiTextEdit rootEdit) throws JavaModelException{
+ if(primitives.contains(qualifiedName))
+ return false;
+
+ if(qualifiedName != null){
+ String shortName = getShortName(qualifiedName);
+
+ IPackageDeclaration[] packages = compilationUnit.getPackageDeclarations();
+
+ // local classes do not need to be imported
+ if(qualifiedName.indexOf(DOT) >= 0){
+ String typePackage = qualifiedName.substring(0,qualifiedName.lastIndexOf(DOT));
+
+ for(IPackageDeclaration packageDeclaration : packages){
+ if(packageDeclaration.getElementName().equals(typePackage))
+ return false;
+ }
+
+ for(IPackageDeclaration packageDeclaration : packages){
+ IType type = compilationUnit.getJavaProject().findType(packageDeclaration.getElementName()+DOT+shortName);
+ if(type != null && type.exists())
+ return true;
+ }
+ }
+
+ IImportDeclaration[] importDeclarations = compilationUnit.getImports();
+
+ for(IImportDeclaration importDeclaration : importDeclarations){
+ String importName = importDeclaration.getElementName();
+ String elementShort = getShortName(importName);
+ if(importDeclaration.isOnDemand()){
+ int importLastDot = importName.lastIndexOf(DOT);
+ if(importLastDot == -1) return false; // invalid import declaration
+ int elementLastDot = qualifiedName.lastIndexOf(DOT);
+ if(elementLastDot == -1) return false; // invalid import declaration
+
+ if(qualifiedName.substring(0, elementLastDot).equals(importName.substring(0, importLastDot)))
+ return false;
+ }
+
+ if(importName.equals(qualifiedName))
+ return false;
+ if(elementShort.equals(shortName))
+ return true;
+
+ }
+ if(rootEdit == null){
+ if(staticFlag){
+ compilationUnit.createImport(qualifiedName, null, Flags.AccStatic, new NullProgressMonitor());
+ }else{
+ compilationUnit.createImport(qualifiedName, null, new NullProgressMonitor());
+ }
+ }else{
+ String text = compilationUnit.findRecommendedLineSeparator()+IMPORT+SPACE+qualifiedName+SEMICOLON;
+ if(!isDuplicate(rootEdit, text)){
+ int importPosition = findPositionForImport(compilationUnit);
+ TextEdit edit = new InsertEdit(importPosition, text);
+ rootEdit.addChild(edit);
+ }
+ }
+ }
+ return false;
+ }
+
+
+ private static int findPositionForImport(ICompilationUnit compilationUnit) throws JavaModelException{
+ if(compilationUnit.getImportContainer().exists()){
+ return compilationUnit.getImportContainer().getSourceRange().getOffset()+compilationUnit.getImportContainer().getSourceRange().getLength();
+ }else{
+ IPackageDeclaration[] packageDeclarations = compilationUnit.getPackageDeclarations();
+ if(packageDeclarations.length == 0){
+ return 0;
+ }
+ int position = 0;
+ for(IPackageDeclaration declaration : packageDeclarations){
+ position = declaration.getSourceRange().getOffset()+declaration.getSourceRange().getLength();
+ }
+ return position;
+ }
+ }
+
+ private static boolean isDuplicate(MultiTextEdit rootEdit, String text){
+ for(TextEdit edit : rootEdit.getChildren()){
+ if(edit instanceof InsertEdit && ((InsertEdit) edit).getText().equals(text))
+ return true;
+ }
+ return false;
+ }
+
+ public static void addAnnotation(String qualifiedName, ICompilationUnit compilationUnit, IJavaElement element) throws JavaModelException{
+ addAnnotation(qualifiedName, compilationUnit, element, "");
+ }
+ public static void updateAnnotation(String qualifiedName, ICompilationUnit compilationUnit, IJavaElement element, String params) throws JavaModelException{
+ updateAnnotation(qualifiedName, compilationUnit, element, params, null);
+ }
+
+ public static void updateAnnotation(String qualifiedName, ICompilationUnit compilationUnit, IJavaElement element, String params, MultiTextEdit rootEdit) throws JavaModelException{
+ IJavaElement workingCopyElement = findWorkingCopy(compilationUnit, element);
+ if(workingCopyElement == null){
+ return;
+ }
+
+ if(!(workingCopyElement instanceof IMember))
+ return;
+
+ IMember workingCopyMember = (IMember) workingCopyElement;
+
+ IAnnotation annotation = findAnnotation(workingCopyMember, qualifiedName);
+ if(annotation == null || !annotation.exists())
+ return;
+
+ boolean duplicateShortName = addImport(qualifiedName, compilationUnit, null);
+
+ IBuffer buffer = compilationUnit.getBuffer();
+ String shortName = getShortName(qualifiedName);
+
+ if(duplicateShortName)
+ shortName = qualifiedName;
+
+ String newValue = AT+shortName+params;
+
+ if(!annotation.getSource().equals(newValue)){
+ if(rootEdit != null){
+ TextEdit edit = new ReplaceEdit(annotation.getSourceRange().getOffset(), annotation.getSourceRange().getLength(), newValue);
+ rootEdit.addChild(edit);
+ }else{
+ buffer.replace(annotation.getSourceRange().getOffset(), annotation.getSourceRange().getLength(), newValue);
+
+ synchronized(compilationUnit) {
+ compilationUnit.reconcile(ICompilationUnit.NO_AST, true, null, null);
+ }
+ }
+ }
+
+ }
+
+ public static void addAnnotation(String qualifiedName, ICompilationUnit compilationUnit, IJavaElement element, String params) throws JavaModelException{
+ addAnnotation(qualifiedName, compilationUnit, element, params, null);
+ }
+
+ public static void addAnnotation(String qualifiedName, ICompilationUnit compilationUnit, IJavaElement element, String params, MultiTextEdit rootEdit) throws JavaModelException{
+ IJavaElement workingCopyElement = findWorkingCopy(compilationUnit, element);
+ if(workingCopyElement == null){
+ return;
+ }
+
+ if(!(workingCopyElement instanceof IMember))
+ return;
+
+ IMember workingCopyMember = (IMember) workingCopyElement;
+
+ IAnnotation annotation = findAnnotation(workingCopyMember, qualifiedName);
+ if(annotation != null && annotation.exists())
+ return;
+
+ boolean duplicateShortName = addImport(qualifiedName, compilationUnit, rootEdit);
+
+ IBuffer buffer = compilationUnit.getBuffer();
+ String shortName = getShortName(qualifiedName);
+
+ if(duplicateShortName)
+ shortName = qualifiedName;
+
+ String str = AT+shortName+params;
+
+ if(workingCopyMember instanceof IType){
+ str += compilationUnit.findRecommendedLineSeparator();
+ }else{
+ str += SPACE;
+ }
+
+ if(rootEdit != null){
+ TextEdit edit = new InsertEdit(workingCopyMember.getSourceRange().getOffset(), str);
+ rootEdit.addChild(edit);
+ }else{
+ buffer.replace(workingCopyMember.getSourceRange().getOffset(), 0, str);
+
+ synchronized(compilationUnit) {
+ compilationUnit.reconcile(ICompilationUnit.NO_AST, true, null, null);
+ }
+ }
+
+
+
+ }
+
+ public static void addQualifier(String qualifiedName, String value, ICompilationUnit compilationUnit, IJavaElement element, MultiTextEdit rootEdit) throws JavaModelException{
+ if(!(element instanceof ISourceReference))
+ return;
+ IAnnotation annotation = findAnnotation(element, qualifiedName);
+ if(annotation != null && annotation.exists())
+ return;
+
+ boolean duplicateShortName = addImport(qualifiedName, compilationUnit, rootEdit);
+
+ String lineDelim = SPACE;
+
+ IBuffer buffer = compilationUnit.getBuffer();
+ String shortName = getShortName(qualifiedName);
+
+ if(!value.isEmpty())
+ value = "(\""+value+"\")";
+
+ if(duplicateShortName)
+ shortName = qualifiedName;
+
+ annotation = findAnnotation(element, CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
+
+ if(rootEdit != null){
+ if(annotation != null && annotation.exists()){
+ TextEdit edit = new InsertEdit(annotation.getSourceRange().getOffset()+annotation.getSourceRange().getLength(), lineDelim+AT+shortName+value);
+ rootEdit.addChild(edit);
+ }else{
+ TextEdit edit = new InsertEdit(((ISourceReference)element).getSourceRange().getOffset(), AT+shortName+value+lineDelim);
+ rootEdit.addChild(edit);
+ }
+ }else{
+ if(annotation != null && annotation.exists()){
+ buffer.replace(annotation.getSourceRange().getOffset()+annotation.getSourceRange().getLength(), 0, lineDelim+AT+shortName+value);
+ }else{
+ buffer.replace(((ISourceReference)element).getSourceRange().getOffset(), 0, AT+shortName+value+lineDelim);
+ }
+
+ synchronized(compilationUnit) {
+ compilationUnit.reconcile(ICompilationUnit.NO_AST, true, null, null);
+ }
+ }
+ }
+
+ public static void updateQualifier(String qualifiedName, String value, ICompilationUnit compilationUnit, IJavaElement element, MultiTextEdit rootEdit) throws JavaModelException{
+ if(!(element instanceof ISourceReference))
+ return;
+ IAnnotation annotation = findAnnotation(element, qualifiedName);
+ if(annotation == null || !annotation.exists())
+ return;
+
+ boolean duplicateShortName = addImport(qualifiedName, compilationUnit, rootEdit);
+
+ IBuffer buffer = compilationUnit.getBuffer();
+ String shortName = getShortName(qualifiedName);
+
+ if(!value.isEmpty())
+ value = "(\""+value+"\")";
+
+ if(duplicateShortName)
+ shortName = qualifiedName;
+
+ String newValue = AT+shortName+value;
+
+ if(!annotation.getSource().equals(newValue)){
+ if(rootEdit != null){
+ TextEdit edit = new ReplaceEdit(annotation.getSourceRange().getOffset(), annotation.getSourceRange().getLength(), newValue);
+ rootEdit.addChild(edit);
+ }else{
+ buffer.replace(annotation.getSourceRange().getOffset(), annotation.getSourceRange().getLength(), newValue);
+
+ synchronized(compilationUnit) {
+ compilationUnit.reconcile(ICompilationUnit.NO_AST, true, null, null);
+ }
+ }
+ }
+ }
+
+ public static String getShortName(String qualifiedName){
+ int lastDot = qualifiedName.lastIndexOf(DOT);
+ String name;
+ if(lastDot < 0)
+ name = qualifiedName;
+ else
+ name = qualifiedName.substring(lastDot+1);
+ return name;
+ }
+
+ public static String getPackageName(String qualifiedName){
+ int lastDot = qualifiedName.lastIndexOf(DOT);
+ String name;
+ if(lastDot < 0)
+ name = "";
+ else
+ name = qualifiedName.substring(0, lastDot);
+ return name;
+ }
+
+ public static String[] getShortNames(String[] qualifiedNames){
+ String[] shortNames = new String[qualifiedNames.length];
+ for(int i = 0; i < qualifiedNames.length; i++){
+ shortNames[i] = getShortName(qualifiedNames[i]);
+ }
+ return shortNames;
+ }
+
+ public static String getTotalList(String[] names){
+ String list = "";
+ for(int i = 0; i < names.length; i++){
+ if(i != 0)
+ list += ", ";
+ list += names[i];
+ }
+ return list;
+ }
+
+ public static IAnnotation findAnnotation(IJavaElement element, String qualifiedName){
+ if(element instanceof IAnnotatable){
+ String name = getShortName(qualifiedName);
+ IAnnotation annotation = ((IAnnotatable)element).getAnnotation(qualifiedName);
+ if (!annotation.exists()) {
+ annotation = ((IAnnotatable)element).getAnnotation(name);
+ } else {
+ return annotation;
+ }
+ if(annotation.exists()) {
+ IType type=null;
+ if(element instanceof IType){
+ type = (IType)element;
+ }else if(element instanceof IMember){
+ type = ((IMember)element).getDeclaringType();
+ }else if(element instanceof ITypeParameter){
+ type = ((ITypeParameter)element).getDeclaringMember().getDeclaringType();
+ }else if(element instanceof ILocalVariable){
+ type = ((ILocalVariable)element).getDeclaringMember().getDeclaringType();
+ }
+ if (type != null && annotation != null && qualifiedName.equals(EclipseJavaUtil.resolveType(type, name))) {
+ return annotation;
+ }
+ }
+ }
+ return null;
+ }
+
+ private static boolean contains(IQualifierDeclaration declaration, List<ValuedQualifier> declarations){
+ for(ValuedQualifier d : declarations){
+ if(declaration.getQualifier().getSourceType().getFullyQualifiedName().equals(d.getQualifier().getSourceType().getFullyQualifiedName()))
+ return true;
+ }
+ return false;
+ }
+
+ private static List<IQualifier> findQualifiersToDelete(IInjectionPoint injectionPoint, List<ValuedQualifier> qualifiers){
+ ArrayList<IQualifier> list = new ArrayList<IQualifier>();
+ Set<IQualifierDeclaration> declarations = injectionPoint.getQualifierDeclarations();
+ for(IQualifierDeclaration declaration : declarations){
+ if(!contains(declaration, qualifiers))
+ list.add(declaration.getQualifier());
+ }
+ return list;
+ }
+
+ private static void addQualifiersToParameter(ICompilationUnit compilationUnit, IInjectionPoint injectionPoint, List<ValuedQualifier> declarations, MultiTextEdit rootEdit){
+ HashMap<IQualifier, Boolean> duplicants = new HashMap<IQualifier, Boolean>();
+ if(!(injectionPoint instanceof IInjectionPointParameter))
+ return;
+ try{
+ for(ValuedQualifier declaration : declarations){
+ String qualifierName = declaration.getQualifier().getSourceType().getFullyQualifiedName();
+ boolean duplicant = false;
+ if(!qualifierName.equals(CDIConstants.ANY_QUALIFIER_TYPE_NAME) &&
+ !qualifierName.equals(CDIConstants.DEFAULT_QUALIFIER_TYPE_NAME)){
+ duplicant = addImport(qualifierName, compilationUnit, rootEdit);
+ }
+ duplicants.put(declaration.getQualifier(), new Boolean(duplicant));
+ }
+
+ String paramName = ((IInjectionPointParameter)injectionPoint).getName();
+ IMethod method = ((IInjectionPointParameter)injectionPoint).getBeanMethod().getMethod();
+ IType type = method.getDeclaringType();
+ IType t = compilationUnit.getType(type.getElementName());
+ IMethod m = t.getMethod(method.getElementName(), method.getParameterTypes());
+
+ IBuffer buffer = compilationUnit.getBuffer();
+
+ ILocalVariable[] parameters = m.getParameters();
+ for(int index = 0; index < parameters.length; index++){
+ if(parameters[index].getElementName().equals(paramName)){
+ StringBuffer b = new StringBuffer();
+ if(index > 0)
+ b.append(SPACE);
+ for(ValuedQualifier declaration : declarations){
+ String qualifierName = declaration.getQualifier().getSourceType().getFullyQualifiedName();
+ String value = declaration.getValue();
+
+ if(!value.isEmpty())
+ value = "(\""+value+"\")";
+
+ if(!qualifierName.equals(CDIConstants.ANY_QUALIFIER_TYPE_NAME) && !qualifierName.equals(CDIConstants.DEFAULT_QUALIFIER_TYPE_NAME)){
+ boolean duplicant = duplicants.get(declaration.getQualifier()).booleanValue();
+ String annotation = getShortName(qualifierName);
+ if(duplicant)
+ annotation = qualifierName;
+ b.append(AT+annotation+value+SPACE);
+ }
+ }
+ b.append(Signature.getSignatureSimpleName(parameters[index].getTypeSignature())+SPACE);
+ b.append(parameters[index].getElementName());
+
+ String newValue = b.toString();
+
+ if(!parameters[index].getSource().equals(newValue)){
+ if(rootEdit != null){
+ TextEdit edit = new ReplaceEdit(parameters[index].getSourceRange().getOffset(), parameters[index].getSourceRange().getLength(), b.toString());
+ rootEdit.addChild(edit);
+ }else{
+ buffer.replace(parameters[index].getSourceRange().getOffset(), parameters[index].getSourceRange().getLength(), b.toString());
+
+ synchronized(compilationUnit) {
+ compilationUnit.reconcile(ICompilationUnit.NO_AST, true, null, null);
+ }
+ }
+ }
+ }
+ }
+
+ }catch(JavaModelException ex){
+ CDICorePlugin.getDefault().logError(ex);
+ }
+ }
+
+ public static ISourceRange getParameterRegion(IInjectionPointParameter injectionParameter){
+ try{
+ String paramName = injectionParameter.getName();
+ IMethod method = injectionParameter.getBeanMethod().getMethod();
+
+ for(ILocalVariable parameter : method.getParameters()){
+ if(parameter.getElementName().equals(paramName)){
+ return parameter.getSourceRange();
+ }
+ }
+ }catch(JavaModelException ex){
+ CDICorePlugin.getDefault().logError(ex);
+ }
+ return null;
+ }
+
+ public static void addQualifiersToInjectionPoint(List<ValuedQualifier> deployed, IInjectionPoint injectionPoint, ICompilationUnit compilationUnit, MultiTextEdit edit){
+ try{
+ if(injectionPoint instanceof IInjectionPointParameter){
+ addQualifiersToParameter(compilationUnit, injectionPoint, deployed, edit);
+ }else{
+ IJavaElement element = getInjectedJavaElement(compilationUnit, injectionPoint);
+ if(element == null || !element.exists())
+ return;
+
+ // delete unneeded qualifiers
+ List<IQualifier> toDelete = findQualifiersToDelete(injectionPoint, deployed);
+
+ for(IQualifier qualifier : toDelete){
+ deleteAnnotation(qualifier.getSourceType().getFullyQualifiedName(), compilationUnit, element, edit);
+ }
+
+ for(ValuedQualifier declaration : deployed){
+ String qualifierName = declaration.getQualifier().getSourceType().getFullyQualifiedName();
+ String value = declaration.getValue();
+ if(!qualifierName.equals(CDIConstants.ANY_QUALIFIER_TYPE_NAME) && !qualifierName.equals(CDIConstants.DEFAULT_QUALIFIER_TYPE_NAME)){
+ addQualifier(qualifierName, value, compilationUnit, element, edit);
+ updateQualifier(qualifierName, value, compilationUnit, element, edit);
+ }
+ }
+ }
+ }catch(CoreException ex){
+ CDICorePlugin.getDefault().logError(ex);
+ }
+
+ }
+
+ public static void addQualifiersToBean(List<ValuedQualifier> deployed, IBean bean, ICompilationUnit compilationUnit, MultiTextEdit edit){
+ IJavaElement beanElement = null;
+ if(bean instanceof IBeanField){
+ beanElement = ((IBeanField) bean).getField();
+ }else if(bean instanceof IBeanMethod){
+ beanElement = ((IBeanMethod) bean).getMethod();
+ }else{
+ beanElement = bean.getBeanClass();
+ }
+
+ try{
+ for(IQualifierDeclaration declaration : bean.getQualifierDeclarations()){
+ IQualifier qualifier = declaration.getQualifier();
+ String qualifierName = qualifier.getSourceType().getFullyQualifiedName();
+ if(!isQualifierNeeded(deployed, qualifier)){
+ deleteAnnotation(qualifierName, compilationUnit, beanElement, edit);
+ }
+ }
+
+ for(ValuedQualifier vq : deployed){
+ String qualifierName = vq.getQualifier().getSourceType().getFullyQualifiedName();
+ String value = vq.getValue();
+ String elName = getELName(bean);
+
+ if(!value.isEmpty() && (!value.equals(elName) || !qualifierName.equals(CDIConstants.NAMED_QUALIFIER_TYPE_NAME))){
+ value = "(\""+value+"\")";
+ }else{
+ value = "";
+ }
+
+ if(!qualifierName.equals(CDIConstants.ANY_QUALIFIER_TYPE_NAME) && !qualifierName.equals(CDIConstants.DEFAULT_QUALIFIER_TYPE_NAME)){
+ addAnnotation(qualifierName, compilationUnit, beanElement, value, edit);
+ updateAnnotation(qualifierName, compilationUnit, beanElement, value, edit);
+ }
+
+ }
+ }catch(CoreException ex){
+ CDICorePlugin.getDefault().logError(ex);
+ }
+
+ }
+
+ private static boolean isQualifierNeeded(List<ValuedQualifier> vQualifiers, IQualifier qualifier){
+ for(ValuedQualifier vq : vQualifiers){
+ if(vq.getQualifier().equals(qualifier))
+ return true;
+ }
+ return false;
+ }
+
+ public static void addInterfaceToClass(ICompilationUnit compilationUnit, IType type, String qualifiedName) throws JavaModelException{
+ String shortName = getShortName(qualifiedName);
+
+ IType[] types = compilationUnit.getTypes();
+ IType workingType = null;
+ for(IType t : types){
+ if(t.getElementName().equals(type.getElementName())){
+ workingType = t;
+ break;
+ }
+ }
+
+ if(workingType != null){
+ addImport(qualifiedName, compilationUnit, null);
+
+ IBuffer buffer = compilationUnit.getBuffer();
+
+ String text = buffer.getText(workingType.getSourceRange().getOffset(), workingType.getSourceRange().getLength());
+
+ int namePosition = text.indexOf(workingType.getElementName());
+ if(namePosition >= 0){
+ int implementsPosition = text.indexOf(IMPLEMENTS,namePosition);
+ if(implementsPosition > 0){
+ buffer.replace(workingType.getSourceRange().getOffset()+implementsPosition+IMPLEMENTS.length(),0,SPACE+shortName+COMMA);
+ }else{
+ int extedsPosition = text.indexOf(EXTENDS,namePosition);
+ if(extedsPosition > 0){
+ int bracePosition = text.indexOf(OPEN_BRACE, extedsPosition);
+ String str = IMPLEMENTS+SPACE+shortName+SPACE;
+ if(!text.substring(bracePosition-1,bracePosition).equals(SPACE))
+ str = SPACE+str;
+ buffer.replace(workingType.getSourceRange().getOffset()+bracePosition,0,str);
+ }else{
+ buffer.replace(workingType.getSourceRange().getOffset()+namePosition+workingType.getElementName().length(),0,SPACE+IMPLEMENTS+SPACE+shortName);
+ }
+ }
+ }
+ }
+
+ }
+
+ private static IJavaElement getInjectedJavaElement(ICompilationUnit compilationUnit, IInjectionPoint injectionPoint){
+ if(injectionPoint instanceof IInjectionPointField){
+ IField field = ((IInjectionPointField)injectionPoint).getField();
+ IType type = field.getDeclaringType();
+ IType t = compilationUnit.getType(type.getElementName());
+ IField f = t.getField(field.getElementName());
+
+ return f;
+ }else if(injectionPoint instanceof IInjectionPointParameter){
+ IMethod method = ((IInjectionPointParameter)injectionPoint).getBeanMethod().getMethod();
+ IType type = method.getDeclaringType();
+ IType t = compilationUnit.getType(type.getElementName());
+ IMethod m = t.getMethod(method.getElementName(), method.getParameterTypes());
+ // Why method? Why not Java element for parameter?
+ return m;
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T extends IJavaElement> T findWorkingCopy(ICompilationUnit compilationUnit, T element) throws JavaModelException{
+ if(element instanceof IAnnotation){
+ IJavaElement parent = findWorkingCopy(compilationUnit, element.getParent());
+ if(parent instanceof IAnnotatable){
+ for(IAnnotation a : ((IAnnotatable)parent).getAnnotations()){
+ if(a.getElementName().equals(element.getElementName()))
+ return (T)a;
+ }
+ }
+ }else if(element instanceof ILocalVariable && ((ILocalVariable) element).isParameter()){
+ IJavaElement parent = findWorkingCopy(compilationUnit, element.getParent());
+ if(parent instanceof IMethod){
+ for(ILocalVariable parameter : ((IMethod)parent).getParameters()){
+ if(parameter.getElementName().equals(element.getElementName()) && parameter.getTypeSignature().equals(((ILocalVariable)element).getTypeSignature()))
+ return (T)parameter;
+ }
+ }
+ }else{
+ IJavaElement[] elements = compilationUnit.findElements(element);
+ if(elements != null){
+ for(IJavaElement e : elements){
+ if(e.getClass().equals(element.getClass()))
+ return (T)e;
+ }
+ }
+ }
+ return null;
+ }
+
+ public static void deleteAnnotation(String qualifiedName, ICompilationUnit compilationUnit, IJavaElement element) throws JavaModelException{
+ deleteAnnotation(qualifiedName, compilationUnit, element, null);
+ }
+
+ public static void deleteAnnotation(String qualifiedName, ICompilationUnit compilationUnit, IJavaElement element, MultiTextEdit rootEdit) throws JavaModelException{
+ IJavaElement workingCopyElement = findWorkingCopy(compilationUnit, element);
+ if(workingCopyElement == null){
+ return;
+ }
+
+ IAnnotation annotation = findAnnotation(workingCopyElement, qualifiedName);
+ if(annotation != null){
+ IBuffer buffer = compilationUnit.getBuffer();
+
+ int position = annotation.getSourceRange().getOffset() + annotation.getSourceRange().getLength();
+ int numberOfSpaces = 0;
+ if(position < buffer.getLength()-1){
+ char c = buffer.getChar(position);
+ while((c == ' ' || c == '\t' || c == '\n' || c == '\r') && position < buffer.getLength()-1){
+ numberOfSpaces++;
+ position++;
+ c = buffer.getChar(position);
+ }
+ }
+
+ // delete annotation
+ if(rootEdit != null){
+ TextEdit edit = new DeleteEdit(annotation.getSourceRange().getOffset(), annotation.getSourceRange().getLength());
+ rootEdit.addChild(edit);
+ }else{
+ buffer.replace(annotation.getSourceRange().getOffset(), annotation.getSourceRange().getLength()+numberOfSpaces, "");
+ }
+
+ // check and delete import
+ IImportDeclaration importDeclaration = compilationUnit.getImport(qualifiedName);
+ IImportContainer importContainer = compilationUnit.getImportContainer();
+ if(importDeclaration.exists() && importContainer.exists()){
+ int importSize = importContainer.getSourceRange().getOffset()+importContainer.getSourceRange().getLength();
+
+ if(rootEdit != null){
+ int annotationStart = annotation.getSourceRange().getOffset();
+ int annotationEnd = annotationStart+annotation.getSourceRange().getLength();
+ String textBefore = buffer.getText(importSize, annotationStart-importSize);
+ String textAfter = buffer.getText(annotationEnd, buffer.getLength()-annotationEnd);
+ if(checkImport(textBefore, qualifiedName) && checkImport(textAfter, qualifiedName)){
+ TextEdit edit = new DeleteEdit(importDeclaration.getSourceRange().getOffset(), importDeclaration.getSourceRange().getLength());
+ rootEdit.addChild(edit);
+ }
+ }else{
+ String text = buffer.getText(importSize, buffer.getLength()-importSize);
+ if(checkImport(text, qualifiedName)){
+ importDeclaration.delete(false, new NullProgressMonitor());
+ }
+ }
+ }
+
+ if(rootEdit == null){
+ synchronized(compilationUnit) {
+ compilationUnit.reconcile(ICompilationUnit.NO_AST, true, null, null);
+ }
+ }
+ }
+ }
+
+ private static boolean checkImport(String text, String qualifiedName){
+ String name = getShortName(qualifiedName);
+
+ Pattern p = Pattern.compile(".*\\W"+name+"\\W.*",Pattern.DOTALL); //$NON-NLS-1$ //$NON-NLS-2$
+ Matcher m = p.matcher(text);
+ return !m.matches();
+ }
+
+ public static IMember getJavaMember(IJavaElement element){
+ while(element != null){
+ if(element instanceof IMember)
+ return (IMember)element;
+ element = element.getParent();
+ }
+ return null;
+ }
+
+ public static boolean checkBeanQualifiers(IBean selectedBean, IBean bean, Set<IQualifier> qualifiers){
+ HashSet<ValuedQualifier> valuedQualifiers = new HashSet<ValuedQualifier>();
+ for(IQualifier qualifier : qualifiers){
+ valuedQualifiers.add(new ValuedQualifier(qualifier));
+ }
+ return checkValuedQualifiers(selectedBean, bean, valuedQualifiers);
+ }
+
+ public static boolean checkValuedQualifiers(IBean selectedBean, IBean bean, Set<ValuedQualifier> qualifiers){
+ for(ValuedQualifier qualifier : qualifiers){
+ if(!isBeanContainQualifier(bean, qualifier)){
+ return false;
+ }
+ }
+ if(bean.getQualifiers().size() == qualifiers.size())
+ return true;
+ return false;
+ }
+
+ private static boolean isBeanContainQualifier(IBean bean, ValuedQualifier valuedQualifier){
+
+ Set<IQualifier> qualifiers = bean.getQualifiers();
+ for(IQualifier q : qualifiers){
+ if(q.getSourceType().getFullyQualifiedName().equals(valuedQualifier.getQualifier().getSourceType().getFullyQualifiedName()))
+ return true;
+ }
+ return false;
+ }
+
+ public static String findQualifierValue(IBean bean, IQualifier qualifier){
+ IQualifierDeclaration declaration = findQualifierDeclaration(bean, qualifier);
+ if(declaration == null)
+ return "";
+
+ return findQualifierValue(bean, declaration);
+ }
+
+ public static String findQualifierValue(IBean bean, IQualifierDeclaration declaration){
+ Object value = declaration.getMemberValue(null);
+
+ String result = value == null ? "" : value.toString();
+
+ if("".equals(result) && declaration.getQualifier().getSourceType().getFullyQualifiedName().equals(CDIConstants.NAMED_QUALIFIER_TYPE_NAME))
+ result = getELName(bean);
+
+ return result;
+ }
+
+ public static IQualifierDeclaration findQualifierDeclaration(IBean bean, IQualifier qualifier){
+ Set<IQualifierDeclaration> declarations = bean.getQualifierDeclarations();
+
+ if(declarations == null)
+ return null;
+
+ for(IQualifierDeclaration declaration : declarations){
+ if(declaration.getQualifier().getSourceType().getFullyQualifiedName().equals(qualifier.getSourceType().getFullyQualifiedName()))
+ return declaration;
+ }
+ return null;
+ }
+
+ public static String getELName(IBean bean){
+ String name;
+ if(bean instanceof IBeanField){
+ name = ((IBeanField) bean).getField().getElementName();
+ }else if(bean instanceof IBeanMethod){
+ name = ((IBeanMethod) bean).getMethod().getElementName();
+ if(BeanUtil.isGetter(((IBeanMethod) bean).getMethod())) {
+ return BeanUtil.getPropertyName(name);
+ }
+ }else{
+ name = bean.getBeanClass().getElementName();
+ if(name.length() > 0) {
+ name = name.substring(0, 1).toLowerCase() + name.substring(1);
+ }
+ }
+
+ return name;
+ }
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/MarkerResolutionUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/ValuedQualifier.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/ValuedQualifier.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/ValuedQualifier.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.internal.core.refactoring;
+
+import org.jboss.tools.cdi.core.IQualifier;
+
+public class ValuedQualifier{
+ private IQualifier qualifier;
+ private String value="";
+
+ public ValuedQualifier(IQualifier qualifier){
+ this.qualifier = qualifier;
+ }
+
+ public ValuedQualifier(IQualifier qualifier, String value){
+ this(qualifier);
+ this.value = value;
+ }
+
+ public IQualifier getQualifier(){
+ return qualifier;
+ }
+
+ public String getValue(){
+ return value;
+ }
+
+ public void setValue(String value){
+ this.value = value;
+ }
+
+ public boolean equals(Object obj) {
+ if(obj instanceof ValuedQualifier)
+ return getQualifier().getSourceType().getFullyQualifiedName().equals(((ValuedQualifier)obj).getQualifier().getSourceType().getFullyQualifiedName());
+ return false;
+ }
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/ValuedQualifier.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/CDISeamResourceLoadingHyperlinkDetector.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/CDISeamResourceLoadingHyperlinkDetector.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/CDISeamResourceLoadingHyperlinkDetector.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -31,8 +31,8 @@
import org.eclipse.jface.text.hyperlink.AbstractHyperlinkDetector;
import org.eclipse.jface.text.hyperlink.IHyperlink;
import org.eclipse.ui.texteditor.ITextEditor;
+import org.jboss.tools.cdi.internal.core.refactoring.MarkerResolutionUtils;
import org.jboss.tools.cdi.seam.text.ext.CDISeamExtPlugin;
-import org.jboss.tools.cdi.ui.marker.MarkerResolutionUtils;
import org.jboss.tools.common.EclipseUtil;
public class CDISeamResourceLoadingHyperlinkDetector extends AbstractHyperlinkDetector{
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddAnnotationMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddAnnotationMarkerResolution.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddAnnotationMarkerResolution.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -24,6 +24,7 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.core.CDIImages;
+import org.jboss.tools.cdi.internal.core.refactoring.MarkerResolutionUtils;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
Deleted: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddQualifiersToBeanProcessor.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddQualifiersToBeanProcessor.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddQualifiersToBeanProcessor.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 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.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-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.text.edits.MultiTextEdit;
-import org.jboss.tools.cdi.core.CDICoreMessages;
-import org.jboss.tools.cdi.core.IBean;
-import org.jboss.tools.cdi.core.IInjectionPoint;
-import org.jboss.tools.cdi.ui.refactoring.CDIRefactoringProcessor;
-import org.jboss.tools.cdi.ui.wizard.xpl.AddQualifiersToBeanComposite.ValuedQualifier;
-import org.jboss.tools.common.EclipseUtil;
-
-public class AddQualifiersToBeanProcessor extends CDIRefactoringProcessor {
- protected IBean selectedBean;
- protected IInjectionPoint injectionPoint;
- protected List<IBean> beans;
- protected ArrayList<ValuedQualifier> qualifiers;
-
- public AddQualifiersToBeanProcessor(String label, IInjectionPoint injectionPoint, List<IBean> beans, IBean bean) {
- super(label);
- this.selectedBean = bean;
- this.injectionPoint = injectionPoint;
- this.beans = beans;
- }
-
- @Override
- public RefactoringStatus checkInitialConditions(IProgressMonitor pm)
- throws CoreException, OperationCanceledException {
- status = new RefactoringStatus();
-
- if(injectionPoint == null){
- status.addFatalError(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_INJECTION_POINT_NOT_FOUND);
- return status;
- }
-
- IFile injectionPointFile = (IFile)injectionPoint.getClassBean().getResource();
-
- isFileCorrect(injectionPointFile);
-
- return status;
- }
-
- @Override
- public RefactoringStatus checkFinalConditions(IProgressMonitor pm,
- CheckConditionsContext context) throws CoreException,
- OperationCanceledException {
-
- if(selectedBean == null){
- status.addFatalError(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_BEAN_NOT_FOUND);
- return status;
- }
-
- IFile beanFile = (IFile)selectedBean.getBeanClass().getResource();
-
- if(!isFileCorrect(beanFile)){
- return status;
- }
- return status;
- }
-
- private ICompilationUnit getCompilationUnit(IFile file) throws CoreException{
- IProject project = file.getProject();
- IJavaProject javaProject = (IJavaProject)project.getNature(JavaCore.NATURE_ID);
- IJavaElement element = javaProject.findElement(file.getProjectRelativePath());
- if(element instanceof ICompilationUnit)
- return (ICompilationUnit)element;
-
- return null;
- }
-
- @Override
- public Change createChange(IProgressMonitor pm) throws CoreException,
- OperationCanceledException {
- rootChange = new CompositeChange(label);
-
- IFile file = (IFile)selectedBean.getBeanClass().getResource();
- ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
-
- ICompilationUnit compilationUnit = original.getWorkingCopy(pm);
-
- TextFileChange fileChange = new CDIFileChange(file.getName(), file);
- if(getEditor(file) != null)
- fileChange.setSaveMode(TextFileChange.LEAVE_DIRTY);
- else
- fileChange.setSaveMode(TextFileChange.FORCE_SAVE);
-
- MultiTextEdit edit = new MultiTextEdit();
-
- MarkerResolutionUtils.addQualifiersToBean(qualifiers, selectedBean, compilationUnit, edit);
-
- IFile file2 = (IFile)injectionPoint.getClassBean().getResource();
- ICompilationUnit original2 = injectionPoint.getClassBean().getBeanClass().getCompilationUnit();
- ICompilationUnit compilationUnit2 = original2.getWorkingCopy(pm);
-
- if(!original.equals(original2)){
- compilationUnit.discardWorkingCopy();
- if(edit.getChildrenSize() > 0){
- fileChange.setEdit(edit);
- rootChange.add(fileChange);
- }
- fileChange = new CDIFileChange(file2.getName(), file2);
- if(getEditor(file2) != null)
- fileChange.setSaveMode(TextFileChange.LEAVE_DIRTY);
- else
- fileChange.setSaveMode(TextFileChange.FORCE_SAVE);
-
- edit = new MultiTextEdit();
- }else{
- compilationUnit2 = compilationUnit;
- }
-
- MarkerResolutionUtils.addQualifiersToInjectionPoint(qualifiers, injectionPoint, compilationUnit2, edit);
-
- if(edit.getChildrenSize() > 0){
- fileChange.setEdit(edit);
- rootChange.add(fileChange);
- }
- compilationUnit.discardWorkingCopy();
- return rootChange;
- }
-
- protected void createRootChange(){
-
- }
-
- public IBean getSelectedBean(){
- return selectedBean;
- }
-
- public IInjectionPoint getInjectionPoint(){
- return injectionPoint;
- }
-
- public List<IBean> getBeans(){
- return beans;
- }
-
- public void setSelectedBean(IBean bean){
- selectedBean = bean;
- }
-
- public void setDeployedQualifiers(ArrayList<ValuedQualifier> qualifiers){
- this.qualifiers = qualifiers;
- }
-
-}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddRetentionAnnotationMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddRetentionAnnotationMarkerResolution.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddRetentionAnnotationMarkerResolution.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -20,6 +20,7 @@
import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDIImages;
+import org.jboss.tools.cdi.internal.core.refactoring.MarkerResolutionUtils;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddSerializableInterfaceMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddSerializableInterfaceMarkerResolution.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddSerializableInterfaceMarkerResolution.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -21,6 +21,7 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.core.CDIImages;
+import org.jboss.tools.cdi.internal.core.refactoring.MarkerResolutionUtils;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
import org.jboss.tools.common.EclipseUtil;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddTargetAnnotationMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddTargetAnnotationMarkerResolution.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddTargetAnnotationMarkerResolution.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -20,6 +20,7 @@
import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDIImages;
+import org.jboss.tools.cdi.internal.core.refactoring.MarkerResolutionUtils;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
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 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -50,6 +50,7 @@
import org.jboss.tools.cdi.core.IStereotype;
import org.jboss.tools.cdi.core.IStereotyped;
import org.jboss.tools.cdi.internal.core.impl.CDIProject;
+import org.jboss.tools.cdi.internal.core.refactoring.MarkerResolutionUtils;
import org.jboss.tools.cdi.internal.core.validation.CDIValidationErrorManager;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
import org.jboss.tools.common.EclipseUtil;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/ChangeAnnotationMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/ChangeAnnotationMarkerResolution.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/ChangeAnnotationMarkerResolution.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -22,6 +22,7 @@
import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDIImages;
+import org.jboss.tools.cdi.internal.core.refactoring.MarkerResolutionUtils;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CreateCDIElementMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CreateCDIElementMarkerResolution.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CreateCDIElementMarkerResolution.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -20,6 +20,7 @@
import org.eclipse.ui.IMarkerResolution2;
import org.eclipse.ui.PlatformUI;
import org.jboss.tools.cdi.core.CDIImages;
+import org.jboss.tools.cdi.internal.core.refactoring.MarkerResolutionUtils;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.wizard.NewBeanCreationWizard;
import org.jboss.tools.cdi.ui.wizard.NewCDIElementWizard;
Deleted: 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 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerAnnotationsProcessor.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -1,81 +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.cdi.ui.marker;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-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.RefactoringStatus;
-import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
-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.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.refactoring.CDIRefactoringProcessor;
-import org.jboss.tools.common.text.ITextSourceReference;
-
-public class DeleteAllDisposerAnnotationsProcessor extends CDIRefactoringProcessor {
- private IMethod method;
-
- public DeleteAllDisposerAnnotationsProcessor(IFile file, IMethod method, String label){
- super(file, label);
- this.method = method;
- }
-
- 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);
- 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);
- }
- }
- }
- }
- }
- }
-
- @Override
- public RefactoringStatus checkFinalConditions(IProgressMonitor pm,
- CheckConditionsContext context) throws CoreException,
- OperationCanceledException {
-
- createRootChange();
-
- if(bean != null)
- changeDisposers(bean);
-
- return status;
- }
-
-}
Modified: 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 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllDisposerDuplicantMarkerResolution.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -20,6 +20,7 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.core.CDIImages;
+import org.jboss.tools.cdi.internal.core.refactoring.DeleteAllDisposerAnnotationsProcessor;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.wizard.DeletePreviewWizard;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsMarkerResolution.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsMarkerResolution.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -21,6 +21,7 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.core.CDIImages;
+import org.jboss.tools.cdi.internal.core.refactoring.DeleteAllInjectedConstructorsProcessor;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.wizard.DeletePreviewWizard;
Deleted: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsProcessor.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsProcessor.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAllInjectedConstructorsProcessor.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -1,72 +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.cdi.ui.marker;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-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.RefactoringStatus;
-import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
-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.IBeanMethod;
-import org.jboss.tools.cdi.core.IClassBean;
-import org.jboss.tools.cdi.ui.refactoring.CDIRefactoringProcessor;
-import org.jboss.tools.common.java.IAnnotationDeclaration;
-
-public class DeleteAllInjectedConstructorsProcessor extends CDIRefactoringProcessor {
- private IMethod method;
-
- public DeleteAllInjectedConstructorsProcessor(IFile file, IMethod method, String label){
- super(file, label);
- this.method = method;
- }
-
- private void changeConstructors(IClassBean bean) {
- Set<IBeanMethod> constructors = bean.getBeanConstructors();
- if(constructors.size()>1) {
- Set<IAnnotationDeclaration> injects = new HashSet<IAnnotationDeclaration>();
- for (IBeanMethod constructor : constructors) {
- if(!constructor.getMethod().isSimilar(method)){
- IAnnotationDeclaration inject = constructor.getAnnotation(CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
- if(inject!=null) {
- injects.add(inject);
- }
- }
- }
- for (IAnnotationDeclaration inject : injects) {
- TextEdit edit = new ReplaceEdit(inject.getStartPosition(), inject.getLength(), "");
- change.addEdit(edit);
- }
- }
- }
-
-
- @Override
- public RefactoringStatus checkFinalConditions(IProgressMonitor pm,
- CheckConditionsContext context) throws CoreException,
- OperationCanceledException {
-
- createRootChange();
-
- if(bean != null)
- changeConstructors(bean);
-
- return status;
- }
-
-}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAnnotationMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAnnotationMarkerResolution.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/DeleteAnnotationMarkerResolution.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -24,6 +24,7 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.core.CDIImages;
+import org.jboss.tools.cdi.internal.core.refactoring.MarkerResolutionUtils;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -32,6 +32,7 @@
import org.jboss.tools.cdi.core.CDIImages;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IScopeDeclaration;
+import org.jboss.tools.cdi.internal.core.refactoring.MarkerResolutionUtils;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
import org.jboss.tools.common.EclipseUtil;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeInjectedPointUnambiguousMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeInjectedPointUnambiguousMarkerResolution.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeInjectedPointUnambiguousMarkerResolution.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -20,6 +20,7 @@
import org.jboss.tools.cdi.core.CDIImages;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IInjectionPoint;
+import org.jboss.tools.cdi.internal.core.refactoring.AddQualifiersToBeanProcessor;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.wizard.AddQualifiersToBeanWizard;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodBusinessMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodBusinessMarkerResolution.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodBusinessMarkerResolution.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -26,6 +26,7 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IMarkerResolution2;
import org.jboss.tools.cdi.core.CDIImages;
+import org.jboss.tools.cdi.internal.core.refactoring.MarkerResolutionUtils;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
import org.jboss.tools.common.EclipseUtil;
Deleted: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -1,888 +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.cdi.ui.marker;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IAnnotatable;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IBuffer;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IImportContainer;
-import org.eclipse.jdt.core.IImportDeclaration;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.ILocalVariable;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IPackageDeclaration;
-import org.eclipse.jdt.core.ISourceRange;
-import org.eclipse.jdt.core.ISourceReference;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeParameter;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.text.edits.DeleteEdit;
-import org.eclipse.text.edits.InsertEdit;
-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.IBean;
-import org.jboss.tools.cdi.core.IBeanField;
-import org.jboss.tools.cdi.core.IBeanMethod;
-import org.jboss.tools.cdi.core.IInjectionPoint;
-import org.jboss.tools.cdi.core.IInjectionPointField;
-import org.jboss.tools.cdi.core.IInjectionPointParameter;
-import org.jboss.tools.cdi.core.IQualifier;
-import org.jboss.tools.cdi.core.IQualifierDeclaration;
-import org.jboss.tools.cdi.ui.CDIUIPlugin;
-import org.jboss.tools.cdi.ui.wizard.xpl.AddQualifiersToBeanComposite.ValuedQualifier;
-import org.jboss.tools.common.model.util.EclipseJavaUtil;
-import org.jboss.tools.common.util.BeanUtil;
-
-/**
- * @author Daniel Azarov
- */
-public class MarkerResolutionUtils {
- public static final String DOT = "."; //$NON-NLS-1$
- public static final String COMMA = ","; //$NON-NLS-1$
- public static final String SEMICOLON = ";"; //$NON-NLS-1$
- public static final String SPACE = " "; //$NON-NLS-1$
- public static final String AT = "@"; //$NON-NLS-1$
- public static final String IMPLEMENTS = "implements"; //$NON-NLS-1$
- public static final String IMPORT = "import"; //$NON-NLS-1$
- public static final String EXTENDS = "extends"; //$NON-NLS-1$
- public static final String OPEN_BRACE = "{"; //$NON-NLS-1$
- public static final String CLOSE_BRACE = "}"; //$NON-NLS-1$
-
- static final HashSet<String> primitives = new HashSet<String>();
- static{
- primitives.add("void"); //$NON-NLS-1$
- primitives.add("int"); //$NON-NLS-1$
- primitives.add("java.lang.Integer"); //$NON-NLS-1$
- primitives.add("char"); //$NON-NLS-1$
- primitives.add("java.lang.Character"); //$NON-NLS-1$
- primitives.add("boolean"); //$NON-NLS-1$
- primitives.add("java.lang.Boolean"); //$NON-NLS-1$
- primitives.add("short"); //$NON-NLS-1$
- primitives.add("java.lang.Short"); //$NON-NLS-1$
- primitives.add("long"); //$NON-NLS-1$
- primitives.add("java.lang.Long"); //$NON-NLS-1$
- primitives.add("float"); //$NON-NLS-1$
- primitives.add("java.lang.Float"); //$NON-NLS-1$
- primitives.add("double"); //$NON-NLS-1$
- primitives.add("java.lang.Double"); //$NON-NLS-1$
- primitives.add("byte"); //$NON-NLS-1$
- primitives.add("java.lang.Byte"); //$NON-NLS-1$
- primitives.add("java.lang.String"); //$NON-NLS-1$
- }
-
- /**
- *
- * @param qualifiedName
- * @param compilationUnit
- * @return true if there is import in compilation unit with the same short name
- * @throws JavaModelException
- */
- public static boolean addImport(String qualifiedName, ICompilationUnit compilationUnit) throws JavaModelException{
- return addImport(qualifiedName, compilationUnit, false, null);
- }
-
- public static boolean addImport(String qualifiedName, ICompilationUnit compilationUnit, MultiTextEdit rootEdit) throws JavaModelException{
- return addImport(qualifiedName, compilationUnit, false, rootEdit);
- }
-
- /**
- *
- * @param qualifiedName
- * @param compilationUnit
- * @param staticFlag
- * @return true if there is import in compilation unit with the same short name
- * @throws JavaModelException
- */
- public static boolean addImport(String qualifiedName, ICompilationUnit compilationUnit, boolean staticFlag) throws JavaModelException{
- return addImport(qualifiedName, compilationUnit, staticFlag, null);
- }
-
- public static boolean addImport(String qualifiedName, ICompilationUnit compilationUnit, boolean staticFlag, MultiTextEdit rootEdit) throws JavaModelException{
- if(primitives.contains(qualifiedName))
- return false;
-
- if(qualifiedName != null){
- String shortName = getShortName(qualifiedName);
-
- IPackageDeclaration[] packages = compilationUnit.getPackageDeclarations();
-
- // local classes do not need to be imported
- if(qualifiedName.indexOf(DOT) >= 0){
- String typePackage = qualifiedName.substring(0,qualifiedName.lastIndexOf(DOT));
-
- for(IPackageDeclaration packageDeclaration : packages){
- if(packageDeclaration.getElementName().equals(typePackage))
- return false;
- }
-
- for(IPackageDeclaration packageDeclaration : packages){
- IType type = compilationUnit.getJavaProject().findType(packageDeclaration.getElementName()+DOT+shortName);
- if(type != null && type.exists())
- return true;
- }
- }
-
- IImportDeclaration[] importDeclarations = compilationUnit.getImports();
-
- for(IImportDeclaration importDeclaration : importDeclarations){
- String importName = importDeclaration.getElementName();
- String elementShort = getShortName(importName);
- if(importDeclaration.isOnDemand()){
- int importLastDot = importName.lastIndexOf(DOT);
- if(importLastDot == -1) return false; // invalid import declaration
- int elementLastDot = qualifiedName.lastIndexOf(DOT);
- if(elementLastDot == -1) return false; // invalid import declaration
-
- if(qualifiedName.substring(0, elementLastDot).equals(importName.substring(0, importLastDot)))
- return false;
- }
-
- if(importName.equals(qualifiedName))
- return false;
- if(elementShort.equals(shortName))
- return true;
-
- }
- if(rootEdit == null){
- if(staticFlag){
- compilationUnit.createImport(qualifiedName, null, Flags.AccStatic, new NullProgressMonitor());
- }else{
- compilationUnit.createImport(qualifiedName, null, new NullProgressMonitor());
- }
- }else{
- String text = compilationUnit.findRecommendedLineSeparator()+IMPORT+SPACE+qualifiedName+SEMICOLON;
- if(!isDuplicate(rootEdit, text)){
- int importPosition = findPositionForImport(compilationUnit);
- TextEdit edit = new InsertEdit(importPosition, text);
- rootEdit.addChild(edit);
- }
- }
- }
- return false;
- }
-
-
- private static int findPositionForImport(ICompilationUnit compilationUnit) throws JavaModelException{
- if(compilationUnit.getImportContainer().exists()){
- return compilationUnit.getImportContainer().getSourceRange().getOffset()+compilationUnit.getImportContainer().getSourceRange().getLength();
- }else{
- IPackageDeclaration[] packageDeclarations = compilationUnit.getPackageDeclarations();
- if(packageDeclarations.length == 0){
- return 0;
- }
- int position = 0;
- for(IPackageDeclaration declaration : packageDeclarations){
- position = declaration.getSourceRange().getOffset()+declaration.getSourceRange().getLength();
- }
- return position;
- }
- }
-
- private static boolean isDuplicate(MultiTextEdit rootEdit, String text){
- for(TextEdit edit : rootEdit.getChildren()){
- if(edit instanceof InsertEdit && ((InsertEdit) edit).getText().equals(text))
- return true;
- }
- return false;
- }
-
- public static void addAnnotation(String qualifiedName, ICompilationUnit compilationUnit, IJavaElement element) throws JavaModelException{
- addAnnotation(qualifiedName, compilationUnit, element, "");
- }
- public static void updateAnnotation(String qualifiedName, ICompilationUnit compilationUnit, IJavaElement element, String params) throws JavaModelException{
- updateAnnotation(qualifiedName, compilationUnit, element, params, null);
- }
-
- public static void updateAnnotation(String qualifiedName, ICompilationUnit compilationUnit, IJavaElement element, String params, MultiTextEdit rootEdit) throws JavaModelException{
- IJavaElement workingCopyElement = findWorkingCopy(compilationUnit, element);
- if(workingCopyElement == null){
- return;
- }
-
- if(!(workingCopyElement instanceof IMember))
- return;
-
- IMember workingCopyMember = (IMember) workingCopyElement;
-
- IAnnotation annotation = findAnnotation(workingCopyMember, qualifiedName);
- if(annotation == null || !annotation.exists())
- return;
-
- boolean duplicateShortName = addImport(qualifiedName, compilationUnit, null);
-
- IBuffer buffer = compilationUnit.getBuffer();
- String shortName = getShortName(qualifiedName);
-
- if(duplicateShortName)
- shortName = qualifiedName;
-
- String newValue = AT+shortName+params;
-
- if(!annotation.getSource().equals(newValue)){
- if(rootEdit != null){
- TextEdit edit = new ReplaceEdit(annotation.getSourceRange().getOffset(), annotation.getSourceRange().getLength(), newValue);
- rootEdit.addChild(edit);
- }else{
- buffer.replace(annotation.getSourceRange().getOffset(), annotation.getSourceRange().getLength(), newValue);
-
- synchronized(compilationUnit) {
- compilationUnit.reconcile(ICompilationUnit.NO_AST, true, null, null);
- }
- }
- }
-
- }
-
- public static void addAnnotation(String qualifiedName, ICompilationUnit compilationUnit, IJavaElement element, String params) throws JavaModelException{
- addAnnotation(qualifiedName, compilationUnit, element, params, null);
- }
-
- public static void addAnnotation(String qualifiedName, ICompilationUnit compilationUnit, IJavaElement element, String params, MultiTextEdit rootEdit) throws JavaModelException{
- IJavaElement workingCopyElement = findWorkingCopy(compilationUnit, element);
- if(workingCopyElement == null){
- return;
- }
-
- if(!(workingCopyElement instanceof IMember))
- return;
-
- IMember workingCopyMember = (IMember) workingCopyElement;
-
- IAnnotation annotation = findAnnotation(workingCopyMember, qualifiedName);
- if(annotation != null && annotation.exists())
- return;
-
- boolean duplicateShortName = addImport(qualifiedName, compilationUnit, rootEdit);
-
- IBuffer buffer = compilationUnit.getBuffer();
- String shortName = getShortName(qualifiedName);
-
- if(duplicateShortName)
- shortName = qualifiedName;
-
- String str = AT+shortName+params;
-
- if(workingCopyMember instanceof IType){
- str += compilationUnit.findRecommendedLineSeparator();
- }else{
- str += SPACE;
- }
-
- if(rootEdit != null){
- TextEdit edit = new InsertEdit(workingCopyMember.getSourceRange().getOffset(), str);
- rootEdit.addChild(edit);
- }else{
- buffer.replace(workingCopyMember.getSourceRange().getOffset(), 0, str);
-
- synchronized(compilationUnit) {
- compilationUnit.reconcile(ICompilationUnit.NO_AST, true, null, null);
- }
- }
-
-
-
- }
-
- public static void addQualifier(String qualifiedName, String value, ICompilationUnit compilationUnit, IJavaElement element, MultiTextEdit rootEdit) throws JavaModelException{
- if(!(element instanceof ISourceReference))
- return;
- IAnnotation annotation = findAnnotation(element, qualifiedName);
- if(annotation != null && annotation.exists())
- return;
-
- boolean duplicateShortName = addImport(qualifiedName, compilationUnit, rootEdit);
-
- String lineDelim = SPACE;
-
- IBuffer buffer = compilationUnit.getBuffer();
- String shortName = getShortName(qualifiedName);
-
- if(!value.isEmpty())
- value = "(\""+value+"\")";
-
- if(duplicateShortName)
- shortName = qualifiedName;
-
- annotation = findAnnotation(element, CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
-
- if(rootEdit != null){
- if(annotation != null && annotation.exists()){
- TextEdit edit = new InsertEdit(annotation.getSourceRange().getOffset()+annotation.getSourceRange().getLength(), lineDelim+AT+shortName+value);
- rootEdit.addChild(edit);
- }else{
- TextEdit edit = new InsertEdit(((ISourceReference)element).getSourceRange().getOffset(), AT+shortName+value+lineDelim);
- rootEdit.addChild(edit);
- }
- }else{
- if(annotation != null && annotation.exists()){
- buffer.replace(annotation.getSourceRange().getOffset()+annotation.getSourceRange().getLength(), 0, lineDelim+AT+shortName+value);
- }else{
- buffer.replace(((ISourceReference)element).getSourceRange().getOffset(), 0, AT+shortName+value+lineDelim);
- }
-
- synchronized(compilationUnit) {
- compilationUnit.reconcile(ICompilationUnit.NO_AST, true, null, null);
- }
- }
- }
-
- public static void updateQualifier(String qualifiedName, String value, ICompilationUnit compilationUnit, IJavaElement element, MultiTextEdit rootEdit) throws JavaModelException{
- if(!(element instanceof ISourceReference))
- return;
- IAnnotation annotation = findAnnotation(element, qualifiedName);
- if(annotation == null || !annotation.exists())
- return;
-
- boolean duplicateShortName = addImport(qualifiedName, compilationUnit, rootEdit);
-
- IBuffer buffer = compilationUnit.getBuffer();
- String shortName = getShortName(qualifiedName);
-
- if(!value.isEmpty())
- value = "(\""+value+"\")";
-
- if(duplicateShortName)
- shortName = qualifiedName;
-
- String newValue = AT+shortName+value;
-
- if(!annotation.getSource().equals(newValue)){
- if(rootEdit != null){
- TextEdit edit = new ReplaceEdit(annotation.getSourceRange().getOffset(), annotation.getSourceRange().getLength(), newValue);
- rootEdit.addChild(edit);
- }else{
- buffer.replace(annotation.getSourceRange().getOffset(), annotation.getSourceRange().getLength(), newValue);
-
- synchronized(compilationUnit) {
- compilationUnit.reconcile(ICompilationUnit.NO_AST, true, null, null);
- }
- }
- }
- }
-
- public static String getShortName(String qualifiedName){
- int lastDot = qualifiedName.lastIndexOf(DOT);
- String name;
- if(lastDot < 0)
- name = qualifiedName;
- else
- name = qualifiedName.substring(lastDot+1);
- return name;
- }
-
- public static String getPackageName(String qualifiedName){
- int lastDot = qualifiedName.lastIndexOf(DOT);
- String name;
- if(lastDot < 0)
- name = "";
- else
- name = qualifiedName.substring(0, lastDot);
- return name;
- }
-
- public static String[] getShortNames(String[] qualifiedNames){
- String[] shortNames = new String[qualifiedNames.length];
- for(int i = 0; i < qualifiedNames.length; i++){
- shortNames[i] = getShortName(qualifiedNames[i]);
- }
- return shortNames;
- }
-
- public static String getTotalList(String[] names){
- String list = "";
- for(int i = 0; i < names.length; i++){
- if(i != 0)
- list += ", ";
- list += names[i];
- }
- return list;
- }
-
- public static IAnnotation findAnnotation(IJavaElement element, String qualifiedName){
- if(element instanceof IAnnotatable){
- String name = getShortName(qualifiedName);
- IAnnotation annotation = ((IAnnotatable)element).getAnnotation(qualifiedName);
- if (!annotation.exists()) {
- annotation = ((IAnnotatable)element).getAnnotation(name);
- } else {
- return annotation;
- }
- if(annotation.exists()) {
- IType type=null;
- if(element instanceof IType){
- type = (IType)element;
- }else if(element instanceof IMember){
- type = ((IMember)element).getDeclaringType();
- }else if(element instanceof ITypeParameter){
- type = ((ITypeParameter)element).getDeclaringMember().getDeclaringType();
- }else if(element instanceof ILocalVariable){
- type = ((ILocalVariable)element).getDeclaringMember().getDeclaringType();
- }
- if (type != null && annotation != null && qualifiedName.equals(EclipseJavaUtil.resolveType(type, name))) {
- return annotation;
- }
- }
- }
- return null;
- }
-
- private static boolean contains(IQualifierDeclaration declaration, List<ValuedQualifier> declarations){
- for(ValuedQualifier d : declarations){
- if(declaration.getQualifier().getSourceType().getFullyQualifiedName().equals(d.getQualifier().getSourceType().getFullyQualifiedName()))
- return true;
- }
- return false;
- }
-
- private static List<IQualifier> findQualifiersToDelete(IInjectionPoint injectionPoint, List<ValuedQualifier> qualifiers){
- ArrayList<IQualifier> list = new ArrayList<IQualifier>();
- Set<IQualifierDeclaration> declarations = injectionPoint.getQualifierDeclarations();
- for(IQualifierDeclaration declaration : declarations){
- if(!contains(declaration, qualifiers))
- list.add(declaration.getQualifier());
- }
- return list;
- }
-
- private static void addQualifiersToParameter(ICompilationUnit compilationUnit, IInjectionPoint injectionPoint, List<ValuedQualifier> declarations, MultiTextEdit rootEdit){
- HashMap<IQualifier, Boolean> duplicants = new HashMap<IQualifier, Boolean>();
- if(!(injectionPoint instanceof IInjectionPointParameter))
- return;
- try{
- for(ValuedQualifier declaration : declarations){
- String qualifierName = declaration.getQualifier().getSourceType().getFullyQualifiedName();
- boolean duplicant = false;
- if(!qualifierName.equals(CDIConstants.ANY_QUALIFIER_TYPE_NAME) &&
- !qualifierName.equals(CDIConstants.DEFAULT_QUALIFIER_TYPE_NAME)){
- duplicant = addImport(qualifierName, compilationUnit, rootEdit);
- }
- duplicants.put(declaration.getQualifier(), new Boolean(duplicant));
- }
-
- String paramName = ((IInjectionPointParameter)injectionPoint).getName();
- IMethod method = ((IInjectionPointParameter)injectionPoint).getBeanMethod().getMethod();
- IType type = method.getDeclaringType();
- IType t = compilationUnit.getType(type.getElementName());
- IMethod m = t.getMethod(method.getElementName(), method.getParameterTypes());
-
- IBuffer buffer = compilationUnit.getBuffer();
-
- ILocalVariable[] parameters = m.getParameters();
- for(int index = 0; index < parameters.length; index++){
- if(parameters[index].getElementName().equals(paramName)){
- StringBuffer b = new StringBuffer();
- if(index > 0)
- b.append(SPACE);
- for(ValuedQualifier declaration : declarations){
- String qualifierName = declaration.getQualifier().getSourceType().getFullyQualifiedName();
- String value = declaration.getValue();
-
- if(!value.isEmpty())
- value = "(\""+value+"\")";
-
- if(!qualifierName.equals(CDIConstants.ANY_QUALIFIER_TYPE_NAME) && !qualifierName.equals(CDIConstants.DEFAULT_QUALIFIER_TYPE_NAME)){
- boolean duplicant = duplicants.get(declaration.getQualifier()).booleanValue();
- String annotation = getShortName(qualifierName);
- if(duplicant)
- annotation = qualifierName;
- b.append(AT+annotation+value+SPACE);
- }
- }
- b.append(Signature.getSignatureSimpleName(parameters[index].getTypeSignature())+SPACE);
- b.append(parameters[index].getElementName());
-
- String newValue = b.toString();
-
- if(!parameters[index].getSource().equals(newValue)){
- if(rootEdit != null){
- TextEdit edit = new ReplaceEdit(parameters[index].getSourceRange().getOffset(), parameters[index].getSourceRange().getLength(), b.toString());
- rootEdit.addChild(edit);
- }else{
- buffer.replace(parameters[index].getSourceRange().getOffset(), parameters[index].getSourceRange().getLength(), b.toString());
-
- synchronized(compilationUnit) {
- compilationUnit.reconcile(ICompilationUnit.NO_AST, true, null, null);
- }
- }
- }
- }
- }
-
- }catch(JavaModelException ex){
- CDIUIPlugin.getDefault().logError(ex);
- }
- }
-
- public static ISourceRange getParameterRegion(IInjectionPointParameter injectionParameter){
- try{
- String paramName = injectionParameter.getName();
- IMethod method = injectionParameter.getBeanMethod().getMethod();
-
- for(ILocalVariable parameter : method.getParameters()){
- if(parameter.getElementName().equals(paramName)){
- return parameter.getSourceRange();
- }
- }
- }catch(JavaModelException ex){
- CDIUIPlugin.getDefault().logError(ex);
- }
- return null;
- }
-
- public static void addQualifiersToInjectionPoint(List<ValuedQualifier> deployed, IInjectionPoint injectionPoint, ICompilationUnit compilationUnit, MultiTextEdit edit){
- try{
- if(injectionPoint instanceof IInjectionPointParameter){
- addQualifiersToParameter(compilationUnit, injectionPoint, deployed, edit);
- }else{
- IJavaElement element = getInjectedJavaElement(compilationUnit, injectionPoint);
- if(element == null || !element.exists())
- return;
-
- // delete unneeded qualifiers
- List<IQualifier> toDelete = findQualifiersToDelete(injectionPoint, deployed);
-
- for(IQualifier qualifier : toDelete){
- deleteAnnotation(qualifier.getSourceType().getFullyQualifiedName(), compilationUnit, element, edit);
- }
-
- for(ValuedQualifier declaration : deployed){
- String qualifierName = declaration.getQualifier().getSourceType().getFullyQualifiedName();
- String value = declaration.getValue();
- if(!qualifierName.equals(CDIConstants.ANY_QUALIFIER_TYPE_NAME) && !qualifierName.equals(CDIConstants.DEFAULT_QUALIFIER_TYPE_NAME)){
- addQualifier(qualifierName, value, compilationUnit, element, edit);
- updateQualifier(qualifierName, value, compilationUnit, element, edit);
- }
- }
- }
- }catch(CoreException ex){
- CDIUIPlugin.getDefault().logError(ex);
- }
-
- }
-
- public static void addQualifiersToBean(List<ValuedQualifier> deployed, IBean bean, ICompilationUnit compilationUnit, MultiTextEdit edit){
- IJavaElement beanElement = null;
- if(bean instanceof IBeanField){
- beanElement = ((IBeanField) bean).getField();
- }else if(bean instanceof IBeanMethod){
- beanElement = ((IBeanMethod) bean).getMethod();
- }else{
- beanElement = bean.getBeanClass();
- }
-
- try{
- for(IQualifierDeclaration declaration : bean.getQualifierDeclarations()){
- IQualifier qualifier = declaration.getQualifier();
- String qualifierName = qualifier.getSourceType().getFullyQualifiedName();
- if(!isQualifierNeeded(deployed, qualifier)){
- deleteAnnotation(qualifierName, compilationUnit, beanElement, edit);
- }
- }
-
- for(ValuedQualifier vq : deployed){
- String qualifierName = vq.getQualifier().getSourceType().getFullyQualifiedName();
- String value = vq.getValue();
- String elName = getELName(bean);
-
- if(!value.isEmpty() && (!value.equals(elName) || !qualifierName.equals(CDIConstants.NAMED_QUALIFIER_TYPE_NAME))){
- value = "(\""+value+"\")";
- }else{
- value = "";
- }
-
- if(!qualifierName.equals(CDIConstants.ANY_QUALIFIER_TYPE_NAME) && !qualifierName.equals(CDIConstants.DEFAULT_QUALIFIER_TYPE_NAME)){
- addAnnotation(qualifierName, compilationUnit, beanElement, value, edit);
- updateAnnotation(qualifierName, compilationUnit, beanElement, value, edit);
- }
-
- }
- }catch(CoreException ex){
- CDIUIPlugin.getDefault().logError(ex);
- }
-
- }
-
- private static boolean isQualifierNeeded(List<ValuedQualifier> vQualifiers, IQualifier qualifier){
- for(ValuedQualifier vq : vQualifiers){
- if(vq.getQualifier().equals(qualifier))
- return true;
- }
- return false;
- }
-
- public static void addInterfaceToClass(ICompilationUnit compilationUnit, IType type, String qualifiedName) throws JavaModelException{
- String shortName = getShortName(qualifiedName);
-
- IType[] types = compilationUnit.getTypes();
- IType workingType = null;
- for(IType t : types){
- if(t.getElementName().equals(type.getElementName())){
- workingType = t;
- break;
- }
- }
-
- if(workingType != null){
- addImport(qualifiedName, compilationUnit, null);
-
- IBuffer buffer = compilationUnit.getBuffer();
-
- String text = buffer.getText(workingType.getSourceRange().getOffset(), workingType.getSourceRange().getLength());
-
- int namePosition = text.indexOf(workingType.getElementName());
- if(namePosition >= 0){
- int implementsPosition = text.indexOf(IMPLEMENTS,namePosition);
- if(implementsPosition > 0){
- buffer.replace(workingType.getSourceRange().getOffset()+implementsPosition+IMPLEMENTS.length(),0,SPACE+shortName+COMMA);
- }else{
- int extedsPosition = text.indexOf(EXTENDS,namePosition);
- if(extedsPosition > 0){
- int bracePosition = text.indexOf(OPEN_BRACE, extedsPosition);
- String str = IMPLEMENTS+SPACE+shortName+SPACE;
- if(!text.substring(bracePosition-1,bracePosition).equals(SPACE))
- str = SPACE+str;
- buffer.replace(workingType.getSourceRange().getOffset()+bracePosition,0,str);
- }else{
- buffer.replace(workingType.getSourceRange().getOffset()+namePosition+workingType.getElementName().length(),0,SPACE+IMPLEMENTS+SPACE+shortName);
- }
- }
- }
- }
-
- }
-
- private static IJavaElement getInjectedJavaElement(ICompilationUnit compilationUnit, IInjectionPoint injectionPoint){
- if(injectionPoint instanceof IInjectionPointField){
- IField field = ((IInjectionPointField)injectionPoint).getField();
- IType type = field.getDeclaringType();
- IType t = compilationUnit.getType(type.getElementName());
- IField f = t.getField(field.getElementName());
-
- return f;
- }else if(injectionPoint instanceof IInjectionPointParameter){
- IMethod method = ((IInjectionPointParameter)injectionPoint).getBeanMethod().getMethod();
- IType type = method.getDeclaringType();
- IType t = compilationUnit.getType(type.getElementName());
- IMethod m = t.getMethod(method.getElementName(), method.getParameterTypes());
- // Why method? Why not Java element for parameter?
- return m;
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public static <T extends IJavaElement> T findWorkingCopy(ICompilationUnit compilationUnit, T element) throws JavaModelException{
- if(element instanceof IAnnotation){
- IJavaElement parent = findWorkingCopy(compilationUnit, element.getParent());
- if(parent instanceof IAnnotatable){
- for(IAnnotation a : ((IAnnotatable)parent).getAnnotations()){
- if(a.getElementName().equals(element.getElementName()))
- return (T)a;
- }
- }
- }else if(element instanceof ILocalVariable && ((ILocalVariable) element).isParameter()){
- IJavaElement parent = findWorkingCopy(compilationUnit, element.getParent());
- if(parent instanceof IMethod){
- for(ILocalVariable parameter : ((IMethod)parent).getParameters()){
- if(parameter.getElementName().equals(element.getElementName()) && parameter.getTypeSignature().equals(((ILocalVariable)element).getTypeSignature()))
- return (T)parameter;
- }
- }
- }else{
- IJavaElement[] elements = compilationUnit.findElements(element);
- if(elements != null){
- for(IJavaElement e : elements){
- if(e.getClass().equals(element.getClass()))
- return (T)e;
- }
- }
- }
- return null;
- }
-
- public static void deleteAnnotation(String qualifiedName, ICompilationUnit compilationUnit, IJavaElement element) throws JavaModelException{
- deleteAnnotation(qualifiedName, compilationUnit, element, null);
- }
-
- public static void deleteAnnotation(String qualifiedName, ICompilationUnit compilationUnit, IJavaElement element, MultiTextEdit rootEdit) throws JavaModelException{
- IJavaElement workingCopyElement = findWorkingCopy(compilationUnit, element);
- if(workingCopyElement == null){
- return;
- }
-
- IAnnotation annotation = findAnnotation(workingCopyElement, qualifiedName);
- if(annotation != null){
- IBuffer buffer = compilationUnit.getBuffer();
-
- int position = annotation.getSourceRange().getOffset() + annotation.getSourceRange().getLength();
- int numberOfSpaces = 0;
- if(position < buffer.getLength()-1){
- char c = buffer.getChar(position);
- while((c == ' ' || c == '\t' || c == '\n' || c == '\r') && position < buffer.getLength()-1){
- numberOfSpaces++;
- position++;
- c = buffer.getChar(position);
- }
- }
-
- // delete annotation
- if(rootEdit != null){
- TextEdit edit = new DeleteEdit(annotation.getSourceRange().getOffset(), annotation.getSourceRange().getLength());
- rootEdit.addChild(edit);
- }else{
- buffer.replace(annotation.getSourceRange().getOffset(), annotation.getSourceRange().getLength()+numberOfSpaces, "");
- }
-
- // check and delete import
- IImportDeclaration importDeclaration = compilationUnit.getImport(qualifiedName);
- IImportContainer importContainer = compilationUnit.getImportContainer();
- if(importDeclaration.exists() && importContainer.exists()){
- int importSize = importContainer.getSourceRange().getOffset()+importContainer.getSourceRange().getLength();
-
- if(rootEdit != null){
- int annotationStart = annotation.getSourceRange().getOffset();
- int annotationEnd = annotationStart+annotation.getSourceRange().getLength();
- String textBefore = buffer.getText(importSize, annotationStart-importSize);
- String textAfter = buffer.getText(annotationEnd, buffer.getLength()-annotationEnd);
- if(checkImport(textBefore, qualifiedName) && checkImport(textAfter, qualifiedName)){
- TextEdit edit = new DeleteEdit(importDeclaration.getSourceRange().getOffset(), importDeclaration.getSourceRange().getLength());
- rootEdit.addChild(edit);
- }
- }else{
- String text = buffer.getText(importSize, buffer.getLength()-importSize);
- if(checkImport(text, qualifiedName)){
- importDeclaration.delete(false, new NullProgressMonitor());
- }
- }
- }
-
- if(rootEdit == null){
- synchronized(compilationUnit) {
- compilationUnit.reconcile(ICompilationUnit.NO_AST, true, null, null);
- }
- }
- }
- }
-
- private static boolean checkImport(String text, String qualifiedName){
- String name = getShortName(qualifiedName);
-
- Pattern p = Pattern.compile(".*\\W"+name+"\\W.*",Pattern.DOTALL); //$NON-NLS-1$ //$NON-NLS-2$
- Matcher m = p.matcher(text);
- return !m.matches();
- }
-
- public static IMember getJavaMember(IJavaElement element){
- while(element != null){
- if(element instanceof IMember)
- return (IMember)element;
- element = element.getParent();
- }
- return null;
- }
-
- public static boolean checkBeanQualifiers(IBean selectedBean, IBean bean, Set<IQualifier> qualifiers){
- HashSet<ValuedQualifier> valuedQualifiers = new HashSet<ValuedQualifier>();
- for(IQualifier qualifier : qualifiers){
- valuedQualifiers.add(new ValuedQualifier(qualifier));
- }
- return checkValuedQualifiers(selectedBean, bean, valuedQualifiers);
- }
-
- public static boolean checkValuedQualifiers(IBean selectedBean, IBean bean, Set<ValuedQualifier> qualifiers){
- for(ValuedQualifier qualifier : qualifiers){
- if(!isBeanContainQualifier(bean, qualifier)){
- return false;
- }
- }
- if(bean.getQualifiers().size() == qualifiers.size())
- return true;
- return false;
- }
-
- private static boolean isBeanContainQualifier(IBean bean, ValuedQualifier valuedQualifier){
-
- Set<IQualifier> qualifiers = bean.getQualifiers();
- for(IQualifier q : qualifiers){
- if(q.getSourceType().getFullyQualifiedName().equals(valuedQualifier.getQualifier().getSourceType().getFullyQualifiedName()))
- return true;
- }
- return false;
- }
-
- public static String findQualifierValue(IBean bean, IQualifier qualifier){
- IQualifierDeclaration declaration = findQualifierDeclaration(bean, qualifier);
- if(declaration == null)
- return "";
-
- return findQualifierValue(bean, declaration);
- }
-
- public static String findQualifierValue(IBean bean, IQualifierDeclaration declaration){
- Object value = declaration.getMemberValue(null);
-
- String result = value == null ? "" : value.toString();
-
- if("".equals(result) && declaration.getQualifier().getSourceType().getFullyQualifiedName().equals(CDIConstants.NAMED_QUALIFIER_TYPE_NAME))
- result = getELName(bean);
-
- return result;
- }
-
- public static IQualifierDeclaration findQualifierDeclaration(IBean bean, IQualifier qualifier){
- Set<IQualifierDeclaration> declarations = bean.getQualifierDeclarations();
-
- if(declarations == null)
- return null;
-
- for(IQualifierDeclaration declaration : declarations){
- if(declaration.getQualifier().getSourceType().getFullyQualifiedName().equals(qualifier.getSourceType().getFullyQualifiedName()))
- return declaration;
- }
- return null;
- }
-
- public static String getELName(IBean bean){
- String name;
- if(bean instanceof IBeanField){
- name = ((IBeanField) bean).getField().getElementName();
- }else if(bean instanceof IBeanMethod){
- name = ((IBeanMethod) bean).getMethod().getElementName();
- if(BeanUtil.isGetter(((IBeanMethod) bean).getMethod())) {
- return BeanUtil.getPropertyName(name);
- }
- }else{
- name = bean.getBeanClass().getElementName();
- if(name.length() > 0) {
- name = name.substring(0, 1).toLowerCase() + name.substring(1);
- }
- }
-
- return name;
- }
-}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/SelectBeanMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/SelectBeanMarkerResolution.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/SelectBeanMarkerResolution.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -10,28 +10,18 @@
******************************************************************************/
package org.jboss.tools.cdi.ui.marker;
-import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ltk.core.refactoring.CompositeChange;
import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IMarkerResolution2;
-import org.eclipse.ui.PlatformUI;
import org.jboss.tools.cdi.core.CDIImages;
import org.jboss.tools.cdi.core.IBean;
-import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IInjectionPoint;
-import org.jboss.tools.cdi.core.IQualifier;
+import org.jboss.tools.cdi.internal.core.refactoring.AddQualifiersToBeanProcessor;
import org.jboss.tools.cdi.ui.CDIUIMessages;
-import org.jboss.tools.cdi.ui.wizard.AddQualifiersToBeanWizard;
import org.jboss.tools.cdi.ui.wizard.SelectBeanWizard;
-import org.jboss.tools.cdi.ui.wizard.xpl.AddQualifiersToBeanComposite.ValuedQualifier;
/**
* @author Daniel Azarov
Deleted: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/CDIRefactoringProcessor.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/CDIRefactoringProcessor.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/CDIRefactoringProcessor.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -1,194 +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.cdi.ui.refactoring;
-
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
-import org.eclipse.jface.text.IDocument;
-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.RefactoringParticipant;
-import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
-import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchWindow;
-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.IBean;
-import org.jboss.tools.cdi.core.ICDIProject;
-import org.jboss.tools.cdi.core.IClassBean;
-import org.jboss.tools.cdi.ui.CDIUIPlugin;
-
-public abstract class CDIRefactoringProcessor extends RefactoringProcessor {
- protected static final RefactoringParticipant[] EMPTY_REF_PARTICIPANT = new RefactoringParticipant[0];
- protected IFile file;
- protected RefactoringStatus status;
- protected String label;
-
- protected CompositeChange rootChange;
- protected TextFileChange change;
- protected IClassBean bean;
-
-
- public CDIRefactoringProcessor(IFile file, String label){
- this(label);
- this.file = file;
- }
-
- public CDIRefactoringProcessor(String label){
- this.label = label;
- }
-
- protected void createRootChange(){
- rootChange = new CompositeChange(label);
- change = new CDIFileChange(file.getName(), file);
-
- if(getEditor(file) != null)
- change.setSaveMode(TextFileChange.LEAVE_DIRTY);
- else
- change.setSaveMode(TextFileChange.FORCE_SAVE);
-
- MultiTextEdit root = new MultiTextEdit();
- change.setEdit(root);
- rootChange.add(change);
- rootChange.markAsSynthetic();
- }
-
- protected IEditorPart getEditor(IFile file){
- IEditorInput ii = EditorUtility.getEditorInput(file);
-
- IWorkbenchWindow[] windows = CDIUIPlugin.getDefault().getWorkbench().getWorkbenchWindows();
- for(IWorkbenchWindow window : windows){
- IEditorPart editor = window.getActivePage().findEditor(ii);
- if(editor != null)
- return editor;
- }
- return null;
- }
-
- 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;
- }
-
- protected boolean isFileCorrect(IFile file){
- if(file == null){
- status.addFatalError(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_FILE_NOT_FOUND);
- return false;
- }else if(!file.isSynchronized(IResource.DEPTH_ZERO)){
- status.addFatalError(NLS.bind(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_OUT_OF_SYNC_PROJECT, file.getProject().getFullPath().toString()));
- return false;
- }else if(file.isPhantom()){
- status.addFatalError(NLS.bind(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_PHANTOM_FILE, file.getFullPath().toString()));
- return false;
- }else if(file.isReadOnly()){
- status.addFatalError(NLS.bind(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_READ_ONLY_FILE, file.getFullPath().toString()));
- return false;
- }
- return true;
- }
-
- @Override
- public Object[] getElements() {
- return new Object[]{file};
- }
-
- @Override
- public String getIdentifier() {
- return "";
- }
-
- @Override
- public String getProcessorName() {
- return label;
- }
-
- @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(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_BEAN_NOT_FOUND);
-
- 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;
- }
-
- protected class CDIFileChange extends TextFileChange{
-
- public CDIFileChange(String name, IFile file) {
- super(name, file);
- }
-
- @Override
- protected void releaseDocument(final IDocument document, IProgressMonitor pm)
- throws CoreException {
- super.releaseDocument(document, pm);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- IEditorPart editor = getEditor(getFile());
- if(editor != null){
- editor.doSave(new NullProgressMonitor());
- }
- }
-
- });
- }
- }
-}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AbstractModifyInjectionPointWizard.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AbstractModifyInjectionPointWizard.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AbstractModifyInjectionPointWizard.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -21,8 +21,8 @@
import org.eclipse.ui.PlatformUI;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IInjectionPoint;
+import org.jboss.tools.cdi.internal.core.refactoring.AddQualifiersToBeanProcessor;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
-import org.jboss.tools.cdi.ui.marker.AddQualifiersToBeanProcessor;
public abstract class AbstractModifyInjectionPointWizard extends RefactoringWizard {
public AbstractModifyInjectionPointWizard(ProcessorBasedRefactoring refactoring){
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanWizard.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanWizard.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanWizard.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -15,8 +15,8 @@
import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring;
import org.eclipse.osgi.util.NLS;
import org.jboss.tools.cdi.core.IQualifier;
+import org.jboss.tools.cdi.internal.core.refactoring.ValuedQualifier;
import org.jboss.tools.cdi.ui.CDIUIMessages;
-import org.jboss.tools.cdi.ui.wizard.xpl.AddQualifiersToBeanComposite.ValuedQualifier;
import org.jboss.tools.common.model.ui.ModelUIImages;
public class AddQualifiersToBeanWizard extends AbstractModifyInjectionPointWizard{
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanWizardPage.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanWizardPage.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/AddQualifiersToBeanWizardPage.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -18,10 +18,10 @@
import org.eclipse.swt.widgets.Composite;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IQualifier;
+import org.jboss.tools.cdi.internal.core.refactoring.AddQualifiersToBeanProcessor;
+import org.jboss.tools.cdi.internal.core.refactoring.ValuedQualifier;
import org.jboss.tools.cdi.ui.CDIUIMessages;
-import org.jboss.tools.cdi.ui.marker.AddQualifiersToBeanProcessor;
import org.jboss.tools.cdi.ui.wizard.xpl.AddQualifiersToBeanComposite;
-import org.jboss.tools.cdi.ui.wizard.xpl.AddQualifiersToBeanComposite.ValuedQualifier;
public class AddQualifiersToBeanWizardPage extends UserInputWizardPage{
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/SelectBeanWizard.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/SelectBeanWizard.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/SelectBeanWizard.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -42,9 +42,9 @@
import org.jboss.tools.cdi.core.CDIImages;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IQualifier;
+import org.jboss.tools.cdi.internal.core.refactoring.MarkerResolutionUtils;
+import org.jboss.tools.cdi.internal.core.refactoring.ValuedQualifier;
import org.jboss.tools.cdi.ui.CDIUIMessages;
-import org.jboss.tools.cdi.ui.marker.MarkerResolutionUtils;
-import org.jboss.tools.cdi.ui.wizard.xpl.AddQualifiersToBeanComposite.ValuedQualifier;
import org.jboss.tools.common.model.ui.ModelUIImages;
public class SelectBeanWizard extends AbstractModifyInjectionPointWizard{
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/xpl/AddQualifiersToBeanComposite.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -77,9 +77,10 @@
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IQualifier;
import org.jboss.tools.cdi.core.IQualifierDeclaration;
+import org.jboss.tools.cdi.internal.core.refactoring.MarkerResolutionUtils;
+import org.jboss.tools.cdi.internal.core.refactoring.ValuedQualifier;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
-import org.jboss.tools.cdi.ui.marker.MarkerResolutionUtils;
import org.jboss.tools.cdi.ui.wizard.AbstractModifyInjectionPointWizard;
import org.jboss.tools.cdi.ui.wizard.AddQualifiersToBeanWizardPage;
import org.jboss.tools.cdi.ui.wizard.NewQualifierCreationWizard;
@@ -549,7 +550,7 @@
}
remove.setEnabled(enabled);
- if(enabled && ms.length == 1 && isEditEnabled(ms[0].qualifier)){
+ if(enabled && ms.length == 1 && isEditEnabled(ms[0].getQualifier())){
editQualifierValue.setEnabled(true);
}else{
editQualifierValue.setEnabled(false);
@@ -716,7 +717,7 @@
public Image getImage(Object element) {
if(element instanceof ValuedQualifier){
- return CDIImages.getImageByElement(((ValuedQualifier) element).qualifier);
+ return CDIImages.getImageByElement(((ValuedQualifier) element).getQualifier());
}
return null;
}
@@ -794,37 +795,6 @@
}
}
- public static class ValuedQualifier{
- private IQualifier qualifier;
- private String value="";
-
- public ValuedQualifier(IQualifier qualifier){
- this.qualifier = qualifier;
- }
-
- public ValuedQualifier(IQualifier qualifier, String value){
- this(qualifier);
- this.value = value;
- }
-
- public IQualifier getQualifier(){
- return qualifier;
- }
-
- public String getValue(){
- return value;
- }
-
- public void setValue(String value){
- this.value = value;
- }
-
- public boolean equals(Object obj) {
- if(obj instanceof ValuedQualifier)
- return getQualifier().getSourceType().getFullyQualifiedName().equals(((ValuedQualifier)obj).getQualifier().getSourceType().getFullyQualifiedName());
- return false;
- }
- }
static class ValueDialog extends MessageDialog{
String value;
Modified: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/AddQualifiersToBeanWizardTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/AddQualifiersToBeanWizardTest.java 2011-11-29 21:01:05 UTC (rev 36747)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/AddQualifiersToBeanWizardTest.java 2011-11-29 21:12:26 UTC (rev 36748)
@@ -19,12 +19,12 @@
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IQualifier;
-import org.jboss.tools.cdi.ui.marker.AddQualifiersToBeanProcessor;
+import org.jboss.tools.cdi.internal.core.refactoring.AddQualifiersToBeanProcessor;
+import org.jboss.tools.cdi.internal.core.refactoring.ValuedQualifier;
import org.jboss.tools.cdi.ui.test.testmodel.CDIBean;
import org.jboss.tools.cdi.ui.test.testmodel.CDIInjectionPoint;
import org.jboss.tools.cdi.ui.test.testmodel.CDIProject;
import org.jboss.tools.cdi.ui.wizard.AddQualifiersToBeanWizard;
-import org.jboss.tools.cdi.ui.wizard.xpl.AddQualifiersToBeanComposite.ValuedQualifier;
public class AddQualifiersToBeanWizardTest extends TestCase{
13 years, 1 month
JBoss Tools SVN: r36747 - trunk/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-11-29 16:01:05 -0500 (Tue, 29 Nov 2011)
New Revision: 36747
Modified:
trunk/build/publish.sh
Log:
oops, can't reuse $z variable
Modified: trunk/build/publish.sh
===================================================================
--- trunk/build/publish.sh 2011-11-29 20:48:55 UTC (rev 36746)
+++ trunk/build/publish.sh 2011-11-29 21:01:05 UTC (rev 36747)
@@ -92,7 +92,7 @@
echo "HUDSON_SLAVE = $(uname -a)" >> ${STAGINGDIR}/logs/${METAFILE}
echo "RELEASE = ${RELEASE}" >> ${STAGINGDIR}/logs/${METAFILE}
echo "ZIPSUFFIX = ${ZIPSUFFIX}" >> ${STAGINGDIR}/logs/${METAFILE}
-z=${STAGINGDIR}/logs/${METAFILE}; for m in $(md5sum ${z}); do if [[ $m != ${z} ]]; then echo $m > ${z}.MD5; fi; done
+y=${STAGINGDIR}/logs/${METAFILE}; for m in $(md5sum ${y}); do if [[ $m != ${y} ]]; then echo $m > ${y}.MD5; fi; done
#echo "$z ..."
if [[ $z != "" ]] && [[ -f $z ]] ; then
13 years, 1 month
JBoss Tools SVN: r36746 - trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2011-11-29 15:48:55 -0500 (Tue, 29 Nov 2011)
New Revision: 36746
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java
Log:
actually handle realm similar to arquillian code. JBIDE-10224
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java 2011-11-29 20:39:52 UTC (rev 36745)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as71/src/org/jboss/ide/eclipse/as/internal/management/as71/AS71Manager.java 2011-11-29 20:48:55 UTC (rev 36746)
@@ -38,6 +38,7 @@
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.sasl.RealmCallback;
import javax.security.sasl.RealmChoiceCallback;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -94,8 +95,10 @@
NameCallback name = null;
PasswordCallback pass = null;
for (Callback current : callbacks) {
- if (current instanceof RealmChoiceCallback) {
- throw new UnsupportedCallbackException(current, "Realm choice not currently supported.");
+ if (current instanceof RealmCallback) {
+ RealmCallback rcb = (RealmCallback) current;
+ String defaultText = rcb.getDefaultText();
+ rcb.setText(defaultText); // For now just use the realm suggested.
}
if (current instanceof NameCallback) {
name = (NameCallback) current;
13 years, 1 month
JBoss Tools SVN: r36745 - in trunk/as/plugins/org.jboss.ide.eclipse.as.ui: META-INF and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-11-29 15:39:52 -0500 (Tue, 29 Nov 2011)
New Revision: 36745
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/OpenManagementConsoleActionProvider.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUISharedImages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
Log:
[JBIDE-6828] implementing "Open Management Console" action in context menu of the server/serverView
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF 2011-11-29 19:49:41 UTC (rev 36744)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF 2011-11-29 20:39:52 UTC (rev 36745)
@@ -55,7 +55,8 @@
org.eclipse.wst.common.project.facet.ui;bundle-version="1.4.200",
org.jboss.ide.eclipse.as.wtp.core;bundle-version="2.3.0",
org.eclipse.jst.common.project.facet.core;bundle-version="1.4.200",
- org.eclipse.wst.common.emfworkbench.integration;bundle-version="1.2.100"
+ org.eclipse.wst.common.emfworkbench.integration;bundle-version="1.2.100",
+ org.jboss.tools.common.ui;bundle-version="3.3.0"
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.ide.eclipse.as.ui,
org.jboss.ide.eclipse.as.ui.console,
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUISharedImages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUISharedImages.java 2011-11-29 19:49:41 UTC (rev 36744)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUISharedImages.java 2011-11-29 20:39:52 UTC (rev 36745)
@@ -50,9 +50,8 @@
public static final String XPATH_LEVEL_1 = "xpath_level_1"; //$NON-NLS-1$
public static final String XPATH_LEVEL_2 = "xpath_level_2"; //$NON-NLS-1$
public static final String XPATH_LEVEL_3 = "xpath_level_3"; //$NON-NLS-1$
+ public static final String CONSOLE = "console"; //$NON-NLS-1$
-
-
private static JBossServerUISharedImages instance;
private Hashtable<String, Object> images, descriptors;
@@ -77,6 +76,7 @@
descriptors.put(XPATH_LEVEL_2, createImageDescriptor(pluginBundle, "icons/xpath_level_2.gif")); //$NON-NLS-1$
descriptors.put(XPATH_LEVEL_3, createImageDescriptor(pluginBundle, "icons/xpath_level_3.gif")); //$NON-NLS-1$
+ descriptors.put(CONSOLE, createImageDescriptor(pluginBundle, "/icons/console.gif")); //$NON-NLS-1$
Iterator<String> iter = descriptors.keySet().iterator();
while (iter.hasNext()) {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2011-11-29 19:49:41 UTC (rev 36744)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2011-11-29 20:39:52 UTC (rev 36745)
@@ -223,6 +223,8 @@
public static String ExploreUtils_Action_Text;
public static String ExploreUtils_Description;
+ public static String OpenManagementConsole_Action_Text;
+ public static String OpenConsole_Action_Description;
public static String Configure;
public static String ConfigureRuntimeMarkerResolution_Description;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2011-11-29 19:49:41 UTC (rev 36744)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2011-11-29 20:39:52 UTC (rev 36745)
@@ -196,6 +196,7 @@
ExploreUtils_Action_Text=Explore
ExploreUtils_Description=Explore deploy directory
+OpenManagementConsole_Action_Text=Open Management Console
Configure=Configure...
ConfigureRuntimeMarkerResolution_Description=Configure Targeted Runtimes
ConvertNodeToXPathDialog_DisplayString=Add to XPaths
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/OpenManagementConsoleActionProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/OpenManagementConsoleActionProvider.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/OpenManagementConsoleActionProvider.java 2011-11-29 20:39:52 UTC (rev 36745)
@@ -0,0 +1,96 @@
+package org.jboss.ide.eclipse.as.ui.views.server.extensions;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.ui.navigator.CommonActionProvider;
+import org.eclipse.ui.navigator.CommonViewer;
+import org.eclipse.ui.navigator.ICommonActionExtensionSite;
+import org.eclipse.ui.navigator.ICommonViewerSite;
+import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.ui.internal.view.servers.AbstractServerAction;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.util.ServerUtil;
+import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
+import org.jboss.ide.eclipse.as.ui.JBossServerUISharedImages;
+import org.jboss.ide.eclipse.as.ui.Messages;
+import org.jboss.tools.common.ui.BrowserUtil;
+
+import com.ibm.icu.text.MessageFormat;
+
+public class OpenManagementConsoleActionProvider extends CommonActionProvider {
+
+ private static final String CONSOLE_URL_PATTERN = "http://{0}:{1}/console";
+
+ private ICommonActionExtensionSite actionSite;
+ private OpenManagementConsoleAction openManagementConsoleAction;
+ public OpenManagementConsoleActionProvider() {
+ super();
+ }
+
+ public void init(ICommonActionExtensionSite site) {
+ super.init(site);
+ this.actionSite = site;
+ createActions(site);
+ }
+
+ protected void createActions(ICommonActionExtensionSite aSite) {
+ ICommonViewerSite viewSite = aSite.getViewSite();
+ if( viewSite instanceof ICommonViewerWorkbenchSite ) {
+ StructuredViewer v = aSite.getStructuredViewer();
+ if( v instanceof CommonViewer ) {
+ ICommonViewerWorkbenchSite wsSite = (ICommonViewerWorkbenchSite)viewSite;
+ openManagementConsoleAction = new OpenManagementConsoleAction(wsSite.getSelectionProvider());
+ }
+ }
+ }
+
+ public void fillContextMenu(IMenuManager menu) {
+ ICommonViewerSite site = actionSite.getViewSite();
+ IStructuredSelection selection = null;
+ if (site instanceof ICommonViewerWorkbenchSite) {
+ ICommonViewerWorkbenchSite wsSite = (ICommonViewerWorkbenchSite) site;
+ selection = (IStructuredSelection) wsSite.getSelectionProvider()
+ .getSelection();
+ }
+ IContributionItem menuItem = menu.find("org.eclipse.ui.navigate.showInQuickMenu"); //$NON-NLS-1$
+ if( menuItem != null && selection != null && selection.toArray().length == 1 ) {
+ if( selection.getFirstElement() instanceof IServer ) {
+ if( menu instanceof MenuManager ) {
+ ((MenuManager)menuItem).add(openManagementConsoleAction);
+ }
+ }
+ }
+ }
+
+ private static class OpenManagementConsoleAction extends AbstractServerAction {
+ public OpenManagementConsoleAction(ISelectionProvider sp) {
+ super(sp, Messages.OpenManagementConsole_Action_Text);
+ setImageDescriptor(JBossServerUISharedImages.getImageDescriptor(JBossServerUISharedImages.CONSOLE));
+ }
+
+ public boolean accept(IServer server) {
+ return (ServerUtil.isJBoss7(server));
+ }
+
+ public void perform(IServer server) {
+ JBossServer jbossServer;
+ try {
+ jbossServer = ServerUtil.checkedGetServerAdapter(server, JBossServer.class);
+ String host = jbossServer.getHost();
+ int webPort = jbossServer.getJBossWebPort();
+ String consoleUrl = MessageFormat.format(CONSOLE_URL_PATTERN, host, String.valueOf(webPort));
+ BrowserUtil.checkedCreateInternalBrowser(
+ consoleUrl, server.getName(), JBossServerUIPlugin.PLUGIN_ID, JBossServerUIPlugin.getDefault().getLog());
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/OpenManagementConsoleActionProvider.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2011-11-29 19:49:41 UTC (rev 36744)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2011-11-29 20:39:52 UTC (rev 36745)
@@ -374,6 +374,18 @@
</instanceof>
</enablement>
</actionProvider>
+ <actionProvider
+ class="org.jboss.ide.eclipse.as.ui.views.server.extensions.OpenManagementConsoleActionProvider"
+ id="org.jboss.ide.eclipse.as.ui.extensions.managementConsole">
+ <enablement>
+<!-- <instanceof
+ value="org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7Server">
+ </instanceof> -->
+ <instanceof
+ value="org.eclipse.wst.server.core.IServer">
+ </instanceof>
+ </enablement>
+ </actionProvider>
</extension>
@@ -396,6 +408,8 @@
<actionExtension
pattern="org.jboss.ide.eclipse.as.ui.extensions.serverLog"/>
<actionExtension
+ pattern="org.jboss.ide.eclipse.as.ui.extensions.managementConsole"/>
+ <actionExtension
pattern="org.jboss.tools.as.wst.server.ui.ServersView.ExploreActionProvider"/>
</includes>
</viewerActionBinding>
13 years, 1 month
JBoss Tools SVN: r36744 - in trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui: refactoring and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2011-11-29 14:49:41 -0500 (Tue, 29 Nov 2011)
New Revision: 36744
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/CDIRefactoringProcessor.java
Log:
Quickfix and Wizard for fixing ambigious injection warning is confusing https://issues.jboss.org/browse/JBIDE-9940
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java 2011-11-29 19:19:22 UTC (rev 36743)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java 2011-11-29 19:49:41 UTC (rev 36744)
@@ -177,7 +177,8 @@
}else{
String text = compilationUnit.findRecommendedLineSeparator()+IMPORT+SPACE+qualifiedName+SEMICOLON;
if(!isDuplicate(rootEdit, text)){
- TextEdit edit = new InsertEdit(compilationUnit.getImportContainer().getSourceRange().getOffset()+compilationUnit.getImportContainer().getSourceRange().getLength(), text);
+ int importPosition = findPositionForImport(compilationUnit);
+ TextEdit edit = new InsertEdit(importPosition, text);
rootEdit.addChild(edit);
}
}
@@ -185,6 +186,23 @@
return false;
}
+
+ private static int findPositionForImport(ICompilationUnit compilationUnit) throws JavaModelException{
+ if(compilationUnit.getImportContainer().exists()){
+ return compilationUnit.getImportContainer().getSourceRange().getOffset()+compilationUnit.getImportContainer().getSourceRange().getLength();
+ }else{
+ IPackageDeclaration[] packageDeclarations = compilationUnit.getPackageDeclarations();
+ if(packageDeclarations.length == 0){
+ return 0;
+ }
+ int position = 0;
+ for(IPackageDeclaration declaration : packageDeclarations){
+ position = declaration.getSourceRange().getOffset()+declaration.getSourceRange().getLength();
+ }
+ return position;
+ }
+ }
+
private static boolean isDuplicate(MultiTextEdit rootEdit, String text){
for(TextEdit edit : rootEdit.getChildren()){
if(edit instanceof InsertEdit && ((InsertEdit) edit).getText().equals(text))
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/CDIRefactoringProcessor.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/CDIRefactoringProcessor.java 2011-11-29 19:19:22 UTC (rev 36743)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/CDIRefactoringProcessor.java 2011-11-29 19:49:41 UTC (rev 36744)
@@ -33,8 +33,6 @@
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.jboss.tools.cdi.core.CDICoreMessages;
import org.jboss.tools.cdi.core.CDICoreNature;
import org.jboss.tools.cdi.core.CDICorePlugin;
@@ -42,7 +40,6 @@
import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.ui.CDIUIPlugin;
-import org.jboss.tools.common.text.ext.IMultiPageEditor;
public abstract class CDIRefactoringProcessor extends RefactoringProcessor {
protected static final RefactoringParticipant[] EMPTY_REF_PARTICIPANT = new RefactoringParticipant[0];
@@ -186,7 +183,9 @@
Display.getDefault().asyncExec(new Runnable() {
public void run() {
IEditorPart editor = getEditor(getFile());
- editor.doSave(new NullProgressMonitor());
+ if(editor != null){
+ editor.doSave(new NullProgressMonitor());
+ }
}
});
13 years, 1 month
JBoss Tools SVN: r36743 - trunk/download.jboss.org/jbosstools/builds/cascade.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-11-29 14:19:22 -0500 (Tue, 29 Nov 2011)
New Revision: 36743
Added:
trunk/download.jboss.org/jbosstools/builds/cascade/3.2.helios.html
Modified:
trunk/download.jboss.org/jbosstools/builds/cascade/3.3.indigo.html
trunk/download.jboss.org/jbosstools/builds/cascade/index.html
trunk/download.jboss.org/jbosstools/builds/cascade/trunk.html
Log:
rename index to 3.2.helios; update links (JBIDE-10278)
Copied: trunk/download.jboss.org/jbosstools/builds/cascade/3.2.helios.html (from rev 36742, trunk/download.jboss.org/jbosstools/builds/cascade/index.html)
===================================================================
--- trunk/download.jboss.org/jbosstools/builds/cascade/3.2.helios.html (rev 0)
+++ trunk/download.jboss.org/jbosstools/builds/cascade/3.2.helios.html 2011-11-29 19:19:22 UTC (rev 36743)
@@ -0,0 +1,130 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Build Job Cascade + Results</title>
+<style>
+@import url("../../web/site.css");
+</style>
+</head>
+<!--
+ s#_trunk#_stable_branch#g
+ s#_Trunk#_Stable_Branch#g
+ s#/trunk#/3.2_stable_branch#g
+-->
+<body>
+<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0">
+<table marginheight="0" marginwidth="0" leftmargin="0" topmargin="0"
+ cellspacing="0" cellpadding="0">
+ <tr>
+ <td colspan="2"><a href="https://www.jboss.org/tools"><img
+ src="https://www.jboss.org/dms/tools/images/tools-banner.png"
+ border="0" /></a></td>
+ </tr>
+ <tr>
+ <td class="bodyText">  </td>
+ </tr>
+ <tr>
+ <td class="bodyText">  </td>
+ <td class="bodyText"><h2 class="title">JBoss Tools 3.2.x <b style="color:black">/</b> <b style="color:red">JBoss Developer Studio 4.x</b> (Helios)</h2></td>
+ </tr>
+ <tr>
+ <td class="bodyText">  </td>
+ <td class="bodyText">
+ <p class="bodyText"><i>Note: <b style="color: red">red
+ links</b> require VPN access.</i>
+<h2 class="title">Build Job Cascade:</h2>
+<ul>
+ <li><a style="color: red"
+ href="https://hudson.qa.jboss.com/hudson/job/jbosstools-3.2_stable_branch.targe...">Local
+ Target Platform build</a> (build + publish)
+ <ul>
+ <li><a style="color: red"
+ href="https://hudson.qa.jboss.com/hudson/job/jbosstools-3.2_stable_branch.conti...">Continuous
+ build</a> (build only, no tests, no publish)</li>
+ <li><a style="color: red"
+ href="https://hudson.qa.jboss.com/hudson/job/jbosstools-3.2_stable_branch.tests">Tests
+ build</a> (build + tests, no publish)</li>
+ <li><a style="color: red"
+ href="https://hudson.qa.jboss.com/hudson/view/DevStudio/view/DevStudio_Stable_B...">All
+ components' jobs, including JBT core + drools, teiid, pi4soa, savara</a>
+ (build, test, publish) :: <b><a style="color: red"
+ href="https://hudson.qa.jboss.com/hudson/view/DevStudio/view/DevStudio_Stable_B...">list
+ of unstable jobs</a></b> - <a href=swimlanes.txt>Interdependencies between jobs, aka "swimlanes"</a></li>
+ <ul>
+ <li><a style="color: red"
+ href="https://hudson.qa.jboss.com/hudson/job/jbosstools-3.2_stable_branch.aggre...">Aggregate
+ build</a> (collect components into a single update site for downstream use and publishing to sf.net)</li>
+ </ul>
+ </ul>
+ <hr />
+ <li><a style="color: red"
+ href="https://hudson.qa.jboss.com/hudson/job/devstudio-4.1_stable_branch.target...">Local
+ JBDS Target Platform build</a> (build + publish)
+ <ul>
+ <ul>
+ <li><a style="color: red"
+ href="https://hudson.qa.jboss.com/hudson/job/devstudio-4.1_stable_branch.update...">JBDS
+ Aggregate site build</a> (build Core [JBT + JBDS], Extras, Tech Preview
+ sites, then publish)
+ <ul>
+ <li><a style="color: red"
+ href="https://hudson.qa.jboss.com/hudson/job/devstudio-4.1_stable_branch.product">JBDS
+ Product builds</a> (combine JBDS components + TP into installers,
+ publish)</li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+</ul>
+<h2 class="title">Results:</h2>
+<ul>
+ <li>JBT Target Platform build: <a
+ href="http://download.jboss.org/jbosstools/updates/target-platform/latest/">http://download.jboss.org/jbosstools/updates/target-platform/latest/</a>
+ <ul>
+ <li>JBT Component builds: <a
+ href="http://download.jboss.org/jbosstools/builds/staging/">http://download.jboss.org/jbosstools/builds/staging/</a>
+ :: <b><a
+ href="http://download.jboss.org/jbosstools/builds/staging/_composite_/3.2_stabl...">composite
+ update site</a></b>
+ <ul>
+ <li>JBT Aggregate builds: <a
+ href="http://download.jboss.org/jbosstools/builds/nightly/core/">http://download.jboss.org/jbosstools/builds/nightly/</a>
+ :: <a
+ href="http://download.jboss.org/jbosstools/builds/nightly/core/3.2_stable_branc...">latest
+ from trunk</a> :: <a
+ href="http://download.jboss.org/jbosstools/updates/nightly/core/3.2_stable_branch/">updates</a>
+ </ul>
+ </ul>
+ <hr />
+ <li>JBDS Target Platform build: <a style="color: red"
+ href="http://www.qa.jboss.com/binaries/RHDS/updates/jbds-target-platform/">http://www.qa.jboss.com/binaries/RHDS/updates/jbds-target-platform/</a>
+ <ul>
+ <ul>
+ <li>JBDS Aggregate updates: <a style="color: red"
+ href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-4.1_stable...">http://www.qa.jboss.com/binaries/RHDS/builds/staging/</a>
+ (Core [JBT + JBDS], Extras, Tech Preview)</li>
+ <ul>
+ <li>JBDS Product builds: <a style="color: red"
+ href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-4.1_stable...">http://www.qa.jboss.com/binaries/RHDS/builds/staging/</a>
+ :: <a style="color: red"
+ href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-4.1_stable...">latest</a> :: <a style="color: red"
+ href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-4.1_stable...">updates</a></li>
+ </ul>
+ </ul>
+ </ul>
+ </li>
+ </ul>
+ </td>
+ </tr>
+</table>
+<p align="right"><i><small>Last updated 2011-11-29</small></i>
+<br/><small><a href=trunk.html>trunk</a> :: <a href=3.3.indigo.html>3.3.x / 5.x (Indigo)</a> :: <a href=3.2.helios.html>3.2.x / 4.x (Helios)</a></small>
+</p>
+
+</body>
+</html>
Modified: trunk/download.jboss.org/jbosstools/builds/cascade/3.3.indigo.html
===================================================================
--- trunk/download.jboss.org/jbosstools/builds/cascade/3.3.indigo.html 2011-11-29 19:04:50 UTC (rev 36742)
+++ trunk/download.jboss.org/jbosstools/builds/cascade/3.3.indigo.html 2011-11-29 19:19:22 UTC (rev 36743)
@@ -26,7 +26,7 @@
</tr>
<tr>
<td class="bodyText">  </td>
- <td class="bodyText"><h2 class="title">JBoss Tools 3.3.x <b style="color:black">/</b> <b style="color:red">JBoss Developer Studio 5.x</b></h2></td>
+ <td class="bodyText"><h2 class="title">JBoss Tools 3.3.x <b style="color:black">/</b> <b style="color:red">JBoss Developer Studio 5.x</b> (Indigo)</h2></td>
</tr>
<tr>
<td class="bodyText">  </td>
@@ -46,16 +46,28 @@
href="https://hudson.qa.jboss.com/hudson/job/jbosstools-3.3_stable_branch.tests">Tests
build</a> (build + tests, no publish)</li>
<li><a style="color: red"
- href="https://hudson.qa.jboss.com/hudson/view/DevStudio/view/DevStudio_3.3.indigo/">All
- components' jobs, including JBT core + drools, teiid, pi4soa, savara</a>
+ href="https://hudson.qa.jboss.com/hudson/view/DevStudio/view/DevStudio_Stable_B...">All
+ components' jobs, including JBT - Core, JBT - SOA Tooling, Drools, Teiid, pi4soa, Savara</a>
(build, test, publish) :: <b><a style="color: red"
- href="https://hudson.qa.jboss.com/hudson/view/DevStudio/view/DevStudio_3.3.indi...">list
+ href="https://hudson.qa.jboss.com/hudson/view/DevStudio/view/DevStudio_Stable_B...">list
of unstable jobs</a></b> - <a href=swimlanes.txt>Interdependencies between jobs, aka "swimlanes"</a></li>
<ul>
<li><a style="color: red"
- href="https://hudson.qa.jboss.com/hudson/job/jbosstools-3.3_stable_branch.aggre...">Aggregate
+ href="https://hudson.qa.jboss.com/hudson/job/jbosstools-3.3_stable_branch.aggre...">JBT - Core
build</a> (collect components into a single update site for downstream use and publishing to sf.net)
</li>
+ <li><a style="color: red"
+ href="https://hudson.qa.jboss.com/hudson/job/jbosstools-3.3_stable_branch.soa-t...">JBT - SOA Tooling
+ build</a> (collect components into a single update site for downstream use and publishing to sf.net)
+ </li>
+ <li><a style="color: red"
+ href="https://hudson.qa.jboss.com/hudson/job/jbosstools-3.3_stable_branch.webto...">JBT - Web Tools
+ build</a> (collect components into a single update site for use as WTP Server Adapter)
+ </li>
+ <li><a style="color: red"
+ href="https://hudson.qa.jboss.com/hudson/job/jbosstools-3.3_stable_branch.botte...">JBT - Bot Tests
+ build</a> (collect all bot tests into a single update site)
+ </li>
</ul>
</ul>
<hr />
@@ -65,13 +77,16 @@
<ul>
<ul>
<li><a style="color: red"
+ href="https://hudson.qa.jboss.com/hudson/job/devstudio-5.0_stable_branch.soa-to...">JBDS
+ SOA Tooling site build</a> (build site, then publish)
+ <li><a style="color: red"
href="https://hudson.qa.jboss.com/hudson/job/devstudio-5.0_stable_branch.update...">JBDS
- Aggregate site build</a> (build Core [JBT + JBDS], Extras, Tech Preview
+ Aggregate site build</a> (build Core Subset [JBT + JBDS], Extras, Tech Preview
sites, then publish)
<ul>
<li><a style="color: red"
href="https://hudson.qa.jboss.com/hudson/job/devstudio-5.0_stable_branch.product">JBDS
- Product builds</a> (combine JBDS components + TP into installers,
+ Product builds</a> (combine JBDS components and TP into Core Site + Installers,
publish)</li>
</ul>
</li>
@@ -84,37 +99,52 @@
</ul>
<h2 class="title">Results:</h2>
<ul>
- <li>JBT Target Platform build: <a
- href="http://download.jboss.org/jbosstools/updates/target-platform_3.3.indigo/l...">http://download.jboss.org/jbosstools/updates/target-platform_3.3.indigo/l...</a> <b>NOTE: same as trunk</b>
+ <li><a
+ href="http://download.jboss.org/jbosstools/updates/target-platform_3.3.indigo/l...">JBT Target Platform</a>
+ <b>NOTE: same as trunk</b>
<ul>
- <li>JBT Component builds: <a
- href="http://download.jboss.org/jbosstools/builds/staging/">http://download.jboss.org/jbosstools/builds/staging/</a>
- :: <b><a
+ <li><a
+ href="http://download.jboss.org/jbosstools/builds/staging/">JBT Component builds</a> (staging)
+ :: <a
href="http://download.jboss.org/jbosstools/builds/staging/_composite_/3.3.indigo/">composite
- update site</a></b>
+ update site</a>
<ul>
- <li>JBT Aggregate builds: <a
- href="http://download.jboss.org/jbosstools/builds/nightly/">http://download.jboss.org/jbosstools/builds/nightly/</a>
- :: <a
- href="http://download.jboss.org/jbosstools/builds/nightly/3.3_stable_branch/lat...">latest
- from branch</a> :: <a
- href="http://download.jboss.org/jbosstools/updates/nightly/3.3_stable_branch/">updates</a>
+ <li><a href="http://download.jboss.org/jbosstools/builds/nightly/soa-tooling/">JBT - SOA Tooling</a> (nightly)
+ :: <a href="http://download.jboss.org/jbosstools/builds/nightly/soa-tooling/3.3.indig...">latest builds</a>
+ :: <b><a href="http://download.jboss.org/jbosstools/updates/nightly/soa-tooling/3.3.indigo/">latest updates</a></b>
+
+ <li><a href="http://download.jboss.org/jbosstools/builds/nightly/core/">JBT - Core Tools</a> (nightly)
+ :: <a href="http://download.jboss.org/jbosstools/builds/nightly/core/3.3.indigo/lates...">latest builds</a>
+ :: <b><a href="http://download.jboss.org/jbosstools/updates/nightly/core/3.3.indigo/">latest updates</a></b>
+
+ <li><a href="http://download.jboss.org/jbosstools/builds/nightly/webtools/">JBT - Web Tools</a> (nightly)
+ :: <a href="http://download.jboss.org/jbosstools/builds/nightly/webtools/3.3.indigo/l...">latest builds</a>
+ :: <b><a href="http://download.jboss.org/jbosstools/updates/nightly/webtools/3.3.indigo/">latest updates</a></b>
+
+ <li><a href="http://download.jboss.org/jbosstools/builds/nightly/bottests/">JBT - Bot Tests</a> (nightly)
+ :: <a href="http://download.jboss.org/jbosstools/builds/nightly/bottests/3.3.indigo/l...">latest builds</a>
+ :: <b><a href="http://download.jboss.org/jbosstools/updates/nightly/bottests/3.3.indigo/">latest updates</a></b>
+
</ul>
</ul>
<hr />
- <li>JBDS Target Platform build: <a style="color: red"
- href="http://www.qa.jboss.com/binaries/RHDS/updates/jbds-target-platform_3.3.in...">http://www.qa.jboss.com/binaries/RHDS/updates/jbds-target-platform_3.3.in...</a> <b>NOTE: same as trunk</b>
+ <li><a style="color: red"
+ href="http://www.qa.jboss.com/binaries/RHDS/updates/jbds-target-platform_3.3.in...">JBDS Target Platform</a>
+ <b>NOTE: same as trunk</b>
<ul>
<ul>
- <li>JBDS Aggregate updates: <a style="color: red"
- href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-5.0_stable...">http://www.qa.jboss.com/binaries/RHDS/builds/staging/</a>
- (Core [JBT + JBDS], Extras, Tech Preview)</li>
+ <li><b><a style="color: red"
+ href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-5.0_stable...">JBDS - SOA Tooling updates</a></b>
+ </li>
+ <li>JBDS - <b><a style="color: red"
+ href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-5.0_stable...">Extras</a></b> / Tech Preview
+ updates</a>
+ </li>
<ul>
- <li>JBDS Product builds: <a style="color: red"
- href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-5.0_stable...">http://www.qa.jboss.com/binaries/RHDS/builds/staging/</a>
- :: <a style="color: red"
- href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-5.0_stable...">latest</a> :: <a style="color: red"
- href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-5.0_stable...">updates</a></li>
+ <li><b><a style="color: red"
+ href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-5.0_stable...">JBDS Installers</a></b>
+ :: <b><a style="color: red"
+ href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-5.0_stable...">JBDS - Core Updates</a></b></li>
</ul>
</ul>
@@ -124,6 +154,9 @@
</td>
</tr>
</table>
-<p align="right"><i><small>Last updated 2011-06-16 16:54 GMT-5</small></i></p>
+<p align="right"><i><small>Last updated 2011-11-29</small></i>
+<br/><small><a href=trunk.html>trunk</a> :: <a href=3.3.indigo.html>3.3.x / 5.x (Indigo)</a> :: <a href=3.2.helios.html>3.2.x / 4.x (Helios)</a></small>
+</p>
+
</body>
</html>
Modified: trunk/download.jboss.org/jbosstools/builds/cascade/index.html
===================================================================
--- trunk/download.jboss.org/jbosstools/builds/cascade/index.html 2011-11-29 19:04:50 UTC (rev 36742)
+++ trunk/download.jboss.org/jbosstools/builds/cascade/index.html 2011-11-29 19:19:22 UTC (rev 36743)
@@ -1,127 +1,2 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<title>Build Job Cascade + Results</title>
-<style>
-@import url("../../web/site.css");
-</style>
-</head>
-<!--
- s#_trunk#_stable_branch#g
- s#_Trunk#_Stable_Branch#g
- s#/trunk#/3.2_stable_branch#g
--->
-<body>
-<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0">
-<table marginheight="0" marginwidth="0" leftmargin="0" topmargin="0"
- cellspacing="0" cellpadding="0">
- <tr>
- <td colspan="2"><a href="https://www.jboss.org/tools"><img
- src="https://www.jboss.org/dms/tools/images/tools-banner.png"
- border="0" /></a></td>
- </tr>
- <tr>
- <td class="bodyText">  </td>
- </tr>
- <tr>
- <td class="bodyText">  </td>
- <td class="bodyText"><h2 class="title">JBoss Tools 3.2.x <b style="color:black">/</b> <b style="color:red">JBoss Developer Studio 4.x</b></h2></td>
- </tr>
- <tr>
- <td class="bodyText">  </td>
- <td class="bodyText">
- <p class="bodyText"><i>Note: <b style="color: red">red
- links</b> require VPN access.</i>
-<h2 class="title">Build Job Cascade:</h2>
-<ul>
- <li><a style="color: red"
- href="https://hudson.qa.jboss.com/hudson/job/jbosstools-3.2_stable_branch.targe...">Local
- Target Platform build</a> (build + publish)
- <ul>
- <li><a style="color: red"
- href="https://hudson.qa.jboss.com/hudson/job/jbosstools-3.2_stable_branch.conti...">Continuous
- build</a> (build only, no tests, no publish)</li>
- <li><a style="color: red"
- href="https://hudson.qa.jboss.com/hudson/job/jbosstools-3.2_stable_branch.tests">Tests
- build</a> (build + tests, no publish)</li>
- <li><a style="color: red"
- href="https://hudson.qa.jboss.com/hudson/view/DevStudio/view/DevStudio_Stable_B...">All
- components' jobs, including JBT core + drools, teiid, pi4soa, savara</a>
- (build, test, publish) :: <b><a style="color: red"
- href="https://hudson.qa.jboss.com/hudson/view/DevStudio/view/DevStudio_Stable_B...">list
- of unstable jobs</a></b> - <a href=swimlanes.txt>Interdependencies between jobs, aka "swimlanes"</a></li>
- <ul>
- <li><a style="color: red"
- href="https://hudson.qa.jboss.com/hudson/job/jbosstools-3.2_stable_branch.aggre...">Aggregate
- build</a> (collect components into a single update site for downstream use and publishing to sf.net)</li>
- </ul>
- </ul>
- <hr />
- <li><a style="color: red"
- href="https://hudson.qa.jboss.com/hudson/job/devstudio-4.1_stable_branch.target...">Local
- JBDS Target Platform build</a> (build + publish)
- <ul>
- <ul>
- <li><a style="color: red"
- href="https://hudson.qa.jboss.com/hudson/job/devstudio-4.1_stable_branch.update...">JBDS
- Aggregate site build</a> (build Core [JBT + JBDS], Extras, Tech Preview
- sites, then publish)
- <ul>
- <li><a style="color: red"
- href="https://hudson.qa.jboss.com/hudson/job/devstudio-4.1_stable_branch.product">JBDS
- Product builds</a> (combine JBDS components + TP into installers,
- publish)</li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </li>
-</ul>
-<h2 class="title">Results:</h2>
-<ul>
- <li>JBT Target Platform build: <a
- href="http://download.jboss.org/jbosstools/updates/target-platform/latest/">http://download.jboss.org/jbosstools/updates/target-platform/latest/</a>
- <ul>
- <li>JBT Component builds: <a
- href="http://download.jboss.org/jbosstools/builds/staging/">http://download.jboss.org/jbosstools/builds/staging/</a>
- :: <b><a
- href="http://download.jboss.org/jbosstools/builds/staging/_composite_/3.2_stabl...">composite
- update site</a></b>
- <ul>
- <li>JBT Aggregate builds: <a
- href="http://download.jboss.org/jbosstools/builds/nightly/">http://download.jboss.org/jbosstools/builds/nightly/</a>
- :: <a
- href="http://download.jboss.org/jbosstools/builds/nightly/3.2_stable_branch/lat...">latest
- from trunk</a> :: <a
- href="http://download.jboss.org/jbosstools/updates/nightly/3.2_stable_branch/">updates</a>
- </ul>
- </ul>
- <hr />
- <li>JBDS Target Platform build: <a style="color: red"
- href="http://www.qa.jboss.com/binaries/RHDS/updates/jbds-target-platform/">http://www.qa.jboss.com/binaries/RHDS/updates/jbds-target-platform/</a>
- <ul>
- <ul>
- <li>JBDS Aggregate updates: <a style="color: red"
- href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-4.1_stable...">http://www.qa.jboss.com/binaries/RHDS/builds/staging/</a>
- (Core [JBT + JBDS], Extras, Tech Preview)</li>
- <ul>
- <li>JBDS Product builds: <a style="color: red"
- href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-4.1_stable...">http://www.qa.jboss.com/binaries/RHDS/builds/staging/</a>
- :: <a style="color: red"
- href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-4.1_stable...">latest</a> :: <a style="color: red"
- href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-4.1_stable...">updates</a></li>
- </ul>
- </ul>
- </ul>
- </li>
- </ul>
- </td>
- </tr>
-</table>
-<p align="right"><i><small>Last updated 2011-04-05 13:41 GMT-5</small></i></p>
-</body>
-</html>
+<meta http-equiv="refresh" content="0;url=trunk.html">
+
Modified: trunk/download.jboss.org/jbosstools/builds/cascade/trunk.html
===================================================================
--- trunk/download.jboss.org/jbosstools/builds/cascade/trunk.html 2011-11-29 19:04:50 UTC (rev 36742)
+++ trunk/download.jboss.org/jbosstools/builds/cascade/trunk.html 2011-11-29 19:19:22 UTC (rev 36743)
@@ -26,7 +26,7 @@
</tr>
<tr>
<td class="bodyText">  </td>
- <td class="bodyText"><h2 class="title">JBoss Tools 3.3.x <b style="color:black">/</b> <b style="color:red">JBoss Developer Studio 5.x</b></h2></td>
+ <td class="bodyText"><h2 class="title">JBoss Tools 3.3.x <b style="color:black">/</b> <b style="color:red">JBoss Developer Studio 5.x</b> (Indigo) <b style="color:black">[trunk]</b></h2></td>
</tr>
<tr>
<td class="bodyText">  </td>
@@ -47,15 +47,27 @@
build</a> (build + tests, no publish)</li>
<li><a style="color: red"
href="https://hudson.qa.jboss.com/hudson/view/DevStudio/view/DevStudio_Trunk/">All
- components' jobs, including JBT core + drools, teiid, pi4soa, savara</a>
+ components' jobs, including JBT - Core, JBT - SOA Tooling, Drools, Teiid, pi4soa, Savara</a>
(build, test, publish) :: <b><a style="color: red"
href="https://hudson.qa.jboss.com/hudson/view/DevStudio/view/DevStudio_Trunk/po...">list
of unstable jobs</a></b> - <a href=swimlanes.txt>Interdependencies between jobs, aka "swimlanes"</a></li>
<ul>
<li><a style="color: red"
- href="https://hudson.qa.jboss.com/hudson/job/jbosstools-3.3_trunk.aggregate">Aggregate
+ href="https://hudson.qa.jboss.com/hudson/job/jbosstools-3.3_trunk.aggregate">JBT - Core
build</a> (collect components into a single update site for downstream use and publishing to sf.net)
</li>
+ <li><a style="color: red"
+ href="https://hudson.qa.jboss.com/hudson/job/jbosstools-3.3_trunk.soa-tooling.a...">JBT - SOA Tooling
+ build</a> (collect components into a single update site for downstream use and publishing to sf.net)
+ </li>
+ <li><a style="color: red"
+ href="https://hudson.qa.jboss.com/hudson/job/jbosstools-3.3_trunk.webtools.aggr...">JBT - Web Tools
+ build</a> (collect components into a single update site for use as WTP Server Adapter)
+ </li>
+ <li><a style="color: red"
+ href="https://hudson.qa.jboss.com/hudson/job/jbosstools-3.3_trunk.bottests.aggr...">JBT - Bot Tests
+ build</a> (collect all bot tests into a single update site)
+ </li>
</ul>
</ul>
<hr />
@@ -65,13 +77,16 @@
<ul>
<ul>
<li><a style="color: red"
+ href="https://hudson.qa.jboss.com/hudson/job/devstudio-5.0_trunk.soa-tooling.up...">JBDS
+ SOA Tooling site build</a> (build site, then publish)
+ <li><a style="color: red"
href="https://hudson.qa.jboss.com/hudson/job/devstudio-5.0_trunk.updatesite">JBDS
- Aggregate site build</a> (build Core [JBT + JBDS], Extras, Tech Preview
+ Aggregate site build</a> (build Core Subset [JBT + JBDS], Extras, Tech Preview
sites, then publish)
<ul>
<li><a style="color: red"
href="https://hudson.qa.jboss.com/hudson/job/devstudio-5.0_trunk.product">JBDS
- Product builds</a> (combine JBDS components + TP into installers,
+ Product builds</a> (combine JBDS components and TP into Core Site + Installers,
publish)</li>
</ul>
</li>
@@ -84,37 +99,50 @@
</ul>
<h2 class="title">Results:</h2>
<ul>
- <li>JBT Target Platform build: <a
- href="http://download.jboss.org/jbosstools/updates/target-platform_3.3.indigo/l...">http://download.jboss.org/jbosstools/updates/target-platform_3.3.indigo/l...</a>
+ <li><a
+ href="http://download.jboss.org/jbosstools/updates/target-platform_3.3.indigo/l...">JBT Target Platform</a>
<ul>
- <li>JBT Component builds: <a
- href="http://download.jboss.org/jbosstools/builds/staging/">http://download.jboss.org/jbosstools/builds/staging/</a>
- :: <b><a
+ <li><a
+ href="http://download.jboss.org/jbosstools/builds/staging/">JBT Component builds</a> (staging)
+ ::<a
href="http://download.jboss.org/jbosstools/builds/staging/_composite_/trunk/">composite
- update site</a></b>
+ update site</a>
<ul>
- <li>JBT Aggregate builds: <a
- href="http://download.jboss.org/jbosstools/builds/nightly/">http://download.jboss.org/jbosstools/builds/nightly/</a>
- :: <a
- href="http://download.jboss.org/jbosstools/builds/nightly/trunk/latestBuild.html">latest
- from trunk</a> :: <a
- href="http://download.jboss.org/jbosstools/updates/nightly/trunk/">updates</a>
+ <li><a href="http://download.jboss.org/jbosstools/builds/nightly/soa-tooling/">JBT - SOA Tooling</a> (nightly)
+ :: <a href="http://download.jboss.org/jbosstools/builds/nightly/soa-tooling/trunk/lat...">latest builds</a>
+ :: <b><a href="http://download.jboss.org/jbosstools/updates/nightly/soa-tooling/trunk/">latest updates</a></b>
+
+ <li><a href="http://download.jboss.org/jbosstools/builds/nightly/core/">JBT - Core Tools</a> (nightly)
+ :: <a href="http://download.jboss.org/jbosstools/builds/nightly/core/trunk/latestBuil...">latest builds</a>
+ :: <b><a href="http://download.jboss.org/jbosstools/updates/nightly/core/trunk/">latest updates</a></b>
+
+ <li><a href="http://download.jboss.org/jbosstools/builds/nightly/webtools/">JBT - Web Tools</a> (nightly)
+ :: <a href="http://download.jboss.org/jbosstools/builds/nightly/webtools/trunk/latest...">latest builds</a>
+ :: <b><a href="http://download.jboss.org/jbosstools/updates/nightly/webtools/trunk/">latest updates</a></b>
+
+ <li><a href="http://download.jboss.org/jbosstools/builds/nightly/bottests/">JBT - Bot Tests</a> (nightly)
+ :: <a href="http://download.jboss.org/jbosstools/builds/nightly/bottests/trunk/latest...">latest builds</a>
+ :: <b><a href="http://download.jboss.org/jbosstools/updates/nightly/bottests/trunk/">latest updates</a></b>
+
</ul>
</ul>
<hr />
- <li>JBDS Target Platform build: <a style="color: red"
- href="http://www.qa.jboss.com/binaries/RHDS/updates/jbds-target-platform_3.3.in...">http://www.qa.jboss.com/binaries/RHDS/updates/jbds-target-platform_3.3.in...</a>
+ <li><a style="color: red"
+ href="http://www.qa.jboss.com/binaries/RHDS/updates/jbds-target-platform_3.3.in...">JBDS Target Platform</a>
<ul>
<ul>
- <li>JBDS Aggregate updates: <a style="color: red"
- href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-5.0_trunk....">http://www.qa.jboss.com/binaries/RHDS/builds/staging/</a>
- (Core [JBT + JBDS], Extras, Tech Preview)</li>
+ <li><b><a style="color: red"
+ href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-5.0_trunk....">JBDS - SOA Tooling updates</a></b>
+ </li>
+ <li>JBDS - <b><a style="color: red"
+ href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-5.0_trunk....">Extras</a></b> / Tech Preview
+ updates</a>
+ </li>
<ul>
- <li>JBDS Product builds: <a style="color: red"
- href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-5.0_trunk....">http://www.qa.jboss.com/binaries/RHDS/builds/staging/</a>
- :: <a style="color: red"
- href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-5.0_trunk....">latest</a> :: <a style="color: red"
- href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-5.0_trunk....">updates</a></li>
+ <li><b><a style="color: red"
+ href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-5.0_trunk....">JBDS Installers</a></b>
+ :: <b><a style="color: red"
+ href="http://www.qa.jboss.com/binaries/RHDS/builds/staging/devstudio-5.0_trunk....">JBDS - Core Updates</a></b></li>
</ul>
</ul>
@@ -124,6 +152,9 @@
</td>
</tr>
</table>
-<p align="right"><i><small>Last updated 2011-04-05 13:41 GMT-5</small></i></p>
+<p align="right"><i><small>Last updated 2011-11-29</small></i>
+<br/><small><a href=trunk.html>trunk</a> :: <a href=3.3.indigo.html>3.3.x / 5.x (Indigo)</a> :: <a href=3.2.helios.html>3.2.x / 4.x (Helios)</a></small>
+</p>
+
</body>
</html>
13 years, 1 month