[jbosstools-commits] JBoss Tools SVN: r23658 - in trunk/vpe/plugins/org.jboss.tools.vpe: src/org/jboss/tools/vpe/editor/preferences and 3 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Thu Jul 22 05:43:18 EDT 2010
Author: yradtsevich
Date: 2010-07-22 05:43:16 -0400 (Thu, 22 Jul 2010)
New Revision: 23658
Added:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportImportUserTagsTemplatesWizardDialog.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUserTagsTemplatesMenuWizard.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUserTagsTemplatesMenuWizardPage.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUserTagsTemplatesWizard.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUserTagsTemplatesWizardPage.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUserTagsTemplatesMenuWizard.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUserTagsTemplatesMenuWizardPage.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUserTagsTemplatesWizard.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUserTagsTemplatesWizardPage.java
Removed:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportImportUnknownTagsTemplatesWizardDialog.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUnknownTagsTemplatesMenuWizard.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUnknownTagsTemplatesMenuWizardPage.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUnknownTagsTemplatesWizard.java
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/ImportUnknownTagsTemplatesMenuWizard.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesMenuWizardPage.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesWizard.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesWizardPage.java
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties
trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/TemplatesPreferencePage.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeEditAnyDialog.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-6689 :
Broken language in Export Visual Page Editor Templates
- Changed filenames and messages from 'unknown templates' to 'user templates'.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties 2010-07-22 08:14:03 UTC (rev 23657)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties 2010-07-22 09:43:16 UTC (rev 23658)
@@ -9,7 +9,7 @@
PreferencePage_ElVariables=El Variables
visualEditorImpl_name=XulRunner Visual Editor
PreferencePage_VpeEditor=Visual Page Editor
-exportUnknownTagsTemplatesWizardName=Unknown tags templates
-exportUnknownTagsTemplatesWizardDescription=Export unknown tags templates to the external file
-importUnknownTagsTemplatesWizardName=Unknown tags templates
-importUnknownTagsTemplatesWizardDescription=Import unknown tags templates from the external file
+exportUserTagsTemplatesWizardName=User specified tag templates
+exportUserTagsTemplatesWizardDescription=Export User specified tag templates to the local file system
+importUserTagsTemplatesWizardName=User specified tag templates
+importUserTagsTemplatesWizardDescription=Import User specified tag templates from the local file system
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml 2010-07-22 08:14:03 UTC (rev 23657)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml 2010-07-22 09:43:16 UTC (rev 23658)
@@ -131,12 +131,12 @@
<extension
point="org.eclipse.ui.exportWizards">
<wizard
- id="org.jboss.tools.vpe.editor.wizards.ExportUnknownTagsTemplatesWizard"
- class="org.jboss.tools.vpe.editor.wizards.ExportUnknownTagsTemplatesMenuWizard"
- name="%exportUnknownTagsTemplatesWizardName"
+ id="org.jboss.tools.vpe.editor.wizards.ExportUserTagsTemplatesMenuWizard"
+ class="org.jboss.tools.vpe.editor.wizards.ExportUserTagsTemplatesMenuWizard"
+ name="%exportUserTagsTemplatesWizardName"
icon="$nl$/resources/org/jboss/tools/vpe/wizards/icons/export_wizard.gif">
<description>
- %exportUnknownTagsTemplatesWizardDescription
+ %exportUserTagsTemplatesWizardDescription
</description>
</wizard>
</extension>
@@ -144,12 +144,12 @@
<extension
point="org.eclipse.ui.importWizards">
<wizard
- id="org.jboss.tools.vpe.editor.wizards.ImportUnknownTagsTemplatesWizard"
- class="org.jboss.tools.vpe.editor.wizards.ImportUnknownTagsTemplatesMenuWizard"
- name="%importUnknownTagsTemplatesWizardName"
+ id="org.jboss.tools.vpe.editor.wizards.ImportUserTagsTemplatesMenuWizard"
+ class="org.jboss.tools.vpe.editor.wizards.ImportUserTagsTemplatesMenuWizard"
+ name="%importUserTagsTemplatesWizardName"
icon="resources/org/jboss/tools/vpe/wizards/icons/import_wizard.gif">
<description>
- %importUnknownTagsTemplatesWizardDescription
+ %importUserTagsTemplatesWizardDescription
</description>
</wizard>
</extension>
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/TemplatesPreferencePage.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/TemplatesPreferencePage.java 2010-07-22 08:14:03 UTC (rev 23657)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/preferences/TemplatesPreferencePage.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -44,9 +44,9 @@
import org.jboss.tools.vpe.editor.template.VpeEditAnyDialog;
import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
import org.jboss.tools.vpe.editor.util.Constants;
-import org.jboss.tools.vpe.editor.wizards.ExportImportUnknownTagsTemplatesWizardDialog;
-import org.jboss.tools.vpe.editor.wizards.ExportUnknownTagsTemplatesWizard;
-import org.jboss.tools.vpe.editor.wizards.ImportUnknownTagsTemplatesWizard;
+import org.jboss.tools.vpe.editor.wizards.ExportImportUserTagsTemplatesWizardDialog;
+import org.jboss.tools.vpe.editor.wizards.ExportUserTagsTemplatesWizard;
+import org.jboss.tools.vpe.editor.wizards.ImportUserTagsTemplatesWizard;
import org.jboss.tools.vpe.editor.wizards.VpeImportExportWizardsUtils;
import org.jboss.tools.vpe.messages.VpeUIMessages;
@@ -95,7 +95,7 @@
composite.setFont(parent.getFont());
/*
- * Create data-table with the list of unknown tags
+ * Create data-table with the list of user specified templates
*/
tagsTable = new Table(composite, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
TableLayout layout = new TableLayout();
@@ -214,17 +214,17 @@
/*
* Export templates
*/
- ExportImportUnknownTagsTemplatesWizardDialog dlg = new ExportImportUnknownTagsTemplatesWizardDialog(
+ ExportImportUserTagsTemplatesWizardDialog dlg = new ExportImportUserTagsTemplatesWizardDialog(
PlatformUI.getWorkbench().getDisplay().getActiveShell(),
- new ExportUnknownTagsTemplatesWizard(tagsList));
+ new ExportUserTagsTemplatesWizard(tagsList));
dlg.open();
} else if (source == importButton) {
/*
* Import templates
*/
- ExportImportUnknownTagsTemplatesWizardDialog dlg = new ExportImportUnknownTagsTemplatesWizardDialog(
+ ExportImportUserTagsTemplatesWizardDialog dlg = new ExportImportUserTagsTemplatesWizardDialog(
PlatformUI.getWorkbench().getDisplay().getActiveShell(),
- new ImportUnknownTagsTemplatesWizard(tagsList));
+ new ImportUserTagsTemplatesWizard(tagsList));
dlg.open();
/*
* Re-initialize tags list from the file
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeEditAnyDialog.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeEditAnyDialog.java 2010-07-22 08:14:03 UTC (rev 23657)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeEditAnyDialog.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -107,7 +107,7 @@
setTitle(VpeUIMessages.TAG_ATTRIBUTES);
setTitleImage(ModelUIImages.getImageDescriptor(
ModelUIImages.WIZARD_DEFAULT).createImage(null));
- setMessage(VpeUIMessages.UNKNOWN_TAGS_DIALOG_DESCRIPTION);
+ setMessage(VpeUIMessages.USER_SPECIFIED_TAG_DIALOG_DESCRIPTION);
/*
* Create validator
@@ -487,7 +487,7 @@
/*
* Initialize the message with the description
*/
- IMessageProvider message = new Message(VpeUIMessages.UNKNOWN_TAGS_DIALOG_DESCRIPTION,
+ IMessageProvider message = new Message(VpeUIMessages.USER_SPECIFIED_TAG_DIALOG_DESCRIPTION,
IMessageProvider.NONE);
List<IMessageProvider> statuses = new ArrayList<IMessageProvider>();
/*
Deleted: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportImportUnknownTagsTemplatesWizardDialog.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportImportUnknownTagsTemplatesWizardDialog.java 2010-07-22 08:14:03 UTC (rev 23657)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportImportUnknownTagsTemplatesWizardDialog.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2009 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.editor.wizards;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.jboss.tools.vpe.editor.template.VpeAnyData;
-
-public class ExportImportUnknownTagsTemplatesWizardDialog extends WizardDialog {
-
- public ExportImportUnknownTagsTemplatesWizardDialog(Shell parentShell,
- IWizard newWizard) {
- super(parentShell, newWizard);
- setHelpAvailable(false);
- }
-
- @Override
- public void setMinimumPageSize(int minWidth, int minHeight) {
- super.setMinimumPageSize(500, 400);
- }
-
- public List<VpeAnyData> getImportedList() {
- if (getWizard() instanceof ImportUnknownTagsTemplatesWizard) {
- return ((ImportUnknownTagsTemplatesWizard)getWizard()).getImportedList();
- } else {
- return new ArrayList<VpeAnyData>();
- }
- }
-}
Copied: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportImportUserTagsTemplatesWizardDialog.java (from rev 23657, trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportImportUnknownTagsTemplatesWizardDialog.java)
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportImportUserTagsTemplatesWizardDialog.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportImportUserTagsTemplatesWizardDialog.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.editor.wizards;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.jboss.tools.vpe.editor.template.VpeAnyData;
+
+public class ExportImportUserTagsTemplatesWizardDialog extends WizardDialog {
+
+ public ExportImportUserTagsTemplatesWizardDialog(Shell parentShell,
+ IWizard newWizard) {
+ super(parentShell, newWizard);
+ setHelpAvailable(false);
+ }
+
+ @Override
+ public void setMinimumPageSize(int minWidth, int minHeight) {
+ super.setMinimumPageSize(500, 400);
+ }
+
+ public List<VpeAnyData> getImportedList() {
+ if (getWizard() instanceof ImportUserTagsTemplatesWizard) {
+ return ((ImportUserTagsTemplatesWizard)getWizard()).getImportedList();
+ } else {
+ return new ArrayList<VpeAnyData>();
+ }
+ }
+}
Deleted: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUnknownTagsTemplatesMenuWizard.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUnknownTagsTemplatesMenuWizard.java 2010-07-22 08:14:03 UTC (rev 23657)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUnknownTagsTemplatesMenuWizard.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2009 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.editor.wizards;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.IExportWizard;
-import org.eclipse.ui.IWorkbench;
-import org.jboss.tools.vpe.messages.VpeUIMessages;
-
-/**
- * Wizard that exports Unknown Tags Templates from Preference Page
- * to the vpe-templates-auto.xml file.
- *
- * @author dmaliarevich
- */
-public class ExportUnknownTagsTemplatesMenuWizard extends Wizard implements
- IExportWizard {
-
- private IStructuredSelection selection;
- private ExportUnknownTagsTemplatesMenuWizardPage mainPage;
-
- /**
- * Constructor
- */
- public ExportUnknownTagsTemplatesMenuWizard() {
- setWindowTitle(VpeUIMessages.EXPORT_UNKNOWN_TAGS_PAGE_TITLE);
- }
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
-
- }
-
- @Override
- public void addPages() {
- super.addPages();
- mainPage = new ExportUnknownTagsTemplatesMenuWizardPage(
- VpeUIMessages.EXPORT_UNKNOWN_TAGS_TEMPLATES_WIZARD_PAGE,
- selection);
- addPage(mainPage);
- }
-
- @Override
- public boolean canFinish() {
- return mainPage.isPageComplete();
- }
-
- @Override
- public boolean performFinish() {
- return mainPage.finish();
- }
-
-}
\ No newline at end of file
Deleted: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUnknownTagsTemplatesMenuWizardPage.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUnknownTagsTemplatesMenuWizardPage.java 2010-07-22 08:14:03 UTC (rev 23657)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUnknownTagsTemplatesMenuWizardPage.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2009 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.editor.wizards;
-
-import java.io.File;
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TableLayout;
-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.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.WizardExportResourcesPage;
-import org.jboss.tools.vpe.editor.template.VpeAnyData;
-import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
-import org.jboss.tools.vpe.editor.util.Constants;
-import org.jboss.tools.vpe.messages.VpeUIMessages;
-import org.jboss.tools.vpe.resref.core.ReferenceWizardPage;
-
-/**
- * Page for exporting unknown tags templates.
- *
- * @author dmaliarevich
- */
-public class ExportUnknownTagsTemplatesMenuWizardPage extends
- WizardExportResourcesPage implements VpeImportExportWizardPage {
-
- private String pathString;
- private Table tagsTable;
- private List<VpeAnyData> tagsList;
-
- /**
- * Constructor
- *
- * @param pageName
- * @param selection
- */
- public ExportUnknownTagsTemplatesMenuWizardPage(String pageName,
- IStructuredSelection selection) {
- super(pageName, selection);
- setTitle(VpeUIMessages.EXPORT_UNKNOWN_TAGS_PAGE_TITLE);
- setDescription(VpeUIMessages.EXPORT_UNKNOWN_TAGS_PAGE_DESCRIPTION);
- setImageDescriptor(ReferenceWizardPage.getImageDescriptor());
- /*
- * Initialize tags list
- */
- tagsList = VpeTemplateManager.getInstance().getAnyTemplates();
- }
-
- @Override
- public void createControl(Composite parent) {
- /*
- * Create main composite element with grid layout.
- * Two columns.
- */
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout(3, false));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
- composite.setFont(parent.getFont());
-
- /*
- * Create datatable with the list of unknown tags
- */
- tagsTable = new Table(composite, 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);
-
- /*
- * Create columns in the table
- */
- ColumnLayoutData columnLayoutData;
- for (int i = 0; i < COLUMNS_NAMES.length; i++) {
- TableColumn column = new TableColumn(tagsTable, SWT.NONE);
- column.setText(COLUMNS_NAMES[i]);
- columnLayoutData = new ColumnWeightData(COLUMNS_WIDTHS[i], true);
- layout.addColumnData(columnLayoutData);
- }
- /*
- * Fill the table with stored tags
- */
- VpeImportExportWizardsUtils.updateTagsTable(tagsTable, tagsList, true);
-
- /*
- * Add label
- */
- Label fileNamaLabel = new Label(composite, SWT.NONE);
- fileNamaLabel.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 1));
- fileNamaLabel.setText(VpeUIMessages.FILE_NAME_LABEL);
- /*
- * Add output path
- */
- final Text pathText = new Text(composite, SWT.BORDER);
- pathText.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false, 1, 1));
- pathText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- pathString = ((Text)e.getSource()).getText();
- setPageComplete(isPageComplete());
- }
- });
- /*
- * Add browse button
- */
- Button browseButton = new Button(composite, SWT.NONE);
- browseButton.setText(VpeUIMessages.BROWSE_BUTTON_TEXT);
- browseButton.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, false, 1, 1));
- browseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- FileDialog dialog = new FileDialog(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getShell(), SWT.NONE);
- String path = dialog.open();
- if (path != null) {
- File file = new File(path);
- pathString = file.toString();
- /*
- * Then modifyText event will be dispatched.
- */
- pathText.setText(pathString);
- }
- }
- });
-
- /*
- * Finishing the initialization
- */
- updateWidgetEnablements();
- setPageComplete(determinePageCompletion());
- setErrorMessage(null); // should not initially have error message
-
- setControl(composite);
- }
-
- @Override
- protected void createDestinationGroup(Composite parent) {
- /*
- * Create nothing
- */
- }
-
- public void handleEvent(Event event) {
- /*
- * Do nothing
- */
- }
-
- @Override
- public boolean isPageComplete() {
- boolean isPageComplete = false;
- if ((pathString != null)
- && !Constants.EMPTY.equalsIgnoreCase(pathString)
- && (Path.ROOT.isValidPath(pathString))) {
- isPageComplete = true;
- }
- return isPageComplete;
- }
-
- public boolean finish() {
- List<VpeAnyData> templates = VpeTemplateManager.getInstance().getAnyTemplates();
- IPath path = new Path(pathString);
- VpeTemplateManager.getInstance().setAnyTemplates(templates, path);
- return true;
- }
-
-}
Deleted: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUnknownTagsTemplatesWizard.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUnknownTagsTemplatesWizard.java 2010-07-22 08:14:03 UTC (rev 23657)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUnknownTagsTemplatesWizard.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2009 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.editor.wizards;
-
-import java.util.List;
-
-import org.eclipse.jface.wizard.Wizard;
-import org.jboss.tools.vpe.editor.template.VpeAnyData;
-import org.jboss.tools.vpe.messages.VpeUIMessages;
-
-public class ExportUnknownTagsTemplatesWizard extends Wizard {
-
- private ExportUnknownTagsTemplatesWizardPage mainPage;
- private List<VpeAnyData> currentList;
-
- /**
- * Constructor
- */
- public ExportUnknownTagsTemplatesWizard(List<VpeAnyData> currentList) {
- setWindowTitle(VpeUIMessages.EXPORT_UNKNOWN_TAGS_PAGE_TITLE);
- this.currentList = currentList;
- }
-
- @Override
- public void addPages() {
- super.addPages();
- mainPage = new ExportUnknownTagsTemplatesWizardPage(
- VpeUIMessages.EXPORT_UNKNOWN_TAGS_TEMPLATES_WIZARD_PAGE,
- currentList);
- addPage(mainPage);
- }
-
- @Override
- public boolean canFinish() {
- return mainPage.isPageComplete();
- }
-
- @Override
- public boolean performFinish() {
- return mainPage.finish();
- }
-
-}
Deleted: 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-07-22 08:14:03 UTC (rev 23657)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUnknownTagsTemplatesWizardPage.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2009 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.editor.wizards;
-
-import java.io.File;
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.wizard.WizardPage;
-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.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.vpe.editor.template.VpeAnyData;
-import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
-import org.jboss.tools.vpe.editor.util.Constants;
-import org.jboss.tools.vpe.messages.VpeUIMessages;
-import org.jboss.tools.vpe.resref.core.ReferenceWizardPage;
-
-public class ExportUnknownTagsTemplatesWizardPage extends WizardPage implements
- VpeImportExportWizardPage {
-
- private String pathString;
- private Table tagsTable;
- private List<VpeAnyData> tagsList;
-
- protected ExportUnknownTagsTemplatesWizardPage(String pageName, List<VpeAnyData> currentList) {
- super(pageName);
- setTitle(VpeUIMessages.EXPORT_UNKNOWN_TAGS_PAGE_TITLE);
- setDescription(VpeUIMessages.EXPORT_UNKNOWN_TAGS_PAGE_DESCRIPTION);
- setImageDescriptor(ReferenceWizardPage.getImageDescriptor());
- /*
- * Initialize tags list
- */
- tagsList = currentList;
- }
-
- public void createControl(Composite parent) {
- /*
- * Create main composite element with grid layout.
- * Two columns.
- */
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout(3, false));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
- composite.setFont(parent.getFont());
-
- /*
- * Create datatable with the list of unknown tags
- */
- tagsTable = new Table(composite, 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);
-
- /*
- * Create columns in the table
- */
- ColumnLayoutData columnLayoutData;
- for (int i = 0; i < COLUMNS_NAMES.length; i++) {
- TableColumn column = new TableColumn(tagsTable, SWT.NONE);
- column.setText(COLUMNS_NAMES[i]);
- columnLayoutData = new ColumnWeightData(COLUMNS_WIDTHS[i], true);
- layout.addColumnData(columnLayoutData);
- }
- /*
- * Fill the table with stored tags
- */
- VpeImportExportWizardsUtils.updateTagsTable(tagsTable, tagsList, true);
-
- /*
- * Add label
- */
- Label fileNamaLabel = new Label(composite, SWT.NONE);
- fileNamaLabel.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 1));
- fileNamaLabel.setText(VpeUIMessages.FILE_NAME_LABEL);
- /*
- * Add output path
- */
- final Text pathText = new Text(composite, SWT.BORDER);
- pathText.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false, 1, 1));
- pathText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- pathString = ((Text)e.getSource()).getText();
- setPageComplete(isPageComplete());
- }
- });
- /*
- * Add browse button
- */
- Button browseButton = new Button(composite, SWT.NONE);
- browseButton.setText(VpeUIMessages.BROWSE_BUTTON_TEXT);
- browseButton.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, false, 1, 1));
- browseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- FileDialog dialog = new FileDialog(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getShell(), SWT.NONE);
- String path = dialog.open();
- if (path != null) {
- File file = new File(path);
- pathString = file.toString();
- /*
- * Then modifyText event will be dispatched.
- */
- pathText.setText(pathString);
- }
- }
- });
-
- /*
- * Finishing the initialization
- */
- setPageComplete(isPageComplete());
- setErrorMessage(null); // should not initially have error message
-
- setControl(composite);
- }
-
- @Override
- public boolean isPageComplete() {
- boolean isPageComplete = false;
- if ((pathString != null)
- && !Constants.EMPTY.equalsIgnoreCase(pathString)
- && (Path.ROOT.isValidPath(pathString))) {
- isPageComplete = true;
- }
- return isPageComplete;
- }
-
- public boolean finish() {
- IPath path = new Path(pathString);
- /*
- * Export the current list to the specified location.
- */
- VpeTemplateManager.getInstance().setAnyTemplates(tagsList, path);
- return true;
- }
-
-}
Copied: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUserTagsTemplatesMenuWizard.java (from rev 23657, trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUnknownTagsTemplatesMenuWizard.java)
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUserTagsTemplatesMenuWizard.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUserTagsTemplatesMenuWizard.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.editor.wizards;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IExportWizard;
+import org.eclipse.ui.IWorkbench;
+import org.jboss.tools.vpe.messages.VpeUIMessages;
+
+/**
+ * Wizard that exports User specified tag templates from Preference Page
+ * to the vpe-templates-auto.xml file.
+ *
+ * @author dmaliarevich
+ */
+public class ExportUserTagsTemplatesMenuWizard extends Wizard implements
+ IExportWizard {
+
+ private IStructuredSelection selection;
+ private ExportUserTagsTemplatesMenuWizardPage mainPage;
+
+ /**
+ * Constructor
+ */
+ public ExportUserTagsTemplatesMenuWizard() {
+ setWindowTitle(VpeUIMessages.EXPORT_USER_TAGS_PAGE_TITLE);
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+
+ }
+
+ @Override
+ public void addPages() {
+ super.addPages();
+ mainPage = new ExportUserTagsTemplatesMenuWizardPage(
+ VpeUIMessages.EXPORT_USER_TAGS_TEMPLATES_WIZARD_PAGE,
+ selection);
+ addPage(mainPage);
+ }
+
+ @Override
+ public boolean canFinish() {
+ return mainPage.isPageComplete();
+ }
+
+ @Override
+ public boolean performFinish() {
+ return mainPage.finish();
+ }
+
+}
\ No newline at end of file
Copied: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUserTagsTemplatesMenuWizardPage.java (from rev 23657, trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUnknownTagsTemplatesMenuWizardPage.java)
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUserTagsTemplatesMenuWizardPage.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUserTagsTemplatesMenuWizardPage.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -0,0 +1,191 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.editor.wizards;
+
+import java.io.File;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.ColumnLayoutData;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TableLayout;
+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.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.WizardExportResourcesPage;
+import org.jboss.tools.vpe.editor.template.VpeAnyData;
+import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
+import org.jboss.tools.vpe.editor.util.Constants;
+import org.jboss.tools.vpe.messages.VpeUIMessages;
+import org.jboss.tools.vpe.resref.core.ReferenceWizardPage;
+
+/**
+ * Page for exporting user specified tag templates templates.
+ *
+ * @author dmaliarevich
+ */
+public class ExportUserTagsTemplatesMenuWizardPage extends
+ WizardExportResourcesPage implements VpeImportExportWizardPage {
+
+ private String pathString;
+ private Table tagsTable;
+ private List<VpeAnyData> tagsList;
+
+ /**
+ * Constructor
+ *
+ * @param pageName
+ * @param selection
+ */
+ public ExportUserTagsTemplatesMenuWizardPage(String pageName,
+ IStructuredSelection selection) {
+ super(pageName, selection);
+ setTitle(VpeUIMessages.EXPORT_USER_TAGS_PAGE_TITLE);
+ setDescription(VpeUIMessages.EXPORT_USER_TAGS_PAGE_DESCRIPTION);
+ setImageDescriptor(ReferenceWizardPage.getImageDescriptor());
+ /*
+ * Initialize tags list
+ */
+ tagsList = VpeTemplateManager.getInstance().getAnyTemplates();
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ /*
+ * Create main composite element with grid layout.
+ * Two columns.
+ */
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(3, false));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ composite.setFont(parent.getFont());
+
+ /*
+ * Create datatable with the list of user specified tag templates
+ */
+ tagsTable = new Table(composite, 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);
+
+ /*
+ * Create columns in the table
+ */
+ ColumnLayoutData columnLayoutData;
+ for (int i = 0; i < COLUMNS_NAMES.length; i++) {
+ TableColumn column = new TableColumn(tagsTable, SWT.NONE);
+ column.setText(COLUMNS_NAMES[i]);
+ columnLayoutData = new ColumnWeightData(COLUMNS_WIDTHS[i], true);
+ layout.addColumnData(columnLayoutData);
+ }
+ /*
+ * Fill the table with stored tags
+ */
+ VpeImportExportWizardsUtils.updateTagsTable(tagsTable, tagsList, true);
+
+ /*
+ * Add label
+ */
+ Label fileNamaLabel = new Label(composite, SWT.NONE);
+ fileNamaLabel.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 1));
+ fileNamaLabel.setText(VpeUIMessages.FILE_NAME_LABEL);
+ /*
+ * Add output path
+ */
+ final Text pathText = new Text(composite, SWT.BORDER);
+ pathText.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false, 1, 1));
+ pathText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ pathString = ((Text)e.getSource()).getText();
+ setPageComplete(isPageComplete());
+ }
+ });
+ /*
+ * Add browse button
+ */
+ Button browseButton = new Button(composite, SWT.NONE);
+ browseButton.setText(VpeUIMessages.BROWSE_BUTTON_TEXT);
+ browseButton.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, false, 1, 1));
+ browseButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ FileDialog dialog = new FileDialog(PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell(), SWT.NONE);
+ String path = dialog.open();
+ if (path != null) {
+ File file = new File(path);
+ pathString = file.toString();
+ /*
+ * Then modifyText event will be dispatched.
+ */
+ pathText.setText(pathString);
+ }
+ }
+ });
+
+ /*
+ * Finishing the initialization
+ */
+ updateWidgetEnablements();
+ setPageComplete(determinePageCompletion());
+ setErrorMessage(null); // should not initially have error message
+
+ setControl(composite);
+ }
+
+ @Override
+ protected void createDestinationGroup(Composite parent) {
+ /*
+ * Create nothing
+ */
+ }
+
+ public void handleEvent(Event event) {
+ /*
+ * Do nothing
+ */
+ }
+
+ @Override
+ public boolean isPageComplete() {
+ boolean isPageComplete = false;
+ if ((pathString != null)
+ && !Constants.EMPTY.equalsIgnoreCase(pathString)
+ && (Path.ROOT.isValidPath(pathString))) {
+ isPageComplete = true;
+ }
+ return isPageComplete;
+ }
+
+ public boolean finish() {
+ List<VpeAnyData> templates = VpeTemplateManager.getInstance().getAnyTemplates();
+ IPath path = new Path(pathString);
+ VpeTemplateManager.getInstance().setAnyTemplates(templates, path);
+ return true;
+ }
+
+}
Copied: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUserTagsTemplatesWizard.java (from rev 23657, trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUnknownTagsTemplatesWizard.java)
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUserTagsTemplatesWizard.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUserTagsTemplatesWizard.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.editor.wizards;
+
+import java.util.List;
+
+import org.eclipse.jface.wizard.Wizard;
+import org.jboss.tools.vpe.editor.template.VpeAnyData;
+import org.jboss.tools.vpe.messages.VpeUIMessages;
+
+public class ExportUserTagsTemplatesWizard extends Wizard {
+
+ private ExportUserTagsTemplatesWizardPage mainPage;
+ private List<VpeAnyData> currentList;
+
+ /**
+ * Constructor
+ */
+ public ExportUserTagsTemplatesWizard(List<VpeAnyData> currentList) {
+ setWindowTitle(VpeUIMessages.EXPORT_USER_TAGS_PAGE_TITLE);
+ this.currentList = currentList;
+ }
+
+ @Override
+ public void addPages() {
+ super.addPages();
+ mainPage = new ExportUserTagsTemplatesWizardPage(
+ VpeUIMessages.EXPORT_USER_TAGS_TEMPLATES_WIZARD_PAGE,
+ currentList);
+ addPage(mainPage);
+ }
+
+ @Override
+ public boolean canFinish() {
+ return mainPage.isPageComplete();
+ }
+
+ @Override
+ public boolean performFinish() {
+ return mainPage.finish();
+ }
+
+}
Copied: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUserTagsTemplatesWizardPage.java (from rev 23657, 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/ExportUserTagsTemplatesWizardPage.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ExportUserTagsTemplatesWizardPage.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.editor.wizards;
+
+import java.io.File;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.ColumnLayoutData;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.wizard.WizardPage;
+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.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.vpe.editor.template.VpeAnyData;
+import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
+import org.jboss.tools.vpe.editor.util.Constants;
+import org.jboss.tools.vpe.messages.VpeUIMessages;
+import org.jboss.tools.vpe.resref.core.ReferenceWizardPage;
+
+public class ExportUserTagsTemplatesWizardPage extends WizardPage implements
+ VpeImportExportWizardPage {
+
+ private String pathString;
+ private Table tagsTable;
+ private List<VpeAnyData> tagsList;
+
+ protected ExportUserTagsTemplatesWizardPage(String pageName, List<VpeAnyData> currentList) {
+ super(pageName);
+ setTitle(VpeUIMessages.EXPORT_USER_TAGS_PAGE_TITLE);
+ setDescription(VpeUIMessages.EXPORT_USER_TAGS_PAGE_DESCRIPTION);
+ setImageDescriptor(ReferenceWizardPage.getImageDescriptor());
+ /*
+ * Initialize tags list
+ */
+ tagsList = currentList;
+ }
+
+ public void createControl(Composite parent) {
+ /*
+ * Create main composite element with grid layout.
+ * Two columns.
+ */
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(3, false));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ composite.setFont(parent.getFont());
+
+ /*
+ * Create datatable with the list of user specified tag templates
+ */
+ tagsTable = new Table(composite, 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);
+
+ /*
+ * Create columns in the table
+ */
+ ColumnLayoutData columnLayoutData;
+ for (int i = 0; i < COLUMNS_NAMES.length; i++) {
+ TableColumn column = new TableColumn(tagsTable, SWT.NONE);
+ column.setText(COLUMNS_NAMES[i]);
+ columnLayoutData = new ColumnWeightData(COLUMNS_WIDTHS[i], true);
+ layout.addColumnData(columnLayoutData);
+ }
+ /*
+ * Fill the table with stored tags
+ */
+ VpeImportExportWizardsUtils.updateTagsTable(tagsTable, tagsList, true);
+
+ /*
+ * Add label
+ */
+ Label fileNamaLabel = new Label(composite, SWT.NONE);
+ fileNamaLabel.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 1));
+ fileNamaLabel.setText(VpeUIMessages.FILE_NAME_LABEL);
+ /*
+ * Add output path
+ */
+ final Text pathText = new Text(composite, SWT.BORDER);
+ pathText.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false, 1, 1));
+ pathText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ pathString = ((Text)e.getSource()).getText();
+ setPageComplete(isPageComplete());
+ }
+ });
+ /*
+ * Add browse button
+ */
+ Button browseButton = new Button(composite, SWT.NONE);
+ browseButton.setText(VpeUIMessages.BROWSE_BUTTON_TEXT);
+ browseButton.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, false, 1, 1));
+ browseButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ FileDialog dialog = new FileDialog(PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell(), SWT.NONE);
+ String path = dialog.open();
+ if (path != null) {
+ File file = new File(path);
+ pathString = file.toString();
+ /*
+ * Then modifyText event will be dispatched.
+ */
+ pathText.setText(pathString);
+ }
+ }
+ });
+
+ /*
+ * Finishing the initialization
+ */
+ setPageComplete(isPageComplete());
+ setErrorMessage(null); // should not initially have error message
+
+ setControl(composite);
+ }
+
+ @Override
+ public boolean isPageComplete() {
+ boolean isPageComplete = false;
+ if ((pathString != null)
+ && !Constants.EMPTY.equalsIgnoreCase(pathString)
+ && (Path.ROOT.isValidPath(pathString))) {
+ isPageComplete = true;
+ }
+ return isPageComplete;
+ }
+
+ public boolean finish() {
+ IPath path = new Path(pathString);
+ /*
+ * Export the current list to the specified location.
+ */
+ VpeTemplateManager.getInstance().setAnyTemplates(tagsList, path);
+ return true;
+ }
+
+}
Deleted: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesMenuWizard.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesMenuWizard.java 2010-07-22 08:14:03 UTC (rev 23657)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesMenuWizard.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2009 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.editor.wizards;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.IImportWizard;
-import org.eclipse.ui.IWorkbench;
-import org.jboss.tools.vpe.messages.VpeUIMessages;
-
-/**
- *
- * Wizard that imports Unknown Tags Templates from external xml file.
- *
- * @author dmaliarevich
- */
-public class ImportUnknownTagsTemplatesMenuWizard extends Wizard implements
- IImportWizard {
-
- private IStructuredSelection selection;
- private ImportUnknownTagsTemplatesMenuWizardPage mainPage;
-
- /**
- * Constructor
- */
- public ImportUnknownTagsTemplatesMenuWizard() {
- super();
- setWindowTitle(VpeUIMessages.IMPORT_UNKNOWN_TAGS_PAGE_TITLE);
- }
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- this.selection = selection;
- setWindowTitle(VpeUIMessages.IMPORT_UNKNOWN_TAGS_PAGE_TITLE);
- }
-
- @Override
- public void addPages() {
- super.addPages();
- mainPage = new ImportUnknownTagsTemplatesMenuWizardPage(
- VpeUIMessages.IMPORT_UNKNOWN_TAGS_TEMPLATES_WIZARD_PAGE,
- selection);
- addPage(mainPage);
- }
-
- @Override
- public boolean canFinish() {
- return mainPage.isPageComplete();
- }
-
- @Override
- public boolean performFinish() {
- return mainPage.finish();
- }
-
-}
Deleted: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesMenuWizardPage.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesMenuWizardPage.java 2010-07-22 08:14:03 UTC (rev 23657)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesMenuWizardPage.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -1,245 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2009 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.editor.wizards;
-
-import java.io.File;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.TableLayout;
-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.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.WizardResourceImportPage;
-import org.jboss.tools.vpe.VpePlugin;
-import org.jboss.tools.vpe.editor.template.VpeAnyData;
-import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
-import org.jboss.tools.vpe.editor.util.Constants;
-import org.jboss.tools.vpe.messages.VpeUIMessages;
-import org.jboss.tools.vpe.resref.core.ReferenceWizardPage;
-
-/**
- * Page for importing unknown tags templates.
- *
- * @author dmaliarevich
- */
-public class ImportUnknownTagsTemplatesMenuWizardPage extends
- WizardResourceImportPage implements VpeImportExportWizardPage {
-
- private String pathString;
- private Table tagsTable;
- private List<VpeAnyData> tagsList;
-
- /**
- * Constructor
- *
- * @param name
- * @param selection
- */
- public ImportUnknownTagsTemplatesMenuWizardPage(String name,
- IStructuredSelection selection) {
- super(name, selection);
- setTitle(VpeUIMessages.IMPORT_UNKNOWN_TAGS_PAGE_TITLE);
- setDescription(VpeUIMessages.IMPORT_UNKNOWN_TAGS_PAGE_DESCRIPTION);
- setImageDescriptor(ReferenceWizardPage.getImageDescriptor());
- }
-
- @Override
- public void createControl(Composite parent) {
- /*
- * Create main composite element with grid layout.
- * Two columns.
- */
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout(3, false));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
- composite.setFont(parent.getFont());
-
- /*
- * Add label
- */
- Label fileNamaLabel = new Label(composite, SWT.NONE);
- fileNamaLabel.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 1));
- fileNamaLabel.setText(VpeUIMessages.FILE_NAME_LABEL);
- /*
- * Add output path
- */
- final Text pathText = new Text(composite, SWT.BORDER);
- pathText.setEditable(true);
- pathText.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false, 1, 1));
- pathText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- pathString = ((Text)e.getSource()).getText();
- IPath enteredPath = null;
- /*
- * Load templates if the path is valid
- */
- if ((Path.ROOT.isValidPath(pathString))
- && (enteredPath = Path.fromOSString(pathString)).toFile().exists()) {
- /*
- * Load tags list from the specified location.
- */
- tagsList = VpeTemplateManager.getInstance()
- .getAnyTemplates(enteredPath);
-
- } else {
- /*
- * Reset taglist, show empty table
- */
- if (tagsList != null) {
- tagsList.clear();
- }
- }
- /*
- * Update table tags list based on the loaded file.
- */
- VpeImportExportWizardsUtils.updateTagsTable(tagsTable, tagsList, true);
- /*
- * Check if the page is complete.
- */
- setPageComplete(isPageComplete());
- }
- });
- /*
- * Add browse button
- */
- Button browseButton = new Button(composite, SWT.NONE);
- browseButton.setText(VpeUIMessages.BROWSE_BUTTON_TEXT);
- browseButton.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, false, 1, 1));
- browseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- FileDialog dialog = new FileDialog(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getShell(), SWT.NONE);
- String path = dialog.open();
- if (path != null) {
- File file = new File(path);
- pathString = file.toString();
- /*
- * Then modifyText event will be dispatched.
- */
- pathText.setText(pathString);
- }
- }
- });
-
- /*
- * Create datatable with the list of unknown tags
- */
- tagsTable = new Table(composite, 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);
-
- /*
- * Create columns in the table
- */
- ColumnLayoutData columnLayoutData;
- for (int i = 0; i < COLUMNS_NAMES.length; i++) {
- TableColumn column = new TableColumn(tagsTable, SWT.NONE);
- column.setText(COLUMNS_NAMES[i]);
- columnLayoutData = new ColumnWeightData(COLUMNS_WIDTHS[i], true);
- layout.addColumnData(columnLayoutData);
- }
-
- /*
- * Finishing the initialization
- */
- setErrorMessage(null); // should not initially have error message
- setControl(composite);
-
- }
-
- @Override
- public boolean isPageComplete() {
- boolean isPageComplete = false;
- if ((pathString != null)
- && !Constants.EMPTY.equalsIgnoreCase(pathString)
- && (Path.ROOT.isValidPath(pathString))
- && ((Path.fromOSString(pathString)).toFile().exists())) {
- isPageComplete = true;
- }
- return isPageComplete;
- }
-
- public boolean finish() {
- /*
- * Currently used templates list
- */
- List<VpeAnyData> currentList = VpeTemplateManager.getInstance().getAnyTemplates();
-
- /*
- * Uploading will add only missing templates.
- * So here all duplicated templates will be deleted from the tagsList.
- */
- Iterator<VpeAnyData> iterator = tagsList.iterator();
- while (iterator.hasNext()) {
- VpeAnyData loadedTemplate = (VpeAnyData) iterator.next();
- for (VpeAnyData currentTemplate : currentList) {
- if (loadedTemplate.equals(currentTemplate)) {
- iterator.remove();
- }
- }
- }
- /*
- * Add unique templates to the current list.
- */
- if (currentList.addAll(tagsList)) {
- /*
- * Store loaded templates to the default auto-templates location.
- */
- VpeTemplateManager.getInstance().setAnyTemplates(currentList);
- } else {
- /*
- * Log WARNING if the operation could not be performed.
- */
- VpePlugin.getDefault().logWarning(VpeUIMessages.NONE_TEMPLATES_WERE_ADDED);
- }
- return true;
- }
-
- @Override
- protected void createSourceGroup(Composite parent) {
- /*
- * Create nothing.
- */
- }
-
- @Override
- protected ITreeContentProvider getFileProvider() {
- return null;
- }
-
- @Override
- protected ITreeContentProvider getFolderProvider() {
- return null;
- }
-
-}
Deleted: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesWizard.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesWizard.java 2010-07-22 08:14:03 UTC (rev 23657)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesWizard.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -1,49 +0,0 @@
-package org.jboss.tools.vpe.editor.wizards;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.wizard.Wizard;
-import org.jboss.tools.vpe.editor.template.VpeAnyData;
-import org.jboss.tools.vpe.messages.VpeUIMessages;
-
-public class ImportUnknownTagsTemplatesWizard extends Wizard {
-
- private ImportUnknownTagsTemplatesWizardPage mainPage;
- private List<VpeAnyData> importedList = new ArrayList<VpeAnyData>();
- private List<VpeAnyData> currentList;
-
- public ImportUnknownTagsTemplatesWizard(List<VpeAnyData> currentList) {
- super();
- setWindowTitle(VpeUIMessages.IMPORT_UNKNOWN_TAGS_PAGE_TITLE);
- this.currentList = currentList;
- }
-
- @Override
- public void addPages() {
- super.addPages();
- mainPage = new ImportUnknownTagsTemplatesWizardPage(
- VpeUIMessages.IMPORT_UNKNOWN_TAGS_TEMPLATES_WIZARD_PAGE,
- currentList);
- addPage(mainPage);
- }
-
- @Override
- public boolean canFinish() {
- return mainPage.isPageComplete();
- }
-
- @Override
- public boolean performFinish() {
- boolean pageFinished = mainPage.finish();
- if (pageFinished) {
- importedList = mainPage.getImportedList();
- }
- return pageFinished;
- }
-
- public List<VpeAnyData> getImportedList() {
- return importedList;
- }
-
-}
Deleted: 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-07-22 08:14:03 UTC (rev 23657)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesWizardPage.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -1,207 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2009 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.editor.wizards;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.wizard.WizardPage;
-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.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.vpe.VpePlugin;
-import org.jboss.tools.vpe.editor.template.VpeAnyData;
-import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
-import org.jboss.tools.vpe.editor.util.Constants;
-import org.jboss.tools.vpe.messages.VpeUIMessages;
-import org.jboss.tools.vpe.resref.core.ReferenceWizardPage;
-
-public class ImportUnknownTagsTemplatesWizardPage extends WizardPage implements
- VpeImportExportWizardPage {
-
- private String pathString;
- private Table tagsTable;
- private List<VpeAnyData> tagsList;
- private List<VpeAnyData> currentList;
- private List<VpeAnyData> importedList = new ArrayList<VpeAnyData>();
-
- protected ImportUnknownTagsTemplatesWizardPage(String pageName, List<VpeAnyData> currentList) {
- super(pageName);
- this.currentList = currentList;
- setTitle(VpeUIMessages.IMPORT_UNKNOWN_TAGS_PAGE_TITLE);
- setDescription(VpeUIMessages.IMPORT_UNKNOWN_TAGS_PAGE_DESCRIPTION);
- setImageDescriptor(ReferenceWizardPage.getImageDescriptor());
- }
-
- public void createControl(Composite parent) {
- /*
- * Create main composite element with grid layout.
- * Two columns.
- */
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout(3, false));
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
- composite.setFont(parent.getFont());
-
- /*
- * Add label
- */
- Label fileNamaLabel = new Label(composite, SWT.NONE);
- fileNamaLabel.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 1));
- fileNamaLabel.setText(VpeUIMessages.FILE_NAME_LABEL);
- /*
- * Add output path
- */
- final Text pathText = new Text(composite, SWT.BORDER);
- pathText.setEditable(true);
- pathText.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false, 1, 1));
- pathText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- pathString = ((Text)e.getSource()).getText();
- IPath enteredPath = null;
- /*
- * Load templates if the path is valid
- */
- if ((Path.ROOT.isValidPath(pathString))
- && (enteredPath = Path.fromOSString(pathString)).toFile().exists()) {
- /*
- * Load tags list from the specified location.
- */
- tagsList = VpeTemplateManager.getInstance()
- .getAnyTemplates(enteredPath);
-
- } else {
- /*
- * Reset taglist, show empty table
- */
- if (tagsList != null) {
- tagsList.clear();
- }
- }
- /*
- * Update table tags list based on the loaded file.
- */
- VpeImportExportWizardsUtils.updateTagsTable(tagsTable, tagsList, true);
- /*
- * Check if the page is complete.
- */
- setPageComplete(isPageComplete());
- }
- });
- /*
- * Add browse button
- */
- Button browseButton = new Button(composite, SWT.NONE);
- browseButton.setText(VpeUIMessages.BROWSE_BUTTON_TEXT);
- browseButton.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, false, 1, 1));
- browseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- FileDialog dialog = new FileDialog(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getShell(), SWT.NONE);
- String path = dialog.open();
- if (path != null) {
- File file = new File(path);
- pathString = file.toString();
- /*
- * Then modifyText event will be dispatched.
- */
- pathText.setText(pathString);
- }
- }
- });
-
- /*
- * Create datatable with the list of unknown tags
- */
- tagsTable = new Table(composite, 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);
-
- /*
- * Create columns in the table
- */
- ColumnLayoutData columnLayoutData;
- for (int i = 0; i < COLUMNS_NAMES.length; i++) {
- TableColumn column = new TableColumn(tagsTable, SWT.NONE);
- column.setText(COLUMNS_NAMES[i]);
- columnLayoutData = new ColumnWeightData(COLUMNS_WIDTHS[i], true);
- layout.addColumnData(columnLayoutData);
- }
-
- /*
- * Finishing the initialization
- */
- setErrorMessage(null); // should not initially have error message
- setControl(composite);
- }
-
- @Override
- public boolean isPageComplete() {
- boolean isPageComplete = false;
- if ((pathString != null)
- && !Constants.EMPTY.equalsIgnoreCase(pathString)
- && (Path.ROOT.isValidPath(pathString))
- && ((Path.fromOSString(pathString)).toFile().exists())) {
- isPageComplete = true;
- }
- return isPageComplete;
- }
-
-
-
- public boolean finish() {
- /*
- * Uploading will add only missing templates.
- * So here all duplicated templates will be deleted from the tagsList.
- */
- importedList.clear();
- importedList.addAll(tagsList);
- Iterator<VpeAnyData> iterator = importedList.iterator();
- while (iterator.hasNext()) {
- VpeAnyData loadedTemplate = (VpeAnyData) iterator.next();
- for (VpeAnyData currentTemplate : currentList) {
- if (loadedTemplate.equals(currentTemplate)) {
- iterator.remove();
- }
- }
- }
- /*
- * Add unique templates to the current list.
- */
- return true;
- }
-
- public List<VpeAnyData> getImportedList() {
- return importedList;
- }
-}
Copied: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUserTagsTemplatesMenuWizard.java (from rev 23657, trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesMenuWizard.java)
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUserTagsTemplatesMenuWizard.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUserTagsTemplatesMenuWizard.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.editor.wizards;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IImportWizard;
+import org.eclipse.ui.IWorkbench;
+import org.jboss.tools.vpe.messages.VpeUIMessages;
+
+/**
+ *
+ * Wizard that imports user specified tag templates from external xml file.
+ *
+ * @author dmaliarevich
+ */
+public class ImportUserTagsTemplatesMenuWizard extends Wizard implements
+ IImportWizard {
+
+ private IStructuredSelection selection;
+ private ImportUserTagsTemplatesMenuWizardPage mainPage;
+
+ /**
+ * Constructor
+ */
+ public ImportUserTagsTemplatesMenuWizard() {
+ super();
+ setWindowTitle(VpeUIMessages.IMPORT_USER_TAGS_PAGE_TITLE);
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.selection = selection;
+ setWindowTitle(VpeUIMessages.IMPORT_USER_TAGS_PAGE_TITLE);
+ }
+
+ @Override
+ public void addPages() {
+ super.addPages();
+ mainPage = new ImportUserTagsTemplatesMenuWizardPage(
+ VpeUIMessages.IMPORT_USER_TAGS_TEMPLATES_WIZARD_PAGE,
+ selection);
+ addPage(mainPage);
+ }
+
+ @Override
+ public boolean canFinish() {
+ return mainPage.isPageComplete();
+ }
+
+ @Override
+ public boolean performFinish() {
+ return mainPage.finish();
+ }
+
+}
Copied: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUserTagsTemplatesMenuWizardPage.java (from rev 23657, trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesMenuWizardPage.java)
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUserTagsTemplatesMenuWizardPage.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUserTagsTemplatesMenuWizardPage.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -0,0 +1,245 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.editor.wizards;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.ColumnLayoutData;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TableLayout;
+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.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.WizardResourceImportPage;
+import org.jboss.tools.vpe.VpePlugin;
+import org.jboss.tools.vpe.editor.template.VpeAnyData;
+import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
+import org.jboss.tools.vpe.editor.util.Constants;
+import org.jboss.tools.vpe.messages.VpeUIMessages;
+import org.jboss.tools.vpe.resref.core.ReferenceWizardPage;
+
+/**
+ * Page for importing user specified tag templates.
+ *
+ * @author dmaliarevich
+ */
+public class ImportUserTagsTemplatesMenuWizardPage extends
+ WizardResourceImportPage implements VpeImportExportWizardPage {
+
+ private String pathString;
+ private Table tagsTable;
+ private List<VpeAnyData> tagsList;
+
+ /**
+ * Constructor
+ *
+ * @param name
+ * @param selection
+ */
+ public ImportUserTagsTemplatesMenuWizardPage(String name,
+ IStructuredSelection selection) {
+ super(name, selection);
+ setTitle(VpeUIMessages.IMPORT_USER_TAGS_PAGE_TITLE);
+ setDescription(VpeUIMessages.IMPORT_USER_TAGS_PAGE_DESCRIPTION);
+ setImageDescriptor(ReferenceWizardPage.getImageDescriptor());
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ /*
+ * Create main composite element with grid layout.
+ * Two columns.
+ */
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(3, false));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ composite.setFont(parent.getFont());
+
+ /*
+ * Add label
+ */
+ Label fileNamaLabel = new Label(composite, SWT.NONE);
+ fileNamaLabel.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 1));
+ fileNamaLabel.setText(VpeUIMessages.FILE_NAME_LABEL);
+ /*
+ * Add output path
+ */
+ final Text pathText = new Text(composite, SWT.BORDER);
+ pathText.setEditable(true);
+ pathText.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false, 1, 1));
+ pathText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ pathString = ((Text)e.getSource()).getText();
+ IPath enteredPath = null;
+ /*
+ * Load templates if the path is valid
+ */
+ if ((Path.ROOT.isValidPath(pathString))
+ && (enteredPath = Path.fromOSString(pathString)).toFile().exists()) {
+ /*
+ * Load tags list from the specified location.
+ */
+ tagsList = VpeTemplateManager.getInstance()
+ .getAnyTemplates(enteredPath);
+
+ } else {
+ /*
+ * Reset taglist, show empty table
+ */
+ if (tagsList != null) {
+ tagsList.clear();
+ }
+ }
+ /*
+ * Update table tags list based on the loaded file.
+ */
+ VpeImportExportWizardsUtils.updateTagsTable(tagsTable, tagsList, true);
+ /*
+ * Check if the page is complete.
+ */
+ setPageComplete(isPageComplete());
+ }
+ });
+ /*
+ * Add browse button
+ */
+ Button browseButton = new Button(composite, SWT.NONE);
+ browseButton.setText(VpeUIMessages.BROWSE_BUTTON_TEXT);
+ browseButton.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, false, 1, 1));
+ browseButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ FileDialog dialog = new FileDialog(PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell(), SWT.NONE);
+ String path = dialog.open();
+ if (path != null) {
+ File file = new File(path);
+ pathString = file.toString();
+ /*
+ * Then modifyText event will be dispatched.
+ */
+ pathText.setText(pathString);
+ }
+ }
+ });
+
+ /*
+ * Create datatable with the list of user specified tag templates
+ */
+ tagsTable = new Table(composite, 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);
+
+ /*
+ * Create columns in the table
+ */
+ ColumnLayoutData columnLayoutData;
+ for (int i = 0; i < COLUMNS_NAMES.length; i++) {
+ TableColumn column = new TableColumn(tagsTable, SWT.NONE);
+ column.setText(COLUMNS_NAMES[i]);
+ columnLayoutData = new ColumnWeightData(COLUMNS_WIDTHS[i], true);
+ layout.addColumnData(columnLayoutData);
+ }
+
+ /*
+ * Finishing the initialization
+ */
+ setErrorMessage(null); // should not initially have error message
+ setControl(composite);
+
+ }
+
+ @Override
+ public boolean isPageComplete() {
+ boolean isPageComplete = false;
+ if ((pathString != null)
+ && !Constants.EMPTY.equalsIgnoreCase(pathString)
+ && (Path.ROOT.isValidPath(pathString))
+ && ((Path.fromOSString(pathString)).toFile().exists())) {
+ isPageComplete = true;
+ }
+ return isPageComplete;
+ }
+
+ public boolean finish() {
+ /*
+ * Currently used templates list
+ */
+ List<VpeAnyData> currentList = VpeTemplateManager.getInstance().getAnyTemplates();
+
+ /*
+ * Uploading will add only missing templates.
+ * So here all duplicated templates will be deleted from the tagsList.
+ */
+ Iterator<VpeAnyData> iterator = tagsList.iterator();
+ while (iterator.hasNext()) {
+ VpeAnyData loadedTemplate = (VpeAnyData) iterator.next();
+ for (VpeAnyData currentTemplate : currentList) {
+ if (loadedTemplate.equals(currentTemplate)) {
+ iterator.remove();
+ }
+ }
+ }
+ /*
+ * Add unique templates to the current list.
+ */
+ if (currentList.addAll(tagsList)) {
+ /*
+ * Store loaded templates to the default auto-templates location.
+ */
+ VpeTemplateManager.getInstance().setAnyTemplates(currentList);
+ } else {
+ /*
+ * Log WARNING if the operation could not be performed.
+ */
+ VpePlugin.getDefault().logWarning(VpeUIMessages.NONE_TEMPLATES_WERE_ADDED);
+ }
+ return true;
+ }
+
+ @Override
+ protected void createSourceGroup(Composite parent) {
+ /*
+ * Create nothing.
+ */
+ }
+
+ @Override
+ protected ITreeContentProvider getFileProvider() {
+ return null;
+ }
+
+ @Override
+ protected ITreeContentProvider getFolderProvider() {
+ return null;
+ }
+
+}
Copied: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUserTagsTemplatesWizard.java (from rev 23657, trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUnknownTagsTemplatesWizard.java)
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUserTagsTemplatesWizard.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUserTagsTemplatesWizard.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -0,0 +1,49 @@
+package org.jboss.tools.vpe.editor.wizards;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.wizard.Wizard;
+import org.jboss.tools.vpe.editor.template.VpeAnyData;
+import org.jboss.tools.vpe.messages.VpeUIMessages;
+
+public class ImportUserTagsTemplatesWizard extends Wizard {
+
+ private ImportUserTagsTemplatesWizardPage mainPage;
+ private List<VpeAnyData> importedList = new ArrayList<VpeAnyData>();
+ private List<VpeAnyData> currentList;
+
+ public ImportUserTagsTemplatesWizard(List<VpeAnyData> currentList) {
+ super();
+ setWindowTitle(VpeUIMessages.IMPORT_USER_TAGS_PAGE_TITLE);
+ this.currentList = currentList;
+ }
+
+ @Override
+ public void addPages() {
+ super.addPages();
+ mainPage = new ImportUserTagsTemplatesWizardPage(
+ VpeUIMessages.IMPORT_USER_TAGS_TEMPLATES_WIZARD_PAGE,
+ currentList);
+ addPage(mainPage);
+ }
+
+ @Override
+ public boolean canFinish() {
+ return mainPage.isPageComplete();
+ }
+
+ @Override
+ public boolean performFinish() {
+ boolean pageFinished = mainPage.finish();
+ if (pageFinished) {
+ importedList = mainPage.getImportedList();
+ }
+ return pageFinished;
+ }
+
+ public List<VpeAnyData> getImportedList() {
+ return importedList;
+ }
+
+}
Copied: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUserTagsTemplatesWizardPage.java (from rev 23657, 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/ImportUserTagsTemplatesWizardPage.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/wizards/ImportUserTagsTemplatesWizardPage.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -0,0 +1,207 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.editor.wizards;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.ColumnLayoutData;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.wizard.WizardPage;
+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.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.vpe.VpePlugin;
+import org.jboss.tools.vpe.editor.template.VpeAnyData;
+import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
+import org.jboss.tools.vpe.editor.util.Constants;
+import org.jboss.tools.vpe.messages.VpeUIMessages;
+import org.jboss.tools.vpe.resref.core.ReferenceWizardPage;
+
+public class ImportUserTagsTemplatesWizardPage extends WizardPage implements
+ VpeImportExportWizardPage {
+
+ private String pathString;
+ private Table tagsTable;
+ private List<VpeAnyData> tagsList;
+ private List<VpeAnyData> currentList;
+ private List<VpeAnyData> importedList = new ArrayList<VpeAnyData>();
+
+ protected ImportUserTagsTemplatesWizardPage(String pageName, List<VpeAnyData> currentList) {
+ super(pageName);
+ this.currentList = currentList;
+ setTitle(VpeUIMessages.IMPORT_USER_TAGS_PAGE_TITLE);
+ setDescription(VpeUIMessages.IMPORT_USER_TAGS_PAGE_DESCRIPTION);
+ setImageDescriptor(ReferenceWizardPage.getImageDescriptor());
+ }
+
+ public void createControl(Composite parent) {
+ /*
+ * Create main composite element with grid layout.
+ * Two columns.
+ */
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(3, false));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+ composite.setFont(parent.getFont());
+
+ /*
+ * Add label
+ */
+ Label fileNamaLabel = new Label(composite, SWT.NONE);
+ fileNamaLabel.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, false, false, 1, 1));
+ fileNamaLabel.setText(VpeUIMessages.FILE_NAME_LABEL);
+ /*
+ * Add output path
+ */
+ final Text pathText = new Text(composite, SWT.BORDER);
+ pathText.setEditable(true);
+ pathText.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false, 1, 1));
+ pathText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ pathString = ((Text)e.getSource()).getText();
+ IPath enteredPath = null;
+ /*
+ * Load templates if the path is valid
+ */
+ if ((Path.ROOT.isValidPath(pathString))
+ && (enteredPath = Path.fromOSString(pathString)).toFile().exists()) {
+ /*
+ * Load tags list from the specified location.
+ */
+ tagsList = VpeTemplateManager.getInstance()
+ .getAnyTemplates(enteredPath);
+
+ } else {
+ /*
+ * Reset taglist, show empty table
+ */
+ if (tagsList != null) {
+ tagsList.clear();
+ }
+ }
+ /*
+ * Update table tags list based on the loaded file.
+ */
+ VpeImportExportWizardsUtils.updateTagsTable(tagsTable, tagsList, true);
+ /*
+ * Check if the page is complete.
+ */
+ setPageComplete(isPageComplete());
+ }
+ });
+ /*
+ * Add browse button
+ */
+ Button browseButton = new Button(composite, SWT.NONE);
+ browseButton.setText(VpeUIMessages.BROWSE_BUTTON_TEXT);
+ browseButton.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, false, 1, 1));
+ browseButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ FileDialog dialog = new FileDialog(PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell(), SWT.NONE);
+ String path = dialog.open();
+ if (path != null) {
+ File file = new File(path);
+ pathString = file.toString();
+ /*
+ * Then modifyText event will be dispatched.
+ */
+ pathText.setText(pathString);
+ }
+ }
+ });
+
+ /*
+ * Create datatable with the list of user specified tag templates
+ */
+ tagsTable = new Table(composite, 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);
+
+ /*
+ * Create columns in the table
+ */
+ ColumnLayoutData columnLayoutData;
+ for (int i = 0; i < COLUMNS_NAMES.length; i++) {
+ TableColumn column = new TableColumn(tagsTable, SWT.NONE);
+ column.setText(COLUMNS_NAMES[i]);
+ columnLayoutData = new ColumnWeightData(COLUMNS_WIDTHS[i], true);
+ layout.addColumnData(columnLayoutData);
+ }
+
+ /*
+ * Finishing the initialization
+ */
+ setErrorMessage(null); // should not initially have error message
+ setControl(composite);
+ }
+
+ @Override
+ public boolean isPageComplete() {
+ boolean isPageComplete = false;
+ if ((pathString != null)
+ && !Constants.EMPTY.equalsIgnoreCase(pathString)
+ && (Path.ROOT.isValidPath(pathString))
+ && ((Path.fromOSString(pathString)).toFile().exists())) {
+ isPageComplete = true;
+ }
+ return isPageComplete;
+ }
+
+
+
+ public boolean finish() {
+ /*
+ * Uploading will add only missing templates.
+ * So here all duplicated templates will be deleted from the tagsList.
+ */
+ importedList.clear();
+ importedList.addAll(tagsList);
+ Iterator<VpeAnyData> iterator = importedList.iterator();
+ while (iterator.hasNext()) {
+ VpeAnyData loadedTemplate = (VpeAnyData) iterator.next();
+ for (VpeAnyData currentTemplate : currentList) {
+ if (loadedTemplate.equals(currentTemplate)) {
+ iterator.remove();
+ }
+ }
+ }
+ /*
+ * Add unique templates to the current list.
+ */
+ return true;
+ }
+
+ public List<VpeAnyData> getImportedList() {
+ return importedList;
+ }
+}
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-07-22 08:14:03 UTC (rev 23657)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java 2010-07-22 09:43:16 UTC (rev 23658)
@@ -37,7 +37,7 @@
public static String GENERAL;
public static String TEMPLATES;
public static String TEMPLATE;
- public static String UNKNOWN_TAGS_DIALOG_DESCRIPTION;
+ public static String USER_SPECIFIED_TAG_DIALOG_DESCRIPTION;
public static String TAG_ATTRIBUTES;
public static String TAG_NAME;
public static String TAG_URI;
@@ -148,12 +148,12 @@
public static String VISUAL_APPEARANCE_GROUP_TITLE;
public static String CONFIRMATION_GROUP_TITLE;
public static String TABS_GROUP_TITLE;
- public static String IMPORT_UNKNOWN_TAGS_TEMPLATES_WIZARD_PAGE;
- public static String EXPORT_UNKNOWN_TAGS_TEMPLATES_WIZARD_PAGE;
- public static String EXPORT_UNKNOWN_TAGS_PAGE_TITLE;
- public static String EXPORT_UNKNOWN_TAGS_PAGE_DESCRIPTION;
- public static String IMPORT_UNKNOWN_TAGS_PAGE_TITLE;
- public static String IMPORT_UNKNOWN_TAGS_PAGE_DESCRIPTION;
+ public static String IMPORT_USER_TAGS_TEMPLATES_WIZARD_PAGE;
+ public static String EXPORT_USER_TAGS_TEMPLATES_WIZARD_PAGE;
+ public static String EXPORT_USER_TAGS_PAGE_TITLE;
+ public static String EXPORT_USER_TAGS_PAGE_DESCRIPTION;
+ public static String IMPORT_USER_TAGS_PAGE_TITLE;
+ public static String IMPORT_USER_TAGS_PAGE_DESCRIPTION;
public static String SELECT_ALL;
public static String DESELECT_ALL;
public static String BROWSE_BUTTON_TEXT;
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-07-22 08:14:03 UTC (rev 23657)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2010-07-22 09:43:16 UTC (rev 23658)
@@ -15,10 +15,10 @@
# END NON-TRANSLATABLE
GENERAL=General
-# Unknown tags templates dialog messages
+# User specified tag templates templates dialog messages
TEMPLATES=Visual Templates
-TEMPLATE=Unknown tag template
-UNKNOWN_TAGS_DIALOG_DESCRIPTION=Set up parameters for the unknown tag
+TEMPLATE=User specified tag template
+USER_SPECIFIED_TAG_DIALOG_DESCRIPTION=Set up parameters for the template
TAG_ATTRIBUTES=Set up tag attributes
TAG_NAME=Tag name:
TAG_URI=Tag URI:
@@ -134,17 +134,17 @@
SPLITTING_HORIZ_LEFT_SOURCE=Horizontal splitting with Source Editor to the left
SPLITTING_HORIZ_LEFT_VISUAL=Horizontal splitting with Visual Editor to the left
-# Import/Export Unknown Tags Templates Messages
-IMPORT_UNKNOWN_TAGS_TEMPLATES_WIZARD_PAGE=Import unknown tags templates wizard page
-EXPORT_UNKNOWN_TAGS_TEMPLATES_WIZARD_PAGE=Export unknown tags templates wizard page
+# Import/Export user specified tag templates messages
+IMPORT_USER_TAGS_TEMPLATES_WIZARD_PAGE=Import user specified tag templates wizard page
+EXPORT_USER_TAGS_TEMPLATES_WIZARD_PAGE=Export user specified tag templates wizard page
SELECT_ALL=Select All
DESELECT_ALL=Deselect All
BROWSE_BUTTON_TEXT=Browse...
FILE_NAME_LABEL=File name:
-EXPORT_UNKNOWN_TAGS_PAGE_TITLE=Export Unknown Tags Templates
-EXPORT_UNKNOWN_TAGS_PAGE_DESCRIPTION=Export unknown tags templates to the external file
-IMPORT_UNKNOWN_TAGS_PAGE_TITLE=Import Unknown Tags Templates
-IMPORT_UNKNOWN_TAGS_PAGE_DESCRIPTION=Import unknown tags templates from the external file
+EXPORT_USER_TAGS_PAGE_TITLE=Export user specified tag templates
+EXPORT_USER_TAGS_PAGE_DESCRIPTION=Export user specified tag templates to the local file system.
+IMPORT_USER_TAGS_PAGE_TITLE=Import user specified tag templates
+IMPORT_USER_TAGS_PAGE_DESCRIPTION=Import user specified tag templates from the local file system.
NONE_TEMPLATES_WERE_ADDED=None of the templates were added.
COULD_NOT_SET_TABLE_SELECTION=Could not set table selection.
LIST_IS_EMPTY=List is empty
More information about the jbosstools-commits
mailing list