KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > wizards > PDEWizardNewFileCreationPage


1 /*******************************************************************************
2  * Copyright (c) 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.pde.internal.ui.wizards;
13
14 import org.eclipse.core.runtime.IStatus;
15 import org.eclipse.core.runtime.Status;
16 import org.eclipse.jface.viewers.IStructuredSelection;
17 import org.eclipse.pde.internal.ui.PDEPlugin;
18 import org.eclipse.pde.internal.ui.PDEUIMessages;
19 import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
20
21 /**
22  * PDEWizardNewFileCreationPage
23  *
24  */

25 public class PDEWizardNewFileCreationPage extends WizardNewFileCreationPage {
26
27     /**
28      * @param pageName
29      * @param selection
30      */

31     public PDEWizardNewFileCreationPage(String JavaDoc pageName,
32             IStructuredSelection selection) {
33         super(pageName, selection);
34     }
35
36     /* (non-Javadoc)
37      * @see org.eclipse.ui.dialogs.WizardNewFileCreationPage#validatePage()
38      */

39     protected boolean validatePage() {
40         String JavaDoc filename = getFileName().trim();
41         // Verify the filename is non-empty
42
if (filename.length() == 0) {
43             // Reset previous error message set if any
44
setErrorMessage(null);
45             return false;
46         }
47         // Verify the file name does not begin with a dot
48
if (filename.charAt(0) == '.') {
49             setErrorMessage(PDEUIMessages.PDEWizardNewFileCreationPage_errorMsgStartsWithDot);
50             return false;
51         }
52         // Perform default validation
53
return super.validatePage();
54     }
55     
56     /* (non-Javadoc)
57      * @see org.eclipse.ui.dialogs.WizardNewFileCreationPage#validateLinkedResource()
58      */

59     protected IStatus validateLinkedResource() {
60         return new Status(IStatus.OK, PDEPlugin.getPluginId(), IStatus.OK, "", null); //$NON-NLS-1$
61
}
62     
63     /* (non-Javadoc)
64      * @see org.eclipse.ui.dialogs.WizardNewFileCreationPage#createLinkTarget()
65      */

66     protected void createLinkTarget() {
67         // NOOP
68
}
69
70     
71 }
72
Popular Tags