/******************************************************************************* * Copyright © 2008, 2013 IBM Corporation 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: * IBM Corporation - initial API and implementation * *******************************************************************************/ package org.eclipse.edt.ide.ui.internal.refactoring.changes; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.Assert; import org.eclipse.edt.ide.core.model.IEGLFile; import org.eclipse.ltk.core.refactoring.TextFileChange; public class EGLFileChange extends TextFileChange { private IEGLFile fCUnit; /** * Creates a new <code>CompilationUnitChange</code>. * * @param name the change's name mainly used to render the change in the UI * @param cunit the compilation unit this text change works on */ public EGLFileChange(String name, IEGLFile cunit) { super(name, getFile(cunit)); Assert.isNotNull(cunit); fCUnit= cunit; setTextType("egl"); //$NON-NLS-1$ } private static IFile getFile(IEGLFile cunit) { return (IFile) cunit.getResource(); } /* non java-doc * Method declared in IChange. */ public Object getModifiedElement(){ return fCUnit; } /** * Returns the compilation unit this change works on. * * @return the compilation unit this change works on */ public IEGLFile getEGLFile() { return fCUnit; } /** * {@inheritDoc} */ public Object getAdapter(Class adapter) { if (IEGLFile.class.equals(adapter)) return fCUnit; return super.getAdapter(adapter); } }