diff --git a/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/DecoupleClassesRefactoringProcessor.java b/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/DecoupleClassesRefactoringProcessor.java index 7a3833e..8c3060b 100644 --- a/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/DecoupleClassesRefactoringProcessor.java +++ b/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/DecoupleClassesRefactoringProcessor.java @@ -127,7 +127,8 @@ System.out.println(this.getClass().getSimpleName() + "#checkFinalConditions()"); RefactoringTaskGenerator taskGenerator = new RefactoringTaskGenerator(); - taskGenerator.setCfrom(descriptor.getClients()); + taskGenerator.setCfrom(descriptor.getCFromClients()); + taskGenerator.setAllClients(descriptor.getClients()); taskGenerator.setTargetClass(descriptor.getTargetType()); refactoringTasks = taskGenerator.generateTasks(); diff --git a/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/RefactoringTaskGenerator.java b/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/RefactoringTaskGenerator.java index c35c762..1ef9333 100644 --- a/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/RefactoringTaskGenerator.java +++ b/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/RefactoringTaskGenerator.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; +import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IMethod; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.dom.AST; @@ -18,16 +19,19 @@ import org.eclipse.jdt.core.dom.IBinding; import org.eclipse.jdt.core.dom.IMethodBinding; import org.eclipse.jdt.core.dom.ITypeBinding; +import org.eclipse.jdt.core.dom.IVariableBinding; import org.eclipse.jdt.core.dom.MethodDeclaration; import org.eclipse.jdt.core.dom.MethodInvocation; import org.eclipse.jdt.core.dom.Name; import org.eclipse.jdt.core.dom.ReturnStatement; import org.eclipse.jdt.core.dom.SingleVariableDeclaration; import org.eclipse.jdt.core.dom.TypeDeclaration; +import org.eclipse.jdt.core.dom.VariableDeclarationFragment; import org.eclipse.jdt.core.dom.VariableDeclarationStatement; import org.ntlab.refactoring.decouplingClasses.refactoringApplication.ContractedRefactoring; import org.ntlab.refactoring.decouplingClasses.refactoringApplication.HideDelegate; import org.ntlab.refactoring.decouplingClasses.refactoringApplication.IntroduceParameterObject; +import org.ntlab.refactoring.decouplingClasses.refactoringApplication.IntroduceReturnValueObject; import org.ntlab.refactoring.decouplingClasses.refactoringApplication.PreserveWholeObject; import org.ntlab.refactoring.decouplingClasses.refactoringApplication.PrimitiveRefactoring; import org.ntlab.refactoring.decouplingClasses.refactoringApplication.RefactoringApplication; @@ -39,6 +43,7 @@ public class RefactoringTaskGenerator { private IType targetClass = null; private List cFrom = null; + private List allClients = null; /** Refactoring Unit, Refactoring*/ public Map> refactoringTasks = new HashMap<>(); @@ -58,7 +63,8 @@ parser.setKind(ASTParser.K_COMPILATION_UNIT); - for (IType clientType: cFrom) { +// for (IType clientType: cFrom) { + for (IType clientType: allClients) { parser.setSource(clientType.getCompilationUnit()); parser.setResolveBindings(true); parser.setBindingsRecovery(true); @@ -71,6 +77,11 @@ @Override public boolean visit(MethodDeclaration node) { + IMethodBinding methodBinding = node.resolveBinding(); + if (!isCfrom((IType) methodBinding.getDeclaringClass().getJavaElement())) { + return super.visit(node); + } + for (Object obj: node.parameters()) { SingleVariableDeclaration parameter = (SingleVariableDeclaration) obj; @@ -89,7 +100,7 @@ return super.visit(node); } - private boolean isCfrom(TypeDeclaration declaringType) { + private boolean isCfrom(TypeDeclaration declaringType) { for (IType type: cFrom) { if (type.getElementName().equals(declaringType.getName().toString())) { return true; @@ -97,9 +108,36 @@ } return false; } + + private boolean isCfrom(ASTNode node) { + ASTNode nowNode = node; + int cnt = 0; + while(cnt < 30 && nowNode != null) { // �Ƃ肠����30��parent��������ł��؂� + if (nowNode.getNodeType() == ASTNode.TYPE_DECLARATION) { + TypeDeclaration type = (TypeDeclaration)nowNode; + System.out.println("isCfrom(ASTNode node) compare:" + type.getName()); + // TODO: ���ƂŃ��\�b�h���s���ʂ����̂܂ܕԂ��悤�ɂ��� + boolean b = isCfrom(type); + if (b) return true; + else { + System.out.println("Cfrom�ɖ���!!! :" + node.toString()); + return false; + } + } + nowNode = nowNode.getParent(); + cnt++; + } + System.out.println("Cfrom�ɖ���!!! :" + node.toString()); + return false; + } @Override public boolean visit(VariableDeclarationStatement node) { + // �錾����Ă���N���X��CFrom�ɂ��邩���ׂ� + if (!isCfrom(node)) { + return super.visit(node); + } + String targetName = targetClass.getElementName(); String typeName = node.getType().toString(); if (typeName.equals(targetName)) { @@ -111,6 +149,11 @@ @Override public boolean visit(FieldDeclaration node) { + // �錾����Ă���N���X��CFrom�ɂ��邩���ׂ� + if (!isCfrom(node)) { + return super.visit(node); + } + String targetName = targetClass.getElementName(); String nodeName = node.getType().toString(); if (targetName.equals(nodeName)) { @@ -122,8 +165,11 @@ @Override public boolean visit(MethodInvocation node) { - // ���̂��������Ő錾���ꂽ�ϐ��ւ̃��\�b�h�Ăяo������Binding�����Ȃ��B - // ���l�ɁA���̃��V�[�o�̌^���������邱�Ƃ��ł��Ȃ��B + // �錾����Ă���N���X��CFrom�ɂ��邩���ׂ� + if (!isCfrom(node)) { + return super.visit(node); + } + IMethodBinding methodBinding = node.resolveMethodBinding(); ITypeBinding typeBinding = node.resolveTypeBinding(); if (methodBinding == null) { @@ -137,8 +183,8 @@ } // MethodDeclaration declaration = toASTNode(methodBinding); -// if (!isCfrom((IType) methodBinding.getDeclaringClass().getJavaElement())) { -// addRefactoringTask(declaration, new IntroduceReturnValueObject(node)); +// if (!isCfrom((IType) methodBinding.getDeclaringClass().getJavaElement()) && declaration != null) { +// addRefactoringTask(declaration, new IntroduceReturnValueObject(node, declaration, cu)); // } for (Object obj: node.arguments()) { @@ -191,9 +237,12 @@ } private boolean isCfrom(IType classType) { - String targetTypeName = targetClass.getElementName(); +// String targetTypeName = targetClass.getElementName(); + String targetTypeName = classType.getElementName(); + System.out.println("���ׂ���Class: " + targetTypeName); for (IType type: cFrom) { String typeName = type.getElementName(); + System.out.println("isCfrom(IType classType) compare: " + typeName); if (typeName.equals(targetTypeName)) { return true; } @@ -203,15 +252,22 @@ @Override public boolean visit(ReturnStatement node) { + // Cfrom�O�͖߂�l�I�u�W�F�N�g�̓����ACfrom�Ȃ�I�u�W�F�N�g���̂��̂̕ԋp��K�p + System.out.println("Return Statement: " + node.toString()); MethodDeclaration mDec = m(node); + IMethodBinding methodBinding = mDec.resolveBinding(); String returnTypeName = mDec.getReturnType2().toString(); String targetTypeName = targetClass.getElementName(); if (returnTypeName.equals(targetTypeName)) { - addRefactoringTask(mDec, new ReturnWholeObject(node, mDec, cu)); + if (!isCfrom((IType) methodBinding.getDeclaringClass().getJavaElement())) { + addRefactoringTask(mDec, new IntroduceReturnValueObject(node, mDec, cu)); + } + else { + addRefactoringTask(mDec, new ReturnWholeObject(node, mDec, cu)); + } } - return super.visit(node); } @@ -424,6 +480,10 @@ this.cFrom = cFrom; } + public void setAllClients(List clients) { + this.allClients = clients; + } + public void setTargetClass(IType targetClass) { this.targetClass = targetClass; } diff --git a/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/descriptors/DecoupleClassesDescriptor.java b/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/descriptors/DecoupleClassesDescriptor.java index ee270f7..85f6e9c 100644 --- a/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/descriptors/DecoupleClassesDescriptor.java +++ b/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/descriptors/DecoupleClassesDescriptor.java @@ -13,7 +13,8 @@ private String packageName = ""; private IType targetClass = null; private List clients = new ArrayList<>(); - + private List allClients = new ArrayList<>(); + public DecoupleClassesDescriptor() { super(DecoupleClassesRefactoring.ID); } @@ -50,16 +51,24 @@ return targetClass; } - public List getClients() { + public List getCFromClients() { return clients; } + + public List getClients() { + return allClients; + } - public void addClient(IType client) { + public void addCFromClient(IType client) { clients.add(client); } - public void removeClient(IType client) { + public void removeCFromClient(IType client) { clients.remove(client); } + + public void addClient(IType client) { + allClients.add(client); + } } diff --git a/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/refactoringApplication/IntroduceReturnValueObject.java b/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/refactoringApplication/IntroduceReturnValueObject.java index 2074de4..2c25790 100644 --- a/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/refactoringApplication/IntroduceReturnValueObject.java +++ b/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/refactoringApplication/IntroduceReturnValueObject.java @@ -1,16 +1,42 @@ package org.ntlab.refactoring.decouplingClasses.refactoringApplication; +import java.util.ArrayList; +import java.util.HashMap; + +import org.eclipse.core.filebuffers.FileBuffers; +import org.eclipse.core.filebuffers.ITextFileBuffer; +import org.eclipse.core.filebuffers.ITextFileBufferManager; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.jdt.core.IMethod; +import org.eclipse.jdt.core.IType; +import org.eclipse.jdt.core.dom.AST; import org.eclipse.jdt.core.dom.ASTNode; +import org.eclipse.jdt.core.dom.CompilationUnit; +import org.eclipse.jdt.core.dom.IMethodBinding; +import org.eclipse.jdt.core.dom.MethodDeclaration; +import org.eclipse.jdt.core.dom.MethodInvocation; +import org.eclipse.jdt.core.dom.Type; +import org.eclipse.jdt.core.dom.rewrite.ASTRewrite; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IDocument; import org.eclipse.ltk.core.refactoring.Change; import org.eclipse.ltk.core.refactoring.RefactoringStatus; +import org.eclipse.text.edits.MalformedTreeException; +import org.eclipse.text.edits.TextEdit; +import org.ntlab.refactoring.decouplingClasses.MyReturnStatementVisitorForReturnWholeObject; +import org.ntlab.refactoring.decouplingClasses.TargetOccurenceSearchEngine; public class IntroduceReturnValueObject extends PrimitiveRefactoring { - - public IntroduceReturnValueObject(ASTNode applicationPoint) { + MethodDeclaration methodDecl; + CompilationUnit cu; + + public IntroduceReturnValueObject(ASTNode applicationPoint, MethodDeclaration m, CompilationUnit cu) { super("Introduce Return Value Object", applicationPoint); + methodDecl = m; + this.cu = cu; } @Override @@ -28,6 +54,47 @@ @Override public Change perform(IProgressMonitor pm) throws CoreException { System.out.println("perform: " + getName()); + System.out.println("node: " + getNode().toString()); + System.out.println("return type: " + methodDecl.getReturnType2()); + + IPath path = cu.getJavaElement().getPath(); + ASTRewrite rewrite = ASTRewrite.create(cu.getAST()); + ASTNode node = getNode(); + AST ast = methodDecl.getAST(); + Type t = ast.newSimpleType(ast.newSimpleName("CNew")); + rewrite.set(methodDecl, MethodDeclaration.RETURN_TYPE2_PROPERTY, t, null); + + IMethodBinding methodBinding = methodDecl.resolveBinding(); + IMethod iMethod = (IMethod) methodBinding.getJavaElement(); + IType tt = iMethod.getDeclaringType(); + + TargetOccurenceSearchEngine searchEngine = new TargetOccurenceSearchEngine(); + HashMap> clients = searchEngine.searchMethodInvocationAsts(tt, iMethod); + + // return����Cnew(ctarget)�ƂȂ�悤rewrite��K�p + // �����Ɏ��� + + + try { + ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager(); + bufferManager.connect(path, null); + ITextFileBuffer textFileBuffer = bufferManager.getTextFileBuffer(path); + IDocument document = textFileBuffer.getDocument(); + TextEdit edit = rewrite.rewriteAST(document, null); + edit.apply(document); + textFileBuffer.commit(null /* ProgressMonitor */, true /* Overwrite */); + } catch (MalformedTreeException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (BadLocationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (CoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return null; } diff --git a/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/refactoringApplication/ReturnWholeObject.java b/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/refactoringApplication/ReturnWholeObject.java index b2dc54f..f0c1363 100644 --- a/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/refactoringApplication/ReturnWholeObject.java +++ b/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/refactoringApplication/ReturnWholeObject.java @@ -72,95 +72,93 @@ @Override public Change perform(IProgressMonitor pm) throws CoreException { - System.out.println("\n-----ReturnWholeObject ���t�@�N�^�����O�J�n-----"); + // DOTO: �ق����t�@�N�^�����O�̎����p�Ɉꎞ�I�ɓ�����~�߂邽�߂̃R�����g�̉��� System.out.println("perform: " + getName()); System.out.println("node: " + getNode().toString()); System.out.println("return type: " + methodDecl.getReturnType2()); - IPath path = cu.getJavaElement().getPath(); -// Document document = new Document(cu.toString()); - ASTRewrite rewrite = ASTRewrite.create(cu.getAST()); -// cu.recordModifications(); - // results.add(ast.newSimpleType(ast.newSimpleName(typeBinding.getName()))); // Type�ݒ�T���v�� - // fieldDeclaration.setType(results.get(0)); - ASTNode node = getNode(); - AST ast = methodDecl.getAST(); - - Type t = ast.newSimpleType(ast.newSimpleName("CNew")); - rewrite.set(methodDecl, MethodDeclaration.RETURN_TYPE2_PROPERTY, t, null); - - IMethodBinding methodBinding = methodDecl.resolveBinding(); - IMethod iMethod = (IMethod) methodBinding.getJavaElement(); - IType tt = iMethod.getDeclaringType(); - - TargetOccurenceSearchEngine searchEngine = new TargetOccurenceSearchEngine(); - HashMap> clients = searchEngine.searchMethodInvocationAsts(tt, iMethod); - -// Type t = ast.newSimpleType(ast.newSimpleName("String")); // Type�ݒ�T���v�� -// methodDecl.setReturnType2(t); - - MyReturnStatementVisitorForReturnWholeObject visitor = new MyReturnStatementVisitorForReturnWholeObject(rewrite, getNode()); - // return�̏C�� - cu.accept(visitor); - ASTNode removedInvocation = visitor.getRemovedInvocation(); - -// applyRewrite(path, rewrite); - try { - ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager(); - bufferManager.connect(path, null); - ITextFileBuffer textFileBuffer = bufferManager.getTextFileBuffer(path); - IDocument document = textFileBuffer.getDocument(); - TextEdit edit = rewrite.rewriteAST(document, null); - edit.apply(document); - textFileBuffer.commit(null /* ProgressMonitor */, true /* Overwrite */); - } catch (MalformedTreeException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (BadLocationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - - // CompilationUnit���Ƃ�getCTarget�̕t�^�����Ă��� - for(CompilationUnit cu : clients.keySet()) { - IPath cupath = cu.getJavaElement().getPath(); - ArrayList nodes = clients.get(cu); - ASTRewrite rewrite2 = ASTRewrite.create(cu.getAST()); - for(MethodInvocation invocation : nodes) { - MethodInvocation copiedNode = (MethodInvocation) ASTNode.copySubtree(invocation.getAST(), invocation); -// MethodInvocation copiedNode = (MethodInvocation)rewrite2.createCopyTarget(invocation); - AST ast2 = copiedNode.getAST(); - MethodInvocation newInvocation = ast2.newMethodInvocation(); - newInvocation.setExpression(copiedNode); - newInvocation.setName(ast2.newSimpleName(removedInvocation.toString())); - rewrite2.replace(invocation, newInvocation, null); - } -// applyRewrite(cupath, rewrite2); - try { - ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager(); - bufferManager.connect(cupath, null); - ITextFileBuffer textFileBuffer = bufferManager.getTextFileBuffer(cupath); - IDocument document = textFileBuffer.getDocument(); - TextEdit edit = rewrite2.rewriteAST(document, null); - edit.apply(document); - textFileBuffer.commit(null /* ProgressMonitor */, true /* Overwrite */); - } catch (MalformedTreeException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (BadLocationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (CoreException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } +// IPath path = cu.getJavaElement().getPath(); +//// Document document = new Document(cu.toString()); +// ASTRewrite rewrite = ASTRewrite.create(cu.getAST()); +//// cu.recordModifications(); +// // results.add(ast.newSimpleType(ast.newSimpleName(typeBinding.getName()))); // Type�ݒ�T���v�� +// // fieldDeclaration.setType(results.get(0)); +// ASTNode node = getNode(); +// AST ast = methodDecl.getAST(); +// +// Type t = ast.newSimpleType(ast.newSimpleName("CNew")); +// rewrite.set(methodDecl, MethodDeclaration.RETURN_TYPE2_PROPERTY, t, null); +// +// IMethodBinding methodBinding = methodDecl.resolveBinding(); +// IMethod iMethod = (IMethod) methodBinding.getJavaElement(); +// IType tt = iMethod.getDeclaringType(); +// +// TargetOccurenceSearchEngine searchEngine = new TargetOccurenceSearchEngine(); +// HashMap> clients = searchEngine.searchMethodInvocationAsts(tt, iMethod); +// +//// Type t = ast.newSimpleType(ast.newSimpleName("String")); // Type�ݒ�T���v�� +//// methodDecl.setReturnType2(t); +// +// // return������getCTarget����菜���Ė߂�l�̕���CNew�ɕύX +// MyReturnStatementVisitorForReturnWholeObject visitor = new MyReturnStatementVisitorForReturnWholeObject(rewrite, getNode()); +// cu.accept(visitor); +// ASTNode removedInvocation = visitor.getRemovedInvocation(); +// try { +// ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager(); +// bufferManager.connect(path, null); +// ITextFileBuffer textFileBuffer = bufferManager.getTextFileBuffer(path); +// IDocument document = textFileBuffer.getDocument(); +// TextEdit edit = rewrite.rewriteAST(document, null); +// edit.apply(document); +// textFileBuffer.commit(null /* ProgressMonitor */, true /* Overwrite */); +// } catch (MalformedTreeException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } catch (BadLocationException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } catch (CoreException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// +// +// // CompilationUnit���Ƃ�getCTarget�̕t�^�����Ă��� +// for(CompilationUnit cu : clients.keySet()) { +// IPath cupath = cu.getJavaElement().getPath(); +// ArrayList nodes = clients.get(cu); +// ASTRewrite rewrite2 = ASTRewrite.create(cu.getAST()); +// for(MethodInvocation invocation : nodes) { +// MethodInvocation copiedNode = (MethodInvocation) ASTNode.copySubtree(invocation.getAST(), invocation); +// AST ast2 = copiedNode.getAST(); +// // getCTarget�̕t�^ +// MethodInvocation newInvocation = ast2.newMethodInvocation(); +// newInvocation.setExpression(copiedNode); +// newInvocation.setName(ast2.newSimpleName(removedInvocation.toString())); +// rewrite2.replace(invocation, newInvocation, null); +// } +// try { +// ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager(); +// bufferManager.connect(cupath, null); +// ITextFileBuffer textFileBuffer = bufferManager.getTextFileBuffer(cupath); +// IDocument document = textFileBuffer.getDocument(); +// TextEdit edit = rewrite2.rewriteAST(document, null); +// edit.apply(document); +// textFileBuffer.commit(null /* ProgressMonitor */, true /* Overwrite */); +// } catch (MalformedTreeException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } catch (BadLocationException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } catch (CoreException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } +// } return null; } + // UI�X�V����̃X���b�h�]�X�G���[�BDisplay�����ꂱ�ꂵ���炢���炵�����ǂ��܂��s�����B // public boolean applyRewrite(final IPath path, final ASTRewrite rewrite) { // try { // ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager(); diff --git a/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/ui/DecoupleClassesWizard.java b/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/ui/DecoupleClassesWizard.java index ef1ee7c..4b9abdd 100644 --- a/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/ui/DecoupleClassesWizard.java +++ b/org.ntlab.refactoring.decouplingClasses/src/org/ntlab/refactoring/decouplingClasses/ui/DecoupleClassesWizard.java @@ -187,9 +187,9 @@ IType type = (IType) event.getElement(); if (event.getChecked()) { - descriptor.addClient(type); + descriptor.addCFromClient(type); } else { - descriptor.removeClient(type); + descriptor.removeCFromClient(type); } } }); @@ -209,6 +209,7 @@ for (IJavaElement client: clients) { tableViewer.add(client); tableViewer.setChecked(client, true); + descriptor.addCFromClient((IType) client); descriptor.addClient((IType) client); } }