JBoss Tools SVN: r8451 - in trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages: impl and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-05-30 06:01:34 -0400 (Fri, 30 May 2008)
New Revision: 8451
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesElement.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesModel.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PageImpl.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesElementImpl.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesModelImpl.java
Log:
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesElement.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesElement.java 2008-05-30 07:55:54 UTC (rev 8450)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesElement.java 2008-05-30 10:01:34 UTC (rev 8451)
@@ -113,4 +113,9 @@
void setData(Object value);
public void dataChanged();
+
+ public PagesModel getPagesModel();
+
+ public void childAdded(Object childData);
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesModel.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesModel.java 2008-05-30 07:55:54 UTC (rev 8450)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesModel.java 2008-05-30 10:01:34 UTC (rev 8451)
@@ -12,6 +12,12 @@
public PagesElement findElement(Object data);
+ public void bindElement(Object data, PagesElement element);
+
+ public Link findLink(Object data);
+
+ public void bindLink(Object data, Link link);
+
public void load();
public void dispose();
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PageImpl.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PageImpl.java 2008-05-30 07:55:54 UTC (rev 8450)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PageImpl.java 2008-05-30 10:01:34 UTC (rev 8451)
@@ -188,4 +188,5 @@
}
}
+
} //PageImpl
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesElementImpl.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesElementImpl.java 2008-05-30 07:55:54 UTC (rev 8450)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesElementImpl.java 2008-05-30 10:01:34 UTC (rev 8451)
@@ -26,8 +26,12 @@
import org.eclipse.emf.ecore.util.InternalEList;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.seam.pages.xml.model.SeamPagesConstants;
+import org.jboss.tools.seam.pages.xml.model.helpers.SeamPagesProcessStructureHelper;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Link;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesElement;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesFactory;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesModel;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesPackage;
/**
@@ -573,6 +577,15 @@
* <!-- end-user-doc -->
* @generated NOT
*/
+ public PagesModel getPagesModel() {
+ return parent == null ? null : parent.getPagesModel();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
public void dataChanged() {
}
@@ -582,6 +595,41 @@
* <!-- end-user-doc -->
* @generated NOT
*/
+ public void childAdded(Object childData) {
+ PagesModel pagesModel = getPagesModel();
+ if(pagesModel == null) return;
+
+ if(childData instanceof XModelObject) {
+ SeamPagesProcessStructureHelper h = SeamPagesProcessStructureHelper.getInstance();
+ XModelObject object = (XModelObject)childData;
+ if(object.getModelEntity().getName().equals(SeamPagesConstants.ENT_PROCESS_ITEM_OUTPUT)) {
+ PagesElement from = this; //pagesModel.findElement(object);
+ XModelObject t = h.getItemOutputTarget(object);
+ if(t == null) {
+ //report
+ return;
+ }
+ PagesElement to = pagesModel.findElement(t);
+ if(to == null) {
+ //TODO report failure
+ return;
+ }
+ Link link = PagesFactory.eINSTANCE.createLink();
+ pagesModel.bindLink(childData, link);
+ link.setFromElement(from);
+ link.setToElement(to);
+ link.setName(h.getItemOutputPresentation(object));
+ link.setShortcut(h.isShortcut(object));
+ }
+ }
+
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
protected XModelObject getModelObject() {
if(data instanceof XModelObject) {
return (XModelObject)data;
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesModelImpl.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesModelImpl.java 2008-05-30 07:55:54 UTC (rev 8450)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesModelImpl.java 2008-05-30 10:01:34 UTC (rev 8451)
@@ -7,6 +7,7 @@
package org.jboss.tools.seam.ui.pages.editor.ecore.pages.impl;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
import org.eclipse.draw2d.geometry.Dimension;
@@ -57,6 +58,13 @@
* <!-- end-user-doc -->
* @generated NOT
*/
+ Map<String, Link> linksByPath = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
XModelTreeListener modelListener = new ML();
/**
@@ -83,6 +91,15 @@
* <!-- end-user-doc -->
* @generated NOT
*/
+ public PagesModel getPagesModel() {
+ return this;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
public PagesElement findElement(Object data) {
if(data instanceof XModelObject) {
data = ((XModelObject)data).getPath();
@@ -99,6 +116,20 @@
* <!-- end-user-doc -->
* @generated NOT
*/
+ public void bindElement(Object data, PagesElement element) {
+ element.setData(data);
+ if(data instanceof XModelObject) {
+ addElement((XModelObject)data, element);
+ } else if(data != null) {
+ elementsByPath.put(data.toString(), element);
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
void addElement(XModelObject data, PagesElement element) {
elementsByPath.put(data.getPath(), element);
}
@@ -108,12 +139,62 @@
* <!-- end-user-doc -->
* @generated NOT
*/
+ public Link findLink(Object data) {
+ if(data instanceof XModelObject) {
+ data = ((XModelObject)data).getPath();
+ }
+ if(data instanceof String) {
+ Link result = linksByPath.get(data);
+ return result;
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public void bindLink(Object data, Link link) {
+ link.setData(data);
+ if(data instanceof XModelObject) {
+ linksByPath.put(((XModelObject)data).getPath(), link);
+ } else if(data != null) {
+ linksByPath.put(data.toString(), link);
+ }
+ }
+
+ void unbind(String path) {
+ Iterator<String> it = elementsByPath.keySet().iterator();
+ while(it.hasNext()) {
+ String p = it.next();
+ if(p.equals(path) || p.startsWith(path + "/")) {
+ it.remove();
+ }
+ }
+ it = linksByPath.keySet().iterator();
+ while(it.hasNext()) {
+ String p = it.next();
+ if(p.equals(path) || path.startsWith(p + "/")) {
+ it.remove();
+ }
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
public void load() {
XModelObject installedProcess = (XModelObject)getData();
if(installedProcess == null) return;
elementsByPath = new HashMap<String, PagesElement>();
+ linksByPath = new HashMap<String, Link>();
+
addElement(installedProcess, this);
+
XModelObject[] is = h.getItems(installedProcess);
for (int i = 0; i < is.length; i++) {
addItem(is[i]);
@@ -126,25 +207,46 @@
installedProcess.getModel().addModelTreeListener(modelListener);
}
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public void childAdded(Object childData) {
+ if(childData instanceof XModelObject) {
+ XModelObject added = (XModelObject)childData;
+ addItem(added);
+ addItemLinks(added);
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
private void addItem(XModelObject item) {
String type = item.getAttributeValue(SeamPagesConstants.ATTR_TYPE);
if(SeamPagesConstants.TYPE_PAGE.equals(type)) {
Page page = PagesFactory.eINSTANCE.createPage();
- page.setData(item);
+ bindElement(item, page);
page.dataChanged();
- addElement(item, page);
getChildren().add(page);
} else if(SeamPagesConstants.TYPE_EXCEPTION.equals(type)) {
PgException exc = PagesFactory.eINSTANCE.createPgException();
- exc.setData(item);
+ bindElement(item, exc);
exc.dataChanged();
- addElement(item, exc);
getChildren().add(exc);
} else {
//TODO
}
}
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
private void addItemLinks(XModelObject item) {
String type = item.getAttributeValue(SeamPagesConstants.ATTR_TYPE);
if(SeamPagesConstants.TYPE_PAGE.equals(type)
@@ -156,22 +258,7 @@
}
XModelObject[] os = h.getOutputs(item);
for (int j = 0; j < os.length; j++) {
- XModelObject t = h.getItemOutputTarget(os[j]);
- if(t == null) {
- //TODO report failure
- return;
- }
- PagesElement to = findElement(t);
- if(to == null) {
- //TODO report failure
- return;
- }
- Link link = PagesFactory.eINSTANCE.createLink();
- link.setData(os[j]);
- link.setFromElement(from);
- link.setToElement(to);
- link.setName(h.getItemOutputPresentation(os[j]));
- link.setShortcut(h.isShortcut(os[j]));
+ from.childAdded(os[j]);
}
}
}
@@ -181,17 +268,6 @@
* <!-- end-user-doc -->
* @generated NOT
*/
- public void update() {
- XModelObject installedProcess = (XModelObject)getData();
- if(installedProcess == null) return;
-
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated NOT
- */
public void dispose() {
XModelObject installedProcess = (XModelObject)getData();
if(installedProcess == null) return;
@@ -238,17 +314,16 @@
if(event.kind() == XModelTreeEvent.CHILD_ADDED) {
XModelObject added = (XModelObject)event.getInfo();
if(target == installedProcess) {
- addItem(added);
- addItemLinks(added);
+ childAdded(added);
} else {
PagesElement item = findElement(target);
- //TODO
+ item.childAdded(added);
}
} else if(event.kind() == XModelTreeEvent.CHILD_REMOVED) {
if(target == installedProcess) {
PagesElement removed = findElement(event.getInfo());
if(removed != null) {
- elementsByPath.remove(event.getInfo());
+
Link[] ls = removed.getOutputLinks().toArray(new Link[0]);
for (int i = 0; i < ls.length; i++) {
ls[i].setFromElement(null);
@@ -261,11 +336,19 @@
}
getChildren().remove(removed);
}
- } else {
+ } else if(findElement(target) != null) {
+ Link removed = findLink(event.getInfo());
+ if(removed != null) {
+ removed.setToElement(null);
+ removed.setFromElement(null);
+ linksByPath.remove(event.getInfo());
+ }
}
+
+ unbind(event.getInfo().toString());
}
- update();
+
}
}
15 years, 11 months
JBoss Tools SVN: r8450 - in trunk/ws/plugins: org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2008-05-30 03:55:54 -0400 (Fri, 30 May 2008)
New Revision: 8450
Added:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ValidateWSImpl.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java
trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebServiceClient.java
Log:
JBIDE-2236: create a client sample to call web service
Added: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ClientSampleCreationCommand.java 2008-05-30 07:55:54 UTC (rev 8450)
@@ -0,0 +1,326 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ws.creation.core.commands;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.NormalAnnotation;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.jboss.tools.ws.core.utils.StatusUtils;
+import org.jboss.tools.ws.creation.core.data.ServiceModel;
+import org.jboss.tools.ws.creation.core.messages.JBossWSCreationCoreMessages;
+import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
+
+/**
+ * @author Grid Qian
+ *
+ * create a sample class to call web service according to wsdl
+ */
+public class ClientSampleCreationCommand extends AbstractDataModelOperation {
+
+ public static final String LINE_SEPARATOR = System
+ .getProperty("line.separator");
+ private static final String PACAKAGE = ".*";
+ private static final String PACAKAGESPLIT = "\\.";
+ private static final String SRC = "src";
+
+ private ServiceModel model;
+
+ public ClientSampleCreationCommand(ServiceModel model) {
+ this.model = model;
+ }
+
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ IStatus status = Status.OK_STATUS;
+ IJavaProject project = null;
+ try {
+ project = JBossWSCreationUtils.getJavaProjectByName(model
+ .getWebProjectName());
+ } catch (JavaModelException e) {
+ return StatusUtils.errorStatus(JBossWSCreationCoreMessages.ERROR_CREATECLIENTSAMPLE);
+ }
+
+ // find web service client classes
+ List<ICompilationUnit> clientUnits = findJavaUnitsByAnnotation(project,
+ JBossWSCreationCoreMessages.WEBSERVICEClient_ANNOTATION);
+
+ // find web service classes
+ List<ICompilationUnit> serviceUnits = findJavaUnitsByAnnotation(
+ project, JBossWSCreationCoreMessages.WEBSERVICE_ANNOTATION_CHECK);
+
+ // create a client sample class
+ ICompilationUnit clientCls = createJavaClass(model.getCustomPackage()
+ + JBossWSCreationCoreMessages.CLIENTSAMPLEPACKAGENAME,
+ JBossWSCreationCoreMessages.CLIENTSAMPLECLASSNAME, false, null,
+ project);
+ if(clientCls == null){
+ return StatusUtils.errorStatus(JBossWSCreationCoreMessages.ERROR_CREATECLIENTSAMPLE);
+ }
+
+ // add imports to client sample class
+ try {
+ clientCls.createImport(model.getCustomPackage() + PACAKAGE, null,
+ null);
+ clientCls.save(null, true);
+ } catch (Exception e1) {
+ return StatusUtils.errorStatus(JBossWSCreationCoreMessages.ERROR_CREATECLIENTSAMPLE);
+ }
+
+ // create main method
+ IType clientClsType = clientCls.findPrimaryType();
+
+ StringBuffer sb = new StringBuffer();
+ sb.append("public static void main(String[] args) {");
+ sb.append(LINE_SEPARATOR);
+ sb.append(" System.out.println(\"***********************\");");
+ sb.append(LINE_SEPARATOR);
+ createWebServiceClient(clientUnits, serviceUnits, sb);
+ sb.append(" System.out.println(\"***********************\");");
+ sb.append(LINE_SEPARATOR);
+ sb.append("}");
+ try {
+ clientClsType.createMethod(sb.toString(), null, true, null);
+ clientCls.save(null, true);
+ } catch (JavaModelException e) {
+ return StatusUtils.errorStatus(JBossWSCreationCoreMessages.ERROR_CREATECLIENTSAMPLE);
+ }
+
+ return status;
+ }
+
+ /**
+ * create a code block used to new a web service from a method of web
+ * service client
+ *
+ * @param serviceUnits
+ * @param method
+ * @param sb
+ * @param i
+ */
+ @SuppressWarnings("unchecked")
+ private void createWebService(List<ICompilationUnit> serviceUnits,MethodDeclaration method, StringBuffer sb,int i) {
+ sb.append(" System.out.println(\""
+ + "Create Web Service...\");");
+ sb.append(LINE_SEPARATOR);
+ sb.append(" "+method.getReturnType2().toString());
+ sb.append(" port").append(i).append(" = ");
+ sb.append("service").append(i).append(".");
+ sb.append(method.getName()).append("();");
+ sb.append(LINE_SEPARATOR);
+
+ for (ICompilationUnit unit : serviceUnits) {
+ // parse the unit
+ ASTParser parser = ASTParser.newParser(AST.JLS3);
+ parser.setSource(unit);
+ parser.setResolveBindings(false);
+ parser.setFocalPosition(0);
+ CompilationUnit result = (CompilationUnit) parser.createAST(null);
+ List types = result.types();
+ TypeDeclaration typeDec1 = (TypeDeclaration) types.get(0);
+ if(typeDec1.getName().toString().equals(method.getReturnType2().toString())){
+ callWebServiceOperation(typeDec1,sb,i);
+ }
+ }
+ }
+
+ /**
+ * create a code block to call web service operation
+ *
+ * @param typeDec
+ * @param sb
+ * @param i
+ */
+ private void callWebServiceOperation(TypeDeclaration typeDec,
+ StringBuffer sb, int i) {
+ sb.append(" System.out.println(\""
+ + "Create Web Service Operation...\");");
+ sb.append(LINE_SEPARATOR);
+
+ MethodDeclaration methodDec[] = typeDec.getMethods();
+
+ // call web serivce Operation
+ for (MethodDeclaration method : methodDec) {
+ sb.append(" System.out.println(\"Server said: \" + ");
+ sb.append("port").append(i).append(".");
+ sb.append(method.getName()).append("(");
+
+ for(int j=0;j<method.parameters().size();j++){
+ sb.append("args[").append(j).append("]");
+ if(j!=method.parameters().size()-1){
+ sb.append(",");
+ }
+ }
+ sb.append("));");
+ sb.append(LINE_SEPARATOR);
+ }
+ }
+
+ /**
+ * create a code block used to new a web service client
+ *
+ * @param clientUnits
+ * @param serviceUnits
+ * @param sb
+ */
+ @SuppressWarnings("unchecked")
+ private void createWebServiceClient(List<ICompilationUnit> clientUnits,
+ List<ICompilationUnit> serviceUnits, StringBuffer sb) {
+ int i = 1;
+ sb.append(" System.out.println(\""
+ + "Create Web Service Client...\");");
+ sb.append(LINE_SEPARATOR);
+ for (ICompilationUnit unit : clientUnits) {
+ // parse the unit
+ ASTParser parser = ASTParser.newParser(AST.JLS3);
+ parser.setSource(unit);
+ parser.setResolveBindings(false);
+ parser.setFocalPosition(0);
+ CompilationUnit result = (CompilationUnit) parser.createAST(null);
+ List types = result.types();
+ TypeDeclaration typeDec = (TypeDeclaration) types.get(0);
+
+ sb.append(" " + typeDec.getName());
+ sb.append(" service").append(i).append(" = new ");
+ sb.append(typeDec.getName());
+ sb.append("();");
+ sb.append(LINE_SEPARATOR);
+
+ MethodDeclaration methodDec[] = typeDec.getMethods();
+
+ // create web service from web serivce client methods
+ for (MethodDeclaration method : methodDec) {
+ if (method.modifiers().get(0) instanceof NormalAnnotation) {
+ NormalAnnotation anno = (NormalAnnotation) method
+ .modifiers().get(0);
+ if (anno.getTypeName().getFullyQualifiedName().equals(
+ JBossWSCreationCoreMessages.WEBENDPOINT)) {
+ createWebService(serviceUnits, method, sb, i);
+ }
+ }
+ }
+
+ }
+ }
+
+ /**
+ * find compilationunit by annotation
+ *
+ * @param project
+ * @param annotation
+ * @return
+ */
+ private List<ICompilationUnit> findJavaUnitsByAnnotation(
+ IJavaProject project, String annotation) {
+ List<ICompilationUnit> units = new LinkedList<ICompilationUnit>();
+ try {
+ ICompilationUnit[] javaFiles = project.findPackageFragment(
+ addPackagetoPath(project)).getCompilationUnits();
+ for (ICompilationUnit unit : javaFiles) {
+ if (unit.getSource().contains(annotation)) {
+ units.add(unit);
+ }
+ }
+ } catch (JavaModelException e) {
+ e.printStackTrace();
+ }
+ return units;
+ }
+
+ /**
+ * new a path by adding a java package
+ *
+ * @param project
+ * @return
+ */
+ private IPath addPackagetoPath(IJavaProject project) {
+ String packagename = model.getCustomPackage();
+ String[] names = packagename.split(PACAKAGESPLIT);
+ IPath path = project.getPath().append(SRC);
+ if (names != null && names.length > 0) {
+ for (String name : names) {
+ path = path.append(name);
+ }
+ }
+ return path;
+ }
+
+ /**
+ * create a java class
+ *
+ * @param packageName
+ * @param className
+ * @param isInterface
+ * @param interfaceName
+ * @param javaProject
+ * @return
+ */
+ public ICompilationUnit createJavaClass(String packageName,
+ String className, boolean isInterface, String interfaceName,
+ IJavaProject javaProject) {
+ try {
+ IPath srcPath = javaProject.getProject().getFolder(SRC)
+ .getFullPath();
+ IPackageFragmentRoot root = javaProject
+ .findPackageFragmentRoot(srcPath);
+ if (packageName == null) {
+ packageName = "";
+ }
+ IPackageFragment pkg = root.createPackageFragment(packageName,
+ false, null);
+ ICompilationUnit wrapperCls = pkg.createCompilationUnit(className
+ + ".java", "", true, null);
+ if (!packageName.equals("")) {
+ wrapperCls.createPackageDeclaration(packageName, null);
+ }
+
+ String clsContent = "";
+ if (isInterface) {
+ clsContent = "public interface " + className + " {"
+ + LINE_SEPARATOR;
+ clsContent += "}" + LINE_SEPARATOR;
+ } else {
+ clsContent = "public class " + className;
+ if (interfaceName != null) {
+ clsContent += " implements " + interfaceName;
+ }
+ clsContent += " {" + LINE_SEPARATOR;
+ clsContent += "}" + LINE_SEPARATOR;
+ }
+ wrapperCls.createType(clsContent, null, true, null);
+
+ wrapperCls.save(null, true);
+ return wrapperCls;
+ } catch (Exception e) {
+ return null;
+ }
+ }
+}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ValidateWSImpl.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ValidateWSImpl.java 2008-05-29 23:23:31 UTC (rev 8449)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ValidateWSImpl.java 2008-05-30 07:55:54 UTC (rev 8450)
@@ -47,7 +47,7 @@
if (JBossWSCreationUtils.getJavaProjectByName(project).findType(
implClass) != null) {
unit = JBossWSCreationUtils.getJavaProjectByName(project)
- .findType(implClass).getCompilationUnit();
+ .findType(implClass).getCompilationUnit();
} else {
return StatusUtils.errorStatus(NLS.bind(
JBossWSCreationCoreMessages.ERROR_NO_CLASS,
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties 2008-05-29 23:23:31 UTC (rev 8449)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties 2008-05-30 07:55:54 UTC (rev 8450)
@@ -12,7 +12,13 @@
SEPARATOR_JAVA=/
ERROR_IMPLEMENTATION_CODE_GENERATION=Exception occurred while generating implementation class
-ERROR_NO_ANNOTATION=This class has no required Annotation!
+ERROR_NO_ANNOTATION=This class has no required JAXWS Annotation!
+WEBSERVICE_ANNOTATION_CHECK=@WebService(
WEBSERVICE_ANNOTATION=@WebService
ERROR_NO_CLASS= The class '{0}' cannot be loaded via project {1}.Check that the project contains the class, or that the class is loadable according to the Java Build Path of the project.
ERROR_WS_LOCATION=The JBoss WS Runtime Location is NULL. Please set the location on JBoss WS preferences page.
+WEBSERVICEClient_ANNOTATION=@WebServiceClient
+CLIENTSAMPLEPACKAGENAME=.clientsample
+CLIENTSAMPLECLASSNAME=ClientSample
+ERROR_CREATECLIENTSAMPLE=When create a client sample, a error comes up. Please check the generated files.
+WEBENDPOINT=WebEndpoint
\ No newline at end of file
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java 2008-05-29 23:23:31 UTC (rev 8449)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCoreMessages.java 2008-05-30 07:55:54 UTC (rev 8450)
@@ -20,9 +20,15 @@
public static String ERROR_IMPLEMENTATION_CODE_GENERATION;
public static String ERROR_NO_ANNOTATION;
- public static String WEBSERVICE_ANNOTATION;
+ public static String WEBSERVICEClient_ANNOTATION;
public static String ERROR_NO_CLASS;
public static String ERROR_WS_LOCATION;
+ public static String WEBSERVICE_ANNOTATION_CHECK;
+ public static String WEBSERVICE_ANNOTATION;
+ public static String CLIENTSAMPLEPACKAGENAME;
+ public static String CLIENTSAMPLECLASSNAME;
+ public static String ERROR_CREATECLIENTSAMPLE;
+ public static String WEBENDPOINT;
private JBossWSCreationCoreMessages() {
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java 2008-05-29 23:23:31 UTC (rev 8449)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/utils/JBossWSCreationUtils.java 2008-05-30 07:55:54 UTC (rev 8450)
@@ -40,6 +40,7 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jst.ws.internal.common.J2EEUtils;
import org.jboss.tools.ws.core.JbossWSCorePlugin;
+import org.jboss.tools.ws.core.messages.JbossWSCoreMessages;
public class JBossWSCreationUtils {
@@ -263,7 +264,7 @@
public static boolean validateJBossWSLocation() {
String location = JbossWSCorePlugin.getDefault().getPreferenceStore()
- .getString("jbosswsruntimelocation");
+ .getString(JbossWSCoreMessages.WS_LOCATION);
if (location == null || location.equals("")) {
return false;
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebServiceClient.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebServiceClient.java 2008-05-29 23:23:31 UTC (rev 8449)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/wsrt/JBossWebServiceClient.java 2008-05-30 07:55:54 UTC (rev 8450)
@@ -24,6 +24,7 @@
import org.eclipse.wst.ws.internal.wsrt.AbstractWebServiceClient;
import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
import org.jboss.tools.ws.creation.core.commands.BindingFilesValidationCommand;
+import org.jboss.tools.ws.creation.core.commands.ClientSampleCreationCommand;
import org.jboss.tools.ws.creation.core.commands.InitialClientCommand;
import org.jboss.tools.ws.creation.core.commands.WSDL2JavaCommand;
import org.jboss.tools.ws.creation.core.data.ServiceModel;
@@ -56,7 +57,7 @@
commands.add(new InitialClientCommand(model, this, WebServiceScenario.CLIENT));
commands.add(new BindingFilesValidationCommand(model));
commands.add(new WSDL2JavaCommand(model));
-
+ commands.add(new ClientSampleCreationCommand(model));
return new SimpleCommandFactory(commands);
}
15 years, 11 months
JBoss Tools SVN: r8449 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2008-05-29 19:23:31 -0400 (Thu, 29 May 2008)
New Revision: 8449
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
Log:
JBIDE-2271 The New Seam Project wizard throws NPE when starting
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2008-05-29 16:52:21 UTC (rev 8448)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2008-05-29 23:23:31 UTC (rev 8449)
@@ -151,6 +151,7 @@
top.setLayoutData(new GridData(GridData.FILL_BOTH));
createProjectGroup(top);
createServerTargetComposite(top);
+ createPrimaryFacetComposite(top);
createSeamServerTargetComposite(top);
createPresetPanel(top);
return top;
15 years, 11 months
JBoss Tools SVN: r8448 - trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-05-29 12:52:21 -0400 (Thu, 29 May 2008)
New Revision: 8448
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesModelImpl.java
Log:
JBIDE-1189
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesModelImpl.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesModelImpl.java 2008-05-29 16:47:36 UTC (rev 8447)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesModelImpl.java 2008-05-29 16:52:21 UTC (rev 8448)
@@ -167,6 +167,7 @@
return;
}
Link link = PagesFactory.eINSTANCE.createLink();
+ link.setData(os[j]);
link.setFromElement(from);
link.setToElement(to);
link.setName(h.getItemOutputPresentation(os[j]));
15 years, 11 months
JBoss Tools SVN: r8447 - trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-05-29 12:47:36 -0400 (Thu, 29 May 2008)
New Revision: 8447
Modified:
trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/ProcessAdopt.java
Log:
JBIDE-1189
Modified: trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/ProcessAdopt.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/ProcessAdopt.java 2008-05-29 16:47:28 UTC (rev 8446)
+++ trunk/seam/plugins/org.jboss.tools.seam.pages.xml/src/org/jboss/tools/seam/pages/xml/model/handlers/ProcessAdopt.java 2008-05-29 16:47:36 UTC (rev 8447)
@@ -102,13 +102,18 @@
}
private boolean isAdoptableItem(XModelObject target, XModelObject object) {
- return ENT_PROCESS.equals(object.getModelEntity().getName());
+ return ENT_PROCESS_ITEM.equals(object.getModelEntity().getName());
}
private void adoptItem(XModelObject target, XModelObject object, Properties p) {
// String path = object.getAttributeValue(ATT_PATH);
p.put("sample", object);
- XActionInvoker.invoke("CreateActions.AddRule", target, p);
+ String type = object.getAttributeValue(ATTR_TYPE);
+ if(TYPE_PAGE.equals(type)) {
+ XActionInvoker.invoke("CreateActions.AddPage", target, p);
+ } else {
+ //TODO
+ }
}
}
15 years, 11 months
JBoss Tools SVN: r8446 - in trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor: ecore/pages and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-05-29 12:47:28 -0400 (Thu, 29 May 2008)
New Revision: 8446
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/SeamPagesGuiEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesElement.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesModel.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PageImpl.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesElementImpl.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesModelImpl.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PgExceptionImpl.java
Log:
JBIDE-1189
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/SeamPagesGuiEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/SeamPagesGuiEditor.java 2008-05-29 15:42:01 UTC (rev 8445)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/SeamPagesGuiEditor.java 2008-05-29 16:47:28 UTC (rev 8446)
@@ -45,7 +45,7 @@
public void dispose() {
if(model == null) return;
-// model.dispose();
+ model.dispose();
model = null;
gui.dispose();
disposeGui();
@@ -114,29 +114,6 @@
}
}
- private PagesModel getFakeModel(){
- PagesModel model = PagesFactory.eINSTANCE.createPagesModel();
-
- Link link = PagesFactory.eINSTANCE.createLink();
-
- link.setName("page1");
-
- PgException ex = PagesFactory.eINSTANCE.createPgException();
- ex.setName("Exception");
- ex.setLocation(new Point(10,100));
- ex.setSize(new Dimension(300,21));
- ex.getOutputLinks().add(link);
- model.getChildren().add(ex);
-
- Page page = PagesFactory.eINSTANCE.createPage();
- page.setName("page1");
- page.setLocation(new Point(500,150));
- page.setSize(new Dimension(100,100));
- page.getInputLinks().add(link);
- model.getChildren().add(page);
- return model;
- }
-
private PagesModel createModel() {
PagesModel model = PagesFactory.eINSTANCE.createPagesModel();
model.setData(installedProcess);
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesElement.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesElement.java 2008-05-29 15:42:01 UTC (rev 8445)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesElement.java 2008-05-29 16:47:28 UTC (rev 8446)
@@ -111,4 +111,6 @@
* @generated
*/
void setData(Object value);
+
+ public void dataChanged();
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesModel.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesModel.java 2008-05-29 15:42:01 UTC (rev 8445)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/PagesModel.java 2008-05-29 16:47:28 UTC (rev 8446)
@@ -14,4 +14,6 @@
public void load();
+ public void dispose();
+
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PageImpl.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PageImpl.java 2008-05-29 15:42:01 UTC (rev 8445)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PageImpl.java 2008-05-29 16:47:28 UTC (rev 8446)
@@ -6,12 +6,16 @@
*/
package org.jboss.tools.seam.ui.pages.editor.ecore.pages.impl;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.seam.pages.xml.model.helpers.SeamPagesProcessStructureHelper;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Page;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesPackage;
@@ -163,4 +167,25 @@
return result.toString();
}
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public void dataChanged() {
+ XModelObject item = getModelObject();
+ SeamPagesProcessStructureHelper h = SeamPagesProcessStructureHelper.getInstance();
+
+ setName(h.getPageTitle(item));
+ int[] shape = h.asIntArray(item, "shape");
+ if(shape != null && shape.length >= 2) {
+ setLocation(new Point(shape[0],shape[1]));
+ } else {
+ setLocation(new Point(0,0));
+ }
+ if(shape != null && shape.length >= 4) {
+ setSize(new Dimension(shape[2],shape[3]));
+ }
+
+ }
} //PageImpl
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesElementImpl.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesElementImpl.java 2008-05-29 15:42:01 UTC (rev 8445)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesElementImpl.java 2008-05-29 16:47:28 UTC (rev 8446)
@@ -25,6 +25,7 @@
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
+import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Link;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesElement;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesPackage;
@@ -567,4 +568,24 @@
return result.toString();
}
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public void dataChanged() {
+
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ protected XModelObject getModelObject() {
+ if(data instanceof XModelObject) {
+ return (XModelObject)data;
+ }
+ return null;
+ }
} //PagesElementImpl
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesModelImpl.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesModelImpl.java 2008-05-29 15:42:01 UTC (rev 8445)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PagesModelImpl.java 2008-05-29 16:47:28 UTC (rev 8446)
@@ -11,9 +11,12 @@
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.event.XModelTreeEvent;
+import org.jboss.tools.common.model.event.XModelTreeListener;
import org.jboss.tools.seam.pages.xml.model.SeamPagesConstants;
import org.jboss.tools.seam.pages.xml.model.helpers.SeamPagesProcessStructureHelper;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Link;
@@ -47,11 +50,18 @@
* <!-- end-user-doc -->
* @generated NOT
*/
- Map<XModelObject, PagesElement> elements = null;
+ Map<String, PagesElement> elementsByPath = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ * @generated NOT
+ */
+ XModelTreeListener modelListener = new ML();
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
* @generated
*/
protected PagesModelImpl() {
@@ -73,90 +83,190 @@
* <!-- end-user-doc -->
* @generated NOT
*/
-
public PagesElement findElement(Object data) {
if(data instanceof XModelObject) {
- PagesElement result = elements.get(data);
- //Check null and something else
+ data = ((XModelObject)data).getPath();
+ }
+ if(data instanceof String) {
+ PagesElement result = elementsByPath.get(data);
return result;
}
return null;
}
+
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
+ void addElement(XModelObject data, PagesElement element) {
+ elementsByPath.put(data.getPath(), element);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
public void load() {
XModelObject installedProcess = (XModelObject)getData();
if(installedProcess == null) return;
- elements = new HashMap<XModelObject, PagesElement>();
+ elementsByPath = new HashMap<String, PagesElement>();
+ addElement(installedProcess, this);
XModelObject[] is = h.getItems(installedProcess);
for (int i = 0; i < is.length; i++) {
- String type = is[i].getAttributeValue(SeamPagesConstants.ATTR_TYPE);
- if(SeamPagesConstants.TYPE_PAGE.equals(type)) {
- Page page = PagesFactory.eINSTANCE.createPage();
- page.setName(h.getPageTitle(is[i]));
- int[] shape = h.asIntArray(is[i], "shape");
- if(shape != null && shape.length >= 2) {
- page.setLocation(new Point(shape[0],shape[1]));
+ addItem(is[i]);
+ }
+
+ for (int i = 0; i < is.length; i++) {
+ addItemLinks(is[i]);
+ }
+ installedProcess.getModel().removeModelTreeListener(modelListener);
+ installedProcess.getModel().addModelTreeListener(modelListener);
+ }
+
+ private void addItem(XModelObject item) {
+ String type = item.getAttributeValue(SeamPagesConstants.ATTR_TYPE);
+ if(SeamPagesConstants.TYPE_PAGE.equals(type)) {
+ Page page = PagesFactory.eINSTANCE.createPage();
+ page.setData(item);
+ page.dataChanged();
+ addElement(item, page);
+ getChildren().add(page);
+ } else if(SeamPagesConstants.TYPE_EXCEPTION.equals(type)) {
+ PgException exc = PagesFactory.eINSTANCE.createPgException();
+ exc.setData(item);
+ exc.dataChanged();
+ addElement(item, exc);
+ getChildren().add(exc);
+ } else {
+ //TODO
+ }
+ }
+
+ private void addItemLinks(XModelObject item) {
+ String type = item.getAttributeValue(SeamPagesConstants.ATTR_TYPE);
+ if(SeamPagesConstants.TYPE_PAGE.equals(type)
+ || SeamPagesConstants.TYPE_EXCEPTION.equals(type)) {
+ PagesElement from = findElement(item);
+ if(from == null) {
+ //TODO report failure
+ return;
+ }
+ XModelObject[] os = h.getOutputs(item);
+ for (int j = 0; j < os.length; j++) {
+ XModelObject t = h.getItemOutputTarget(os[j]);
+ if(t == null) {
+ //TODO report failure
+ return;
}
- if(shape != null && shape.length >= 4) {
- page.setSize(new Dimension(shape[2],shape[3]));
+ PagesElement to = findElement(t);
+ if(to == null) {
+ //TODO report failure
+ return;
}
- page.setData(is[i]);
- getChildren().add(page);
- elements.put(is[i], page);
- } else if(SeamPagesConstants.TYPE_EXCEPTION.equals(type)) {
- PgException exc = PagesFactory.eINSTANCE.createPgException();
- exc.setName(is[i].getPresentationString());
- int[] shape = h.asIntArray(is[i], "shape");
- if(shape != null && shape.length >= 2) {
- exc.setLocation(new Point(shape[0],shape[1]));
- }
- if(shape != null && shape.length >= 4) {
- exc.setSize(new Dimension(shape[2],shape[3]));
- }
- exc.setData(is[i]);
- getChildren().add(exc);
- //maybe we need other map for exceptions?
- elements.put(is[i], exc);
- } else {
- //TODO
+ Link link = PagesFactory.eINSTANCE.createLink();
+ link.setFromElement(from);
+ link.setToElement(to);
+ link.setName(h.getItemOutputPresentation(os[j]));
+ link.setShortcut(h.isShortcut(os[j]));
}
}
+ }
- for (int i = 0; i < is.length; i++) {
- String type = is[i].getAttributeValue(SeamPagesConstants.ATTR_TYPE);
- if(SeamPagesConstants.TYPE_PAGE.equals(type)
- || SeamPagesConstants.TYPE_EXCEPTION.equals(type)) {
- PagesElement from = elements.get(is[i]);
- if(from == null) {
- //TODO report failure
- continue;
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public void update() {
+ XModelObject installedProcess = (XModelObject)getData();
+ if(installedProcess == null) return;
+
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public void dispose() {
+ XModelObject installedProcess = (XModelObject)getData();
+ if(installedProcess == null) return;
+ installedProcess.getModel().removeModelTreeListener(modelListener);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ class ML implements XModelTreeListener {
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public void nodeChanged(XModelTreeEvent event) {
+ if(getData() == null) return;
+ XModelObject installedProcess = (XModelObject)getData();
+ if(!event.getModelObject().getPath().startsWith(installedProcess.getPath())) {
+ return;
+ }
+ PagesElement item = findElement(event.getModelObject());
+ if(item != null) {
+ item.dataChanged();
+ }
+ //TODO update link
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public void structureChanged(XModelTreeEvent event) {
+ if(getData() == null) return;
+ XModelObject installedProcess = (XModelObject)getData();
+ XModelObject target = event.getModelObject();
+ if(!target.getPath().startsWith(installedProcess.getPath())) {
+ return;
+ }
+ if(event.kind() == XModelTreeEvent.CHILD_ADDED) {
+ XModelObject added = (XModelObject)event.getInfo();
+ if(target == installedProcess) {
+ addItem(added);
+ addItemLinks(added);
+ } else {
+ PagesElement item = findElement(target);
+ //TODO
}
- XModelObject[] os = h.getOutputs(is[i]);
- for (int j = 0; j < os.length; j++) {
- XModelObject t = h.getItemOutputTarget(os[j]);
- if(t == null) {
- //TODO report failure
- continue;
+ } else if(event.kind() == XModelTreeEvent.CHILD_REMOVED) {
+ if(target == installedProcess) {
+ PagesElement removed = findElement(event.getInfo());
+ if(removed != null) {
+ elementsByPath.remove(event.getInfo());
+ Link[] ls = removed.getOutputLinks().toArray(new Link[0]);
+ for (int i = 0; i < ls.length; i++) {
+ ls[i].setFromElement(null);
+ ls[i].setToElement(null);
+ }
+ ls = removed.getInputLinks().toArray(new Link[0]);
+ for (int i = 0; i < ls.length; i++) {
+ ls[i].setFromElement(null);
+ ls[i].setToElement(null);
+ }
+ getChildren().remove(removed);
}
- PagesElement to = elements.get(t);
- if(to == null) {
- //TODO report failure
- continue;
- }
- Link link = PagesFactory.eINSTANCE.createLink();
- link.setFromElement(from);
- link.setToElement(to);
- link.setName(h.getItemOutputPresentation(os[j]));
- link.setShortcut(h.isShortcut(os[j]));
+ } else {
+
}
}
+ update();
}
-
+
}
} //PagesModelImpl
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PgExceptionImpl.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PgExceptionImpl.java 2008-05-29 15:42:01 UTC (rev 8445)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/ecore/pages/impl/PgExceptionImpl.java 2008-05-29 16:47:28 UTC (rev 8446)
@@ -6,8 +6,12 @@
*/
package org.jboss.tools.seam.ui.pages.editor.ecore.pages.impl;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
import org.eclipse.emf.ecore.EClass;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.seam.pages.xml.model.helpers.SeamPagesProcessStructureHelper;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesPackage;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PgException;
@@ -40,4 +44,25 @@
return PagesPackage.Literals.PG_EXCEPTION;
}
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public void dataChanged() {
+ XModelObject item = getModelObject();
+ SeamPagesProcessStructureHelper h = SeamPagesProcessStructureHelper.getInstance();
+
+ setName(item.getPresentationString());
+ int[] shape = h.asIntArray(item, "shape");
+ if(shape != null && shape.length >= 2) {
+ setLocation(new Point(shape[0],shape[1]));
+ } else {
+ setLocation(new Point(0,0));
+ }
+ if(shape != null && shape.length >= 4) {
+ setSize(new Dimension(shape[2],shape[3]));
+ }
+ }
+
} //PgExceptionImpl
15 years, 11 months
JBoss Tools SVN: r8445 - trunk/documentation/guides/GettingStartedGuide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-05-29 11:42:01 -0400 (Thu, 29 May 2008)
New Revision: 8445
Modified:
trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml
Log:
http://jira.jboss.com/jira/browse/JBDS-134 - creating FAq section (commented because of the only question)
Modified: trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml 2008-05-29 15:21:06 UTC (rev 8444)
+++ trunk/documentation/guides/GettingStartedGuide/en/modules/first_seam.xml 2008-05-29 15:42:01 UTC (rev 8445)
@@ -10,326 +10,373 @@
</chapterinfo>
<title>Write Your First Project with JBoss Developer Studio</title>
-
- <para>This chapter is a set of hands-on labs. You get step-by-step information about how the JBoss Developer Studio can be used during the development process.</para>
-<section id="create_seam_application">
- <title>Create a Seam Application</title>
-
- <para>In this section you get to know how to create a Seam project in JBDS, how to start the server and what a structure your project has after creating.</para>
-
- <section id="start_dev_db">
- <title>Start Development Database</title>
-
- <para>Before opening the JBoss Developer studio you need to <ulink url="../../../database.zip">download</ulink> and start a Workshop Database.</para>
- <para>To start the database just run <property>./runDBServer.sh</property> or <property>runDBServer.bat</property> from the database directory.</para>
- <para>The end result should be a console window that looks like:</para>
-
- <figure>
- <title>Starting DataBase</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/first_seam/first_seam1.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- </section>
+ <para>This chapter is a set of hands-on labs. You get step-by-step information about how the JBoss
+ Developer Studio can be used during the development process.</para>
- <section id="create_deploy_seam">
- <title>Create and deploy Seam Web Project</title>
-
- <para>Minimize the terminal window and run the JBoss Developer Studio from Applications Menu or from the desktop icon.</para>
- <para>First of all you get the Workspace Launcher. Change the default workspace location if it's needed. Click on <property>Ok</property>.
- </para>
-
- <figure>
- <title>Workspace Launcher Dialog</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/first_seam/first_seam2.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>After startup, you see the welcome page. You could read how to work with welcome pages in <link linkend="Welcome">previous</link> chapter.
- Now select <property>Create New...</property> icon and then press on <property>Create Seam Project</property> link.</para>
-
- <para>The New Seam Project wizard is started. You need to enter a name (e.g., "workshop") and a location directory for your new project.
- The wizard has an option for selecting the actual Server (and not just WTP runtime) that will be used for the project.
- This allow the wizard to correctly identify where the needed datasource and driver libraries need to go. All settings are already specified.
- Click on <property>Next</property>.</para>
-
- <figure>
- <title>New Seam Project Wizard</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/first_seam/first_seam3.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>Next, you will be asked to select the "features" you want to use in your project. This allows JBoss Developer Studio to setup the
- appropriate tooling for your project. Since JBoss Seam integrates all popular Java EE frameworks, you can select any combination of
- technologies from the list. Here, for this project, we will select Dynamic Web Module, Java, JavaServer Faces (JSF), and Seam Facet for
- a typical database-driven web application. The default project facets should suffice, click on <property>Next</property>.</para>
-
- <figure id="ProjectFacetsSpecifyingScreen">
- <title>Project Facets Specifying</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/first_seam/first_seam4.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>In the <link linkend="ProjectFacetsSpecifyingScreen">Project Facets Specifying</link> form you can also bring up server runtimes panel by clicking <property>Show Runtimes</property> in the bottom right corner.
- This panel shows available server runtimes. Then this button will be changed into <property>Hide Runtimes</property> one.</para>
- <para>Click <property>Next</property> to proceed further.</para>
-
- <figure>
- <title>Runtimes Selecting</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/first_seam/first_seam5.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>A dynamic web application contains both web pages and Java code. The wizard will ask you where you want to put those files.
- You can just leave the default values or choose another folder.</para>
-
- <figure>
- <title>Web Module Settings</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/first_seam/first_seam6.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>On the next form, you will be able to select where those library JARs come from. The easiest is just to select the JARs provided by
- the JBoss AS runtime associated with this project. That is why it is important to chose the right JBoss AS 4.2 runtime in the project setup window.</para>
- <itemizedlist>
- <listitem>
- <para>Check <emphasis><property>Server Supplied JSF Implementation</property>.
- </emphasis>We will use <ulink url="&seamlink;#addJSFCapab">JSF implementation</ulink> that comes with JBoss server</para>
- </listitem>
- <listitem>
- <para>Click <emphasis><property>Next</property></emphasis></para>
- </listitem>
- </itemizedlist>
-
- <figure>
- <title>JSF Capabilities Adding</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/first_seam/first_seam7.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>Next wizard step needs more settings that previous. Let's start with <property>General</property> section.</para>
- <para>Leave the default Seam runtime and check a WAR deployment.</para>
-
- <figure>
- <title>Seam Facet Setting</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/first_seam/first_seam8.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>Next <property>Database</property> section is a little tricky. The <property>Connection Profile</property> needs to be edited so that the
- new project works properly with the external HSQLDB server. By default the project wizard tries to use the JBoss embedded
- HSQLDB, but the tutorial uses an external database to replicate a more real world development scenario.
- Click on <property>Edit</property> to modify the Connection Profile.</para>
-
- <figure>
- <title>DataBase Setting</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/first_seam/first_seam8_1.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>Select <property>JDBC Connection Properties</property>. Make sure the URL is set to <emphasis><property>jdbc:hsqldb:hsql://localhost:1701</property></emphasis></para>
-
- <figure>
- <title>JDBC Connection Properties</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/first_seam/first_seam9.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>Try click on <property>Test Connection</property> button. It probably won’t work. This happens if the hsql jdbc driver is not exactly the same. This can
- be worked around by modifying the HSQLDB database driver settings. To modify the settings, click the <property>“...”</property> next to the drop-down box.</para>
-
- <para>The proper Driver JAR File should be listed under <property>Driver File(s)</property>. Select the hsqldb.jar file found in the
- database/lib directory and click on <property>Ok</property>.</para>
-
- <figure>
- <title>Driver Details</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/first_seam/first_seam10.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>Select <property>Hypersonic DB</property> and click on <property>Ok</property>. Again, this only happens if the selected hsqldb.jar is different
- from the running database.</para>
-
- <figure>
- <title>Hypersonic DB Selecting</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/first_seam/first_seam11.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>Now, the <property>Test Connection</property> should succeed. After testing the connection, click on Ok.</para>
-
- <figure>
- <title>Connection Testing</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/first_seam/first_seam12.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>You can leave the <property>Code Generation</property> section as is. It refers to Java packages in which the generated code will be placed.</para>
-
- <figure>
- <title>Code Generation Setting</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/first_seam/first_seam13.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>Click on <property>Finish</property> button. Now, there should be a new Seam project called “workshop” listed in Package Explorer view.</para>
-
- <figure>
- <title>"worskhop" Project in the Package Explorer</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/first_seam/first_seam14.png"/>
- </imageobject>
- </mediaobject>
- </figure>
- </section>
-
+ <section id="create_seam_application">
+ <title>Create a Seam Application</title>
+
+ <para>In this section you get to know how to create a Seam project in JBDS, how to start the
+ server and what a structure your project has after creating.</para>
+
+ <section id="start_dev_db">
+ <title>Start Development Database</title>
+
+ <para>Before opening the JBoss Developer studio you need to <ulink url="../../../database.zip"
+ >download</ulink> and start a Workshop Database.</para>
+ <para>To start the database just run <property>./runDBServer.sh</property> or
+ <property>runDBServer.bat</property> from the database directory.</para>
+ <para>The end result should be a console window that looks like:</para>
+
+ <figure>
+ <title>Starting DataBase</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/first_seam/first_seam1.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ </section>
+
+ <section id="create_deploy_seam">
+ <title>Create and deploy Seam Web Project</title>
+
+ <para>Minimize the terminal window and run the JBoss Developer Studio from Applications Menu
+ or from the desktop icon.</para>
+ <para>First of all you get the Workspace Launcher. Change the default workspace location if
+ it's needed. Click on <property>Ok</property>. </para>
+
+ <figure>
+ <title>Workspace Launcher Dialog</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/first_seam/first_seam2.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>After startup, you see the welcome page. You could read how to work with welcome pages
+ in <link linkend="Welcome">previous</link> chapter. Now select <property>Create
+ New...</property> icon and then press on <property>Create Seam Project</property> link.</para>
+
+ <para>The New Seam Project wizard is started. You need to enter a name (e.g.,
+ "workshop") and a location directory for your new project. The wizard has
+ an option for selecting the actual Server (and not just WTP runtime) that will be used for
+ the project. This allow the wizard to correctly identify where the needed datasource and
+ driver libraries need to go. All settings are already specified. Click on
+ <property>Next</property>.</para>
+
+ <figure>
+ <title>New Seam Project Wizard</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/first_seam/first_seam3.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Next, you will be asked to select the "features" you want to use in your project. This
+ allows JBoss Developer Studio to setup the appropriate tooling for your project. Since JBoss
+ Seam integrates all popular Java EE frameworks, you can select any combination of
+ technologies from the list. Here, for this project, we will select Dynamic Web Module, Java,
+ JavaServer Faces (JSF), and Seam Facet for a typical database-driven web application. The
+ default project facets should suffice, click on <property>Next</property>.</para>
+
+ <figure id="ProjectFacetsSpecifyingScreen">
+ <title>Project Facets Specifying</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/first_seam/first_seam4.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>In the <link linkend="ProjectFacetsSpecifyingScreen">Project Facets Specifying</link>
+ form you can also bring up server runtimes panel by clicking <property>Show
+ Runtimes</property> in the bottom right corner. This panel shows available server runtimes.
+ Then this button will be changed into <property>Hide Runtimes</property> one.</para>
+ <para>Click <property>Next</property> to proceed further.</para>
+
+ <figure>
+ <title>Runtimes Selecting</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/first_seam/first_seam5.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>A dynamic web application contains both web pages and Java code. The wizard will ask you
+ where you want to put those files. You can just leave the default values or choose another
+ folder.</para>
+
+ <figure>
+ <title>Web Module Settings</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/first_seam/first_seam6.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>On the next form, you will be able to select where those library JARs come from. The
+ easiest is just to select the JARs provided by the JBoss AS runtime associated with this
+ project. That is why it is important to chose the right JBoss AS 4.2 runtime in the project
+ setup window.</para>
+ <itemizedlist>
+ <listitem>
+ <para>Check <emphasis><property>Server Supplied JSF Implementation</property>.
+ </emphasis>We will use <ulink url="&seamlink;#addJSFCapab">JSF
+ implementation</ulink> that comes with JBoss server</para>
+ </listitem>
+ <listitem>
+ <para>Click <emphasis>
+ <property>Next</property>
+ </emphasis></para>
+ </listitem>
+ </itemizedlist>
+
+ <figure>
+ <title>JSF Capabilities Adding</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/first_seam/first_seam7.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Next wizard step needs more settings that previous. Let's start with
+ <property>General</property> section.</para>
+ <para>Leave the default Seam runtime and check a WAR deployment.</para>
+
+ <figure>
+ <title>Seam Facet Setting</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/first_seam/first_seam8.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Next <property>Database</property> section is a little tricky. The <property>Connection
+ Profile</property> needs to be edited so that the new project works properly with the
+ external HSQLDB server. By default the project wizard tries to use the JBoss embedded
+ HSQLDB, but the tutorial uses an external database to replicate a more real world
+ development scenario. Click on <property>Edit</property> to modify the Connection Profile.</para>
+
+ <figure>
+ <title>DataBase Setting</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/first_seam/first_seam8_1.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Select <property>JDBC Connection Properties</property>. Make sure the URL is set to <emphasis>
+ <property>jdbc:hsqldb:hsql://localhost:1701</property>
+ </emphasis></para>
+
+ <figure>
+ <title>JDBC Connection Properties</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/first_seam/first_seam9.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Try click on <property>Test Connection</property> button. It probably won’t work. This
+ happens if the hsql jdbc driver is not exactly the same. This can be worked around by
+ modifying the HSQLDB database driver settings. To modify the settings, click the
+ <property>“...”</property> next to the drop-down box.</para>
+
+ <para>The proper Driver JAR File should be listed under <property>Driver File(s)</property>.
+ Select the hsqldb.jar file found in the database/lib directory and click on
+ <property>Ok</property>.</para>
+
+ <figure>
+ <title>Driver Details</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/first_seam/first_seam10.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Select <property>Hypersonic DB</property> and click on <property>Ok</property>. Again,
+ this only happens if the selected hsqldb.jar is different from the running database.</para>
+
+ <figure>
+ <title>Hypersonic DB Selecting</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/first_seam/first_seam11.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Now, the <property>Test Connection</property> should succeed. After testing the
+ connection, click on Ok.</para>
+
+ <figure>
+ <title>Connection Testing</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/first_seam/first_seam12.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>You can leave the <property>Code Generation</property> section as is. It refers to Java
+ packages in which the generated code will be placed.</para>
+
+ <figure>
+ <title>Code Generation Setting</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/first_seam/first_seam13.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Click on <property>Finish</property> button. Now, there should be a new Seam project
+ called “workshop” listed in Package Explorer view.</para>
+
+ <figure>
+ <title>"worskhop" Project in the Package Explorer</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/first_seam/first_seam14.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </section>
+
<section id="start_JBossAS">
<title>Start JBoss Application Server</title>
-
- <para>The complete information on how to manage JBoss AS from JBoss Developer Studio you can read in a <link linkend="manage">corresponding chapter</link>.</para>
- <para>Now you just need to start the server by clicking on green circle/triangle icon in the JBoss Server View.</para>
-
- <figure>
- <title>Starting the Server</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/first_seam/first_seam15.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>Then run the project by selecting the project and use <emphasis><property>Run As... > Run on Server</property>.</emphasis></para>
-
+
+ <para>The complete information on how to manage JBoss AS from JBoss Developer Studio you can
+ read in a <link linkend="manage">corresponding chapter</link>.</para>
+ <para>Now you just need to start the server by clicking on green circle/triangle icon in the
+ JBoss Server View.</para>
+
+ <figure>
+ <title>Starting the Server</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/first_seam/first_seam15.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Then run the project by selecting the project and use <emphasis><property>Run As... >
+ Run on Server</property>.</emphasis></para>
+
<note>
<title>Note:</title>
- <para>If the project does not show up, then you can use a normal browser and use <emphasis><property>http://localhost:8080/workshop/home.seam</property></emphasis> as the
- url.</para>
- </note>
-
- <para>Your project looks like this:</para>
-
- <figure>
- <title>"workshop" Project Started</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/first_seam/first_seam16.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
+ <para>If the project does not show up, then you can use a normal browser and use <emphasis>
+ <property>http://localhost:8080/workshop/home.seam</property>
+ </emphasis> as the url.</para>
+ </note>
+
+ <para>Your project looks like this:</para>
+
+ <figure>
+ <title>"workshop" Project Started</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/first_seam/first_seam16.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
</section>
-
- <section id="workshop_code_overview">
- <title>Workshop Project Code Overview</title>
-
- <para>Now let's examine the project and its structure. Go back to the Package Explorer view in JBoss Developer Studio.</para>
-
- <para>It seems like it's not much for project but this shell application contains a login screen with default login logic, a
- menu template that can be further modified, and other layout templates.</para>
-
- <figure>
- <title>Project Structure</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/first_seam/first_seam17.png"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>It’s important to note that the business logic will reside in the <emphasis><property>src/action</property></emphasis> folder, by default. And, the
- package naming conventions that were used in Seam project setup wizard could have been changed to
- something different from <emphasis><property>org.domain.workshop.session</property></emphasis>. Also, notice that there is a default <property>Authenticator.
- java</property> file. This is where custom security logic can be added. Seam has a nice declarative security
- model that we will explore in a bit more detail later on. The <emphasis><property>src/model</property></emphasis> folder will store the project’s
- JPA entity beans. The view tier of the application is also important. Seam uses facelets and there is a built-in
- facelets GUI editor that has some nice WYSIWYG and component drag/drop functionality. Try this out by opening <property>home.xhtml</property> from
- <property>WebContent</property> folder.</para>
-
- <figure>
- <title>Facelets GUI Editor</title>
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/first_seam/first_seam18.png" scale="85"/>
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>Notice that the templates reside in the <emphasis><property>WebContent/layout</property></emphasis> folder. There is a stylesheet in
- the <emphasis><property>WebContent/stylesheet</property></emphasis> folder. There is also a login and default error page. The Facelet editor will be explored in
- more detail later in the lab.</para>
-
- <para>The project already has a datasource that was created per the Seam project wizard database settings. And,
- obviously all of the Seam specific configuration files and JAR dependencies are included and placed in
- the proper locations. On last noteworthy line item is related to the build script. There isn’t a build script
- because the Eclipse WTP(Web Tools Project) plugin is used to publish web application changes. As you
- can see, JBoss Developer Studio is removing a great deal of complexity from the enterprise Java project
- setup/deployment process. The end result is a developer that is writing code, not spending days/weeks trying
- to figure out how to get a decent development environment and project build process.</para>
-
+
+ <section id="workshop_code_overview">
+ <title>Workshop Project Code Overview</title>
+
+ <para>Now let's examine the project and its structure. Go back to the Package Explorer view in
+ JBoss Developer Studio.</para>
+
+ <para>It seems like it's not much for project but this shell application contains a login
+ screen with default login logic, a menu template that can be further modified, and other
+ layout templates.</para>
+
+ <figure>
+ <title>Project Structure</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/first_seam/first_seam17.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>It’s important to note that the business logic will reside in the <emphasis>
+ <property>src/action</property>
+ </emphasis> folder, by default. And, the package naming conventions that were used in Seam
+ project setup wizard could have been changed to something different from <emphasis>
+ <property>org.domain.workshop.session</property>
+ </emphasis>. Also, notice that there is a default <property>Authenticator. java</property>
+ file. This is where custom security logic can be added. Seam has a nice declarative security
+ model that we will explore in a bit more detail later on. The <emphasis>
+ <property>src/model</property>
+ </emphasis> folder will store the project’s JPA entity beans. The view tier of the
+ application is also important. Seam uses facelets and there is a built-in facelets GUI
+ editor that has some nice WYSIWYG and component drag/drop functionality. Try this out by
+ opening <property>home.xhtml</property> from <property>WebContent</property> folder.</para>
+
+ <figure>
+ <title>Facelets GUI Editor</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/first_seam/first_seam18.png" scale="85"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Notice that the templates reside in the <emphasis>
+ <property>WebContent/layout</property>
+ </emphasis> folder. There is a stylesheet in the <emphasis>
+ <property>WebContent/stylesheet</property>
+ </emphasis> folder. There is also a login and default error page. The Facelet editor will be
+ explored in more detail later in the lab.</para>
+
+ <para>The project already has a datasource that was created per the Seam project wizard
+ database settings. And, obviously all of the Seam specific configuration files and JAR
+ dependencies are included and placed in the proper locations. On last noteworthy line item
+ is related to the build script. There isn’t a build script because the Eclipse WTP(Web Tools
+ Project) plugin is used to publish web application changes. As you can see, JBoss Developer
+ Studio is removing a great deal of complexity from the enterprise Java project
+ setup/deployment process. The end result is a developer that is writing code, not spending
+ days/weeks trying to figure out how to get a decent development environment and project
+ build process.</para>
+
</section>
-</section>
+ </section>
<section id="seam_action_dev">
<title>Seam Action Development</title>
-
- <para>Now, it’s time to write some code. The good news is that JBoss Developer Studio can also help out in
- this respect. In this section, we will create a new Seam Action POJO and facelet with some custom business
- logic and some GUI changes.</para>
-
+
+ <para>Now, it’s time to write some code. The good news is that JBoss Developer Studio can also
+ help out in this respect. In this section, we will create a new Seam Action POJO and facelet
+ with some custom business logic and some GUI changes.</para>
+
<section id="create_seam_action">
<title>Create a New Seam Action</title>
-
- <para>Go to main menu bar and click on <emphasis><property>File > New > New Seam Action</property></emphasis> to start the New Seam Action wizard.</para>
-
- <para>Specify a <property>Seam component name</property> (e.g., "myAction"). The other properties will be auto-completed for
- you so there is no need to change them. Click on <property>Finish</property>.</para>
-
+
+ <para>Go to main menu bar and click on <emphasis>
+ <property>File > New > New Seam Action</property>
+ </emphasis> to start the New Seam Action wizard.</para>
+
+ <para>Specify a <property>Seam component name</property> (e.g., "myAction").
+ The other properties will be auto-completed for you so there is no need to change them.
+ Click on <property>Finish</property>.</para>
+
<figure>
<title>New Seam Action Wizard</title>
<mediaobject>
@@ -338,25 +385,27 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>Now, open the <property>MyAction.java</property> file and replace the "myAction" method with this logic:</para>
-
+
+ <para>Now, open the <property>MyAction.java</property> file and replace the
+ "myAction" method with this logic:</para>
+
<programlisting><![CDATA[public void myAction() {
Calendar cal = Calendar.getInstance();
log.info("myAction.myAction() action called");
facesMessages.add("MyAction Executed on:" + cal.getTime());
}]]></programlisting>
-
- <para>You also need to import the <property>java.util.Calendar</property> class by clicking <emphasis><property>CTRL + Shift + O</property>.</emphasis></para>
-
+
+ <para>You also need to import the <property>java.util.Calendar</property> class by clicking
+ <emphasis><property>CTRL + Shift + O</property>.</emphasis></para>
+
</section>
-
+
<section id="test_seam_action">
<title>Test Seam Action</title>
-
- <para>The new action can be tested by browsing the workshop-test project. JBoss Developer Studio has already
- created a TestNG test case for you.</para>
-
+
+ <para>The new action can be tested by browsing the workshop-test project. JBoss Developer
+ Studio has already created a TestNG test case for you.</para>
+
<figure>
<title>"workshop-test" Project</title>
<mediaobject>
@@ -365,11 +414,13 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>The test case simulates a Seam component/method execution for the <property>MyAction.myAction()</property> logic.</para>
- <para>To run the test case, right click on <property>MyActionTest.xml</property> and click <emphasis><property>Run As > TestNG Suite</property></emphasis> or use the <property>Run
- As...</property> toolbar shortcut as shown below.</para>
-
+
+ <para>The test case simulates a Seam component/method execution for the
+ <property>MyAction.myAction()</property> logic.</para>
+ <para>To run the test case, right click on <property>MyActionTest.xml</property> and click <emphasis>
+ <property>Run As > TestNG Suite</property>
+ </emphasis> or use the <property>Run As...</property> toolbar shortcut as shown below.</para>
+
<figure>
<title>TestNG Running</title>
<mediaobject>
@@ -378,9 +429,9 @@
</imageobject>
</mediaobject>
</figure>
-
+
<para>With any luck, the test case will pass. Look at the TestNG view.</para>
-
+
<figure>
<title>TestNG Results</title>
<mediaobject>
@@ -389,10 +440,15 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>Now, it’s safe to test the new Seam Action in a web browser. The fastest way to do that is to right click on <property>myAction.xhtml</property> and use <emphasis><property>Run As... > Run On Server</property></emphasis> which will
- show the appropriate url in the browser. Alternatively you can manually enter <emphasis><property>http://localhost/workshop/myAction.seam</property></emphasis> into a browser.</para>
-
+
+ <para>Now, it’s safe to test the new Seam Action in a web browser. The fastest way to do that
+ is to right click on <property>myAction.xhtml</property> and use <emphasis>
+ <property>Run As... > Run On Server</property>
+ </emphasis> which will show the appropriate url in the browser. Alternatively you can
+ manually enter <emphasis>
+ <property>http://localhost/workshop/myAction.seam</property>
+ </emphasis> into a browser.</para>
+
<figure>
<title>Seam Action in a Web Browser</title>
<mediaobject>
@@ -401,17 +457,21 @@
</imageobject>
</mediaobject>
</figure>
-
+
</section>
-
+
<section id="modify_seam_action">
<title>Modify Seam Action User Interface</title>
-
- <para>Browse to <emphasis><property>http://localhost:8080/workshop/myAction.seam</property></emphasis> and click on <property>myAction</property>. This executes the
- “myAction” method. This looks pretty good, but we could make this page look a little better.</para>
-
- <para>Open <emphasis><property>WebContent/myAction.xhtml</property></emphasis> in JBoss Developer Studio to use the nice facelets editor.</para>
-
+
+ <para>Browse to <emphasis>
+ <property>http://localhost:8080/workshop/myAction.seam</property>
+ </emphasis> and click on <property>myAction</property>. This executes the “myAction” method.
+ This looks pretty good, but we could make this page look a little better.</para>
+
+ <para>Open <emphasis>
+ <property>WebContent/myAction.xhtml</property>
+ </emphasis> in JBoss Developer Studio to use the nice facelets editor.</para>
+
<figure>
<title>Open Seam Action with Editor </title>
<mediaobject>
@@ -420,9 +480,10 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>Right click on the "myAction!" button in the visual part of editor and select <property><h:commandButton> Attributes</property>.</para>
-
+
+ <para>Right click on the "myAction!" button in the visual part of editor and
+ select <property><h:commandButton> Attributes</property>.</para>
+
<figure>
<title>Seam Action Editing</title>
<mediaobject>
@@ -431,10 +492,12 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>Change the <property>value</property> of the button to something different. If desired, you can change any other text on the
- page. Then, type <emphasis><property>CTRL + S</property></emphasis> to save the facelet.</para>
-
+
+ <para>Change the <property>value</property> of the button to something different. If desired,
+ you can change any other text on the page. Then, type <emphasis>
+ <property>CTRL + S</property>
+ </emphasis> to save the facelet.</para>
+
<figure>
<title>Attributes Dialog</title>
<mediaobject>
@@ -443,11 +506,14 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>Refresh <emphasis><property>http://localhost:8080/workshop/myAction.seam</property></emphasis> and now you should see your changes.</para>
-
- <para>Notice that you did not have to publish the application. JBoss Developer Studio auto-published it for you.</para>
-
+
+ <para>Refresh <emphasis>
+ <property>http://localhost:8080/workshop/myAction.seam</property>
+ </emphasis> and now you should see your changes.</para>
+
+ <para>Notice that you did not have to publish the application. JBoss Developer Studio
+ auto-published it for you.</para>
+
<figure>
<title>Seam Action Is Modified</title>
<mediaobject>
@@ -456,25 +522,27 @@
</imageobject>
</mediaobject>
</figure>
-
+
</section>
-
-
+
+
</section>
-
+
<section id="declarative_security">
<title>Declarative Security</title>
-
- <para>In this section you will see how it’s easy to secure the facelets and facelet components in Seam. Let’s go ahead and secure the action button,
- then we will secure the entire page.</para>
-
+
+ <para>In this section you will see how it’s easy to secure the facelets and facelet components
+ in Seam. Let’s go ahead and secure the action button, then we will secure the entire page.</para>
+
<section id="edit_login">
<title>Edit Login Authentication Logic</title>
-
- <para>There is a class called <property>Authenticator.java</property>. The login page will execute
- the <property>Authenticator.authenticate()</property> method by default, so we’ll start by adding some custom login logic.</para>
- <para>Open <property>Authenticator.java</property> in JBoss Developer Studio and replace the <property>authenticate()</property> method with this code:</para>
-
+
+ <para>There is a class called <property>Authenticator.java</property>. The login page will
+ execute the <property>Authenticator.authenticate()</property> method by default, so we’ll
+ start by adding some custom login logic.</para>
+ <para>Open <property>Authenticator.java</property> in JBoss Developer Studio and replace the
+ <property>authenticate()</property> method with this code:</para>
+
<programlisting><![CDATA[public boolean authenticate() {
if (identity.getUsername().equals("admin")
&& identity.getPassword().equals("password")) {
@@ -484,21 +552,23 @@
else
return true;
}]]></programlisting>
-
+
</section>
<section id="secure_seam_page">
<title>Secure Seam Page Component</title>
-
+
<para>Open <property>myAction.xhtml</property> and add a new secured command button:</para>
<programlisting><![CDATA[<h:commandButton id="myActionSecured"
value="Secured Action Button"
action="#{myAction.myAction}"
rendered="#{s:hasRole('admin')}"/>]]></programlisting>
-
- <para>Refresh <emphasis><property>http://localhost:8080/workshop/myAction.seam</property></emphasis> If you are not logged in you will only see one
- button. If you are logged in, there will be two buttons.</para>
-
-
+
+ <para>Refresh <emphasis>
+ <property>http://localhost:8080/workshop/myAction.seam</property>
+ </emphasis> If you are not logged in you will only see one button. If you are logged in,
+ there will be two buttons.</para>
+
+
<figure>
<title>One Button on a Page</title>
<mediaobject>
@@ -507,9 +577,10 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>The secured button is not visible because the user isn’t logged in as <property>"admin"</property>.</para>
-
+
+ <para>The secured button is not visible because the user isn’t logged in as
+ <property>"admin"</property>.</para>
+
<figure>
<title>Secured Button is Visible</title>
<mediaobject>
@@ -518,17 +589,19 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>The user is logged in as <property>"admin"</property>. Securing components is easy but securing pages is pretty simple as
- well. </para>
- <para>Open <emphasis><property>WebContent/WEB-INF/pages.xml</property></emphasis>. Then add this markup directly underneath the
- <pages> element:</para>
-
+
+ <para>The user is logged in as <property>"admin"</property>. Securing
+ components is easy but securing pages is pretty simple as well. </para>
+ <para>Open <emphasis>
+ <property>WebContent/WEB-INF/pages.xml</property>
+ </emphasis>. Then add this markup directly underneath the <pages> element:</para>
+
<programlisting><![CDATA[<page view-id="/myAction.xhtml" login-required="true"/>]]></programlisting>
-
- <para>Refresh <emphasis><property>http://localhost:8080/workshop/myAction.seam</property></emphasis> If you are not logged in you will get bounced
- back to the login page.</para>
-
+
+ <para>Refresh <emphasis>
+ <property>http://localhost:8080/workshop/myAction.seam</property>
+ </emphasis> If you are not logged in you will get bounced back to the login page.</para>
+
<figure>
<title>Login Page</title>
<mediaobject>
@@ -537,32 +610,36 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>Thus, if you enter login credentials for the <property>"admin"</property> user, you will be re-directed to the secured page and
- secured component. If you enter different login credentials, page access will be granted, but the secured component will not be
- displayed.</para>
-
- <para>Congratulations! You have secured your new action both at the facelet component and page level. You
- also added custom authentication logic to the login action.</para>
-
- </section>
-
+
+ <para>Thus, if you enter login credentials for the
+ <property>"admin"</property> user, you will be re-directed to the secured
+ page and secured component. If you enter different login credentials, page access will be
+ granted, but the secured component will not be displayed.</para>
+
+ <para>Congratulations! You have secured your new action both at the facelet component and page
+ level. You also added custom authentication logic to the login action.</para>
+
+ </section>
+
</section>
-
+
<section id="browsing_workshop_db">
<title>Browsing Workshop Database</title>
-
- <para>In this section you get to know how to use the workshop database that was started at the beginning of the lab.</para>
-
+
+ <para>In this section you get to know how to use the workshop database that was started at the
+ beginning of the lab.</para>
+
<section id="database_connectivity">
<title>Database Connectivity Setup</title>
-
+
<para>The workshop data can be browsed inside of JBoss Developer Studio.</para>
- <para>To open the Data Source Explorer, click on <emphasis><property>Window > Open Perspective > Other > Database Development</property>.</emphasis></para>
- <para>In the Data Source Explorer, expand a <property>Databases</property> node and select a <property>Default</property> database.
- Right click on it, select <property>Connect</property> from the context menu.</para>
-
+ <para>To open the Data Source Explorer, click on <emphasis><property>Window > Open Perspective
+ > Other > Database Development</property>.</emphasis></para>
+ <para>In the Data Source Explorer, expand a <property>Databases</property> node and select a
+ <property>Default</property> database. Right click on it, select
+ <property>Connect</property> from the context menu.</para>
+
<figure>
<title>Data Source Explorer</title>
<mediaobject>
@@ -571,14 +648,14 @@
</imageobject>
</mediaobject>
</figure>
-
+
</section>
-
+
<section id="browsing_workshop_db2">
<title>Browse Workshop Database</title>
-
+
<para>Then in the current view, drill down to the <property>CUSTOMERS</property> table.</para>
-
+
<figure>
<title>"CUSTOMERS" Table</title>
<mediaobject>
@@ -587,13 +664,16 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>Right click on <property>CUSTOMERS</property>, select <emphasis><property>Data > Sample Contents</property></emphasis> to view the data in the table.</para>
-
- <para>There should be a SQL Results view on the workbench, but it could be hidden.
- Click on the <property>"Result1"</property> tab in the right side and you should see the data in the CUSTOMERS table.</para>
-
-
+
+ <para>Right click on <property>CUSTOMERS</property>, select <emphasis>
+ <property>Data > Sample Contents</property>
+ </emphasis> to view the data in the table.</para>
+
+ <para>There should be a SQL Results view on the workbench, but it could be hidden. Click on
+ the <property>"Result1"</property> tab in the right side and you should
+ see the data in the CUSTOMERS table.</para>
+
+
<figure>
<title>SQL Results View</title>
<mediaobject>
@@ -602,31 +682,36 @@
</imageobject>
</mediaobject>
</figure>
-
+
<note>
<title>Note:</title>
- <para>If you can’t find the SQL Results view tab, click on <emphasis><property>Window > Show View > Other > SQL Development > SQL Results</property>.</emphasis></para>
+ <para>If you can’t find the SQL Results view tab, click on <emphasis><property>Window > Show
+ View > Other > SQL Development > SQL Results</property>.</emphasis></para>
</note>
-
- <para>Congratulations! You just connected to the workshop database and queried the content using Database Explorer tools.</para>
-
+
+ <para>Congratulations! You just connected to the workshop database and queried the content
+ using Database Explorer tools.</para>
+
</section>
-
+
</section>
<section id="db_programming">
<title>Database Programming</title>
-
- <para>Now, it’s time to reverse engineer the workshop database into a fully functioning Seam CRUD(Create
- Read Update Delete) application.</para>
-
+
+ <para>Now, it’s time to reverse engineer the workshop database into a fully functioning Seam
+ CRUD(Create Read Update Delete) application.</para>
+
<section id="reverse_engineer_crud">
<title>Reverse Engineer CRUD from a Running Database</title>
-
- <para>In JBoss Developer Studio, switch to Seam perspective and click on <emphasis><property>File > New > Seam Generate Entities</property>.</emphasis></para>
-
- <para>In the Seam Generate Entities wizard, select "workshop" project using the <property>Browse</property> button. There is no need to change something more, click on <property>Finish</property>.</para>
-
+
+ <para>In JBoss Developer Studio, switch to Seam perspective and click on
+ <emphasis><property>File > New > Seam Generate Entities</property>.</emphasis></para>
+
+ <para>In the Seam Generate Entities wizard, select "workshop" project using
+ the <property>Browse</property> button. There is no need to change something more, click on
+ <property>Finish</property>.</para>
+
<figure>
<title>Generate Seam Entities</title>
<mediaobject>
@@ -635,10 +720,11 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>After running the Generate Entities action, you will see new <emphasis><property>org.domain.workshop.entity</property></emphasis> classes.
- These classes represent insert/update/delete/query logic.</para>
-
+
+ <para>After running the Generate Entities action, you will see new <emphasis>
+ <property>org.domain.workshop.entity</property>
+ </emphasis> classes. These classes represent insert/update/delete/query logic.</para>
+
<figure>
<title>org.domain.workshop.entity Classes</title>
<mediaobject>
@@ -647,16 +733,20 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>There are also <emphasis><property>org.domain.workshop.entity</property></emphasis> package that contains the JPA classes. These are the entity
- beans that are mapped to database tables.</para>
-
- <para>Last, but not least, there are facelets for all of the CRUD screens. The best way to get a feel for the generated
- code is to open a browser and play around with the application. Go to <emphasis><property>http://localhost:8080/workshop</property></emphasis>
- and insert/update/delete/query a few records. There is quite a bit of AJAX in this application, but
- which we will explore further later on in the lab. For now, take note of the page tabs, required field logic
- and data table sorting in the list pages. </para>
-
+
+ <para>There are also <emphasis>
+ <property>org.domain.workshop.entity</property>
+ </emphasis> package that contains the JPA classes. These are the entity beans that are
+ mapped to database tables.</para>
+
+ <para>Last, but not least, there are facelets for all of the CRUD screens. The best way to get
+ a feel for the generated code is to open a browser and play around with the application. Go
+ to <emphasis>
+ <property>http://localhost:8080/workshop</property>
+ </emphasis> and insert/update/delete/query a few records. There is quite a bit of AJAX in
+ this application, but which we will explore further later on in the lab. For now, take note
+ of the page tabs, required field logic and data table sorting in the list pages. </para>
+
<figure>
<title>CustomersList.xhtml in the Editor</title>
<mediaobject>
@@ -665,19 +755,21 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>Congratulations! You now have a fully functioning CRUD application
- that is already AJAX enabled.</para>
-
+
+ <para>Congratulations! You now have a fully functioning CRUD application that is already AJAX
+ enabled.</para>
+
</section>
-
+
<section id="use_hibernate_tools">
<title>Use Hibernate Tools to Query Data via JPA</title>
-
- <para>Now, it’s time to write some JPA queries using the Hibernate Tools perspective in JBoss Developer Studio.</para>
- <para>In the upper right corner of the workbench there is a small <property>>></property>, click on it and choose <property>Hibernate</property>.</para>
-
- <figure>
+
+ <para>Now, it’s time to write some JPA queries using the Hibernate Tools perspective in JBoss
+ Developer Studio.</para>
+ <para>In the upper right corner of the workbench there is a small <property>>></property>,
+ click on it and choose <property>Hibernate</property>.</para>
+
+ <figure>
<title>Hibernate Perspective</title>
<mediaobject>
<imageobject>
@@ -685,10 +777,11 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>Look at the Hibernate Configurations view. In the "workshop" project, drill down on the
- <property>Session Factory</property> and notice that the JPA entities/attributes are listed in a nice tree view.</para>
-
+
+ <para>Look at the Hibernate Configurations view. In the "workshop" project,
+ drill down on the <property>Session Factory</property> and notice that the JPA
+ entities/attributes are listed in a nice tree view.</para>
+
<figure>
<title>Hibernate Configurations View</title>
<mediaobject>
@@ -697,12 +790,13 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>Right click on the <property>Session Factory</property> and select <property>HQL Editor</property>. This will open a JPA query scratch pad
- window.</para>
-
- <para>Write your query and click on the "Hibernate Dynamic SQL Preview" tab. You should see the SQL that will be executed if this JPA query is run.</para>
-
+
+ <para>Right click on the <property>Session Factory</property> and select <property>HQL
+ Editor</property>. This will open a JPA query scratch pad window.</para>
+
+ <para>Write your query and click on the "Hibernate Dynamic SQL Preview" tab.
+ You should see the SQL that will be executed if this JPA query is run.</para>
+
<figure>
<title>JPA Query Editor</title>
<mediaobject>
@@ -711,13 +805,14 @@
</imageobject>
</mediaobject>
</figure>
-
+
<para>Run the query by clicking on the green run icon.</para>
-
- <para>The results are listed in the "Hibernate Query Result" tab. There is a "Properties" tab in the workbench
- that can be used to see a specific JPA result. These results represent the JPA objects because our
- query did not specify column names.</para>
-
+
+ <para>The results are listed in the "Hibernate Query Result" tab. There is a
+ "Properties" tab in the workbench that can be used to see a specific JPA
+ result. These results represent the JPA objects because our query did not specify column
+ names.</para>
+
<figure>
<title>Hibernate Query Result View</title>
<mediaobject>
@@ -726,9 +821,10 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>The query can be refined, and take note that there is nice code completion in the JPA query editor.</para>
-
+
+ <para>The query can be refined, and take note that there is nice code completion in the JPA
+ query editor.</para>
+
<figure>
<title>Code Completion</title>
<mediaobject>
@@ -737,9 +833,10 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>A refined query will return results that are more ResultSet oriented. Notice the join logic that JPA supports.</para>
-
+
+ <para>A refined query will return results that are more ResultSet oriented. Notice the join
+ logic that JPA supports.</para>
+
<figure>
<title>The Results</title>
<mediaobject>
@@ -748,14 +845,15 @@
</imageobject>
</mediaobject>
</figure>
-
-
- <para>There was no need to specify an <property>Employees</property> table in the <property>from</property> part of the JPA query because JPA supports
- reference traversal via Java class attribute references. Not only are JPA and HQL queries fully supported,
- but Criteria based queries can also be written in the Criteria Editor. You should spend some time
- tinkering with different queries and possibly Criteria based queries, even though the instructions are not
- provided in this lab.</para>
-
+
+
+ <para>There was no need to specify an <property>Employees</property> table in the
+ <property>from</property> part of the JPA query because JPA supports reference traversal
+ via Java class attribute references. Not only are JPA and HQL queries fully supported, but
+ Criteria based queries can also be written in the Criteria Editor. You should spend some
+ time tinkering with different queries and possibly Criteria based queries, even though the
+ instructions are not provided in this lab.</para>
+
<figure>
<title>Criteria Editor</title>
<mediaobject>
@@ -764,17 +862,19 @@
</imageobject>
</mediaobject>
</figure>
-
+
</section>
-
+
<section id="use_hibernate_to_vizualize">
<title>Use Hibernate Tools to visualize the Data Model</title>
-
+
<para>Now, it’s time to view the data model for the workshop database.</para>
-
- <para>In the Hibernate Configurations view, select "workshop" project and expand the <property>Configuration</property> node.
- Select the <property>Customers</property> entity, right click on it, choose <property>Open Mapping Diagram</property>.</para>
-
+
+ <para>In the Hibernate Configurations view, select "workshop" project and
+ expand the <property>Configuration</property> node. Select the
+ <property>Customers</property> entity, right click on it, choose <property>Open Mapping
+ Diagram</property>.</para>
+
<figure>
<title>Mapping Diagram Opening</title>
<mediaobject>
@@ -783,13 +883,13 @@
</imageobject>
</mediaobject>
</figure>
-
-
- <para>You see a Diagram tab for the CUSTOMERS table and any tables that have FK references. This is a
- handy way to view the data model and JPA mappings. Now, you’ve got access to something that the Erwin
- Data Modeler can’t do.</para>
-
-
+
+
+ <para>You see a Diagram tab for the CUSTOMERS table and any tables that have FK references.
+ This is a handy way to view the data model and JPA mappings. Now, you’ve got access to
+ something that the Erwin Data Modeler can’t do.</para>
+
+
<figure>
<title>Diagram Tab</title>
<mediaobject>
@@ -798,24 +898,26 @@
</imageobject>
</mediaobject>
</figure>
-
+
</section>
- </section>
+ </section>
-
+
<section id="rich_components">
<title>Rich Components</title>
-
- <para>This lab will conclude with one last AJAX twist. In this section we add a RichFaces <property>inputNumberSlider</property> to the Order
- Details edit screen.</para>
-
+
+ <para>This lab will conclude with one last AJAX twist. In this section we add a RichFaces
+ <property>inputNumberSlider</property> to the Order Details edit screen.</para>
+
<section id="add_richfaces">
<title>Add a Richfaces component to the CRUD Application</title>
-
- <para>Switch to Seam perspective, open <emphasis><property>WebContent/OrderdetailsEdit.xhtml</property></emphasis> in JBoss Developer Studio.</para>
- <para>Change the form field values using the visual editor. Seam has generated the form field names that match the
- database column names. This is not ideal for business users.</para>
-
+
+ <para>Switch to Seam perspective, open <emphasis>
+ <property>WebContent/OrderdetailsEdit.xhtml</property>
+ </emphasis> in JBoss Developer Studio.</para>
+ <para>Change the form field values using the visual editor. Seam has generated the form field
+ names that match the database column names. This is not ideal for business users.</para>
+
<figure>
<title>Form Fields Editing</title>
<mediaobject>
@@ -824,10 +926,11 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>Also, replace the QTY Ordered input field with a <property>inputNumberSlider</property>. You can use the JBoss Developer
- Studio palette or right click on the form and insert the RichFaces component.</para>
-
+
+ <para>Also, replace the QTY Ordered input field with a <property>inputNumberSlider</property>.
+ You can use the JBoss Developer Studio palette or right click on the form and insert the
+ RichFaces component.</para>
+
<figure>
<title>RichFaces Component Inserting</title>
<mediaobject>
@@ -836,12 +939,13 @@
</imageobject>
</mediaobject>
</figure>
-
- <para>One the last option is to use the source view and manually copy the inputNumberSlider markup listed below:</para>
-
+
+ <para>One the last option is to use the source view and manually copy the inputNumberSlider
+ markup listed below:</para>
+
<programlisting><![CDATA[<rich:inputNumberSlider id="quantityOrdered" required="true"
value="#{orderdetailsHome.instance.quantityordered}"/>]]></programlisting>
-
+
<figure>
<title>Adding the Source</title>
<mediaobject>
@@ -850,9 +954,9 @@
</imageobject>
</mediaobject>
</figure>
-
+
<para>The end result is an edit page that has better form labels and a new RichFaces control.</para>
-
+
<figure>
<title>The Result Page</title>
<mediaobject>
@@ -861,11 +965,50 @@
</imageobject>
</mediaobject>
</figure>
-
+
<para>Congratulations! You have completed the JBoss Developer Studio lab.</para>
-
+
</section>
-
- </section>
-
+
+ </section>
+
+ <!--section id="gsg_seam_faq">
+ <title>FAQ</title>
+ <para>For more information on work with Seam in JBoss Developer Studio, refer to the following
+ FAQ to get the answers on the most "popular" questions.</para>
+
+ <para><emphasis role="bold">How to import an example Seam project from jboss-eap directory?</emphasis></para>
+
+ <para>To import an example Seam project from <emphasis>
+ <property>jboss-eap</property>
+ </emphasis> into your working directory, you should perform the following steps:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Go to <emphasis>
+ <property>New > Other > Java Project from Existing Buildfile</property>
+ </emphasis></para>
+ </listitem>
+
+ <listitem>
+ <para>Point to the <emphasis>
+ <property>build.xml</property>
+ </emphasis> of any chosen project by pressing <emphasis>
+ <property>Browse</property>
+ </emphasis> button</para>
+ </listitem>
+
+ <listitem>
+ <para>Hit <emphasis>
+ <property>Finish</property>
+ </emphasis> to open the project</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>As these seam examples are non WTP projects, next you should enable Seam support for
+ them. To do that, right click the project and go to<emphasis>
+ <property>Properties > Seam Settings</property>. </emphasis></para>
+
+ </section-->
+
</chapter>
15 years, 11 months
JBoss Tools SVN: r8444 - trunk/documentation/jboss-tools-docs.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-05-29 11:21:06 -0400 (Thu, 29 May 2008)
New Revision: 8444
Removed:
trunk/documentation/jboss-tools-docs/index.html
Log:
http://jira.jboss.com/jira/browse/JBDS-344 - deleting old index
Deleted: trunk/documentation/jboss-tools-docs/index.html
===================================================================
--- trunk/documentation/jboss-tools-docs/index.html 2008-05-29 15:08:15 UTC (rev 8443)
+++ trunk/documentation/jboss-tools-docs/index.html 2008-05-29 15:21:06 UTC (rev 8444)
@@ -1,40 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="en/http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="en/Books on JBoss tools" content="en/text/html; charset=iso-8859-1" />
-<title>JBoss Tools Guides</title>
-</head>
-
- <body>
-
- <h1>JBoss Tools Guides - Latest Version:</h1>
-
-<ul class="en/linkage">
-
- <li>Getting Started with JBoss Developer Studio Guide <a href="en/GettingStartedGuide/html/index.html">(html)</a> <a href="en/GettingStartedGuide/html_single/index.html">(html single)</a> <a href="en/GettingStartedGuide/pdf/Getting_Started_Guide.pdf">(pdf)</a></li>
-
- <li>Seam Dev Tools Reference Guide<a href="en/seam/html/index.html">(html)</a> <a href="en/seam/html_single/index.html">(html single)</a> <a href="en/seam/pdf/Seam_Reference_Guide.pdf">(pdf)</a></li>
-
- <li>Visual Web Tools Reference Guide <a href="en/jsf/html/index.html">(html)</a> <a href="en/jsf/html_single/index.html">(html single)</a> <a href="en/jsf/pdf/Visual_Web_Tools_Reference_Guide.pdf">(pdf)</a></li>
-
- <li>JBoss Server Manager Reference Guide<a href="en/as/html/index.html">(html)</a> <a href="en/as/html_single/index.html">(html single)</a> <a href="en/as/pdf/AS_Reference_Guide.pdf">(pdf)</a></li>
-
- <li>jBPM Tools Reference Guide<a href="en/jbpm/html/index.html">(html)</a> <a href="en/jbpm/html_single/index.html">(html single)</a> <a href="en/jbpm/pdf/JBPM_Reference_Guide.pdf">(pdf)</a></li>
-
- <li>Hibernate Tools Reference Guide<a href="en/hibernatetools/html/index.html">(html)</a> <a href="en/hibernatetools/html_single/index.html">(html single)</a> <a href="en/hibernatetools/pdf/Hibernatetools_Reference_Guide.pdf">(pdf)</a></li>
-
- <li> ESB Editor Reference Guide<a href="en/esb_ref_guide/html/index.html">(html)</a> <a href="en/esb_ref_guide/html_single/index.html">(html single)</a> <a href="en/esb_ref_guide/pdf/Hibernatetools_Reference_Guide.pdf">(pdf)</a></li>
-
- <li>JSF Tools Reference Guide<a href="en/jsf_tools_ref_guide/html/index.html">(html)</a> <a href="en/jsf_tools_ref_guide/html_single/index.html">(html single)</a> <a href="en/jsf_tools_ref_guide/pdf/JSF_Tools_Reference_Guide.pdf">(pdf)</a></li>
- <li>JSF Tools Tutorial<a href="en/jsf_tools_tutorial/html/index.html">(html)</a> <a href="en/jsf_tools_tutorial/html_single/index.html">(html single)</a> <a href="en/jsf_tools_tutorial/pdf/JSF_Tools_Tutorial.pdf">(pdf)</a></li>
-
- <li>Struts Tools Reference Guide<a href="en/struts_tools_ref_guide/html/index.html">(html)</a> <a href="en/struts_tools_ref_guide/html_single/index.html">(html single)</a> <a href="en/struts_tools_ref_guide/pdf/Struts_Tools_Reference_Guide.pdf">(pdf)</a></li>
- <li>Struts Tools Tutorial<a href="en/struts_tools_tutorial/html/index.html">(html)</a> <a href="en/struts_tools_tutorial/html_single/index.html">(html single)</a> <a href="en/struts_tools_tutorial/pdf/Struts_Tools_Tutorial.pdf">(pdf)</a></li>
-
- <li>Exadel Studio Migration Guide <a href="en/Exadel-migration/html/index.html">(html)</a> <a href="en/Exadel-migration/html_single/index.html">(html single)</a> <a href="en/Exadel-migration/pdf/Exadel_Studio_Migration_Guide.pdf">(pdf)</a></li>
-
-</ul>
-
-
-</body>
-</html>
15 years, 11 months
JBoss Tools SVN: r8443 - in trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor: edit and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2008-05-29 11:08:15 -0400 (Thu, 29 May 2008)
New Revision: 8443
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/ConnectionCommand.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/ReconnectSourceLinkCommand.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/ReconnectTargetLinkCommand.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PagesNodeEditPolicy.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PagesEditPart.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1189
Added: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/ConnectionCommand.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/ConnectionCommand.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/ConnectionCommand.java 2008-05-29 15:08:15 UTC (rev 8443)
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.pages.editor.commands;
+
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.seam.ui.pages.editor.dnd.DndHelper;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Link;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesElement;
+import org.jboss.tools.seam.ui.pages.editor.edit.PagesEditPart;
+
+
+public class ConnectionCommand extends Command {
+ protected PagesEditPart oldSource;
+ protected String oldSourceTerminal;
+ protected PagesEditPart oldTarget;
+ protected String oldTargetTerminal;
+ protected PagesEditPart source;
+ protected String sourceTerminal;
+ protected PagesEditPart target;
+ protected String targetTerminal;
+ protected Link link;
+
+ public ConnectionCommand() {
+ super("connection command");
+ }
+
+ public boolean canExecute() {
+ if (target == null)
+ return false;
+ if (target.getModel() == null)
+ return false;
+ return DndHelper
+ .isDropEnabled(((PagesElement) target.getModel()).getData());
+ }
+
+ public void execute() {
+ DndHelper.drop(((PagesElement) target.getModel()).getData());
+ }
+
+ public String getLabel() {
+ return "connection command";
+ }
+
+ public PagesEditPart getSource() {
+ return source;
+ }
+
+ public java.lang.String getSourceTerminal() {
+ return sourceTerminal;
+ }
+
+ public PagesEditPart getTarget() {
+ return target;
+ }
+
+ public String getTargetTerminal() {
+ return targetTerminal;
+ }
+
+ public Link getLink() {
+ return link;
+ }
+
+ public void setSource(PagesEditPart newSource) {
+ source = newSource;
+ }
+
+ public void setSourceTerminal(String newSourceTerminal) {
+ sourceTerminal = newSourceTerminal;
+ }
+
+ public void setTarget(PagesEditPart newTarget) {
+ target = newTarget;
+ }
+
+ public void setTargetTerminal(String newTargetTerminal) {
+ targetTerminal = newTargetTerminal;
+ }
+
+ public void setLink(Link l) {
+ link = l;
+ }
+
+ public boolean canUndo() {
+ return false;
+ }
+
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/ReconnectSourceLinkCommand.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/ReconnectSourceLinkCommand.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/ReconnectSourceLinkCommand.java 2008-05-29 15:08:15 UTC (rev 8443)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.pages.editor.commands;
+
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.seam.ui.pages.editor.dnd.DndHelper;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Link;
+
+
+public class ReconnectSourceLinkCommand extends Command{
+
+ static Link child = null;
+
+ public ReconnectSourceLinkCommand(){
+ super("ReconnectSourceLinkCommand");
+ }
+
+ public void setLink(Link child){
+ ReconnectSourceLinkCommand.child= child;
+ }
+ public boolean canExecute(){
+ return DndHelper.isDropEnabled(child.getData());
+ }
+
+ public void execute(){
+ if(child != null)DndHelper.drop(child.getData());
+ child = null;
+ }
+
+ public boolean canUndo() {
+ return false;
+ }
+}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/ReconnectTargetLinkCommand.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/ReconnectTargetLinkCommand.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/ReconnectTargetLinkCommand.java 2008-05-29 15:08:15 UTC (rev 8443)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.pages.editor.commands;
+
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.seam.ui.pages.editor.dnd.DndHelper;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesElement;
+
+
+public class ReconnectTargetLinkCommand extends Command{
+
+ PagesElement child = null;
+
+ public ReconnectTargetLinkCommand(){
+ super("ReconnectTargetLinkCommand");
+ }
+
+ public void setChild(PagesElement child){
+ this.child= child;
+ }
+
+ public boolean canExecute(){
+ return DndHelper.isDropEnabled(child.getData());
+ }
+
+ public void execute(){
+ DndHelper.drop(child.getData());
+ }
+
+ public boolean canUndo() {
+ return false;
+ }
+}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PagesEditPart.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PagesEditPart.java 2008-05-29 14:57:32 UTC (rev 8442)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PagesEditPart.java 2008-05-29 15:08:15 UTC (rev 8443)
@@ -22,6 +22,7 @@
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.*;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesElement;
import org.jboss.tools.seam.ui.pages.editor.figures.NodeFigure;
abstract public class PagesEditPart extends
@@ -42,6 +43,10 @@
super.activate();
}
+ public PagesElement getElementModel(){
+ return (PagesElement)getModel();
+ }
+
/**
*
* @return
@@ -56,8 +61,8 @@
*/
protected void createEditPolicies() {
// installEditPolicy(EditPolicy.COMPONENT_ROLE, new JSFElementEditPolicy());
-// installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE,
-// new JSFNodeEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE,
+ new PagesNodeEditPolicy());
}
/**
@@ -125,6 +130,15 @@
public void propertyChange(PropertyChangeEvent evt) {
refreshVisuals();
}
+
+ /**
+ *
+ * @param c
+ * @return
+ */
+ final protected String mapConnectionAnchorToTerminal(ConnectionAnchor c) {
+ return getNodeFigure().getConnectionAnchorName(c);
+ }
/**
*
Added: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PagesNodeEditPolicy.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PagesNodeEditPolicy.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/edit/PagesNodeEditPolicy.java 2008-05-29 15:08:15 UTC (rev 8443)
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.pages.editor.edit;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.PolylineConnection;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy;
+import org.eclipse.gef.requests.CreateConnectionRequest;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.seam.ui.pages.editor.commands.ConnectionCommand;
+import org.jboss.tools.seam.ui.pages.editor.dnd.DndHelper;
+import org.jboss.tools.seam.ui.pages.editor.figures.FigureFactory;
+import org.jboss.tools.seam.ui.pages.editor.figures.NodeFigure;
+
+public class PagesNodeEditPolicy extends
+ GraphicalNodeEditPolicy {
+
+ /**
+ *
+ */
+ protected Connection createDummyConnection(Request req) {
+ PolylineConnection dummyConn = FigureFactory.createNewLink(null);
+ return dummyConn;
+ }
+
+ /**
+ *
+ */
+ protected Command getConnectionCompleteCommand(
+ CreateConnectionRequest request) {
+ if (getPagesEditPart() instanceof PageEditPart) {
+ if (!DndHelper
+ .isDropEnabled((XModelObject) ((PageEditPart) getPagesEditPart())
+ .getPageModel().getData()))
+ return null;
+ } else if (getPagesEditPart() instanceof PagesEditPart) {
+ if (!DndHelper
+ .isDropEnabled((XModelObject) ((PagesEditPart) getPagesEditPart())
+ .getElementModel().getData()))
+ return null;
+ }
+ ConnectionCommand command = (ConnectionCommand) request
+ .getStartCommand();
+ command.setTarget((PagesEditPart) getPagesEditPart());
+ ConnectionAnchor ancor = getPagesEditPart().getTargetConnectionAnchor(
+ request);
+ if (ancor == null)
+ return null;
+ command.setTargetTerminal(getPagesEditPart()
+ .mapConnectionAnchorToTerminal(ancor));
+ return command;
+ }
+
+ /**
+ *
+ */
+ protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
+ if (getPagesEditPart() instanceof PageEditPart) {
+ if (!DndHelper
+ .drag((XModelObject) ((PageEditPart) getPagesEditPart())
+ .getPageModel().getData()))
+ return null;
+ } else if (getPagesEditPart() instanceof PagesEditPart) {
+ /*if (((PagesEditPart) getPagesEditPart()).getElementModel()
+ .getPageList().size() > 1)
+ return null;*/
+ if (!DndHelper
+ .drag((XModelObject) ((PagesEditPart) getPagesEditPart())
+ .getElementModel().getData()))
+ return null;
+ }
+ ConnectionCommand command = new ConnectionCommand();
+ command.setLink(null);
+ command.setSource((PageEditPart) getPagesEditPart());
+ ConnectionAnchor ancor = getPagesEditPart().getSourceConnectionAnchor(
+ request);
+ command.setSourceTerminal(getPagesEditPart()
+ .mapConnectionAnchorToTerminal(ancor));
+ request.setStartCommand(command);
+ return command;
+ }
+
+ /**
+ *
+ * @return
+ */
+ protected PagesEditPart getPagesEditPart() {
+ return (PagesEditPart) getHost();
+ }
+
+ /**
+ *
+ */
+ protected Command getReconnectTargetCommand(ReconnectRequest request) {
+ return null;
+ }
+
+ /**
+ *
+ */
+ protected Command getReconnectSourceCommand(ReconnectRequest request) {
+ return null;
+ }
+
+ /**
+ *
+ * @return
+ */
+ protected NodeFigure getNodeFigure() {
+ return (NodeFigure) ((GraphicalEditPart) getHost()).getFigure();
+ }
+
+}
\ No newline at end of file
15 years, 11 months
JBoss Tools SVN: r8442 - trunk/jst/plugins/org.jboss.tools.jst.jsp.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2008-05-29 10:57:32 -0400 (Thu, 29 May 2008)
New Revision: 8442
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
Log:
JBIDE-2257 Invalid preference page path: XML Occurrences and JSP Occurrences
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2008-05-29 14:53:26 UTC (rev 8441)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2008-05-29 14:57:32 UTC (rev 8442)
@@ -104,7 +104,7 @@
<!-- Additional JSP/HTML PREFERENCE PAGES -->
<page
name="%JSP_Occurrences.name"
- category="org.eclipse.wst.sse.ui.preferences.jsp"
+ category="org.eclipse.jst.jsp.ui.preferences.jsp"
class="org.jboss.tools.jst.jsp.preferences.JSPOccurrencesPreferencePage"
id="org.eclipse.wst.sse.ui.preferences.jsp.occurrences">
</page>
15 years, 11 months