[jbosstools-commits] JBoss Tools SVN: r22545 - in trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe: editor/mozilla and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Jun 4 09:38:01 EDT 2010


Author: dmaliarevich
Date: 2010-06-04 09:38:00 -0400 (Fri, 04 Jun 2010)
New Revision: 22545

Modified:
   trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/dialog/ExternalizeStringsWizard.java
   trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/dialog/ExternalizeStringsWizardPage.java
   trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
   trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java
   trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
Log:
https://jira.jboss.org/browse/JBIDE-6287 , New File creation was added, table with content of properties file was added.

Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/dialog/ExternalizeStringsWizard.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/dialog/ExternalizeStringsWizard.java	2010-06-04 13:35:48 UTC (rev 22544)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/dialog/ExternalizeStringsWizard.java	2010-06-04 13:38:00 UTC (rev 22545)
@@ -10,14 +10,26 @@
  ******************************************************************************/
 package org.jboss.tools.vpe.editor.dialog;
 
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.jboss.tools.common.model.ui.ModelUIImages;
 import org.jboss.tools.vpe.editor.VpeController;
 import org.jboss.tools.vpe.messages.VpeUIMessages;
 
 public class ExternalizeStringsWizard extends Wizard {
 	
+	public String ExternalizeStringsWizardPageName = "ExternalizeStringsWizardPage";
+	public String NewFileCreationPageName = "NewFileCreationPage";
+	
 	VpeController vpeController = null;
-	ExternalizeStringsWizardPage page = null;
+	ExternalizeStringsWizardPage page1 = null;
+	WizardNewFileCreationPage page2 = null;
 	
 	public ExternalizeStringsWizard(VpeController vpeController) {
 		super();
@@ -28,18 +40,56 @@
 	
 	@Override
 	public void addPages() {
-		page = new ExternalizeStringsWizardPage(vpeController);
-		addPage(page);
+		super.addPages();
+		page1 = new ExternalizeStringsWizardPage(
+				ExternalizeStringsWizardPageName, vpeController);
+		page2 = new WizardNewFileCreationPage(NewFileCreationPageName,
+				(IStructuredSelection) vpeController
+				.getSourceEditor().getSelectionProvider().getSelection());
+		page2.setTitle(VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_TITLE);
+		page2.setDescription(VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_DESCRIPTION);
+		page2.setImageDescriptor(ModelUIImages.getImageDescriptor(ModelUIImages.WIZARD_DEFAULT));
+		addPage(page1);
+		addPage(page2);
 	}
 
 	@Override
 	public boolean canFinish() {
-		return page.isPageComplete();
+		return (!page1.isNewFile() && page1.isPageComplete())
+				|| (page1.isNewFile() && page2.isPageComplete());
 	}
 
 	@Override
 	public boolean performFinish() {
-		return page.performFinish();
+		IFile bundleFile = null;
+		if (page1.isNewFile()) {
+			bundleFile = page2.createNewFile();
+		} else {
+			bundleFile = page1.getBundleFile();
+		}
+		/*
+		 * Exit when the file is null
+		 */
+		if (bundleFile == null) {
+			return false;
+		}
+		/*
+		 * Add "key=value" to the bundle
+		 */
+		if (bundleFile.exists()) {
+			InputStream is = new ByteArrayInputStream(page1.getKeyValuePair().getBytes());
+			try {
+				bundleFile.appendContents(is, false, true, null);
+			} catch (CoreException e) {
+				e.printStackTrace();
+			}
+		}
+		/*
+		 * Replace text in the editor
+		 */
+		page1.replaceText();
+		
+		return true;
 	}
 
 }

Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/dialog/ExternalizeStringsWizardPage.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/dialog/ExternalizeStringsWizardPage.java	2010-06-04 13:35:48 UTC (rev 22544)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/dialog/ExternalizeStringsWizardPage.java	2010-06-04 13:38:00 UTC (rev 22545)
@@ -10,16 +10,26 @@
  ******************************************************************************/
 package org.jboss.tools.vpe.editor.dialog;
 
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
 import java.util.HashSet;
 import java.util.Set;
 
 import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.DialogPage;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.text.BadLocationException;
 import org.eclipse.jface.text.IDocument;
 import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.viewers.ColumnLayoutData;
+import org.eclipse.jface.viewers.ColumnWeightData;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TableLayout;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
@@ -28,10 +38,14 @@
 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.Combo;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Group;
 import org.eclipse.swt.widgets.Label;
+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.ui.texteditor.IDocumentProvider;
 import org.eclipse.wst.sse.ui.StructuredTextEditor;
@@ -47,26 +61,37 @@
 public class ExternalizeStringsWizardPage extends WizardPage {
 
 	private final int DIALOG_WIDTH = 450;
-	private final int DIALOG_HEIGHT = 300;
+	private final int DIALOG_HEIGHT = 650;
 	private VpeController vpeController;
 	private Text textStringValue;
 	private Text propsKey;
 	private Text propsValue;
+	private Button newFile;
+	private Label propsFileLabel;
 	private Text propsFile;
+	private Label rbListLabel;
 	private Combo rbCombo;
 	private BundleMap bm;
+	private Group propsFilesGroup;
+	private Status propsKeyStatus;
+	private Status propsValueStatus;
+	private Status selectedTextStatus;
+	private Table tagsTable;
 	
-	public ExternalizeStringsWizardPage(VpeController vpeController) {
+	public ExternalizeStringsWizardPage(String pageName, VpeController vpeController) {
 		/*
 		 * Setting dialog Title, Description, Image.
 		 */
-		super(VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_TITLE,
+		super(pageName,
 				VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_TITLE, 
 				ModelUIImages.getImageDescriptor(ModelUIImages.WIZARD_DEFAULT));
 		setDescription(VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_DESCRIPTION);
 		setPageComplete(false);
 		this.vpeController = vpeController;
 		this.bm = vpeController.getPageContext().getBundle();
+		propsKeyStatus = new Status(IStatus.OK, VpePlugin.PLUGIN_ID, Constants.EMPTY);
+		propsValueStatus = new Status(IStatus.OK, VpePlugin.PLUGIN_ID, Constants.EMPTY);
+		selectedTextStatus = new Status(IStatus.OK, VpePlugin.PLUGIN_ID, Constants.EMPTY);
 	}
 
 	public ExternalizeStringsWizardPage(String pageName) {
@@ -102,7 +127,7 @@
 		 */
 		textStringValue = new Text(propsStringGroup, SWT.BORDER);
 		textStringValue.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 2, 1));
-		textStringValue.setText("Not initialized"); //$NON-NLS-1$
+		textStringValue.setText(Constants.EMPTY);
 		textStringValue.setEditable(false);
 
 		/*
@@ -116,16 +141,19 @@
 		 */
 		propsKey = new Text(propsStringGroup, SWT.BORDER);
 		propsKey.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 2, 1));
-		propsKey.setText("key"); //$NON-NLS-1$
+		propsKey.setText(VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_DEFAULT_KEY);
 		propsKey.addModifyListener(new ModifyListener() {
 			public void modifyText(ModifyEvent e) {
 				if ((propsKey.getText() == null) 
 						|| (Constants.EMPTY.equalsIgnoreCase(propsKey.getText().trim()))) {
-					setErrorMessage(VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_KEY_MUST_BE_SET);
+					propsKeyStatus = new Status(
+							IStatus.ERROR,
+							VpePlugin.PLUGIN_ID,
+							VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_KEY_MUST_BE_SET);
 				} else {
-					setErrorMessage(null);
+					propsKeyStatus = new Status(IStatus.OK, VpePlugin.PLUGIN_ID, Constants.EMPTY);
 				}
-				setPageComplete(isPageComplete());
+				updateStatus();
 			}
 		});
 		/*
@@ -139,31 +167,59 @@
 		 */
 		propsValue = new Text(propsStringGroup, SWT.BORDER);
 		propsValue.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 2, 1));
-		propsValue.setText("value"); //$NON-NLS-1$
+		propsValue.setText(VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_DEFAULT_VALUE);
 		propsValue.addModifyListener(new ModifyListener() {
 			public void modifyText(ModifyEvent e) {
 				if ((propsValue.getText() == null)
 						|| (Constants.EMPTY.equalsIgnoreCase(propsValue.getText().trim()))) {
-					setErrorMessage(VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_VALUE_MUST_BE_SET);
+					propsValueStatus = new Status(
+							IStatus.ERROR,
+							VpePlugin.PLUGIN_ID,
+							VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_VALUE_MUST_BE_SET);
 				} else {
-					setErrorMessage(null);
+					propsValueStatus = new Status(IStatus.OK, VpePlugin.PLUGIN_ID, Constants.EMPTY);
 				}
-				setPageComplete(isPageComplete());
+				updateStatus();
 			}
 		});
 
 		/*
+		 * Create New File Checkbox
+		 */
+		newFile = new Button(composite, SWT.CHECK);
+		newFile.setLayoutData(new GridData(SWT.LEFT, SWT.NONE, false, false, 1, 1));
+		newFile.setText(VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_NEW_FILE);
+		
+		/*
 		 * Create properties string group
 		 */
-		Group propsFilesGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);
+		propsFilesGroup = new Group(composite, SWT.SHADOW_ETCHED_IN);
 		propsFilesGroup.setLayout(new GridLayout(3, false));
-		propsFilesGroup.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 1, 1));
+		gd = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
+		gd.heightHint = 300; 
+		propsFilesGroup.setLayoutData(gd);
 		propsFilesGroup.setText(VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_PROPS_FILES_GROUP);
+
+		/*
+		 * Add selection listener to New File button
+		 */
+		newFile.addSelectionListener( new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				boolean selected = ((Button)e.getSource()).getSelection();
+				if (selected) {
+					enableBundleGroup(false);
+				} else {
+					enableBundleGroup(true);
+				}
+				setPageComplete(isPageComplete());
+			}
+		});
 		
 		/*
 		 * Create Resource Bundles List label
 		 */
-		Label rbListLabel = new Label(propsFilesGroup, SWT.NONE);
+		rbListLabel = new Label(propsFilesGroup, SWT.NONE);
 		rbListLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.NONE, false, false, 1, 1));
 		rbListLabel.setText(VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_RESOURCE_BUNDLE_LIST);
 		/*
@@ -171,8 +227,6 @@
 		 */
 		rbCombo = new Combo(propsFilesGroup, SWT.NONE);
 		rbCombo.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 2, 1));
-		rbCombo.add(VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_PLEASE_SELECT_BUNDLE);
-		rbCombo.select(0);
 		rbCombo.addSelectionListener(new SelectionAdapter() {
 			@Override
 			public void widgetSelected(SelectionEvent e) {
@@ -180,6 +234,7 @@
 				String bundlePath = Constants.EMPTY;
 				if (bundleFile != null) {
 					bundlePath = bundleFile.getFullPath().toString();
+					updateTable(bundleFile);
 				} 
 				propsFile.setText(bundlePath);
 				setPageComplete(isPageComplete());
@@ -189,7 +244,7 @@
 		/*
 		 * Create Properties File label
 		 */
-		Label propsFileLabel = new Label(propsFilesGroup, SWT.NONE);
+		propsFileLabel = new Label(propsFilesGroup, SWT.NONE);
 		propsFileLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.NONE, false,false, 1, 1));
 		propsFileLabel.setText(VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_PROPERTIES_FILE);
 		/*
@@ -199,7 +254,26 @@
 		propsFile.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true,false, 2, 1));
 		propsFile.setText(Constants.EMPTY);
 		propsFile.setEditable(false);
+		/*
+		 * Create properties file table of content
+		 */
+		tagsTable = new Table(propsFilesGroup, SWT.BORDER);
+        TableLayout layout = new TableLayout();
+        tagsTable.setLayout(layout);
+        tagsTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
+        tagsTable.setHeaderVisible(true);
+        tagsTable.setLinesVisible(true);
 		
+        ColumnLayoutData columnLayoutData;
+        TableColumn propNameColumn = new TableColumn(tagsTable, SWT.NONE);
+        propNameColumn.setText(VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_PROPERTY_NAME);
+        columnLayoutData = new ColumnWeightData(200, true);
+        layout.addColumnData(columnLayoutData);
+        TableColumn propValueColumn = new TableColumn(tagsTable, SWT.NONE);
+        propValueColumn.setText(VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_PROPERTY_VALUE);
+        columnLayoutData = new ColumnWeightData(200, true);
+        layout.addColumnData(columnLayoutData);
+        
 		/*
 		 * Initialize all fields with real values.
 		 */
@@ -219,6 +293,10 @@
 			ISelection sel = vpeController.getSourceEditor().getSelectionProvider().getSelection();
 			if ((textStringValue != null) && (propsKey != null)
 					&& isSelectionCorrect(sel)) {
+				/*
+				 * TODO: One must add functionality
+				 * for convenient text replacement
+				 */
 				String stringToUpdate = Constants.EMPTY;
 				TextSelection textSelection = null;
 				String text = null;
@@ -226,10 +304,23 @@
 				textSelection = (TextSelection) sel;
 				text = textSelection.getText();
 				if (text.trim().length() < 1) {
-					setErrorMessage(VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_SELECTED_TEXT_IS_EMPTY);
+					selectedTextStatus = new Status(
+							IStatus.ERROR,
+							VpePlugin.PLUGIN_ID,
+							VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_SELECTED_TEXT_IS_EMPTY);
 				} else if ((text.indexOf(Constants.GT) != -1) ||  (text.indexOf(Constants.LT) != -1)) {
-					setErrorMessage(VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_WRONG_SELECTED_TEXT);
+					selectedTextStatus = new Status(
+							IStatus.ERROR,
+							VpePlugin.PLUGIN_ID,
+							VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_WRONG_SELECTED_TEXT);
+				} else {
+					selectedTextStatus = new Status(IStatus.OK, VpePlugin.PLUGIN_ID, Constants.EMPTY);
 				}
+				/*
+				 * Update status message.
+				 */
+				updateStatus();
+				
 				Object selectedElement = structuredSelection.getFirstElement();
 				/*
 				 * Parse selected element and find a string to replace
@@ -283,23 +374,56 @@
 		}
 	}
 	
-	@Override
-	public boolean isPageComplete() {
-		boolean isPageComplete = false;
-		/*
-		 * The page is ready when there are no error messages 
-		 * and the bundle is selected
-		 * and "key=value" exists.
-		 */
-		if ((getErrorMessage() == null)
-				&& (!VpeUIMessages.EXTRNALIZE_STRINGS_DIALOG_PLEASE_SELECT_BUNDLE
-						.equalsIgnoreCase(rbCombo.getItem(rbCombo.getSelectionIndex())))) {
-			isPageComplete = true;
+	private void updateTable(IFile file) {
+		if ((file != null) && file.exists()) {
+		try {
+			BufferedReader in = new BufferedReader(new InputStreamReader(
+					file.getContents()));
+			String line = in.readLine();
+			int i = 0;
+			while (line != null) {
+				TableItem tableItem = null;
+				String[] propertie = null;
+				if (line.trim().length() > 0) {
+					tableItem = new TableItem(tagsTable, SWT.BORDER, i);
+					propertie = line.trim().split("="); //$NON-NLS-1$
+					if (propertie.length < 3) {
+						tableItem.setText(propertie);
+						i++;
+					}
+				}
+				line = in.readLine();
+			}
+		} catch (CoreException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}		
 		}
-		return isPageComplete;
 	}
 	
-	public boolean performFinish() {
+	private void enableBundleGroup(boolean enabled) {
+			propsFilesGroup.setEnabled(enabled);
+			propsFileLabel.setEnabled(enabled);
+			propsFile.setEnabled(enabled);
+			rbListLabel.setEnabled(enabled);
+			rbCombo.setEnabled(enabled);
+			tagsTable.setEnabled(enabled);
+	}
+	
+	public String getKeyValuePair() {
+		return "\n" + propsKey.getText() + Constants.EQUAL + propsValue.getText() + "\n"; //$NON-NLS-1$ //$NON-NLS-2$
+	}
+	
+	public IFile getBundleFile() {
+		return bm.getBundleFile(rbCombo.getText());
+	}
+	
+	public boolean isNewFile() {
+		return newFile.getSelection();
+	}
+	
+	public boolean replaceText() {
 		StructuredTextEditor editor = vpeController.getSourceEditor();
 		IDocumentProvider prov = editor.getDocumentProvider();
 		IDocument doc = prov.getDocument(editor.getEditorInput());
@@ -310,31 +434,86 @@
 				 * Get source text and new text
 				 */
 				final TextSelection textSel = (TextSelection) sel;
-				String newText = "\n" + propsKey.getText() + Constants.EQUAL + propsValue.getText() + "\n"; //$NON-NLS-1$ //$NON-NLS-2$
 				/*
-				 * Add "key=value" to the bundle
-				 */
-				IFile bundleFile = bm.getBundleFile(rbCombo.getText());
-				if ((bundleFile != null) && (bundleFile.exists())) {
-					InputStream is = new ByteArrayInputStream(newText.getBytes());
-					bundleFile.appendContents(is, false, true, null);
-				} 
-				/*
 				 * Replace text in the editor with "key.value"
 				 */
 				String bundlePrefix = Constants.EMPTY;
-				for (BundleEntry be : bm.getBundles()) {
-					if (be.uri.equalsIgnoreCase(rbCombo.getText())) {
-						bundlePrefix = be.prefix;
+				if (!isNewFile()) {
+					for (BundleEntry be : bm.getBundles()) {
+						if (be.uri.equalsIgnoreCase(rbCombo.getText())) {
+							bundlePrefix = be.prefix;
+						}
 					}
 				}
-				newText = "#{" + bundlePrefix + Constants.DOT + propsKey.getText() + "}"; //$NON-NLS-1$ //$NON-NLS-2$
+				String newText = "#{" + bundlePrefix + Constants.DOT + propsKey.getText() + "}"; //$NON-NLS-1$ //$NON-NLS-2$
 				doc.replace(textSel.getOffset(), textSel.getLength(), newText);
-			} catch (Exception ex) {
+			} catch (BadLocationException ex) {
 				ex.printStackTrace();
 			}
 		}
-		 return false;
+		 return true;
 	}
 	
+	private void updateStatus() {
+		applyStatus(this, new IStatus[] {selectedTextStatus, propsKeyStatus, propsValueStatus});
+		setPageComplete(isPageComplete());
+	}
+	
+	private void applyStatus(DialogPage page, IStatus[] statuses) {
+		IStatus severeStatus = statuses[0];
+		for (IStatus status : statuses) {
+			severeStatus = severeStatus.getSeverity() >= status.getSeverity() 
+				? severeStatus : status;
+		}
+
+		String message = severeStatus.getMessage();
+		switch (severeStatus.getSeverity()) {
+		case IStatus.OK:
+			page.setMessage(null, IMessageProvider.NONE);
+			page.setErrorMessage(null);
+			break;
+
+		case IStatus.WARNING:
+			page.setMessage(message, IMessageProvider.WARNING);
+			page.setErrorMessage(null);
+			break;
+
+		case IStatus.INFO:
+			page.setMessage(message, IMessageProvider.INFORMATION);
+			page.setErrorMessage(null);
+			break;
+
+		default:
+			if (message.length() == 0) {
+				message = null;
+			}
+			page.setMessage(null);
+			page.setErrorMessage(message);
+			break;
+		}
+	}
+
+	@Override
+	public boolean isPageComplete() {
+		boolean isPageComplete = false;
+		/*
+		 * The page is ready when there are no error messages 
+		 * and the bundle is selected
+		 * and "key=value" exists.
+		 */
+		if ((getErrorMessage() == null)
+				&& (getMessage() == null)
+				&& ((rbCombo.getSelectionIndex() != -1) || isNewFile())) {
+			isPageComplete = true;
+		}
+		return isPageComplete;
+	}
+	
+	@Override
+	public boolean canFlipToNextPage() {
+		return isPageComplete() && (getNextPage() != null)
+				&& (newFile.getSelection() == true);
+	}
+
+	
 }

Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java	2010-06-04 13:35:48 UTC (rev 22544)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java	2010-06-04 13:38:00 UTC (rev 22545)
@@ -480,7 +480,7 @@
 				 * otherwise show warning message.
 				 */
 				ISelection sel = controller.getSourceEditor().getSelectionProvider().getSelection();
-			
+				
 				if ((sel instanceof TextSelection)
 						&& (sel instanceof IStructuredSelection)
 						&& (((IStructuredSelection) sel).size() == 1)) {

Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java	2010-06-04 13:35:48 UTC (rev 22544)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java	2010-06-04 13:38:00 UTC (rev 22545)
@@ -174,6 +174,11 @@
 	public static String EXTRNALIZE_STRINGS_DIALOG_SELECTED_TEXT_IS_EMPTY;
 	public static String EXTRNALIZE_STRINGS_DIALOG_KEY_MUST_BE_SET;
 	public static String EXTRNALIZE_STRINGS_DIALOG_VALUE_MUST_BE_SET;
+	public static String EXTRNALIZE_STRINGS_DIALOG_NEW_FILE;
+	public static String EXTRNALIZE_STRINGS_DIALOG_DEFAULT_KEY;
+	public static String EXTRNALIZE_STRINGS_DIALOG_DEFAULT_VALUE;
+	public static String EXTRNALIZE_STRINGS_DIALOG_PROPERTY_NAME;
+	public static String EXTRNALIZE_STRINGS_DIALOG_PROPERTY_VALUE;
 	
 	public static String COULD_NOT_OPEN_VPE_RESOURCES_DIALOG;
 	

Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties	2010-06-04 13:35:48 UTC (rev 22544)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties	2010-06-04 13:38:00 UTC (rev 22545)
@@ -162,6 +162,11 @@
 EXTRNALIZE_STRINGS_DIALOG_SELECTED_TEXT_IS_EMPTY=Selected text is empty
 EXTRNALIZE_STRINGS_DIALOG_KEY_MUST_BE_SET=Key must be set
 EXTRNALIZE_STRINGS_DIALOG_VALUE_MUST_BE_SET=Value must be set
+EXTRNALIZE_STRINGS_DIALOG_NEW_FILE=Create a new properties file (See details on the next page)
+EXTRNALIZE_STRINGS_DIALOG_DEFAULT_KEY=key
+EXTRNALIZE_STRINGS_DIALOG_DEFAULT_VALUE=value
+EXTRNALIZE_STRINGS_DIALOG_PROPERTY_NAME=Property name
+EXTRNALIZE_STRINGS_DIALOG_PROPERTY_VALUE=Property value
 
 # Other messages
 CANNOT_LOAD_TAGLIBS_FROM_PAGE_CONTEXT=Cannot load taglibs from PageContext!



More information about the jbosstools-commits mailing list