本文整理汇总了Java中org.eclipse.jdt.internal.ui.util.ExceptionHandler类的典型用法代码示例。如果您正苦于以下问题:Java ExceptionHandler类的具体用法?Java ExceptionHandler怎么用?Java ExceptionHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExceptionHandler类属于org.eclipse.jdt.internal.ui.util包,在下文中一共展示了ExceptionHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
});
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}