JBoss Tools SVN: r14985 - in trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext: hyperlink and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-04-30 13:54:25 -0400 (Thu, 30 Apr 2009)
New Revision: 14985
Modified:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtMessages.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlink.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlinkDetector.java
Log:
JBIDE-4068 Add option (Open On) to open the correspondent Seam component when we have a @In annotation in a field and click on the field name .
- New open-on is added for the members annotated by @In annotation
Modified: trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtMessages.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtMessages.java 2009-04-30 17:42:05 UTC (rev 14984)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtMessages.java 2009-04-30 17:54:25 UTC (rev 14985)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.seam.text.ext;
import org.eclipse.osgi.util.NLS;
@@ -2,2 +12,7 @@
+/**
+ *
+ * @author Victor Rubezhny
+ *
+ */
public class SeamExtMessages extends NLS {
Modified: trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlink.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlink.java 2009-04-30 17:42:05 UTC (rev 14984)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlink.java 2009-04-30 17:54:25 UTC (rev 14985)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.seam.text.ext.hyperlink;
import java.text.MessageFormat;
@@ -20,6 +30,11 @@
import org.jboss.tools.seam.text.ext.SeamExtMessages;
import org.jboss.tools.seam.text.ext.SeamExtPlugin;
+/**
+ *
+ * @author Victor Rubezhny
+ *
+ */
public class SeamComponentHyperlink implements IHyperlink {
private IRegion fRegion;
Modified: trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlinkDetector.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlinkDetector.java 2009-04-30 17:42:05 UTC (rev 14984)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlinkDetector.java 2009-04-30 17:54:25 UTC (rev 14985)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.seam.text.ext.hyperlink;
import java.util.ArrayList;
@@ -44,7 +54,11 @@
import org.jboss.tools.seam.internal.core.scanner.java.SeamAnnotations;
import org.jboss.tools.seam.text.ext.SeamExtPlugin;
-
+/**
+ *
+ * @author Victor Rubezhny
+ *
+ */
public class SeamComponentHyperlinkDetector extends AbstractHyperlinkDetector {
/*
15 years, 11 months
JBoss Tools SVN: r14984 - in trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext: hyperlink and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-04-30 13:42:05 -0400 (Thu, 30 Apr 2009)
New Revision: 14984
Added:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/Messages.properties
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtMessages.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlink.java
trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlinkDetector.java
Log:
JBIDE-4068 Add option (Open On) to open the correspondent Seam component when we have a @In annotation in a field and click on the field name .
- New open-on is added for the members annotated by @In annotation
Added: trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/Messages.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/Messages.properties (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/Messages.properties 2009-04-30 17:42:05 UTC (rev 14984)
@@ -0,0 +1,5 @@
+OpenAs=Open ''{0}'' as {1}
+SeamComponent=Component
+SeamRole=Role
+SeamFactory=Factory
+SeamBijected=Bijected Attribute
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/Messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtMessages.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtMessages.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtMessages.java 2009-04-30 17:42:05 UTC (rev 14984)
@@ -0,0 +1,22 @@
+package org.jboss.tools.seam.text.ext;
+
+import org.eclipse.osgi.util.NLS;
+
+public class SeamExtMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.tools.seam.text.ext.Messages"; //$NON-NLS-1$
+
+ public static String OpenAs;
+ public static String SeamComponent;
+ public static String SeamRole;
+ public static String SeamFactory;
+ public static String SeamBijected;
+
+ //
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, SeamExtMessages.class);
+ }
+
+ private SeamExtMessages() {
+ }
+}
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/SeamExtMessages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlink.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlink.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlink.java 2009-04-30 17:42:05 UTC (rev 14984)
@@ -0,0 +1,157 @@
+package org.jboss.tools.seam.text.ext.hyperlink;
+
+import java.text.MessageFormat;
+import java.util.Set;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.hyperlink.IHyperlink;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+import org.jboss.tools.seam.core.IBijectedAttribute;
+import org.jboss.tools.seam.core.IOpenableElement;
+import org.jboss.tools.seam.core.IRole;
+import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamComponentDeclaration;
+import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
+import org.jboss.tools.seam.text.ext.SeamExtMessages;
+import org.jboss.tools.seam.text.ext.SeamExtPlugin;
+
+public class SeamComponentHyperlink implements IHyperlink {
+
+ private IRegion fRegion;
+ private IJavaElement fElement;
+ private IOpenableElement fOpenable;
+ private String fLabel;
+ private String fName;
+
+ /**
+ * Creates a new Seam Component hyperlink.
+ */
+ SeamComponentHyperlink(IRegion region, IJavaElement element, String name) {
+ Assert.isNotNull(region);
+ Assert.isNotNull(element);
+ Assert.isNotNull(name);
+
+ fRegion = region;
+ fElement = element;
+ fOpenable = null;
+ fLabel = SeamExtMessages.SeamFactory;
+ fName = name;
+ }
+
+ /**
+ * Creates a new Seam Component hyperlink.
+ */
+ SeamComponentHyperlink(IRegion region, ISeamComponent element, String name) {
+ Assert.isNotNull(region);
+ Assert.isNotNull(element);
+ Assert.isNotNull(name);
+
+ fRegion = region;
+ fElement = null;
+ fLabel = SeamExtMessages.SeamComponent;
+ fName = name;
+ fOpenable = null;
+
+ ISeamJavaComponentDeclaration javaDeclaration = element.getJavaDeclaration();
+ if (javaDeclaration != null && javaDeclaration instanceof IOpenableElement) {
+ fOpenable = (IOpenableElement)javaDeclaration;
+ } else {
+ Set<ISeamComponentDeclaration> declarations = element.getAllDeclarations();
+ for (ISeamComponentDeclaration componentDeclaration : declarations) {
+ if (componentDeclaration instanceof IOpenableElement) {
+ fOpenable = (IOpenableElement)componentDeclaration;
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Creates a new Seam Component hyperlink.
+ */
+ SeamComponentHyperlink(IRegion region, IBijectedAttribute element, String name) {
+ Assert.isNotNull(region);
+ Assert.isNotNull(element);
+ Assert.isNotNull(name);
+
+ fRegion = region;
+ fElement = element.getSourceMember();
+ fLabel = SeamExtMessages.SeamBijected;
+ fName = name;
+ fOpenable = null;
+ }
+
+ /**
+ * Creates a new Seam Component hyperlink.
+ */
+ SeamComponentHyperlink(IRegion region, IRole element, String name) {
+ Assert.isNotNull(region);
+ Assert.isNotNull(element);
+ Assert.isTrue(element instanceof IOpenableElement);
+ Assert.isNotNull(name);
+
+ fRegion = region;
+ fElement = null;
+ fOpenable = (IOpenableElement)element;
+ fLabel = SeamExtMessages.SeamRole;
+ fName = name;
+ }
+
+ /*
+ * @see org.eclipse.jdt.internal.ui.javaeditor.IHyperlink#getHyperlinkRegion()
+ * @since 3.1
+ */
+ public IRegion getHyperlinkRegion() {
+ return fRegion;
+ }
+
+ /*
+ * @see org.eclipse.jdt.internal.ui.javaeditor.IHyperlink#open()
+ * @since 3.1
+ */
+ public void open() {
+
+ if (fOpenable != null) {
+ fOpenable.open();
+ return;
+ }
+
+ if (fElement != null) {
+ try {
+ IEditorPart part = null;
+ part = JavaUI.openInEditor(fElement);
+ if (part != null) {
+ JavaUI.revealInEditor(part, fElement);
+ }
+ } catch (PartInitException e) {
+ SeamExtPlugin.getPluginLog().logError(e);
+ } catch (JavaModelException e) {
+ // Ignore. It is probably because of Java element is not found
+ }
+ }
+ }
+
+ /*
+ * @see org.eclipse.jdt.internal.ui.javaeditor.IHyperlink#getTypeLabel()
+ * @since 3.1
+ */
+ public String getTypeLabel() {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see IHyperlink#getHyperlinkText()
+ */
+ public String getHyperlinkText() {
+ return MessageFormat.format(SeamExtMessages.OpenAs, fName, fLabel);
+ }
+
+
+}
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlink.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlinkDetector.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlinkDetector.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlinkDetector.java 2009-04-30 17:42:05 UTC (rev 14984)
@@ -0,0 +1,186 @@
+package org.jboss.tools.seam.text.ext.hyperlink;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IAnnotatable;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.ICodeAssist;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMemberValuePair;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
+import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
+import org.eclipse.jdt.internal.ui.text.JavaWordFinder;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.hyperlink.AbstractHyperlinkDetector;
+import org.eclipse.jface.text.hyperlink.IHyperlink;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.jboss.tools.common.text.ext.hyperlink.HyperlinkBuilder;
+import org.jboss.tools.seam.core.IBijectedAttribute;
+import org.jboss.tools.seam.core.IRole;
+import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamContextShortVariable;
+import org.jboss.tools.seam.core.ISeamContextVariable;
+import org.jboss.tools.seam.core.ISeamMessages;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.ISeamXmlFactory;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.internal.core.el.SeamELCompletionEngine;
+import org.jboss.tools.seam.internal.core.scanner.ScannerException;
+import org.jboss.tools.seam.internal.core.scanner.java.AnnotatedASTNode;
+import org.jboss.tools.seam.internal.core.scanner.java.ResolvedAnnotation;
+import org.jboss.tools.seam.internal.core.scanner.java.SeamAnnotations;
+import org.jboss.tools.seam.text.ext.SeamExtPlugin;
+
+
+public class SeamComponentHyperlinkDetector extends AbstractHyperlinkDetector {
+
+ /*
+ * If the hyperlink is performed on the field name that is annotated as @In then
+ * the hyperlink will open a correspondent Seam component
+ *
+ * (non-Javadoc)
+ * @see org.eclipse.jface.text.hyperlink.IHyperlinkDetector#detectHyperlinks(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion, boolean)
+ */
+ public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) {
+ ITextEditor textEditor= (ITextEditor)getAdapter(ITextEditor.class);
+ if (region == null ||
+// canShowMultipleHyperlinks ||
+ !(textEditor instanceof JavaEditor))
+ return null;
+
+ int offset= region.getOffset();
+
+ IJavaElement input= EditorUtility.getEditorInputJavaElement(textEditor, false);
+ if (input == null)
+ return null;
+
+ if (input.getResource() == null || input.getResource().getProject() == null)
+ return null;
+
+ ISeamProject seamProject = SeamCorePlugin.getSeamProject(input.getResource().getProject(), true);
+ SeamELCompletionEngine engine = new SeamELCompletionEngine(seamProject);
+
+ IDocument document= textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
+ IRegion wordRegion= JavaWordFinder.findWord(document, offset);
+ if (wordRegion == null)
+ return null;
+
+ IFile file = null;
+
+ try {
+ IResource resource = input.getCorrespondingResource();
+ if (resource instanceof IFile)
+ file = (IFile) resource;
+ } catch (JavaModelException e) {
+ // Ignore. It is probably because of Java element's resource is not found
+ }
+
+ int[] range = new int[]{wordRegion.getOffset(), wordRegion.getOffset() + wordRegion.getLength()};
+
+ IJavaElement[] elements = null;
+
+ try {
+ elements = ((ICodeAssist)input).codeSelect(wordRegion.getOffset(), wordRegion.getLength());
+ if (elements == null)
+ return null;
+
+ ArrayList<IHyperlink> hyperlinks = new ArrayList<IHyperlink>();
+ for (IJavaElement element : elements) {
+ if (element instanceof IAnnotatable) {
+ IAnnotatable annotatable = (IAnnotatable)element;
+
+ IAnnotation annotation = annotatable.getAnnotation("In");
+ if (annotation == null)
+ continue;
+
+ String nameToSearch = element.getElementName();
+
+ IMemberValuePair[] mvPairs = annotation.getMemberValuePairs();
+ if (mvPairs != null) {
+ for (IMemberValuePair mvPair : mvPairs) {
+ if ("value".equals(mvPair.getMemberName()) && mvPair.getValue() != null) {
+ String name = mvPair.getValue().toString();
+ if (name != null && name.trim().length() != 0) {
+ nameToSearch = name;
+ break;
+ }
+ }
+ }
+ }
+
+
+ if (nameToSearch == null && nameToSearch.trim().length() == 0)
+ continue;
+
+ Set<ISeamContextVariable> vars = seamProject.getVariables(true);
+ if (vars != null) {
+ for (ISeamContextVariable var : vars) {
+ if (nameToSearch.equals(var.getName())){
+ while (var instanceof ISeamContextShortVariable) {
+ var = ((ISeamContextShortVariable)var).getOriginal();
+ }
+ if (var == null)
+ continue;
+
+ if (var instanceof ISeamXmlFactory) {
+ ISeamXmlFactory xmlFactory = (ISeamXmlFactory)var;
+
+ String value = xmlFactory.getValue();
+ if (value == null || value.trim().length() == 0) {
+ value = xmlFactory.getMethod();
+ }
+
+ if (value == null || value.trim().length() == 0)
+ continue;
+
+ List<IJavaElement> javaElements = null;
+
+ try {
+ javaElements = engine.getJavaElementsForExpression(
+ seamProject, file, value);
+ } catch (StringIndexOutOfBoundsException e) {
+ } catch (BadLocationException e) {
+ }
+ if (javaElements != null) {
+ for (IJavaElement javaElement : javaElements) {
+ hyperlinks.add(new SeamComponentHyperlink(wordRegion, javaElement, nameToSearch));
+ }
+ }
+ } else if (var instanceof ISeamComponent) {
+ hyperlinks.add(new SeamComponentHyperlink(wordRegion, (ISeamComponent)var, nameToSearch));
+ } else if (var instanceof IRole) {
+ hyperlinks.add(new SeamComponentHyperlink(wordRegion, (IRole)var, nameToSearch));
+ } else if (var instanceof IBijectedAttribute) {
+ IBijectedAttribute attr = (IBijectedAttribute)var;
+ if (attr.getSourceMember() != null) {
+ hyperlinks.add(new SeamComponentHyperlink(wordRegion, (IBijectedAttribute)var, nameToSearch));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if (hyperlinks != null && hyperlinks.size() > 0) {
+ return (IHyperlink[])hyperlinks.toArray(new IHyperlink[hyperlinks.size()]);
+ }
+ } catch (JavaModelException jme) {
+ // ignore
+ }
+ return null;
+ }
+
+}
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.text.ext/src/org/jboss/tools/seam/text/ext/hyperlink/SeamComponentHyperlinkDetector.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 11 months
JBoss Tools SVN: r14983 - trunk/seam/plugins/org.jboss.tools.seam.text.ext.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-04-30 13:41:35 -0400 (Thu, 30 Apr 2009)
New Revision: 14983
Modified:
trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml
Log:
JBIDE-4210 Add OpenOn for s:graphicImage@value
- New open-on is added for s:graphicImage@value
JBIDE-4068 Add option (Open On) to open the correspondent Seam component when we have a @In annotation in a field and click on the field name .
- New open-on is added for the members annotated by @In annotation
Modified: trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml 2009-04-30 17:04:41 UTC (rev 14982)
+++ trunk/seam/plugins/org.jboss.tools.seam.text.ext/plugin.xml 2009-04-30 17:41:35 UTC (rev 14983)
@@ -220,6 +220,26 @@
</contentType>
</hyperlinkPartitioner>
+ <hyperlinkPartitioner
+ id="org.jboss.tools.common.text.ext.jsf.hyperlink.JSPForwardHyperlinkPartitioner"
+ class="org.jboss.tools.jsf.text.ext.hyperlink.JSPForwardHyperlinkPartitioner">
+ <contentType id="org.eclipse.jst.jsp.core.jspsource">
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_ATTRIBUTE_VALUE">
+ <axis path="*/[http://jboss.com/products/seam/taglib]:graphicImage/value/" />
+ </partitionType>
+ </contentType>
+ <contentType id="org.eclipse.wst.html.core.htmlsource">
+ <partitionType id="org.jboss.tools.common.text.ext.xml.XML_ATTRIBUTE_VALUE">
+ <axis path="*/[http://jboss.com/products/seam/taglib]:graphicImage/value/" />
+ </partitionType>
+ </contentType>
+ </hyperlinkPartitioner>
+
+
+ <!--
+ The following definitions are subject to move into another plugin
+ bacause of bpm and drools are not the basics of seam
+ -->
<!-- JBIDE-4002 <bpm:process-definitions> and <bpm:pageflow-definitions> in components.xml -->
<!-- JBIDE-3901 <drools:rule-files> in components.xml -->
<hyperlinkPartitioner
@@ -353,6 +373,13 @@
name="%SeamELInJavaStringHyperlinkDetector"
targetId="org.eclipse.jdt.ui.javaCode">
</hyperlinkDetector>
+ <hyperlinkDetector
+ class="org.jboss.tools.seam.text.ext.hyperlink.SeamComponentHyperlinkDetector"
+ id="org.jboss.tools.seam.text.ext.hyperlink.SeamComponentHyperlinkDetector"
+ name="Seam Component"
+ targetId="org.eclipse.jdt.ui.javaCode">
+ </hyperlinkDetector>
+
</extension>
15 years, 11 months
JBoss Tools SVN: r14982 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-04-30 13:04:41 -0400 (Thu, 30 Apr 2009)
New Revision: 14982
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4068
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java 2009-04-30 16:41:31 UTC (rev 14981)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java 2009-04-30 17:04:41 UTC (rev 14982)
@@ -99,8 +99,8 @@
} else if(javaSource instanceof IMethod) {
SeamXMLHelper.saveMethod(element, (IMethod)javaSource, TAG_JAVA_SOURCE, context);
} else if(javaSource instanceof IType) {
- Element ce = XMLUtilities.createElement(parent, TAG_JAVA_SOURCE);
- element.setAttribute(SeamXMLConstants.ATTR_CLASS, SeamXMLConstants.CLS_TYPE);
+ Element ce = XMLUtilities.createElement(element, TAG_JAVA_SOURCE);
+ ce.setAttribute(SeamXMLConstants.ATTR_CLASS, SeamXMLConstants.CLS_TYPE);
SeamXMLHelper.saveType(ce, (IType)javaSource, context);
}
15 years, 11 months
JBoss Tools SVN: r14981 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-04-30 12:41:31 -0400 (Thu, 30 Apr 2009)
New Revision: 14981
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4068
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java 2009-04-30 16:22:05 UTC (rev 14980)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java 2009-04-30 16:41:31 UTC (rev 14981)
@@ -99,7 +99,9 @@
} else if(javaSource instanceof IMethod) {
SeamXMLHelper.saveMethod(element, (IMethod)javaSource, TAG_JAVA_SOURCE, context);
} else if(javaSource instanceof IType) {
- SeamXMLHelper.saveType(element, (IType)javaSource, TAG_JAVA_SOURCE, context);
+ Element ce = XMLUtilities.createElement(parent, TAG_JAVA_SOURCE);
+ element.setAttribute(SeamXMLConstants.ATTR_CLASS, SeamXMLConstants.CLS_TYPE);
+ SeamXMLHelper.saveType(ce, (IType)javaSource, context);
}
return element;
15 years, 11 months
JBoss Tools SVN: r14980 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-04-30 12:22:05 -0400 (Thu, 30 Apr 2009)
New Revision: 14980
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4068
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java 2009-04-30 15:33:37 UTC (rev 14979)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaContextVariable.java 2009-04-30 16:22:05 UTC (rev 14980)
@@ -19,6 +19,7 @@
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.ui.JavaUI;
import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
@@ -97,6 +98,8 @@
SeamXMLHelper.saveField(element, (IField)javaSource, TAG_JAVA_SOURCE, context);
} else if(javaSource instanceof IMethod) {
SeamXMLHelper.saveMethod(element, (IMethod)javaSource, TAG_JAVA_SOURCE, context);
+ } else if(javaSource instanceof IType) {
+ SeamXMLHelper.saveType(element, (IType)javaSource, TAG_JAVA_SOURCE, context);
}
return element;
@@ -112,6 +115,8 @@
javaSource = SeamXMLHelper.loadField(c, context);
} else if(SeamXMLConstants.CLS_METHOD.equals(cls)) {
javaSource = SeamXMLHelper.loadMethod(c, context);
+ } else if(SeamXMLConstants.CLS_TYPE.equals(cls)) {
+ javaSource = SeamXMLHelper.loadType(c, context);
}
}
15 years, 11 months
JBoss Tools SVN: r14979 - trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-04-30 11:33:37 -0400 (Thu, 30 Apr 2009)
New Revision: 14979
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/CriteriaEditorAction.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4253 - for subitems of Session Factory -> open Hibernate Criteria Editor with criteria
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/CriteriaEditorAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/CriteriaEditorAction.java 2009-04-30 14:20:16 UTC (rev 14978)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/CriteriaEditorAction.java 2009-04-30 15:33:37 UTC (rev 14979)
@@ -21,10 +21,15 @@
*/
package org.hibernate.eclipse.console.actions;
+import javax.swing.tree.TreeNode;
+
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.osgi.util.NLS;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.ImageConstants;
+import org.hibernate.console.node.BaseNode;
+import org.hibernate.console.node.PersistentCollectionNode;
+import org.hibernate.console.node.TypeNode;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.utils.EclipseImages;
@@ -49,7 +54,7 @@
protected String generateQuery(TreePath path) {
final String criteria = ".createCriteria({0})"; //$NON-NLS-1$
final String alias = "\n.createCriteria(\"{0}\", \"{1}\")"; //$NON-NLS-1$
- final String projection = "\n.setProjection( Property.forName(\"{0}\").as(\"{0}\"))"; //$NON-NLS-1$
+ final String projection = "\n.setProjection(Property.forName(\"{0}\").as(\"{0}\"))"; //$NON-NLS-1$
final String sess = "session"; //$NON-NLS-1$
String enCriteria = ""; //$NON-NLS-1$
String propCriteria = ""; //$NON-NLS-1$
@@ -61,7 +66,7 @@
} else if (node instanceof Property){
Property prop = (Property)node;
String prName = prop.getName();
- PersistentClass pClass = ((Property)node).getPersistentClass();
+ PersistentClass pClass = prop.getPersistentClass();
if (pClass != null){
enName = pClass.getEntityName();
enName = enName.substring(enName.lastIndexOf('.') + 1);
@@ -87,8 +92,47 @@
}
}
}
+ } else if (node instanceof BaseNode) {
+ String prName = null;
+ TreeNode treeNodeParent = null;
+ if (node instanceof TypeNode) {
+ TypeNode typeNode = (TypeNode)node;
+ prName = typeNode.getName();
+ treeNodeParent = typeNode.getParent();
+ }
+ else if (node instanceof PersistentCollectionNode) {
+ PersistentCollectionNode persistentCollectionNode = (PersistentCollectionNode)node;
+ prName = persistentCollectionNode.getName();
+ treeNodeParent = persistentCollectionNode.getParent();
+ }
+ else {
+ BaseNode baseNode = (BaseNode)node;
+ enName = baseNode.getName();
+ enName = enName.substring(enName.lastIndexOf('.') + 1);
+ }
+ if (prName != null) {
+ if (treeNodeParent instanceof BaseNode) {
+ BaseNode baseNodeParent = (BaseNode)treeNodeParent;
+ if (baseNodeParent instanceof TypeNode) {
+ TypeNode typeNodeParent = (TypeNode)baseNodeParent;
+ enName = typeNodeParent.getType().getName();
+ }
+ else if (baseNodeParent instanceof PersistentCollectionNode) {
+ PersistentCollectionNode persistentCollectionNodeParent = (PersistentCollectionNode)baseNodeParent;
+ enName = persistentCollectionNodeParent.getType().getName();
+ }
+ else {
+ enName = baseNodeParent.getName();
+ }
+ enName = enName.substring(enName.lastIndexOf('.') + 1);
+ propCriteria = NLS.bind(alias, prName, prName.charAt(0));
+ }
+ else {
+ return ""; //$NON-NLS-1$
+ }
+ }
} else {
- return ""; //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
}
enCriteria = NLS.bind(criteria, enName + ".class"); //$NON-NLS-1$
return sess + enCriteria + propCriteria + "\n.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP)"; //$NON-NLS-1$
15 years, 11 months
JBoss Tools SVN: r14978 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2009-04-30 10:20:16 -0400 (Thu, 30 Apr 2009)
New Revision: 14978
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-1077
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java 2009-04-30 13:08:52 UTC (rev 14977)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java 2009-04-30 14:20:16 UTC (rev 14978)
@@ -11,9 +11,6 @@
package org.jboss.tools.seam.internal.core.refactoring;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
@@ -22,20 +19,8 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jdt.core.IAnnotatable;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IParent;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.ui.text.FastJavaPartitionScanner;
import org.eclipse.jdt.ui.text.IJavaPartitions;
import org.eclipse.jface.text.BadLocationException;
@@ -69,8 +54,6 @@
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.EclipseJavaUtil;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.seam.core.BijectedAttributeType;
import org.jboss.tools.seam.core.IBijectedAttribute;
@@ -83,6 +66,7 @@
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.SeamProjectsSet;
import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
+import org.jboss.tools.seam.internal.core.scanner.java.SeamAnnotations;
import org.jboss.tools.seam.internal.core.validation.SeamContextValidationHelper;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -91,21 +75,13 @@
* @author Alexey Kazakov
*/
public class RenameComponentProcessor extends RenameProcessor {
- private static final String ANNOTATION_NAME = "org.jboss.seam.annotations.Name";
- private static final String ANNOTATION_IN = "org.jboss.seam.annotations.In";
- private static final String ANNOTATION_FACTORY = "org.jboss.seam.annotations.Factory";
-
private static final String JAVA_EXT = "java";
private static final String XML_EXT = "xml";
private static final String XHTML_EXT = "xhtml";
private static final String JSP_EXT = "jsp";
private static final String PROPERTIES_EXT = "properties";
- private static final String COMPONENTS_FILE = "components.xml";
private static final String SEAM_PROPERTIES_FILE = "seam.properties";
- private static final String COMPONENT_NODE = "component";
- private static final String FACTORY_NODE = "factory";
- private static final String NAME_ATTRIBUTE = "name";
private IFile declarationFile=null;
private ISeamComponent component;
@@ -132,89 +108,6 @@
this.newName = componentName;
}
- private IAnnotation getNameAnnotation(IFile file){
- try{
- ICompilationUnit unit = getCompilationUnit(file);
- for(IType type : unit.getAllTypes()){
- for(IAnnotation annotation : type.getAnnotations()){
- if(EclipseJavaUtil.resolveType(type, annotation.getElementName()).equals(ANNOTATION_NAME))
- return annotation;
- }
- }
- }catch(CoreException ex){
- SeamCorePlugin.getDefault().logError(ex);
- }
- return null;
- }
-
- private List<IAnnotation> getAnnotations(IFile file, String[] annotationNames){
- ArrayList<IAnnotation> annotations = new ArrayList<IAnnotation>();
- try{
- ICompilationUnit unit = getCompilationUnit(file);
- for(IType type : unit.getAllTypes()){
- for(IAnnotation annotation : type.getAnnotations()){
- for(String annotationName : annotationNames){
- if(EclipseJavaUtil.resolveType(type, annotation.getElementName()).equals(annotationName))
- annotations.add(annotation);
- }
- }
- }
- for(IJavaElement element : unit.getChildren()){
- List<IAnnotation> list = getAnnotations(element, annotationNames);
- annotations.addAll(list);
-
- }
- }catch(CoreException ex){
- SeamCorePlugin.getDefault().logError(ex);
- }
- return annotations;
- }
-
- private List<IAnnotation> getAnnotations(IJavaElement element, String[] annotationNames){
- IType type = (IType)element.getAncestor(IJavaElement.TYPE);
- ArrayList<IAnnotation> annotations = new ArrayList<IAnnotation>();
- if(element instanceof IAnnotatable){
- try{
- for(IAnnotation annotation : ((IAnnotatable)element).getAnnotations()){
- for(String annotationName : annotationNames){
- if(EclipseJavaUtil.resolveType(type, annotation.getElementName()).equals(annotationName))
- annotations.add(annotation);
- }
- }
- }catch(JavaModelException ex){
- SeamCorePlugin.getDefault().logError(ex);
- }
- }
- if(element instanceof IParent){
- try{
- for(IJavaElement child : ((IParent)element).getChildren()){
- List<IAnnotation> list = getAnnotations(child, annotationNames);
- annotations.addAll(list);
- }
- }catch(JavaModelException ex){
- SeamCorePlugin.getDefault().logError(ex);
- }
- }
-
- return annotations;
- }
-
-
- private ICompilationUnit getCompilationUnit(IFile file) throws CoreException {
- IProject project = file.getProject();
- IJavaProject javaProject = (IJavaProject)project.getNature(JavaCore.NATURE_ID);
- for (IResource resource : EclipseResourceUtil.getJavaSourceRoots(project)) {
- if(resource.getFullPath().isPrefixOf(file.getFullPath())) {
- IPath path = file.getFullPath().removeFirstSegments(resource.getFullPath().segmentCount());
- IJavaElement element = javaProject.findElement(path);
- if(element instanceof ICompilationUnit) {
- return (ICompilationUnit)element;
- }
- }
- }
- return null;
- }
-
// we need to find references in .java .xml .xhtml .jsp .properties files
private void findELReferences(){
if(declarationFile == null)
@@ -265,7 +158,6 @@
}
if(ext.equalsIgnoreCase(JAVA_EXT)){
scanJava(file, content);
- lookingForAnnotations(file);
} else if(ext.equalsIgnoreCase(XML_EXT) || ext.equalsIgnoreCase(XHTML_EXT) || ext.equalsIgnoreCase(JSP_EXT))
scanDOM(file, content);
else if(ext.equalsIgnoreCase(PROPERTIES_EXT))
@@ -273,57 +165,6 @@
}
- private void lookingForAnnotations(IFile file){
- String source;
- List<IAnnotation> annotations = getAnnotations(file, new String[]{ANNOTATION_IN, ANNOTATION_FACTORY});
- for(IAnnotation annotation : annotations){
- source = "";
- int memberValueNumber = 0;
- try{
- source = annotation.getSource();
- memberValueNumber = annotation.getMemberValuePairs().length;
- }catch(JavaModelException ex){
- SeamCorePlugin.getDefault().logError(ex);
- }
-
- if(source.indexOf("\""+component.getName()+"\"") >= 0){
- changeAnnotation(file, annotation);
- }else if(annotation.getParent().getElementType() == IJavaElement.FIELD){
- IField field = (IField)annotation.getParent();
- if(memberValueNumber == 0 && field.getElementName().equals(component.getName())){
-
-// RenameFieldProcessor fieldProcessor = new RenameFieldProcessor(field);
-// fieldProcessor.setUpdateReferences(true);
-// fieldProcessor.setNewElementName(newName);
-// try{
-// System.out.println("Rename Field");
-// DynamicValidationRefactoringChange change = (DynamicValidationRefactoringChange)fieldProcessor.createChange(new NullProgressMonitor());
-// rootChange.add(change);
-// }catch(CoreException ex){
-// SeamCorePlugin.getDefault().logError(ex);
-// }
- changeAnnotation(file, annotation);
- }
- }else if(annotation.getParent().getElementType() == IJavaElement.METHOD){
- IMethod method = (IMethod)annotation.getParent();
- if(memberValueNumber == 0 && getFieldName(method.getElementName()).equals(component.getName())){
-// TextChangeManager man = new TextChangeManager();
-// RenameNonVirtualMethodProcessor methodProcessor = new RenameNonVirtualMethodProcessor(method);
-// methodProcessor.setUpdateReferences(true);
-// methodProcessor.setNewElementName(newName);
-// try{
-// System.out.println("Rename Method");
-// DynamicValidationRefactoringChange change = (DynamicValidationRefactoringChange)methodProcessor.createChange(new NullProgressMonitor());
-// rootChange.add(change);
-// }catch(CoreException ex){
-// SeamCorePlugin.getDefault().logError(ex);
-// }
- changeAnnotation(file, annotation);
- }
- }
- }
- }
-
private void findDeclarations() throws CoreException{
if(component.getJavaDeclaration() != null)
renameJavaDeclaration(component.getJavaDeclaration());
@@ -351,61 +192,12 @@
private void renameXMLDeclaration(ISeamXmlComponentDeclaration xmlDecl){
declarationFile = (IFile)xmlDecl.getResource();
if(declarationFile != null && !coreHelper.isJar(xmlDecl)){
- String content = null;
- try {
- content = FileUtil.readStream(declarationFile.getContents());
- } catch (CoreException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- return;
- }
ISeamTextSourceReference location = ((SeamComponentDeclaration)xmlDecl).getLocationFor(ISeamXmlComponentDeclaration.NAME);
- if(location != null){
- String text = content.substring(location.getStartPosition(), location.getStartPosition()+location.getLength());
- if(text.startsWith("<")){
- int position = text.lastIndexOf("/>");
- if(position < 0){
- position = text.lastIndexOf(">");
- }
- TextFileChange change = getChange(declarationFile);
- TextEdit edit = new ReplaceEdit(location.getStartPosition()+position, 0, " name=\""+newName+"\"");
- change.addEdit(edit);
- }else{
- TextFileChange change = getChange(declarationFile);
- TextEdit edit = new ReplaceEdit(location.getStartPosition(), location.getLength(), newName);
- change.addEdit(edit);
- }
- }
+ if(location != null)
+ changeXMLNode(location, declarationFile);
}
}
- private void changeAnnotation(IFile file, IAnnotation annotation){
- try{
- String annotationText = annotation.getSource();
- //String annotationText = "@In(\""+newName+"\")";
- int open = annotationText.indexOf("(");
- if(open >= 0){
- annotationText = annotationText.substring(0, open) + "(\""+newName+"\")";
- }else
- annotationText += "(\""+newName+"\")";
-
- TextEdit edit = new ReplaceEdit(annotation.getSourceRange().getOffset(), annotation.getSourceRange().getLength(), annotationText);
- TextFileChange change = getChange(file);
- change.addEdit(edit);
- }catch(JavaModelException ex){
- SeamCorePlugin.getDefault().logError(ex);
- }
- }
-
- private String getFieldName(String methodName){
- if(methodName.startsWith("is") || methodName.startsWith("get") || methodName.startsWith("set")){
- if(methodName.startsWith("is"))
- return methodName.substring(2,3).toLowerCase()+methodName.substring(3);
- else
- return methodName.substring(3,4).toLowerCase()+methodName.substring(4);
- }else
- return "";
- }
-
private void scanJava(IFile file, String content){
try {
FastJavaPartitionScanner scaner = new FastJavaPartitionScanner();
@@ -440,8 +232,6 @@
IDOMModel domModel = (IDOMModel) model;
IDOMDocument document = domModel.getDocument();
scanChildNodes(file, document);
- //if(file.getName().equals(COMPONENTS_FILE))
- // scanChildComponent(file, document);
}
} catch (CoreException e) {
SeamCorePlugin.getDefault().logError(e);
@@ -454,34 +244,6 @@
}
}
- private void scanChildComponent(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()
- && (curentValidatedNode.getNodeName().equals(COMPONENT_NODE)
- || curentValidatedNode.getNodeName().equals(FACTORY_NODE))) {
- scanComponentNode(file, curentValidatedNode);
- }
- scanChildComponent(file, curentValidatedNode);
- }
- }
-
- private void scanComponentNode(IFile file, Node node) {
- Node nameNode = node.getAttributes().getNamedItem(NAME_ATTRIBUTE);
- if(nameNode != null){
- if(nameNode.getNodeValue().equals(component.getName())){
- IStructuredDocumentRegion region = ((IDOMNode)node).getFirstStructuredDocumentRegion();
- TextFileChange change = getChange(file);
-
-
- TextEdit edit = new ReplaceEdit(region.getStartOffset(), region.getLength(), region.getFullText().replace(component.getName(), newName));
- change.addEdit(edit);
- }
- }
-
- }
-
private void scanChildNodes(IFile file, Node parent) {
NodeList children = parent.getChildNodes();
for(int i=0; i<children.getLength(); i++) {
@@ -645,7 +407,7 @@
findDeclarations();
- //findAnnotations();
+ findAnnotations();
findELReferences();
@@ -659,50 +421,84 @@
Set<IBijectedAttribute> inSet = seamProject.getBijectedAttributesByName(component.getName(), BijectedAttributeType.IN);
for(IBijectedAttribute inAtt : inSet){
- System.out.println("@In - "+inAtt.getValue());
-
- String content = null;
- try {
- content = FileUtil.readStream(((IFile)inAtt.getResource()).getContents());
- } catch (CoreException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- return;
- }
-
- ISeamTextSourceReference location = inAtt.getLocationFor(ISeamXmlComponentDeclaration.NAME);
- if(location != null){
- String text = content.substring(location.getStartPosition(), location.getStartPosition()+location.getLength());
- System.out.println("Text - "+text);
- TextFileChange change = getChange((IFile)inAtt.getResource());
- TextEdit edit = new ReplaceEdit(location.getStartPosition(), location.getLength(), "\""+newName+"\"");
- change.addEdit(edit);
- }
+ ISeamTextSourceReference location = inAtt.getLocationFor(SeamAnnotations.IN_ANNOTATION_TYPE);
+ if(location != null)
+ changeAnnotation(location, (IFile)inAtt.getResource());
}
// find @Factory annotations
-
Set<ISeamFactory> factorySet = seamProject.getFactoriesByName(component.getName());
for(ISeamFactory factory : factorySet){
- System.out.println("@Factory - "+factory.getName());
-
- String content = null;
- try {
- content = FileUtil.readStream(((IFile)factory.getResource()).getContents());
- } catch (CoreException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- return;
+ ISeamTextSourceReference location = factory.getLocationFor(SeamAnnotations.FACTORY_ANNOTATION_TYPE);
+ if(location != null){
+ IFile file = (IFile)factory.getResource();
+
+ if(file.getFileExtension().equalsIgnoreCase(XML_EXT))
+ changeXMLNode(location, file);
+ else
+ changeAnnotation(location, file);
}
+ }
+ }
+
+ private void changeXMLNode(ISeamTextSourceReference location, IFile file){
+ String content = null;
+ try {
+ content = FileUtil.readStream(file.getContents());
+ } catch (CoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ return;
+ }
+
+ TextFileChange change = getChange(file);
+
+ String text = content.substring(location.getStartPosition(), location.getStartPosition()+location.getLength());
+ if(text.startsWith("<")){
+ int position = text.lastIndexOf("/>");
+ if(position < 0){
+ position = text.lastIndexOf(">");
+ }
- ISeamTextSourceReference location = factory.getLocationFor(ISeamXmlComponentDeclaration.NAME);
- if(location != null){
- String text = content.substring(location.getStartPosition(), location.getStartPosition()+location.getLength());
- System.out.println("Text - "+text);
- TextFileChange change = getChange((IFile)factory.getResource());
- TextEdit edit = new ReplaceEdit(location.getStartPosition(), location.getLength(), "\""+newName+"\"");
+ TextEdit edit = new ReplaceEdit(location.getStartPosition()+position, 0, " name=\""+newName+"\"");
+ change.addEdit(edit);
+ }else{
+ TextEdit edit = new ReplaceEdit(location.getStartPosition(), location.getLength(), newName);
+ change.addEdit(edit);
+ }
+ }
+
+ private void changeAnnotation(ISeamTextSourceReference location, IFile file){
+ String content = null;
+ try {
+ content = FileUtil.readStream(file.getContents());
+ } catch (CoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ return;
+ }
+
+ TextFileChange change = getChange(file);
+
+ String text = content.substring(location.getStartPosition(), location.getStartPosition()+location.getLength());
+ int openBracket = text.indexOf("(");
+ if(openBracket > 0){
+ int openQuote = text.indexOf("\"", openBracket);
+ if(openQuote > 0){
+ String newText = text.replace(component.getName(), newName);
+ TextEdit edit = new ReplaceEdit(location.getStartPosition(), location.getLength(), newText);
change.addEdit(edit);
+ }else{
+ String newText = "\""+newName+"\"";
+ TextEdit edit = new ReplaceEdit(location.getStartPosition()+openBracket+1, 0, newText);
+ change.addEdit(edit);
}
+ }else{
+ String newText = "(\""+newName+"\")";
+ TextEdit edit = new ReplaceEdit(location.getStartPosition()+location.getLength(), 0, newText);
+ change.addEdit(edit);
}
+
+
}
/*
15 years, 11 months
JBoss Tools SVN: r14977 - in trunk/documentation/guides/GettingStartedGuide/en: modules and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: chukhutsina
Date: 2009-04-30 09:08:52 -0400 (Thu, 30 Apr 2009)
New Revision: 14977
Modified:
trunk/documentation/guides/GettingStartedGuide/en/images/first_seam/first_seam10.png
trunk/documentation/guides/GettingStartedGuide/en/modules/jsp_application.xml
trunk/documentation/guides/GettingStartedGuide/en/modules/rad_jsf_application.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-652 - Code patterns in text .All the code patterns were marked with the tag <code>.The incorrect picture was modified.
Modified: trunk/documentation/guides/GettingStartedGuide/en/images/first_seam/first_seam10.png
===================================================================
(Binary files differ)
Modified: trunk/documentation/guides/GettingStartedGuide/en/modules/jsp_application.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en/modules/jsp_application.xml 2009-04-30 12:32:19 UTC (rev 14976)
+++ trunk/documentation/guides/GettingStartedGuide/en/modules/jsp_application.xml 2009-04-30 13:08:52 UTC (rev 14977)
@@ -9,16 +9,16 @@
</keywordset>
</chapterinfo>
<title>Developing a simple JSP web application</title>
-
+
<note>
<title>Note:</title>
<para>We highly recommend developing in <property>Seam</property>. This chapter is for users
who for some reason cannot use Seam.</para>
</note>
-
+
<para>In this chapter you'll find out how to create a simple <ulink
- url="http://java.sun.com/products/jsp/">JSP</ulink> application using the
- <property>JBoss Developer Studio</property>. The application will show a classic
+ url="http://java.sun.com/products/jsp/">JSP</ulink> application using the
+ <property>JBoss Developer Studio</property>. The application will show a classic
"Hello World!" on the page.</para>
<para>We'll assume that you have already launched <property>JBoss Developer
Studio</property> and also that the <property>Web Development</property> perspective is the
@@ -28,7 +28,7 @@
<property>Window > Open Perspective > Other...</property>
</emphasis> from the menu bar and then selecting Web Development from the Select Perspective
dialog box.</para>
-
+
<section id="SettingUpTheProject">
<?dbhtml filename="SettingUpTheProject.html"?>
<title>Setting Up the Project</title>
@@ -38,18 +38,18 @@
<itemizedlist>
<listitem>
<para>Go to the menu bar and select <emphasis>
- <property>File > New > Other...</property>
- </emphasis></para>
+ <property>File > New > Other...</property>
+ </emphasis></para>
</listitem>
<listitem>
<para>Select <emphasis>
- <property>Web > Dynamic Web Project</property>
- </emphasis> in the New Project dialog box</para>
+ <property>Web > Dynamic Web Project</property>
+ </emphasis> in the New Project dialog box</para>
</listitem>
<listitem>
<para>Click <emphasis>
- <property>Next</property>
- </emphasis>
+ <property>Next</property>
+ </emphasis>
</para>
</listitem>
<listitem>
@@ -57,10 +57,10 @@
</listitem>
<listitem>
<para>Then select <emphasis>
- <property>Minimal Configuration</property>
- </emphasis> from the list of possible configurations and click <emphasis>
- <property>Finish</property>
- </emphasis></para>
+ <property>Minimal Configuration</property>
+ </emphasis> from the list of possible configurations and click <emphasis>
+ <property>Finish</property>
+ </emphasis></para>
</listitem>
</itemizedlist>
<figure>
@@ -71,10 +71,10 @@
</imageobject>
</mediaobject>
</figure>
-
+
<para>The <emphasis>
- <property>jspHello</property>
- </emphasis> node should appear in the upper-left <property>Package Explorer</property>
+ <property>jspHello</property>
+ </emphasis> node should appear in the upper-left <property>Package Explorer</property>
view.</para>
<figure>
<title>New Web Project</title>
@@ -85,32 +85,32 @@
</mediaobject>
</figure>
</section>
-
+
<section id="CreatingJSPPage">
<?dbhtml filename="CreatingJSPPage.html"?>
<title>Creating JSP Page</title>
<para>This section covers all the points how to create, edit and then preview JSP page.</para>
<para>In our simple application we need to create only one JSP page which displays a
- <emphasis>"Hello World!"</emphasis> message.</para>
+ <emphasis>"Hello World!"</emphasis> message.</para>
<itemizedlist>
<listitem>
<para>Right click <emphasis><property>WebContent > New >
- JSP</property>. </emphasis></para>
+ JSP</property>. </emphasis></para>
</listitem>
<listitem>
<para>Type "hello.jsp" for a file name and click the <emphasis>
- <property>Next</property>
- </emphasis> button.</para>
+ <property>Next</property>
+ </emphasis> button.</para>
</listitem>
</itemizedlist>
<para>In the next window you can choose a template for your jsp page and see its preview.</para>
<itemizedlist>
<listitem>
<para>Select <emphasis>
- <property>New JSP File (xhtml)</property>
- </emphasis> template and click <emphasis>
- <property>Finish</property>
- </emphasis> button.</para>
+ <property>New JSP File (xhtml)</property>
+ </emphasis> template and click <emphasis>
+ <property>Finish</property>
+ </emphasis> button.</para>
</listitem>
</itemizedlist>
<figure>
@@ -128,19 +128,26 @@
<?dbhtml filename="EditingJSPPage.html"?>
<title>Editing a JSP Page</title>
<para>Let's now make a little change so that a jsp page displays
- <emphasis>"Hello World!"</emphasis> message.</para>
+ <emphasis>"Hello World!"</emphasis> message.</para>
<itemizedlist>
<listitem>
- <para>Insert this line inside the <emphasis role="bold">
- <property><body></property>
+ <!--<para>Insert this line inside the <emphasis role="bold">
+ <property><body></property>
</emphasis><emphasis role="bold">
- <property></body></property>
- </emphasis> tag: </para>
+ <property></body></property>
+ </emphasis> tag: </para>-->
+ <para>
+
+ Insert this line inside the
+ <code><body> </body>
+ </code>
+ tag:
+ </para>
</listitem>
</itemizedlist>
<programlisting role="XML"><![CDATA[<% System.out.println("Hello World!"); %>]]>
-</programlisting>
-
+ </programlisting>
+
<para>Notice that content assist functionality is always available when you are typing:</para>
<figure>
<title>Content Assist in JSP Page</title>
@@ -151,8 +158,8 @@
</mediaobject>
</figure>
<para>After changes made your <emphasis>
- <property>hello.jsp</property>
- </emphasis> page should look like this:</para>
+ <property>hello.jsp</property>
+ </emphasis> page should look like this:</para>
<figure>
<title>Hello.jsp Page</title>
<mediaobject>
@@ -161,21 +168,21 @@
</imageobject>
</mediaobject>
</figure>
-
+
<para>This line will actually output <emphasis>"Hello
World!"</emphasis> message in the <property>Console</property>. To make the
message displayed in the Browser, just replace this line with the simple
- <emphasis>Hello World!</emphasis>.</para>
+ <emphasis>Hello World!</emphasis>.</para>
</section>
-
+
<section id="WebXML">
<?dbhtml filename="WebXML.html"?>
<title>web.xml file</title>
<para>When you are creating web project the wizard creates the <emphasis>
- <property>web.xml</property>
- </emphasis> for you automatically. The <property>web.xml file editor</property>
+ <property>web.xml</property>
+ </emphasis> for you automatically. The <property>web.xml file editor</property>
provided by <property>JBoss Developer Studio</property> is available in two modes:
- <property>Tree</property> and <property>Source</property>.</para>
+ <property>Tree</property> and <property>Source</property>.</para>
<figure>
<title>Web.xml in Design and Source Mode</title>
<mediaobject>
@@ -186,18 +193,18 @@
</mediaobject>
</figure>
<para>Both modes are fully synchronized. Let's add mapping to our <emphasis>
- <property>hello.jsp</property>
- </emphasis> page in <emphasis>
- <property>web.xml</property>
- </emphasis> file.</para>
+ <property>hello.jsp</property>
+ </emphasis> page in <emphasis>
+ <property>web.xml</property>
+ </emphasis> file.</para>
<itemizedlist>
<listitem>
<para>Switch to <property>Source</property> tab.</para>
</listitem>
<listitem>
- <para>Add the next code into <emphasis role="bold">
- <property><welcome-file-list></property>
- </emphasis>:</para>
+ <para>Add the next code into
+ <code><welcome-file-list></code>
+ :</para>
</listitem>
</itemizedlist>
<programlisting role="XML"><![CDATA[<welcome-file>hello.jsp</welcome-file>
@@ -206,29 +213,29 @@
made are automatically reflected in that mode.</para>
<para>Actually you don't really need to do any configurations right now.</para>
</section>
-
+
<section id="DeployTheProject">
<?dbhtml filename="DeployTheProject.html"?>
<title>Deploying the project</title>
<para>While creating any web project you could experience a pain writing ant scripts and
managing the packaging even when writing the most trivial web applications. With
- <property>JBoss Developer Studio</property> you are saved from such a pain. All
+ <property>JBoss Developer Studio</property> you are saved from such a pain. All
you need is to start <property>JBoss Server</property> and launch your application
in your favorite browser.</para>
<para>You can also create a war archive with <ulink
- url="&aslink;#Project_archivesView">JBDS's Archive Tools</ulink>
+ url="&aslink;#Project_archivesView">JBDS's Archive Tools</ulink>
and export it to any web server.</para>
<section id="WarConfig">
<?dbhtml filename="WarConfig.html"?>
<title>WAR Config</title>
<para>Project archives managing is available through <ulink
- url="&aslink;#Project_archivesView">Project Archives view</ulink>.</para>
+ url="&aslink;#Project_archivesView">Project Archives view</ulink>.</para>
<itemizedlist>
<listitem>
<para>Select <emphasis>
- <property>Window > Show view > Other > JBoss
- Tools > Project archives</property>
- </emphasis> from menu bar</para>
+ <property>Window > Show view > Other > JBoss
+ Tools > Project archives</property>
+ </emphasis> from menu bar</para>
</listitem>
<listitem>
<para>Select a project in Package Explorer you want to be archived</para>
@@ -247,8 +254,8 @@
<itemizedlist>
<listitem>
<para>Click, for example, <emphasis>
- <property>WAR</property>
- </emphasis> option to create war archive</para>
+ <property>WAR</property>
+ </emphasis> option to create war archive</para>
</listitem>
</itemizedlist>
<para>In the <property>New WAR</property> dialog you can see automatically selected
@@ -264,24 +271,24 @@
<itemizedlist>
<listitem>
<para>Click <emphasis>
- <property>Next</property>
- </emphasis> to see a stub archive configuration for your project: <figure>
- <title>Stub Archive Configuration</title>
- <mediaobject>
- <imageobject>
- <imagedata
- fileref="images/jsp_application/jsp_application_10.png"
- />
- </imageobject>
- </mediaobject>
- </figure>
+ <property>Next</property>
+ </emphasis> to see a stub archive configuration for your project: <figure>
+ <title>Stub Archive Configuration</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata
+ fileref="images/jsp_application/jsp_application_10.png"
+ />
+ </imageobject>
+ </mediaobject>
+ </figure>
</para>
</listitem>
<listitem>
<para>Click <emphasis>
- <property>Finish</property>. </emphasis> The
+ <property>Finish</property>. </emphasis> The
<emphasis>.war</emphasis> file will appear in <property>Package
- Explorer</property> and also in <property>Project Archives</property>
+ Explorer</property> and also in <property>Project Archives</property>
view as structure tree: <figure>
<title>Archive is Created</title>
<mediaobject>
@@ -316,19 +323,19 @@
</mediaobject>
</figure>
</section>
-
+
<section id="AutoRedeploy">
<?dbhtml filename="AutoRedeploy.html"?>
<title>Auto redeploy</title>
<para>When you are creating a web application and register it on <property>JBoss
- Server</property> it is automatically deployed into
+ Server</property> it is automatically deployed into
<emphasis>/deploy</emphasis> directory of the server. JBDS comes with the
feature of auto-redeploy. It means that you don't need to restart
- <property>JBoss Server</property>. Any changes made in the application in
+ <property>JBoss Server</property>. Any changes made in the application in
exploded format will trigger a redeployment on the server.</para>
</section>
</section>
-
+
<section id="Previewtab">
<?dbhtml filename="Previewtab.html"?>
<title>JSP Page Preview</title>
@@ -339,8 +346,8 @@
<itemizedlist>
<listitem>
<para>Make a little change to <emphasis>
- <property>hello.jsp</property>
- </emphasis> page, e.g. put this code snippet:</para>
+ <property>hello.jsp</property>
+ </emphasis> page, e.g. put this code snippet:</para>
</listitem>
</itemizedlist>
<programlisting role="XML"><![CDATA[<%= new java.util.Date() %>
@@ -348,8 +355,8 @@
<itemizedlist>
<listitem>
<para>Click <emphasis>
- <property>Save</property>
- </emphasis> button.</para>
+ <property>Save</property>
+ </emphasis> button.</para>
</listitem>
<listitem>
<para>Switch to Preview page by clicking <property>Preview</property> tab at the
@@ -357,20 +364,20 @@
</listitem>
</itemizedlist>
<!-- <figure>
- <title>Preview Page</title>
- <mediaobject>
+ <title>Preview Page</title>
+ <mediaobject>
<imageobject>
- <imagedata fileref="images/jsp_application/jsp_application_14.png"/>
+ <imagedata fileref="images/jsp_application/jsp_application_14.png"/>
</imageobject>
- </mediaobject>
- </figure>
--->
+ </mediaobject>
+ </figure>
+ -->
</section>
<section id="LaunchingTheProject">
<?dbhtml filename="LaunchingTheProject.html"?>
<title>Launch JSP Project</title>
<para>Let's now launch our project on server. We'll use
- <property>JBoss Server</property> that is shipped with <property>JBoss Developer
+ <property>JBoss Server</property> that is shipped with <property>JBoss Developer
Studio</property>. You can do it by performing one of the following actions:</para>
<itemizedlist>
<listitem>
@@ -383,11 +390,11 @@
</inlinemediaobject> ) .</para>
</listitem>
</itemizedlist>
-
+
<itemizedlist>
<listitem>
<para>Click the Run icon or right click your project folder and select <emphasis>
- <property>Run As > Run on Server</property>. </emphasis> If you
+ <property>Run As > Run on Server</property>. </emphasis> If you
haven't made any changes in <emphasis>
<property>web.xml</property>
</emphasis> file or cleared it out you can launch the application by right
@@ -396,9 +403,9 @@
</emphasis> page and selecting <emphasis>
<property>Run on the Server</property> </emphasis>(
<inlinemediaobject>
- <imageobject>
- <imagedata fileref="images/jsp_application/jsp_application_16.png"/>
- </imageobject>
+ <imageobject>
+ <imagedata fileref="images/jsp_application/jsp_application_16.png"/>
+ </imageobject>
</inlinemediaobject> ).</para>
</listitem>
</itemizedlist>
@@ -418,6 +425,6 @@
shipped with <property>JBDS</property>.
</para>
</section>
-
- </section>
+
+ </section>
</chapter>
Modified: trunk/documentation/guides/GettingStartedGuide/en/modules/rad_jsf_application.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en/modules/rad_jsf_application.xml 2009-04-30 12:32:19 UTC (rev 14976)
+++ trunk/documentation/guides/GettingStartedGuide/en/modules/rad_jsf_application.xml 2009-04-30 13:08:52 UTC (rev 14977)
@@ -571,25 +571,24 @@
<para>The Visual Page Editor will open in a screen split between source code along the
top and a WYSIWIG view along the bottom. You can see that some JSF code will be
already generated as we choose a template when creating the page.</para>
- <para>At the beginning it's necessary to create a <emphasis role="bold">
- <property><h:form></property>
- </emphasis> component where all others components are put.</para>
+ <para>At the beginning it's necessary to create a
+ <code><h:form></code>
+ component where all others components are put.</para>
<itemizedlist>
<listitem>
- <para>Place the mouse cursor inside <emphasis role="bold">
- <property><f:view></property>
- </emphasis><emphasis role="bold">
- <property></f:view></property>
- </emphasis></para>
+ <para>Place the mouse cursor inside
+ <code><f:view>
+ </f:view></code>
+ </para>
</listitem>
<listitem>
<para>Go to JBoss Tools Palette and expand JSF HTML folder by selecting
it</para>
</listitem>
<listitem>
- <para>Click on <emphasis role="bold">
- <property><h:form></property>
- </emphasis> tag <figure>
+ <para>Click on
+ <code><h:form></code>
+ tag <figure>
<title>Insert h:form</title>
<mediaobject>
<imageobject>
@@ -720,11 +719,11 @@
</figure>
<itemizedlist>
<listitem>
- <para>Switch to Source mode and insert <emphasis role="bold">
- <property><br/></property>
- </emphasis> tag after <emphasis role="bold">
- <property><h:outputText></property>
- </emphasis> component to make a new line.</para>
+ <para>Switch to Source mode and insert
+ <code><br/></code>
+ tag after
+ <code><h:outputText></code>
+ component to make a new line.</para>
</listitem>
<listitem>
<para>Click <emphasis>
@@ -737,11 +736,11 @@
editor, and drop it inside the editor after the text.</para>
</listitem>
<listitem>
- <para>Switch to a Source mode and insert <emphasis role="bold">
- <property><br/></property>
- </emphasis> tag after <emphasis role="bold">
- <property><h:outputText></property>
- </emphasis> component to make a new line</para>
+ <para>Switch to a Source mode and insert
+ <code><br/></code>
+ tag after
+ <code><h:outputText></code>
+ component to make a new line</para>
</listitem>
<listitem>
<para>Click <emphasis>
@@ -826,9 +825,9 @@
<para>Go to Source mode</para>
</listitem>
<listitem>
- <para>Add the validation attribute to <emphasis role="bold">
- <property><f:validateLongRange></property>
- </emphasis> for user input validation</para>
+ <para>Add the validation attribute to
+ <code><f:validateLongRange></code>
+ for user input validation</para>
</listitem>
</itemizedlist>
<programlisting role="XML"><![CDATA[<h:inputText id="userNumber" value="#{NumberBean.userNumber}" required="true">
@@ -890,15 +889,13 @@
</emphasis></para>
</listitem>
<listitem>
- <para>In Source mode add <emphasis role="bold">
- <property><br/></property>
- </emphasis> tags between <emphasis role="bold">
- <property><outputText></property>
- </emphasis>, <emphasis role="bold">
- <property><inputText></property>
- </emphasis> and <emphasis role="bold">
- <property><commandButton></property>
- </emphasis> components to place them on different lines</para>
+ <para>In Source mode add
+ <code><br/></code>
+ tags between
+ <code><outputText></code>
+ , <code><inputText></code>
+ and <code><commandButton></code>
+ components to place them on different lines</para>
</listitem>
</itemizedlist>
<para>inputnumber.jsp page should look like this:</para>
@@ -957,13 +954,11 @@
</mediaobject>
</figure>
<para>This page, success.jsp, is shown if you correctly guessed the number. The
- <emphasis role="bold">
- <property><h:outputFormat></property>
- </emphasis> tag will get the value of success_text from the properties file. The {0}
+ <code><h:outputFormat></code>
+ tag will get the value of success_text from the properties file. The {0}
in success_text will be substituted for by the value of the value attribute within
- the <emphasis role="bold">
- <property><f:param></property>
- </emphasis> tag during runtime.</para>
+ the <code><f:param></code>
+ tag during runtime.</para>
<para>At the end, you have a button which allows you to replay the game. The action
value references a backing bean method. In this case, the method only terminates the
current session so that when you are shown the first page, the input text box is
15 years, 11 months
JBoss Tools SVN: r14976 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-04-30 08:32:19 -0400 (Thu, 30 Apr 2009)
New Revision: 14976
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-1077
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2009-04-30 11:46:26 UTC (rev 14975)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/java/ComponentBuilder.java 2009-04-30 12:32:19 UTC (rev 14976)
@@ -124,7 +124,7 @@
ValueInfo factoryName = ValueInfo.getValueInfo(a, null);
if(factoryName == null) {
factoryName = new ValueInfo();
- factoryName.value = toPropertyName(m.getName().getIdentifier());
+ factoryName.value = toPropertyName(m.getName().getIdentifier(), "get");
factoryName.valueLength = m.getName().getLength();
factoryName.valueStartPosition = m.getName().getStartPosition();
}
@@ -153,12 +153,12 @@
}
}
- private String toPropertyName(String methodName) {
+ private String toPropertyName(String methodName, String prefix) {
if(methodName == null) {
return methodName;
}
- if(methodName.startsWith("get") && methodName.length() > 3) {
- String root = methodName.substring(3);
+ if(methodName.startsWith(prefix) && methodName.length() > prefix.length()) {
+ String root = methodName.substring(prefix.length());
return root.substring(0, 1).toLowerCase() + root.substring(1);
}
return methodName;
@@ -195,6 +195,9 @@
name.valueStartPosition = m.getStartPosition();
name.valueLength = m.getLength();
name.value = m.getName().getIdentifier();
+ if(in != null) {
+ name.value = toPropertyName(name.value, "set");
+ }
}
att.setName(name);
15 years, 11 months