KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > wizards > buildpaths > EditFilterWizard


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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 package org.eclipse.jdt.internal.ui.wizards.buildpaths;
12
13 import org.eclipse.core.runtime.IPath;
14
15 import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages;
16
17 public class EditFilterWizard extends BuildPathWizard {
18
19     private SetFilterWizardPage fFilterPage;
20     private final IPath[] fOrginalInclusion, fOriginalExclusion;
21     
22     public EditFilterWizard(CPListElement[] existingEntries, CPListElement newEntry, IPath outputLocation) {
23         super(existingEntries, newEntry, outputLocation, NewWizardMessages.ExclusionInclusionDialog_title, null);
24         
25         IPath[] inc= (IPath[])newEntry.getAttribute(CPListElement.INCLUSION);
26         fOrginalInclusion= new IPath[inc.length];
27         System.arraycopy(inc, 0, fOrginalInclusion, 0, inc.length);
28         
29         IPath[] excl= (IPath[])newEntry.getAttribute(CPListElement.EXCLUSION);
30         fOriginalExclusion= new IPath[excl.length];
31         System.arraycopy(excl, 0, fOriginalExclusion, 0, excl.length);
32     }
33     
34     /*
35      * @see Wizard#addPages
36      */

37     public void addPages() {
38         super.addPages();
39         
40         fFilterPage= new SetFilterWizardPage(getEntryToEdit(), getExistingEntries(), getOutputLocation());
41         addPage(fFilterPage);
42     }
43     
44     /* (non-Javadoc)
45      * @see org.eclipse.jface.wizard.IWizard#performFinish()
46      */

47     public boolean performFinish() {
48         CPListElement entryToEdit= getEntryToEdit();
49         entryToEdit.setAttribute(CPListElement.INCLUSION, fFilterPage.getInclusionPattern());
50         entryToEdit.setAttribute(CPListElement.EXCLUSION, fFilterPage.getExclusionPattern());
51         
52         return super.performFinish();
53     }
54
55     /**
56      * {@inheritDoc}
57      */

58     public void cancel() {
59         CPListElement entryToEdit= getEntryToEdit();
60         entryToEdit.setAttribute(CPListElement.INCLUSION, fOrginalInclusion);
61         entryToEdit.setAttribute(CPListElement.EXCLUSION, fOriginalExclusion);
62     }
63 }
64
Popular Tags