JBoss Tools SVN: r19487 - trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/META-INF.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2009-12-20 14:12:42 -0500 (Sun, 20 Dec 2009)
New Revision: 19487
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/META-INF/MANIFEST.MF
Log:
https://jira.jboss.org/jira/browse/JBIDE-4758
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/META-INF/MANIFEST.MF 2009-12-20 11:06:37 UTC (rev 19486)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/META-INF/MANIFEST.MF 2009-12-20 19:12:42 UTC (rev 19487)
@@ -11,7 +11,8 @@
org.eclipse.jface.text,
org.jboss.tools.common.text.ext,
org.jboss.tools.jst.text.ext,
- org.jboss.tools.jsf
+ org.jboss.tools.jsf,
+ org.jboss.tools.common.el.core
Export-Package: org.jboss.tools.jsf.text.ext,
org.jboss.tools.jsf.text.ext.hyperlink
Bundle-Version: 2.0.0
15 years
JBoss Tools SVN: r19486 - trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2009-12-20 06:06:37 -0500 (Sun, 20 Dec 2009)
New Revision: 19486
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlink.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4758
Added: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlink.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlink.java 2009-12-20 11:06:37 UTC (rev 19486)
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.text.ext.hyperlink;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.Region;
+import org.eclipse.ui.IEditorPart;
+import org.jboss.tools.common.el.core.model.ELExpression;
+import org.jboss.tools.common.el.core.model.ELInvocationExpression;
+import org.jboss.tools.common.el.core.resolver.ELContext;
+import org.jboss.tools.common.el.core.resolver.ELResolution;
+import org.jboss.tools.common.el.core.resolver.ELResolver;
+import org.jboss.tools.common.el.core.resolver.ELSegment;
+import org.jboss.tools.common.el.core.resolver.JavaMemberELSegment;
+import org.jboss.tools.common.text.ext.ExtensionsPlugin;
+import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
+import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
+import org.jboss.tools.jst.web.kb.PageContextFactory;
+
+/**
+ * @author Daniel
+ */
+public class JSPExprHyperlink extends AbstractHyperlink{
+ private String hyperlinkText = ""; //$NON-NLS-1$
+ private ELExpression expression;
+ ELInvocationExpression invocationExpression;
+
+ protected IRegion doGetHyperlinkRegion(int offset) {
+ expression = JSPExprHyperlinkPartitioner.getExpression(getDocument(), offset);
+ invocationExpression = getInvocationExpression(expression, offset);
+ if(invocationExpression != null){
+ Region region = new Region(invocationExpression.getStartPosition(), invocationExpression.getLength());
+ return region;
+ }
+ return null;
+ }
+
+ private ELInvocationExpression getInvocationExpression(ELExpression expression, int offset){
+ if(expression == null)
+ return null;
+
+ for(ELInvocationExpression ie : expression.getInvocations()){
+ if (expression.getStartPosition()+ie.getStartPosition() <= offset && expression.getStartPosition()+ie.getEndPosition() >= offset) {
+ return ie;
+ }
+ }
+ return null;
+ }
+
+ protected void doHyperlink(IRegion region) {
+ IEditorPart part = null;
+ if (region == null)
+ return;
+
+ try {
+ IDocument document = getDocument();
+ hyperlinkText = document
+ .get(region.getOffset(), region.getLength());
+ } catch (BadLocationException ex) {
+ ExtensionsPlugin.getPluginLog().logError(ex);
+ }
+ if(invocationExpression != null){
+ ELContext context = PageContextFactory.getInstance().createPageContext(getFile());
+ if(context != null){
+ for(ELResolver resolver : context.getElResolvers()){
+ ELResolution resolution = resolver.resolve(context, expression, invocationExpression.getStartPosition());
+ ELSegment segment = resolution.findSegmentByOffset(invocationExpression.getStartPosition());
+ if(segment != null){
+ if(segment instanceof JavaMemberELSegment){
+ JavaMemberELSegment javaSegment = (JavaMemberELSegment)segment;
+ if(javaSegment.getJavaElement() != null){
+ try{
+ IResource resource = javaSegment.getJavaElement().getCorrespondingResource();
+ if(resource != null && resource instanceof IFile)
+ part = openFileInEditor((IFile)javaSegment.getJavaElement().getCorrespondingResource());
+ }catch(JavaModelException ex){
+ JSFExtensionsPlugin.log(ex);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if (part == null)
+ openFileFailed();
+ }
+
+ public String getHyperlinkText() {
+ return hyperlinkText;
+ }
+
+}
Property changes on: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlink.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java 2009-12-19 18:52:53 UTC (rev 19485)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java 2009-12-20 11:06:37 UTC (rev 19486)
@@ -10,22 +10,22 @@
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
+import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.IDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMText;
+import org.jboss.tools.common.el.core.ELReference;
+import org.jboss.tools.common.el.core.model.ELExpression;
+import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IExclusiblePartitionerRecognition;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
+import org.jboss.tools.jst.web.kb.PageContextFactory;
/**
- * @author Jeremy
+ * @author Jeremy and Daniel
*/
@SuppressWarnings("restriction")
public class JSPExprHyperlinkPartitioner extends AbstractHyperlinkPartitioner implements IHyperlinkPartitionRecognizer, IExclusiblePartitionerRecognition {
@@ -39,28 +39,17 @@
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- smw.init(document);
- try {
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
-
- IHyperlinkRegion r = getRegion(document, superRegion.getOffset());
- if (r == null) return null;
+ IHyperlinkRegion r = getRegion(document, superRegion.getOffset());
+ if (r == null) return null;
- String axis = getAxis(document, superRegion);
- String contentType = superRegion.getContentType();
- String type = getPartitionType();
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
-
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
- } finally {
- smw.dispose();
- }
+ String axis = getAxis(document, superRegion);
+ String contentType = superRegion.getContentType();
+ String type = getPartitionType();
+ int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
+ int offset = superRegion.getOffset();
+
+ IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
+ return region;
}
protected String getAxis(IDocument document, IHyperlinkRegion superRegion) {
@@ -70,81 +59,45 @@
return superRegion.getAxis();
}
-
private IHyperlinkRegion getRegion(IDocument document, final int offset) {
+ ELExpression expression = getExpression(document, offset);
+ if(expression != null){
+ IHyperlinkRegion region = new HyperlinkRegion(expression.getStartPosition(), expression.getLength(), null, null, null);
+ return region;
+ }
+ return null;
+ }
+
+ public static ELExpression getExpression(IDocument document, final int offset){
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
try {
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null || !(n instanceof IDOMAttr || n instanceof IDOMText)) return null;
-
- int valStart = Utils.getValueStart(n);
- int valEnd = Utils.getValueEnd(n);
- if(valStart < 0 || valStart > offset) return null;
-
- String valText = (n instanceof IDOMAttr)?
- ((IDOMAttr)n).getValueRegionText():
- ((IDOMText)n).getData();
- if (valText == null)
- return null;
-
- int startBracket = 0;
- int exprStart = 0;
- int exprLength = 0;
- while (startBracket != -1) {
- int v = valText.indexOf("#{", startBracket + exprLength); //$NON-NLS-1$
- if (v == -1) v = valText.indexOf("${", startBracket + exprLength); //$NON-NLS-1$
- if (v == -1) return null;
- startBracket = v;
-
- int endBracket = valText.indexOf("}", startBracket + 2); //$NON-NLS-1$
- exprStart = valStart + startBracket + 2;
- int exprEnd = (endBracket == -1 ? valEnd - 1: valStart + endBracket);
- int lineBreaker = valText.indexOf('\n', startBracket + 2);
- int lineBreaker1 = valText.indexOf('\r', startBracket + 2);
- if (lineBreaker != -1 && lineBreaker + valStart < exprEnd) exprEnd = valStart + lineBreaker;
- if (lineBreaker1 != -1 && lineBreaker1 + valStart < exprEnd) exprEnd = valStart + lineBreaker1;
- exprLength = exprEnd - exprStart;
+ IFile file = smw.getFile();
+ ELContext context = PageContextFactory.getInstance().createPageContext(file);
+ if(context != null){
- if(exprLength<=0) {
- return null;
- } else if (exprStart <= offset && exprEnd >= offset) {
- int start = exprStart;
- int length = exprLength;
-
- IHyperlinkRegion region = new HyperlinkRegion(start, length, null, null, null);
- return region;
+ ELReference[] references = context.getELReferences();
+
+ for(ELReference reference : references){
+ for(ELExpression expression : reference.getEl()){
+ if (reference.getStartPosition()+expression.getStartPosition() <= offset && reference.getStartPosition()+expression.getEndPosition() >= offset)
+ return expression;
+ }
}
}
return null;
} finally {
smw.dispose();
}
-
}
-
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
public boolean recognize(IDocument document, IHyperlinkRegion region) {
if(document == null || region == null) return false;
- StructuredModelWrapper smw = new StructuredModelWrapper();
- smw.init(document);
- try {
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return false;
-
- Utils.findNodeForOffset(xmlDocument, region.getOffset());
-
- return (getRegion(document, region.getOffset()) != null);
- } finally {
- smw.dispose();
- }
+
+ return (getRegion(document, region.getOffset()) != null);
}
public boolean excludes(String partitionType, IDocument document, IHyperlinkRegion superRegion) {
15 years
JBoss Tools SVN: r19485 - in trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor: wizards and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2009-12-19 13:52:53 -0500 (Sat, 19 Dec 2009)
New Revision: 19485
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateFileList.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesWizard.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesWizardPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2795, import wizard was updated.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateFileList.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateFileList.java 2009-12-19 10:26:20 UTC (rev 19484)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateFileList.java 2009-12-19 18:52:53 UTC (rev 19485)
@@ -36,13 +36,8 @@
}
void load() {
- VpeTemplateFile newAutoTemplateFile = null;
- try {
- newAutoTemplateFile = new VpeTemplateFile(
- VpeTemplateManager.getAutoTemplates(), null);
- } catch (IOException e) {
- VpePlugin.getPluginLog().logError("Default template for unknown tags loading error ",e); //$NON-NLS-1$
- }
+ VpeTemplateFile newAutoTemplateFile = new VpeTemplateFile(
+ VpeTemplateManager.getAutoTemplates(), null);
changed = (autoTemplateFile == null) != (newAutoTemplateFile == null);
if (!changed && autoTemplateFile != null) {
changed = !autoTemplateFile.isEqual(newAutoTemplateFile);
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java 2009-12-19 10:26:20 UTC (rev 19484)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeTemplateManager.java 2009-12-19 18:52:53 UTC (rev 19485)
@@ -296,6 +296,9 @@
*/
private static final String NAMESPACE_IDENTIFIER_ATTRIBUTE = "namespaceIdentifier"; //$NON-NLS-1$
+ private static final IPath DEFAULT_AUTO_TEMPLATES_PATH = VpePlugin.getDefault()
+ .getStateLocation().append(VPE_TEMPLATES_AUTO);
+
private VpeTemplateManager() {
// singleton
}
@@ -544,7 +547,7 @@
String elementName = data.getName();
boolean caseSensitive = data.isCaseSensitive();
- Element root = loadAutoTemplate();
+ Element root = loadAutoTemplate(DEFAULT_AUTO_TEMPLATES_PATH);
if (root == null) {
root = XMLUtilities.createDocumentElement(TAG_TEMPLATES);
}
@@ -589,7 +592,7 @@
root = appendTaglib(prefixSet, document, root, data);
try {
- IPath path = getAutoTemplates();
+ IPath path = getAutoTemplates(DEFAULT_AUTO_TEMPLATES_PATH);
XMLUtilities.serialize(root, path.toOSString());
} catch(IOException e) {
VpePlugin.reportProblem(e);
@@ -625,10 +628,13 @@
}
public List<VpeAnyData> getAnyTemplates() {
+ return getAnyTemplates(DEFAULT_AUTO_TEMPLATES_PATH);
+ }
+ public List<VpeAnyData> getAnyTemplates(IPath path) {
List<VpeAnyData> anyTemplateList = new ArrayList<VpeAnyData>();
Map<String,Node> taglibs = new HashMap<String,Node>();
- Element root = loadAutoTemplate();
+ Element root = loadAutoTemplate(path);
if (root == null) {
root = XMLUtilities.createDocumentElement(TAG_TEMPLATES);
}
@@ -768,6 +774,10 @@
return null;
}
+ public void setAnyTemplates(List<VpeAnyData> templates) {
+ setAnyTemplates(templates, DEFAULT_AUTO_TEMPLATES_PATH);
+ }
+
public void setAnyTemplates(List<VpeAnyData> templates, IPath path) {
if (templates != null) {
Set<String> prefixSet = new HashSet<String>();
@@ -792,17 +802,8 @@
}
}
}
-
- public void setAnyTemplates(List<VpeAnyData> templates) {
- IPath path;
- try {
- path = getAutoTemplates();
- setAnyTemplates(templates, path);
- } catch (IOException e) {
- VpePlugin.reportProblem(e);
- }
- }
+
static public Element createNewTagElement(Document document, VpeAnyData data) {
Element newTagElement = document.createElement(TAG_TAG);
newTagElement.setAttribute(ATTR_TAG_NAME, data.getName());
@@ -846,15 +847,10 @@
return newTaglibElement;
}
- private Element loadAutoTemplate() {
- try {
- IPath path = getAutoTemplates();
- Element root = XMLUtilities.getElement(path.toFile(), null);
- if (root != null && TAG_TEMPLATES.equals(root.getNodeName())) {
- return root;
- }
- } catch (IOException e) {
- VpePlugin.reportProblem(e);
+ private Element loadAutoTemplate(IPath path) {
+ Element root = XMLUtilities.getElement(path.toFile(), null);
+ if (root != null && TAG_TEMPLATES.equals(root.getNodeName())) {
+ return root;
}
return null;
}
@@ -1056,7 +1052,7 @@
return defaultTextFormattingData;
}
-
+
/**
* Returns the user's template file path.
* <P>
@@ -1070,21 +1066,27 @@
* @see <a href="https://jira.jboss.org/jira/browse/JBIDE-4131" >
JBIDE-4131: Change saving of vpe auto templates</a>
*/
- public static IPath getAutoTemplates() throws IOException {
- final IPath workspaceTemplatePath = VpePlugin.getDefault()
- .getStateLocation().append(VPE_TEMPLATES_AUTO);
-
+ public static IPath getAutoTemplates(IPath workspaceTemplatePath) {
final File workspaceTemplateFile = workspaceTemplatePath.toFile();
if (!workspaceTemplateFile.exists()) {
- final IPath dafaultTemplatePath = VpeTemplateFileList
- .getFilePath(EMPTY_VPE_TEMPLATES_AUTO, null);
+ IPath dafaultTemplatePath;
+ try {
+ dafaultTemplatePath = VpeTemplateFileList
+ .getFilePath(EMPTY_VPE_TEMPLATES_AUTO, null);
final File defaultTemplateFile = dafaultTemplatePath.toFile();
copy(defaultTemplateFile, workspaceTemplateFile);
+ } catch (IOException e) {
+ VpePlugin.reportProblem(e);
+ }
}
-
return workspaceTemplatePath;
}
+
+ public static IPath getAutoTemplates() {
+ return getAutoTemplates(DEFAULT_AUTO_TEMPLATES_PATH);
+ }
+
/**
* Copies {@code src} file to {@code dst} file.
* If the {@code dst} file does not exist, it is created.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesWizard.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesWizard.java 2009-12-19 10:26:20 UTC (rev 19484)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesWizard.java 2009-12-19 18:52:53 UTC (rev 19485)
@@ -32,7 +32,7 @@
* Constructor
*/
public ImportUnknownTagsTemplatesWizard() {
-
+ setWindowTitle(VpeUIMessages.IMPORT_UNKNOWN_TAGS_PAGE_TITLE);
}
public void init(IWorkbench workbench, IStructuredSelection selection) {
@@ -51,12 +51,12 @@
@Override
public boolean canFinish() {
- return false;
+ return mainPage.isPageComplete();
}
@Override
public boolean performFinish() {
- return false;
+ return mainPage.finish();
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesWizardPage.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesWizardPage.java 2009-12-19 10:26:20 UTC (rev 19484)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesWizardPage.java 2009-12-19 18:52:53 UTC (rev 19485)
@@ -10,10 +10,37 @@
******************************************************************************/
package org.jboss.tools.vpe.editor.wizards;
+import java.io.File;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.ColumnLayoutData;
+import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTException;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.WizardResourceImportPage;
+import org.jboss.tools.vpe.editor.template.VpeAnyData;
+import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
import org.jboss.tools.vpe.messages.VpeUIMessages;
import org.jboss.tools.vpe.resref.core.ReferenceWizardPage;
@@ -26,6 +53,24 @@
public class ImportUnknownTagsTemplatesWizardPage extends
WizardResourceImportPage {
+ private static final String[] COLUMNS_NAMES = new String[] {
+ "", //$NON-NLS-1$
+ VpeUIMessages.TemplatesTableProvider_TagName,
+ VpeUIMessages.TemplatesTableProvider_TagForDisplay,
+ VpeUIMessages.TemplatesTableProvider_URI,
+ VpeUIMessages.TemplatesTableProvider_Children};
+ private static final int[] COLUMNS_WIDTHS = new int[] {
+ 15, 50, 50, 90, 30
+ };
+
+ private String pathString;
+ private Table tagsTable;
+// private TableViewer tableViewer;
+ private List<VpeAnyData> tagsList;
+ private Button selectAllButton;
+ private Button deselectAllButton;
+
+
/**
* Constructor
*
@@ -40,7 +85,247 @@
setImageDescriptor(ReferenceWizardPage.getImageDescriptor());
}
+
+
+
@Override
+ public void createControl(Composite parent) {
+ /*
+ * Create main composite element with grid layout.
+ * Two columns.
+ */
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(2, false));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ composite.setFont(parent.getFont());
+
+ /*
+ * Add path output and browse button
+ */
+ final Text pathText = new Text(composite, SWT.BORDER);
+ pathText.setEditable(false);
+ pathText.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1));
+ pathText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ pathString = ((Text)e.getSource()).getText();
+ setPageComplete(isPageComplete());
+ }
+ });
+
+ Button browseButton = new Button(composite, SWT.NONE);
+ browseButton.setText(VpeUIMessages.BROWSE_BUTTON_TEXT);
+ browseButton.setLayoutData(new GridData(SWT.NONE, SWT.NONE, false, false, 1, 1));
+ browseButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ FileDialog dialog = new FileDialog(PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell(), SWT.NONE);
+ String path = dialog.open();
+ if (path != null) {
+ File file = new File(path);
+ pathString = file.toString();
+ pathText.setText(pathString);
+ /*
+ * Load tags list from the specified location.
+ */
+ tagsList = VpeTemplateManager.getInstance().getAnyTemplates(new Path(pathString));
+ /*
+ * Update table tags list based on the loaded file.
+ */
+ updateTagsTable();
+ /*
+ * Store loaded templates to the default auto-templates location.
+ */
+ VpeTemplateManager.getInstance().setAnyTemplates(tagsList);
+ /*
+ * Check if the page is complete.
+ */
+ setPageComplete(isPageComplete());
+ }
+ }
+ });
+
+ /*
+ * Create datatable with the list of unknown tags
+ */
+ tagsTable = new Table(composite, SWT.BORDER);
+ TableLayout layout = new TableLayout();
+ tagsTable.setLayout(layout);
+ tagsTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2));
+ tagsTable.setHeaderVisible(true);
+ tagsTable.setLinesVisible(true);
+
+ /*
+ * Create columns in the table
+ */
+ ColumnLayoutData columnLayoutData;
+ for (int i = 0; i < COLUMNS_NAMES.length; i++) {
+ TableColumn column = new TableColumn(tagsTable, SWT.NONE);
+ column.setText(COLUMNS_NAMES[i]);
+ columnLayoutData = new ColumnWeightData(COLUMNS_WIDTHS[i], true);
+ layout.addColumnData(columnLayoutData);
+ }
+
+ /*
+ * Add buttons
+ */
+ selectAllButton = new Button(composite, SWT.NONE);
+ selectAllButton.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
+ selectAllButton.setText(VpeUIMessages.SELECT_ALL);
+
+ deselectAllButton = new Button(composite, SWT.NONE);
+ deselectAllButton.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
+ deselectAllButton.setText(VpeUIMessages.DESELECT_ALL);
+
+ /*
+ * Adding event listeners to the buttons
+ */
+ selectAllButton.addListener(SWT.Modify, this);
+ selectAllButton.addListener(SWT.Selection, this);
+ deselectAllButton.addListener(SWT.Modify, this);
+ deselectAllButton.addListener(SWT.Selection, this);
+
+ /*
+ * Finishing the initialization
+ */
+ setErrorMessage(null); // should not initially have error message
+ setControl(composite);
+
+ }
+
+ private void updateTagsTable() {
+ if(tagsTable == null || tagsTable.isDisposed()) {
+ return;
+ }
+ int selectionIndex = tagsTable.getSelectionIndex();
+ TableItem tableItem = null;
+ for (int i = 0; i < tagsList.size(); i++) {
+ if(tagsTable.getItemCount() > i) {
+ /*
+ * Use existed items
+ */
+ tableItem = tagsTable.getItem(i);
+ } else {
+ /*
+ * Add necessary item
+ */
+ tableItem = new TableItem(tagsTable, SWT.BORDER, i);
+ }
+ /*
+ * Fill in columns.
+ * Tags table has 5 columns with checkbox in the first column.
+ */
+ String[] itemColumnsData = new String[tagsTable.getColumnCount()];
+ itemColumnsData[0] = ""; //$NON-NLS-1$
+ for (int j = 1; j < itemColumnsData.length; j++) {
+ /*
+ * Getting values from tagList
+ */
+ itemColumnsData[j] = toVisualValue(getValueAt(i, (j-1)));
+ }
+ /*
+ * Set cells text
+ */
+ tableItem.setText(itemColumnsData);
+ /*
+ * Adding checkbox to the first column
+ */
+// TableEditor editor = new TableEditor(tagsTable);
+// Button check = new Button(tagsTable, SWT.CHECK);
+// check.setBackground(tagsTable.getBackground());
+// editor.minimumWidth = check.getSize().x;
+// editor.grabHorizontal = true;
+// editor.setEditor(check, tableItem, 0);
+ }
+
+ /*
+ * Restoring selection index
+ */
+ if (selectionIndex > 0 ) {
+ try {
+ tagsTable.setSelection(selectionIndex);
+ } catch (SWTException e) {
+ /*
+ * Do nothing
+ */
+ }
+ }
+ }
+
+ public String getValueAt(int row, int column) {
+ String result = "List is empty"; //$NON-NLS-1$
+ if (null != tagsList) {
+ VpeAnyData tagItem = (VpeAnyData)tagsList.get(row);
+ switch(column){
+ case 0:
+ result = tagItem.getName();
+ break;
+ case 1:
+ result = tagItem.getTagForDisplay();
+ break;
+ case 2:
+ result = tagItem.getUri();
+ break;
+ case 3:
+ if(tagItem.isChildren()) {
+ result = VpeUIMessages.TemplatesTableProvider_Yes;
+ } else {
+ result = VpeUIMessages.TemplatesTableProvider_No;
+ }
+ break;
+ }
+ }
+ return result;
+ }
+
+ private String toVisualValue(String v) {
+ if(v == null) return ""; //$NON-NLS-1$
+ if(v.indexOf('\n') >= 0) v = v.replace('\n', ' ');
+ if(v.indexOf('\t') >= 0) v = v.replace('\t', ' ');
+ if(v.indexOf('\r') >= 0) v = v.replace('\r', ' ');
+ return v;
+ }
+
+ public void handleEvent(Event event) {
+ Widget source = event.widget;
+ if (source == selectAllButton) {
+ /*
+ * Handle select all event
+ */
+
+ } else if (source == deselectAllButton) {
+ /*
+ * Handle deselect all event
+ */
+
+ } else {
+ /*
+ * Handle chekbox event
+ */
+
+ }
+ }
+
+ @Override
+ public boolean isPageComplete() {
+ /*
+ * Later page should be complete some tags are selected.
+ */
+ boolean isPageComplete = false;
+ if ((pathString != null) && !"".equalsIgnoreCase(pathString)) { //$NON-NLS-1$
+ isPageComplete = true;
+ }
+ return isPageComplete;
+ }
+
+
+ public boolean finish() {
+ List<VpeAnyData> templates = VpeTemplateManager.getInstance().getAnyTemplates();
+ IPath path = new Path(pathString);
+ VpeTemplateManager.getInstance().setAnyTemplates(templates, path);
+ return true;
+ }
+
+ @Override
protected void createSourceGroup(Composite parent) {
/*
* Create nothing.
15 years
JBoss Tools SVN: r19484 - in trunk/smooks: plugins/org.jboss.tools.smooks.ui and 14 other directories.
by jbosstools-commits@lists.jboss.org
Author: tfennelly
Date: 2009-12-19 05:26:20 -0500 (Sat, 19 Dec 2009)
New Revision: 19484
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/serialize/
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/serialize/MarshallingStrategy.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/serialize/ObjectSerializer.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/serialize/XPathMarshaller.java
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/META-INF/
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/META-INF/MANIFEST.MF
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/build.properties
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/lib/
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/lib/xmlunit-1.1.jar
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/lib/xstream-1.2.2.jar
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/plugin.properties
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/Header.java
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/ObjectSerializerText.java
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/Order.java
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/OrderItem.java
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/TestUtil.java
trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/expected-01.txt
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.templating/.classpath
trunk/smooks/plugins/org.jboss.tools.smooks.ui/.classpath
trunk/smooks/plugins/org.jboss.tools.smooks.ui/.project
trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchConfigurationDelegate.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLauncher.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5409
Replace XML Serialized Objects with something easier to read
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.templating/.classpath
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.templating/.classpath 2009-12-19 02:38:14 UTC (rev 19483)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.templating/.classpath 2009-12-19 10:26:20 UTC (rev 19484)
@@ -3,6 +3,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
- <classpathentry exported="true" kind="lib" path="libs/xstream-1.2.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="libs/xstream-1.2.2.jar" sourcepath="/xstream"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/.classpath
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/.classpath 2009-12-19 02:38:14 UTC (rev 19483)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/.classpath 2009-12-19 10:26:20 UTC (rev 19484)
@@ -1,7 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/xstream"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/.project
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/.project 2009-12-19 02:38:14 UTC (rev 19483)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/.project 2009-12-19 10:26:20 UTC (rev 19484)
@@ -1,40 +1,40 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.jboss.tools.smooks.ui</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
- <linkedResources>
- <link>
- <name>smooks-core</name>
- <type>2</type>
- <location>D:/Users/tfennelly/packs/eclipse/Eclipse.app/Contents/MacOS/D::/Users/tfennelly/milyn/trunk/smooks-core/src/main/java</location>
- </link>
- <link>
- <name>smooks-csv</name>
- <type>2</type>
- <location>D:/Users/tfennelly/packs/eclipse/Eclipse.app/Contents/MacOS/D::/Users/tfennelly/milyn/trunk/smooks-cartridges/csv/src/main/java</location>
- </link>
- </linkedResources>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.smooks.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+ <linkedResources>
+ <link>
+ <name>smooks-core</name>
+ <type>2</type>
+ <location>/Users/tfennelly/packs/eclipse/Eclipse.app/Contents/MacOS/D::/Users/tfennelly/packs/eclipse/Eclipse.app/Contents/MacOS/D::/Users/tfennelly/milyn/trunk/smooks-core/src/main/java</location>
+ </link>
+ <link>
+ <name>smooks-csv</name>
+ <type>2</type>
+ <location>/Users/tfennelly/packs/eclipse/Eclipse.app/Contents/MacOS/D::/Users/tfennelly/packs/eclipse/Eclipse.app/Contents/MacOS/D::/Users/tfennelly/milyn/trunk/smooks-cartridges/csv/src/main/java</location>
+ </link>
+ </linkedResources>
+</projectDescription>
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2009-12-19 02:38:14 UTC (rev 19483)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2009-12-19 10:26:20 UTC (rev 19484)
@@ -55,4 +55,5 @@
org.jboss.tools.smooks.edimap.editor,
org.jboss.tools.smooks.editor,
org.jboss.tools.smooks.graphical.editors,
- org.jboss.tools.smooks.launch
+ org.jboss.tools.smooks.launch,
+ org.jboss.tools.smooks.launch.serialize
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchConfigurationDelegate.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchConfigurationDelegate.java 2009-12-19 02:38:14 UTC (rev 19483)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchConfigurationDelegate.java 2009-12-19 10:26:20 UTC (rev 19484)
@@ -51,6 +51,9 @@
import org.jboss.tools.smooks.configuration.RuntimeMetadata;
import org.jboss.tools.smooks.configuration.editors.uitls.ProjectClassLoader;
import org.jboss.tools.smooks.core.SmooksInputType;
+import org.jboss.tools.smooks.launch.serialize.MarshallingStrategy;
+import org.jboss.tools.smooks.launch.serialize.ObjectSerializer;
+import org.jboss.tools.smooks.launch.serialize.XPathMarshaller;
/**
* Smooks Launch Configuration Delegate.
@@ -125,6 +128,9 @@
addToCP(wsTempClasses, SmooksLauncher.class);
addToCP(wsTempClasses, SmooksInputType.class);
addToCP(wsTempClasses, ProcessNodeType.class);
+ addToCP(wsTempClasses, ObjectSerializer.class);
+ addToCP(wsTempClasses, MarshallingStrategy.class);
+ addToCP(wsTempClasses, XPathMarshaller.class);
classpath.add(wsTempClasses.getAbsolutePath());
VMRunnerConfiguration runConfig= new VMRunnerConfiguration(SmooksLauncher.class.getName(), classpath.toArray(new String[classpath.size()]));
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLauncher.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLauncher.java 2009-12-19 02:38:14 UTC (rev 19483)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLauncher.java 2009-12-19 10:26:20 UTC (rev 19484)
@@ -24,21 +24,20 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.StringReader;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
-import java.util.Map.Entry;
import javax.xml.transform.stream.StreamSource;
import org.jboss.tools.smooks.configuration.ProcessNodeType;
import org.jboss.tools.smooks.core.SmooksInputType;
+import org.jboss.tools.smooks.launch.serialize.ObjectSerializer;
import org.milyn.Smooks;
import org.milyn.payload.JavaResult;
import org.milyn.payload.StringResult;
import org.xml.sax.SAXException;
-import com.thoughtworks.xstream.XStream;
-
/**
* Smooks runtime Launcher class.
*
@@ -83,14 +82,13 @@
smooks.filterSource(new StreamSource(new FileInputStream(input)), javaResult);
}
- Set<Entry<String, Object>> bindings = javaResult.getResultMap().entrySet();
- if(!bindings.isEmpty()) {
- System.out.println("[JavaResult Objects (XML Serialized)...]"); //$NON-NLS-1$
+ Collection<ObjectSerializer> serializedJavaResults = ObjectSerializer.serialize(javaResult);
+ if(!serializedJavaResults.isEmpty()) {
+ System.out.println("[JavaResult Objects...]"); //$NON-NLS-1$
- for(Entry<String, Object> binding : bindings) {
- System.out.println("\n" + binding.getKey() + ":"); //$NON-NLS-1$ //$NON-NLS-2$
+ for(ObjectSerializer serializedJavaResult : serializedJavaResults) {
System.out.println(" |--"); //$NON-NLS-1$
- System.out.println(indent((new XStream()).toXML(binding.getValue())));
+ System.out.println(indent(serializedJavaResult.getSerializedForm()));
System.out.println(" |--"); //$NON-NLS-1$
}
nothingDisplayed = false;
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/serialize/MarshallingStrategy.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/serialize/MarshallingStrategy.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/serialize/MarshallingStrategy.java 2009-12-19 10:26:20 UTC (rev 19484)
@@ -0,0 +1,51 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009, JBoss Inc.
+ */
+package org.jboss.tools.smooks.launch.serialize;
+
+import com.thoughtworks.xstream.converters.ConverterLookup;
+import com.thoughtworks.xstream.converters.DataHolder;
+import com.thoughtworks.xstream.core.ReferenceByXPathMarshallingStrategy;
+import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
+import com.thoughtworks.xstream.mapper.Mapper;
+
+/**
+ *
+ * @author <a href="mailto:tom.fennelly@jboss.com">tom.fennelly(a)jboss.com</a>
+ */
+public class MarshallingStrategy extends ReferenceByXPathMarshallingStrategy {
+
+ private ObjectSerializer objectSerializer;
+
+ /**
+ * @param objectSerializer
+ */
+ public MarshallingStrategy(ObjectSerializer objectSerializer) {
+ this.objectSerializer = objectSerializer;
+ }
+
+ /* (non-Javadoc)
+ * @see com.thoughtworks.xstream.core.ReferenceByXPathMarshallingStrategy#marshal(com.thoughtworks.xstream.io.HierarchicalStreamWriter, java.lang.Object, com.thoughtworks.xstream.converters.ConverterLookup, com.thoughtworks.xstream.mapper.Mapper, com.thoughtworks.xstream.converters.DataHolder)
+ */
+ @Override
+ public void marshal(HierarchicalStreamWriter writer, Object obj, ConverterLookup converterLookup, Mapper mapper, DataHolder dataHolder) {
+ XPathMarshaller marshaller = new XPathMarshaller(writer, converterLookup, mapper, ReferenceByXPathMarshallingStrategy.RELATIVE, objectSerializer);
+ marshaller.start(obj, dataHolder);
+ }
+}
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/serialize/ObjectSerializer.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/serialize/ObjectSerializer.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/serialize/ObjectSerializer.java 2009-12-19 10:26:20 UTC (rev 19484)
@@ -0,0 +1,281 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009, JBoss Inc.
+ */
+package org.jboss.tools.smooks.launch.serialize;
+
+import java.io.StringWriter;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import org.milyn.payload.JavaResult;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.xml.AbstractXmlWriter;
+import com.thoughtworks.xstream.io.xml.DomDriver;
+
+/**
+ * Object Graph Serializer.
+ *
+ * @author <a href="mailto:tom.fennelly@jboss.com">tom.fennelly(a)jboss.com</a>
+ */
+public class ObjectSerializer extends AbstractXmlWriter {
+
+ private Object rootObject;
+ private String rootBeanId;
+ private List<Object> items = new ArrayList<Object>();
+ private Set<String> referencedBeans = new LinkedHashSet<String>();
+ private Map<String, Object> beanContext;
+ private int indent = 0;
+ private boolean writeNL = false;
+ private String serializedForm;
+ private StringWriter writer;
+
+ public ObjectSerializer(Object object, String beanId, Map<String, Object> beanMap) {
+ assertNotNull(object, "object");
+ assertNotNull(beanId, "beanId");
+ assertNotNull(beanMap, "beanMap");
+ this.rootObject = object;
+ this.rootBeanId = beanId;
+ this.beanContext = beanMap;
+ this.serializedForm = writeObject();
+ }
+
+ public static String serialize(Object object, Map<String, Object> beanMap) {
+ ObjectSerializer serializer = new ObjectSerializer(object, object.getClass().getSimpleName(), beanMap);
+ return serializer.getSerializedForm();
+ }
+
+ public static Collection<ObjectSerializer> serialize(JavaResult javaResult) {
+ StringBuilder stringBuilder = new StringBuilder();
+ Map<String, Object> beanMap = javaResult.getResultMap();
+ Set<Entry<String, Object>> beanMapEntries = beanMap.entrySet();
+ Map<String, ObjectSerializer> serializedObjectMap = new HashMap<String, ObjectSerializer>();
+ Set<String> beanNames = beanMap.keySet();
+
+ // Create all the ObjectSerializer instances...
+ for(Entry<String, Object> beanMapEntry : beanMapEntries) {
+ serializedObjectMap.put(beanMapEntry.getKey(), new ObjectSerializer(beanMapEntry.getValue(), beanMapEntry.getKey(), beanMap));
+ }
+
+ // Now try to work out which can be eliminated by analysing the beans used in each
+ // ObjectSerializer instance...
+ Set<Entry<String, ObjectSerializer>> serializedObjectMapEntries = serializedObjectMap.entrySet();
+ for(Entry<String, ObjectSerializer> serializedObjectMapEntry : serializedObjectMapEntries) {
+ beanNames.removeAll(serializedObjectMapEntry.getValue().getReferencedBeans());
+ }
+
+ if(!beanNames.isEmpty()) {
+ // If the beanNames Set is not empty, only return those ObjectSerializer instances...
+ List<ObjectSerializer> rootBeans = new ArrayList<ObjectSerializer>();
+
+ for(String beanName : beanNames) {
+ rootBeans.add(serializedObjectMap.get(beanName));
+ }
+
+ return rootBeans;
+ } else {
+ // If the beanNames Set is empty, return all ObjectSerializer instances i.e.
+ // we're not able to work out the "root" bean(s)...
+ return serializedObjectMap.values();
+ }
+ }
+
+ public Set<String> getReferencedBeans() {
+ return referencedBeans;
+ }
+
+ public String getSerializedForm() {
+ return serializedForm;
+ }
+
+ private synchronized String writeObject() {
+ XStream xstream = new XStream(new DomDriver());
+ MarshallingStrategy marshallingStrategy = new MarshallingStrategy(this);
+
+ writer = new StringWriter();
+ items.clear();
+ referencedBeans.clear();
+ xstream.setMarshallingStrategy(marshallingStrategy);
+ xstream.marshal(rootObject, this);
+
+ return writer.toString();
+ }
+
+ /* (non-Javadoc)
+ * @see com.thoughtworks.xstream.io.xml.AbstractXmlWriter#startNode(java.lang.String, java.lang.Class)
+ */
+ @Override
+ public void startNode(String name, Class clazz) {
+ if(writeNL) {
+ writer.write("\n");
+ }
+
+ if(indent == 0) {
+ // Root object...
+ writer.write("> " + rootBeanId);
+ } else {
+ writeIndent(indent);
+ writer.write("> " + name);
+ }
+
+ writeNL = true;
+ indent++;
+ }
+
+ public void startNode(Object item) {
+ //write(" (@" + Integer.toHexString(System.identityHashCode(item)) + ")");
+ items.add(item);
+
+ String beanId = getBeanId(item, true);
+ if(beanId != null) {
+ writer.write(" (beanId = \"" + beanId + "\")");
+ if(!beanId.equals(rootBeanId)) {
+ referencedBeans.add(beanId);
+ }
+ }
+ }
+
+ private String getBeanId(Object item, boolean checkCollections) {
+ // First see it it one of the root beans...
+ Set<Entry<String, Object>> beans = beanContext.entrySet();
+ for(Entry<String, Object> bean : beans) {
+ if(bean.getValue() == item) {
+ return bean.getKey();
+ }
+ }
+
+ if(checkCollections) {
+ // Then, see is it in a Collection bean in one of the root beans...
+ for(Entry<String, Object> bean : beans) {
+ Object beanObj = bean.getValue();
+
+ if(beanObj instanceof Collection) {
+ Collection collectionBean = (Collection)beanObj;
+ if(collectionContains(collectionBean, item)) {
+ // Get the beanId of the first object in the collection
+ // that also exists in the root of the beanContext...
+ for (Object collectionItem : collectionBean) {
+ String beanId = getBeanId(collectionItem, false);
+ if(beanId != null) {
+ return beanId;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ private boolean collectionContains(Collection collection, Object item) {
+ // Intentionally not using Collection.contains() because it uses
+ // Object.equals(), which is not what we want... we need an exact object ref match...
+ for(Object object : collection) {
+ if(object == item) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see com.thoughtworks.xstream.io.HierarchicalStreamWriter#setValue(java.lang.String)
+ */
+ public void setValue(String text) {
+ Object currentItem = items.get(items.size() - 1);
+
+ if((currentItem instanceof String || containsNonNumeric(text)) && !(currentItem instanceof Number)) {
+ writer.write(" = \"" + text + "\"");
+ } else if(currentItem instanceof Number) {
+ Class<? extends Object> itemClass = currentItem.getClass();
+ if(itemClass.getPackage() == Integer.class.getPackage()) {
+ writer.write(" = " + text + itemClass.getSimpleName().charAt(0));
+ } else {
+ writer.write(" = " + text);
+ }
+ } else {
+ writer.write(" = " + text);
+ }
+
+ writer.write("\n");
+ writeNL = false;
+ }
+
+ /* (non-Javadoc)
+ * @see com.thoughtworks.xstream.io.HierarchicalStreamWriter#endNode()
+ */
+ public void endNode() {
+ indent--;
+ }
+
+ /* (non-Javadoc)
+ * @see com.thoughtworks.xstream.io.HierarchicalStreamWriter#startNode(java.lang.String)
+ */
+ public void startNode(String name) {
+ }
+
+ /* (non-Javadoc)
+ * @see com.thoughtworks.xstream.io.HierarchicalStreamWriter#flush()
+ */
+ public void flush() {
+ writer.flush();
+ }
+
+ private void writeIndent(int count) {
+ for(int i = 0; i < count; i++) {
+ writer.write(" "); //$NON-NLS-1$
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see com.thoughtworks.xstream.io.HierarchicalStreamWriter#addAttribute(java.lang.String, java.lang.String)
+ */
+ public void addAttribute(String name, String value) {
+ }
+
+ /* (non-Javadoc)
+ * @see com.thoughtworks.xstream.io.HierarchicalStreamWriter#close()
+ */
+ public void close() {
+ }
+
+ private boolean containsNonNumeric(String text) {
+ for(int i = 0; i < text.length(); i++) {
+ if(!Character.isDigit(text.charAt(i))) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private void assertNotNull(Object object, String name) {
+ if(object == null) {
+ throw new IllegalArgumentException("ObjectSerializer argument '" + name + "' is null.");
+ }
+ }
+}
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/serialize/XPathMarshaller.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/serialize/XPathMarshaller.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/serialize/XPathMarshaller.java 2009-12-19 10:26:20 UTC (rev 19484)
@@ -0,0 +1,52 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009, JBoss Inc.
+ */
+package org.jboss.tools.smooks.launch.serialize;
+
+import com.thoughtworks.xstream.converters.Converter;
+import com.thoughtworks.xstream.converters.ConverterLookup;
+import com.thoughtworks.xstream.core.ReferenceByXPathMarshaller;
+import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
+import com.thoughtworks.xstream.mapper.Mapper;
+
+/**
+ * XStream object marshaller.
+ * <p/>
+ * Provides access to the current object/item being processed.
+ *
+ * @author <a href="mailto:tom.fennelly@jboss.com">tom.fennelly(a)jboss.com</a>
+ */
+public class XPathMarshaller extends ReferenceByXPathMarshaller {
+
+ private ObjectSerializer objectSerializer;
+
+ public XPathMarshaller(HierarchicalStreamWriter writer, ConverterLookup converterLookup, Mapper mapper, int mode, ObjectSerializer objectSerializer) {
+ super(writer, converterLookup, mapper, mode);
+ this.objectSerializer = objectSerializer;
+ }
+
+ /* (non-Javadoc)
+ * @see com.thoughtworks.xstream.core.AbstractReferenceMarshaller#convert(java.lang.Object, com.thoughtworks.xstream.converters.Converter)
+ */
+ @Override
+ public void convert(Object item, Converter converter) {
+ objectSerializer.startNode(item);
+ super.convert(item, converter);
+ }
+}
Added: trunk/smooks/tests/org.jboss.tools.smooks.ui.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.ui.test/META-INF/MANIFEST.MF (rev 0)
+++ trunk/smooks/tests/org.jboss.tools.smooks.ui.test/META-INF/MANIFEST.MF 2009-12-19 10:26:20 UTC (rev 19484)
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name.0
+Bundle-SymbolicName: org.jboss.tools.smooks.ui.test
+Bundle-Version: 1.0.0
+Bundle-ClassPath: lib/xmlunit-1.1.jar,
+ .,
+ lib/xstream-1.2.2.jar
+Bundle-Vendor: %Bundle-Vendor.0
+Bundle-Localization: plugin
+Require-Bundle: org.junit,
+ org.jboss.tools.smooks.runtime,
+ org.jboss.tools.smooks.ui
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
Added: trunk/smooks/tests/org.jboss.tools.smooks.ui.test/build.properties
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.ui.test/build.properties (rev 0)
+++ trunk/smooks/tests/org.jboss.tools.smooks.ui.test/build.properties 2009-12-19 10:26:20 UTC (rev 19484)
@@ -0,0 +1,8 @@
+output.. = bin/
+bin.includes = META-INF/,\
+ plugin.properties,\
+ projects/,\
+ lib/xmlunit-1.1.jar,\
+ .,\
+ lib/xstream-1.2.2.jar
+source.. = src/
Added: trunk/smooks/tests/org.jboss.tools.smooks.ui.test/lib/xmlunit-1.1.jar
===================================================================
(Binary files differ)
Property changes on: trunk/smooks/tests/org.jboss.tools.smooks.ui.test/lib/xmlunit-1.1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/smooks/tests/org.jboss.tools.smooks.ui.test/lib/xstream-1.2.2.jar
===================================================================
(Binary files differ)
Property changes on: trunk/smooks/tests/org.jboss.tools.smooks.ui.test/lib/xstream-1.2.2.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/smooks/tests/org.jboss.tools.smooks.ui.test/plugin.properties
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.ui.test/plugin.properties (rev 0)
+++ trunk/smooks/tests/org.jboss.tools.smooks.ui.test/plugin.properties 2009-12-19 10:26:20 UTC (rev 19484)
@@ -0,0 +1,3 @@
+#Properties file for org.jboss.tools.smooks.test
+Bundle-Vendor.0 = JBoss by Red Hat
+Bundle-Name.0 = Smooks Tools Templating Test Plug-in
\ No newline at end of file
Added: trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/Header.java
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/Header.java (rev 0)
+++ trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/Header.java 2009-12-19 10:26:20 UTC (rev 19484)
@@ -0,0 +1,51 @@
+/*
+ Milyn - Copyright (C) 2006
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License (version 2.1) as published by the Free Software
+ Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ See the GNU Lesser General Public License for more details:
+ http://www.gnu.org/licenses/lgpl.txt
+*/
+package org.jboss.tools.smooks.launch.serialize;
+
+import java.util.Date;
+
+/**
+ * @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly(a)gmail.com</a>
+ */
+public class Header {
+ private Date date;
+ private Long customerNumber = 188276L;
+ private String customerName = "Mr. Fox";
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ public Long getCustomerNumber() {
+ return customerNumber;
+ }
+
+ public void setCustomerNumber(Long customerNumber) {
+ this.customerNumber = customerNumber;
+ }
+
+ public String getCustomerName() {
+ return customerName;
+ }
+
+ public void setCustomerName(String customerName) {
+ this.customerName = customerName;
+ }
+}
Added: trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/ObjectSerializerText.java
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/ObjectSerializerText.java (rev 0)
+++ trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/ObjectSerializerText.java 2009-12-19 10:26:20 UTC (rev 19484)
@@ -0,0 +1,68 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2009, JBoss Inc.
+ */
+package org.jboss.tools.smooks.launch.serialize;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.milyn.payload.JavaResult;
+import org.xml.sax.SAXException;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ *
+ * @author <a href="mailto:tom.fennelly@jboss.com">tom.fennelly(a)jboss.com</a>
+ */
+public class ObjectSerializerText extends TestCase {
+
+ public void test() throws IOException, SAXException {
+ Map<String, Object> beanContext = new HashMap<String, Object>();
+ Order order = new Order();
+ List<OrderItem> items = order.getOrderItems();
+
+ beanContext.put("order", order);
+ beanContext.put("header", order.getHeader());
+ beanContext.put("orderItems", items);
+
+ items.add(new OrderItem().setProductId(55126).setQuantity(6).setPrice(65.98));
+ items.add(new OrderItem().setProductId(23423).setQuantity(3).setPrice(8.42));
+ items.add(new OrderItem().setProductId(45645).setQuantity(7).setPrice(999.00));
+
+ beanContext.put("orderItem", items.get(items.size() - 1));
+
+ JavaResult javaResult = new JavaResult(beanContext);
+
+ Collection<ObjectSerializer> rootBeans = ObjectSerializer.serialize(javaResult);
+
+ // ObjectSerializer should work out that there's just 1 root
+ // bean i.e. the "order" bean...
+ assertEquals(1, rootBeans.size());
+ for(ObjectSerializer serializer : rootBeans) {
+ //System.out.println(serializer.getSerializedForm());
+ TestUtil.assertEquals(serializer.getSerializedForm(), "expected-01.txt", getClass());
+ assertEquals("[header, orderItems, orderItem]", serializer.getReferencedBeans().toString());
+ }
+ }
+}
Added: trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/Order.java
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/Order.java (rev 0)
+++ trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/Order.java 2009-12-19 10:26:20 UTC (rev 19484)
@@ -0,0 +1,43 @@
+/*
+ Milyn - Copyright (C) 2006
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License (version 2.1) as published by the Free Software
+ Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ See the GNU Lesser General Public License for more details:
+ http://www.gnu.org/licenses/lgpl.txt
+*/
+package org.jboss.tools.smooks.launch.serialize;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly(a)gmail.com</a>
+ */
+public class Order {
+ private Header header = new Header();
+ private List<OrderItem> orderItems = new ArrayList<OrderItem>();
+
+ public Header getHeader() {
+ return header;
+ }
+
+ public void setHeader(Header header) {
+ this.header = header;
+ }
+
+ public List<OrderItem> getOrderItems() {
+ return orderItems;
+ }
+
+ public void setOrderItems(List<OrderItem> orderItems) {
+ this.orderItems = orderItems;
+ }
+}
Added: trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/OrderItem.java
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/OrderItem.java (rev 0)
+++ trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/OrderItem.java 2009-12-19 10:26:20 UTC (rev 19484)
@@ -0,0 +1,52 @@
+/*
+ Milyn - Copyright (C) 2006
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License (version 2.1) as published by the Free Software
+ Foundation.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ See the GNU Lesser General Public License for more details:
+ http://www.gnu.org/licenses/lgpl.txt
+*/
+package org.jboss.tools.smooks.launch.serialize;
+
+/**
+ * @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly(a)gmail.com</a>
+ */
+public class OrderItem {
+ private long productId;
+ private Integer quantity;
+ private double price;
+
+ public long getProductId() {
+ return productId;
+ }
+
+ public OrderItem setProductId(long productId) {
+ this.productId = productId;
+ return this;
+ }
+
+ public Integer getQuantity() {
+ return quantity;
+ }
+
+ public OrderItem setQuantity(Integer quantity) {
+ this.quantity = quantity;
+ return this;
+ }
+
+ public double getPrice() {
+ return price;
+ }
+
+ public OrderItem setPrice(double price) {
+ this.price = price;
+ return this;
+ }
+}
Added: trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/TestUtil.java
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/TestUtil.java (rev 0)
+++ trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/TestUtil.java 2009-12-19 10:26:20 UTC (rev 19484)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.tools.smooks.launch.serialize;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.StringReader;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import junit.framework.TestCase;
+
+import org.custommonkey.xmlunit.XMLAssert;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.milyn.io.StreamUtils;
+import org.milyn.xml.XmlUtil;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/**
+ * @author <a href="mailto:tom.fennelly@jboss.com">tom.fennelly(a)jboss.com</a>
+ */
+public abstract class TestUtil {
+
+ public static void assertXMLEquals(String xmlText, String xmlFileOnCP, Class refClass) throws IOException, SAXException {
+ //System.out.println(xmlText);
+ XMLUnit.setIgnoreWhitespace( true );
+ XMLAssert.assertXMLEqual(new InputStreamReader(refClass.getResourceAsStream(xmlFileOnCP)), new StringReader(xmlText));
+ }
+
+ public static void assertEquals(String text, String fileOnCP, Class refClass) throws IOException, SAXException {
+ //System.out.println(text);
+ String fileContents = readFileContents(fileOnCP, refClass);
+ TestCase.assertEquals(normalizeCRLF(fileContents.trim()), normalizeCRLF(text.trim()));
+ }
+
+ public static String readFileContents(String fileOnCP, Class refClass) throws IOException {
+ return StreamUtils.readStreamAsString(refClass.getResourceAsStream(fileOnCP));
+ }
+
+ public static String normalizeCRLF(String text) {
+ text = text.replace("\r\n", "\n");
+ text = text.replace("\n\r", "\n");
+ text = text.replace("\r", "\n");
+ return text;
+ }
+
+ public static Document toDOM(String theTemplate) throws ParserConfigurationException, IOException, SAXException {
+ return XmlUtil.parseStream(new ByteArrayInputStream(theTemplate.getBytes()));
+ }
+}
Added: trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/expected-01.txt
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/expected-01.txt (rev 0)
+++ trunk/smooks/tests/org.jboss.tools.smooks.ui.test/src/org/jboss/tools/smooks/launch/serialize/expected-01.txt 2009-12-19 10:26:20 UTC (rev 19484)
@@ -0,0 +1,17 @@
+> order (beanId = order)
+ > header (beanId = header)
+ > customerNumber = 188276L
+ > customerName = "Mr. Fox"
+ > orderItems (beanId = orderItems)
+ > org.jboss.tools.smooks.launch.serialize.OrderItem (beanId = orderItem)
+ > productId = 55126L
+ > quantity = 6I
+ > price = 65.98D
+ > org.jboss.tools.smooks.launch.serialize.OrderItem (beanId = orderItem)
+ > productId = 23423L
+ > quantity = 3I
+ > price = 8.42D
+ > org.jboss.tools.smooks.launch.serialize.OrderItem (beanId = orderItem)
+ > productId = 45645L
+ > quantity = 7I
+ > price = 999.0D
\ No newline at end of file
15 years
JBoss Tools SVN: r19483 - in trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4: src/org/jboss/tools/flow/jpdl4/editor and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-12-18 21:38:14 -0500 (Fri, 18 Dec 2009)
New Revision: 19483
Added:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/JmsTaskDeserializer.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/JmsTaskSerializer.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/RuleTaskDeserializer.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/RuleTaskSerializer.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/RulesDecisionDeserializer.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/RulesDecisionSerializer.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/JmsTask.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/RuleTask.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/RulesDecision.java
Modified:
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlPaletteFactory.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/ProcessDeserializer.java
trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/Registry.java
Log:
add
- rules decision node
- rules node
- jms node
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2009-12-19 01:47:05 UTC (rev 19482)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/plugin.xml 2009-12-19 02:38:14 UTC (rev 19483)
@@ -162,6 +162,26 @@
<figure class="org.jboss.tools.flow.jpdl4.figure.TaskFigure"></figure>
</node>
</element>
+ <element
+ class="org.jboss.tools.flow.jpdl4.model.JmsTask"
+ figure="icons/16/task_empty.png"
+ id="org.jboss.tools.flow.jpdl4.jmsTask"
+ label="jms"
+ language="org.jboss.tools.flow.jpdl4">
+ <node>
+ <figure class="org.jboss.tools.flow.jpdl4.figure.TaskFigure"></figure>
+ </node>
+ </element>
+ <element
+ class="org.jboss.tools.flow.jpdl4.model.RuleTask"
+ figure="icons/16/task_empty.png"
+ id="org.jboss.tools.flow.jpdl4.ruleTask"
+ label="rule"
+ language="org.jboss.tools.flow.jpdl4">
+ <node>
+ <figure class="org.jboss.tools.flow.jpdl4.figure.TaskFigure"></figure>
+ </node>
+ </element>
<!-- <element
class="org.jboss.tools.flow.jpdl4.model.ServiceTask"
figure="icons/16/task_empty.png"
@@ -213,6 +233,16 @@
</node>
</element>
<element
+ class="org.jboss.tools.flow.jpdl4.model.RulesDecision"
+ figure="icons/16/gateway_exclusive.png"
+ id="org.jboss.tools.flow.jpdl4.rulesDecision"
+ label="rule"
+ language="org.jboss.tools.flow.jpdl4">
+ <node>
+ <figure class="org.jboss.tools.flow.jpdl4.figure.ExclusiveGatewayFigure"></figure>
+ </node>
+ </element>
+ <element
class="org.jboss.tools.flow.jpdl4.model.ForkParallelGateway"
figure="icons/16/gateway_parallel.png"
id="org.jboss.tools.flow.jpdl4.parallelForkGateway"
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlPaletteFactory.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlPaletteFactory.java 2009-12-19 01:47:05 UTC (rev 19482)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/editor/JpdlPaletteFactory.java 2009-12-19 02:38:14 UTC (rev 19483)
@@ -134,6 +134,24 @@
);
entries.add(combined);
combined = new CombinedTemplateCreationEntry(
+ "jms",
+ "Create a new JMS Node",
+ "org.jboss.tools.flow.jpdl4.jmsTask",
+ ElementRegistry.getCreationFactory("org.jboss.tools.flow.jpdl4.jmsTask"),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/16/task_empty.png")),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/32/task_empty.png"))
+ );
+ entries.add(combined);
+ combined = new CombinedTemplateCreationEntry(
+ "custom",
+ "Create a new Custom Node",
+ "org.jboss.tools.flow.jpdl4.customTask",
+ ElementRegistry.getCreationFactory("org.jboss.tools.flow.jpdl4.customTask"),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/16/task_empty.png")),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/32/task_empty.png"))
+ );
+ entries.add(combined);
+ combined = new CombinedTemplateCreationEntry(
"java",
"Create a new Java Task",
"org.jboss.tools.flow.jpdl4.javaTask",
@@ -151,6 +169,15 @@
ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/32/task_empty.png"))
);
entries.add(combined);
+ combined = new CombinedTemplateCreationEntry(
+ "rule",
+ "Create a new Rule Task",
+ "org.jboss.tools.flow.jpdl4.ruleTask",
+ ElementRegistry.getCreationFactory("org.jboss.tools.flow.jpdl4.ruleTask"),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/16/task_empty.png")),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/32/task_empty.png"))
+ );
+ entries.add(combined);
// combined = new CombinedTemplateCreationEntry(
// "esb",
// "Create a new Service Task",
@@ -178,15 +205,6 @@
ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/32/task_empty.png"))
);
entries.add(combined);
- combined = new CombinedTemplateCreationEntry(
- "custom",
- "Create a new Custom Node",
- "org.jboss.tools.flow.jpdl4.customTask",
- ElementRegistry.getCreationFactory("org.jboss.tools.flow.jpdl4.customTask"),
- ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/16/task_empty.png")),
- ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/32/task_empty.png"))
- );
- entries.add(combined);
return entries;
}
@@ -202,6 +220,15 @@
);
entries.add(combined);
combined = new CombinedTemplateCreationEntry(
+ "rule",
+ "Create a new Rules Decision",
+ "org.jboss.tools.flow.jpdl4.rulesDecision",
+ ElementRegistry.getCreationFactory("org.jboss.tools.flow.jpdl4.exclusiveGateway"),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/16/gateway_exclusive.png")),
+ ImageDescriptor.createFromURL(Activator.getDefault().getBundle().getEntry("icons/32/gateway_exclusive.png"))
+ );
+ entries.add(combined);
+ combined = new CombinedTemplateCreationEntry(
"fork",
"Create a new Fork",
"org.jboss.tools.flow.jpdl4.parallelForkGateway",
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/JmsTaskDeserializer.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/JmsTaskDeserializer.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/JmsTaskDeserializer.java 2009-12-19 02:38:14 UTC (rev 19483)
@@ -0,0 +1,9 @@
+/**
+ *
+ */
+package org.jboss.tools.flow.jpdl4.io;
+
+
+class JmsTaskDeserializer extends NodeDeserializer {
+
+}
\ No newline at end of file
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/JmsTaskDeserializer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/JmsTaskSerializer.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/JmsTaskSerializer.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/JmsTaskSerializer.java 2009-12-19 02:38:14 UTC (rev 19483)
@@ -0,0 +1,9 @@
+/**
+ *
+ */
+package org.jboss.tools.flow.jpdl4.io;
+
+
+class JmsTaskSerializer extends ProcessNodeSerializer {
+
+}
\ No newline at end of file
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/JmsTaskSerializer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/ProcessDeserializer.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/ProcessDeserializer.java 2009-12-19 01:47:05 UTC (rev 19482)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/ProcessDeserializer.java 2009-12-19 02:38:14 UTC (rev 19483)
@@ -31,6 +31,10 @@
FlowWrapper flowWrapper = (FlowWrapper)parent;
if (node instanceof Element) {
result = Registry.createWrapper((Element)node);
+ if (result == null) {
+ return null;
+// result = tryToCreateUnknownNodeWrapper((Element)node);
+ }
if (result == null) return null;
if (result instanceof NodeWrapper) {
flowWrapper.addElement((NodeWrapper)result);
@@ -45,4 +49,6 @@
return result;
}
+
+
}
\ No newline at end of file
Modified: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/Registry.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/Registry.java 2009-12-19 01:47:05 UTC (rev 19482)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/Registry.java 2009-12-19 02:38:14 UTC (rev 19483)
@@ -18,12 +18,15 @@
import org.jboss.tools.flow.jpdl4.model.ForkParallelGateway;
import org.jboss.tools.flow.jpdl4.model.HumanTask;
import org.jboss.tools.flow.jpdl4.model.JavaTask;
+import org.jboss.tools.flow.jpdl4.model.JmsTask;
import org.jboss.tools.flow.jpdl4.model.JoinParallelGateway;
import org.jboss.tools.flow.jpdl4.model.MailTask;
import org.jboss.tools.flow.jpdl4.model.Parameter;
import org.jboss.tools.flow.jpdl4.model.PrimitiveObject;
import org.jboss.tools.flow.jpdl4.model.Process;
import org.jboss.tools.flow.jpdl4.model.QueryTask;
+import org.jboss.tools.flow.jpdl4.model.RuleTask;
+import org.jboss.tools.flow.jpdl4.model.RulesDecision;
import org.jboss.tools.flow.jpdl4.model.ScriptTask;
import org.jboss.tools.flow.jpdl4.model.SequenceFlow;
import org.jboss.tools.flow.jpdl4.model.ServiceTask;
@@ -50,12 +53,15 @@
else if ("sql".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.sqlTask";
else if ("java".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.javaTask";
else if ("script".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.scriptTask";
+ else if ("jms".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.jmsTask";
+ else if ("rules".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.ruleTask";
else if ("esb".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.serviceTask";
else if ("mail".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.mailTask";
else if ("task".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.humanTask";
else if ("custom".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.customTask";
else if ("sub-process".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.subprocessTask";
else if ("decision".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.exclusiveGateway";
+ else if ("rules-decision".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.rulesDecision";
else if ("join".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.parallelJoinGateway";
else if ("fork".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.parallelForkGateway";
else if ("transition".equals(nodeName)) return "org.jboss.tools.flow.jpdl4.sequenceFlow";
@@ -142,12 +148,18 @@
return new SubprocessTaskDeserializer();
} else if (element instanceof ExclusiveGateway) {
return new ExclusiveGatewayDeserializer();
+ } else if (element instanceof RulesDecision) {
+ return new RulesDecisionDeserializer();
} else if (element instanceof TerminateEndEvent) {
return new TerminateEndEventDeserializer();
} else if (element instanceof JavaTask) {
return new JavaTaskDeserializer();
} else if (element instanceof ScriptTask) {
return new ScriptTaskDeserializer();
+ } else if (element instanceof JmsTask) {
+ return new JmsTaskDeserializer();
+ } else if (element instanceof RuleTask) {
+ return new RuleTaskDeserializer();
} else if (element instanceof QueryTask) {
return new QueryTaskDeserializer();
} else {
@@ -195,6 +207,10 @@
return new JavaTaskSerializer();
} else if (element instanceof ScriptTask) {
return new ScriptTaskSerializer();
+ } else if (element instanceof JmsTask) {
+ return new JmsTaskSerializer();
+ } else if (element instanceof RuleTask) {
+ return new RuleTaskSerializer();
} else if (element instanceof MailTask) {
return new ProcessNodeSerializer();
} else if (element instanceof ServiceTask) {
@@ -207,6 +223,8 @@
return new ProcessNodeSerializer();
} else if (element instanceof ExclusiveGateway) {
return new ExclusiveGatewaySerializer();
+ } else if (element instanceof RulesDecision) {
+ return new RulesDecisionSerializer();
} else if (element instanceof ForkParallelGateway) {
return new ProcessNodeSerializer();
} else if (element instanceof JoinParallelGateway) {
@@ -244,12 +262,15 @@
else if ("org.jboss.tools.flow.jpdl4.sqlTask".equals(elementId)) return "sql";
else if ("org.jboss.tools.flow.jpdl4.javaTask".equals(elementId)) return "java";
else if ("org.jboss.tools.flow.jpdl4.scriptTask".equals(elementId)) return "script";
+ else if ("org.jboss.tools.flow.jpdl4.jmsTask".equals(elementId)) return "jms";
+ else if ("org.jboss.tools.flow.jpdl4.ruleTask".equals(elementId)) return "rules";
else if ("org.jboss.tools.flow.jpdl4.mailTask".equals(elementId)) return "mail";
else if ("org.jboss.tools.flow.jpdl4.serviceTask".equals(elementId)) return "esb";
else if ("org.jboss.tools.flow.jpdl4.humanTask".equals(elementId)) return "task";
else if ("org.jboss.tools.flow.jpdl4.subprocessTask".equals(elementId)) return "sub-process";
else if ("org.jboss.tools.flow.jpdl4.customTask".equals(elementId)) return "custom";
else if ("org.jboss.tools.flow.jpdl4.exclusiveGateway".equals(elementId)) return "decision";
+ else if ("org.jboss.tools.flow.jpdl4.rulesDecision".equals(elementId)) return "rules-decision";
else if ("org.jboss.tools.flow.jpdl4.parallelJoinGateway".equals(elementId)) return "join";
else if ("org.jboss.tools.flow.jpdl4.parallelForkGateway".equals(elementId)) return "fork";
else if ("org.jboss.tools.flow.jpdl4.sequenceFlow".equals(elementId)) return "transition";
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/RuleTaskDeserializer.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/RuleTaskDeserializer.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/RuleTaskDeserializer.java 2009-12-19 02:38:14 UTC (rev 19483)
@@ -0,0 +1,9 @@
+/**
+ *
+ */
+package org.jboss.tools.flow.jpdl4.io;
+
+
+class RuleTaskDeserializer extends NodeDeserializer {
+
+}
\ No newline at end of file
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/RuleTaskDeserializer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/RuleTaskSerializer.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/RuleTaskSerializer.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/RuleTaskSerializer.java 2009-12-19 02:38:14 UTC (rev 19483)
@@ -0,0 +1,9 @@
+/**
+ *
+ */
+package org.jboss.tools.flow.jpdl4.io;
+
+
+class RuleTaskSerializer extends ProcessNodeSerializer {
+
+}
\ No newline at end of file
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/RuleTaskSerializer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/RulesDecisionDeserializer.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/RulesDecisionDeserializer.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/RulesDecisionDeserializer.java 2009-12-19 02:38:14 UTC (rev 19483)
@@ -0,0 +1,9 @@
+/**
+ *
+ */
+package org.jboss.tools.flow.jpdl4.io;
+
+
+class RulesDecisionDeserializer extends NodeDeserializer {
+
+}
\ No newline at end of file
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/RulesDecisionDeserializer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/RulesDecisionSerializer.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/RulesDecisionSerializer.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/RulesDecisionSerializer.java 2009-12-19 02:38:14 UTC (rev 19483)
@@ -0,0 +1,9 @@
+/**
+ *
+ */
+package org.jboss.tools.flow.jpdl4.io;
+
+
+class RulesDecisionSerializer extends ProcessNodeSerializer {
+
+}
\ No newline at end of file
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/io/RulesDecisionSerializer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/JmsTask.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/JmsTask.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/JmsTask.java 2009-12-19 02:38:14 UTC (rev 19483)
@@ -0,0 +1,7 @@
+package org.jboss.tools.flow.jpdl4.model;
+
+
+
+public class JmsTask extends Task {
+
+}
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/JmsTask.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/RuleTask.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/RuleTask.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/RuleTask.java 2009-12-19 02:38:14 UTC (rev 19483)
@@ -0,0 +1,12 @@
+package org.jboss.tools.flow.jpdl4.model;
+
+
+
+public class RuleTask extends Task {
+
+
+ protected boolean isPropagationExclusive() {
+ return true;
+ }
+
+}
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/RuleTask.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/RulesDecision.java
===================================================================
--- trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/RulesDecision.java (rev 0)
+++ trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/RulesDecision.java 2009-12-19 02:38:14 UTC (rev 19483)
@@ -0,0 +1,7 @@
+package org.jboss.tools.flow.jpdl4.model;
+
+
+
+public class RulesDecision extends Gateway {
+
+}
Property changes on: trunk/jbpm/plugins/org.jboss.tools.flow.jpdl4/src/org/jboss/tools/flow/jpdl4/model/RulesDecision.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years
JBoss Tools SVN: r19482 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-12-18 20:47:05 -0500 (Fri, 18 Dec 2009)
New Revision: 19482
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
Log:
JBIDE-5449: Unnecessary JSF EL expression proposal in CA for non web JSF project
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java 2009-12-18 23:04:41 UTC (rev 19481)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java 2009-12-19 01:47:05 UTC (rev 19482)
@@ -49,6 +49,9 @@
*/
@Override
protected void addTextELProposals(ContentAssistRequest contentAssistRequest) {
+ if (!isJsfProject())
+ return;
+
TextRegion prefix = getELPrefix(contentAssistRequest);
if (prefix == null || !prefix.isELStarted()) {
AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(true, "#{}", //$NON-NLS-1$
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-12-18 23:04:41 UTC (rev 19481)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-12-19 01:47:05 UTC (rev 19482)
@@ -13,6 +13,8 @@
import java.util.List;
import java.util.Map;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
@@ -285,6 +287,9 @@
@Override
protected void addAttributeValueELProposals(ContentAssistRequest contentAssistRequest) {
+ if (!isJsfProject())
+ return;
+
TextRegion prefix = getELPrefix(contentAssistRequest);
if (prefix == null) {
return;
@@ -430,4 +435,23 @@
contentAssistRequest.addProposal(proposal);
}
}
+
+ /**
+ * A temporary fix to decide if JSF-tricks are to play
+ *
+ * @return
+ */
+ protected boolean isJsfProject() {
+ if (getContext() == null || getContext().getResource() == null)
+ return false;
+
+ IProject project = getContext().getResource().getProject();
+ try {
+ if (project.getNature("org.jboss.tools.jsf.jsfnature") != null) //$NON-NLS-1$
+ return true;
+ } catch (CoreException e) {
+ JspEditorPlugin.getDefault().logError(e);
+ }
+ return false;
+ }
}
\ No newline at end of file
15 years
JBoss Tools SVN: r19481 - in trunk/jst/plugins/org.jboss.tools.jst.jsp: src/org/jboss/tools/jst/jsp and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-12-18 18:04:41 -0500 (Fri, 18 Dec 2009)
New Revision: 19481
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/TextHoverInformationProvider.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/Utils.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ChainTextHover.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/FaceletTagInfoHoverProcessor.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java
Log:
JBIDE-4946: Tool tip for tag/attributes in XHTML editor.
Issue is fixed
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2009-12-18 22:32:28 UTC (rev 19480)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2009-12-18 23:04:41 UTC (rev 19481)
@@ -109,7 +109,10 @@
target="org.jboss.tools.jst.jsp.jspeditor.HTMLTextEditor"
type="structuredtextfoldingprovider">
</provisionalConfiguration>
-
+
+
+ <documentationTextHover class="org.jboss.tools.jst.jsp.jspeditor.info.FaceletTagInfoHoverProcessor" target="org.eclipse.wst.html.HTML_DEFAULT" />
+
</extension>
<extension point="org.eclipse.ui.preferencePages">
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java 2009-12-18 22:32:28 UTC (rev 19480)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java 2009-12-18 23:04:41 UTC (rev 19481)
@@ -10,27 +10,28 @@
******************************************************************************/
package org.jboss.tools.jst.jsp;
-import java.util.ArrayList;
-import java.util.Dictionary;
import java.util.List;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
+import org.eclipse.jface.text.ITextHover;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.formatter.IContentFormatter;
import org.eclipse.jface.text.formatter.MultiPassContentFormatter;
import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
+import org.eclipse.jface.text.information.IInformationProvider;
import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
import org.eclipse.wst.html.core.text.IHTMLPartitions;
import org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML;
+import org.eclipse.wst.sse.ui.internal.ExtendedConfigurationBuilder;
+import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
import org.eclipse.wst.sse.ui.internal.format.StructuredFormattingStrategy;
-import org.jboss.tools.common.text.xml.contentassist.SortingCompoundContentAssistProcessor;
+import org.eclipse.wst.sse.ui.internal.taginfo.AnnotationHoverProcessor;
+import org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor;
+import org.eclipse.wst.sse.ui.internal.taginfo.TextHoverManager;
import org.jboss.tools.jst.jsp.format.HTMLFormatProcessor;
-import org.osgi.framework.Bundle;
+import org.jboss.tools.jst.jsp.jspeditor.info.ChainTextHover;
+@SuppressWarnings("restriction")
public class HTMLTextViewerConfiguration extends StructuredTextViewerConfigurationHTML implements ITextViewerConfiguration{
TextViewerConfigurationDelegate configurationDelegate;
@@ -39,7 +40,6 @@
configurationDelegate = new TextViewerConfigurationDelegate(this);
}
- @SuppressWarnings("restriction")
protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
return configurationDelegate.getContentAssistProcessors(sourceViewer, partitionType);
}
@@ -68,4 +68,63 @@
ISourceViewer sourceViewer, String partitionType) {
return super.getContentAssistProcessors(sourceViewer, partitionType);
}
+
+ /**
+ * Create documentation hovers based on hovers contributed via
+ * <code>org.eclipse.wst.sse.ui.editorConfiguration</code> extension
+ * point
+ *
+ * Copied from {@link org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration} because of private modifier
+ *
+ * @param partitionType
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ private ITextHover[] createDocumentationHovers(String partitionType) {
+ List extendedTextHover = ExtendedConfigurationBuilder.getInstance().getConfigurations(ExtendedConfigurationBuilder.DOCUMENTATIONTEXTHOVER, partitionType);
+ ITextHover[] hovers = (ITextHover[]) extendedTextHover.toArray(new ITextHover[extendedTextHover.size()]);
+ return hovers;
+ }
+
+ @Override
+ protected IInformationProvider getInformationProvider(
+ ISourceViewer sourceViewer, String partitionType) {
+
+ ITextHover chainTextHover = new ChainTextHover(createDocumentationHovers(partitionType));
+ return new TextHoverInformationProvider(chainTextHover);
+ }
+
+ @Override
+ public ITextHover getTextHover(ISourceViewer sourceViewer,
+ String contentType, int stateMask) {
+ ITextHover textHover = null;
+
+ /*
+ * Returns a default problem, annotation, and best match hover
+ * depending on stateMask
+ */
+ TextHoverManager.TextHoverDescriptor[] hoverDescs = SSEUIPlugin.getDefault().getTextHoverManager().getTextHovers();
+ int i = 0;
+ while (i < hoverDescs.length && textHover == null) {
+ if (hoverDescs[i].isEnabled() && computeStateMask(hoverDescs[i].getModifierString()) == stateMask) {
+ String hoverType = hoverDescs[i].getId();
+ if (TextHoverManager.PROBLEM_HOVER.equalsIgnoreCase(hoverType))
+ textHover = new ProblemAnnotationHoverProcessor();
+ else if (TextHoverManager.ANNOTATION_HOVER.equalsIgnoreCase(hoverType))
+ textHover = new AnnotationHoverProcessor();
+ else if (TextHoverManager.COMBINATION_HOVER.equalsIgnoreCase(hoverType))
+ textHover = new ChainTextHover(createDocumentationHovers(contentType));
+ else if (TextHoverManager.DOCUMENTATION_HOVER.equalsIgnoreCase(hoverType)) {
+ ITextHover[] hovers = createDocumentationHovers(contentType);
+ if (hovers.length > 0) {
+ textHover = hovers[0];
+ }
+ }
+ }
+ i++;
+ }
+ return textHover;
+ }
+
+
}
\ No newline at end of file
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/TextHoverInformationProvider.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/TextHoverInformationProvider.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/TextHoverInformationProvider.java 2009-12-18 23:04:41 UTC (rev 19481)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp;
+
+import org.eclipse.jface.text.IInformationControlCreator;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextHover;
+import org.eclipse.jface.text.ITextHoverExtension2;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.information.IInformationProvider;
+import org.eclipse.jface.text.information.IInformationProviderExtension;
+import org.eclipse.jface.text.information.IInformationProviderExtension2;
+
+/**
+ *
+ * @author Victor Rubezhny
+ *
+ */
+class TextHoverInformationProvider implements IInformationProvider, IInformationProviderExtension, IInformationProviderExtension2 {
+ private ITextHover fTextHover;
+
+ public TextHoverInformationProvider(ITextHover hover) {
+ fTextHover = hover;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.text.information.IInformationProvider#getInformation(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
+ */
+ public String getInformation(ITextViewer textViewer, IRegion subject) {
+ return (String) getInformation2(textViewer, subject);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.text.information.IInformationProviderExtension#getInformation2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
+ */
+ public Object getInformation2(ITextViewer textViewer, IRegion subject) {
+ return (fTextHover instanceof ITextHoverExtension2 ?
+ ((ITextHoverExtension2)fTextHover).getHoverInfo2(textViewer, subject) :
+ fTextHover.getHoverInfo(textViewer, subject));
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.text.information.IInformationProviderExtension2#getInformationPresenterControlCreator()
+ */
+ public IInformationControlCreator getInformationPresenterControlCreator() {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.text.information.IInformationProvider#getSubject(org.eclipse.jface.text.ITextViewer, int)
+ */
+ public IRegion getSubject(ITextViewer textViewer, int offset) {
+ return fTextHover.getHoverRegion(textViewer, offset);
+ }
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/TextHoverInformationProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/Utils.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/Utils.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/Utils.java 2009-12-18 23:04:41 UTC (rev 19481)
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.contentassist;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.jboss.tools.jst.web.kb.KbQuery;
+import org.jboss.tools.jst.web.kb.KbQuery.Type;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ *
+ * @author Victor Rubezhny
+ *
+ */
+@SuppressWarnings("restriction")
+public class Utils {
+ private static final String JSFC_ATTRIBUTE_NAME = "jsfc"; //$NON-NLS-1$
+
+ /**
+ * Creates and fills the KbQuery object
+ *
+ * @param type
+ * @param offset
+ * @param query
+ * @param stringQuery
+ * @param prefix
+ * @param uri
+ * @param parentTags
+ * @param parent
+ * @param mask
+ * @return
+ */
+ public static KbQuery createKbQuery(Type type, int offset, String query,
+ String stringQuery, String prefix, String uri, String[] parentTags, String parent, boolean mask) {
+ KbQuery kbQuery = new KbQuery();
+
+ kbQuery.setPrefix(prefix);
+ kbQuery.setUri(uri);
+ kbQuery.setParentTags(parentTags);
+ kbQuery.setParent(parent);
+ kbQuery.setMask(mask);
+ kbQuery.setType(type);
+ kbQuery.setOffset(offset);
+ kbQuery.setValue(query);
+ kbQuery.setStringQuery(stringQuery);
+
+ return kbQuery;
+ }
+
+ /**
+ * Returns the name for the tag
+ *
+ * @param tag
+ * @param useJsfcTags
+ * @return
+ */
+ public static String getTagName(Node tag, boolean useJsfcTags) {
+ String tagName = tag.getNodeName();
+ if(useJsfcTags) {
+ // Only HTML tags
+ if(tagName.indexOf(':')>0) {
+ return tagName;
+ }
+ if (!(tag instanceof Element))
+ return tagName;
+
+ Element element = (Element)tag;
+
+ NamedNodeMap attributes = element.getAttributes();
+ Node jsfC = attributes.getNamedItem(JSFC_ATTRIBUTE_NAME);
+ if(jsfC==null || (!(jsfC instanceof Attr))) {
+ return tagName;
+ }
+ Attr jsfCAttribute = (Attr)jsfC;
+ String jsfTagName = jsfCAttribute.getValue();
+ if(jsfTagName==null || jsfTagName.indexOf(':')<1) {
+ return tagName;
+ }
+ tagName = jsfTagName;
+ }
+ return tagName;
+ }
+
+ /**
+ * Returns name of the parent attribute/tag name
+ *
+ * @return
+ */
+ public static String getParent(IDOMNode xmlnode, boolean returnAttributeName, boolean returnThisElement,
+ boolean useJsfcAttribute) {
+
+ Node node = xmlnode;
+ while ((node != null) && (node.getNodeType() == Node.TEXT_NODE) && (node.getParentNode() != null)) {
+ node = node.getParentNode();
+ }
+
+ if (!returnAttributeName && (node instanceof IDOMAttr)) {
+ node = ((IDOMAttr)node).getOwnerElement();
+ }
+
+ if (node == null)
+ return null;
+
+ // Find the first parent tag
+ if (!(node instanceof IDOMElement)) {
+ if (node instanceof IDOMAttr) {
+ if (returnAttributeName) {
+ String parentAttrName = node.getNodeName();
+ return parentAttrName;
+ }
+ node = ((IDOMAttr) node).getOwnerElement();
+ } else {
+ node = node.getParentNode();
+ }
+ } else {
+ if (!returnThisElement)
+ node = node.getParentNode();
+ }
+ if (node == null)
+ return null;
+
+ return getTagName(node, useJsfcAttribute);
+ }
+
+ private static final String[] EMPTY_TAGS = new String[0];
+ /**
+ * Returns array of the parent tags
+ *
+ * @return
+ */
+ public static String[] getParentTags(IDOMNode xmlnode, boolean includeThisTag, boolean useJsfcAttribute) {
+ List<String> parentTags = new ArrayList<String>();
+
+ // Find the first parent tag
+ Node node = xmlnode;
+ while ((node != null) && (node.getNodeType() != Node.ELEMENT_NODE) && (node.getParentNode() != null)) {
+ node = node.getNodeType() == Node.ATTRIBUTE_NODE ? ((Attr)node).getOwnerElement() : node.getParentNode();
+ }
+
+ if (!includeThisTag) {
+ node = node.getParentNode();
+ }
+
+ if (node == null)
+ return EMPTY_TAGS;
+
+ // Store all the parents
+ while (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
+ String tagName = getTagName(node, useJsfcAttribute);
+ parentTags.add(0, tagName);
+ node = node.getParentNode();
+ }
+
+ return (String[])parentTags.toArray(new String[parentTags.size()]);
+ }
+
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/Utils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ChainTextHover.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ChainTextHover.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ChainTextHover.java 2009-12-18 23:04:41 UTC (rev 19481)
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.jspeditor.info;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.text.IInformationControlCreator;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextHover;
+import org.eclipse.jface.text.ITextHoverExtension;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.wst.sse.ui.internal.Logger;
+import org.eclipse.wst.sse.ui.internal.taginfo.AnnotationHoverProcessor;
+import org.eclipse.wst.sse.ui.internal.taginfo.DebugInfoHoverProcessor;
+import org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor;
+
+
+/**
+ * Provides the best hover help documentation (by using other hover help
+ * processors) Priority of hover help processors is: ProblemHoverProcessor,
+ * FaceletTagInfoProcessor, TagInfoProcessor, AnnotationHoverProcessor
+ *
+ * The processors are acquired in order of their priorities. If a hover doesn'n returns an information
+ * (i.e. returns null as a display string) the next processor will be acquired.
+ *
+ * @author Victor Rubezhny
+ *
+ */
+@SuppressWarnings("restriction")
+public class ChainTextHover implements ITextHover, ITextHoverExtension {
+ private ITextHover fBestMatchHover; // current best match text hover
+ private ITextHover[] fTagInfoHovers; // documentation/information hover
+ private List<ITextHover> fTextHovers; // list of text hovers to consider in best
+ // match
+
+ public ChainTextHover(ITextHover infoTagHover) {
+ this(new ITextHover[]{infoTagHover});
+ }
+
+ public ChainTextHover(ITextHover[] infoTagHovers) {
+ fTagInfoHovers = infoTagHovers;
+ }
+
+ /**
+ * Create a list of text hovers applicable to this best match hover
+ * processor
+ *
+ * @return List of ITextHover - in abstract class this is empty list
+ */
+ private List<ITextHover> createTextHoversList() {
+ List<ITextHover> hoverList = new ArrayList<ITextHover>();
+ // if currently debugging, then add the debug hover to the list of
+ // best match
+ if (Logger.isTracing(DebugInfoHoverProcessor.TRACEFILTER)) {
+ hoverList.add(new DebugInfoHoverProcessor());
+ }
+
+ hoverList.add(new ProblemAnnotationHoverProcessor());
+
+ if (fTagInfoHovers != null) {
+ for (int i = 0; i < fTagInfoHovers.length; i++) {
+ if (fTagInfoHovers[i] instanceof FaceletTagInfoHoverProcessor) {
+ hoverList.add(fTagInfoHovers[i]);
+ }
+ }
+ for (int i = 0; i < fTagInfoHovers.length; i++) {
+ if (!(fTagInfoHovers[i] instanceof FaceletTagInfoHoverProcessor)) {
+ hoverList.add(fTagInfoHovers[i]);
+ }
+ }
+ }
+ hoverList.add(new AnnotationHoverProcessor());
+ return hoverList;
+ }
+
+ public IInformationControlCreator getHoverControlCreator() {
+ IInformationControlCreator creator = null;
+
+ if (fBestMatchHover instanceof ITextHoverExtension) {
+ creator = ((ITextHoverExtension) fBestMatchHover).getHoverControlCreator();
+ }
+ return creator;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.text.ITextHover#getHoverInfo(org.eclipse.jface.text.ITextViewer,
+ * org.eclipse.jface.text.IRegion)
+ */
+ public String getHoverInfo(ITextViewer viewer, IRegion hoverRegion) {
+ String displayInfo = null;
+
+ // already have a best match hover picked out from getHoverRegion call
+ if (fBestMatchHover != null) {
+ displayInfo = fBestMatchHover.getHoverInfo(viewer, hoverRegion);
+ }
+ // either had no best match hover or best match hover returned null
+ if (displayInfo == null) {
+ // go through list of text hovers and return first display string
+ Iterator<ITextHover> i = getTextHovers().iterator();
+ while ((i.hasNext()) && (displayInfo == null)) {
+ ITextHover hover = (ITextHover) i.next();
+ displayInfo = hover.getHoverInfo(viewer, hoverRegion);
+ }
+ }
+ return displayInfo;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.text.ITextHover#getHoverRegion(org.eclipse.jface.text.ITextViewer,
+ * int)
+ */
+ public IRegion getHoverRegion(ITextViewer viewer, int offset) {
+ IRegion hoverRegion = null;
+
+ // go through list of text hovers and return first hover region
+ ITextHover hover = null;
+ Iterator<ITextHover> i = getTextHovers().iterator();
+ while ((i.hasNext()) && (hoverRegion == null)) {
+ hover = i.next();
+ hoverRegion = hover.getHoverRegion(viewer, offset);
+ }
+
+ // store the text hover processor that found region
+ if (hoverRegion != null)
+ fBestMatchHover = hover;
+ else
+ fBestMatchHover = null;
+
+ return hoverRegion;
+ }
+
+ private List<ITextHover> getTextHovers() {
+ if (fTextHovers == null) {
+ fTextHovers = createTextHoversList();
+ }
+ return fTextHovers;
+ }
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/ChainTextHover.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/FaceletTagInfoHoverProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/FaceletTagInfoHoverProcessor.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/FaceletTagInfoHoverProcessor.java 2009-12-18 23:04:41 UTC (rev 19481)
@@ -0,0 +1,193 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.jspeditor.info;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.filebuffers.FileBuffers;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xml.ui.internal.taginfo.XMLTagInfoHoverProcessor;
+import org.jboss.tools.common.el.core.resolver.ELContext;
+import org.jboss.tools.common.text.TextProposal;
+import org.jboss.tools.jst.jsp.contentassist.Utils;
+import org.jboss.tools.jst.web.kb.IPageContext;
+import org.jboss.tools.jst.web.kb.KbQuery;
+import org.jboss.tools.jst.web.kb.PageContextFactory;
+import org.jboss.tools.jst.web.kb.PageProcessor;
+import org.jboss.tools.jst.web.kb.KbQuery.Type;
+import org.jboss.tools.jst.web.kb.taglib.INameSpace;
+
+/**
+ *
+ * @author Victor Rubezhny
+ *
+ */
+@SuppressWarnings("restriction")
+public class FaceletTagInfoHoverProcessor extends XMLTagInfoHoverProcessor {
+ private ELContext fContext;
+ private int fDocumentPosition;
+
+ public FaceletTagInfoHoverProcessor() {
+ super();
+ }
+
+ @Override
+ protected String computeHoverHelp(ITextViewer textViewer,
+ int documentPosition) {
+ this.fDocumentPosition = documentPosition;
+ this.fContext = null;
+
+ IFile file = getResource(textViewer.getDocument());
+ if (file == null)
+ return null;
+
+ fContext = PageContextFactory.createPageContext(file);
+ if (fContext == null)
+ return null;
+
+ return super.computeHoverHelp(textViewer, documentPosition);
+ }
+
+ @Override
+ protected String computeTagAttNameHelp(IDOMNode xmlnode,
+ IDOMNode parentNode, IStructuredDocumentRegion flatNode,
+ ITextRegion region) {
+ if (fContext == null)
+ return null;
+
+ String tagName = Utils.getTagName(xmlnode, true);
+ String query = flatNode.getText(region);
+ String prefix = getPrefix(tagName);
+ String uri = getUri(prefix);
+ String[] parentTags = Utils.getParentTags(xmlnode, true, true);
+ String parent = Utils.getParent(xmlnode, true, true, true);
+
+ KbQuery kbQuery = Utils.createKbQuery(Type.ATTRIBUTE_NAME, fDocumentPosition, query, query, //$NON-NLS-1$
+ prefix, uri, parentTags, parent, false);
+
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, fContext);
+ if (proposals == null)
+ return null;
+
+ for(TextProposal proposal : proposals) {
+ if (proposal != null && proposal.getContextInfo() != null &&
+ proposal.getContextInfo().trim().length() > 0) {
+ return proposal.getContextInfo();
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ protected String computeTagAttValueHelp(IDOMNode xmlnode,
+ IDOMNode parentNode, IStructuredDocumentRegion flatNode,
+ ITextRegion region) {
+ return null;
+ }
+
+ @Override
+ protected String computeTagNameHelp(IDOMNode xmlnode, IDOMNode parentNode,
+ IStructuredDocumentRegion flatNode, ITextRegion region) {
+ if (fContext == null)
+ return null;
+
+ String query = Utils.getTagName(xmlnode, true);
+ String prefix = getPrefix(query);
+ String uri = getUri(prefix);
+ String[] parentTags = Utils.getParentTags(xmlnode, false, true);
+ String parent = Utils.getParent(xmlnode, false, false, true);
+
+ KbQuery kbQuery = Utils.createKbQuery(Type.TAG_NAME, fDocumentPosition, query, "<" + query, //$NON-NLS-1$
+ prefix, uri, parentTags, parent, false);
+
+ TextProposal[] proposals = PageProcessor.getInstance().getProposals(kbQuery, fContext);
+ if (proposals == null)
+ return null;
+
+ for(TextProposal proposal : proposals) {
+ if (proposal != null && proposal.getContextInfo() != null &&
+ proposal.getContextInfo().trim().length() > 0) {
+ return proposal.getContextInfo();
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns IFile resource of the document
+ *
+ * @return
+ */
+ protected IFile getResource(IDocument document) {
+ IStructuredModel sModel = StructuredModelManager.getModelManager().getExistingModelForRead(document);
+ try {
+ if (sModel != null) {
+ String baseLocation = sModel.getBaseLocation();
+ IPath location = new Path(baseLocation).makeAbsolute();
+ return FileBuffers.getWorkspaceFileAtLocation(location);
+ }
+ }
+ finally {
+ if (sModel != null) {
+ sModel.releaseFromRead();
+ }
+ }
+ return null;
+ }
+
+
+ private String getPrefix(String tagname) {
+ String prefix = null;
+
+ int index = tagname == null ? -1 : tagname.indexOf(':');
+ if (tagname != null && index != -1) {
+ prefix = tagname.substring(0, index);
+ }
+
+ if (prefix != null)
+ return prefix;
+
+ String uri = getUri(""); //$NON-NLS-1$
+ return uri == null ? null : ""; //$NON-NLS-1$
+ }
+
+ private String getUri(String prefix) {
+ if (prefix == null || fContext == null)
+ return null;
+ if (!(fContext instanceof IPageContext))
+ return null;
+
+ Map<String, List<INameSpace>> nameSpaces = ((IPageContext)fContext).getNameSpaces(fDocumentPosition);
+ if (nameSpaces == null || nameSpaces.isEmpty())
+ return null;
+
+ for (List<INameSpace> nameSpace : nameSpaces.values()) {
+ for (INameSpace n : nameSpace) {
+ if (prefix.equals(n.getPrefix())) {
+ return n.getURI();
+ }
+ }
+ }
+ return null;
+ }
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/info/FaceletTagInfoHoverProcessor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years
JBoss Tools SVN: r19480 - trunk/as/plugins/org.jboss.ide.eclipse.as.core.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2009-12-18 17:32:28 -0500 (Fri, 18 Dec 2009)
New Revision: 19480
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-5524 Debugger does not "see" source by default
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2009-12-18 21:14:55 UTC (rev 19479)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2009-12-18 22:32:28 UTC (rev 19480)
@@ -434,7 +434,7 @@
name="JBoss Application Server Startup Configuration"
public="true"
sourceLocatorId="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"
- sourcePathComputerId="org.eclipse.jst.server.tomcat.core.sourcePathComputer"/>
+ sourcePathComputerId="org.eclipse.jst.server.generic.core.sourcePathComputer"/>
<launchConfigurationType
delegate="org.jboss.ide.eclipse.as.core.server.internal.launch.TwiddleLaunchConfiguration"
id="org.jboss.ide.eclipse.as.core.server.twiddleConfiguration"
15 years
JBoss Tools SVN: r19479 - in workspace/dgolovin/jsf2-basics: .settings and 25 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2009-12-18 16:14:55 -0500 (Fri, 18 Dec 2009)
New Revision: 19479
Added:
workspace/dgolovin/jsf2-basics/.classpath
workspace/dgolovin/jsf2-basics/.project
workspace/dgolovin/jsf2-basics/.settings/
workspace/dgolovin/jsf2-basics/.settings/.jsdtscope
workspace/dgolovin/jsf2-basics/.settings/org.eclipse.jdt.core.prefs
workspace/dgolovin/jsf2-basics/.settings/org.eclipse.wst.common.component
workspace/dgolovin/jsf2-basics/.settings/org.eclipse.wst.common.project.facet.core.xml
workspace/dgolovin/jsf2-basics/.settings/org.eclipse.wst.jsdt.ui.superType.container
workspace/dgolovin/jsf2-basics/.settings/org.eclipse.wst.jsdt.ui.superType.name
workspace/dgolovin/jsf2-basics/WebContent/
workspace/dgolovin/jsf2-basics/WebContent/META-INF/
workspace/dgolovin/jsf2-basics/WebContent/META-INF/MANIFEST.MF
workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/
workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/faces-config.xml
workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/lib/
workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/lib/jsf-api.jar
workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/lib/jsf-impl.jar
workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/lib/resources1.jar
workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/web.xml
workspace/dgolovin/jsf2-basics/WebContent/css/
workspace/dgolovin/jsf2-basics/WebContent/css/styles.css
workspace/dgolovin/jsf2-basics/WebContent/images/
workspace/dgolovin/jsf2-basics/WebContent/images/duke1.jpeg
workspace/dgolovin/jsf2-basics/WebContent/images/duke10.jpeg
workspace/dgolovin/jsf2-basics/WebContent/images/duke11.jpeg
workspace/dgolovin/jsf2-basics/WebContent/images/duke12.jpeg
workspace/dgolovin/jsf2-basics/WebContent/images/duke2.jpeg
workspace/dgolovin/jsf2-basics/WebContent/images/duke3.jpeg
workspace/dgolovin/jsf2-basics/WebContent/images/duke4.jpeg
workspace/dgolovin/jsf2-basics/WebContent/images/duke5.jpeg
workspace/dgolovin/jsf2-basics/WebContent/images/duke6.jpeg
workspace/dgolovin/jsf2-basics/WebContent/images/duke7.jpeg
workspace/dgolovin/jsf2-basics/WebContent/images/duke8.jpeg
workspace/dgolovin/jsf2-basics/WebContent/images/duke9.jpeg
workspace/dgolovin/jsf2-basics/WebContent/index.html
workspace/dgolovin/jsf2-basics/WebContent/resource-handling-1.xhtml
workspace/dgolovin/jsf2-basics/WebContent/resources/
workspace/dgolovin/jsf2-basics/WebContent/resources/en/
workspace/dgolovin/jsf2-basics/WebContent/resources/en_US/
workspace/dgolovin/jsf2-basics/WebContent/resources/en_US/image.png
workspace/dgolovin/jsf2-basics/WebContent/resources/en_US/library3/
workspace/dgolovin/jsf2-basics/WebContent/resources/en_US/library3/image.png
workspace/dgolovin/jsf2-basics/WebContent/resources/image.png
workspace/dgolovin/jsf2-basics/WebContent/resources/image.xcf
workspace/dgolovin/jsf2-basics/WebContent/resources/library0/
workspace/dgolovin/jsf2-basics/WebContent/resources/library0/image.png
workspace/dgolovin/jsf2-basics/WebContent/resources/library1/
workspace/dgolovin/jsf2-basics/WebContent/resources/library1/1_0/
workspace/dgolovin/jsf2-basics/WebContent/resources/library1/1_0/image.png
workspace/dgolovin/jsf2-basics/WebContent/resources/library1/1_1/
workspace/dgolovin/jsf2-basics/WebContent/resources/library1/1_1/image.png
workspace/dgolovin/jsf2-basics/WebContent/resources/library1/1_2/
workspace/dgolovin/jsf2-basics/WebContent/resources/library1/1_2/image.png/
workspace/dgolovin/jsf2-basics/WebContent/resources/library1/1_2/image.png/1_0.png
workspace/dgolovin/jsf2-basics/WebContent/resources/library1/1_2/image.png/1_1.png
workspace/dgolovin/jsf2-basics/WebContent/resources/library1/image.png
workspace/dgolovin/jsf2-basics/WebContent/resources/ru/
workspace/dgolovin/jsf2-basics/WebContent/resources/ru/image.png
workspace/dgolovin/jsf2-basics/WebContent/resources/title.png
workspace/dgolovin/jsf2-basics/build/
workspace/dgolovin/jsf2-basics/build/classes/
workspace/dgolovin/jsf2-basics/build/classes/META-INF/
workspace/dgolovin/jsf2-basics/build/classes/META-INF/resources/
workspace/dgolovin/jsf2-basics/build/classes/META-INF/resources/duke2.jpeg
workspace/dgolovin/jsf2-basics/build/classes/coreservlets/
workspace/dgolovin/jsf2-basics/build/classes/coreservlets/BankCustomer.class
workspace/dgolovin/jsf2-basics/build/classes/coreservlets/BankCustomerLookupService.class
workspace/dgolovin/jsf2-basics/build/classes/coreservlets/BankingBean.class
workspace/dgolovin/jsf2-basics/build/classes/coreservlets/HealthPlanBean.class
workspace/dgolovin/jsf2-basics/build/classes/messages_en.properties
workspace/dgolovin/jsf2-basics/build/classes/messages_en_US.properties
workspace/dgolovin/jsf2-basics/build/classes/messages_ru.properties
workspace/dgolovin/jsf2-basics/src/
workspace/dgolovin/jsf2-basics/src/META-INF/
workspace/dgolovin/jsf2-basics/src/META-INF/resources/
workspace/dgolovin/jsf2-basics/src/META-INF/resources/duke2.jpeg
workspace/dgolovin/jsf2-basics/src/coreservlets/
workspace/dgolovin/jsf2-basics/src/coreservlets/BankCustomer.java
workspace/dgolovin/jsf2-basics/src/coreservlets/BankCustomerLookupService.java
workspace/dgolovin/jsf2-basics/src/coreservlets/BankingBean.java
workspace/dgolovin/jsf2-basics/src/coreservlets/HealthPlanBean.java
workspace/dgolovin/jsf2-basics/src/messages_en.properties
workspace/dgolovin/jsf2-basics/src/messages_en_US.properties
workspace/dgolovin/jsf2-basics/src/messages_ru.properties
Log:
Jsf2 complex example
Added: workspace/dgolovin/jsf2-basics/.classpath
===================================================================
--- workspace/dgolovin/jsf2-basics/.classpath (rev 0)
+++ workspace/dgolovin/jsf2-basics/.classpath 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
+ <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
+ <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.jboss.ide.eclipse.as.core.server.runtime.runtimeTarget/JBoss 5.0 Runtime">
+ <attributes>
+ <attribute name="owner.project.facets" value="jst.web"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-6-sun-1.6.0.16"/>
+ <classpathentry kind="output" path="build/classes"/>
+</classpath>
Property changes on: workspace/dgolovin/jsf2-basics/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/jsf2-basics/.project
===================================================================
--- workspace/dgolovin/jsf2-basics/.project (rev 0)
+++ workspace/dgolovin/jsf2-basics/.project 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jsf2-basics</name>
+ <comment></comment>
+ <projects>
+ <project>resources1</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+ </natures>
+</projectDescription>
Property changes on: workspace/dgolovin/jsf2-basics/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/jsf2-basics/.settings/.jsdtscope
===================================================================
--- workspace/dgolovin/jsf2-basics/.settings/.jsdtscope (rev 0)
+++ workspace/dgolovin/jsf2-basics/.settings/.jsdtscope 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
+ <attributes>
+ <attribute name="hide" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
+ <classpathentry kind="output" path=""/>
+</classpath>
Added: workspace/dgolovin/jsf2-basics/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- workspace/dgolovin/jsf2-basics/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ workspace/dgolovin/jsf2-basics/.settings/org.eclipse.jdt.core.prefs 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1,7 @@
+#Mon Aug 17 16:43:17 EDT 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Property changes on: workspace/dgolovin/jsf2-basics/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/jsf2-basics/.settings/org.eclipse.wst.common.component
===================================================================
--- workspace/dgolovin/jsf2-basics/.settings/org.eclipse.wst.common.component (rev 0)
+++ workspace/dgolovin/jsf2-basics/.settings/org.eclipse.wst.common.component 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-modules id="moduleCoreId" project-version="1.5.0">
+ <wb-module deploy-name="jsf-basics">
+ <wb-resource deploy-path="/" source-path="/WebContent"/>
+ <wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
+ <dependent-module archiveName="resources1.jar" deploy-path="/" handle="module:/resource/resources1/resources1">
+ <dependency-type>uses</dependency-type>
+ </dependent-module>
+ <dependent-module archiveName="resources1.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/resources1/resources1">
+ <dependency-type>uses</dependency-type>
+ </dependent-module>
+ <property name="context-root" value="jsf-basics"/>
+ <property name="java-output-path"/>
+ </wb-module>
+</project-modules>
Added: workspace/dgolovin/jsf2-basics/.settings/org.eclipse.wst.common.project.facet.core.xml
===================================================================
--- workspace/dgolovin/jsf2-basics/.settings/org.eclipse.wst.common.project.facet.core.xml (rev 0)
+++ workspace/dgolovin/jsf2-basics/.settings/org.eclipse.wst.common.project.facet.core.xml 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <runtime name="JBoss 5.0 Runtime"/>
+ <fixed facet="jst.web"/>
+ <fixed facet="jst.java"/>
+ <installed facet="jst.java" version="6.0"/>
+ <installed facet="jst.web" version="2.5"/>
+</faceted-project>
Property changes on: workspace/dgolovin/jsf2-basics/.settings/org.eclipse.wst.common.project.facet.core.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/jsf2-basics/.settings/org.eclipse.wst.jsdt.ui.superType.container
===================================================================
--- workspace/dgolovin/jsf2-basics/.settings/org.eclipse.wst.jsdt.ui.superType.container (rev 0)
+++ workspace/dgolovin/jsf2-basics/.settings/org.eclipse.wst.jsdt.ui.superType.container 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1 @@
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
Added: workspace/dgolovin/jsf2-basics/.settings/org.eclipse.wst.jsdt.ui.superType.name
===================================================================
--- workspace/dgolovin/jsf2-basics/.settings/org.eclipse.wst.jsdt.ui.superType.name (rev 0)
+++ workspace/dgolovin/jsf2-basics/.settings/org.eclipse.wst.jsdt.ui.superType.name 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1 @@
+Window
\ No newline at end of file
Added: workspace/dgolovin/jsf2-basics/WebContent/META-INF/MANIFEST.MF
===================================================================
--- workspace/dgolovin/jsf2-basics/WebContent/META-INF/MANIFEST.MF (rev 0)
+++ workspace/dgolovin/jsf2-basics/WebContent/META-INF/MANIFEST.MF 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/faces-config.xml
===================================================================
--- workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/faces-config.xml (rev 0)
+++ workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/faces-config.xml 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
+ version="2.0">
+ <application>
+ <locale-config>
+ <default-locale>en_US</default-locale>
+ <supported-locale>en_US</supported-locale>
+ </locale-config>
+ <message-bundle>messages_ru</message-bundle>
+ <message-bundle>messages_en</message-bundle>
+ <message-bundle>messages_en_US</message-bundle>
+ </application>
+</faces-config>
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/faces-config.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/lib/jsf-api.jar
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/lib/jsf-api.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/lib/jsf-impl.jar
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/lib/jsf-impl.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/lib/resources1.jar
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/lib/resources1.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/web.xml
===================================================================
--- workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/web.xml (rev 0)
+++ workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/web.xml 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <context-param>
+ <param-name>javax.faces.PROJECT_STAGE</param-name>
+ <param-value>Development</param-value>
+ </context-param>
+ <welcome-file-list>
+ <welcome-file>index.jsp</welcome-file>
+ <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+</web-app>
\ No newline at end of file
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/WEB-INF/web.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/jsf2-basics/WebContent/css/styles.css
===================================================================
--- workspace/dgolovin/jsf2-basics/WebContent/css/styles.css (rev 0)
+++ workspace/dgolovin/jsf2-basics/WebContent/css/styles.css 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1,55 @@
+body {
+ background-color: #fdf5e6
+}
+
+a:hover {
+ color: red
+}
+
+th.title {
+ background-color: #ef8429;
+ font-size: 28px;
+ font-family: Arial, Helvetica, sans-serif;
+}
+
+th {
+ background-color: #ef8429;
+ font-size: 18px;
+ font-family: Arial, Helvetica, sans-serif;
+}
+
+td {
+ font-size: 18px;
+ font-family: Arial, Helvetica, sans-serif;
+}
+
+legend {
+ font-weight: bold;
+ color: black;
+ background-color: #eeeeee;
+ border: 1px solid #999999;
+ padding: 3px 2px;
+}
+
+.ajaxResult {
+ color: #440000;
+ font-weight: bold;
+ font-size: 18px;
+ font-family: Arial, Helvetica, sans-serif;
+}
+
+h2 {
+ color: #440000;
+ font-weight: bold;
+ font-size: 18px;
+ font-family: Arial, Helvetica, sans-serif;
+}
+
+.error {
+ background-color: yellow;
+ color: red;
+ font-weight: bold;
+ font-size: 20px;
+ font-family: Arial, Helvetica, sans-serif;
+ border-style: inset;
+}
\ No newline at end of file
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/css/styles.css
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/jsf2-basics/WebContent/images/duke1.jpeg
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/images/duke1.jpeg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/images/duke10.jpeg
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/images/duke10.jpeg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/images/duke11.jpeg
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/images/duke11.jpeg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/images/duke12.jpeg
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/images/duke12.jpeg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/images/duke2.jpeg
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/images/duke2.jpeg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/images/duke3.jpeg
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/images/duke3.jpeg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/images/duke4.jpeg
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/images/duke4.jpeg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/images/duke5.jpeg
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/images/duke5.jpeg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/images/duke6.jpeg
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/images/duke6.jpeg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/images/duke7.jpeg
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/images/duke7.jpeg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/images/duke8.jpeg
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/images/duke8.jpeg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/images/duke9.jpeg
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/images/duke9.jpeg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/index.html
===================================================================
--- workspace/dgolovin/jsf2-basics/WebContent/index.html (rev 0)
+++ workspace/dgolovin/jsf2-basics/WebContent/index.html 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>JSF 2.0: VPE Tests</title>
+</head>
+<body>
+ <a href="resource-handling-1.jsf">Resource handling test case 1</a>
+</body>
+</html>
\ No newline at end of file
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/index.html
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/jsf2-basics/WebContent/resource-handling-1.xhtml
===================================================================
--- workspace/dgolovin/jsf2-basics/WebContent/resource-handling-1.xhtml (rev 0)
+++ workspace/dgolovin/jsf2-basics/WebContent/resource-handling-1.xhtml 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1,91 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html">
+ <h:head>
+ <title>Resource Handling Case 1</title>
+ </h:head>
+ <h:body>
+ <h:outputText value="#{facesContext.viewRoot.locale}" />
+ <h:panelGrid border="1" columns="6">
+ <h:outputText value="Locale"/>
+ <h:outputText value="Library"/>
+ <h:outputText value="Version"/>
+ <h:outputText value="Resource"/>
+ <h:outputText value="Version"/>
+ <h:graphicImage value="#{resource['title.png']}" />
+
+ <h:outputText value="#{facesContext.viewRoot.locale}"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="image.png"/>
+ <h:outputText value="n/a"/>
+ <h:graphicImage value="#{resource['image.png']}" />
+
+ <h:outputText value="#{facesContext.viewRoot.locale}"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="image.png"/>
+ <h:outputText value="n/a"/>
+ <h:graphicImage value="#{resource['library3:image.png']}" />
+
+ <h:outputText value="n/a"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="image.png"/>
+ <h:outputText value="n/a"/>
+ <h:graphicImage value="#{resource['library1:image.png']}" />
+ <h:outputText value="n/a"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="image.png"/>
+ <h:outputText value="n/a"/>
+ <h:graphicImage value="#{resource['library1/1_0:image.png']}" />
+ <h:outputText value="n/a"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="image.png"/>
+ <h:outputText value="n/a"/>
+ <h:graphicImage value="#{resource['library1/1_1:image.png']}" />
+ <h:outputText value="n/a"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="image.png"/>
+ <h:outputText value="n/a"/>
+ <h:graphicImage value="#{resource['library1/1_2:duke.png/1_0.png']}" />
+ <h:outputText value="n/a"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="image.png"/>
+ <h:outputText value="n/a"/>
+ <h:graphicImage value="#{resource['library1/1_2:duke.png/1_1.png']}" />
+ <h:outputText value="n/a"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="image.png"/>
+ <h:outputText value="n/a"/>
+ <h:graphicImage name="image.png" />
+ <h:outputText value="n/a"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="image.png"/>
+ <h:outputText value="n/a"/>
+ <h:graphicImage name="image.png" library="library1" />
+ <h:outputText value="n/a"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="image.png"/>
+ <h:outputText value="n/a"/>
+ <h:graphicImage name="duke1.jpeg"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="n/a"/>
+ <h:outputText value="image.png"/>
+ <h:outputText value="n/a"/>
+ <h:graphicImage name="duke3.jpeg"/>
+ </h:panelGrid>
+
+ <img src="/jsf-basics/javax.faces.resource/image.png?loc=en_US" />
+
+ </h:body>
+</html>
\ No newline at end of file
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/resource-handling-1.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/jsf2-basics/WebContent/resources/en_US/image.png
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/resources/en_US/image.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/resources/en_US/library3/image.png
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/resources/en_US/library3/image.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/resources/image.png
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/resources/image.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/resources/image.xcf
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/resources/image.xcf
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/resources/library0/image.png
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/resources/library0/image.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/resources/library1/1_0/image.png
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/resources/library1/1_0/image.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/resources/library1/1_1/image.png
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/resources/library1/1_1/image.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/resources/library1/1_2/image.png/1_0.png
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/resources/library1/1_2/image.png/1_0.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/resources/library1/1_2/image.png/1_1.png
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/resources/library1/1_2/image.png/1_1.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/resources/library1/image.png
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/resources/library1/image.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/resources/ru/image.png
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/resources/ru/image.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/WebContent/resources/title.png
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/WebContent/resources/title.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/build/classes/META-INF/resources/duke2.jpeg
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/build/classes/META-INF/resources/duke2.jpeg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/build/classes/coreservlets/BankCustomer.class
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/build/classes/coreservlets/BankCustomer.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/build/classes/coreservlets/BankCustomerLookupService.class
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/build/classes/coreservlets/BankCustomerLookupService.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/build/classes/coreservlets/BankingBean.class
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/build/classes/coreservlets/BankingBean.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/build/classes/coreservlets/HealthPlanBean.class
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/build/classes/coreservlets/HealthPlanBean.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/build/classes/messages_en.properties
===================================================================
--- workspace/dgolovin/jsf2-basics/build/classes/messages_en.properties (rev 0)
+++ workspace/dgolovin/jsf2-basics/build/classes/messages_en.properties 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1 @@
+javax.faces.resource.localePrefix=en
Added: workspace/dgolovin/jsf2-basics/build/classes/messages_en_US.properties
===================================================================
--- workspace/dgolovin/jsf2-basics/build/classes/messages_en_US.properties (rev 0)
+++ workspace/dgolovin/jsf2-basics/build/classes/messages_en_US.properties 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1 @@
+javax.faces.resource.localePrefix=en_US
Added: workspace/dgolovin/jsf2-basics/build/classes/messages_ru.properties
===================================================================
--- workspace/dgolovin/jsf2-basics/build/classes/messages_ru.properties (rev 0)
+++ workspace/dgolovin/jsf2-basics/build/classes/messages_ru.properties 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1 @@
+javax.faces.resource.localePrefix=ru
Added: workspace/dgolovin/jsf2-basics/src/META-INF/resources/duke2.jpeg
===================================================================
(Binary files differ)
Property changes on: workspace/dgolovin/jsf2-basics/src/META-INF/resources/duke2.jpeg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/dgolovin/jsf2-basics/src/coreservlets/BankCustomer.java
===================================================================
--- workspace/dgolovin/jsf2-basics/src/coreservlets/BankCustomer.java (rev 0)
+++ workspace/dgolovin/jsf2-basics/src/coreservlets/BankCustomer.java 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1,46 @@
+package coreservlets;
+
+/** Bean to represent a bank customer. Immutable.
+ * <p>
+ * From <a href="http://courses.coreservlets.com/Course-Materials/">the
+ * coreservlets.com tutorials on servlets, JSP, Struts, JSF, Ajax, GWT,
+ * Spring, Hibernate/JPA, and Java programming</a>.
+ */
+
+public class BankCustomer {
+ private final String id, firstName, lastName;
+ private final double balance;
+
+ public BankCustomer(String id,
+ String firstName,
+ String lastName,
+ double balance) {
+ this.id = id;
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.balance = balance;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getFirstName() {
+ return(firstName);
+ }
+
+ public String getLastName() {
+ return(lastName);
+ }
+
+ public double getBalance() {
+ return(balance);
+ }
+
+ public String getBalanceNoSign() {
+ String balanceString =
+ String.format("%,.2f", Math.abs(balance));
+ return(balanceString);
+ }
+}
+
Property changes on: workspace/dgolovin/jsf2-basics/src/coreservlets/BankCustomer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/jsf2-basics/src/coreservlets/BankCustomerLookupService.java
===================================================================
--- workspace/dgolovin/jsf2-basics/src/coreservlets/BankCustomerLookupService.java (rev 0)
+++ workspace/dgolovin/jsf2-basics/src/coreservlets/BankCustomerLookupService.java 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1,42 @@
+package coreservlets;
+
+import java.util.*;
+
+public class BankCustomerLookupService {
+ // Makes a small table of banking customers.
+
+ private static Map<String,BankCustomer> customers;
+
+ static {
+ customers = new HashMap<String,BankCustomer>();
+ customers.put("id001",
+ new BankCustomer("id001",
+ "Harry",
+ "Hacker",
+ -3456.78));
+ customers.put("id002",
+ new BankCustomer("id002",
+ "Codie",
+ "Coder",
+ 1234.56));
+ customers.put("id003",
+ new BankCustomer("id003",
+ "Polly",
+ "Programmer",
+ 987654.32));
+ }
+
+ public static Map<String,BankCustomer> getSampleCustomers() {
+ return(customers);
+ }
+
+ /** Finds the customer with the given non-null ID.
+ * Returns null if there is no match.
+ */
+
+ public static BankCustomer getCustomer(String id) {
+ return(customers.get(id.toLowerCase()));
+ }
+
+ private BankCustomerLookupService() {} // Non-instantiatable class
+}
Property changes on: workspace/dgolovin/jsf2-basics/src/coreservlets/BankCustomerLookupService.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/jsf2-basics/src/coreservlets/BankingBean.java
===================================================================
--- workspace/dgolovin/jsf2-basics/src/coreservlets/BankingBean.java (rev 0)
+++ workspace/dgolovin/jsf2-basics/src/coreservlets/BankingBean.java 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1,79 @@
+package coreservlets;
+
+import javax.faces.bean.*;
+
+/** From <a href="http://courses.coreservlets.com/Course-Materials/">the
+ * coreservlets.com tutorials on servlets, JSP, Struts, JSF, Ajax, GWT,
+ * Spring, Hibernate/JPA, and Java programming</a>.
+ */
+
+@ManagedBean
+public class BankingBean {
+ private String customerId, password, message="";
+
+ private BankCustomer customer;
+
+ public String getCustomerId() {
+ return(customerId);
+ }
+
+ public void setCustomerId(String customerId) {
+ this.customerId = customerId;
+ }
+
+ public String getPassword() {
+ return(password);
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public BankCustomer getCustomer() {
+ return(customer);
+ }
+
+ public String getMessage() {
+ return(message);
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public String showBalancePage() {
+ if (!password.equals("secret")) {
+ return("wrong-password");
+ }
+ customer =
+ BankCustomerLookupService.getCustomer(customerId);
+ if (customer == null) {
+ return("unknown-customer");
+ } else if (customer.getBalance() < 0) {
+ return("negative-balance");
+ } else if (customer.getBalance() < 10000) {
+ return("normal-balance");
+ } else {
+ return("high-balance");
+ }
+ }
+
+ public String showBalanceMessage() {
+ if (!password.equals("secret")) {
+ message = "Incorrect password";
+ } else {
+ customer =
+ BankCustomerLookupService.getCustomer(customerId);
+ if (customer == null) {
+ message = "Unknown customer";
+ } else {
+ message =
+ String.format("Balance for %s %s is $%,.2f",
+ customer.getFirstName(),
+ customer.getLastName(),
+ customer.getBalance());
+ }
+ }
+ return(null);
+ }
+}
Property changes on: workspace/dgolovin/jsf2-basics/src/coreservlets/BankingBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/jsf2-basics/src/coreservlets/HealthPlanBean.java
===================================================================
--- workspace/dgolovin/jsf2-basics/src/coreservlets/HealthPlanBean.java (rev 0)
+++ workspace/dgolovin/jsf2-basics/src/coreservlets/HealthPlanBean.java 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1,19 @@
+package coreservlets;
+
+import javax.faces.bean.*;
+
+@ManagedBean
+public class HealthPlanBean {
+ public String signup() {
+ if (Math.random() < 0.2) {
+ return("accepted");
+ } else {
+ return("rejected");
+ }
+ }
+}
+
+
+// Note: there is no persistent state, so I could have specified @ApplicationScoped above class.
+// But I wanted to keep this simple. Besides, in real applications, application scope is rare,
+// because most beans of this type have state (properties that capture user input).
Property changes on: workspace/dgolovin/jsf2-basics/src/coreservlets/HealthPlanBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/jsf2-basics/src/messages_en.properties
===================================================================
--- workspace/dgolovin/jsf2-basics/src/messages_en.properties (rev 0)
+++ workspace/dgolovin/jsf2-basics/src/messages_en.properties 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1 @@
+javax.faces.resource.localePrefix=en
Property changes on: workspace/dgolovin/jsf2-basics/src/messages_en.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/jsf2-basics/src/messages_en_US.properties
===================================================================
--- workspace/dgolovin/jsf2-basics/src/messages_en_US.properties (rev 0)
+++ workspace/dgolovin/jsf2-basics/src/messages_en_US.properties 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1 @@
+javax.faces.resource.localePrefix=en_US
Property changes on: workspace/dgolovin/jsf2-basics/src/messages_en_US.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: workspace/dgolovin/jsf2-basics/src/messages_ru.properties
===================================================================
--- workspace/dgolovin/jsf2-basics/src/messages_ru.properties (rev 0)
+++ workspace/dgolovin/jsf2-basics/src/messages_ru.properties 2009-12-18 21:14:55 UTC (rev 19479)
@@ -0,0 +1 @@
+javax.faces.resource.localePrefix=ru
Property changes on: workspace/dgolovin/jsf2-basics/src/messages_ru.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years