blob: 76ac573c6ae62bc0b6c7010f4abb13a149da8337 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2009 University of Illinois at Urbana-Champaign and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* UIUC - Initial API and implementation
*******************************************************************************/
package org.eclipse.photran.internal.ui.actions;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
import org.eclipse.photran.core.IFortranAST;
import org.eclipse.photran.internal.core.lexer.Token;
import org.eclipse.photran.internal.core.vpg.PhotranVPG;
import org.eclipse.photran.internal.ui.refactoring.AbstractFortranRefactoringActionDelegate;
import org.eclipse.photran.internal.ui.refactoring.AbstractFortranRefactoringWizard;
import org.eclipse.rephraserengine.core.vpg.refactoring.VPGRefactoring;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IEditorActionDelegate;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
/**
* @author Jeff Overbey
*/
public class EasterEggAction
extends AbstractFortranRefactoringActionDelegate
implements IWorkbenchWindowActionDelegate, IEditorActionDelegate
{
public EasterEggAction()
{
super(EasterEgg.class, EasterEggWizard.class);
}
@Override
protected VPGRefactoring<IFortranAST, Token, PhotranVPG> getRefactoring(List<IFile> files)
{
EasterEgg r = new EasterEgg();
r.initialize(
getFortranEditor().getIFile(),
getFortranEditor().getSelection());
return r;
}
public static class EasterEggWizard extends AbstractFortranRefactoringWizard
{
protected EasterEgg transformation;
public EasterEggWizard(EasterEgg r)
{
super(r);
this.transformation = r;
}
@Override protected void doAddUserInputPages()
{
addPage(new UserInputWizardPage(transformation.getName())
{
public void createControl(Composite parent)
{
Composite top = new Composite(parent, SWT.NONE);
initializeDialogUnits(top);
setControl(top);
top.setLayout(new GridLayout(1, false));
Label lbl = new Label(top, SWT.NONE);
lbl.setText("Congratulations! You found an Easter Egg."); //$NON-NLS-1$
}
});
}
}
}