From 4236c89f746d2dfce8ac735b4eefbc778973a821 Mon Sep 17 00:00:00 2001 From: jechoi Date: Thu, 22 Jun 2006 08:29:24 +0000 Subject: bug fix 148071: From-Outcome browser from Link property sheet always displays empty list --- .../properties/ActionOutcomeSelectionDialog.java | 42 ++++++++-------------- .../jsf/facesconfig/ui/pageflow/util/JSPUtil.java | 16 ++++----- 2 files changed, 21 insertions(+), 37 deletions(-) diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ActionOutcomeSelectionDialog.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ActionOutcomeSelectionDialog.java index 90e70c88d..c8cee09e2 100644 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ActionOutcomeSelectionDialog.java +++ b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/properties/ActionOutcomeSelectionDialog.java @@ -24,8 +24,8 @@ import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.JSPUtil; import org.eclipse.swt.SWT; 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.events.SelectionListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; @@ -195,21 +195,13 @@ public class ActionOutcomeSelectionDialog extends Dialog { actionCol .setText(PageflowMessages.Pageflow_Property_Action_OutcomeSelectionDialog_ActionListTable_Action);//$NON-NLS-1$ - actionTable.addSelectionListener(new SelectionListener() { - + actionTable.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { TableItem selItem = (TableItem) e.item; String action = selItem.getText(1); - if (action != null && action.length() > 0) { + if (action != null && action.length() > 0) actionText.setText(action); - } - } - - public void widgetDefaultSelected(SelectionEvent e) { - // TODO Auto-generated method stub - } - }); addActionsInJSP(); @@ -306,7 +298,7 @@ public class ActionOutcomeSelectionDialog extends Dialog { * @return */ private boolean isValidName() { - return (actionText.getText().length() > 0); + return actionText.getText().length() > 0; } /** @@ -326,33 +318,29 @@ public class ActionOutcomeSelectionDialog extends Dialog { List actionNodes = JSPUtil.getActionListInJSPFile(jspName); if (actionNodes != null) { - for (int i = 0; i < actionNodes.size(); i++) { + for (int i = 0, n = actionNodes.size(); i < n; i++) { Element node = (Element) actionNodes.get(i); + StringBuffer componentName = new StringBuffer(); - String tagName = node.getTagName(); Attr idAttr = node.getAttributeNode("id"); - String id = ""; - if (idAttr != null) { - id = idAttr.getNodeValue(); //$NON-NLS-1$ - } + if (idAttr != null) + componentName.append(idAttr.getNodeValue()); + + componentName.append("(").append(node.getTagName()).append(")"); //$NON-NLS-1$ - String componentName = id + "(" + tagName + ")"; //$NON-NLS-1$ Attr actionAttr = node.getAttributeNode("action"); - String action = ""; if (actionAttr != null) { - action = actionAttr.getValue(); - if (!isValidEL(action)) { - addActionTableItem(componentName, action); - } + String action = actionAttr.getValue(); + if (isValidEL(action)) + addActionTableItem(componentName.toString(), action); } } } } public static boolean isValidEL(String expressionString) { - if (expressionString == null || expressionString.length() == 0) { + if (expressionString == null || expressionString.length() == 0) return true; - } return expressionString.startsWith(JSF_EL_LEFT_BRACE) && expressionString.endsWith(JSF_EL_RIGHT_BRACE); @@ -373,7 +361,5 @@ public class ActionOutcomeSelectionDialog extends Dialog { item.setText(0, componentName); item.setText(1, action); } - } - } diff --git a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/JSPUtil.java b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/JSPUtil.java index 527e7c3f3..dbd215154 100644 --- a/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/JSPUtil.java +++ b/jsf/plugins/org.eclipse.jst.jsf.facesconfig.ui/src/org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/JSPUtil.java @@ -69,9 +69,9 @@ public class JSPUtil { List trackers = m.getTaglibTrackers(); for (Iterator iter = trackers.iterator(); iter.hasNext();) { TaglibTracker tracker = (TaglibTracker) iter.next(); - if (uri.equals(tracker.getURI())) { + if (uri.equals(tracker.getURI())) return tracker.getPrefix(); - } else { + else { CMDocument cmdoc = tracker.getDocument(); if (cmdoc instanceof TLDDocument && uri.equals(((TLDDocument) cmdoc).getUri())) { @@ -122,15 +122,15 @@ public class JSPUtil { TaglibTracker tracker = (TaglibTracker) iter.next(); if (prefix.equals(tracker.getPrefix())) { CMDocument cmdoc = tracker.getDocument(); - if (cmdoc instanceof TLDDocument) { + if (cmdoc instanceof TLDDocument) return ((TLDDocument) cmdoc).getUri(); - } else + else return null; } } return null; } - + /** * get the action list in the jsp file * @@ -160,16 +160,14 @@ public class JSPUtil { // get the command butonns List buttonActions = jspAdapter.getElementsByTagNameNS( prefix, "commandButton");//$NON-NLS-1$ - if (buttonActions != null) { + if (buttonActions != null) actions.addAll(buttonActions); - } // get the command links List linkActions = jspAdapter.getElementsByTagNameNS( prefix, "commandLink");//$NON-NLS-1$ - if (linkActions != null) { + if (linkActions != null) actions.addAll(linkActions); - } } } } -- cgit v1.2.3