本文整理汇总了Java中org.eclipse.jdt.internal.ui.util.ExceptionHandler类的典型用法代码示例。如果您正苦于以下问题:Java ExceptionHandler类的具体用法?Java ExceptionHandler怎么用?Java ExceptionHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExceptionHandler类属于org.eclipse.jdt.internal.ui.util包,在下文中一共展示了ExceptionHandler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doBrowseTypes
import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入依赖的package包/类
private void doBrowseTypes(StringButtonDialogField dialogField) {
IRunnableContext context= new BusyIndicatorRunnableContext();
IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
int style= IJavaElementSearchConstants.CONSIDER_ANNOTATION_TYPES;
try {
SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), context, scope, style, false, dialogField.getText());
dialog.setTitle(PreferencesMessages.NullAnnotationsConfigurationDialog_browse_title);
dialog.setMessage(PreferencesMessages.NullAnnotationsConfigurationDialog_choose_annotation);
if (dialog.open() == Window.OK) {
IType res= (IType) dialog.getResult()[0];
dialogField.setText(res.getFullyQualifiedName('.'));
}
} catch (JavaModelException e) {
ExceptionHandler.handle(e, getShell(), PreferencesMessages.NullAnnotationsConfigurationDialog_error_title, PreferencesMessages.NullAnnotationsConfigurationDialog_error_message);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:ProblemSeveritiesConfigurationBlock.java
示例2: openView
import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入依赖的package包/类
public static CallHierarchyViewPart openView(IMember[] input, IWorkbenchWindow window) {
if (input.length == 0) {
MessageDialog.openInformation(window.getShell(), CallHierarchyMessages.CallHierarchyUI_selectionDialog_title,
CallHierarchyMessages.CallHierarchyUI_open_operation_unavialable);
return null;
}
IWorkbenchPage page= window.getActivePage();
try {
CallHierarchyViewPart viewPart= getDefault().findLRUCallHierarchyViewPart(page); //find the first view which is not pinned
String secondaryId= null;
if (viewPart == null) {
if (page.findViewReference(CallHierarchyViewPart.ID_CALL_HIERARCHY) != null) //all the current views are pinned, open a new instance
secondaryId= String.valueOf(++getDefault().fViewCount);
} else
secondaryId= viewPart.getViewSite().getSecondaryId();
viewPart= (CallHierarchyViewPart)page.showView(CallHierarchyViewPart.ID_CALL_HIERARCHY, secondaryId, IWorkbenchPage.VIEW_ACTIVATE);
viewPart.setInputElements(input);
return viewPart;
} catch (CoreException e) {
ExceptionHandler.handle(e, window.getShell(),
CallHierarchyMessages.CallHierarchyUI_error_open_view, e.getMessage());
}
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:25,代码来源:CallHierarchyUI.java
示例3: run
import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入依赖的package包/类
@Override
public void run(ITextSelection selection) {
try {
IMember member= getSelectedMemberFromEditor();
if (!ActionUtil.isEditable(fEditor, getShell(), member))
return;
IMember[] array= new IMember[]{member};
if (member != null && RefactoringAvailabilityTester.isMoveStaticMembersAvailable(array)){
RefactoringExecutionStarter.startMoveStaticMembersRefactoring(array, getShell());
} else {
MessageDialog.openInformation(getShell(), RefactoringMessages.OpenRefactoringWizardAction_unavailable, RefactoringMessages.MoveMembersAction_unavailable);
}
} catch (JavaModelException e) {
ExceptionHandler.handle(e, RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringMessages.OpenRefactoringWizardAction_exception);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:MoveStaticMembersAction.java
示例4: run
import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void run(ITextSelection selection) {
try {
if (!ActionUtil.isEditable(fEditor))
return;
IMember member= getSelectedMemberFromEditor();
IMember[] array= new IMember[] { member};
if (member != null && RefactoringAvailabilityTester.isPullUpAvailable(array)) {
RefactoringExecutionStarter.startPullUpRefactoring(array, getShell());
} else {
MessageDialog.openInformation(getShell(), RefactoringMessages.OpenRefactoringWizardAction_unavailable, RefactoringMessages.PullUpAction_unavailable);
}
} catch (JavaModelException e) {
ExceptionHandler.handle(e, RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringMessages.OpenRefactoringWizardAction_exception);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:20,代码来源:PullUpAction.java
示例5: export
import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入依赖的package包/类
private IStatus export(JarPackageData[] jarPackages) {
Shell shell= getShell();
IJarExportRunnable op= jarPackages[0].createJarExportRunnable(jarPackages, shell);
try {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().run(false, true, op);
//PlatformUI.getWorkbench().getProgressService().run(false, true, op); // see bug 118152
} catch (InvocationTargetException ex) {
if (ex.getTargetException() != null) {
ExceptionHandler.handle(ex, shell, JarPackagerMessages.CreateJarActionDelegate_jarExportError_title, JarPackagerMessages.CreateJarActionDelegate_jarExportError_message);
return null;
}
} catch (InterruptedException e) {
// do nothing on cancel
return null;
}
return op.getStatus();
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:18,代码来源:CreateJarActionDelegate.java
示例6: run
import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入依赖的package包/类
@Override
public void run(IStructuredSelection selection) {
if (ReorgUtils.containsOnlyProjects(selection.toList())){
createWorkbenchAction(selection).run();
return;
}
try {
List<?> elements= selection.toList();
IResource[] resources= ReorgUtils.getResources(elements);
IJavaElement[] javaElements= ReorgUtils.getJavaElements(elements);
if (RefactoringAvailabilityTester.isCopyAvailable(resources, javaElements))
RefactoringExecutionStarter.startCopyRefactoring(resources, javaElements, getShell());
} catch (JavaModelException e) {
ExceptionHandler.handle(e, RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringMessages.OpenRefactoringWizardAction_exception);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:17,代码来源:ReorgCopyAction.java
示例7: run
import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入依赖的package包/类
@Override
public void run(IStructuredSelection selection) {
if (ReorgUtils.containsOnlyProjects(selection.toList())) {
createWorkbenchAction(selection).run();
return;
}
try {
List<?> elements= selection.toList();
IResource[] resources= ReorgUtils.getResources(elements);
IJavaElement[] javaElements= ReorgUtils.getJavaElements(elements);
if (RefactoringAvailabilityTester.isMoveAvailable(resources, javaElements))
RefactoringExecutionStarter.startMoveRefactoring(resources, javaElements, getShell());
} catch (JavaModelException e) {
ExceptionHandler.handle(e, RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringMessages.OpenRefactoringWizardAction_exception);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:ReorgMoveAction.java
示例8: run
import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入依赖的package包/类
@Override
public void run(IStructuredSelection selection) {
if (ReorgUtils.containsOnlyProjects(selection.toList())) {
createWorkbenchAction(selection).run();
return;
}
if (ReorgUtils.containsOnlyWorkingSets(selection.toList())){
deleteWorkingSets(selection);
return;
}
try {
RefactoringExecutionStarter.startDeleteRefactoring(selection.toArray(), getShell());
} catch (CoreException e) {
ExceptionHandler.handle(e, RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringMessages.OpenRefactoringWizardAction_exception);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:DeleteAction.java
示例9: createFileListInput
import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入依赖的package包/类
private Object[] createFileListInput() {
try {
IPackageFragment fPkgFragment= fResourceBundlePackage.getSelected();
if (fPkgFragment == null)
return new Object[0];
List<Object> result= new ArrayList<Object>(1);
Object[] nonjava= fPkgFragment.getNonJavaResources();
for (int i= 0; i < nonjava.length; i++) {
if (isPropertyFile(nonjava[i]))
result.add(nonjava[i]);
}
return result.toArray();
} catch (JavaModelException e) {
ExceptionHandler.handle(e, NLSUIMessages.NLSAccessorConfigurationDialog_externalizing, NLSUIMessages .NLSAccessorConfigurationDialog_exception);
return new Object[0];
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:NLSAccessorConfigurationDialog.java
示例10: open
import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入依赖的package包/类
public static void open(final ICompilationUnit unit, final Shell shell) {
if (unit == null || !unit.exists()) {
return;
}
Display display= shell != null ? shell.getDisplay() : Display.getCurrent();
BusyIndicator.showWhile(display, new Runnable() {
public void run() {
NLSRefactoring refactoring= null;
try {
refactoring= NLSRefactoring.create(unit);
} catch (IllegalArgumentException e) {
// Loading a properties file can throw an IAE due to malformed Unicode escape sequence, see Properties#load for details.
IStatus status= new Status(IStatus.ERROR, JavaPlugin.getPluginId(), e.getLocalizedMessage());
ExceptionHandler.handle(status,
NLSUIMessages.ExternalizeWizard_name,
NLSUIMessages.ExternalizeWizard_error_message);
}
if (refactoring != null)
new RefactoringStarter().activate(new ExternalizeWizard(refactoring), shell, ActionMessages.ExternalizeStringsAction_dialog_title, RefactoringSaveHelper.SAVE_REFACTORING);
}
});
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:ExternalizeWizard.java
示例11: initializeTreeViewer
import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入依赖的package包/类
private void initializeTreeViewer(final IProgressMonitor pm) {
try {
pm.beginTask(RefactoringCoreMessages.PullUpRefactoring_checking, 2);
final IMember[] matchingMethods= fProcessor.getMatchingElements(new SubProgressMonitor(pm, 1), false);
final ITypeHierarchy hierarchy= fProcessor.getDestinationTypeHierarchy(new SubProgressMonitor(pm, 1));
removeAllTreeViewFilters();
fTreeViewer.addFilter(new PullUpFilter(hierarchy, matchingMethods));
fTreeViewer.setContentProvider(new PullUpHierarchyContentProvider(fProcessor.getDeclaringType(), matchingMethods));
fTreeViewer.setInput(hierarchy);
precheckElements(fTreeViewer);
fTreeViewer.expandAll();
updateSelectionLabel();
} catch (JavaModelException e) {
ExceptionHandler.handle(e, RefactoringMessages.PullUpInputPage_pull_up1, RefactoringMessages.PullUpInputPage_exception);
fTreeViewer.setInput(null);
} finally {
pm.done();
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:PullUpMethodPage.java
示例12: run
import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入依赖的package包/类
@Override
public void run(ITextSelection selection) {
try {
if (!ActionUtil.isEditable(fEditor))
return;
IType type= RefactoringActions.getEnclosingOrPrimaryType(fEditor);
if (RefactoringAvailabilityTester.isExtractInterfaceAvailable(type)) {
RefactoringExecutionStarter.startExtractInterfaceRefactoring(type, getShell());
} else {
String unavailable= RefactoringMessages.ExtractInterfaceAction_To_activate;
MessageDialog.openInformation(getShell(), RefactoringMessages.OpenRefactoringWizardAction_unavailable, unavailable);
}
} catch (JavaModelException e) {
ExceptionHandler.handle(e, RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringMessages.OpenRefactoringWizardAction_exception);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:17,代码来源:ExtractInterfaceAction.java
示例13: run
import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入依赖的package包/类
@Override
public void run(IStructuredSelection selection) {
try {
//we have to call this here - no selection changed event is sent
// after a refactoring but it may still invalidate enablement
if (RefactoringAvailabilityTester.isMoveInnerAvailable(selection)) {
IType singleSelectedType= getSingleSelectedType(selection);
if (! ActionUtil.isEditable(getShell(), singleSelectedType))
return;
RefactoringExecutionStarter.startMoveInnerRefactoring(singleSelectedType, getShell());
}
} catch (JavaModelException e) {
ExceptionHandler.handle(e,
RefactoringMessages.OpenRefactoringWizardAction_refactoring,
RefactoringMessages.OpenRefactoringWizardAction_exception);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:ConvertNestedToTopAction.java
示例14: run
import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入依赖的package包/类
@Override
public void run(IStructuredSelection selection) {
IJavaElement[] elements= getSelectedElements(selection);
try {
if (! ActionUtil.areProcessable(getShell(), elements))
return;
if (RefactoringAvailabilityTester.isInferTypeArgumentsAvailable(elements)) {
RefactoringExecutionStarter.startInferTypeArgumentsRefactoring(elements, getShell());
} else {
MessageDialog.openInformation(getShell(), RefactoringMessages.OpenRefactoringWizardAction_unavailable, RefactoringMessages.InferTypeArgumentsAction_unavailable);
}
} catch (JavaModelException e) {
ExceptionHandler.handle(e, RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringMessages.OpenRefactoringWizardAction_exception);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:InferTypeArgumentsAction.java
示例15: run
import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入依赖的package包/类
@Override
public void run() {
Shell shell= getShell();
if (!doCreateProjectFirstOnEmptyWorkspace(shell)) {
return;
}
try {
INewWizard wizard= createWizard();
wizard.init(PlatformUI.getWorkbench(), getSelection());
WizardDialog dialog= new WizardDialog(shell, wizard);
PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont());
dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
dialog.create();
int res= dialog.open();
if (res == Window.OK && wizard instanceof NewElementWizard) {
fCreatedElement= ((NewElementWizard)wizard).getCreatedElement();
}
notifyResult(res == Window.OK);
} catch (CoreException e) {
String title= NewWizardMessages.AbstractOpenWizardAction_createerror_title;
String message= NewWizardMessages.AbstractOpenWizardAction_createerror_message;
ExceptionHandler.handle(e, shell, title, message);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:AbstractOpenWizardAction.java
示例16: run
import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入依赖的package包/类
@Override
public void run(IStructuredSelection selection) {
try {
IField[] selectedFields= getSelectedFields(selection);
if (canRunOn(selectedFields)) {
run(selectedFields[0].getDeclaringType(), selectedFields, false);
return;
}
Object firstElement= selection.getFirstElement();
if (firstElement instanceof IType)
run((IType) firstElement, new IField[0], false);
else if (firstElement instanceof ICompilationUnit)
run(JavaElementUtil.getMainType((ICompilationUnit) firstElement), new IField[0], false);
else if (!(firstElement instanceof IField))
MessageDialog.openInformation(getShell(), DIALOG_TITLE, ActionMessages.AddDelegateMethodsAction_not_applicable);
} catch (CoreException e) {
ExceptionHandler.handle(e, getShell(), DIALOG_TITLE, ActionMessages.AddDelegateMethodsAction_error_actionfailed);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:21,代码来源:AddDelegateMethodsAction.java
示例17: handleOpen
import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入依赖的package包/类
@Override
protected void handleOpen(OpenEvent event) {
Object firstElement= ((IStructuredSelection)event.getSelection()).getFirstElement();
if (firstElement instanceof ICompilationUnit ||
firstElement instanceof IClassFile ||
firstElement instanceof IMember) {
if (getDisplayedMatchCount(firstElement) == 0) {
try {
fEditorOpener.openElement(firstElement);
} catch (CoreException e) {
ExceptionHandler.handle(e, getSite().getShell(), SearchMessages.JavaSearchResultPage_open_editor_error_title, SearchMessages.JavaSearchResultPage_open_editor_error_message);
}
return;
}
}
super.handleOpen(event);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:18,代码来源:JavaSearchResultPage.java
示例18: run
import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入依赖的package包/类
@Override
public void run() {
IWorkbench workbench= JavaPlugin.getDefault().getWorkbench();
IWorkbenchWindow window= workbench.getActiveWorkbenchWindow();
IWorkbenchPage page= window.getActivePage();
IAdaptable input;
if (page != null)
input= page.getInput();
else
input= ResourcesPlugin.getWorkspace().getRoot();
try {
workbench.showPerspective(JavaUI.ID_BROWSING_PERSPECTIVE, window, input);
} catch (WorkbenchException e) {
ExceptionHandler.handle(e, window.getShell(),
ActionMessages.OpenJavaBrowsingPerspectiveAction_dialog_title,
ActionMessages.OpenJavaBrowsingPerspectiveAction_error_open_failed);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:OpenJavaBrowsingPerspectiveAction.java
示例19: run
import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void run(ITextSelection selection) {
try {
if (!ActionUtil.isEditable(fEditor))
return;
IMember member= getSelectedMemberFromEditor();
IMember[] array= new IMember[] { member};
if (member != null && RefactoringAvailabilityTester.isPushDownAvailable(array)) {
RefactoringExecutionStarter.startPushDownRefactoring(array, getShell());
} else {
MessageDialog.openInformation(getShell(), RefactoringMessages.OpenRefactoringWizardAction_unavailable, RefactoringMessages.PushDownAction_To_activate);
}
} catch (JavaModelException e) {
ExceptionHandler.handle(e, RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringMessages.OpenRefactoringWizardAction_exception);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:PushDownAction.java
示例20: run
import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入依赖的package包/类
@Override
public void run(IStructuredSelection selection) {
try {
final IType type= getSelectedType(selection);
if (type == null) {
MessageDialog.openInformation(getShell(), getDialogTitle(), ActionMessages.OverrideMethodsAction_not_applicable);
notifyResult(false);
return;
}
if (!ElementValidator.check(type, getShell(), getDialogTitle(), false) || !ActionUtil.isEditable(getShell(), type)) {
notifyResult(false);
return;
}
run(getShell(), type);
} catch (CoreException exception) {
ExceptionHandler.handle(exception, getShell(), getDialogTitle(), ActionMessages.OverrideMethodsAction_error_actionfailed);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:OverrideMethodsAction.java
注:本文中的org.eclipse.jdt.internal.ui.util.ExceptionHandler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论