Java Code Examples for org.eclipse.ltk.core.refactoring.RefactoringStatus#INFO

The following examples show how to use org.eclipse.ltk.core.refactoring.RefactoringStatus#INFO . 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: LtkIssueAcceptor.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
protected int convert(RefactoringIssueAcceptor.Severity severity) {
	int refactoringStatus = RefactoringStatus.OK;
	if (severity != null) {
		switch (severity) {
			case FATAL:
				refactoringStatus = RefactoringStatus.FATAL;
				break;
			case ERROR:
				refactoringStatus = RefactoringStatus.ERROR;
				break;
			case WARNING:
				refactoringStatus = RefactoringStatus.WARNING;
				break;
			case INFO:
				refactoringStatus = RefactoringStatus.INFO;
				break;
			default:
				break;
		}
	}
	return refactoringStatus;
}
 
Example 2
Source File: ExtractClassWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
protected void updateDecoration(ControlDecoration decoration, RefactoringStatus status) {
	RefactoringStatusEntry highestSeverity= status.getEntryWithHighestSeverity();
	if (highestSeverity != null) {
		Image newImage= null;
		FieldDecorationRegistry registry= FieldDecorationRegistry.getDefault();
		switch (highestSeverity.getSeverity()) {
			case RefactoringStatus.INFO:
				newImage= registry.getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage();
				break;
			case RefactoringStatus.WARNING:
				newImage= registry.getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage();
				break;
			case RefactoringStatus.FATAL:
			case RefactoringStatus.ERROR:
				newImage= registry.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage();
		}
		decoration.setDescriptionText(highestSeverity.getMessage());
		decoration.setImage(newImage);
		decoration.show();
	} else {
		decoration.setDescriptionText(null);
		decoration.hide();
	}
}
 
Example 3
Source File: IntroduceFactoryInputPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void validateInput(boolean methodName) {
	RefactoringStatus merged= new RefactoringStatus();
	if (fMethodNameStatus != null && (methodName || fMethodNameStatus.hasError()))
		merged.merge(fMethodNameStatus);
	if (fDestinationStatus != null && (!methodName || fDestinationStatus.hasError()))
		merged.merge(fDestinationStatus);

	setPageComplete(!merged.hasError());
	int severity= merged.getSeverity();
	String message= merged.getMessageMatchingSeverity(severity);
	if (severity >= RefactoringStatus.INFO) {
		setMessage(message, severity);
	} else {
		setMessage("", NONE); //$NON-NLS-1$
	}
}
 
Example 4
Source File: ExtractClassWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected RefactoringStatus validateRefactoring() {
	RefactoringStatus status= new RefactoringStatus();
	setErrorMessage(null);
	setMessage(null);
	setPageComplete(true);
	status.merge(validateTopLevel());
	status.merge(validateClassName());
	status.merge(validateParameterName());
	status.merge(validateFields());
	RefactoringStatusEntry highestSeverity= status.getEntryWithHighestSeverity();
	if (highestSeverity != null) {
		switch (highestSeverity.getSeverity()) {
			case RefactoringStatus.ERROR:
			case RefactoringStatus.FATAL:
				setErrorMessage(highestSeverity.getMessage());
				setPageComplete(false);
				break;
			case RefactoringStatus.WARNING:
				setMessage(highestSeverity.getMessage(), IMessageProvider.WARNING);
				break;
			case RefactoringStatus.INFO:
				setMessage(highestSeverity.getMessage(), IMessageProvider.INFORMATION);
				break;
		}
	}
	return status;
}
 
Example 5
Source File: IntroduceIndirectionInputPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void validateInput() {
	RefactoringStatus merged= new RefactoringStatus();
	merged.merge(getIntroduceIndirectionRefactoring().setIntermediaryTypeName(fIntermediaryTypeName.getText()));
	merged.merge(getIntroduceIndirectionRefactoring().setIntermediaryMethodName(fIntermediaryMethodName.getText()));

	setPageComplete(!merged.hasError());
	int severity= merged.getSeverity();
	String message= merged.getMessageMatchingSeverity(severity);
	if (severity >= RefactoringStatus.INFO) {
		setMessage(message, severity);
	} else {
		setMessage("", NONE); //$NON-NLS-1$
	}
}
 
Example 6
Source File: MemberVisibilityAdjustor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Is the specified severity a refactoring status severity?
 *
 * @param severity the severity to test
 * @return <code>true</code> if it is a refactoring status severity, <code>false</code> otherwise
 */
private static boolean isStatusSeverity(final int severity) {
	return severity == RefactoringStatus.ERROR || severity == RefactoringStatus.FATAL || severity == RefactoringStatus.INFO || severity == RefactoringStatus.OK || severity == RefactoringStatus.WARNING;
}