Java Code Examples for org.eclipse.jdt.internal.corext.util.JavaModelUtil#isExceptionToBeLogged()

The following examples show how to use org.eclipse.jdt.internal.corext.util.JavaModelUtil#isExceptionToBeLogged() . 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: ReorgCopyAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void selectionChanged(IStructuredSelection selection) {
	if (!selection.isEmpty()) {
		if (ReorgUtils.containsOnlyProjects(selection.toList())) {
			setEnabled(createWorkbenchAction(selection).isEnabled());
			return;
		}
		try {
			List<?> elements= selection.toList();
			IResource[] resources= ReorgUtils.getResources(elements);
			IJavaElement[] javaElements= ReorgUtils.getJavaElements(elements);
			if (elements.size() != resources.length + javaElements.length)
				setEnabled(false);
			else
				setEnabled(RefactoringAvailabilityTester.isCopyAvailable(resources, javaElements));
		} catch (JavaModelException e) {
			// no ui here - this happens on selection changes
			// http://bugs.eclipse.org/bugs/show_bug.cgi?id=19253
			if (JavaModelUtil.isExceptionToBeLogged(e))
				JavaPlugin.log(e);
			setEnabled(false);
		}
	} else
		setEnabled(false);
}
 
Example 2
Source File: ReorgMoveAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void selectionChanged(IStructuredSelection selection) {
	if (!selection.isEmpty()) {
		if (ReorgUtils.containsOnlyProjects(selection.toList())) {
			setEnabled(createWorkbenchAction(selection).isEnabled());
			return;
		}
		try {
			List<?> elements= selection.toList();
			IResource[] resources= ReorgUtils.getResources(elements);
			IJavaElement[] javaElements= ReorgUtils.getJavaElements(elements);
			if (elements.size() != resources.length + javaElements.length)
				setEnabled(false);
			else
				setEnabled(RefactoringAvailabilityTester.isMoveAvailable(resources, javaElements));
		} catch (JavaModelException e) {
			// no ui here - this happens on selection changes
			// http://bugs.eclipse.org/bugs/show_bug.cgi?id=19253
			if (JavaModelUtil.isExceptionToBeLogged(e))
				JavaPlugin.log(e);
			setEnabled(false);
		}
	} else
		setEnabled(false);
}
 
Example 3
Source File: ReplaceInvocationsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void selectionChanged(IStructuredSelection selection) {
	try {
		setEnabled(RefactoringAvailabilityTester.isReplaceInvocationsAvailable(selection));
	} catch (JavaModelException e) {
		if (JavaModelUtil.isExceptionToBeLogged(e))
			JavaPlugin.log(e);
	}
}
 
Example 4
Source File: IntroduceFactoryAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void selectionChanged(IStructuredSelection selection) {
	try {
		setEnabled(RefactoringAvailabilityTester.isIntroduceFactoryAvailable(selection));
	} catch (JavaModelException e) {
		if (JavaModelUtil.isExceptionToBeLogged(e))
			JavaPlugin.log(e);
		setEnabled(false);//no UI here - happens on selection changes
	}
}
 
Example 5
Source File: ExtractSuperClassAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void selectionChanged(final IStructuredSelection selection) {
	try {
		setEnabled(RefactoringAvailabilityTester.isExtractSupertypeAvailable(selection));
	} catch (JavaModelException exception) {
		// http://bugs.eclipse.org/bugs/show_bug.cgi?id=19253
		if (!(exception.getException() instanceof CharConversionException) && JavaModelUtil.isExceptionToBeLogged(exception))
			JavaPlugin.log(exception);
		setEnabled(false);//no UI - happens on selection changes
	}
}
 
Example 6
Source File: IntroduceParameterObjectAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void selectionChanged(JavaTextSelection selection) {
	try {
		setEnabled(RefactoringAvailabilityTester.isIntroduceParameterObjectAvailable(selection));
	} catch (JavaModelException e) {
		if (JavaModelUtil.isExceptionToBeLogged(e))
			JavaPlugin.log(e);
		setEnabled(false);
	}
}
 
Example 7
Source File: GenerateNewConstructorUsingFieldsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void selectionChanged(IStructuredSelection selection) {
	try {
		setEnabled(canEnable(selection));
	} catch (JavaModelException e) {
		// http://bugs.eclipse.org/bugs/show_bug.cgi?id=19253
		if (JavaModelUtil.isExceptionToBeLogged(e))
			JavaPlugin.log(e);
		setEnabled(false);
	}
}
 
Example 8
Source File: OverrideMethodsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void selectionChanged(IStructuredSelection selection) {
	try {
		setEnabled(canEnable(selection));
	} catch (JavaModelException exception) {
		if (JavaModelUtil.isExceptionToBeLogged(exception))
			JavaPlugin.log(exception);
		setEnabled(false);
	}
}
 
Example 9
Source File: PushDownAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void selectionChanged(IStructuredSelection selection) {
	try {
		setEnabled(RefactoringAvailabilityTester.isPushDownAvailable(selection));
	} catch (JavaModelException e) {
		// http://bugs.eclipse.org/bugs/show_bug.cgi?id=19253
		if (JavaModelUtil.isExceptionToBeLogged(e))
			JavaPlugin.log(e);
		setEnabled(false);// no UI
	}
}
 
Example 10
Source File: AddDelegateMethodsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void selectionChanged(IStructuredSelection selection) {
	try {
		setEnabled(canEnable(selection));
	} catch (JavaModelException e) {
		// http://bugs.eclipse.org/bugs/show_bug.cgi?id=19253
		if (JavaModelUtil.isExceptionToBeLogged(e))
			JavaPlugin.log(e);
		setEnabled(false);
	}
}
 
Example 11
Source File: FindAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private IJavaElement findType(ICompilationUnit cu, boolean silent) {
	IType[] types= null;
	try {
		types= cu.getAllTypes();
	} catch (JavaModelException ex) {
		if (JavaModelUtil.isExceptionToBeLogged(ex))
			ExceptionHandler.log(ex, SearchMessages.JavaElementAction_error_open_message);
		if (silent)
			return RETURN_WITHOUT_BEEP;
		else
			return null;
	}
	if (types.length == 1 || (silent && types.length > 0))
		return types[0];
	if (silent)
		return RETURN_WITHOUT_BEEP;
	if (types.length == 0)
		return null;
	String title= SearchMessages.JavaElementAction_typeSelectionDialog_title;
	String message = SearchMessages.JavaElementAction_typeSelectionDialog_message;
	int flags= (JavaElementLabelProvider.SHOW_DEFAULT);

	ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), new JavaElementLabelProvider(flags));
	dialog.setTitle(title);
	dialog.setMessage(message);
	dialog.setElements(types);

	if (dialog.open() == Window.OK)
		return (IType)dialog.getFirstResult();
	else
		return RETURN_WITHOUT_BEEP;
}
 
Example 12
Source File: IntroduceParameterObjectAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void selectionChanged(IStructuredSelection selection) {
	try {
		setEnabled(RefactoringAvailabilityTester.isIntroduceParameterObjectAvailable(selection));
	} catch (JavaModelException e) {
		if (JavaModelUtil.isExceptionToBeLogged(e))
			JavaPlugin.log(e);
	}
}
 
Example 13
Source File: InlineConstantAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void selectionChanged(IStructuredSelection selection) {
	try {
		setEnabled(RefactoringAvailabilityTester.isInlineConstantAvailable(selection));
	} catch (JavaModelException e) {
		// http://bugs.eclipse.org/bugs/show_bug.cgi?id=19253
		if (JavaModelUtil.isExceptionToBeLogged(e))
			JavaPlugin.log(e);
		setEnabled(false);//no ui
	}
}
 
Example 14
Source File: ConvertAnonymousToNestedAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void selectionChanged(IStructuredSelection selection) {
	try {
		setEnabled(RefactoringAvailabilityTester.isConvertAnonymousAvailable(selection));
	} catch (JavaModelException e) {
		if (JavaModelUtil.isExceptionToBeLogged(e))
			JavaPlugin.log(e);
		setEnabled(false);
	}
}
 
Example 15
Source File: ModifyParametersAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void selectionChanged(IStructuredSelection selection) {
	try {
		setEnabled(RefactoringAvailabilityTester.isChangeSignatureAvailable(selection));
	} catch (JavaModelException e) {
		// http://bugs.eclipse.org/bugs/show_bug.cgi?id=19253
		if (JavaModelUtil.isExceptionToBeLogged(e))
			JavaPlugin.log(e);
		setEnabled(false);//no UI here - happens on selection changes
	}
}
 
Example 16
Source File: InferTypeArgumentsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void selectionChanged(IStructuredSelection selection) {
	try {
		setEnabled(RefactoringAvailabilityTester.isInferTypeArgumentsAvailable(selection));
	} catch (JavaModelException e) {
		// http://bugs.eclipse.org/bugs/show_bug.cgi?id=19253
		if (JavaModelUtil.isExceptionToBeLogged(e))
			JavaPlugin.log(e);
		setEnabled(false);//no UI
	}
}
 
Example 17
Source File: SelfEncapsulateFieldAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void selectionChanged(IStructuredSelection selection) {
	try {
		setEnabled(RefactoringAvailabilityTester.isSelfEncapsulateAvailable(selection));
	} catch (JavaModelException e) {
		// http://bugs.eclipse.org/bugs/show_bug.cgi?id=19253
		if (JavaModelUtil.isExceptionToBeLogged(e))
			JavaPlugin.log(e);
		setEnabled(false);//no UI
	}
}
 
Example 18
Source File: AddToClasspathAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void selectionChanged(IStructuredSelection selection) {
	try {
		setEnabled(checkEnabled(selection));
	} catch (JavaModelException e) {
		// http://bugs.eclipse.org/bugs/show_bug.cgi?id=19253
		if (JavaModelUtil.isExceptionToBeLogged(e))
			JavaPlugin.log(e);
		setEnabled(false);
	}
}
 
Example 19
Source File: FindStringsToExternalizeAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void selectionChanged(IStructuredSelection selection) {
	try {
		setEnabled(computeEnablementState(selection));
	} catch (JavaModelException e) {
		if (JavaModelUtil.isExceptionToBeLogged(e))
			JavaPlugin.log(e);
		setEnabled(false);//no UI - happens on selection changes
	}
}
 
Example 20
Source File: InlineMethodAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void selectionChanged(IStructuredSelection selection) {
	try {
		setEnabled(RefactoringAvailabilityTester.isInlineMethodAvailable(selection));
	} catch (JavaModelException e) {
		if (JavaModelUtil.isExceptionToBeLogged(e))
			JavaPlugin.log(e);
	}
}