public IType findType(String builderClassName) throws JavaModelException { if (fLastValidBuilderType != null && builderClassName.equals(fLastValidBuilderType.getFullyQualifiedParameterizedName())) { return fLastValidBuilderType; } return fJavaProject.findType(builderClassName, (IProgressMonitor)null); }
public IType findType(String builderClassName) throws JavaModelException { if (fLastValidBuilderType != null && builderClassName.equals(fLastValidBuilderType.getFullyQualifiedParameterizedName())) { return fLastValidBuilderType; } return fJavaProject.findType(builderClassName, (IProgressMonitor)null); }
private String createDummyType(String name) throws JavaModelException { StringBuffer buffer= new StringBuffer(); buffer.append("abstract class "); //$NON-NLS-1$ buffer.append(name); if (fSuperType.isInterface()) buffer.append(" implements "); //$NON-NLS-1$ else buffer.append(" extends "); //$NON-NLS-1$ if (fDeclarationSignature != null) buffer.append(Signature.toString(fDeclarationSignature)); else buffer.append(fSuperType.getFullyQualifiedParameterizedName()); buffer.append(" {"); //$NON-NLS-1$ buffer.append("\n"); // Using newline is ok since source is used in dummy compilation unit //$NON-NLS-1$ buffer.append("}"); //$NON-NLS-1$ return buffer.toString(); }
private String createDummyType(String name) throws JavaModelException { StringBuilder buffer= new StringBuilder(); buffer.append("abstract class "); //$NON-NLS-1$ buffer.append(name); if (fSuperType.isInterface()) buffer.append(" implements "); //$NON-NLS-1$ else buffer.append(" extends "); //$NON-NLS-1$ if (fDeclarationSignature != null) buffer.append(Signature.toString(fDeclarationSignature)); else buffer.append(fSuperType.getFullyQualifiedParameterizedName()); buffer.append(" {"); //$NON-NLS-1$ buffer.append("\n"); // Using newline is ok since source is used in dummy compilation unit //$NON-NLS-1$ buffer.append("}"); //$NON-NLS-1$ return buffer.toString(); }
private String createDummyType(String name) throws JavaModelException { StringBuffer buffer = new StringBuffer(); buffer.append("abstract class "); //$NON-NLS-1$ buffer.append(name); if (fSuperType.isInterface()) { buffer.append(" implements "); //$NON-NLS-1$ } else { buffer.append(" extends "); //$NON-NLS-1$ } if (fDeclarationSignature != null) { buffer.append(Signature.toString(fDeclarationSignature)); } else { buffer.append(fSuperType.getFullyQualifiedParameterizedName()); } buffer.append(" {"); //$NON-NLS-1$ buffer.append("\n"); //$NON-NLS-1$ buffer.append("}"); //$NON-NLS-1$ return buffer.toString(); }
private int createDummy(String name, StringBuffer buffer) throws JavaModelException { String lineDelim= "\n"; // Using newline is ok since source is used in dummy compilation unit //$NON-NLS-1$ buffer.append("class "); //$NON-NLS-1$ buffer.append(name); if (fSuperType.isInterface()) buffer.append(" implements "); //$NON-NLS-1$ else buffer.append(" extends "); //$NON-NLS-1$ if (fDeclarationSignature != null) buffer.append(Signature.toString(fDeclarationSignature)); else buffer.append(fSuperType.getFullyQualifiedParameterizedName()); int start= buffer.length(); buffer.append("{"); //$NON-NLS-1$ buffer.append(lineDelim); buffer.append(lineDelim); buffer.append("}"); //$NON-NLS-1$ return start; }
private void browseForBuilderClass() { try { IJavaSearchScope scope= SearchEngine.createJavaSearchScope(new IJavaElement[] { getType().getJavaProject() }); SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), PlatformUI.getWorkbench().getProgressService(), scope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, "*ToString", fExtension); //$NON-NLS-1$ dialog.setTitle(JavaUIMessages.GenerateToStringDialog_customBuilderConfig_classSelection_windowTitle); dialog.setMessage(JavaUIMessages.GenerateToStringDialog_customBuilderConfig_classSelection_message); dialog.open(); if (dialog.getReturnCode() == OK) { IType type= (IType)dialog.getResult()[0]; fBuilderClassName.setText(type.getFullyQualifiedParameterizedName()); List<String> suggestions= fValidator.getAppendMethodSuggestions(type); if (!suggestions.contains(fAppendMethodName.getText())) fAppendMethodName.setText(suggestions.get(0)); suggestions= fValidator.getResultMethodSuggestions(type); if (!suggestions.contains(fResultMethodName.getText())) fResultMethodName.setText(suggestions.get(0)); } } catch (JavaModelException e) { JavaPlugin.log(e); } } }
private void browseForBuilderClass() { try { IJavaSearchScope scope= SearchEngine.createJavaSearchScope(new IJavaElement[] { getType().getJavaProject() }); SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), PlatformUI.getWorkbench().getProgressService(), scope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, "*ToString", fExtension); //$NON-NLS-1$ dialog.setTitle(JavaUIMessages.GenerateToStringDialog_customBuilderConfig_classSelection_windowTitle); dialog.setMessage(JavaUIMessages.GenerateToStringDialog_customBuilderConfig_classSelection_message); dialog.open(); if (dialog.getReturnCode() == OK) { IType type= (IType)dialog.getResult()[0]; fBuilderClassName.setText(type.getFullyQualifiedParameterizedName()); List<String> suggestions= fValidator.getAppendMethodSuggestions(type); if (!suggestions.contains(fAppendMethodName.getText())) fAppendMethodName.setText(suggestions.get(0)); suggestions= fValidator.getResultMethodSuggestions(type); if (!suggestions.contains(fResultMethodName.getText())) fResultMethodName.setText(suggestions.get(0)); } } catch (JavaModelException e) { JavaPlugin.log(e); } } }