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;
|
||||
|
||||
|
||||
public class GetterSetterInsertEditProvider implements Comparable<GetterSetterInsertEditProvider>{
|
||||
public enum Type{
|
||||
public enum Type {
|
||||
getter,
|
||||
setter;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private IASTSimpleDeclaration functionDeclaration;
|
||||
private Type type;
|
||||
private String name;
|
||||
private IASTSimpleDeclaration fieldDeclaration;
|
||||
|
||||
|
||||
public GetterSetterInsertEditProvider(String name, IASTSimpleDeclaration fieldDeclaration, Type type){
|
||||
switch(type) {
|
||||
public GetterSetterInsertEditProvider(String name, IASTSimpleDeclaration fieldDeclaration, Type type) {
|
||||
switch (type) {
|
||||
case getter:
|
||||
|
||||
this.functionDeclaration = FunctionFactory.createGetterDeclaration(name, fieldDeclaration);
|
||||
|
@ -52,7 +48,7 @@ public class GetterSetterInsertEditProvider implements Comparable<GetterSetterIn
|
|||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
public String toString() {
|
||||
IASTDeclarator declarator = functionDeclaration.getDeclarators()[0];
|
||||
while (declarator.getNestedDeclarator() != null) {
|
||||
declarator = declarator.getNestedDeclarator();
|
||||
|
@ -65,11 +61,11 @@ public class GetterSetterInsertEditProvider implements Comparable<GetterSetterIn
|
|||
ICPPASTQualifiedName qname;
|
||||
if(qualifedName) {
|
||||
qname = getClassname();
|
||||
}else {
|
||||
} else {
|
||||
qname = null;
|
||||
}
|
||||
|
||||
switch(type) {
|
||||
switch (type) {
|
||||
case getter:
|
||||
definition = FunctionFactory.createGetterDefinition(name, fieldDeclaration, qname);
|
||||
break;
|
||||
|
@ -103,6 +99,4 @@ public class GetterSetterInsertEditProvider implements Comparable<GetterSetterIn
|
|||
public int compareTo(GetterSetterInsertEditProvider o) {
|
||||
return toString().compareTo(o.toString());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* 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;
|
||||
|
||||
|
@ -20,16 +20,13 @@ import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider;
|
|||
|
||||
/**
|
||||
* @author Emanuel Graf IFS
|
||||
*
|
||||
*/
|
||||
public class GetterSetterLabelProvider extends LabelProvider {
|
||||
|
||||
@Override
|
||||
public Image getImage(Object element) {
|
||||
if(element != null) {
|
||||
if (element instanceof GetterSetterInsertEditProvider) {
|
||||
return CElementImageProvider.getMethodImageDescriptor(ASTAccessVisibility.PUBLIC).createImage();
|
||||
}
|
||||
if (element instanceof GetterSetterInsertEditProvider) {
|
||||
return CElementImageProvider.getMethodImageDescriptor(ASTAccessVisibility.PUBLIC).createImage();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue