Commit 48cf5c46 authored by Kristof Szabados's avatar Kristof Szabados
Browse files

removed line ending whitespaces.


Signed-off-by: Kristof Szabados's avatarKristof Szabados <Kristof.Szabados@ericsson.com>
parent 6b206fce
...@@ -13,7 +13,7 @@ import org.osgi.framework.BundleContext; ...@@ -13,7 +13,7 @@ import org.osgi.framework.BundleContext;
/** /**
* The activator class controls the plug-in life cycle * The activator class controls the plug-in life cycle
* *
* @author Kristof Szabados * @author Kristof Szabados
*/ */
public class Activator extends AbstractUIPlugin { public class Activator extends AbstractUIPlugin {
...@@ -41,7 +41,7 @@ public class Activator extends AbstractUIPlugin { ...@@ -41,7 +41,7 @@ public class Activator extends AbstractUIPlugin {
/** /**
* Sets the default singleton instance of this plug-in, * Sets the default singleton instance of this plug-in,
* that later can be used to access plug-in specific preference settings. * that later can be used to access plug-in specific preference settings.
* *
* @param activator the single instance of this plug-in class. * @param activator the single instance of this plug-in class.
* */ * */
private static void setDefault(final Activator activator) { private static void setDefault(final Activator activator) {
......
...@@ -52,7 +52,7 @@ import org.eclipse.ui.actions.WorkspaceModifyOperation; ...@@ -52,7 +52,7 @@ import org.eclipse.ui.actions.WorkspaceModifyOperation;
/** /**
* A class for utilities used by the refactoring classes. * A class for utilities used by the refactoring classes.
* TODO needed? used consistently? * TODO needed? used consistently?
* *
* @author Viktor Varga * @author Viktor Varga
*/ */
public class Utils { public class Utils {
...@@ -86,7 +86,7 @@ public class Utils { ...@@ -86,7 +86,7 @@ public class Utils {
final IEditorInput input = editor.getEditorInput(); final IEditorInput input = editor.getEditorInput();
if (!(input instanceof IFileEditorInput)) { if (!(input instanceof IFileEditorInput)) {
TITANDebugConsole.getConsole().newMessageStream() TITANDebugConsole.getConsole().newMessageStream()
.println("Utils.extractFile() during refactoring " + .println("Utils.extractFile() during refactoring " +
refactoringName + ": IEditorInput is not an IFileEditorInput. "); refactoringName + ": IEditorInput is not an IFileEditorInput. ");
return null; return null;
} }
...@@ -102,7 +102,7 @@ public class Utils { ...@@ -102,7 +102,7 @@ public class Utils {
TTCN3Editor editor; TTCN3Editor editor;
if (editorPart == null || !(editorPart instanceof TTCN3Editor)) { if (editorPart == null || !(editorPart instanceof TTCN3Editor)) {
TITANDebugConsole.getConsole().newMessageStream() TITANDebugConsole.getConsole().newMessageStream()
.println("Utils.updateASTForProjectActiveInEditor() during refactoring " + .println("Utils.updateASTForProjectActiveInEditor() during refactoring " +
refactoringName + ": Only for TTCN3 editors!"); refactoringName + ": Only for TTCN3 editors!");
return; return;
} else {// TODO not needed else } else {// TODO not needed else
...@@ -120,7 +120,7 @@ public class Utils { ...@@ -120,7 +120,7 @@ public class Utils {
if (job == null) { if (job == null) {
TITANDebugConsole.getConsole().newMessageStream() TITANDebugConsole.getConsole().newMessageStream()
.println("Utils.updateASTForProjectActiveInEditor() during refactoring " + .println("Utils.updateASTForProjectActiveInEditor() during refactoring " +
refactoringName + ": WorkspaceJob to report outdating could not be created for project: " + selProject); refactoringName + ": WorkspaceJob to report outdating could not be created for project: " + selProject);
return; return;
} }
try { try {
...@@ -134,7 +134,7 @@ public class Utils { ...@@ -134,7 +134,7 @@ public class Utils {
if (job == null) { if (job == null) {
TITANDebugConsole.getConsole().newMessageStream() TITANDebugConsole.getConsole().newMessageStream()
.println("Utils.updateASTForProjectActiveInEditor() during refactoring " + .println("Utils.updateASTForProjectActiveInEditor() during refactoring " +
refactoringName + ": WorkspaceJob to reanalyze project could not be created for project: " + selProject); refactoringName + ": WorkspaceJob to reanalyze project could not be created for project: " + selProject);
return; return;
} }
try { try {
...@@ -171,7 +171,7 @@ public class Utils { ...@@ -171,7 +171,7 @@ public class Utils {
* This needs to be saved before {@link Refactoring#createChange(org.eclipse.core.runtime.IProgressMonitor)} returns, * This needs to be saved before {@link Refactoring#createChange(org.eclipse.core.runtime.IProgressMonitor)} returns,
* because a successful refactoring operation clears the affected objects' list in the Change object. * because a successful refactoring operation clears the affected objects' list in the Change object.
* @param refactoringName The name of the operation * @param refactoringName The name of the operation
* *
* */ * */
public static void updateASTAfterRefactoring(final RefactoringWizard wiz, final Object[] affectedObjects, final String refactoringName) { public static void updateASTAfterRefactoring(final RefactoringWizard wiz, final Object[] affectedObjects, final String refactoringName) {
if (wiz.getChange() == null || wiz.getChange().getAffectedObjects() == null) { if (wiz.getChange() == null || wiz.getChange().getAffectedObjects() == null) {
...@@ -246,7 +246,7 @@ public class Utils { ...@@ -246,7 +246,7 @@ public class Utils {
* <p> * <p>
* Use an instance of this class as a parameter of the * Use an instance of this class as a parameter of the
* {@link ProgressMonitorDialog#run(boolean, boolean, IRunnableWithProgress)} method. * {@link ProgressMonitorDialog#run(boolean, boolean, IRunnableWithProgress)} method.
* *
* */ * */
private static class UpdateASTOp implements IRunnableWithProgress { private static class UpdateASTOp implements IRunnableWithProgress {
...@@ -276,16 +276,16 @@ public class Utils { ...@@ -276,16 +276,16 @@ public class Utils {
final WorkspaceJob job = projectSourceParser.analyzeAll(); final WorkspaceJob job = projectSourceParser.analyzeAll();
if (job == null) { if (job == null) {
TITANDebugConsole.getConsole().newMessageStream() TITANDebugConsole.getConsole().newMessageStream()
.println("Utils.updateASTOp: WorkspaceJob to analyze project could not be created for project " .println("Utils.updateASTOp: WorkspaceJob to analyze project could not be created for project "
+ proj.getName() + ", during the refactoring: " + name); + proj.getName() + ", during the refactoring: " + name);
return; return;
} }
try { try {
job.join(); job.join();
} catch (InterruptedException e) { } catch (InterruptedException e) {
TITANDebugConsole.getConsole().newMessageStream() TITANDebugConsole.getConsole().newMessageStream()
.println("Utils.updateASTOp: Error during semantic analysis of the project: " .println("Utils.updateASTOp: Error during semantic analysis of the project: "
+ proj.getName() + ", during the refactoring: " + name); + proj.getName() + ", during the refactoring: " + name);
return; return;
} }
if (monitor.isCanceled()) { if (monitor.isCanceled()) {
......
...@@ -206,7 +206,7 @@ class ChangeCreator { ...@@ -206,7 +206,7 @@ class ChangeCreator {
job.schedule(); job.schedule();
return job; return job;
} }
public int insertField(final TTCN3_Set_Seq_Choice_BaseType ss, final ILocateableNode node, final MultiTextEdit rootEdit, int vmLen) { public int insertField(final TTCN3_Set_Seq_Choice_BaseType ss, final ILocateableNode node, final MultiTextEdit rootEdit, int vmLen) {
final Location nodeLocation = node.getLocation(); final Location nodeLocation = node.getLocation();
...@@ -238,7 +238,7 @@ class ChangeCreator { ...@@ -238,7 +238,7 @@ class ChangeCreator {
private final NavigableSet<ILocateableNode> locations; private final NavigableSet<ILocateableNode> locations;
private final Type type; private final Type type;
DefinitionVisitor(final Type type) { DefinitionVisitor(final Type type) {
locations = new TreeSet<ILocateableNode>(new LocationComparator()); locations = new TreeSet<ILocateableNode>(new LocationComparator());
this.type = type; this.type = type;
...@@ -250,7 +250,6 @@ class ChangeCreator { ...@@ -250,7 +250,6 @@ class ChangeCreator {
@Override @Override
public int visit(final IVisitableNode node) { public int visit(final IVisitableNode node) {
if (node instanceof Def_Type && ((Def_Type)node).getType(CompilationTimeStamp.getBaseTimestamp()).equals(type)) { if (node instanceof Def_Type && ((Def_Type)node).getType(CompilationTimeStamp.getBaseTimestamp()).equals(type)) {
final Definition d = (Definition)node; final Definition d = (Definition)node;
locations.add(d); locations.add(d);
...@@ -271,7 +270,6 @@ class ChangeCreator { ...@@ -271,7 +270,6 @@ class ChangeCreator {
return V_CONTINUE; return V_CONTINUE;
} }
} }
/** /**
* Compares {@link ILocateableNode}s by comparing the file paths as strings. * Compares {@link ILocateableNode}s by comparing the file paths as strings.
......
...@@ -49,8 +49,8 @@ public class InsertFieldActionFromEditor extends AbstractHandler { ...@@ -49,8 +49,8 @@ public class InsertFieldActionFromEditor extends AbstractHandler {
return null; return null;
} }
final IStructuredSelection structSelection = new StructuredSelection(selectedFile); final IStructuredSelection structSelection = new StructuredSelection(selectedFile);
final InsertFieldRefactoring refactoring = new InsertFieldRefactoring(structSelection, null); final InsertFieldRefactoring refactoring = new InsertFieldRefactoring(structSelection, null);
//open wizard //open wizard
final InsertFieldWizard wiz = new InsertFieldWizard(refactoring, refactoring.getSelection()); final InsertFieldWizard wiz = new InsertFieldWizard(refactoring, refactoring.getSelection());
final RefactoringWizardOpenOperation operation = new RefactoringWizardOpenOperation(wiz); final RefactoringWizardOpenOperation operation = new RefactoringWizardOpenOperation(wiz);
......
...@@ -50,9 +50,7 @@ public class InsertFieldRefactoring extends Refactoring { ...@@ -50,9 +50,7 @@ public class InsertFieldRefactoring extends Refactoring {
private final Definition selection; private final Definition selection;
private final Set<IProject> projects = new HashSet<IProject>(); private final Set<IProject> projects = new HashSet<IProject>();
private final IStructuredSelection iselection; private final IStructuredSelection iselection;
private final Settings settings; private final Settings settings;
private Object[] affectedObjects; //the list of objects affected by the change private Object[] affectedObjects; //the list of objects affected by the change
...@@ -76,7 +74,7 @@ public class InsertFieldRefactoring extends Refactoring { ...@@ -76,7 +74,7 @@ public class InsertFieldRefactoring extends Refactoring {
public Definition getSelection() { public Definition getSelection() {
return selection; return selection;
} }
public Object[] getAffectedObjects() { public Object[] getAffectedObjects() {
return affectedObjects; return affectedObjects;
} }
...@@ -135,12 +133,11 @@ public class InsertFieldRefactoring extends Refactoring { ...@@ -135,12 +133,11 @@ public class InsertFieldRefactoring extends Refactoring {
throws CoreException, OperationCanceledException { throws CoreException, OperationCanceledException {
return new RefactoringStatus(); return new RefactoringStatus();
} }
public Settings getSettings() { public Settings getSettings() {
return settings; return settings;
} }
@Override @Override
public Change createChange(final IProgressMonitor pm) throws CoreException, OperationCanceledException { public Change createChange(final IProgressMonitor pm) throws CoreException, OperationCanceledException {
if (iselection == null) { if (iselection == null) {
...@@ -216,7 +213,7 @@ public class InsertFieldRefactoring extends Refactoring { ...@@ -216,7 +213,7 @@ public class InsertFieldRefactoring extends Refactoring {
} }
} }
public static class Settings { public static class Settings {
private String type; private String type;
private Identifier id; private Identifier id;
......
...@@ -53,7 +53,7 @@ class ChangeCreator { ...@@ -53,7 +53,7 @@ class ChangeCreator {
private static Map<Module, List<Module>> moduleImports = new HashMap<Module, List<Module>>(); private static Map<Module, List<Module>> moduleImports = new HashMap<Module, List<Module>>();
// out // out
private Change change; private Change change;
ChangeCreator(final IFile selectedFile, final MoveFunctionSettings settings, final List<FunctionData> functions, final IProject project) { ChangeCreator(final IFile selectedFile, final MoveFunctionSettings settings, final List<FunctionData> functions, final IProject project) {
this.selectedFile = selectedFile; this.selectedFile = selectedFile;
...@@ -61,7 +61,7 @@ class ChangeCreator { ...@@ -61,7 +61,7 @@ class ChangeCreator {
this.functions = functions; this.functions = functions;
this.project = project; this.project = project;
} }
ChangeCreator(final IFile selectedFile, final MoveFunctionSettings settings, final List<FunctionData> functions, final IProject project, final Map<Module, List<Module>> mi) { ChangeCreator(final IFile selectedFile, final MoveFunctionSettings settings, final List<FunctionData> functions, final IProject project, final Map<Module, List<Module>> mi) {
this.selectedFile = selectedFile; this.selectedFile = selectedFile;
this.settings = settings; this.settings = settings;
...@@ -82,7 +82,7 @@ class ChangeCreator { ...@@ -82,7 +82,7 @@ class ChangeCreator {
if (selectedFile == null) { if (selectedFile == null) {
return; return;
} }
change = createFileChange(selectedFile); change = createFileChange(selectedFile);
} }
...@@ -100,7 +100,7 @@ class ChangeCreator { ...@@ -100,7 +100,7 @@ class ChangeCreator {
if (functions.isEmpty()) { if (functions.isEmpty()) {
return null; return null;
} }
if (settings.getExcludedModuleNames() != null && settings.getExcludedModuleNames().matcher(module.getIdentifier().getTtcnName()).matches()) { if (settings.getExcludedModuleNames() != null && settings.getExcludedModuleNames().matcher(module.getIdentifier().getTtcnName()).matches()) {
return null; return null;
} }
...@@ -113,7 +113,7 @@ class ChangeCreator { ...@@ -113,7 +113,7 @@ class ChangeCreator {
if (noDestination) { if (noDestination) {
return null; return null;
} }
CompositeChange cc = null; CompositeChange cc = null;
if (module instanceof TTCN3Module) { if (module instanceof TTCN3Module) {
cc = new CompositeChange("Moving functions from: "+module.getFullName()); cc = new CompositeChange("Moving functions from: "+module.getFullName());
...@@ -121,7 +121,7 @@ class ChangeCreator { ...@@ -121,7 +121,7 @@ class ChangeCreator {
else { else {
return null; return null;
} }
final TextFileChange tfc = new TextFileChange(toVisit.getName(), toVisit); final TextFileChange tfc = new TextFileChange(toVisit.getName(), toVisit);
cc.add(tfc); cc.add(tfc);
final MultiTextEdit rootEdit = new MultiTextEdit(); final MultiTextEdit rootEdit = new MultiTextEdit();
...@@ -130,15 +130,15 @@ class ChangeCreator { ...@@ -130,15 +130,15 @@ class ChangeCreator {
if(function.getFinalDestination() == null || !function.isToBeMoved()) { if(function.getFinalDestination() == null || !function.isToBeMoved()) {
continue; continue;
} }
final TextFileChange tfcDestination = new TextFileChange(function.getFinalDestination().getModule().getName(), (IFile) function.getFinalDestination().getModule().getLocation().getFile()); final TextFileChange tfcDestination = new TextFileChange(function.getFinalDestination().getModule().getName(), (IFile) function.getFinalDestination().getModule().getLocation().getFile());
final MultiTextEdit rootEdit2 = new MultiTextEdit(); final MultiTextEdit rootEdit2 = new MultiTextEdit();
tfcDestination.setEdit(rootEdit2); tfcDestination.setEdit(rootEdit2);
cc.add(tfcDestination); cc.add(tfcDestination);
final int length = function.getDefiniton().getLocation().getEndOffset() - function.getDefiniton().getLocation().getOffset(); final int length = function.getDefiniton().getLocation().getEndOffset() - function.getDefiniton().getLocation().getOffset();
final DeleteEdit deleteEdit = new DeleteEdit(function.getDefiniton().getLocation().getOffset(), length); final DeleteEdit deleteEdit = new DeleteEdit(function.getDefiniton().getLocation().getOffset(), length);
rootEdit.addChild(deleteEdit); rootEdit.addChild(deleteEdit);
if (!moduleImports.containsKey(function.getFinalDestination().getModule())) { if (!moduleImports.containsKey(function.getFinalDestination().getModule())) {
moduleImports.put(function.getFinalDestination().getModule(), new ArrayList<Module>()); moduleImports.put(function.getFinalDestination().getModule(), new ArrayList<Module>());
} }
final InsertEdit importEdit = insertMissingImports(function.getFinalDestination().getModule(), function.getUsedModules()); final InsertEdit importEdit = insertMissingImports(function.getFinalDestination().getModule(), function.getUsedModules());
...@@ -169,22 +169,22 @@ class ChangeCreator { ...@@ -169,22 +169,22 @@ class ChangeCreator {
} }
return cc; return cc;
} }
private InsertEdit insertMissingImports(final Module destinationModule, final List<Module> usedModules) { private InsertEdit insertMissingImports(final Module destinationModule, final List<Module> usedModules) {
final List<Module> importedModules = destinationModule.getImportedModules(); final List<Module> importedModules = destinationModule.getImportedModules();
String importText = ""; String importText = "";
for (final Module m : usedModules) { for (final Module m : usedModules) {
if (!importedModules.contains(m) if (!importedModules.contains(m)
&& !m.equals(destinationModule) && !m.equals(destinationModule)
&& !moduleImports.get(destinationModule).contains(m)) { && !moduleImports.get(destinationModule).contains(m)) {
importText += "import from "+m.getIdentifier().getTtcnName()+" all;\n "; importText += "import from "+m.getIdentifier().getTtcnName()+" all;\n ";
moduleImports.get(destinationModule).add(m); moduleImports.get(destinationModule).add(m);
} }
} }
final TextFileChange insertImports = new TextFileChange(destinationModule.getName(), final TextFileChange insertImports = new TextFileChange(destinationModule.getName(),
(IFile)destinationModule.getLocation().getFile()); (IFile)destinationModule.getLocation().getFile());
final MultiTextEdit rootEdit = new MultiTextEdit(); final MultiTextEdit rootEdit = new MultiTextEdit();
insertImports.setEdit(rootEdit); insertImports.setEdit(rootEdit);
int offset = destinationModule.getLocation().getEndOffset(); int offset = destinationModule.getLocation().getEndOffset();
...@@ -202,27 +202,27 @@ class ChangeCreator { ...@@ -202,27 +202,27 @@ class ChangeCreator {
} }
return new InsertEdit(offset, importText); return new InsertEdit(offset, importText);
} }
private void findFunctionUses(final FunctionData function) { private void findFunctionUses(final FunctionData function) {
final ProjectSourceParser projectSourceParser = GlobalParser.getProjectSourceParser(project); final ProjectSourceParser projectSourceParser = GlobalParser.getProjectSourceParser(project);
for(final Module m : projectSourceParser.getModules()) { for(final Module m : projectSourceParser.getModules()) {
if (!m.equals(function.getFinalDestination().getModule())) { if (!m.equals(function.getFinalDestination().getModule())) {
final ModuleVisitor vis = new ModuleVisitor(function.getDefiniton()); final ModuleVisitor vis = new ModuleVisitor(function.getDefiniton());
m.accept(vis); m.accept(vis);
if (vis.getIsUsed() if (vis.getIsUsed()
& !m.getImportedModules().contains(function.getFinalDestination().getModule()) & !m.getImportedModules().contains(function.getFinalDestination().getModule())
& !m.equals(function.getFinalDestination().getModule())) { & !m.equals(function.getFinalDestination().getModule())) {
function.addUsedBy(m); function.addUsedBy(m);
} }
} }
} }
} }
private static class ModuleVisitor extends ASTVisitor { private static class ModuleVisitor extends ASTVisitor {
private final Def_Function function; private final Def_Function function;
private boolean isUsed; private boolean isUsed;
public ModuleVisitor(final Def_Function function) { public ModuleVisitor(final Def_Function function) {
this.function = function; this.function = function;
this.isUsed = false; this.isUsed = false;
...@@ -238,7 +238,7 @@ class ChangeCreator { ...@@ -238,7 +238,7 @@ class ChangeCreator {
} }
return V_CONTINUE; return V_CONTINUE;
} }
public boolean getIsUsed() { public boolean getIsUsed() {
return isUsed; return isUsed;
} }
......
...@@ -26,7 +26,7 @@ public class FunctionData implements Comparable<FunctionData> { ...@@ -26,7 +26,7 @@ public class FunctionData implements Comparable<FunctionData> {
private Destination finalDestination; private Destination finalDestination;
private MoveFunctionMethod method; private MoveFunctionMethod method;
private final List<Module> usedBy; private final List<Module> usedBy;
public FunctionData(final Def_Function definiton, final String functionBody) { public FunctionData(final Def_Function definiton, final String functionBody) {
this.definiton = definiton; this.definiton = definiton;
this.functionBody = functionBody; this.functionBody = functionBody;
...@@ -35,78 +35,78 @@ public class FunctionData implements Comparable<FunctionData> { ...@@ -35,78 +35,78 @@ public class FunctionData implements Comparable<FunctionData> {
usedModules = new ArrayList<Module>(); usedModules = new ArrayList<Module>();
usedBy = new ArrayList<Module>(); usedBy = new ArrayList<Module>();
} }
public void setToBeMoved(final boolean toBeMoved) { public void setToBeMoved(final boolean toBeMoved) {
this.toBeMoved = toBeMoved; this.toBeMoved = toBeMoved;
} }
public void setModule(final Module module) { public void setModule(final Module module) {
this.module = module; this.module = module;
} }
public void addDestination(final Module destination, final Integer rating, final int newImports) { public void addDestination(final Module destination, final Integer rating, final int newImports) {
destinations.add(new Destination(destination, rating, this, newImports)); destinations.add(new Destination(destination, rating, this, newImports));
} }
public void addUsedModule(final Module module) { public void addUsedModule(final Module module) {
usedModules.add(module); usedModules.add(module);
} }
public void addUsedModules(final List<Module> modules) { public void addUsedModules(final List<Module> modules) {
usedModules.addAll(modules); usedModules.addAll(modules);
} }