Package ch.ethz.prose.eclipse.internal.wizards

Source Code of ch.ethz.prose.eclipse.internal.wizards.NewAspectCreationWizard

//
//  This file is part of the Prose Development Tools for Eclipse package.
//
//  The contents of this file are subject to the Mozilla Public License
//  Version 1.1 (the "License"); you may not use this file except in
//  compliance with the License. You may obtain a copy of the License at
//  http://www.mozilla.org/MPL/
//
//  Software distributed under the License is distributed on an "AS IS" basis,
//  WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
//  for the specific language governing rights and limitations under the
//  License.
//
//  The Original Code is Prose Development Tools for Eclipse.
//
//  The Initial Developer of the Original Code is Angela Nicoara. Portions
//  created by Angela Nicoara are Copyright (C) 2006 Angela Nicoara.
//  All Rights Reserved.
//
//  Contributor(s):
//  $Id: NewAspectCreationWizard.java,v 1.1 2008/11/18 12:26:05 anicoara Exp $
//  ==============================================================================
//

package ch.ethz.prose.eclipse.internal.wizards;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.internal.ui.wizards.NewElementWizard;

import ch.ethz.prose.eclipse.internal.core.ProsePlugin;

/**
* Wizard to create a new Prose crosscut.
*
* @author Angela Nicoara
* @author Johann Gyger
* @version $Id: NewAspectCreationWizard.java,v 1.1 2008/11/18 12:26:05 anicoara Exp $
*/
public class NewAspectCreationWizard extends NewElementWizard {

    protected NewAspectWizardPage mainPage;
    protected NewMethodCutWizardPage methodPage;
    protected NewMethodRedefineCutWizardPage methodRedefinePage;
    protected NewFieldCutWizardPage fieldPage;
    protected NewExceptionCutWizardPage exceptionPage;

    /**
     * Create a new aspect creation wizard.
     */
    public NewAspectCreationWizard() {
        setDefaultPageImageDescriptor(ProsePlugin.getDefault().createImageDescriptor("icons/wizard/new_aspect.gif"));
        setDialogSettings(ProsePlugin.getDefault().getDialogSettings());
        setWindowTitle("New Prose Aspect");
    }

    /* (non-Javadoc)
     * @see org.eclipse.jface.wizard.IWizard#addPages()
     */
    public void addPages() {
        super.addPages();
        mainPage = new NewAspectWizardPage();
        methodPage = new NewMethodCutWizardPage();
        methodRedefinePage = new NewMethodRedefineCutWizardPage();
        fieldPage = new NewFieldCutWizardPage();
        exceptionPage = new NewExceptionCutWizardPage();
        addPage(mainPage);
        addPage(methodPage);
        addPage(methodRedefinePage);
        addPage(fieldPage);
        addPage(exceptionPage);
        mainPage.init(getSelection());
    }

    /* (non-Javadoc)
     * @see org.eclipse.jdt.internal.ui.wizards.NewElementWizard#canRunForked()
     */
    protected boolean canRunForked() {
        return false;
    }

    /* (non-Javadoc)
     * @see org.eclipse.jdt.internal.ui.wizards.NewElementWizard#finishPage(org.eclipse.core.runtime.IProgressMonitor)
     */
    protected void finishPage(IProgressMonitor monitor) throws InterruptedException, CoreException {
        mainPage.createAspect(monitor); // use the full progress monitor
    }

    /*
     * (non-Javadoc)
     * @see org.eclipse.jface.wizard.IWizard#performFinish()
     */
    public boolean performFinish() {
        warnAboutTypeCommentDeprecation();
        boolean res = super.performFinish();
        if (res) {
            IResource resource = mainPage.getModifiedResource();
            if (resource != null) {
                selectAndReveal(resource);
                openResource((IFile) resource);
            }
        }
        return res;
    }

    /**
     * @return Main page of this wizard
     */
    public NewAspectWizardPage getMainPage() {
        return mainPage;
    }

    /**
     * @return Method cut page
     */
    public NewMethodCutWizardPage getMethodPage() {
        return methodPage;
    }

    /**
     * @return MethodRedefine cut page
     */
    public NewMethodRedefineCutWizardPage getMethodRedefinePage() {   
        return methodRedefinePage;
    }
   
    /**
     * @return Field cut page
     */
    public NewFieldCutWizardPage getFieldPage() {
        return fieldPage;
    }

    /**
     * @return Exception cut page
     */
    public NewExceptionCutWizardPage getExceptionPage() {
        return exceptionPage;
    }

    /* (non-Javadoc)
   * @see org.eclipse.jdt.internal.ui.wizards.NewElementWizard#getCreatedElement()
   */
  public IJavaElement getCreatedElement() {
    return null//TODO check function of this new method
  }
}
TOP

Related Classes of ch.ethz.prose.eclipse.internal.wizards.NewAspectCreationWizard

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.