1 /*******************************************************************************
2 * Copyright (c) 2000, 2011 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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.jdt.internal.corext.refactoring.changes;
13 import org.eclipse.jdt.core.ICompilationUnit;
15 import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
16 import org.eclipse.jdt.internal.corext.refactoring.nls.changes.CreateTextFileChange;
17 import org.eclipse.jdt.internal.corext.util.Messages;
19 import org.eclipse.jdt.internal.ui.viewsupport.BasicElementLabels;
21 public final class CreateCompilationUnitChange extends CreateTextFileChange {
23 private final ICompilationUnit fUnit;
25 public CreateCompilationUnitChange(ICompilationUnit unit, String source, String encoding) {
26 super(unit.getResource().getFullPath(), source, encoding, "java"); //$NON-NLS-1$
31 public String getName() {
32 String cuName= BasicElementLabels.getFileName(fUnit);
33 String cuContainerName= BasicElementLabels.getPathLabel(fUnit.getParent().getPath(), false);
34 return Messages.format(RefactoringCoreMessages.CompilationUnitChange_label, new String[] { cuName, cuContainerName });