JBoss Tools SVN: r25501 - in trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator: factory and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: bbrodt
Date: 2010-10-05 15:58:27 -0400 (Tue, 05 Oct 2010)
New Revision: 25501
Added:
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/wsdl/messages.properties
Modified:
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/Builder.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/factory/AdapterFactory.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/wsdl/Definitions.java
Log:
https://jira.jboss.org/browse/JBIDE-7116
Added <import> location checking: missing XSD imports are not reported by WSDL validator
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/Builder.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/Builder.java 2010-10-05 18:34:13 UTC (rev 25500)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/Builder.java 2010-10-05 19:58:27 UTC (rev 25501)
@@ -107,12 +107,16 @@
bDebug = toBoolean(args.get("debug"),false);
}
+
AdapterFactory.DEBUG = bDebug;
if (bDebug) {
p("Clear error messages from the cache ... (will re-load)");
Messages.clear();
- }
-
+ }
+
+ // https://jira.jboss.org/browse/JBIDE-7116
+ clearCach();
+
IProject myProject = this.getProject();
IResourceDelta resourceDelta = this.getDelta(myProject);
@@ -192,6 +196,14 @@
@SuppressWarnings("unchecked")
public void validate (IResource resource, IProgressMonitor monitor) throws CoreException {
+ // https://jira.jboss.org/browse/JBIDE-7116
+ // enable element location tracking for error reporting
+ // TODO: move this to somewhere more appropriate when fixing JBIDE-6839
+ Map<Object, Object> loadOptions = fResourceSet.getLoadOptions();
+ loadOptions.put("TRACK_LOCATION", Boolean.TRUE);
+ fResourceSet.setLoadOptions(loadOptions);
+
+
switch (resource.getType()) {
case IResource.FOLDER :
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/factory/AdapterFactory.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/factory/AdapterFactory.java 2010-10-05 18:34:13 UTC (rev 25500)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/factory/AdapterFactory.java 2010-10-05 19:58:27 UTC (rev 25501)
@@ -142,6 +142,9 @@
// Find the EObject reference to the emf model in the hierarchy of
// the
EObject eObj = (EObject) top.getUserData("emf.model");
+ // https://jira.jboss.org/browse/JBIDE-7116
+ if (eObj==null)
+ eObj = (EObject) elm.getUserData("emf.model");
result = adapt_EObject2IResource(eObj);
}
@@ -175,32 +178,43 @@
//message && fix
String msg = problem.getAttribute(IProblem.MESSAGE);
String rule = problem.getAttribute(IProblem.RULE);
-
- props.put("bpel.validation.rule", rule);
+
+ // https://jira.jboss.org/browse/JBIDE-7116
+ // fix ugliness in DEBUG mode (see "org.eclipse.bpel.validator.builder" buildCommand in .project)
+ if (rule!=null)
+ props.put("bpel.validation.rule", rule);
if (DEBUG) {
+ String emsg = msg;
Throwable t = problem.getAttribute(IProblem.EXCEPTION);
- String emsg = msg;
- emsg += " (rule=";
- emsg += rule;
+ if (rule!=null || t!=null) {
+
+ emsg += "(DEBUG: ";
+ if (rule!=null) {
+ emsg += "rule=";
+ emsg += rule;
+ }
- if (t != null) {
- emsg += "; stack=";
-
- int count = 0;
- for(StackTraceElement e : t.getStackTrace()) {
- emsg += "[" + count + "]";
- emsg += e.getClassName() + ".";
- emsg += e.getMethodName() + "@" + e.getLineNumber();
- count += 1;
- if (count > 2) {
- break;
+ if (t != null) {
+ if (rule!=null)
+ emsg += "; ";
+ emsg += "stack=";
+
+ int count = 0;
+ for(StackTraceElement e : t.getStackTrace()) {
+ emsg += "[" + count + "]";
+ emsg += e.getClassName() + ".";
+ emsg += e.getMethodName() + "@" + e.getLineNumber();
+ count += 1;
+ if (count > 2) {
+ break;
+ }
+ emsg += "/";
}
- emsg += "/";
}
+
+ emsg += ")";
}
-
- emsg += ")";
props.put(IMarker.MESSAGE, emsg);
} else {
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/wsdl/Definitions.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/wsdl/Definitions.java 2010-10-05 18:34:13 UTC (rev 25500)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/wsdl/Definitions.java 2010-10-05 19:58:27 UTC (rev 25501)
@@ -10,7 +10,33 @@
*******************************************************************************/
package org.eclipse.bpel.validator.wsdl;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.bpel.validator.IBPELMarker;
+import org.eclipse.bpel.validator.ModelQuery;
+import org.eclipse.bpel.validator.model.IModelQuery;
+import org.eclipse.bpel.validator.model.INode;
+import org.eclipse.bpel.validator.model.IProblem;
import org.eclipse.bpel.validator.model.Validator;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdapterManager;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.wst.wsdl.Definition;
+import org.eclipse.wst.wsdl.Import;
+import org.eclipse.wst.wsdl.internal.impl.ImportImpl;
+import org.eclipse.wst.wsdl.util.WSDLParser;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSchemaContent;
+import org.eclipse.xsd.impl.XSDImportImpl;
+import org.eclipse.xsd.impl.XSDIncludeImpl;
+import org.eclipse.xsd.util.XSDParser;
+import org.w3c.dom.Node;
/**
@@ -23,13 +49,105 @@
public class Definitions extends Validator {
+
+ // https://jira.jboss.org/browse/JBIDE-7116
+ // Added <import> location checking: missing XSD imports are not reported by WSDL validator!
+ @Override
+ protected void start() {
+ super.start();
+
+ Definition definition = (Definition)mModelQuery.adapt(mNode,EObject.class,ModelQuery.ADAPT_HINT_NONE);
+ List<EObject> unresolved = findUnresolvedImports(definition);
+
+ for (EObject obj : unresolved) {
+ String location = "unkonwn";
+ int startLine = 1, startCol = 1;
+ Node node = null;
+ if (obj instanceof Import) {
+ location = ((Import)obj).getLocationURI();
+ node = ((Import)obj).getElement();
+ startLine = WSDLParser.getStartLine(node);
+ startCol = WSDLParser.getStartColumn(node);
+ }
+ else if ( obj instanceof XSDImportImpl ) {
+ location = ((XSDImportImpl)obj).getSchemaLocation();
+ node = ((XSDImportImpl)obj).getElement();
+ startLine = XSDParser.getStartLine(node);
+ startCol = XSDParser.getStartColumn(node);
+ }
+ else if ( obj instanceof XSDIncludeImpl ) {
+ location = ((XSDIncludeImpl)obj).getSchemaLocation();
+ node = ((XSDIncludeImpl)obj).getElement();
+ startLine = XSDParser.getStartLine(node);
+ startCol = XSDParser.getStartColumn(node);
+ }
+ IProblem problem = createWarning( (INode)mModelQuery.adapt(obj,INode.class,IModelQuery.ADAPT_HINT_NONE) );
+
+ problem.fill("BPELC_IMPORT__UNRESOVED", //$NON-NLS-1$
+ toString(mNode.nodeName()),
+ location,
+ definition.getLocation());
+ problem.setAttribute(IProblem.LINE_NUMBER, startLine);
+ problem.setAttribute(IProblem.COLUMN_NUMBER, startCol);
+ }
+ }
- /** End of public rule methods.
- *
- * Other methods are support methods for this class to perform its
- * validation function.
- *
- */
+
+ @SuppressWarnings({ "restriction", "unchecked", "rawtypes" })
+ protected List<EObject> findUnresolvedImports(Definition definition) {
+ if (definition == null) {
+ return Collections.emptyList();
+ }
+
+ IAdapterManager adapterManager = Platform.getAdapterManager();
+ IFile file = (IFile)adapterManager.getAdapter(definition, IResource.class);
+ if (file!=null && file.exists())
+ try {
+ file.deleteMarkers(IBPELMarker.ID, false, IResource.DEPTH_INFINITE);
+// System.out.println("deleted markers from "+file);
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ ArrayList<EObject> imports = new ArrayList<EObject>();
+ if (definition.getImports() != null) {
+ Iterator defImp = definition.getImports().values().iterator();
+ while (defImp.hasNext()) {
+ List impList = (List) defImp.next();
+ for (int i=0; i<impList.size(); i++) {
+ ImportImpl wsdlImport = (ImportImpl) impList.get(i);
+ wsdlImport.importDefinitionOrSchema();
+ XSDSchema schema = wsdlImport.getESchema();
+ Definition wsdlDefinition = wsdlImport.getEDefinition();
+ if (schema==null && wsdlDefinition==null)
+ imports.add(wsdlImport);
+ // only look at top-level imports to avoid multiple reports of the same problem
+ imports.addAll(findUnresolvedImports(wsdlDefinition));
+ }
+ }
+ }
+ if (definition.getETypes() != null) {
+ List<XSDSchema> schemas = definition.getETypes().getSchemas();
+ for (XSDSchema si : schemas) {
+ for (XSDSchemaContent sc : si.getContents()) {
+ if (sc instanceof XSDIncludeImpl) {
+ XSDIncludeImpl inc = (XSDIncludeImpl)sc;
+ inc.getIncorporatedSchema();
+ if (inc.getResolvedSchema() == null)
+ imports.add(inc);
+ }
+ if (sc instanceof XSDImportImpl) {
+ XSDImportImpl imp = (XSDImportImpl)sc;
+ imp.importSchema();
+ if (imp.getResolvedSchema() == null)
+ imports.add(imp);
+ }
+ }
+ }
+ }
+ return imports;
+ }
}
Added: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/wsdl/messages.properties
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/wsdl/messages.properties (rev 0)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/wsdl/messages.properties 2010-10-05 19:58:27 UTC (rev 25501)
@@ -0,0 +1,8 @@
+# https://jira.jboss.org/browse/JBIDE-7116
+# BPELC_IMPORT__UNRESOVED
+# {0}: node name (import)
+# {1}: import namespace
+# {2}: import location
+BPELC_IMPORT__UNRESOVED.summary = Cannot import "{1}"
+BPELC_IMPORT__UNRESOVED = The "{1}" document could not be imported while parsing "{2}"
+BPELC_IMPORT__UNRESOVED.fix = Check that the document exists and that the location is correct
14 years, 3 months
JBoss Tools SVN: r25500 - in trunk: common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-10-05 14:34:13 -0400 (Tue, 05 Oct 2010)
New Revision: 25500
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELReference.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/ITextSourceReference.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidatorContext.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationErrorManager.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractSeamDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/ELValidatorWrapper.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamCoreValidatorWrapper.java
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java
Log:
https://jira.jboss.org/browse/JBIDE-7264 Increase EL validation performance for big projects.
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/ITextSourceReference.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/ITextSourceReference.java 2010-10-05 18:30:44 UTC (rev 25499)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/text/ITextSourceReference.java 2010-10-05 18:34:13 UTC (rev 25500)
@@ -19,10 +19,10 @@
/**
* @return start position of element in text
*/
- public int getStartPosition();
+ int getStartPosition();
/**
* @return number of characters of element in text
*/
- public int getLength();
+ int getLength();
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELReference.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELReference.java 2010-10-05 18:30:44 UTC (rev 25499)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELReference.java 2010-10-05 18:34:13 UTC (rev 25500)
@@ -41,6 +41,7 @@
private IFile resource;
private IPath path;
private int length;
+ private int lineNumber;
private int startPosition;
private ELExpression[] el;
private Set<IMarker> markers;
@@ -49,6 +50,20 @@
private List<SyntaxError> syntaxErrors;
private String source;
+ /**
+ * @return
+ */
+ public int getLineNumber() {
+ return lineNumber;
+ }
+
+ /**
+ * @param lineNumber the lineNumber to set
+ */
+ public void setLineNumber(int lineNumber) {
+ this.lineNumber = lineNumber;
+ }
+
/* (non-Javadoc)
* @see org.jboss.tools.seam.core.ISeamTextSourceReference#getLength()
*/
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java 2010-10-05 18:30:44 UTC (rev 25499)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/ELValidator.java 2010-10-05 18:34:13 UTC (rev 25500)
@@ -151,8 +151,13 @@
}
}
if(revalidateUnresolvedELs) {
+ int i=0;
for (ELReference el : elsToValidate) {
+ // Don't re-validate more than 1000 ELs.
if(!filesToValidate.contains(el.getResource())) {
+ if(i++>1000) {
+ break;
+ }
validateEL(el);
}
}
@@ -261,7 +266,7 @@
for (int i = 0; i < references.length; i++) {
if(!references[i].getSyntaxErrors().isEmpty()) {
for (SyntaxError error: references[i].getSyntaxErrors()) {
- addError(JSFValidationMessages.EL_SYNTAX_ERROR, JSFSeverityPreferences.EL_SYNTAX_ERROR, new String[]{"" + error.getProblem()}, 1, references[i].getStartPosition() + error.getPosition(), context.getResource());
+ addError(JSFValidationMessages.EL_SYNTAX_ERROR, JSFSeverityPreferences.EL_SYNTAX_ERROR, new String[]{"" + error.getProblem()}, references[i].getLineNumber(), 1, references[i].getStartPosition() + error.getPosition(), context.getResource());
// IMarker marker = addError(JSFValidationMessages.EL_SYNTAX_ERROR, JSFSeverityPreferences.EL_SYNTAX_ERROR, new String[]{"" + error.getProblem()}, 1, references[i].getStartPosition() + error.getPosition(), context.getResource());
// references[i].addMarker(marker);
}
@@ -371,7 +376,7 @@
length = propertyName.length();
}
// addError(JSFValidationMessages.UNPAIRED_GETTER_OR_SETTER, JSFSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, new String[]{propertyName, existedMethodName, missingMethodName}, length, startPosition, file);
- IMarker marker = addError(JSFValidationMessages.UNPAIRED_GETTER_OR_SETTER, JSFSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, new String[]{propertyName, existedMethodName, missingMethodName}, length, startPosition, file);
+ IMarker marker = addError(JSFValidationMessages.UNPAIRED_GETTER_OR_SETTER, JSFSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, new String[]{propertyName, existedMethodName, missingMethodName}, elReference.getLineNumber(), length, startPosition, file);
elReference.addMarker(marker);
}
}
@@ -407,11 +412,11 @@
// Mark invalid EL
if(unresolvedTokenIsVariable) {
// addError(JSFValidationMessages.UNKNOWN_EL_VARIABLE_NAME, JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, new String[]{varName}, lengthOfVarName, offsetOfVarName, file);
- IMarker marker = addError(JSFValidationMessages.UNKNOWN_EL_VARIABLE_NAME, JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, new String[]{varName}, lengthOfVarName, offsetOfVarName, file);
+ IMarker marker = addError(JSFValidationMessages.UNKNOWN_EL_VARIABLE_NAME, JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, new String[]{varName}, elReference.getLineNumber(), lengthOfVarName, offsetOfVarName, file);
elReference.addMarker(marker);
} else {
// addError(JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, new String[]{varName}, lengthOfVarName, offsetOfVarName, file);
- IMarker marker = addError(JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, new String[]{varName}, lengthOfVarName, offsetOfVarName, file);
+ IMarker marker = addError(JSFValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, JSFSeverityPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, new String[]{varName}, elReference.getLineNumber(), lengthOfVarName, offsetOfVarName, file);
elReference.addMarker(marker);
}
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2010-10-05 18:30:44 UTC (rev 25499)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2010-10-05 18:34:13 UTC (rev 25500)
@@ -41,6 +41,7 @@
import org.eclipse.jdt.ui.text.IJavaPartitions;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.rules.IToken;
@@ -303,6 +304,11 @@
List<ELInstance> is = model.getInstances();
ELReference elReference = new KbELReference();
+ try {
+ elReference.setLineNumber(document.getLineOfOffset(startEl));
+ } catch (BadLocationException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
elReference.setResource(file);
elReference.setEl(is);
elReference.setLength(value.length());
@@ -418,7 +424,7 @@
// The subsequently called functions may use the file and document
// already stored in context for their needs
- fillContextForChildNodes(document, context, parents);
+ fillContextForChildNodes(model.getStructuredDocument(), document, context, parents);
}
} catch (CoreException e) {
WebKbPlugin.getDefault().logError(e);
@@ -478,18 +484,18 @@
}
}
- private void fillContextForChildNodes(IDOMNode parent, ELContext context, List<String> parents) {
+ private void fillContextForChildNodes(IDocument document, IDOMNode parent, ELContext context, List<String> parents) {
NodeList children = parent.getChildNodes();
for(int i = 0; children != null && i < children.getLength(); i++) {
Node child = children.item(i);
if (child instanceof IDOMNode) {
- fillContextForNode((IDOMNode)child, context, parents);
- fillContextForChildNodes((IDOMNode)child, context, parents);
+ fillContextForNode(document, (IDOMNode)child, context, parents);
+ fillContextForChildNodes(document, (IDOMNode)child, context, parents);
}
}
}
- private void fillContextForNode(IDOMNode node, ELContext context, List<String> parents) {
+ private void fillContextForNode(IDocument document, IDOMNode node, ELContext context, List<String> parents) {
if (!(context instanceof FaceletPageContextImpl) && !(node instanceof IDOMElement)) {
// There is no any useful info for JSP in text nodes
return;
@@ -497,7 +503,7 @@
if (context instanceof XmlContextImpl) {
XmlContextImpl xmlContext = (XmlContextImpl)context;
- fillElReferencesForNode(node, xmlContext);
+ fillElReferencesForNode(document, node, xmlContext);
if (node instanceof IDOMElement) {
fillXMLNamespacesForNode((IDOMElement)node, xmlContext);
}
@@ -541,7 +547,7 @@
}
}
- private void fillElReferencesForNode(IDOMNode node, XmlContextImpl context) {
+ private void fillElReferencesForNode(IDocument document, IDOMNode node, XmlContextImpl context) {
if(Node.ELEMENT_NODE == node.getNodeType() || Node.TEXT_NODE == node.getNodeType()) {
IStructuredDocumentRegion regionNode = node.getFirstStructuredDocumentRegion();
if (regionNode == null)
@@ -567,6 +573,11 @@
elReference.setEl(is);
elReference.setLength(text.length());
elReference.setStartPosition(offset);
+ try {
+ elReference.setLineNumber(document.getLineOfOffset(offset) + 1);
+ } catch (BadLocationException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
elReference.setSyntaxErrors(model.getSyntaxErrors());
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidatorContext.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidatorContext.java 2010-10-05 18:30:44 UTC (rev 25499)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidatorContext.java 2010-10-05 18:34:13 UTC (rev 25500)
@@ -44,15 +44,17 @@
elsByVariableName.put(variableName, linkedEls);
}
// save linked ELs.
- linkedEls.add(el);
-
- // Save link between EL and variable names.
- Set<String> variableNames = variableNamesByEl.get(el);
- if(variableNames==null) {
- variableNames = new HashSet<String>();
- variableNamesByEl.put(el, variableNames);
+ // don't save links if there are more than 500 ELs for the var name.
+ if(linkedEls.size()<500) {
+ linkedEls.add(el);
+ // Save link between EL and variable names.
+ Set<String> variableNames = variableNamesByEl.get(el);
+ if(variableNames==null) {
+ variableNames = new HashSet<String>();
+ variableNamesByEl.put(el, variableNames);
+ }
+ variableNames.add(variableName);
}
- variableNames.add(variableName);
// Save link between EL and resource.
Set<ELReference> els = elsByResource.get(el.getPath());
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java 2010-10-05 18:30:44 UTC (rev 25499)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ValidationErrorManager.java 2010-10-05 18:34:13 UTC (rev 25500)
@@ -123,7 +123,7 @@
public IMarker addError(String message, String preferenceKey,
String[] messageArguments, ITextSourceReference location,
IResource target) {
- return addError(message, preferenceKey, messageArguments, location
+ return addError(message, preferenceKey, messageArguments, 0, location
.getLength(), location.getStartPosition(), target);
}
@@ -145,7 +145,7 @@
*/
public IMarker addError(String message, String preferenceKey,
String[] messageArguments, IResource target) {
- return addError(message, preferenceKey, messageArguments, 0, 0, target);
+ return addError(message, preferenceKey, messageArguments, 0, 0, 0, target);
}
private String getMarkerId() {
@@ -164,7 +164,7 @@
* @see org.jboss.tools.seam.internal.core.validation.IValidationErrorManager#addError(java.lang.String, java.lang.String, java.lang.String[], int, int, org.eclipse.core.resources.IResource)
*/
public IMarker addError(String message, String preferenceKey,
- String[] messageArguments, int length, int offset, IResource target) {
+ String[] messageArguments, int lineNumber, int length, int offset, IResource target) {
String preferenceValue = getPreference(target.getProject(), preferenceKey);
IMarker marker = null;
if (!SeverityPreferences.IGNORE.equals(preferenceValue)) {
@@ -172,11 +172,16 @@
if (SeverityPreferences.WARNING.equals(preferenceValue)) {
severity = IMessage.NORMAL_SEVERITY;
}
- marker = addError(message, severity, messageArguments, length, offset, target, getDocumentProvider(), getMarkerId(), getMarkerOwner());
+ marker = addError(message, severity, messageArguments, lineNumber, length, offset, target, getDocumentProvider(), getMarkerId(), getMarkerOwner());
}
return marker;
}
+ public IMarker addError(String message, String preferenceKey,
+ String[] messageArguments, int length, int offset, IResource target) {
+ return addError(message, preferenceKey, messageArguments, 0, length, offset, target);
+ }
+
protected TextFileDocumentProvider getDocumentProvider() {
if(documentProvider==null) {
if(coreHelper!=null) {
@@ -200,8 +205,8 @@
* (non-Javadoc)
* @see org.jboss.tools.seam.internal.core.validation.IValidationErrorManager#addError(java.lang.String, int, java.lang.String[], int, int, org.eclipse.core.resources.IResource)
*/
- public IMarker addError(String message, int severity, String[] messageArguments, int length, int offset, IResource target) {
- return addError(message, severity, messageArguments, length, offset, target, getDocumentProvider(), getMarkerId(), getMarkerOwner());
+ public IMarker addError(String message, int severity, String[] messageArguments, int lineNumber, int length, int offset, IResource target) {
+ return addError(message, severity, messageArguments, lineNumber, length, offset, target, getDocumentProvider(), getMarkerId(), getMarkerOwner());
}
/**
@@ -217,22 +222,25 @@
* @param markerOwner
* @return
*/
- public static IMarker addError(String message, int severity, Object[] messageArguments, int length, int offset, IResource target, TextFileDocumentProvider documentProvider, String markerId, Class markerOwner) {
+ public static IMarker addError(String message, int severity, Object[] messageArguments, int lineNumber, int length, int offset, IResource target, TextFileDocumentProvider documentProvider, String markerId, Class markerOwner) {
IMarker marker = null;
- int lineNumber = 1;
try {
- if (documentProvider != null) {
- documentProvider.connect(target);
- IDocument doc = documentProvider.getDocument(target);
- if(doc != null){
- lineNumber = doc.getLineOfOffset(offset) + 1;
+ if(lineNumber<1) {
+ if (documentProvider != null) {
+ documentProvider.connect(target);
+ IDocument doc = documentProvider.getDocument(target);
+ if(doc != null){
+ try {
+ lineNumber = doc.getLineOfOffset(offset) + 1;
+ } catch (BadLocationException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+ }
}
}
- marker = addTask(markerOwner.getName().intern(), target, lineNumber, MessageFormat.format(message, messageArguments),
+ marker = addTask(markerOwner.getName().intern(), target, lineNumber,
+ MessageFormat.format(message, messageArguments),
severity, null, markerId, offset, length);
- } catch (BadLocationException e) {
- WebKbPlugin.getDefault().logError(
- NLS.bind(KbMessages.EXCEPTION_DURING_CREATING_MARKER, target.getFullPath()), e);
} catch (CoreException e) {
WebKbPlugin.getDefault().logError(
NLS.bind(KbMessages.EXCEPTION_DURING_CREATING_MARKER, target.getFullPath()), e);
@@ -254,6 +262,11 @@
}
int severity = getSeverity(markerType);
+ int existingMarkers = resource.findMarkers(VALIDATION_MARKER, true, IResource.DEPTH_ZERO).length;
+ if(existingMarkers>1) {
+ return null;
+ }
+
IMarker item = resource.createMarker(VALIDATION_MARKER); // add a validation marker
boolean offsetSet = ((offset != IMessage.OFFSET_UNSET) && (length != IMessage.OFFSET_UNSET));
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationErrorManager.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationErrorManager.java 2010-10-05 18:30:44 UTC (rev 25499)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/validation/IValidationErrorManager.java 2010-10-05 18:34:13 UTC (rev 25500)
@@ -77,6 +77,18 @@
* @param target
*/
IMarker addError(String message, String preferenceKey,
+ String[] messageArguments, int lineNumber, int length, int offset, IResource target);
+
+ /**
+ * Adds a marker to the resource
+ * @param message
+ * @param preferenceKey
+ * @param messageArguments
+ * @param length
+ * @param offset
+ * @param target
+ */
+ IMarker addError(String message, String preferenceKey,
String[] messageArguments, int length, int offset, IResource target);
/**
@@ -88,7 +100,7 @@
* @param offset
* @param target
*/
- IMarker addError(String message, int severity, String[] messageArguments, int length, int offset, IResource target);
+ IMarker addError(String message, int severity, String[] messageArguments, int lineNumber, int length, int offset, IResource target);
/**
* Displays a subtask in the progress view.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractSeamDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractSeamDeclaration.java 2010-10-05 18:30:44 UTC (rev 25499)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/AbstractSeamDeclaration.java 2010-10-05 18:34:13 UTC (rev 25500)
@@ -37,7 +37,7 @@
protected String name;
protected Map<String,IValueInfo> attributes = new HashMap<String, IValueInfo>();
-
+
public AbstractSeamDeclaration() {}
public String getName() {
@@ -47,7 +47,7 @@
public void setName(String name) {
this.name = name;
}
-
+
public void open() {}
public int getLength() {
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2010-10-05 18:30:44 UTC (rev 25499)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamCoreValidator.java 2010-10-05 18:34:13 UTC (rev 25500)
@@ -142,6 +142,7 @@
ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, false);
if(seamProject!=null) {
rootContext = seamProject.getValidationContext();
+ war = project;
}
}
@@ -152,7 +153,7 @@
projects.add(array[i]);
}
}
- return new ValidatingProjectSet(project, projects, rootContext);
+ return new ValidatingProjectSet(war, projects, rootContext);
}
/*
@@ -1045,7 +1046,9 @@
IResource target, int messageId) {
IMarker marker = addError(message, preferenceKey, messageArguments, location, target);
try{
- marker.setAttribute(MESSAGE_ID_ATTRIBUTE_NAME, new Integer(messageId));
+ if(marker!=null) {
+ marker.setAttribute(MESSAGE_ID_ATTRIBUTE_NAME, new Integer(messageId));
+ }
}catch(CoreException ex){
SeamCorePlugin.getDefault().logError(ex);
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java 2010-10-05 18:30:44 UTC (rev 25499)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamEarProjectValidator.java 2010-10-05 18:34:13 UTC (rev 25500)
@@ -188,11 +188,11 @@
int position = offset + text.indexOf(jarName);
int length = jarName.length();
if(SEAM_JAR_NAME.equals(jarName)) {
- ValidationErrorManager.addError(SeamValidationMessages.INVALID_JAR_MODULE_IN_APPLICATION_XML, IMessage.HIGH_SEVERITY, new String[]{jarName}, length, position, file, documentProvider, SeamValidationErrorManager.MARKED_SEAM_PROJECT_MESSAGE_GROUP, this.getClass());
+ ValidationErrorManager.addError(SeamValidationMessages.INVALID_JAR_MODULE_IN_APPLICATION_XML, IMessage.HIGH_SEVERITY, new String[]{jarName}, 0, length, position, file, documentProvider, SeamValidationErrorManager.MARKED_SEAM_PROJECT_MESSAGE_GROUP, this.getClass());
break;
}
if(jarName.startsWith(JARS[jarIndex])) {
- ValidationErrorManager.addError(SeamValidationMessages.INVALID_JAR_MODULE_IN_APPLICATION_XML, IMessage.NORMAL_SEVERITY, new String[]{jarName}, length, position, file, documentProvider, SeamValidationErrorManager.MARKED_SEAM_PROJECT_MESSAGE_GROUP, this.getClass());
+ ValidationErrorManager.addError(SeamValidationMessages.INVALID_JAR_MODULE_IN_APPLICATION_XML, IMessage.NORMAL_SEVERITY, new String[]{jarName}, 0, length, position, file, documentProvider, SeamValidationErrorManager.MARKED_SEAM_PROJECT_MESSAGE_GROUP, this.getClass());
break;
}
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java 2010-10-05 18:30:44 UTC (rev 25499)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamProjectPropertyValidator.java 2010-10-05 18:34:13 UTC (rev 25500)
@@ -334,13 +334,15 @@
public void validate(IValidationContext helper, IReporter reporter) throws ValidationException {
validateInJob(helper, reporter);
}
-
+
public IMarker addError(String message, String preferenceKey,
String[] messageArguments, IResource target, int messageId) {
IMarker marker = errorManager.addError(message, preferenceKey, messageArguments, target);
- try{
- marker.setAttribute(MESSAGE_ID_ATTRIBUTE_NAME, new Integer(messageId));
- }catch(CoreException ex){
+ try {
+ if(marker!=null) {
+ marker.setAttribute(MESSAGE_ID_ATTRIBUTE_NAME, new Integer(messageId));
+ }
+ } catch(CoreException ex) {
SeamCorePlugin.getDefault().logError(ex);
}
return marker;
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/ELValidatorWrapper.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/ELValidatorWrapper.java 2010-10-05 18:30:44 UTC (rev 25499)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/ELValidatorWrapper.java 2010-10-05 18:34:13 UTC (rev 25500)
@@ -20,10 +20,10 @@
}
@Override
public IMarker addError(String message, int severity,
- String[] messageArguments, int length, int offset,
+ String[] messageArguments, int lineNumber, int length, int offset,
IResource target) {
- IMarker marker= super.addError(message, severity, messageArguments, length, offset,
+ IMarker marker= super.addError(message, severity, messageArguments, lineNumber, length, offset,
target);
validatorSupport.add(marker);
return marker;
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamCoreValidatorWrapper.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamCoreValidatorWrapper.java 2010-10-05 18:30:44 UTC (rev 25499)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamCoreValidatorWrapper.java 2010-10-05 18:34:13 UTC (rev 25500)
@@ -1,7 +1,5 @@
package org.jboss.tools.seam.core.test.validation;
-import java.text.MessageFormat;
-import java.util.HashSet;
import java.util.List;
import org.eclipse.core.resources.IFile;
@@ -10,10 +8,6 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.wst.validation.internal.core.ValidationException;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-import org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper;
-import org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager;
import org.jboss.tools.seam.internal.core.validation.SeamCoreValidator;
public class SeamCoreValidatorWrapper extends SeamCoreValidator implements IValidatorSupport{
@@ -25,9 +19,9 @@
}
@Override
public IMarker addError(String message, int severity,
- String[] messageArguments, int length, int offset,
+ String[] messageArguments, int lineNumber, int length, int offset,
IResource target) {
- IMarker marker = super.addError(message, severity, messageArguments, length, offset,
+ IMarker marker = super.addError(message, severity, messageArguments, lineNumber, length, offset,
target);
validatorSupport.add(marker);
return marker;
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java 2010-10-05 18:30:44 UTC (rev 25499)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/validation/SeamProjectPropertyValidatorWrapper.java 2010-10-05 18:34:13 UTC (rev 25500)
@@ -12,7 +12,6 @@
import org.eclipse.wst.validation.internal.core.ValidationException;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
import org.jboss.tools.common.text.ITextSourceReference;
import org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper;
import org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager;
@@ -163,8 +162,8 @@
}
public IMarker addError(String message, int severity,
- String[] messageArguments, int length, int offset, IResource target) {
- IMarker marker = errorManager.addError(message, severity, messageArguments, length, offset, target);
+ String[] messageArguments, int lineNumber, int length, int offset, IResource target) {
+ IMarker marker = errorManager.addError(message, severity, messageArguments, lineNumber, length, offset, target);
support.add(marker);
return marker;
}
@@ -184,4 +183,12 @@
public void removeAllMessagesFromResource(IResource resource) {
errorManager.removeAllMessagesFromResource(resource);
}
-}
+
+ public IMarker addError(String message, String preferenceKey,
+ String[] messageArguments, int lineNumber, int length, int offset,
+ IResource target) {
+ IMarker marker = errorManager.addError(message, preferenceKey, messageArguments, lineNumber, length, offset, target);
+ support.add(marker);
+ return marker;
+ }
+}
\ No newline at end of file
14 years, 3 months
JBoss Tools SVN: r25499 - in trunk: vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2010-10-05 14:30:44 -0400 (Tue, 05 Oct 2010)
New Revision: 25499
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsUtils.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardPage.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/VpeMenuCreator.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
Log:
https://jira.jboss.org/browse/JBIDE-7222 , correcting dialog's behavior when several tags have been selected at one time.
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsUtils.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsUtils.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsUtils.java 2010-10-05 18:30:44 UTC (rev 25499)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.jst.jsp.i18n;
+
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.w3c.dom.Element;
+
+/**
+ * The Utils class for externalize strings routine.
+ */
+public class ExternalizeStringsUtils {
+
+ /**
+ * Checks that the user has selected a correct string.
+ *
+ * @param selection the current selection
+ * @return <code>true</code> if correct
+ */
+ public static boolean isSelectionCorrect(ISelection selection) {
+ boolean isSelectionCorrect = false;
+ if ((selection instanceof TextSelection)
+ && (selection instanceof IStructuredSelection)
+ && (((IStructuredSelection) selection).size() == 1)) {
+ /*
+ * In general selection is correct now except one case:
+ */
+ isSelectionCorrect = true;
+ /*
+ * If the whole tag is selected -- check if it has children.
+ * The wizard could not find a proper string to externalize
+ * among several tags.
+ */
+ Object selectedElement = ((IStructuredSelection) selection).getFirstElement();
+ if (selectedElement instanceof Element) {
+ Element element = (Element) selectedElement;
+ if (element.hasChildNodes()) {
+ isSelectionCorrect = false;
+ }
+ }
+ }
+ return isSelectionCorrect;
+ }
+
+}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardPage.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardPage.java 2010-10-05 17:56:17 UTC (rev 25498)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardPage.java 2010-10-05 18:30:44 UTC (rev 25499)
@@ -111,8 +111,18 @@
private Status propsValueStatus;
private Status duplicateKeyStatus;
private Table tagsTable;
-
-
+
+ /**
+ * Creates the wizard page
+ *
+ * @param pageName
+ * the name of the page
+ * @param editor
+ * the source text editor
+ * @param bm
+ * bundle map, or <code>null</code> - then the bundle map will be
+ * created and initialized manually
+ */
public ExternalizeStringsWizardPage(String pageName, ITextEditor editor, BundleMap bm) {
/*
* Setting dialog Title, Description, Image.
@@ -261,7 +271,7 @@
*/
private void initializeFieldsAndAddLIsteners() {
ISelection sel = editor.getSelectionProvider().getSelection();
- if (isSelectionCorrect(sel)) {
+ if (ExternalizeStringsUtils.isSelectionCorrect(sel)) {
String text = Constants.EMPTY;
String stringToUpdate = Constants.EMPTY;
TextSelection textSelection = null;
@@ -419,21 +429,6 @@
}
/**
- * Checks user has selected a correct string.
- *
- * @param selection the current selection
- * @return <code>true</code> if correct
- */
- private boolean isSelectionCorrect(ISelection selection) {
- if ((selection instanceof TextSelection)
- && (selection instanceof IStructuredSelection)
- && (((IStructuredSelection) selection).size() == 1)) {
- return true;
- }
- return false;
- }
-
- /**
* Checks keys in the selected resource bundle.
*
* @param key the key name
@@ -549,7 +544,7 @@
IDocumentProvider prov = editor.getDocumentProvider();
IDocument doc = prov.getDocument(editor.getEditorInput());
ISelection sel = editor.getSelectionProvider().getSelection();
- if (isSelectionCorrect(sel)) {
+ if (ExternalizeStringsUtils.isSelectionCorrect(sel)) {
try {
/*
* Get source text and new text
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/VpeMenuCreator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/VpeMenuCreator.java 2010-10-05 17:56:17 UTC (rev 25498)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/VpeMenuCreator.java 2010-10-05 18:30:44 UTC (rev 25499)
@@ -22,6 +22,7 @@
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.texteditor.AbstractTextEditor;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.jboss.tools.jst.jsp.i18n.ExternalizeStringsUtils;
import org.jboss.tools.vpe.VpeDebug;
import org.jboss.tools.vpe.editor.VpeEditorPart;
import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
@@ -91,7 +92,10 @@
* https://jira.jboss.org/browse/JBIDE-7222
* Adding ExternalizeStrings dialog to the VPE context menu
*/
-// menuManager.add(new ExternalizeStringsContributionItem());
+// if (ExternalizeStringsUtils.isSelectionCorrect(
+// vpeMenuUtil.getSelection())) {
+// menuManager.add(new ExternalizeStringsContributionItem());
+// }
addSeparator();
if (topLevelMenu) {
addZoomActions();
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2010-10-05 17:56:17 UTC (rev 25498)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2010-10-05 18:30:44 UTC (rev 25499)
@@ -36,6 +36,7 @@
import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.ProgressEvent;
import org.eclipse.swt.browser.ProgressListener;
@@ -65,6 +66,7 @@
import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.i18n.ExternalizeStringsDialog;
+import org.jboss.tools.jst.jsp.i18n.ExternalizeStringsUtils;
import org.jboss.tools.jst.jsp.i18n.ExternalizeStringsWizard;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
@@ -101,6 +103,7 @@
import org.mozilla.interfaces.nsIHTMLObjectResizer;
import org.mozilla.interfaces.nsIPlaintextEditor;
import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
public class MozillaEditor extends EditorPart implements IReusableEditor {
protected static final File INIT_FILE = new File(VpePlugin.getDefault().getResourcePath("ve"), "init.html"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -1110,6 +1113,55 @@
// StructuredTextEditor editor = controller.getSourceEditor();
// ISelection sel = editor.getSelectionProvider().getSelection();
// String stringToUpdate = Constants.EMPTY;
+// if (ExternalizeStringsUtils.isSelectionCorrect(sel)) {
+// String text = Constants.EMPTY;
+// TextSelection textSelection = null;
+// IStructuredSelection structuredSelection = (IStructuredSelection) sel;
+// textSelection = (TextSelection) sel;
+// text = textSelection.getText();
+// Object selectedElement = structuredSelection.getFirstElement();
+// /*
+// * When selected text is empty parse selected element and find a
+// * string to replace..
+// */
+// if ((text.trim().length() == 0)) {
+// if (selectedElement instanceof org.w3c.dom.Text) {
+// /*
+// * ..it could be a plain text
+// */
+// org.w3c.dom.Text textNode = (org.w3c.dom.Text) selectedElement;
+// if (textNode.getNodeValue().trim().length() > 0) {
+// stringToUpdate = textNode.getNodeValue();
+// }
+// } else if (selectedElement instanceof Attr) {
+// /*
+// * ..or an attribute's value
+// */
+// Attr attrNode = (Attr) selectedElement;
+// if (attrNode.getNodeValue().trim().length() > 0) {
+// stringToUpdate = attrNode.getNodeValue();
+// }
+// }
+// } else {
+// stringToUpdate = text;
+// }
+// }
+// if ((stringToUpdate.length() > 0)) {
+// externalizeStringsAction.setEnabled(true);
+// } else {
+// externalizeStringsAction.setEnabled(false);
+// }
+// }
+// /**
+// * Update Externalize Strings toolbar icon state.
+// * <p>
+// * Enables the button when suitable text is selected.
+// * Disabled otherwise.
+// */
+// public void updateExternalizeStringsToolbarIconState() {
+// StructuredTextEditor editor = controller.getSourceEditor();
+// ISelection sel = editor.getSelectionProvider().getSelection();
+// String stringToUpdate = Constants.EMPTY;
// if ((sel instanceof TextSelection)
// && (sel instanceof IStructuredSelection)
// && (((IStructuredSelection) sel).size() == 1)) {
14 years, 3 months
JBoss Tools SVN: r25498 - trunk/seam/features/org.jboss.tools.seam.test.feature.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2010-10-05 13:56:17 -0400 (Tue, 05 Oct 2010)
New Revision: 25498
Modified:
trunk/seam/features/org.jboss.tools.seam.test.feature/feature.xml
Log:
https://jira.jboss.org/browse/JBIDE-2850 Run JUnit tests for relevant Seam Distributions
fix for seam tests feature.xm
Modified: trunk/seam/features/org.jboss.tools.seam.test.feature/feature.xml
===================================================================
--- trunk/seam/features/org.jboss.tools.seam.test.feature/feature.xml 2010-10-05 17:19:05 UTC (rev 25497)
+++ trunk/seam/features/org.jboss.tools.seam.test.feature/feature.xml 2010-10-05 17:56:17 UTC (rev 25498)
@@ -85,13 +85,6 @@
unpack="false"/>
<plugin
- id="org.jboss.tools.seam203CR1.core201.test"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
id="org.jboss.tools.seam203CR1.ui.test"
download-size="0"
install-size="0"
@@ -133,4 +126,74 @@
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="org.jboss.tools.seam212GA.ui.test"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.jboss.tools.seam221CR1.ui.test"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.jboss.tools.seam221CR2.ui.test"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.jboss.tools.seam203CR1.core.test"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.jboss.tools.seam211GA.core.test"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.jboss.tools.seam212GA.core.test"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.jboss.tools.seam220CR1.core.test"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.jboss.tools.seam220GA.core.test"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.jboss.tools.seam221CR1.core.test"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.jboss.tools.seam221CR2.core.test"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
</feature>
14 years, 3 months
JBoss Tools SVN: r25497 - in trunk/seam/tests: org.jboss.tools.seam220CR1.core.test and 10 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2010-10-05 13:19:05 -0400 (Tue, 05 Oct 2010)
New Revision: 25497
Added:
trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/
trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/.classpath
trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/.project
trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/META-INF/
trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/META-INF/MANIFEST.MF
trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/about.html
trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/build.properties
trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/plugin.properties
trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/pom.xml
trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/requirements.properties
trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/src/
trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/src/org/
trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/src/org/jboss/
trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/src/org/jboss/tools/
trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/src/org/jboss/tools/seam/
trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/src/org/jboss/tools/seam/core/
trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/src/org/jboss/tools/seam/core/test/
trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/src/org/jboss/tools/seam/core/test/project/
trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/src/org/jboss/tools/seam/core/test/project/facet/
trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/src/org/jboss/tools/seam/core/test/project/facet/Seam20XFacetTestSuite220CR1.java
Log:
https://jira.jboss.org/browse/JBIDE-2850 Run JUnit tests for relevant Seam Distributions
missing test plugin added to fix continuous build
Added: trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/.classpath
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/.classpath (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/.classpath 2010-10-05 17:19:05 UTC (rev 25497)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/.project
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/.project (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/.project 2010-10-05 17:19:05 UTC (rev 25497)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.seam220CR1.core.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/.project
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/META-INF/MANIFEST.MF (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/META-INF/MANIFEST.MF 2010-10-05 17:19:05 UTC (rev 25497)
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name.0
+Bundle-SymbolicName: org.jboss.tools.seam220CR1.core.test;singleton:=true
+Bundle-Version: 3.1.0.qualifier
+Bundle-Vendor: %Bundle-Vendor.0
+Export-Package: org.jboss.tools.seam.core.test.project.facet
+Require-Bundle:
+ org.junit,
+ org.jboss.tools.tests;bundle-version="3.1.0",
+ org.jboss.tools.seam.core.test;bundle-version="3.1.0",
+ org.eclipse.wst.validation;bundle-version="1.2.200"
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
Added: trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/about.html
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/about.html (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/about.html 2010-10-05 17:19:05 UTC (rev 25497)
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+
+<BODY lang="EN-US">
+
+<H3>About This Content</H3>
+
+<P>©2007 Red Hat, Inc. All rights reserved</P>
+
+<H3>License</H3>
+
+<P>Red Hat Inc., through its JBoss division, makes available all content in this plug-in
+("Content"). Unless otherwise indicated below, the Content is provided to you
+under the terms and conditions of the Eclipse Public License Version 1.0
+("EPL"). A copy of the EPL is available at
+<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
+For purposes of the EPL, "Program" will mean the Content.</P>
+
+<P>If you did not receive this Content directly from Red Hat Inc., the
+Content is being redistributed by another party ("Redistributor") and different
+terms and conditions may apply to your use of any object code in the Content.
+Check the Redistributor's license that was provided with the Content. If no such
+license exists, contact the Redistributor. Unless otherwise indicated below, the
+terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at
+ <A href="http://www.jboss.org/tools">http://www.jboss.org/tools</A>.</P>
+
+</BODY>
+</HTML>
\ No newline at end of file
Added: trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/build.properties
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/build.properties (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/build.properties 2010-10-05 17:19:05 UTC (rev 25497)
@@ -0,0 +1,17 @@
+bin.includes = META-INF/,\
+ projects/,\
+ info.xml,\
+ seam/,\
+ about.html,\
+ ant.properties,\
+ plugin.properties,\
+ .
+src.includes = ant.properties,\
+ info.xml,\
+ src/,\
+ projects/,\
+ seam/,\
+ about.html
+jars.compile.order = .
+source.. = src/
+output.. = bin/
Added: trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/plugin.properties
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/plugin.properties (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/plugin.properties 2010-10-05 17:19:05 UTC (rev 25497)
@@ -0,0 +1,3 @@
+#Properties file for org.jboss.tools.seam.core.test
+Bundle-Vendor.0 = JBoss by Red Hat
+Bundle-Name.0 = Seam 2.2.0.CR1 Core Tests Plug-in
\ No newline at end of file
Added: trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/pom.xml
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/pom.xml (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/pom.xml 2010-10-05 17:19:05 UTC (rev 25497)
@@ -0,0 +1,39 @@
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.parent.pom</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.seam.tests</groupId>
+ <artifactId>org.jboss.tools.seam220CR1.core.test</artifactId>
+ <version>3.1.0-SNAPSHOT</version>
+ <packaging>eclipse-test-plugin</packaging>
+
+ <properties>
+ <systemProperties>-Djbosstools.test.seam.2.0.1.GA.home=${requirement.build.root}/jboss-seam-2.2.0.CR1</systemProperties>
+ <emma.filter>org.jboss.tools.seam*</emma.filter>
+ <emma.instrument.bundles>org.jboss.tools.seam.core</emma.instrument.bundles>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.sonatype.tycho</groupId>
+ <artifactId>maven-osgi-test-plugin</artifactId>
+ <configuration>
+ <explodedBundles>
+ <bundle>org.jboss.tools.seam.core.test</bundle>
+ <bundle>org.jboss.tools.seam.core</bundle>
+ </explodedBundles>
+ <product>org.jboss.tools.tests</product>
+ <includes>
+ <include>org/jboss/tools/seam/core/test/project/facet/Seam20XFacetTestSuite220CR1.class</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/requirements.properties
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/requirements.properties (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/requirements.properties 2010-10-05 17:19:05 UTC (rev 25497)
@@ -0,0 +1 @@
+requirements=seam-2.2.0.CR1
\ No newline at end of file
Added: trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/src/org/jboss/tools/seam/core/test/project/facet/Seam20XFacetTestSuite220CR1.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/src/org/jboss/tools/seam/core/test/project/facet/Seam20XFacetTestSuite220CR1.java (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam220CR1.core.test/src/org/jboss/tools/seam/core/test/project/facet/Seam20XFacetTestSuite220CR1.java 2010-10-05 17:19:05 UTC (rev 25497)
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.seam.core.test.project.facet;
+
+/**
+ * @author eskimo
+ *
+ */
+public class Seam20XFacetTestSuite220CR1 extends Seam20XFacetTestSuite201GA {
+
+}
14 years, 3 months
JBoss Tools SVN: r25496 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-10-05 11:45:24 -0400 (Tue, 05 Oct 2010)
New Revision: 25496
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/VpeMenuCreator.java
Log:
https://jira.jboss.org/browse/JBIDE-7060
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/VpeMenuCreator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/VpeMenuCreator.java 2010-10-05 15:38:45 UTC (rev 25495)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/VpeMenuCreator.java 2010-10-05 15:45:24 UTC (rev 25496)
@@ -22,7 +22,6 @@
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.texteditor.AbstractTextEditor;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.jboss.tools.jst.jsp.i18n.ExternalizeStringsContributionItem;
import org.jboss.tools.vpe.VpeDebug;
import org.jboss.tools.vpe.editor.VpeEditorPart;
import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
@@ -92,7 +91,7 @@
* https://jira.jboss.org/browse/JBIDE-7222
* Adding ExternalizeStrings dialog to the VPE context menu
*/
- menuManager.add(new ExternalizeStringsContributionItem());
+// menuManager.add(new ExternalizeStringsContributionItem());
addSeparator();
if (topLevelMenu) {
addZoomActions();
14 years, 3 months
JBoss Tools SVN: r25495 - trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-10-05 11:38:45 -0400 (Tue, 05 Oct 2010)
New Revision: 25495
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/Messages_en_US.properties
Log:
https://jira.jboss.org/browse/JBIDE-7060
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/Messages_en_US.properties
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/Messages_en_US.properties 2010-10-05 15:35:02 UTC (rev 25494)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/Messages_en_US.properties 2010-10-05 15:38:45 UTC (rev 25495)
@@ -1,5 +1,3 @@
header=US Hello Demo Application
prompt_message=US Name:
hello_message=US Hello
-
-Resource_Test_Page=Resource Test Page
14 years, 3 months
JBoss Tools SVN: r25494 - in trunk: jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo and 9 other directories.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-10-05 11:35:02 -0400 (Tue, 05 Oct 2010)
New Revision: 25494
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/icons/externalize.png
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/handlers/
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/handlers/I18Handler.java
Removed:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsAction.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsContributionItem.java
trunk/vpe/plugins/org.jboss.tools.vpe/resources/org/jboss/tools/vpe/editor/mozilla/icons/externalize.png
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/i18n/JsfLocaleProvider.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/Messages_en_US.properties
trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.properties
trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/bundle/BundleMap.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizard.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardPage.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ILocaleProvider.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/MainLocaleProvider.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditorPart.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditorSite.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
Log:
https://jira.jboss.org/browse/JBIDE-7060
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/i18n/JsfLocaleProvider.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/i18n/JsfLocaleProvider.java 2010-10-05 15:23:45 UTC (rev 25493)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/i18n/JsfLocaleProvider.java 2010-10-05 15:35:02 UTC (rev 25494)
@@ -15,7 +15,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.ui.texteditor.ITextEditor;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
@@ -38,7 +38,7 @@
* Returns the locale for given {@code editor}, or {@code null} if it
* can not determine it.
*/
- public Locale getLocale(StructuredTextEditor editor) {
+ public Locale getLocale(ITextEditor editor) {
IEditorInput editorInput = editor.getEditorInput();
if (editorInput instanceof IFileEditorInput) {
IProject project = ((IFileEditorInput)editorInput)
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/Messages_en_US.properties
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/Messages_en_US.properties 2010-10-05 15:23:45 UTC (rev 25493)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/JavaSource/demo/Messages_en_US.properties 2010-10-05 15:35:02 UTC (rev 25494)
@@ -1,3 +1,5 @@
header=US Hello Demo Application
prompt_message=US Name:
hello_message=US Hello
+
+Resource_Test_Page=Resource Test Page
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/icons/externalize.png
===================================================================
(Binary files differ)
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/icons/externalize.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.properties 2010-10-05 15:23:45 UTC (rev 25493)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.properties 2010-10-05 15:35:02 UTC (rev 25494)
@@ -16,6 +16,6 @@
proposalCategory.xmlEL= JBoss JSF/SEAM EL Proposals
proposalCategory.xmlTag= JBoss JSF/SEAM Tag Proposals
-Show.Selection.Bar=Show Selection Bar
Toggle.Selection.Bar=Toggle Selection Bar
+Externalize.Selected.Property=Externalize Strings...
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2010-10-05 15:23:45 UTC (rev 25493)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2010-10-05 15:35:02 UTC (rev 25494)
@@ -308,7 +308,7 @@
</menuContribution>
<menuContribution
locationURI="menu:navigate?endof=show.ext">
- <command label="%Show.Selection.Bar"
+ <command label="%Toggle.Selection.Bar"
commandId="org.jboss.tools.jst.jsp.commands.showSelectionBar"
id="org.jboss.tools.jst.jsp.menus.showSelectionBar"
style="toggle"
@@ -346,6 +346,32 @@
id="org.jboss.tools.jst.jsp.i18n.ExternalizeStringsContributionItem">
</dynamic>
</menuContribution>
+ <menuContribution
+ locationURI="menu:sourceMenuId?after=OccurencesFile">
+ <command label="%Externalize.Selected.Property"
+ commandId="org.jboss.tools.jst.jsp.commands.i18"
+ id="org.jboss.tools.jst.jsp.menus.i18"
+ mnemonic="S">
+ <visibleWhen checkEnabled="false">
+ <reference definitionId="org.jboss.tools.ui.structuredEditor"/>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ <menuContribution
+ locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
+ <toolbar
+ id="org.jboss.tools.jst.jsp.toolbars.sampleToolbar">
+ <command
+ commandId="org.jboss.tools.jst.jsp.commands.i18"
+ icon="icons/externalize.png"
+ id="org.jboss.tools.jst.jsp.toolbars.i18"
+ tooltip="%Externalize.Selected.Property">
+ <visibleWhen checkEnabled="false">
+ <reference definitionId="org.jboss.tools.ui.structuredEditor"/>
+ </visibleWhen>
+ </command>
+ </toolbar>
+ </menuContribution>
</extension>
@@ -456,6 +482,10 @@
<reference definitionId="org.jboss.tools.ui.structuredEditor"/>
</enabledWhen>
</handler>
+ <handler
+ class="org.jboss.tools.jst.jsp.i18n.handlers.I18Handler"
+ commandId="org.jboss.tools.jst.jsp.commands.i18">
+ </handler>
</extension>
<extension point="org.eclipse.core.expressions.definitions">
@@ -722,6 +752,11 @@
id="org.eclipse.ui.commands.toggleState">
</state>
</command>
+ <command
+ categoryId="org.jboss.tools.jst.jsp.commands.category"
+ id="org.jboss.tools.jst.jsp.commands.i18"
+ name="%Externalize.Selected.Property">
+ </command>
</extension>
<extension
point="org.eclipse.ui.bindings">
@@ -737,6 +772,12 @@
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
sequence="M1+6">
</key>
+ <key
+ commandId="org.jboss.tools.jst.jsp.commands.i18"
+ contextId="org.eclipse.ui.contexts.window"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+7">
+ </key>
</extension>
<extension
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/bundle/BundleMap.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/bundle/BundleMap.java 2010-10-05 15:23:45 UTC (rev 25493)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/bundle/BundleMap.java 2010-10-05 15:35:02 UTC (rev 25494)
@@ -34,6 +34,7 @@
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.jboss.tools.common.el.core.model.ELArgumentInvocation;
import org.jboss.tools.common.el.core.model.ELExpression;
@@ -64,7 +65,7 @@
};
private BundleMapListener[] bundleMapListeners = new BundleMapListener[0];
- private StructuredTextEditor editor;
+ private ITextEditor editor;
private String[] javaSources;
/*
@@ -79,7 +80,7 @@
XModelTreeListener modelListener = new ML();
- public void init(StructuredTextEditor editor){
+ public void init(ITextEditor editor){
this.editor = editor;
IEditorInput input = editor.getEditorInput();
Deleted: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsAction.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsAction.java 2010-10-05 15:23:45 UTC (rev 25493)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsAction.java 2010-10-05 15:35:02 UTC (rev 25494)
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2010 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.jst.jsp.i18n;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
-import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-
-public class ExternalizeStringsAction extends Action {
-
- private JSPMultiPageEditor editor;
-
- public ExternalizeStringsAction() {
- super();
- editor = (JSPMultiPageEditor) PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- }
-
- @Override
- public void run() {
- ISelection sel = editor.getSelectionProvider().getSelection();
-
- if ((sel instanceof TextSelection)
- && (sel instanceof IStructuredSelection)
- && (((IStructuredSelection) sel).size() == 1)) {
- /*
- * Pass null for Bundle Map that it will be created by the page itself.
- */
- ExternalizeStringsDialog dlg = new ExternalizeStringsDialog(
- PlatformUI.getWorkbench().getDisplay().getActiveShell(),
- new ExternalizeStringsWizard(editor.getSourceEditor(), null));
- dlg.open();
- } else {
- MessageDialog.openWarning(
- PlatformUI.getWorkbench().getDisplay().getActiveShell(),
- JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_TITLE,
- JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_WRONG_SELECTION);
- }
- }
-
-}
Deleted: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsContributionItem.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsContributionItem.java 2010-10-05 15:23:45 UTC (rev 25493)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsContributionItem.java 2010-10-05 15:35:02 UTC (rev 25494)
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2010 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.jst.jsp.i18n;
-
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.swt.widgets.Menu;
-import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-
-public class ExternalizeStringsContributionItem extends ActionContributionItem {
-
- /**
- * Instantiates a new externalize strings contribution item.
- * Default constructor is used to create
- * source editor context menu from plugin.xml
- */
- public ExternalizeStringsContributionItem() {
- super(new ExternalizeStringsAction());
- }
-
- @Override
- public void fill(Menu parent, int index) {
- /*
- * Simply sets the title
- */
- getAction().setText(JstUIMessages.EXTERNALIZE_STRINGS);
- super.fill(parent, index);
- }
-
-}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizard.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizard.java 2010-10-05 15:23:45 UTC (rev 25493)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizard.java 2010-10-05 15:35:02 UTC (rev 25494)
@@ -19,7 +19,7 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.ui.texteditor.ITextEditor;
import org.jboss.tools.common.model.ui.ModelUIImages;
import org.jboss.tools.jst.jsp.bundle.BundleMap;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
@@ -29,12 +29,12 @@
public String ExternalizeStringsWizardPageName = "ExternalizeStringsWizardPage"; //$NON-NLS-1$
public String NewFileCreationPageName = "NewFileCreationPage"; //$NON-NLS-1$
- StructuredTextEditor editor = null;
+ ITextEditor editor = null;
BundleMap bm = null;
ExternalizeStringsWizardPage page1 = null;
WizardNewFileCreationPage page2 = null;
- public ExternalizeStringsWizard(StructuredTextEditor editor, BundleMap bm) {
+ public ExternalizeStringsWizard(ITextEditor editor, BundleMap bm) {
super();
setHelpAvailable(false);
setWindowTitle(JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_TITLE);
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardPage.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardPage.java 2010-10-05 15:23:45 UTC (rev 25493)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardPage.java 2010-10-05 15:35:02 UTC (rev 25494)
@@ -59,8 +59,8 @@
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools;
import org.eclipse.wst.xml.core.internal.document.AttrImpl;
import org.eclipse.wst.xml.core.internal.document.NodeImpl;
@@ -97,7 +97,7 @@
private final char[] LINE_DELEMITERS = new char[] {'\r', '\n', '\t'};
private final int DIALOG_WIDTH = 450;
private final int DIALOG_HEIGHT = 650;
- private StructuredTextEditor editor;
+ private ITextEditor editor;
private Text propsKey;
private Text propsValue;
private Button newFile;
@@ -113,7 +113,7 @@
private Table tagsTable;
- public ExternalizeStringsWizardPage(String pageName, StructuredTextEditor editor, BundleMap bm) {
+ public ExternalizeStringsWizardPage(String pageName, ITextEditor editor, BundleMap bm) {
/*
* Setting dialog Title, Description, Image.
*/
@@ -732,7 +732,7 @@
* @param editor the source editor
* @return the new bundle map
*/
- private BundleMap createBundleMap(StructuredTextEditor editor) {
+ private BundleMap createBundleMap(ITextEditor editor) {
String uri = null;
String prefix = null;
int hash;
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ILocaleProvider.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ILocaleProvider.java 2010-10-05 15:23:45 UTC (rev 25493)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ILocaleProvider.java 2010-10-05 15:35:02 UTC (rev 25494)
@@ -12,7 +12,7 @@
import java.util.Locale;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.ui.texteditor.ITextEditor;
/**
* This interface is intended for creation extensions of {@code localeProvider}
@@ -25,7 +25,7 @@
* Returns the locale for given {@code editor}. Implementations
* may return {@code null} if they can not determine the locale.
*/
- Locale getLocale(StructuredTextEditor editor);
+ Locale getLocale(ITextEditor editor);
/**
* Shows the string representation of the locale
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/MainLocaleProvider.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/MainLocaleProvider.java 2010-10-05 15:23:45 UTC (rev 25493)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/MainLocaleProvider.java 2010-10-05 15:35:02 UTC (rev 25494)
@@ -17,19 +17,16 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
-
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.InvalidRegistryObjectException;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.RegistryFactory;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.ui.texteditor.ITextEditor;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
/**
@@ -77,7 +74,7 @@
* {@code localeProvider} extensions. Returns the default
* system locale if nothing found (never returns {@code null}).
*/
- public Locale getLocale(StructuredTextEditor editor) {
+ public Locale getLocale(ITextEditor editor) {
IEditorInput editorInput = editor.getEditorInput();
if (editorInput instanceof IFileEditorInput) {
IProject project = ((IFileEditorInput)editorInput)
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/handlers/I18Handler.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/handlers/I18Handler.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/handlers/I18Handler.java 2010-10-05 15:35:02 UTC (rev 25494)
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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.jst.jsp.i18n.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.jboss.tools.jst.jsp.i18n.ExternalizeStringsDialog;
+import org.jboss.tools.jst.jsp.i18n.ExternalizeStringsWizard;
+import org.w3c.dom.Attr;
+
+/**
+ * Externalization command handler
+ * @author mareshkau
+ *
+ */
+public class I18Handler extends AbstractHandler {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
+ */
+ @Override
+ public boolean isEnabled() {
+ IEditorPart activeEditor= PlatformUI
+ .getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ if(activeEditor instanceof ITextEditor){
+ ITextEditor txtEditor = (ITextEditor) activeEditor;
+ ISelection selection = txtEditor.getSelectionProvider().getSelection();
+ return getExternalizeStringsCommandEnabled(selection);
+ }
+ return false;
+ }
+ /**
+ * Calculates the state of ext command
+ * @param selection
+ * @return
+ */
+ private static boolean getExternalizeStringsCommandEnabled(ISelection selection) {
+ boolean enabled=false;
+ String stringToUpdate = ""; //$NON-NLS-1$
+ if ((selection instanceof TextSelection)
+ && (selection instanceof IStructuredSelection)
+ && (((IStructuredSelection) selection).size() == 1)) {
+ String text = ""; //$NON-NLS-1$
+ TextSelection textSelection = null;
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ textSelection = (TextSelection) selection;
+ text = textSelection.getText();
+ Object selectedElement = structuredSelection.getFirstElement();
+ /*
+ * When selected text is empty parse selected element and find a
+ * string to replace..
+ */
+ if ((text.trim().length() == 0)) {
+ if (selectedElement instanceof org.w3c.dom.Text) {
+ /*
+ * ..it could be a plain text
+ */
+ org.w3c.dom.Text textNode = (org.w3c.dom.Text) selectedElement;
+ if (textNode.getNodeValue().trim().length() > 0) {
+ stringToUpdate = textNode.getNodeValue();
+ }
+ } else if (selectedElement instanceof Attr) {
+ /*
+ * ..or an attribute's value
+ */
+ Attr attrNode = (Attr) selectedElement;
+ if (attrNode.getNodeValue().trim().length() > 0) {
+ stringToUpdate = attrNode.getNodeValue();
+ }
+ }
+ } else {
+ stringToUpdate = text;
+ }
+ }
+ if ((stringToUpdate.length() > 0)) {
+ enabled=true;
+ }
+ return enabled;
+ }
+
+ /**
+ * the command has been executed, so extract extract the needed information
+ * from the application context.
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IEditorPart activeEditor = HandlerUtil.getActiveEditorChecked(event);
+
+ if(activeEditor instanceof ITextEditor){
+ ExternalizeStringsDialog dlg = new ExternalizeStringsDialog(
+ PlatformUI.getWorkbench().getDisplay().getActiveShell(),
+ new ExternalizeStringsWizard((ITextEditor)activeEditor,
+ null));
+ dlg.open();
+ }
+ return null;
+ }
+}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditorPart.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditorPart.java 2010-10-05 15:23:45 UTC (rev 25493)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditorPart.java 2010-10-05 15:35:02 UTC (rev 25494)
@@ -10,10 +10,8 @@
******************************************************************************/
package org.jboss.tools.jst.jsp.jspeditor;
-import java.awt.Color;
import java.util.ArrayList;
import java.util.Iterator;
-
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.jface.util.Assert;
import org.eclipse.jface.util.SafeRunnable;
@@ -28,7 +26,6 @@
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Item;
@@ -39,6 +36,7 @@
import org.eclipse.ui.IKeyBindingService;
import org.eclipse.ui.INestableKeyBindingService;
import org.eclipse.ui.IPropertyListener;
+import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.EditorPart;
@@ -59,6 +57,7 @@
private ArrayList nestedEditors = new ArrayList(3);
private SelectionBar selectionBar;
+
protected JSPMultiPageEditorPart() {
super();
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditorSite.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditorSite.java 2010-10-05 15:23:45 UTC (rev 25493)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditorSite.java 2010-10-05 15:35:02 UTC (rev 25494)
@@ -11,6 +11,9 @@
package org.jboss.tools.jst.jsp.jspeditor;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.MenuManager;
@@ -31,6 +34,11 @@
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.contexts.IContextActivation;
+import org.eclipse.ui.contexts.IContextService;
+import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.internal.KeyBindingService;
import org.eclipse.ui.internal.PartSite;
import org.eclipse.ui.internal.PopupMenuExtender;
Deleted: trunk/vpe/plugins/org.jboss.tools.vpe/resources/org/jboss/tools/vpe/editor/mozilla/icons/externalize.png
===================================================================
(Binary files differ)
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2010-10-05 15:23:45 UTC (rev 25493)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2010-10-05 15:35:02 UTC (rev 25494)
@@ -234,10 +234,6 @@
this.visualEditor = visualEditor;
visualEditor.setController(this);
bundleMap.init(sourceEditor);
- /*
- * Update the toolbar item state
- */
- updateExternalizeStringsToolbarIconState();
pageContext = new VpePageContext(bundleMap, editPart);
domMapping = new VpeDomMapping(pageContext);
sourceBuilder = new VpeSourceDomBuilder(domMapping, this,
@@ -2238,13 +2234,7 @@
// synced = false;
return;
}
-
/*
- * Enable/disable "Externalize strings" toolbar icon
- */
- updateExternalizeStringsToolbarIconState();
-
- /*
* Update Text Formatting Toolbar state
*/
if (editPart.getVisualMode() != VpeEditorPart.SOURCE_MODE) {
@@ -2518,16 +2508,6 @@
public ISelectionManager getSelectionManager() {
return selectionManager;
}
-
- /**
- * Update Externalize Strings toolbar icon state.
- * <p>
- * Enables the button when suitable text is selected.
- * Disabled otherwise.
- */
- public void updateExternalizeStringsToolbarIconState() {
- visualEditor.updateExternalizeStringsToolbarIconState();
- }
public IZoomEventManager getZoomEventManager() {
return zoomEventManager;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2010-10-05 15:23:45 UTC (rev 25493)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2010-10-05 15:35:02 UTC (rev 25494)
@@ -124,7 +124,7 @@
public static final String ICON_NON_VISUAL_TAGS = "icons/non-visusal-tags.gif"; //$NON-NLS-1$
public static final String ICON_TEXT_FORMATTING = "icons/text-formatting.gif"; //$NON-NLS-1$
public static final String ICON_BUNDLE_AS_EL= "icons/bundle-as-el.gif"; //$NON-NLS-1$
- public static final String ICON_EXTERNALIZE_STRINGS= "icons/externalize.png"; //$NON-NLS-1$
+// public static final String ICON_EXTERNALIZE_STRINGS= "icons/externalize.png"; //$NON-NLS-1$
//static String SELECT_BAR = "SELECT_LBAR"; //$NON-NLS-1$
private XulRunnerEditor xulRunnerEditor;
@@ -153,7 +153,7 @@
private Action showNonVisualTagsAction;
private Action showTextFormattingAction;
private Action showBundleAsELAction;
- private Action externalizeStringsAction;
+// private Action externalizeStringsAction;
static {
/*
@@ -450,27 +450,27 @@
/*
* Create EXTERNALIZE STRINGS tool bar item
*/
- externalizeStringsAction = new Action(JstUIMessages.EXTERNALIZE_STRINGS,
- IAction.AS_PUSH_BUTTON) {
- @Override
- public void run() {
- /*
- * Externalize strings action.
- * Show a dialog to add properties key and value.
- * When selection is correct show the dialog
- * otherwise the toolbar icon will be disabled.
- */
- ExternalizeStringsDialog dlg = new ExternalizeStringsDialog(
- PlatformUI.getWorkbench().getDisplay().getActiveShell(),
- new ExternalizeStringsWizard(controller.getSourceEditor(),
- controller.getPageContext().getBundle()));
- dlg.open();
- }
- };
- externalizeStringsAction.setImageDescriptor(ImageDescriptor.createFromFile(MozillaEditor.class,
- ICON_EXTERNALIZE_STRINGS));
- externalizeStringsAction.setToolTipText(JstUIMessages.EXTERNALIZE_STRINGS);
- toolBarManager.add(externalizeStringsAction);
+// externalizeStringsAction = new Action(JstUIMessages.EXTERNALIZE_STRINGS,
+// IAction.AS_PUSH_BUTTON) {
+// @Override
+// public void run() {
+// /*
+// * Externalize strings action.
+// * Show a dialog to add properties key and value.
+// * When selection is correct show the dialog
+// * otherwise the toolbar icon will be disabled.
+// */
+// ExternalizeStringsDialog dlg = new ExternalizeStringsDialog(
+// PlatformUI.getWorkbench().getDisplay().getActiveShell(),
+// new ExternalizeStringsWizard(controller.getSourceEditor(),
+// controller.getPageContext().getBundle()));
+// dlg.open();
+// }
+// };
+// externalizeStringsAction.setImageDescriptor(ImageDescriptor.createFromFile(MozillaEditor.class,
+// ICON_EXTERNALIZE_STRINGS));
+// externalizeStringsAction.setToolTipText(JstUIMessages.EXTERNALIZE_STRINGS);
+// toolBarManager.add(externalizeStringsAction);
updateToolbarItemsAccordingToPreferences();
toolBarManager.update(true);
@@ -488,7 +488,7 @@
showNonVisualTagsAction = null;
showTextFormattingAction = null;
showBundleAsELAction = null;
- externalizeStringsAction = null;
+// externalizeStringsAction = null;
}
});
return verBar;
@@ -1100,55 +1100,55 @@
}
- /**
- * Update Externalize Strings toolbar icon state.
- * <p>
- * Enables the button when suitable text is selected.
- * Disabled otherwise.
- */
- public void updateExternalizeStringsToolbarIconState() {
- StructuredTextEditor editor = controller.getSourceEditor();
- ISelection sel = editor.getSelectionProvider().getSelection();
- String stringToUpdate = Constants.EMPTY;
- if ((sel instanceof TextSelection)
- && (sel instanceof IStructuredSelection)
- && (((IStructuredSelection) sel).size() == 1)) {
- String text = Constants.EMPTY;
- TextSelection textSelection = null;
- IStructuredSelection structuredSelection = (IStructuredSelection) sel;
- textSelection = (TextSelection) sel;
- text = textSelection.getText();
- Object selectedElement = structuredSelection.getFirstElement();
- /*
- * When selected text is empty parse selected element and find a
- * string to replace..
- */
- if ((text.trim().length() == 0)) {
- if (selectedElement instanceof org.w3c.dom.Text) {
- /*
- * ..it could be a plain text
- */
- org.w3c.dom.Text textNode = (org.w3c.dom.Text) selectedElement;
- if (textNode.getNodeValue().trim().length() > 0) {
- stringToUpdate = textNode.getNodeValue();
- }
- } else if (selectedElement instanceof Attr) {
- /*
- * ..or an attribute's value
- */
- Attr attrNode = (Attr) selectedElement;
- if (attrNode.getNodeValue().trim().length() > 0) {
- stringToUpdate = attrNode.getNodeValue();
- }
- }
- } else {
- stringToUpdate = text;
- }
- }
- if ((stringToUpdate.length() > 0)) {
- externalizeStringsAction.setEnabled(true);
- } else {
- externalizeStringsAction.setEnabled(false);
- }
- }
+// /**
+// * Update Externalize Strings toolbar icon state.
+// * <p>
+// * Enables the button when suitable text is selected.
+// * Disabled otherwise.
+// */
+// public void updateExternalizeStringsToolbarIconState() {
+// StructuredTextEditor editor = controller.getSourceEditor();
+// ISelection sel = editor.getSelectionProvider().getSelection();
+// String stringToUpdate = Constants.EMPTY;
+// if ((sel instanceof TextSelection)
+// && (sel instanceof IStructuredSelection)
+// && (((IStructuredSelection) sel).size() == 1)) {
+// String text = Constants.EMPTY;
+// TextSelection textSelection = null;
+// IStructuredSelection structuredSelection = (IStructuredSelection) sel;
+// textSelection = (TextSelection) sel;
+// text = textSelection.getText();
+// Object selectedElement = structuredSelection.getFirstElement();
+// /*
+// * When selected text is empty parse selected element and find a
+// * string to replace..
+// */
+// if ((text.trim().length() == 0)) {
+// if (selectedElement instanceof org.w3c.dom.Text) {
+// /*
+// * ..it could be a plain text
+// */
+// org.w3c.dom.Text textNode = (org.w3c.dom.Text) selectedElement;
+// if (textNode.getNodeValue().trim().length() > 0) {
+// stringToUpdate = textNode.getNodeValue();
+// }
+// } else if (selectedElement instanceof Attr) {
+// /*
+// * ..or an attribute's value
+// */
+// Attr attrNode = (Attr) selectedElement;
+// if (attrNode.getNodeValue().trim().length() > 0) {
+// stringToUpdate = attrNode.getNodeValue();
+// }
+// }
+// } else {
+// stringToUpdate = text;
+// }
+// }
+// if ((stringToUpdate.length() > 0)) {
+// externalizeStringsAction.setEnabled(true);
+// } else {
+// externalizeStringsAction.setEnabled(false);
+// }
+// }
}
14 years, 3 months
JBoss Tools SVN: r25493 - trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2010-10-05 11:23:45 -0400 (Tue, 05 Oct 2010)
New Revision: 25493
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
Log:
JBIDE-6398
https://jira.jboss.org/browse/JBIDE-6398
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2010-10-05 14:09:08 UTC (rev 25492)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamValidatorsTest.java 2010-10-05 15:23:45 UTC (rev 25493)
@@ -12,7 +12,6 @@
import java.io.IOException;
import java.io.InputStream;
-import java.text.MessageFormat;
import java.util.Set;
import org.eclipse.core.resources.IFile;
@@ -22,10 +21,10 @@
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.preference.IPersistentPreferenceStore;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.wst.validation.internal.core.ValidationException;
-import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.jsf.JSFModelPlugin;
import org.jboss.tools.jsf.preferences.JSFSeverityPreferences;
import org.jboss.tools.jsf.web.validation.JSFValidationMessages;
@@ -34,6 +33,7 @@
import org.jboss.tools.seam.core.ISeamComponentMethod;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamComponentMethodType;
+import org.jboss.tools.seam.core.SeamCoreBuilder;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.SeamPreferences;
import org.jboss.tools.seam.core.test.validation.ELValidatorWrapper;
@@ -81,14 +81,14 @@
protected void tearDown() throws Exception {
}
-
+
private void copyContentsFile(String originalName, String newContentName) throws CoreException{
IFile originalFile = project.getFile(originalName);
IFile newContentFile = project.getFile(newContentName);
copyContentsFile(originalFile, newContentFile);
}
-
+
private void copyContentsFile(IFile originalFile, String newContentName) throws CoreException{
IFile newContentFile = project.getFile(newContentName);
copyContentsFile(originalFile, newContentFile);
@@ -108,7 +108,13 @@
}
}
}
- originalFile.getProject().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
+ project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ JobUtils.waitForIdle();
+ originalFile.getProject().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, "org.eclipse.jdt.internal.core.builder.JavaBuilder", null, null);
+ JobUtils.waitForIdle();
+ originalFile.getProject().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, SeamCoreBuilder.BUILDER_ID, null, null);
+// originalFile.getProject().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null);
+ JobUtils.waitForIdle();
}
private ISeamProject getSeamProject(IProject project) {
@@ -234,7 +240,7 @@
// restore file content
copyContentsFile(
"src/action/org/domain/SeamWebWarTestProject/session/BbcComponent.java",
- "src/action/org/domain/SeamWebWarTestProject/session/BbcComponent.2");
+ "src/action/org/domain/SeamWebWarTestProject/session/BbcComponent.original");
}
public void testStatefulComponentWithoutRemoveMethodValidator() throws CoreException, ValidationException {
@@ -676,16 +682,31 @@
// Unpaired Getter/Setter
try {
enableUnpairGetterOrSetterValidation(true);
+ String target = "src/action/org/domain/SeamWebWarTestProject/session/AbcComponent.java";
+ copyContentsFile(
+ target,
+ "src/action/org/domain/SeamWebWarTestProject/session/AbcComponent.2");
+ copyContentsFile(
+ "WebContent/abcComponent.xhtml",
+ "WebContent/abcComponent.4");
+//I am not sure that we need build here. If test is stable, lets remove this.
+// project.build(IncrementalProjectBuilder.CLEAN_BUILD, null);
+// project.build(IncrementalProjectBuilder.FULL_BUILD, null);
+// JobUtils.waitForIdle();
- assertMarkerIsNotCreatedForFile(
- new ELValidatorWrapper(project),
- "src/action/org/domain/SeamWebWarTestProject/session/AbcComponent.java",
- "src/action/org/domain/SeamWebWarTestProject/session/AbcComponent.2",
- JSFValidationMessages.UNPAIRED_GETTER_OR_SETTER,
- new Object[] {"actionType","Setter","Getter"});
+ IFile targetFile = project.getFile(target);
+ ELValidatorWrapper wrapper = new ELValidatorWrapper(project);
+ wrapper.validate(targetFile);
+// assertMarkerIsNotCreatedForFile(
+// new ELValidatorWrapper(project),
+// "src/action/org/domain/SeamWebWarTestProject/session/AbcComponent.java",
+// "src/action/org/domain/SeamWebWarTestProject/session/AbcComponent.2",
+// JSFValidationMessages.UNPAIRED_GETTER_OR_SETTER,
+// new Object[] {"actionType","Setter","Getter"},
+// true);
assertMarkerIsCreatedForLine(
- new ELValidatorWrapper(project),
+ wrapper,
"WebContent/abcComponent.xhtml",
"WebContent/abcComponent.4",
JSFValidationMessages.UNPAIRED_GETTER_OR_SETTER,
@@ -697,19 +718,29 @@
}
public void testPropertyHasOnlyGetterValidator() throws CoreException, ValidationException {
- project.build(IncrementalProjectBuilder.FULL_BUILD, null);
+ //I am not sure that we need build here. If test is stable, lets remove this.
+// project.build(IncrementalProjectBuilder.FULL_BUILD, null);
try {
enableUnpairGetterOrSetterValidation(true);
+ String target = "src/action/org/domain/SeamWebWarTestProject/session/AbcComponent.java";
+ copyContentsFile(
+ target,
+ "src/action/org/domain/SeamWebWarTestProject/session/AbcComponent.3");
+ JobUtils.waitForIdle();
- assertMarkerIsNotCreatedForFile(
- new ELValidatorWrapper(project),
- "src/action/org/domain/SeamWebWarTestProject/session/AbcComponent.java",
- "src/action/org/domain/SeamWebWarTestProject/session/AbcComponent.3",
- JSFValidationMessages.UNPAIRED_GETTER_OR_SETTER,
- new Object[] {"actionType", "Getter", "Setter"});
+ IFile targetFile = project.getFile(target);
+ ELValidatorWrapper wrapper = new ELValidatorWrapper(project);
+ wrapper.validate(targetFile);
+// assertMarkerIsNotCreatedForFile(
+// new ELValidatorWrapper(project),
+// "src/action/org/domain/SeamWebWarTestProject/session/AbcComponent.java",
+// "src/action/org/domain/SeamWebWarTestProject/session/AbcComponent.3",
+// JSFValidationMessages.UNPAIRED_GETTER_OR_SETTER,
+// new Object[] {"actionType", "Getter", "Setter"},
+// true);
assertMarkerIsCreatedForLine(
- new ELValidatorWrapper(project),
+ wrapper,
"WebContent/abcComponent.xhtml",
"WebContent/abcComponent.original",
JSFValidationMessages.UNPAIRED_GETTER_OR_SETTER,
14 years, 3 months
JBoss Tools SVN: r25492 - in trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core: utils and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: bfitzpat
Date: 2010-10-05 10:09:08 -0400 (Tue, 05 Oct 2010)
New Revision: 25492
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/WSDLPropertyReader.java
Log:
JBIDE-7234: JAX-WS generated portType implementation has incorrect @WebService annotation - now we get the service name and target namespace from the WSDL if they're available and use them as defaults
https://jira.jboss.org/browse/JBIDE-7234
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java 2010-10-05 13:55:18 UTC (rev 25491)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java 2010-10-05 14:09:08 UTC (rev 25492)
@@ -1,9 +1,13 @@
package org.jboss.tools.ws.creation.core.commands;
import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
+import javax.wsdl.WSDLException;
+
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -54,6 +58,7 @@
import org.jboss.tools.ws.creation.core.data.ServiceModel;
import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
+import org.jboss.tools.ws.creation.core.utils.WSDLPropertyReader;
public class ImplementationClassCreationCommand extends
AbstractDataModelOperation {
@@ -65,6 +70,7 @@
private static final String ANNOTATION_TYPE_NAME_WEBSERVICE = "WebService";; //$NON-NLS-1$
private static final String ANNOTATION_PROPERTY_SERVICE_NAME = "serviceName"; //$NON-NLS-1$
private static final String ANNOTATION_PROPERTY_ENDPOINT_INTERFACE = "endpointInterface"; //$NON-NLS-1$
+ private static final String ANNOTATION_PROPERTY_TNS = "targetNamespace"; //$NON-NLS-1$
private ServiceModel model;
private IWorkspaceRoot fWorkspaceRoot;
@@ -133,6 +139,42 @@
return status;
}
+ protected String getTNSFromWSDL() {
+ WSDLPropertyReader reader = new WSDLPropertyReader();
+ try {
+ URI fileURI = new URI(model.getWsdlURI());
+ File tempFile = new File(fileURI);
+ reader.readWSDL(tempFile.getAbsolutePath());
+ return reader.getTargetnamespace();
+ } catch (WSDLException e) {
+ e.printStackTrace();
+ } catch (URISyntaxException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ protected String getServiceNameFromWSDL() {
+ WSDLPropertyReader reader = new WSDLPropertyReader();
+
+ try {
+ URI fileURI = new URI(model.getWsdlURI());
+ File tempFile = new File(fileURI);
+ reader.readWSDL(tempFile.getAbsolutePath());
+ List<String> services = reader.getServiceList();
+ if (services != null && services.size() > 0) {
+ return services.get(0);
+ }
+ } catch (WSDLException e) {
+ e.printStackTrace();
+ } catch (URISyntaxException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+ }
+
@SuppressWarnings("unchecked")
protected void generateImplClass(ICompilationUnit service)
throws CoreException, BadLocationException {
@@ -144,6 +186,10 @@
String className = getClassName(service.getElementName());
String implFileName = getJavaFileName(className);
+
+ String serviceName = getServiceNameFromWSDL();
+
+ String targetNamespace = getTNSFromWSDL();
ICompilationUnit icu = pack.createCompilationUnit(implFileName,
"", true, null); //$NON-NLS-1$
@@ -180,7 +226,12 @@
type.setInterface(false);
// add WebService annotation
String endpoint = getServiceInterfaceFullName(className);
- NormalAnnotation ann = createAnnotation(ast, className, endpoint);
+ NormalAnnotation ann = null;
+ if (serviceName != null) {
+ ann = createAnnotation(ast, serviceName, endpoint, targetNamespace);
+ } else {
+ ann = createAnnotation(ast, className, endpoint, targetNamespace);
+ }
type.modifiers().add(ann);
type.modifiers().add(
ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
@@ -301,7 +352,7 @@
*/
@SuppressWarnings("unchecked")
protected NormalAnnotation createAnnotation(AST ast, String serviceName,
- String endpoint) {
+ String endpoint, String targetNamespace) {
NormalAnnotation ann = ast.newNormalAnnotation();
ann.setTypeName(ast.newSimpleName(ANNOTATION_TYPE_NAME_WEBSERVICE));
@@ -311,6 +362,11 @@
member = createMemberValuePair(ast,
ANNOTATION_PROPERTY_ENDPOINT_INTERFACE, endpoint);
ann.values().add(member);
+ if (targetNamespace != null) {
+ member = createMemberValuePair(ast,
+ ANNOTATION_PROPERTY_TNS, targetNamespace);
+ ann.values().add(member);
+ }
return ann;
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/WSDLPropertyReader.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/WSDLPropertyReader.java 2010-10-05 13:55:18 UTC (rev 25491)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/WSDLPropertyReader.java 2010-10-05 14:09:08 UTC (rev 25492)
@@ -226,4 +226,9 @@
return returnList;
}
+ public String getTargetnamespace() {
+ String tns = definition.getTargetNamespace();
+ return tns;
+ }
+
}
14 years, 3 months