Java Code Examples for org.eclipse.ltk.core.refactoring.RefactoringStatus#addFatalError()
The following examples show how to use
org.eclipse.ltk.core.refactoring.RefactoringStatus#addFatalError() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RenameMethodProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public final RefactoringStatus checkNewElementName(String newName) { Assert.isNotNull(newName, "new name"); //$NON-NLS-1$ RefactoringStatus status= Checks.checkName(newName, JavaConventionsUtil.validateMethodName(newName, fMethod)); if (status.isOK() && !Checks.startsWithLowerCase(newName)) status= RefactoringStatus.createWarningStatus(fIsComposite ? Messages.format(RefactoringCoreMessages.Checks_method_names_lowercase2, new String[] { BasicElementLabels.getJavaElementName(newName), getDeclaringTypeLabel()}) : RefactoringCoreMessages.Checks_method_names_lowercase); if (Checks.isAlreadyNamed(fMethod, newName)) status.addFatalError(fIsComposite ? Messages.format(RefactoringCoreMessages.RenameMethodRefactoring_same_name2, new String[] { BasicElementLabels.getJavaElementName(newName), getDeclaringTypeLabel() } ) : RefactoringCoreMessages.RenameMethodRefactoring_same_name, JavaStatusContext.create(fMethod)); return status; }
Example 2
Source File: NewFeatureNameUtil.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
public void checkNewFeatureName(String newFeatureName, boolean isLookupInScope, RefactoringStatus status) { if (isEmpty(newFeatureName)) { status.addFatalError("Choose a name"); return; } try { Object value = valueConverterService.toValue(newFeatureName, "ValidID", null); valueConverterService.toString(value, "ValidID"); } catch(ValueConverterException exc) { status.addFatalError(exc.getMessage()); } if (Character.isUpperCase(newFeatureName.charAt(0))) status.addError("Discouraged name '" + newFeatureName + "'. Name should start with a lowercase letter. "); if (isKeyword(newFeatureName)) status.addFatalError("'" + newFeatureName + "' is keyword."); @SuppressWarnings("restriction") Class<?> asPrimitive = org.eclipse.xtext.common.types.access.impl.Primitives.forName(newFeatureName); if(asPrimitive != null) status.addFatalError("'" + newFeatureName + "' is reserved."); if (isLookupInScope && featureCallScope != null && isAlreadyDefined(newFeatureName)) status.addError("The name '" + newFeatureName + "' is already defined in this scope."); }
Example 3
Source File: XtendRenameStrategy.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Override public RefactoringStatus validateNewName(String newName) { if (grammarAccess.getFunctionIDRule().getName().equals(nameRuleName)) { if (operatorMapping.getOperator(QualifiedName.create(newName)) != null) { RefactoringStatus status = new RefactoringStatus(); if(nameRuleName != null) { try { String value = getNameAsValue(newName, grammarAccess.getValidIDRule().getName()); String text = getNameAsText(value, grammarAccess.getValidIDRule().getName()); if(!equal(text, newName)) { status.addError("Illegal name: '" + newName + "'. Consider using '" + text + "' instead."); } } catch(ValueConverterException vce) { status.addFatalError("Illegal name: " + notNull(vce.getMessage())); } } return status; } } return super.validateNewName(newName); }
Example 4
Source File: MoveStaticMembersProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException { try { pm.beginTask(RefactoringCoreMessages.MoveMembersRefactoring_checking, 1); RefactoringStatus result= new RefactoringStatus(); result.merge(checkDeclaringType()); pm.worked(1); if (result.hasFatalError()) return result; fSource= new CompilationUnitRewrite(fMembersToMove[0].getCompilationUnit()); fSourceBinding= (ITypeBinding)((SimpleName)NodeFinder.perform(fSource.getRoot(), fMembersToMove[0].getDeclaringType().getNameRange())).resolveBinding(); fMemberBindings= getMemberBindings(); if (fSourceBinding == null || hasUnresolvedMemberBinding()) { result.addFatalError(Messages.format( RefactoringCoreMessages.MoveMembersRefactoring_compile_errors, BasicElementLabels.getFileName(fSource.getCu()))); } fMemberDeclarations= getASTMembers(result); return result; } finally { pm.done(); } }
Example 5
Source File: RenameTypeProcessor.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
/** * If suffix matching is enabled, the refactoring may suggest two fields to have * the same name which reside in the same type. Same thing may also happen if * the user makes poor choices for the field names. * * Consider: FooBarThing fFooBarThing; FooBarThing fBarThing; * * Rename "FooBarThing" to "DifferentHunk". Suggestion for both fields is * "fDifferentHunk" (and rightly so). * * @param currentField * field * @param newName * new name * @return status */ private RefactoringStatus checkForConflictingRename(IField currentField, String newName) { RefactoringStatus status = new RefactoringStatus(); for (Iterator<IJavaElement> iter = fFinalSimilarElementToName.keySet().iterator(); iter.hasNext();) { IJavaElement element = iter.next(); if (element instanceof IField) { IField alreadyRegisteredField = (IField) element; String alreadyRegisteredFieldName = fFinalSimilarElementToName.get(element); if (alreadyRegisteredFieldName.equals(newName)) { if (alreadyRegisteredField.getDeclaringType().equals(currentField.getDeclaringType())) { String message = Messages.format(RefactoringCoreMessages.RenameTypeProcessor_cannot_rename_fields_same_new_name, new String[] { BasicElementLabels.getJavaElementName(alreadyRegisteredField.getElementName()), BasicElementLabels.getJavaElementName(currentField.getElementName()), BasicElementLabels.getJavaElementName(alreadyRegisteredField.getDeclaringType().getFullyQualifiedName('.')), BasicElementLabels.getJavaElementName(newName) }); status.addFatalError(message); return status; } } } } return status; }
Example 6
Source File: RenameTypeProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Checks whether one of the given methods, which will all be renamed to * "newName", shares a type with another already registered method which is * renamed to the same new name and shares the same parameters. * @param methods methods to check * @param newName the new name * @return status * * @see #checkForConflictingRename(IField, String) */ private RefactoringStatus checkForConflictingRename(IMethod[] methods, String newName) { RefactoringStatus status= new RefactoringStatus(); for (Iterator<IJavaElement> iter= fFinalSimilarElementToName.keySet().iterator(); iter.hasNext();) { IJavaElement element= iter.next(); if (element instanceof IMethod) { IMethod alreadyRegisteredMethod= (IMethod) element; String alreadyRegisteredMethodName= fFinalSimilarElementToName.get(element); for (int i= 0; i < methods.length; i++) { IMethod method2= methods[i]; if ( (alreadyRegisteredMethodName.equals(newName)) && (method2.getDeclaringType().equals(alreadyRegisteredMethod.getDeclaringType())) && (sameParams(alreadyRegisteredMethod, method2))) { String message= Messages.format(RefactoringCoreMessages.RenameTypeProcessor_cannot_rename_methods_same_new_name, new String[] { BasicElementLabels.getJavaElementName(alreadyRegisteredMethod.getElementName()), BasicElementLabels.getJavaElementName(method2.getElementName()), BasicElementLabels.getJavaElementName(alreadyRegisteredMethod.getDeclaringType().getFullyQualifiedName('.')), BasicElementLabels.getJavaElementName(newName) }); status.addFatalError(message); return status; } } } } return status; }
Example 7
Source File: Checks.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * From SearchResultGroup[] passed as the parameter * this method removes all those that correspond to a non-parsable ICompilationUnit * and returns it as a result. * @param grouped the array of search result groups from which non parsable compilation * units are to be removed. * @param status a refactoring status to collect errors and problems * @return the array of search result groups * @throws JavaModelException */ public static SearchResultGroup[] excludeCompilationUnits(SearchResultGroup[] grouped, RefactoringStatus status) throws JavaModelException{ List<SearchResultGroup> result= new ArrayList<SearchResultGroup>(); boolean wasEmpty= grouped.length == 0; for (int i= 0; i < grouped.length; i++){ IResource resource= grouped[i].getResource(); IJavaElement element= JavaCore.create(resource); if (! (element instanceof ICompilationUnit)) continue; //XXX this is a workaround for a jcore feature that shows errors in cus only when you get the original element ICompilationUnit cu= (ICompilationUnit)JavaCore.create(resource); if (! cu.isStructureKnown()){ status.addError(Messages.format(RefactoringCoreMessages.Checks_cannot_be_parsed, BasicElementLabels.getPathLabel(cu.getPath(), false))); continue; //removed, go to the next one } result.add(grouped[i]); } if ((!wasEmpty) && result.isEmpty()) status.addFatalError(RefactoringCoreMessages.Checks_all_excluded); return result.toArray(new SearchResultGroup[result.size()]); }
Example 8
Source File: ExtractMethodAnalyzer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void checkExpression(RefactoringStatus status) { ASTNode[] nodes= getSelectedNodes(); if (nodes != null && nodes.length == 1) { ASTNode node= nodes[0]; if (node instanceof Type) { status.addFatalError(RefactoringCoreMessages.ExtractMethodAnalyzer_cannot_extract_type_reference, JavaStatusContext.create(fCUnit, node)); } else if (node.getLocationInParent() == SwitchCase.EXPRESSION_PROPERTY) { status.addFatalError(RefactoringCoreMessages.ExtractMethodAnalyzer_cannot_extract_switch_case, JavaStatusContext.create(fCUnit, node)); } else if (node instanceof Annotation || ASTNodes.getParent(node, Annotation.class) != null) { status.addFatalError(RefactoringCoreMessages.ExtractMethodAnalyzer_cannot_extract_from_annotation, JavaStatusContext.create(fCUnit, node)); } } }
Example 9
Source File: RenameSourceFolderChange.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private static RefactoringStatus checkIfModifiable(IPackageFragmentRoot root) throws CoreException { RefactoringStatus result= new RefactoringStatus(); if (root == null) { result.addFatalError(RefactoringCoreMessages.DynamicValidationStateChange_workspace_changed); return result; } if (!root.exists()) { result.addFatalError(Messages.format(RefactoringCoreMessages.Change_does_not_exist, getRootLabel(root))); return result; } if (result.hasFatalError()) return result; if (root.isArchive()) { result.addFatalError(Messages.format(RefactoringCoreMessages.RenameSourceFolderChange_rename_archive, getRootLabel(root))); return result; } if (root.isExternal()) { result.addFatalError(Messages.format(RefactoringCoreMessages.RenameSourceFolderChange_rename_external, getRootLabel(root))); return result; } IResource correspondingResource= root.getCorrespondingResource(); if (correspondingResource == null || !correspondingResource.exists()) { result.addFatalError(Messages.format(RefactoringCoreMessages.RenameSourceFolderChange_error_underlying_resource_not_existing, getRootLabel(root))); return result; } if (correspondingResource.isLinked()) { result.addFatalError(Messages.format(RefactoringCoreMessages.RenameSourceFolderChange_rename_linked, getRootLabel(root))); return result; } return result; }
Example 10
Source File: InlineMethodRefactoring.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private static SourceProvider resolveSourceProvider(RefactoringStatus status, ITypeRoot typeRoot, ASTNode invocation) { CompilationUnit root= (CompilationUnit)invocation.getRoot(); IMethodBinding methodBinding= Invocations.resolveBinding(invocation); if (methodBinding == null) { status.addFatalError(RefactoringCoreMessages.InlineMethodRefactoring_error_noMethodDeclaration); return null; } MethodDeclaration declaration= (MethodDeclaration)root.findDeclaringNode(methodBinding); if (declaration != null) { return new SourceProvider(typeRoot, declaration); } IMethod method= (IMethod)methodBinding.getJavaElement(); if (method != null) { CompilationUnit methodDeclarationAstRoot; ICompilationUnit methodCu= method.getCompilationUnit(); if (methodCu != null) { methodDeclarationAstRoot= new RefactoringASTParser(ASTProvider.SHARED_AST_LEVEL).parse(methodCu, true); } else { IClassFile classFile= method.getClassFile(); if (! JavaElementUtil.isSourceAvailable(classFile)) { String methodLabel= JavaElementLabels.getTextLabel(method, JavaElementLabels.M_FULLY_QUALIFIED | JavaElementLabels.M_PARAMETER_TYPES); status.addFatalError(Messages.format(RefactoringCoreMessages.InlineMethodRefactoring_error_classFile, methodLabel)); return null; } methodDeclarationAstRoot= new RefactoringASTParser(ASTProvider.SHARED_AST_LEVEL).parse(classFile, true); } ASTNode node= methodDeclarationAstRoot.findDeclaringNode(methodBinding.getMethodDeclaration().getKey()); if (node instanceof MethodDeclaration) { return new SourceProvider(methodDeclarationAstRoot.getTypeRoot(), (MethodDeclaration) node); } } status.addFatalError(RefactoringCoreMessages.InlineMethodRefactoring_error_noMethodDeclaration); return null; }
Example 11
Source File: CodeAnalyzer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override protected final void checkSelectedNodes() { super.checkSelectedNodes(); RefactoringStatus status= getStatus(); if (status.hasFatalError()) return; ASTNode node= getFirstSelectedNode(); if (node instanceof ArrayInitializer) { status.addFatalError(RefactoringCoreMessages.CodeAnalyzer_array_initializer, JavaStatusContext.create(fCUnit, node)); } }
Example 12
Source File: IntroduceIndirectionRefactoring.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private RefactoringStatus findCommonParent(ITypeBinding typeBinding) { RefactoringStatus status= new RefactoringStatus(); ITypeBinding highest= fIntermediaryFirstParameterType; ITypeBinding current= typeBinding; if (current.equals(highest) || Bindings.isSuperType(highest, current)) // current is the same as highest or highest is already a supertype of current in the same hierarchy => no change return status; // find lowest common supertype with the method // search in bottom-up order ITypeBinding[] currentAndSupers= getTypeAndAllSuperTypes(current); ITypeBinding[] highestAndSupers= getTypeAndAllSuperTypes(highest); ITypeBinding foundBinding= null; for (int i1= 0; i1 < currentAndSupers.length; i1++) { for (int i2= 0; i2 < highestAndSupers.length; i2++) { if (highestAndSupers[i2].isEqualTo(currentAndSupers[i1]) && (Bindings.findMethodInHierarchy(highestAndSupers[i2], fTargetMethodBinding.getName(), fTargetMethodBinding.getParameterTypes()) != null)) { foundBinding= highestAndSupers[i2]; break; } } if (foundBinding != null) break; } if (foundBinding != null) { fIntermediaryFirstParameterType= foundBinding; } else { String type1= BasicElementLabels.getJavaElementName(fIntermediaryFirstParameterType.getQualifiedName()); String type2= BasicElementLabels.getJavaElementName(current.getQualifiedName()); status.addFatalError(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_open_hierarchy_error, new String[] { type1, type2 })); } return status; }
Example 13
Source File: ExtractMethodAnalyzer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private RefactoringStatus analyzeSelection(RefactoringStatus status) { fInputFlowContext= new FlowContext(0, fMaxVariableId + 1); fInputFlowContext.setConsiderAccessMode(true); fInputFlowContext.setComputeMode(FlowContext.ARGUMENTS); InOutFlowAnalyzer flowAnalyzer= new InOutFlowAnalyzer(fInputFlowContext); fInputFlowInfo= flowAnalyzer.perform(getSelectedNodes()); if (fInputFlowInfo.branches()) { String canHandleBranchesProblem= canHandleBranches(); if (canHandleBranchesProblem != null) { status.addFatalError(canHandleBranchesProblem, JavaStatusContext.create(fCUnit, getSelection())); fReturnKind= ERROR; return status; } } if (fInputFlowInfo.isValueReturn()) { fReturnKind= RETURN_STATEMENT_VALUE; } else if (fInputFlowInfo.isVoidReturn() || (fInputFlowInfo.isPartialReturn() && isVoidMethod() && isLastStatementSelected())) { fReturnKind= RETURN_STATEMENT_VOID; } else if (fInputFlowInfo.isNoReturn() || fInputFlowInfo.isThrow() || fInputFlowInfo.isUndefined()) { fReturnKind= NO; } if (fReturnKind == UNDEFINED) { status.addError(RefactoringCoreMessages.FlowAnalyzer_execution_flow, JavaStatusContext.create(fCUnit, getSelection())); fReturnKind= NO; } computeInput(); computeExceptions(); computeOutput(status); if (status.hasFatalError()) return status; adjustArgumentsAndMethodLocals(); compressArrays(); return status; }
Example 14
Source File: ExtractMethodInputPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private RefactoringStatus validateParameters() { RefactoringStatus result= new RefactoringStatus(); List<ParameterInfo> parameters= fRefactoring.getParameterInfos(); for (Iterator<ParameterInfo> iter= parameters.iterator(); iter.hasNext();) { ParameterInfo info= iter.next(); if ("".equals(info.getNewName())) { //$NON-NLS-1$ result.addFatalError(RefactoringMessages.ExtractMethodInputPage_validation_emptyParameterName); return result; } } result.merge(fRefactoring.checkParameterNames()); result.merge(fRefactoring.checkVarargOrder()); return result; }
Example 15
Source File: RenameCompilationUnitProcessor.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Override public RefactoringStatus checkNewElementName(String newName) throws CoreException { Assert.isNotNull(newName, "new name"); //$NON-NLS-1$ String typeName= removeFileNameExtension(newName); RefactoringStatus result= Checks.checkCompilationUnitName(newName, fCu); if (fWillRenameType) { result.merge(fRenameTypeProcessor.checkNewElementName(typeName)); } if (Checks.isAlreadyNamed(fCu, newName)) { result.addFatalError(RefactoringCoreMessages.RenameCompilationUnitRefactoring_same_name); } return result; }
Example 16
Source File: CommentAnalyzer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void check(RefactoringStatus result, Selection selection, IScanner scanner, int start, int end) { char[] characters= scanner.getSource(); selection= adjustSelection(characters, selection, end); scanner.resetTo(start, end); int token= 0; try { loop: while (token != ITerminalSymbols.TokenNameEOF) { token= scanner.getNextToken(); switch(token) { case ITerminalSymbols.TokenNameCOMMENT_LINE: case ITerminalSymbols.TokenNameCOMMENT_BLOCK: case ITerminalSymbols.TokenNameCOMMENT_JAVADOC: if (checkStart(scanner, selection.getOffset())) { result.addFatalError(RefactoringCoreMessages.CommentAnalyzer_starts_inside_comment); break loop; } if (checkEnd(scanner, selection.getInclusiveEnd())) { result.addFatalError(RefactoringCoreMessages.CommentAnalyzer_ends_inside_comment); break loop; } break; } } } catch (InvalidInputException e) { result.addFatalError(RefactoringCoreMessages.CommentAnalyzer_internal_error); } }
Example 17
Source File: ExtractMethodAnalyzer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
public RefactoringStatus checkInitialConditions(ImportRewrite rewriter) { RefactoringStatus result= getStatus(); checkExpression(result); if (result.hasFatalError()) return result; List<ASTNode> validDestinations= new ArrayList<ASTNode>(); ASTNode destination= ASTResolving.findParentType(fEnclosingBodyDeclaration.getParent()); while (destination != null) { if (isValidDestination(destination)) { validDestinations.add(destination); } destination= ASTResolving.findParentType(destination.getParent()); } if (validDestinations.size() == 0) { result.addFatalError(RefactoringCoreMessages.ExtractMethodAnalyzer_no_valid_destination_type); return result; } fReturnKind= UNDEFINED; fMaxVariableId= LocalVariableIndex.perform(fEnclosingBodyDeclaration); if (analyzeSelection(result).hasFatalError()) return result; int returns= fReturnKind == NO ? 0 : 1; if (fReturnValue != null) { fReturnKind= ACCESS_TO_LOCAL; returns++; } if (isExpressionSelected()) { fReturnKind= EXPRESSION; returns++; } if (returns > 1) { result.addFatalError(RefactoringCoreMessages.ExtractMethodAnalyzer_ambiguous_return_value, JavaStatusContext.create(fCUnit, getSelection())); fReturnKind= MULTIPLE; return result; } initReturnType(rewriter); return result; }
Example 18
Source File: ExtractMethodRefactoring.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private RefactoringStatus mergeTextSelectionStatus(RefactoringStatus status) { status.addFatalError(RefactoringCoreMessages.ExtractMethodRefactoring_no_set_of_statements); return status; }
Example 19
Source File: ExtractMethodRefactoring.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
private RefactoringStatus mergeTextSelectionStatus(RefactoringStatus status) { status.addFatalError(RefactoringCoreMessages.ExtractMethodRefactoring_no_set_of_statements); return status; }
Example 20
Source File: BinaryRefactoringHistoryWizard.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
/** * Creates the necessary source code for the refactoring. * * @param monitor * the progress monitor to use * @return * the resulting status */ private RefactoringStatus createNecessarySourceCode(final IProgressMonitor monitor) { final RefactoringStatus status= new RefactoringStatus(); try { monitor.beginTask(JarImportMessages.JarImportWizard_prepare_import, 240); final IPackageFragmentRoot root= getPackageFragmentRoot(); if (root != null && fSourceFolder != null && fJavaProject != null) { try { final SubProgressMonitor subMonitor= new SubProgressMonitor(monitor, 40, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL); final IJavaElement[] elements= root.getChildren(); final List<IPackageFragment> list= new ArrayList<IPackageFragment>(elements.length); try { subMonitor.beginTask(JarImportMessages.JarImportWizard_prepare_import, elements.length); for (int index= 0; index < elements.length; index++) { final IJavaElement element= elements[index]; if (!fProcessedFragments.contains(element) && !element.getElementName().equals(META_INF_FRAGMENT)) list.add((IPackageFragment) element); subMonitor.worked(1); } } finally { subMonitor.done(); } if (!list.isEmpty()) { fProcessedFragments.addAll(list); final URI uri= fSourceFolder.getRawLocationURI(); if (uri != null) { final IPackageFragmentRoot sourceFolder= fJavaProject.getPackageFragmentRoot(fSourceFolder); IWorkspaceRunnable runnable= null; if (canUseSourceAttachment()) { runnable= new SourceCreationOperation(uri, list) { private IPackageFragment fFragment= null; @Override protected final void createCompilationUnit(final IFileStore store, final String name, final String content, final IProgressMonitor pm) throws CoreException { fFragment.createCompilationUnit(name, content, true, pm); } @Override protected final void createPackageFragment(final IFileStore store, final String name, final IProgressMonitor pm) throws CoreException { fFragment= sourceFolder.createPackageFragment(name, true, pm); } }; } else { runnable= new StubCreationOperation(uri, list, true) { private IPackageFragment fFragment= null; @Override protected final void createCompilationUnit(final IFileStore store, final String name, final String content, final IProgressMonitor pm) throws CoreException { fFragment.createCompilationUnit(name, content, true, pm); } @Override protected final void createPackageFragment(final IFileStore store, final String name, final IProgressMonitor pm) throws CoreException { fFragment= sourceFolder.createPackageFragment(name, true, pm); } }; } try { runnable.run(new SubProgressMonitor(monitor, 150, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)); } finally { fSourceFolder.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 50, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL)); } } } } catch (CoreException exception) { status.addFatalError(exception.getLocalizedMessage()); } } } finally { monitor.done(); } return status; }