当前位置: 首页>>代码示例>>Java>>正文


Java ExceptionHandler.handle方法代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.ui.util.ExceptionHandler.handle方法的典型用法代码示例。如果您正苦于以下问题:Java ExceptionHandler.handle方法的具体用法?Java ExceptionHandler.handle怎么用?Java ExceptionHandler.handle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.internal.ui.util.ExceptionHandler的用法示例。


在下文中一共展示了ExceptionHandler.handle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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,代码行数:17,代码来源:ReorgCopyAction.java

示例2: 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-Juno38,代码行数:17,代码来源:ProblemSeveritiesConfigurationBlock.java

示例3: run

import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void run(final ITextSelection selection) {
	try {
		if (! ActionUtil.isEditable(fEditor))
			return;
		final IMember member= getSelectedMemberFromEditor();
		final IMember[] array= new IMember[] { member};
		if (member != null && RefactoringAvailabilityTester.isExtractSupertypeAvailable(array)) {
			RefactoringExecutionStarter.startExtractSupertypeRefactoring(array, getShell());
		} else {
			MessageDialog.openInformation(getShell(), RefactoringMessages.OpenRefactoringWizardAction_unavailable, RefactoringMessages.ExtractSuperTypeAction_unavailable);
		}
	} catch (JavaModelException exception) {
		ExceptionHandler.handle(exception, RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringMessages.OpenRefactoringWizardAction_exception);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:ExtractSuperClassAction.java

示例4: 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

示例5: run

import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入方法依赖的package包/类
@Override
public void run() {
	Shell shell= JavaPlugin.getActiveWorkbenchShell();
	SelectionDialog dialog= null;
	try {
		dialog= JavaUI.createTypeDialog(shell, new ProgressMonitorDialog(shell),
			SearchEngine.createWorkspaceScope(), IJavaElementSearchConstants.CONSIDER_ALL_TYPES, false);
	} catch (JavaModelException e) {
		String title= getDialogTitle();
		String message= PackagesMessages.GotoType_error_message;
		ExceptionHandler.handle(e, title, message);
		return;
	}

	dialog.setTitle(getDialogTitle());
	dialog.setMessage(PackagesMessages.GotoType_dialog_message);
	if (dialog.open() == IDialogConstants.CANCEL_ID) {
		return;
	}

	Object[] types= dialog.getResult();
	if (types != null && types.length > 0) {
		gotoType((IType) types[0]);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:GotoTypeAction.java

示例6: 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-Juno38,代码行数:17,代码来源:MoveStaticMembersAction.java

示例7: run

import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入方法依赖的package包/类
@Override
public void run() {
  Shell localShell = getShell();
  if (!doCreateProjectFirstOnEmptyWorkspace(localShell)) {
    return;
  }

  try {
    INewWizard wizard = createWizard();
    wizard.init(PlatformUI.getWorkbench(), getSelection());

    WizardDialog dialog = new WizardDialog(localShell, wizard);
    IPixelConverter converter =
        PixelConverterFactory.createPixelConverter(JFaceResources.getDialogFont());
    dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70),
        converter.convertHeightInCharsToPixels(20));
    dialog.create();
    int res = dialog.open();
    if (res == Window.OK && wizard instanceof NewElementWizard) {
      createdElement = ((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, localShell, title, message);
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:30,代码来源:AbstractOpenWizardAction.java

示例8: treeViewerSelectionChanged

import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入方法依赖的package包/类
private void treeViewerSelectionChanged(SelectionChangedEvent event) {
	try {
		final IJavaElement selection= getFirstSelectedSourceReference(event);
		setSourceViewerContents(selection);
		fEditElementButton.setEnabled(selection != null && (isSimilarElement(selection)));
		fCurrentElementLabel.setText(selection != null ? JavaElementLabels.getElementLabel(selection, LABEL_FLAGS) : RefactoringMessages.RenameTypeWizardSimilarElementsPage_select_element_to_view_source);
		fCurrentElementLabel.setImage(selection != null ? fTreeViewerLabelProvider.getJavaImage(selection) : null);
	} catch (JavaModelException e) {
		ExceptionHandler.handle(e, RefactoringMessages.RenameTypeWizard_defaultPageTitle, RefactoringMessages.RenameTypeWizard_unexpected_exception);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:12,代码来源:RenameTypeWizardSimilarElementsPage.java

示例9: run

import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入方法依赖的package包/类
@Override
public void run(ITextSelection selection) {
	try {
		checkAndRun(SelectionConverter.getTypeAtOffset(fEditor));
	} catch (CoreException e) {
		ExceptionHandler.handle(e, getShell(), getErrorCaption(), ActionMessages.GenerateMethodAbstractAction_error_cannot_create);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:9,代码来源:GenerateMethodAbstractAction.java

示例10: run

import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入方法依赖的package包/类
@Override
public void run(IStructuredSelection selection) {
	Shell shell= getShell();
	try {
		ICompilationUnit cu= getSelectedCompilationUnit(selection);
		if (cu == null) {
			return;
		}
		IType[] types= cu.getTypes();
		if (!hasMembersToSort(types)) {
			return;
		}
		if (!ActionUtil.isEditable(getShell(), cu)) {
			return;
		}

		SortMembersMessageDialog dialog= new SortMembersMessageDialog(getShell());
		if (dialog.open() != Window.OK) {
			return;
		}

		if (!ElementValidator.check(cu, getShell(), getDialogTitle(), false)) {
			return;
		}

		// open an editor and work on a working copy
		IEditorPart editor= JavaUI.openInEditor(cu);
		if (editor != null) {
			run(shell, cu, editor, dialog.isNotSortingFieldsEnabled());
		}
	} catch (CoreException e) {
		ExceptionHandler.handle(e, shell, getDialogTitle(), null);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:35,代码来源:SortMembersAction.java

示例11: handleException

import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入方法依赖的package包/类
private static void handleException(Shell shell, Exception e) {
	String title= JavaTemplateMessages.JavaContext_error_title;
	if (e instanceof CoreException)
		ExceptionHandler.handle((CoreException)e, shell, title, null);
	else if (e instanceof InvocationTargetException)
		ExceptionHandler.handle((InvocationTargetException)e, shell, title, null);
	else {
		JavaPlugin.log(e);
		String message= e.getMessage();
		if (message == null) {
			message= JavaTemplateMessages.JavaContext_unexpected_error_message;
		}
		MessageDialog.openError(shell, title, message);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:16,代码来源:JavaContext.java

示例12: apply

import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入方法依赖的package包/类
public void apply(IDocument document) {
	try {
		performChange(JavaPlugin.getActivePage().getActiveEditor(), document);
	} catch (CoreException e) {
		ExceptionHandler.handle(e, CorrectionMessages.ChangeCorrectionProposal_error_title, CorrectionMessages.ChangeCorrectionProposal_error_message);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:8,代码来源:ChangeCorrectionProposal.java

示例13: run

import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入方法依赖的package包/类
@Override
public void run(IStructuredSelection selection) {
	IJavaElement element= getJavaElement(selection);
	if (element == null)
		return;
	if (!ActionUtil.isEditable(getShell(), element))
		return;
	try {
		run(element, false);
	} catch (CoreException e){
		ExceptionHandler.handle(e, RefactoringMessages.RenameJavaElementAction_name, RefactoringMessages.RenameJavaElementAction_exception);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:RenameJavaElementAction.java

示例14: run

import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入方法依赖的package包/类
@Override
public void run(IStructuredSelection selection) {
	try {
		if (RefactoringAvailabilityTester.isExtractInterfaceAvailable(selection)) {
			IType singleSelectedType= RefactoringAvailabilityTester.getSingleSelectedType(selection);
			if (! ActionUtil.isEditable(getShell(), singleSelectedType))
				return;
			RefactoringExecutionStarter.startExtractInterfaceRefactoring(singleSelectedType, getShell());
		}
	} catch (JavaModelException e) {
		ExceptionHandler.handle(e, RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringMessages.OpenRefactoringWizardAction_exception);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:14,代码来源:ExtractInterfaceAction.java

示例15: run

import org.eclipse.jdt.internal.ui.util.ExceptionHandler; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void run(IStructuredSelection selection) {
	try {
		IMember[] members= getSelectedMembers(selection);
		if (RefactoringAvailabilityTester.isPushDownAvailable(members) && ActionUtil.isEditable(getShell(), members[0]))
			RefactoringExecutionStarter.startPushDownRefactoring(members, getShell());
	} catch (JavaModelException e) {
		ExceptionHandler.handle(e, RefactoringMessages.OpenRefactoringWizardAction_refactoring, RefactoringMessages.OpenRefactoringWizardAction_exception);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:14,代码来源:PushDownAction.java


注:本文中的org.eclipse.jdt.internal.ui.util.ExceptionHandler.handle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。