01: /*******************************************************************************
02: * Copyright (c) 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.wizards;
11:
12: import org.eclipse.core.runtime.IStatus;
13: import org.eclipse.core.runtime.Status;
14: import org.eclipse.jface.viewers.IStructuredSelection;
15: import org.eclipse.pde.internal.ui.PDEPlugin;
16: import org.eclipse.pde.internal.ui.PDEUIMessages;
17: import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
18:
19: /**
20: * PDEWizardNewFileCreationPage
21: *
22: */
23: public class PDEWizardNewFileCreationPage extends
24: WizardNewFileCreationPage {
25:
26: /**
27: * @param pageName
28: * @param selection
29: */
30: public PDEWizardNewFileCreationPage(String pageName,
31: IStructuredSelection selection) {
32: super (pageName, selection);
33: }
34:
35: /* (non-Javadoc)
36: * @see org.eclipse.ui.dialogs.WizardNewFileCreationPage#validatePage()
37: */
38: protected boolean validatePage() {
39: String filename = getFileName().trim();
40: // Verify the filename is non-empty
41: if (filename.length() == 0) {
42: // Reset previous error message set if any
43: setErrorMessage(null);
44: return false;
45: }
46: // Verify the file name does not begin with a dot
47: if (filename.charAt(0) == '.') {
48: setErrorMessage(PDEUIMessages.PDEWizardNewFileCreationPage_errorMsgStartsWithDot);
49: return false;
50: }
51: // Perform default validation
52: return super .validatePage();
53: }
54:
55: /* (non-Javadoc)
56: * @see org.eclipse.ui.dialogs.WizardNewFileCreationPage#validateLinkedResource()
57: */
58: protected IStatus validateLinkedResource() {
59: return new Status(IStatus.OK, PDEPlugin.getPluginId(),
60: 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: }
|