mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
4a97e80fb5
commit
0823fc1277
2 changed files with 9 additions and 18 deletions
|
@ -20,23 +20,19 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTQualifiedName;
|
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTQualifiedName;
|
||||||
|
|
||||||
|
|
||||||
public class GetterSetterInsertEditProvider implements Comparable<GetterSetterInsertEditProvider>{
|
public class GetterSetterInsertEditProvider implements Comparable<GetterSetterInsertEditProvider>{
|
||||||
public enum Type{
|
public enum Type {
|
||||||
getter,
|
getter,
|
||||||
setter;
|
setter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private IASTSimpleDeclaration functionDeclaration;
|
private IASTSimpleDeclaration functionDeclaration;
|
||||||
private Type type;
|
private Type type;
|
||||||
private String name;
|
private String name;
|
||||||
private IASTSimpleDeclaration fieldDeclaration;
|
private IASTSimpleDeclaration fieldDeclaration;
|
||||||
|
|
||||||
|
public GetterSetterInsertEditProvider(String name, IASTSimpleDeclaration fieldDeclaration, Type type) {
|
||||||
public GetterSetterInsertEditProvider(String name, IASTSimpleDeclaration fieldDeclaration, Type type){
|
switch (type) {
|
||||||
switch(type) {
|
|
||||||
case getter:
|
case getter:
|
||||||
|
|
||||||
this.functionDeclaration = FunctionFactory.createGetterDeclaration(name, fieldDeclaration);
|
this.functionDeclaration = FunctionFactory.createGetterDeclaration(name, fieldDeclaration);
|
||||||
|
@ -52,7 +48,7 @@ public class GetterSetterInsertEditProvider implements Comparable<GetterSetterIn
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(){
|
public String toString() {
|
||||||
IASTDeclarator declarator = functionDeclaration.getDeclarators()[0];
|
IASTDeclarator declarator = functionDeclaration.getDeclarators()[0];
|
||||||
while (declarator.getNestedDeclarator() != null) {
|
while (declarator.getNestedDeclarator() != null) {
|
||||||
declarator = declarator.getNestedDeclarator();
|
declarator = declarator.getNestedDeclarator();
|
||||||
|
@ -65,11 +61,11 @@ public class GetterSetterInsertEditProvider implements Comparable<GetterSetterIn
|
||||||
ICPPASTQualifiedName qname;
|
ICPPASTQualifiedName qname;
|
||||||
if(qualifedName) {
|
if(qualifedName) {
|
||||||
qname = getClassname();
|
qname = getClassname();
|
||||||
}else {
|
} else {
|
||||||
qname = null;
|
qname = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(type) {
|
switch (type) {
|
||||||
case getter:
|
case getter:
|
||||||
definition = FunctionFactory.createGetterDefinition(name, fieldDeclaration, qname);
|
definition = FunctionFactory.createGetterDefinition(name, fieldDeclaration, qname);
|
||||||
break;
|
break;
|
||||||
|
@ -103,6 +99,4 @@ public class GetterSetterInsertEditProvider implements Comparable<GetterSetterIn
|
||||||
public int compareTo(GetterSetterInsertEditProvider o) {
|
public int compareTo(GetterSetterInsertEditProvider o) {
|
||||||
return toString().compareTo(o.toString());
|
return toString().compareTo(o.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Institute for Software (IFS)- initial API and implementation
|
* Institute for Software (IFS)- initial API and implementation
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.refactoring.gettersandsetters;
|
package org.eclipse.cdt.internal.ui.refactoring.gettersandsetters;
|
||||||
|
|
||||||
|
@ -20,16 +20,13 @@ import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Emanuel Graf IFS
|
* @author Emanuel Graf IFS
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class GetterSetterLabelProvider extends LabelProvider {
|
public class GetterSetterLabelProvider extends LabelProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Image getImage(Object element) {
|
public Image getImage(Object element) {
|
||||||
if(element != null) {
|
if (element instanceof GetterSetterInsertEditProvider) {
|
||||||
if (element instanceof GetterSetterInsertEditProvider) {
|
return CElementImageProvider.getMethodImageDescriptor(ASTAccessVisibility.PUBLIC).createImage();
|
||||||
return CElementImageProvider.getMethodImageDescriptor(ASTAccessVisibility.PUBLIC).createImage();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue