1 11 12 package org.eclipse.pde.internal.ui.wizards.cheatsheet; 13 14 import java.util.StringTokenizer ; 15 16 import org.eclipse.core.runtime.IPath; 17 import org.eclipse.jface.viewers.IStructuredSelection; 18 import org.eclipse.osgi.util.NLS; 19 import org.eclipse.pde.internal.core.util.PDETextHelper; 20 import org.eclipse.pde.internal.ui.PDEUIMessages; 21 import org.eclipse.swt.widgets.Composite; 22 23 27 public class SimpleCSFileWizardPage extends CSFileWizardPage { 28 29 public final static String F_PAGE_NAME = "simple-cheatsheet"; 31 private String fAbsoluteFileName; 32 33 private String fProjectName; 34 35 39 public SimpleCSFileWizardPage(IStructuredSelection selection) { 40 super(F_PAGE_NAME, selection); 41 42 fAbsoluteFileName = null; 44 } 45 46 49 protected void initialize() { 50 setTitle(PDEUIMessages.CheatSheetFileWizardPage_1); 51 setDescription(PDEUIMessages.SimpleCSFileWizardPage_simpleCSWizardDescription); 52 setFileExtension(F_FILE_EXTENSION); 54 } 55 56 59 public int getCheatSheetType() { 60 return F_SIMPLE_CHEAT_SHEET; 61 } 62 63 66 protected void createAdvancedControls(Composite parent) { 67 } 69 70 73 protected boolean validatePage() { 74 fAbsoluteFileName = getContainerFullPath().toPortableString() + 76 IPath.SEPARATOR + 77 getFileName(); 78 if (PDETextHelper.isDefined(fProjectName)) { 82 String path = getContainerFullPath().toPortableString(); 84 StringTokenizer tokenizer = new StringTokenizer (path, 85 new Character (IPath.SEPARATOR).toString()); 86 String compareProject = tokenizer.nextToken(); 87 if (compareProject.equals(fProjectName) == false) { 88 setErrorMessage(NLS.bind(PDEUIMessages.SimpleCSFileWizardPage_errorInvalidProjectSelected, fProjectName)); 89 return false; 90 } 91 } 92 93 return super.validatePage(); 94 } 95 96 99 public String getAbsoluteFileName() { 100 return fAbsoluteFileName; 103 } 104 105 108 public void setProjectName(String projectName) { 109 fProjectName = projectName; 110 } 111 112 } 113 | Popular Tags |