Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCedric Brun2011-01-05 14:13:01 +0000
committerCedric Brun2011-01-05 14:13:01 +0000
commit8a1c5eb415078284a94d29c00280485ee60843cf (patch)
tree30ee7be4f84904ae13c89e0a873d759adf061bac /plugins/org.eclipse.emf.compare.examples.export.library/src/org/eclipse/emf/compare/examples/export/library/wizard/LibraryExportWizardPage.java
parentf0991e9aff822115764d9c392404a906e735a602 (diff)
downloadorg.eclipse.emf.compare-8a1c5eb415078284a94d29c00280485ee60843cf.tar.gz
org.eclipse.emf.compare-8a1c5eb415078284a94d29c00280485ee60843cf.tar.xz
org.eclipse.emf.compare-8a1c5eb415078284a94d29c00280485ee60843cf.zip
repository relayout : https://bugs.eclipse.org/bugs/show_bug.cgi?id=333059
Diffstat (limited to 'plugins/org.eclipse.emf.compare.examples.export.library/src/org/eclipse/emf/compare/examples/export/library/wizard/LibraryExportWizardPage.java')
-rw-r--r--plugins/org.eclipse.emf.compare.examples.export.library/src/org/eclipse/emf/compare/examples/export/library/wizard/LibraryExportWizardPage.java54
1 files changed, 54 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.compare.examples.export.library/src/org/eclipse/emf/compare/examples/export/library/wizard/LibraryExportWizardPage.java b/plugins/org.eclipse.emf.compare.examples.export.library/src/org/eclipse/emf/compare/examples/export/library/wizard/LibraryExportWizardPage.java
new file mode 100644
index 000000000..942f556fc
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.examples.export.library/src/org/eclipse/emf/compare/examples/export/library/wizard/LibraryExportWizardPage.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.examples.export.library.wizard;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+
+/**
+ * Overrides the default behavior of a wizard page to specify validation rules.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+public class LibraryExportWizardPage extends WizardNewFileCreationPage {
+ /**
+ * Instantiates a wizard page given its name and the current selection.
+ *
+ * @param pageName
+ * Name of the page that is to be created.
+ * @param selection
+ * Current resource selection.
+ */
+ public LibraryExportWizardPage(String pageName, IStructuredSelection selection) {
+ super(pageName, selection);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.ui.dialogs.WizardNewFileCreationPage#validatePage()
+ */
+ @Override
+ protected boolean validatePage() {
+ boolean result = super.validatePage();
+ if (result) {
+ final String fileName = getFileName();
+ if (fileName.endsWith(".html")) { //$NON-NLS-1$
+ setErrorMessage(null);
+ return true;
+ }
+ setErrorMessage("File name must end in '.html'");
+ return false;
+ }
+ // This will return false
+ return result;
+ }
+}

Back to the top