Author: dmaliarevich
Date: 2010-01-23 10:22:57 -0500 (Sat, 23 Jan 2010)
New Revision: 19894
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUnknownTagsTemplatesWizardPage.java
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/messages/VpeUIMessages.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-2795, import/export wizards were finished.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties 2010-01-22 20:40:59 UTC (rev
19893)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties 2010-01-23 15:22:57 UTC (rev
19894)
@@ -9,7 +9,7 @@
PreferencePage_ElVariables=El Variables
visualEditorImpl_name=XulRunner Visual Editor
PreferencePage_VpeEditor=Visual Page Editor
-exportUnknownTagsTemplatesWizardName=Export unknown tags templates wizard
+exportUnknownTagsTemplatesWizardName=Unknown tags templates
exportUnknownTagsTemplatesWizardDescription=Export unknown tags templates to the external
file
-importUnknownTagsTemplatesWizardName=Import unknown tags templates wizard
+importUnknownTagsTemplatesWizardName=Unknown tags templates
importUnknownTagsTemplatesWizardDescription=Import unknown tags templates from the
external file
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUnknownTagsTemplatesWizardPage.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUnknownTagsTemplatesWizardPage.java 2010-01-22
20:40:59 UTC (rev 19893)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUnknownTagsTemplatesWizardPage.java 2010-01-23
15:22:57 UTC (rev 19894)
@@ -123,7 +123,7 @@
/*
* Fill the table with stored tags
*/
- updateTagsTable();
+ updateTagsTable(true);
/*
* Add path output and browse button
@@ -148,8 +148,10 @@
if (path != null) {
File file = new File(path);
pathString = file.toString();
+ /*
+ * Then modifyText event will be dispatched.
+ */
pathText.setText(pathString);
- setPageComplete(isPageComplete());
}
}
});
@@ -171,10 +173,34 @@
*/
}
- private void updateTagsTable() {
+ /**
+ * Updates visual table with tags templates.
+ *
+ * @param clearTagsTable clears current tags table
+ */
+ private void updateTagsTable(boolean clearTagsTable) {
+ /*
+ * Return when visual table hasn't been initialized.
+ */
if(tagsTable == null || tagsTable.isDisposed()) {
return;
}
+ /*
+ * Clear current visual table.
+ */
+ if (clearTagsTable) {
+ tagsTable.clearAll();
+ }
+ /*
+ * Return when tags templates list hasn't been initialized.
+ */
+ if (tagsList == null) {
+ return;
+ }
+ /*
+ * Remember current selection index
+ * and restore it at the end.
+ */
int selectionIndex = tagsTable.getSelectionIndex();
TableItem tableItem = null;
for (int i = 0; i < tagsList.size(); i++) {
@@ -262,11 +288,10 @@
@Override
public boolean isPageComplete() {
- /*
- * Later page should be complete some tags are selected.
- */
boolean isPageComplete = false;
- if ((pathString != null) && !Constants.EMPTY.equalsIgnoreCase(pathString)) {
+ if ((pathString != null)
+ && !Constants.EMPTY.equalsIgnoreCase(pathString)
+ && (Path.ROOT.isValidPath(pathString))) {
isPageComplete = true;
}
return isPageComplete;
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 2010-01-22
20:40:59 UTC (rev 19893)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesWizardPage.java 2010-01-23
15:22:57 UTC (rev 19894)
@@ -118,24 +118,23 @@
*/
tagsList = VpeTemplateManager.getInstance()
.getAnyTemplates(enteredPath);
- /*
- * Update table tags list based on the loaded file.
- */
- updateTagsTable();
- /*
- * Check if the page is complete.
- */
- setPageComplete(isPageComplete());
+
} else {
/*
* Reset taglist, show empty table
*/
if (tagsList != null) {
tagsList.clear();
- updateTagsTable();
- setPageComplete(isPageComplete());
}
}
+ /*
+ * Update table tags list based on the loaded file.
+ */
+ updateTagsTable(true);
+ /*
+ * Check if the page is complete.
+ */
+ setPageComplete(isPageComplete());
}
});
@@ -150,6 +149,9 @@
if (path != null) {
File file = new File(path);
pathString = file.toString();
+ /*
+ * Then modifyText event will be dispatched.
+ */
pathText.setText(pathString);
}
}
@@ -184,10 +186,34 @@
}
- private void updateTagsTable() {
+ /**
+ * Updates visual table with tags templates.
+ *
+ * @param clearTagsTable clears current tags table
+ */
+ private void updateTagsTable(boolean clearTagsTable) {
+ /*
+ * Return when visual table hasn't been initialized.
+ */
if(tagsTable == null || tagsTable.isDisposed()) {
return;
}
+ /*
+ * Clear current visual table.
+ */
+ if (clearTagsTable) {
+ tagsTable.clearAll();
+ }
+ /*
+ * Return when tags templates list hasn't been initialized.
+ */
+ if (tagsList == null) {
+ return;
+ }
+ /*
+ * Remember current selection index
+ * and restore it at the end.
+ */
int selectionIndex = tagsTable.getSelectionIndex();
TableItem tableItem = null;
for (int i = 0; i < tagsList.size(); i++) {
@@ -198,7 +224,7 @@
tableItem = tagsTable.getItem(i);
} else {
/*
- * Add necessary item
+ * Add new item
*/
tableItem = new TableItem(tagsTable, SWT.BORDER, i);
}
@@ -217,7 +243,6 @@
*/
tableItem.setText(itemColumnsData);
}
-
/*
* Restoring selection index
*/
@@ -225,9 +250,8 @@
try {
tagsTable.setSelection(selectionIndex);
} catch (SWTException e) {
- /*
- * Do nothing
- */
+ VpePlugin.getDefault().logError(
+ VpeUIMessages.COULD_NOT_SET_TABLE_SELECTION, e);
}
}
}
@@ -268,11 +292,11 @@
@Override
public boolean isPageComplete() {
- /*
- * Later page should be complete some tags are selected.
- */
boolean isPageComplete = false;
- if ((pathString != null) && !Constants.EMPTY.equalsIgnoreCase(pathString)) {
+ if ((pathString != null)
+ && !Constants.EMPTY.equalsIgnoreCase(pathString)
+ && (Path.ROOT.isValidPath(pathString))
+ && ((Path.fromOSString(pathString)).toFile().exists())) {
isPageComplete = true;
}
return isPageComplete;
@@ -308,9 +332,9 @@
VpeTemplateManager.getInstance().setAnyTemplates(currentList);
} else {
/*
- * Log error if the operation could not be performed.
+ * Log WARNING if the operation could not be performed.
*/
- VpePlugin.getDefault().logError(VpeUIMessages.ERROR_ON_IMPORT_TAG_TEMPLATES);
+ VpePlugin.getDefault().logWarning(VpeUIMessages.NONE_TEMPLATES_WERE_ADDED);
}
return true;
}
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-01-22
20:40:59 UTC (rev 19893)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java 2010-01-23
15:22:57 UTC (rev 19894)
@@ -151,6 +151,7 @@
public static String SELECT_ALL;
public static String DESELECT_ALL;
public static String BROWSE_BUTTON_TEXT;
- public static String ERROR_ON_IMPORT_TAG_TEMPLATES;
+ public static String NONE_TEMPLATES_WERE_ADDED;
+ public static String COULD_NOT_SET_TABLE_SELECTION;
}
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-01-22
20:40:59 UTC (rev 19893)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2010-01-23
15:22:57 UTC (rev 19894)
@@ -26,7 +26,7 @@
TAG_STYLE=Tag style:
CHILDREN=Allow tag children:
VALUE=Value:
-TAG_NAME_IS_NOT_VALID=Tag name is not valid ({0})
+TAG_NAME_IS_NOT_VALID=Tag name ({0}) is not valid. The pattern is "taglib:tag"
TAG_FOR_DISPLAY_IS_NOT_VALID=Tag for display is not valid ({0}).
VALUE_IS_NOT_VALID=Value is not valid ({0}).
@@ -134,8 +134,9 @@
SELECT_ALL=Select All
DESELECT_ALL=Deselect All
BROWSE_BUTTON_TEXT=Browse...
-EXPORT_UNKNOWN_TAGS_PAGE_TITLE=Export unknown tags templates wizard
+EXPORT_UNKNOWN_TAGS_PAGE_TITLE=Unknown tags templates
EXPORT_UNKNOWN_TAGS_PAGE_DESCRIPTION=Export unknown tags templates to external file
-IMPORT_UNKNOWN_TAGS_PAGE_TITLE=Import unknown tags templates wizard
+IMPORT_UNKNOWN_TAGS_PAGE_TITLE=Unknown tags templates
IMPORT_UNKNOWN_TAGS_PAGE_DESCRIPTION=Import unknown tags templates from external file
-ERROR_ON_IMPORT_TAG_TEMPLATES=Error while importing unknown tag templates.
\ No newline at end of file
+NONE_TEMPLATES_WERE_ADDED=None of the templates were added.
+COULD_NOT_SET_TABLE_SELECTION=Could not set table selection.
\ No newline at end of file