Author: dmaliarevich
Date: 2010-11-30 10:52:47 -0500 (Tue, 30 Nov 2010)
New Revision: 27026
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizard.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/JstUIMessages.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/messages.properties
Log:
https://jira.jboss.org/browse/JBIDE-7758 , fixed.
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizard.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizard.java 2010-11-30
15:49:17 UTC (rev 27025)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizard.java 2010-11-30
15:52:47 UTC (rev 27026)
@@ -30,6 +30,8 @@
import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.wst.xml.core.internal.document.AttrImpl;
+import org.eclipse.wst.xml.core.internal.document.ElementImpl;
import org.jboss.tools.common.EclipseUtil;
import org.jboss.tools.common.meta.action.XActionInvoker;
import org.jboss.tools.common.meta.action.impl.handlers.DefaultCreateHandler;
@@ -337,7 +339,24 @@
jsfCoreTaglibPrefix + Constants.COLON + "loadBundle"); //$NON-NLS-1$
loadBundle.setAttribute("var", var); //$NON-NLS-1$
loadBundle.setAttribute("basename", bundlePath); //$NON-NLS-1$
- node.getParentNode().insertBefore(loadBundle, node);
+ Node elementToInsertBefore = null;
+ Node refChild = null;
+ if (node.getParentNode() != null) {
+ refChild = node;
+ elementToInsertBefore = node.getParentNode();
+ } else if (node instanceof AttrImpl) {
+ AttrImpl attr = (AttrImpl) node;
+ if ((attr.getOwnerElement().getParentNode() != null)){
+ refChild = attr.getOwnerElement();
+ elementToInsertBefore = attr.getOwnerElement().getParentNode();
+ }
+ }
+ if ((elementToInsertBefore != null) && (refChild != null)){
+ elementToInsertBefore.insertBefore(loadBundle, refChild);
+ } else {
+ JspEditorPlugin.getDefault().logWarning(
+ JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_CANNOT_ADD_LOAD_BUNDLE_TAG);
+ }
}
}
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/JstUIMessages.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/JstUIMessages.java 2010-11-30
15:49:17 UTC (rev 27025)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/JstUIMessages.java 2010-11-30
15:52:47 UTC (rev 27026)
@@ -164,5 +164,6 @@
public static String EXTERNALIZE_STRINGS_DIALOG_USER_DEFINED;
public static String EXTERNALIZE_STRINGS_DIALOG_BUNDLE_NAME;
public static String EXTERNALIZE_STRINGS_DIALOG_WRONG_BUNDLE_PLACEMENT;
+ public static String EXTERNALIZE_STRINGS_DIALOG_CANNOT_ADD_LOAD_BUNDLE_TAG;
}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/messages.properties
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/messages.properties 2010-11-30
15:49:17 UTC (rev 27025)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/messages/messages.properties 2010-11-30
15:52:47 UTC (rev 27026)
@@ -143,3 +143,4 @@
EXTERNALIZE_STRINGS_DIALOG_USER_DEFINED=manually by user
EXTERNALIZE_STRINGS_DIALOG_BUNDLE_NAME=Bundle name:
EXTERNALIZE_STRINGS_DIALOG_WRONG_BUNDLE_PLACEMENT=Resource Bundle file should be created
in the source folder.\n Basename will be incorect.
+EXTERNALIZE_STRINGS_DIALOG_CANNOT_ADD_LOAD_BUNDLE_TAG=Cannot add loadBundle tag