1 11 package org.eclipse.jdt.internal.ui.wizards.buildpaths; 12 13 import java.util.List ; 14 15 import org.eclipse.core.runtime.IPath; 16 17 import org.eclipse.core.resources.IContainer; 18 19 import org.eclipse.jdt.internal.ui.JavaPluginImages; 20 import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages; 21 22 public class AddSourceFolderWizard extends BuildPathWizard { 23 24 private AddSourceFolderWizardPage fAddFolderPage; 25 private SetFilterWizardPage fFilterPage; 26 private final boolean fLinkedMode; 27 private boolean fAllowConflict; 28 private final boolean fAllowRemoveProjectFolder; 29 private final boolean fAllowAddExclusionPatterns; 30 private final boolean fCanCommitConflict; 31 private final IContainer fParent; 32 33 public AddSourceFolderWizard(CPListElement[] existingEntries, CPListElement newEntry, IPath outputLocation, 34 boolean linkedMode, boolean canCommitConflict, 35 boolean allowConflict, boolean allowRemoveProjectFolder, boolean allowAddExclusionPatterns) { 36 this(existingEntries, newEntry, outputLocation, linkedMode, canCommitConflict, allowConflict, allowRemoveProjectFolder, allowAddExclusionPatterns, newEntry.getJavaProject().getProject()); 37 } 38 39 public AddSourceFolderWizard(CPListElement[] existingEntries, CPListElement newEntry, IPath outputLocation, 40 boolean linkedMode, boolean canCommitConflict, 41 boolean allowConflict, boolean allowRemoveProjectFolder, boolean allowAddExclusionPatterns, IContainer parent) { 42 super(existingEntries, newEntry, outputLocation, getTitel(newEntry, linkedMode), JavaPluginImages.DESC_WIZBAN_NEWSRCFOLDR); 43 fLinkedMode= linkedMode; 44 fCanCommitConflict= canCommitConflict; 45 fAllowConflict= allowConflict; 46 fAllowRemoveProjectFolder= allowRemoveProjectFolder; 47 fAllowAddExclusionPatterns= allowAddExclusionPatterns; 48 fParent= parent; 49 } 50 51 private static String getTitel(CPListElement newEntry, boolean linkedMode) { 52 if (newEntry.getPath() == null) { 53 if (linkedMode) { 54 return NewWizardMessages.NewSourceFolderCreationWizard_link_title; 55 } else { 56 return NewWizardMessages.NewSourceFolderCreationWizard_title; 57 } 58 } else { 59 return NewWizardMessages.NewSourceFolderCreationWizard_edit_title; 60 } 61 } 62 63 66 public void addPages() { 67 super.addPages(); 68 69 fAddFolderPage= new AddSourceFolderWizardPage(getEntryToEdit(), getExistingEntries(), getOutputLocation(), 70 fLinkedMode, fCanCommitConflict, 71 fAllowConflict, fAllowRemoveProjectFolder, fAllowAddExclusionPatterns, fParent); 72 addPage(fAddFolderPage); 73 74 fFilterPage= new SetFilterWizardPage(getEntryToEdit(), getExistingEntries(), getOutputLocation()); 75 addPage(fFilterPage); 76 } 77 78 81 public List getInsertedElements() { 82 List result= super.getInsertedElements(); 83 if (getEntryToEdit().getOrginalPath() == null) 84 result.add(getEntryToEdit()); 85 86 return result; 87 } 88 89 92 public List getRemovedElements() { 93 return fAddFolderPage.getRemovedElements(); 94 } 95 96 99 public List getModifiedElements() { 100 return fAddFolderPage.getModifiedElements(); 101 } 102 103 106 public boolean performFinish() { 107 getEntryToEdit().setAttribute(CPListElement.INCLUSION, fFilterPage.getInclusionPattern()); 108 getEntryToEdit().setAttribute(CPListElement.EXCLUSION, fFilterPage.getExclusionPattern()); 109 setOutputLocation(fAddFolderPage.getOutputLocation()); 110 111 boolean res= super.performFinish(); 112 if (res) { 113 selectAndReveal(fAddFolderPage.getCorrespondingResource()); 114 } 115 return res; 116 } 117 118 public void cancel() { 119 fAddFolderPage.restore(); 120 } 121 } 122 | Popular Tags |