JBoss Tools SVN: r17490 - trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/appregister.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-09-09 09:49:12 -0400 (Wed, 09 Sep 2009)
New Revision: 17490
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/appregister/AppRegisterComponent.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3506
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/appregister/AppRegisterComponent.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/appregister/AppRegisterComponent.java 2009-09-09 13:46:04 UTC (rev 17489)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/appregister/AppRegisterComponent.java 2009-09-09 13:49:12 UTC (rev 17490)
@@ -31,8 +31,11 @@
import org.jboss.tools.common.model.ui.attribute.editor.IPropertyEditor;
import org.jboss.tools.common.model.ui.attribute.editor.MutableComboBoxFieldEditor;
import org.jboss.tools.common.model.ui.attribute.editor.MutableMultipleChoiceFieldEditor;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.jboss.tools.common.meta.action.SpecialWizard;
@@ -42,6 +45,7 @@
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.common.model.util.XModelObjectUtil;
+import org.jboss.tools.jst.web.WebModelPlugin;
import org.jboss.tools.jst.web.context.RegisterServerContext;
import org.jboss.tools.jst.web.server.*;
import org.jboss.tools.jst.web.ui.Messages;
@@ -220,6 +224,15 @@
ns[i] = rs[i].getName();
if(rs[i] == selectedRuntime || selectedRuntime1 == null) selectedRuntime1 = rs[i];
}
+ IProject p = context.getProjectHandle();
+ if(p != null && p.exists() && p.isAccessible()) {
+ try {
+ IRuntime sr = J2EEProjectUtilities.getServerRuntime(p);
+ if(sr != null) selectedRuntime1 = sr;
+ } catch (CoreException exc) {
+ WebModelPlugin.getPluginLog().logError(exc);
+ }
+ }
HUtil.hackAttributeConstraintList(new XEntityData[]{support.getEntityData()}, 0, ATTR_RUNTIME, ns);
String runtimeName = (selectedRuntime1 != null) ? selectedRuntime1.getName() : ""; //$NON-NLS-1$
context.setRuntimeName(runtimeName);
14 years, 9 months
JBoss Tools SVN: r17489 - trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/context.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-09-09 09:46:04 -0400 (Wed, 09 Sep 2009)
New Revision: 17489
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/context/RegisterServerContext.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3506
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/context/RegisterServerContext.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/context/RegisterServerContext.java 2009-09-09 13:25:12 UTC (rev 17488)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/context/RegisterServerContext.java 2009-09-09 13:46:04 UTC (rev 17489)
@@ -73,6 +73,10 @@
public void setProjectHandle(IProject p) {
project = p;
}
+
+ public IProject getProjectHandle() {
+ return project;
+ }
public void setPreferences(Preference registerProjectPreference) {
this.registerProjectPreference = registerProjectPreference;
14 years, 9 months
JBoss Tools SVN: r17488 - trunk/jsf/docs/userguide/en/images/editors_features.
by jbosstools-commits@lists.jboss.org
Author: chukhutsina
Date: 2009-09-09 09:25:12 -0400 (Wed, 09 Sep 2009)
New Revision: 17488
Added:
trunk/jsf/docs/userguide/en/images/editors_features/editors_features_7a.png
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/jira/browse/JBDS-801 -Added the information of custom tags OpenOn supporting to Doc - VisualWebTools. </p>
</body></html>
Added: trunk/jsf/docs/userguide/en/images/editors_features/editors_features_7a.png
===================================================================
(Binary files differ)
Property changes on: trunk/jsf/docs/userguide/en/images/editors_features/editors_features_7a.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
14 years, 9 months
JBoss Tools SVN: r17487 - trunk/jsf/docs/userguide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: chukhutsina
Date: 2009-09-09 09:23:34 -0400 (Wed, 09 Sep 2009)
New Revision: 17487
Modified:
trunk/jsf/docs/userguide/en/modules/editors.xml
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/jira/browse/JBDS-801 -Added the information of custom tags OpenOn supporting to Doc - VisualWebTools. </p>
</body></html>
Modified: trunk/jsf/docs/userguide/en/modules/editors.xml
===================================================================
--- trunk/jsf/docs/userguide/en/modules/editors.xml 2009-09-09 11:18:49 UTC (rev 17486)
+++ trunk/jsf/docs/userguide/en/modules/editors.xml 2009-09-09 13:23:34 UTC (rev 17487)
@@ -142,6 +142,15 @@
</imageobject>
</mediaobject>
</figure>
+ <para>You can use OpenOn to open custom tag libraries:</para>
+ <figure>
+ <title>OpenOn With custom tags</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/editors_features/editors_features_7a.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
<para>For JSP files in a JSF project, you can also easily open the navigation rules
by applying <property>OpenOn</property> to the JSF tag for the navigation
outcome:</para>
14 years, 9 months
JBoss Tools SVN: r17486 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2009-09-09 07:18:49 -0400 (Wed, 09 Sep 2009)
New Revision: 17486
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/ELSearchQuery.java
Log:
fixed spelling
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/ELSearchQuery.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/ELSearchQuery.java 2009-09-09 00:43:23 UTC (rev 17485)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/ELSearchQuery.java 2009-09-09 11:18:49 UTC (rev 17486)
@@ -23,7 +23,7 @@
import org.jboss.tools.common.el.core.model.ELInvocationExpression;
import org.jboss.tools.common.el.core.model.ELMethodInvocation;
import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
-import org.jboss.tools.seam.internal.core.refactoring.SeamRefactorSeacher;
+import org.jboss.tools.seam.internal.core.refactoring.SeamRefactorSearcher;
public class ELSearchQuery implements ISearchQuery {
private String propertyName;
@@ -65,7 +65,7 @@
return Status.OK_STATUS;
}
- class ELSearcher extends SeamRefactorSeacher{
+ class ELSearcher extends SeamRefactorSearcher{
public ELSearcher(IFile file, String name){
super(file, name);
}
14 years, 9 months
JBoss Tools SVN: r17485 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-09-08 20:43:23 -0400 (Tue, 08 Sep 2009)
New Revision: 17485
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java
Removed:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSeacher.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameProcessor.java
Log:
Fixed spelling.
Deleted: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSeacher.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSeacher.java 2009-09-09 00:20:30 UTC (rev 17484)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSeacher.java 2009-09-09 00:43:23 UTC (rev 17485)
@@ -1,321 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.internal.core.refactoring;
-
-import java.io.IOException;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.internal.ui.text.FastJavaPartitionScanner;
-import org.eclipse.jdt.ui.text.IJavaPartitions;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.rules.IToken;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
-import org.jboss.tools.common.el.core.model.ELInstance;
-import org.jboss.tools.common.el.core.model.ELInvocationExpression;
-import org.jboss.tools.common.el.core.model.ELMethodInvocation;
-import org.jboss.tools.common.el.core.model.ELModel;
-import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
-import org.jboss.tools.common.el.core.parser.ELParser;
-import org.jboss.tools.common.el.core.parser.ELParserUtil;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.common.util.FileUtil;
-import org.jboss.tools.seam.core.SeamCorePlugin;
-import org.jboss.tools.seam.core.SeamProjectsSet;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public abstract class SeamRefactorSeacher {
- protected static final String JAVA_EXT = "java"; //$NON-NLS-1$
- protected static final String XML_EXT = "xml"; //$NON-NLS-1$
- protected static final String XHTML_EXT = "xhtml"; //$NON-NLS-1$
- protected static final String JSP_EXT = "jsp"; //$NON-NLS-1$
- protected static final String PROPERTIES_EXT = "properties"; //$NON-NLS-1$
-
- protected static final String SEAM_PROPERTIES_FILE = "seam.properties"; //$NON-NLS-1$
-
- protected IFile baseFile;
- protected String propertyName;
-
- public SeamRefactorSeacher(IFile baseFile, String propertyName){
- this.baseFile = baseFile;
- this.propertyName = propertyName;
- }
-
- public void findELReferences(){
- if(baseFile == null)
- return;
-
- SeamProjectsSet projectsSet = new SeamProjectsSet(baseFile.getProject());
-
- IProject[] projects = projectsSet.getAllProjects();
- for (IProject project : projects) {
- if(project == null) continue;
-
- IJavaProject javaProject = EclipseResourceUtil.getJavaProject(project);
-
- // searching java, xml and property files in source folders
- if(javaProject != null){
- for(IResource resource : EclipseResourceUtil.getJavaSourceRoots(project)){
- if(resource instanceof IFolder)
- scanForJava((IFolder) resource);
- else if(resource instanceof IFile)
- scanForJava((IFile) resource);
- }
- }
-
- // searching jsp, xhtml and xml files in WebContent folders
- if(project.equals(projectsSet.getWarProject()))
- scan(projectsSet.getDefaultViewsFolder());
- else if(project.equals(projectsSet.getEarProject()))
- scan(projectsSet.getDefaultEarViewsFolder());
- else{
- scan(project);
- }
- }
- }
- private void scanForJava(IContainer container){
- try{
- for(IResource resource : container.members()){
- if(resource instanceof IFolder)
- scanForJava((IFolder) resource);
- else if(resource instanceof IFile)
- scanForJava((IFile) resource);
- }
- }catch(CoreException ex){
- SeamCorePlugin.getDefault().logError(ex);
- }
- }
-
- private void scan(IContainer container){
- try{
- for(IResource resource : container.members()){
- if(resource instanceof IFolder)
- scan((IFolder) resource);
- else if(resource instanceof IFile)
- scan((IFile) resource);
- }
- }catch(CoreException ex){
- SeamCorePlugin.getDefault().logError(ex);
- }
- }
-
- private void scanForJava(IFile file){
- String ext = file.getFileExtension();
-
- if(!isFileCorrect(file))
- return;
-
- String content = null;
- try {
- content = FileUtil.readStream(file.getContents());
- } catch (CoreException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- return;
- }
- if(JAVA_EXT.equalsIgnoreCase(ext)){
- scanJava(file, content);
- }else if(XML_EXT.equalsIgnoreCase(ext))
- scanDOM(file, content);
- else if(PROPERTIES_EXT.equalsIgnoreCase(ext))
- scanProperties(file, content);
- }
-
- private void scan(IFile file){
- String ext = file.getFileExtension();
-
- if(!isFileCorrect(file))
- return;
-
- String content = null;
- try {
- content = FileUtil.readStream(file.getContents());
- } catch (CoreException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- return;
- }
- if(XML_EXT.equalsIgnoreCase(ext) || XHTML_EXT.equalsIgnoreCase(ext) || JSP_EXT.equalsIgnoreCase(ext))
- scanDOM(file, content);
- }
-
- private void scanJava(IFile file, String content){
- try {
- FastJavaPartitionScanner scaner = new FastJavaPartitionScanner();
- Document document = new Document(content);
- scaner.setRange(document, 0, document.getLength());
- IToken token = scaner.nextToken();
- while(token!=null && token!=Token.EOF) {
- if(IJavaPartitions.JAVA_STRING.equals(token.getData())) {
- int length = scaner.getTokenLength();
- int offset = scaner.getTokenOffset();
- String value = document.get(offset, length);
- if(value.indexOf('{')>-1) {
- scanString(file, value, offset);
- }
- }
- token = scaner.nextToken();
- }
- } catch (BadLocationException e) {
- SeamCorePlugin.getDefault().logError(e);
- }
- }
-
- private void scanDOM(IFile file, String content){
- IModelManager manager = StructuredModelManager.getModelManager();
- if(manager == null) {
- return;
- }
- IStructuredModel model = null;
- try {
- model = manager.getModelForRead(file);
- if (model instanceof IDOMModel) {
- IDOMModel domModel = (IDOMModel) model;
- IDOMDocument document = domModel.getDocument();
- scanChildNodes(file, document);
- }
- } catch (CoreException e) {
- SeamCorePlugin.getDefault().logError(e);
- } catch (IOException e) {
- SeamCorePlugin.getDefault().logError(e);
- } finally {
- if (model != null) {
- model.releaseFromRead();
- }
- }
- }
-
- private void scanChildNodes(IFile file, Node parent) {
- NodeList children = parent.getChildNodes();
- for(int i=0; i<children.getLength(); i++) {
- Node curentValidatedNode = children.item(i);
- if(Node.ELEMENT_NODE == curentValidatedNode.getNodeType()) {
- scanNodeContent(file, ((IDOMNode)curentValidatedNode).getFirstStructuredDocumentRegion(), DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE);
- } else if(Node.TEXT_NODE == curentValidatedNode.getNodeType()) {
- scanNodeContent(file, ((IDOMNode)curentValidatedNode).getFirstStructuredDocumentRegion(), DOMRegionContext.XML_CONTENT);
- }
- scanChildNodes(file, curentValidatedNode);
- }
- }
-
- private void scanNodeContent(IFile file, IStructuredDocumentRegion node, String regionType) {
- ITextRegionList regions = node.getRegions();
- for(int i=0; i<regions.size(); i++) {
- ITextRegion region = regions.get(i);
- if(region.getType() == regionType) {
- String text = node.getFullText(region);
- if(text.indexOf("{")>-1) { //$NON-NLS-1$
- int offset = node.getStartOffset() + region.getStart();
- scanString(file, text, offset);
- }
- }
- }
- }
-
- // looking for component references in EL
- private void scanString(IFile file, String string, int offset) {
- int startEl = string.indexOf("#{"); //$NON-NLS-1$
- if(startEl>-1) {
- ELParser parser = ELParserUtil.getJbossFactory().createParser();
- ELModel model = parser.parse(string);
- for (ELInstance instance : model.getInstances()) {
- for(ELInvocationExpression ie : instance.getExpression().getInvocations()){
- ELInvocationExpression expression = findComponentReference(ie);
- if(expression != null){
- if(expression instanceof ELPropertyInvocation){
- ELPropertyInvocation pi = (ELPropertyInvocation)expression;
- match(file, offset+pi.getStartPosition(), pi.getName().getStart()+pi.getName().getLength()-pi.getStartPosition());
- }else if(expression instanceof ELMethodInvocation){
- ELMethodInvocation mi = (ELMethodInvocation)expression;
- match(file, offset+mi.getStartPosition(), mi.getName().getStart()+mi.getName().getLength()-mi.getStartPosition());
- }
- }
- }
- }
- }
- }
-
- private void scanProperties(IFile file, String content){
- scanString(file, content, 0);
-
- if(!file.getName().equals(SEAM_PROPERTIES_FILE))
- return;
-
- StringTokenizer tokenizer = new StringTokenizer(content, "#= \t\r\n\f", true); //$NON-NLS-1$
-
- String lastToken = "\n"; //$NON-NLS-1$
- int offset = 0;
- boolean comment = false;
- boolean key = true;
-
- while(tokenizer.hasMoreTokens()){
- String token = tokenizer.nextToken("#= \t\r\n\f"); //$NON-NLS-1$
- if(token.equals("\r")) //$NON-NLS-1$
- token = "\n"; //$NON-NLS-1$
-
- if(token.equals("#") && lastToken.equals("\n")) //$NON-NLS-1$ //$NON-NLS-2$
- comment = true;
- else if(token.equals("\n") && comment) //$NON-NLS-1$
- comment = false;
-
- if(!comment){
- if(!token.equals("\n") && lastToken.equals("\n")) //$NON-NLS-1$ //$NON-NLS-2$
- key = true;
- else if(key && (token.equals("=") || token.equals(" "))) //$NON-NLS-1$ //$NON-NLS-2$
- key = false;
-
- if(key && token.startsWith(propertyName)){
- match(file, offset, token.length());
- }
- }
-
- lastToken = token;
- offset += token.length();
- }
- }
-
-
- protected ELInvocationExpression findComponentReference(ELInvocationExpression invocationExpression){
- ELInvocationExpression invExp = invocationExpression;
- while(invExp != null){
- if(invExp instanceof ELPropertyInvocation){
- if(((ELPropertyInvocation)invExp).getQualifiedName() != null && ((ELPropertyInvocation)invExp).getQualifiedName().equals(propertyName))
- return invExp;
- else
- invExp = invExp.getLeft();
-
- }else{
- invExp = invExp.getLeft();
- }
- }
- return null;
- }
-
- protected abstract boolean isFileCorrect(IFile file);
-
- protected abstract void match(IFile file, int offset, int length);
-}
Copied: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java (from rev 17470, trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSeacher.java)
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java 2009-09-09 00:43:23 UTC (rev 17485)
@@ -0,0 +1,321 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.internal.core.refactoring;
+
+import java.io.IOException;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.internal.ui.text.FastJavaPartitionScanner;
+import org.eclipse.jdt.ui.text.IJavaPartitions;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
+import org.jboss.tools.common.el.core.model.ELInstance;
+import org.jboss.tools.common.el.core.model.ELInvocationExpression;
+import org.jboss.tools.common.el.core.model.ELMethodInvocation;
+import org.jboss.tools.common.el.core.model.ELModel;
+import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
+import org.jboss.tools.common.el.core.parser.ELParser;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.util.FileUtil;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.core.SeamProjectsSet;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public abstract class SeamRefactorSearcher {
+ protected static final String JAVA_EXT = "java"; //$NON-NLS-1$
+ protected static final String XML_EXT = "xml"; //$NON-NLS-1$
+ protected static final String XHTML_EXT = "xhtml"; //$NON-NLS-1$
+ protected static final String JSP_EXT = "jsp"; //$NON-NLS-1$
+ protected static final String PROPERTIES_EXT = "properties"; //$NON-NLS-1$
+
+ protected static final String SEAM_PROPERTIES_FILE = "seam.properties"; //$NON-NLS-1$
+
+ protected IFile baseFile;
+ protected String propertyName;
+
+ public SeamRefactorSearcher(IFile baseFile, String propertyName){
+ this.baseFile = baseFile;
+ this.propertyName = propertyName;
+ }
+
+ public void findELReferences(){
+ if(baseFile == null)
+ return;
+
+ SeamProjectsSet projectsSet = new SeamProjectsSet(baseFile.getProject());
+
+ IProject[] projects = projectsSet.getAllProjects();
+ for (IProject project : projects) {
+ if(project == null) continue;
+
+ IJavaProject javaProject = EclipseResourceUtil.getJavaProject(project);
+
+ // searching java, xml and property files in source folders
+ if(javaProject != null){
+ for(IResource resource : EclipseResourceUtil.getJavaSourceRoots(project)){
+ if(resource instanceof IFolder)
+ scanForJava((IFolder) resource);
+ else if(resource instanceof IFile)
+ scanForJava((IFile) resource);
+ }
+ }
+
+ // searching jsp, xhtml and xml files in WebContent folders
+ if(project.equals(projectsSet.getWarProject()))
+ scan(projectsSet.getDefaultViewsFolder());
+ else if(project.equals(projectsSet.getEarProject()))
+ scan(projectsSet.getDefaultEarViewsFolder());
+ else{
+ scan(project);
+ }
+ }
+ }
+ private void scanForJava(IContainer container){
+ try{
+ for(IResource resource : container.members()){
+ if(resource instanceof IFolder)
+ scanForJava((IFolder) resource);
+ else if(resource instanceof IFile)
+ scanForJava((IFile) resource);
+ }
+ }catch(CoreException ex){
+ SeamCorePlugin.getDefault().logError(ex);
+ }
+ }
+
+ private void scan(IContainer container){
+ try{
+ for(IResource resource : container.members()){
+ if(resource instanceof IFolder)
+ scan((IFolder) resource);
+ else if(resource instanceof IFile)
+ scan((IFile) resource);
+ }
+ }catch(CoreException ex){
+ SeamCorePlugin.getDefault().logError(ex);
+ }
+ }
+
+ private void scanForJava(IFile file){
+ String ext = file.getFileExtension();
+
+ if(!isFileCorrect(file))
+ return;
+
+ String content = null;
+ try {
+ content = FileUtil.readStream(file.getContents());
+ } catch (CoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ return;
+ }
+ if(JAVA_EXT.equalsIgnoreCase(ext)){
+ scanJava(file, content);
+ }else if(XML_EXT.equalsIgnoreCase(ext))
+ scanDOM(file, content);
+ else if(PROPERTIES_EXT.equalsIgnoreCase(ext))
+ scanProperties(file, content);
+ }
+
+ private void scan(IFile file){
+ String ext = file.getFileExtension();
+
+ if(!isFileCorrect(file))
+ return;
+
+ String content = null;
+ try {
+ content = FileUtil.readStream(file.getContents());
+ } catch (CoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ return;
+ }
+ if(XML_EXT.equalsIgnoreCase(ext) || XHTML_EXT.equalsIgnoreCase(ext) || JSP_EXT.equalsIgnoreCase(ext))
+ scanDOM(file, content);
+ }
+
+ private void scanJava(IFile file, String content){
+ try {
+ FastJavaPartitionScanner scaner = new FastJavaPartitionScanner();
+ Document document = new Document(content);
+ scaner.setRange(document, 0, document.getLength());
+ IToken token = scaner.nextToken();
+ while(token!=null && token!=Token.EOF) {
+ if(IJavaPartitions.JAVA_STRING.equals(token.getData())) {
+ int length = scaner.getTokenLength();
+ int offset = scaner.getTokenOffset();
+ String value = document.get(offset, length);
+ if(value.indexOf('{')>-1) {
+ scanString(file, value, offset);
+ }
+ }
+ token = scaner.nextToken();
+ }
+ } catch (BadLocationException e) {
+ SeamCorePlugin.getDefault().logError(e);
+ }
+ }
+
+ private void scanDOM(IFile file, String content){
+ IModelManager manager = StructuredModelManager.getModelManager();
+ if(manager == null) {
+ return;
+ }
+ IStructuredModel model = null;
+ try {
+ model = manager.getModelForRead(file);
+ if (model instanceof IDOMModel) {
+ IDOMModel domModel = (IDOMModel) model;
+ IDOMDocument document = domModel.getDocument();
+ scanChildNodes(file, document);
+ }
+ } catch (CoreException e) {
+ SeamCorePlugin.getDefault().logError(e);
+ } catch (IOException e) {
+ SeamCorePlugin.getDefault().logError(e);
+ } finally {
+ if (model != null) {
+ model.releaseFromRead();
+ }
+ }
+ }
+
+ private void scanChildNodes(IFile file, Node parent) {
+ NodeList children = parent.getChildNodes();
+ for(int i=0; i<children.getLength(); i++) {
+ Node curentValidatedNode = children.item(i);
+ if(Node.ELEMENT_NODE == curentValidatedNode.getNodeType()) {
+ scanNodeContent(file, ((IDOMNode)curentValidatedNode).getFirstStructuredDocumentRegion(), DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE);
+ } else if(Node.TEXT_NODE == curentValidatedNode.getNodeType()) {
+ scanNodeContent(file, ((IDOMNode)curentValidatedNode).getFirstStructuredDocumentRegion(), DOMRegionContext.XML_CONTENT);
+ }
+ scanChildNodes(file, curentValidatedNode);
+ }
+ }
+
+ private void scanNodeContent(IFile file, IStructuredDocumentRegion node, String regionType) {
+ ITextRegionList regions = node.getRegions();
+ for(int i=0; i<regions.size(); i++) {
+ ITextRegion region = regions.get(i);
+ if(region.getType() == regionType) {
+ String text = node.getFullText(region);
+ if(text.indexOf("{")>-1) { //$NON-NLS-1$
+ int offset = node.getStartOffset() + region.getStart();
+ scanString(file, text, offset);
+ }
+ }
+ }
+ }
+
+ // looking for component references in EL
+ private void scanString(IFile file, String string, int offset) {
+ int startEl = string.indexOf("#{"); //$NON-NLS-1$
+ if(startEl>-1) {
+ ELParser parser = ELParserUtil.getJbossFactory().createParser();
+ ELModel model = parser.parse(string);
+ for (ELInstance instance : model.getInstances()) {
+ for(ELInvocationExpression ie : instance.getExpression().getInvocations()){
+ ELInvocationExpression expression = findComponentReference(ie);
+ if(expression != null){
+ if(expression instanceof ELPropertyInvocation){
+ ELPropertyInvocation pi = (ELPropertyInvocation)expression;
+ match(file, offset+pi.getStartPosition(), pi.getName().getStart()+pi.getName().getLength()-pi.getStartPosition());
+ }else if(expression instanceof ELMethodInvocation){
+ ELMethodInvocation mi = (ELMethodInvocation)expression;
+ match(file, offset+mi.getStartPosition(), mi.getName().getStart()+mi.getName().getLength()-mi.getStartPosition());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void scanProperties(IFile file, String content){
+ scanString(file, content, 0);
+
+ if(!file.getName().equals(SEAM_PROPERTIES_FILE))
+ return;
+
+ StringTokenizer tokenizer = new StringTokenizer(content, "#= \t\r\n\f", true); //$NON-NLS-1$
+
+ String lastToken = "\n"; //$NON-NLS-1$
+ int offset = 0;
+ boolean comment = false;
+ boolean key = true;
+
+ while(tokenizer.hasMoreTokens()){
+ String token = tokenizer.nextToken("#= \t\r\n\f"); //$NON-NLS-1$
+ if(token.equals("\r")) //$NON-NLS-1$
+ token = "\n"; //$NON-NLS-1$
+
+ if(token.equals("#") && lastToken.equals("\n")) //$NON-NLS-1$ //$NON-NLS-2$
+ comment = true;
+ else if(token.equals("\n") && comment) //$NON-NLS-1$
+ comment = false;
+
+ if(!comment){
+ if(!token.equals("\n") && lastToken.equals("\n")) //$NON-NLS-1$ //$NON-NLS-2$
+ key = true;
+ else if(key && (token.equals("=") || token.equals(" "))) //$NON-NLS-1$ //$NON-NLS-2$
+ key = false;
+
+ if(key && token.startsWith(propertyName)){
+ match(file, offset, token.length());
+ }
+ }
+
+ lastToken = token;
+ offset += token.length();
+ }
+ }
+
+
+ protected ELInvocationExpression findComponentReference(ELInvocationExpression invocationExpression){
+ ELInvocationExpression invExp = invocationExpression;
+ while(invExp != null){
+ if(invExp instanceof ELPropertyInvocation){
+ if(((ELPropertyInvocation)invExp).getQualifiedName() != null && ((ELPropertyInvocation)invExp).getQualifiedName().equals(propertyName))
+ return invExp;
+ else
+ invExp = invExp.getLeft();
+
+ }else{
+ invExp = invExp.getLeft();
+ }
+ }
+ return null;
+ }
+
+ protected abstract boolean isFileCorrect(IFile file);
+
+ protected abstract void match(IFile file, int offset, int length);
+}
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameProcessor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameProcessor.java 2009-09-09 00:20:30 UTC (rev 17484)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameProcessor.java 2009-09-09 00:43:23 UTC (rev 17485)
@@ -67,13 +67,13 @@
private String newName;
private String oldName;
- private SeamSeacher seacher = null;
+ private SeamSearcher searcher = null;
- protected SeamSeacher getSeacher(){
- if(seacher == null){
- seacher = new SeamSeacher(declarationFile, getOldName());
+ protected SeamSearcher getSearcher(){
+ if(searcher == null){
+ searcher = new SeamSearcher(declarationFile, getOldName());
}
- return seacher;
+ return searcher;
}
public void setNewName(String newName){
@@ -376,7 +376,7 @@
pm.worked(1);
- getSeacher().findELReferences();
+ getSearcher().findELReferences();
pm.done();
}
@@ -392,7 +392,7 @@
pm.worked(1);
- getSeacher().findELReferences();
+ getSearcher().findELReferences();
pm.done();
}
@@ -434,8 +434,8 @@
}
}
- class SeamSeacher extends SeamRefactorSeacher{
- public SeamSeacher(IFile declarationFile, String oldName){
+ class SeamSearcher extends SeamRefactorSearcher{
+ public SeamSearcher(IFile declarationFile, String oldName){
super(declarationFile, oldName);
}
14 years, 9 months
JBoss Tools SVN: r17484 - trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2009-09-08 20:20:30 -0400 (Tue, 08 Sep 2009)
New Revision: 17484
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/XMLUtilities.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3892
fix compilation errors
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/XMLUtilities.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/XMLUtilities.java 2009-09-09 00:17:23 UTC (rev 17483)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/xml/XMLUtilities.java 2009-09-09 00:20:30 UTC (rev 17484)
@@ -11,6 +11,7 @@
package org.jboss.tools.common.xml;
import java.io.BufferedWriter;
+import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
@@ -22,6 +23,8 @@
import java.util.ArrayList;
import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
import org.apache.xml.serialize.LineSeparator;
import org.apache.xml.serialize.Method;
@@ -43,6 +46,7 @@
import org.xml.sax.SAXException;
public class XMLUtilities {
+
public static boolean hasAttribute(Element e, String s) {
return e.getAttributes().getNamedItem(s) != null;
}
@@ -116,12 +120,31 @@
}
public static DocumentBuilder createDocumentBuilder() {
- return createDocumentBuilder(false);
+ return createDocumentBuilder(false);
}
- public static DocumentBuilder createDocumentBuilder(boolean validating) {
- return SafeDocumentBuilderFactory.createDocumentBuilder(validating);
+ public static DocumentBuilder createDocumentBuilder(boolean validate) {
+ try {
+ DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
+ if (validate) {
+ f.setValidating(validate);
+ }
+ // / f.setExpandEntityReferences(false);
+ DocumentBuilder d = f.newDocumentBuilder();
+ if (!validate) {
+ d.setEntityResolver(EMPTY_RESOLVER);
+ }
+ d.setErrorHandler(new ErrorHandlerImpl());
+ return d;
+ } catch (ParserConfigurationException e) {
+ CommonPlugin.getPluginLog().logError(e);
+ }
+ return null;
}
+
+ public static final EntityResolver EMPTY_RESOLVER = createEmptyEntityResolver();
+
+
public static Element createDocumentElement(String name) {
Document d = createDocumentBuilder().newDocument();
@@ -130,7 +153,19 @@
return de;
}
- public static Element createDocumentElement(String name, String qName, String publicId, String systemId, String namespaceURI) {
+ public static EntityResolver createEmptyEntityResolver() {
+ return new EntityResolver() {
+ public InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId) throws SAXException, java.io.IOException {
+ if((systemId != null) && systemId.toLowerCase().endsWith(".dtd")) { // this deactivates DTD //$NON-NLS-1$
+ return new InputSource(new ByteArrayInputStream("<?xml version='1.0' encoding='UTF-8'?>".getBytes())); //$NON-NLS-1$
+ } else {
+ return null;
+ }
+ }
+ };
+ }
+
+ public static Element createDocumentElement(String name, String qName, String publicId, String systemId, String namespaceURI) {
Document d = null;
try {
DOMImplementation domImpl = createDocumentBuilder().getDOMImplementation();
14 years, 9 months
JBoss Tools SVN: r17483 - trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2009-09-08 20:17:23 -0400 (Tue, 08 Sep 2009)
New Revision: 17483
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/Messages.java
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/messages.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-3892
fix compilation errors
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/Messages.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/Messages.java 2009-09-08 23:45:58 UTC (rev 17482)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/Messages.java 2009-09-09 00:17:23 UTC (rev 17483)
@@ -10,6 +10,7 @@
public static String SAXValidator_UnableToInstantiateMessage;
public static String XMLUtilities_IOExceptionMessage;
public static String XMLUtilities_SAXExceptionMessage;
+ public static String MethodNotImplementedException_MethodIsNotImplementedYet;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/messages.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/messages.properties 2009-09-08 23:45:58 UTC (rev 17482)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/messages.properties 2009-09-09 00:17:23 UTC (rev 17483)
@@ -4,3 +4,4 @@
SAXValidator_UnableToInstantiateMessage=error: Unable to instantiate parser ({0})
XMLUtilities_IOExceptionMessage=Unexpected parser error
XMLUtilities_SAXExceptionMessage=Unexpected parser error
+MethodNotImplementedException_MethodIsNotImplementedYet=Method is not implemented yet
14 years, 9 months
JBoss Tools SVN: r17482 - trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/xml/test.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2009-09-08 19:45:58 -0400 (Tue, 08 Sep 2009)
New Revision: 17482
Added:
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/xml/test/XMLUtilitiesTest1.xml
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/xml/test/XMLUtilitiesTest2.xml
Modified:
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/xml/test/XMLUtilitiesTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3892
increase code coverage for o.j.t.common plug-in
Modified: trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/xml/test/XMLUtilitiesTest.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/xml/test/XMLUtilitiesTest.java 2009-09-08 23:45:37 UTC (rev 17481)
+++ trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/xml/test/XMLUtilitiesTest.java 2009-09-08 23:45:58 UTC (rev 17482)
@@ -10,7 +10,14 @@
******************************************************************************/
package org.jboss.tools.common.xml.test;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import javax.xml.parsers.DocumentBuilder;
+
import org.jboss.tools.common.xml.XMLUtilities;
+import org.w3c.dom.Document;
import org.w3c.dom.Element;
import junit.framework.TestCase;
@@ -18,8 +25,7 @@
public class XMLUtilitiesTest extends TestCase {
public final void testCreateDocumentBuilder() {
- assertNotNull("Element builder without validation wasn't created", XMLUtilities.createDocumentBuilder(true)); // TODO
- assertNotNull("Element builder with validation wasn't created", XMLUtilities.createDocumentBuilder(true)); // TODO
+ assertNotNull("Element builder without validation wasn't created", XMLUtilities.createDocumentBuilder()); // TODO
}
public static final String ELEMENT_NAME = "ElementName";
@@ -30,4 +36,56 @@
assertTrue(element.getNodeName().equals(ELEMENT_NAME));
}
+ public void testCreateDocumentBuilderBoolean() {
+ assertNotNull("Element builder with validation wasn't created", XMLUtilities.createDocumentBuilder(true)); // TODO
+ }
+
+ public void testGetDocumentReaderEntityResolver() throws IOException {
+ assertNotNull(getGoodDocument());;
+ }
+
+ public void testHasAttributeElementString() {
+ Element element = getGoodDocument().getDocumentElement();
+ assertTrue(XMLUtilities.hasAttribute(element, "attribute1"));
+ }
+
+ public void testGetChildrenElementsElementString() {
+ Element element = getGoodDocument().getDocumentElement();
+ assertTrue(XMLUtilities.getChildren(element, "child1").length==4);
+ }
+
+ public void testGetUniqueChildElementString() {
+ Element element = getGoodDocument().getDocumentElement();
+ assertNotNull(XMLUtilities.getUniqueChild(element, "child1"));
+ }
+
+ public void testGetChildrenElementString() {
+ Element element = getGoodDocument().getDocumentElement();
+ assertTrue(XMLUtilities.getChildren(element, "child1").length==4);
+ }
+
+ public void testGetFirstChildElementString() {
+ Element element = getGoodDocument().getDocumentElement();
+ Element first = XMLUtilities.getFirstChild(element,"child1");
+ assertTrue(first.getAttribute("first").equals("true"));
+ first = XMLUtilities.getFirstChild(element,"child2");
+ assertTrue(first.getAttribute("first").equals("true"));
+ first = XMLUtilities.getFirstChild(element,"child10");
+ assertNull(first);
+ }
+
+ public static final Document getGoodDocument() {
+ InputStream in = null;
+ try {
+ in = XMLUtilitiesTest.class.getResourceAsStream("XMLUtilitiesTest1.xml");
+ Document document = XMLUtilities.getDocument(new InputStreamReader(in), XMLUtilities.EMPTY_RESOLVER);
+ assertNotNull(document);
+ return document;
+ } finally {
+ try {
+ in.close();
+ } catch (IOException e) {
+ }
+ }
+ }
}
Added: trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/xml/test/XMLUtilitiesTest1.xml
===================================================================
--- trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/xml/test/XMLUtilitiesTest1.xml (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/xml/test/XMLUtilitiesTest1.xml 2009-09-08 23:45:58 UTC (rev 17482)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node1 attribute1="valueOfAttribute1">
+ <child1 first="true"></child1>
+ <child1></child1>
+ <child1></child1>
+ <child1></child1>
+ <child2 first="true"></child2>
+ <child3></child3>
+ <child4></child4>
+ <child5></child5>
+</node1>
\ No newline at end of file
Property changes on: trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/xml/test/XMLUtilitiesTest1.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/xml/test/XMLUtilitiesTest2.xml
===================================================================
--- trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/xml/test/XMLUtilitiesTest2.xml (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/xml/test/XMLUtilitiesTest2.xml 2009-09-08 23:45:58 UTC (rev 17482)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<
+<node1>
+ <child1></child1>
+ <child2></child2>
+ <child3></child3>
+ <child4></child4>
+ <child5></child5>
+</node1>
\ No newline at end of file
Property changes on: trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/xml/test/XMLUtilitiesTest2.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 9 months
JBoss Tools SVN: r17481 - trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2009-09-08 19:45:37 -0400 (Tue, 08 Sep 2009)
New Revision: 17481
Added:
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/MessagesTest.java
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/MethodNotImplementedExceptionTest.java
Modified:
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/CommonAllTests.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3892
increase code coverage for o.j.t.common plug-in
Modified: trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/CommonAllTests.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/CommonAllTests.java 2009-09-08 20:40:03 UTC (rev 17480)
+++ trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/CommonAllTests.java 2009-09-08 23:45:37 UTC (rev 17481)
@@ -31,7 +31,9 @@
suite.addTestSuite(SAXValidatorTest.class);
suite.addTestSuite(ProblemReportingHelperTest.class);
suite.addTestSuite(CommonPluginTest.class);
- suite.addTestSuite(ZipAllTests.class);
+ suite.addTest(ZipAllTests.suite());
+ suite.addTestSuite(MessagesTest.class);
+ suite.addTestSuite(MethodNotImplementedExceptionTest.class);
return suite;
}
}
\ No newline at end of file
Added: trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/MessagesTest.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/MessagesTest.java (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/MessagesTest.java 2009-09-08 23:45:37 UTC (rev 17481)
@@ -0,0 +1,11 @@
+package org.jboss.tools.common.test;
+
+import org.jboss.tools.common.Messages;
+
+import junit.framework.TestCase;
+
+public class MessagesTest extends TestCase {
+ public static void testMessagesInitialization() {
+ assertNotNull(Messages.BaseUIPlugin_ErrorDialogTitle);
+ }
+}
Property changes on: trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/MessagesTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/MethodNotImplementedExceptionTest.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/MethodNotImplementedExceptionTest.java (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/MethodNotImplementedExceptionTest.java 2009-09-08 23:45:37 UTC (rev 17481)
@@ -0,0 +1,38 @@
+package org.jboss.tools.common.test;
+
+import org.jboss.tools.common.Messages;
+import org.jboss.tools.common.MethodNotImplementedException;
+
+import junit.framework.TestCase;
+
+public class MethodNotImplementedExceptionTest extends TestCase {
+
+ public void testMethodNotImplementedException() {
+ MethodNotImplementedException ex = new MethodNotImplementedException();
+ assertEquals(
+ Messages.MethodNotImplementedException_MethodIsNotImplementedYet,
+ ex.getMessage());
+ }
+
+ public void testMethodNotImplementedExceptionStringThrowable() {
+ Throwable th = new Exception();
+ MethodNotImplementedException ex = new MethodNotImplementedException(Messages.BaseUIPlugin_ErrorDialogTitle,th);
+ assertEquals(
+ Messages.BaseUIPlugin_ErrorDialogTitle,
+ ex.getMessage());
+ assertEquals(th,ex.getCause());
+ }
+
+ public void testMethodNotImplementedExceptionString() {
+ MethodNotImplementedException ex = new MethodNotImplementedException(Messages.BaseUIPlugin_ErrorDialogTitle);
+ assertEquals(
+ Messages.BaseUIPlugin_ErrorDialogTitle,
+ ex.getMessage());
+ }
+
+ public void testMethodNotImplementedExceptionThrowable() {
+ Throwable th = new Exception();
+ MethodNotImplementedException ex = new MethodNotImplementedException(th);
+ assertEquals(th,ex.getCause());
+ }
+}
Property changes on: trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/MethodNotImplementedExceptionTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years, 9 months