Author: mareshkau
Date: 2011-02-18 10:21:38 -0500 (Fri, 18 Feb 2011)
New Revision: 29242
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/ExternalizeStringsWizardRegisterBundlePage.java
Log:
https://issues.jboss.org/browse/JBIDE-7003, working on Externalize dialog, trying to
removed dependency of dialog from JSPMultipage editor to make it usable without editor.
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 2011-02-18
14:54:49 UTC (rev 29241)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizard.java 2011-02-18
15:21:38 UTC (rev 29242)
@@ -79,7 +79,7 @@
public static final String EXTERNALIZE_STRINGS_DIALOG_NEW_FILE_PAGE =
"EXTERNALIZE_STRINGS_DIALOG_NEW_FILE_PAGE"; //$NON-NLS-1$
- ITextEditor editor = null;
+ private ITextEditor editor = null;
BundleMap bm = null;
ExternalizeStringsWizardPage page1 = null;
WizardNewFileCreationPage page2 = null;
@@ -134,7 +134,7 @@
if (null != containerFullPath) {
page2.setContainerFullPath(containerFullPath);
}
- String fileName = editor.getEditorInput().getName();
+ String fileName = getFileName();
int pos = fileName.lastIndexOf(Constants.DOT);
if (pos != -1) {
fileName = fileName.substring(0, pos) + Constants.PROPERTIES_EXTENTION;
@@ -210,8 +210,8 @@
*/
if (page1.isNewFile() && !page3.isUserDefined()) {
var = page3.getBundleName();
- if (editor.getEditorInput() instanceof IFileEditorInput) {
- IProject project =
((IFileEditorInput)editor.getEditorInput()).getFile().getProject();
+ if (getProject()!=null) {
+ IProject project = getProject();
String userDefinedPath = page2.getContainerFullPath().toString();
/*
* Get the source folders for the project
@@ -536,4 +536,16 @@
}
return containerFullPath;
}
+
+ protected String getFileName(){
+ return editor.getEditorInput().getName();
+ }
+
+ protected IProject getProject(){
+ IProject project = null;
+ if (editor.getEditorInput() instanceof IFileEditorInput) {
+ project = ((IFileEditorInput)editor.getEditorInput()).getFile().getProject();
+ }
+ return project;
+ }
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardRegisterBundlePage.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardRegisterBundlePage.java 2011-02-18
14:54:49 UTC (rev 29241)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardRegisterBundlePage.java 2011-02-18
15:21:38 UTC (rev 29242)
@@ -24,7 +24,6 @@
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
import org.jboss.tools.common.EclipseUtil;
import org.jboss.tools.common.model.ui.ModelUIImages;
@@ -89,8 +88,7 @@
bundleName.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1));
String fileName = Constants.EMPTY;
if (getWizard() instanceof ExternalizeStringsWizard) {
- fileName = ((ExternalizeStringsWizard) getWizard()).editor
- .getEditorInput().getName();
+ fileName = ((ExternalizeStringsWizard) getWizard()).getFileName();
int pos = fileName.lastIndexOf(Constants.DOT);
if (pos != -1) {
fileName = fileName.substring(0, pos);
@@ -184,22 +182,22 @@
}
}
- /**
- * Gets the selected place.
- *
- * @return the selected place
- */
- private int getSelectedPlace() {
- int place = FACES_CONFIG;
- if (isInFacesConfig()) {
- place = FACES_CONFIG;
- } else if (isViaLoadBundle()) {
- place = LOAD_BUNDLE;
- } else if (isUserDefined()) {
- place = USER_DEFINED;
- }
- return place;
- }
+// /**
+// * Gets the selected place.
+// *
+// * @return the selected place
+// */
+// private int getSelectedPlace() {
+// int place = FACES_CONFIG;
+// if (isInFacesConfig()) {
+// place = FACES_CONFIG;
+// } else if (isViaLoadBundle()) {
+// place = LOAD_BUNDLE;
+// } else if (isUserDefined()) {
+// place = USER_DEFINED;
+// }
+// return place;
+// }
/**
* Update bundle name field.
@@ -223,8 +221,8 @@
boolean sourceFolderSelected = false;
if (getWizard() instanceof ExternalizeStringsWizard) {
ExternalizeStringsWizard wiz = (ExternalizeStringsWizard) getWizard();
- if (wiz.editor.getEditorInput() instanceof IFileEditorInput) {
- IProject project =
((IFileEditorInput)(wiz.editor.getEditorInput())).getFile().getProject();
+ if (wiz.getProject()!=null) {
+ IProject project = wiz.getProject();
WizardNewFileCreationPage page2 = (WizardNewFileCreationPage)wiz.getPage(
ExternalizeStringsWizard.EXTERNALIZE_STRINGS_DIALOG_NEW_FILE_PAGE);
String userDefinedPath = page2.getContainerFullPath().toString();