本文整理汇总了Java中org.eclipse.jface.operation.IRunnableContext类的典型用法代码示例。如果您正苦于以下问题:Java IRunnableContext类的具体用法?Java IRunnableContext怎么用?Java IRunnableContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IRunnableContext类属于org.eclipse.jface.operation包,在下文中一共展示了IRunnableContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doBrowseTypes
import org.eclipse.jface.operation.IRunnableContext; //导入依赖的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: runInUI
import org.eclipse.jface.operation.IRunnableContext; //导入依赖的package包/类
@Override
public void runInUI(IRunnableContext context,
IRunnableWithProgress runnable, ISchedulingRule rule)
throws InvocationTargetException, InterruptedException {
final RunnableWithStatus runnableWithStatus = new RunnableWithStatus(
context,
runnable, rule);
uiSynchronize.syncExec(new Runnable() {
@Override
public void run() {
BusyIndicator.showWhile(getDisplay(), runnableWithStatus);
}
});
IStatus status = runnableWithStatus.getStatus();
if (!status.isOK()) {
Throwable exception = status.getException();
if (exception instanceof InvocationTargetException)
throw (InvocationTargetException) exception;
else if (exception instanceof InterruptedException)
throw (InterruptedException) exception;
else // should be OperationCanceledException
throw new InterruptedException(exception.getMessage());
}
}
示例3: ViewSiteRelationsListener
import org.eclipse.jface.operation.IRunnableContext; //导入依赖的package包/类
public ViewSiteRelationsListener(
final IRunnableContext runnableContext,
final IProgressService progressService,
final ILogger logger,
final IJavaModel model,
final IObjectModel<IItem> selectedItemModel,
final IObjectListModel<IItem> selectedItemsModel,
final Label label,
final IDependenciesModel dependenciesModel,
final WritableList<IDependencyRelation> descriptions,
final INameHitMaps nameHitMaps) {
this.runnableContext = runnableContext;
this.logger = logger;
this.progressService = progressService;
this.model = model;
this.selectedItemModel = selectedItemModel;
this.selectedItemsModel = selectedItemsModel;
this.label = label;
this.dependenciesModel = dependenciesModel;
this.descriptions = descriptions;
this.nameHitMaps = nameHitMaps;
}
示例4: internalUpdateDescriptor
import org.eclipse.jface.operation.IRunnableContext; //导入依赖的package包/类
protected CloudSpacesDescriptor internalUpdateDescriptor(String urlText, String userName, String password,
boolean selfSigned, IRunnableContext context, boolean sso, String passcode, String tokenValue) throws CoreException {
String actualURL = CFUiUtil.getUrlFromDisplayText(urlText);
validateCredentialsLocally(actualURL, userName, password, sso, passcode, tokenValue);
if (spacesDescriptor == null) {
CloudOrgsAndSpaces orgsAndSpaces = CFUiUtil.getCloudSpaces(cloudServer, userName, password, actualURL, true,
selfSigned, context, sso, passcode, tokenValue);
if (orgsAndSpaces != null) {
spacesDescriptor = new CloudSpacesDescriptor(orgsAndSpaces, userName, password, actualURL, selfSigned);
}
}
return spacesDescriptor;
}
示例5: getValidationEvent
import org.eclipse.jface.operation.IRunnableContext; //导入依赖的package包/类
/**
* Examines the given event to determine if validation should occur. If so,
* it will generate a separate Validation event after the validation has
* been completed.
* <p/>
* Returns null if the incoming event does NOT trigger a validation
* operation.
* <p/>
* Validation can only occur if the incoming event is {@link IStatus#OK}.
* <p/>
* Otherwise, if there is an issue indicated by the incoming event status,
* that should be resolved first before validation can occur (e.g. missing
* password, invalid server URL, invalid space selection, etc..)
* @param event
* @return Validation event IFF the incoming event triggers a validation
* operation. Otherwise, return null. It does NOT return the original event.
*/
protected PartChangeEvent getValidationEvent(PartChangeEvent event) {
// Do not validate if the incoming event is NOT OK.
if (event.getStatus() == null || !event.getStatus().isOK()) {
return null;
}
int eventType = event.getType();
IRunnableContext context = event.getData() instanceof IRunnableContext ? (IRunnableContext) event.getData()
: null;
ValidationStatus validationStatus = validate(context, eventType);
PartChangeEvent validationEvent = null;
if (validationStatus instanceof IAdaptable) {
validationEvent = (PartChangeEvent) ((IAdaptable) validationStatus).getAdapter(PartChangeEvent.class);
}
else {
validationEvent = new PartChangeEvent(null, validationStatus != null ? validationStatus.getStatus() : null,
new EventSource<ValidationEventHandler>(this), ValidationEvents.VALIDATION);
}
return validationEvent;
}
示例6: validateCredentials
import org.eclipse.jface.operation.IRunnableContext; //导入依赖的package包/类
/**
* Validates the given credentials. Throws {@link CoreException} if error
* occurred during validation.
* @param userName
* @param password
* @param urlText
* @param displayURL
* @param selfSigned true if its a server using self-signed certificate. If
* this information is not known, set this to false
* @param context
*
* @throws CoreException if validation failed and error type cannot be
* determined
* @throws OperationCanceledException if validation is cancelled.
*/
public static void validateCredentials(final CloudFoundryServer cfServer, final String userName, final String password, final String urlText,
final boolean displayURL, final boolean selfSigned, IRunnableContext context) throws CoreException,
OperationCanceledException {
try {
ICoreRunnable coreRunner = new ICoreRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
String url = urlText;
if (displayURL) {
url = getUrlFromDisplayText(urlText);
}
CloudFoundryServerBehaviour.validate(cfServer, url, userName, password, selfSigned, false, null, null, monitor);
}
};
if (context != null) {
runForked(coreRunner, context);
}
else {
runForked(coreRunner);
}
}
catch (CoreException ce) {
throw CloudErrorUtil.checkSSLPeerUnverifiedException(ce);
}
}
示例7: validateSsoCredentials
import org.eclipse.jface.operation.IRunnableContext; //导入依赖的package包/类
public static void validateSsoCredentials(final CloudFoundryServer cfServer, final String urlText,
final boolean displayURL, final boolean selfSigned, IRunnableContext context,
final String passcode, final String tokenValue) throws CoreException,
OperationCanceledException {
try {
ICoreRunnable coreRunner = new ICoreRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
String url = urlText;
if (displayURL) {
url = getUrlFromDisplayText(urlText);
}
CloudFoundryServerBehaviour.validate(cfServer, url, null, null, selfSigned, true, passcode, tokenValue, monitor);
}
};
if (context != null) {
runForked(coreRunner, context);
}
else {
runForked(coreRunner);
}
}
catch (CoreException ce) {
throw CloudErrorUtil.checkSSLPeerUnverifiedException(ce);
}
}
示例8: checkInitialConditions
import org.eclipse.jface.operation.IRunnableContext; //导入依赖的package包/类
/**
* CHANGED to protected
* CHANGED do not fork as we are keeping the resource lock.
*/
protected RefactoringStatus checkInitialConditions(Refactoring refactoring, Shell parent, String title,
IRunnableContext context) throws InterruptedException {
try {
CheckConditionsOperation cco = new CheckConditionsOperation(refactoring,
CheckConditionsOperation.INITIAL_CONDITONS);
WorkbenchRunnableAdapter workbenchRunnableAdapter = new WorkbenchRunnableAdapter(cco, ResourcesPlugin
.getWorkspace().getRoot());
/* CHANGE: don't fork (or use busyCursorWhile) as this will cause a deadlock */
if (context == null) {
PlatformUI.getWorkbench().getProgressService().run(false, true, workbenchRunnableAdapter);
} else if (context instanceof IProgressService) {
((IProgressService) context).run(false, true, workbenchRunnableAdapter);
} else {
context.run(false, true, workbenchRunnableAdapter);
}
return cco.getStatus();
} catch (InvocationTargetException e) {
ExceptionHandler.handle(e, parent, title, RefactoringUIMessages.RefactoringUI_open_unexpected_exception);
return RefactoringStatus
.createFatalErrorStatus(RefactoringUIMessages.RefactoringUI_open_unexpected_exception);
}
}
示例9: validateCredentials
import org.eclipse.jface.operation.IRunnableContext; //导入依赖的package包/类
/**
* Validates the given credentials. Throws {@link CoreException} if error
* occurred during validation.
* @param userName
* @param password
* @param urlText
* @param displayURL
* @param selfSigned true if its a server using self-signed certificate. If
* this information is not known, set this to false
* @param context
*
* @throws CoreException if validation failed and error type cannot be
* determined
* @throws OperationCanceledException if validation is cancelled.
*/
public static void validateCredentials(final DockerFoundryServer cfServer, final String userName, final String password, final String urlText,
final boolean displayURL, final boolean selfSigned, IRunnableContext context) throws CoreException,
OperationCanceledException {
try {
ICoreRunnable coreRunner = new ICoreRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
String url = urlText;
if (displayURL) {
url = getUrlFromDisplayText(urlText);
}
DockerFoundryServerBehaviour.validate(cfServer, url, userName, password, selfSigned, monitor);
}
};
if (context != null) {
runForked(coreRunner, context);
}
else {
runForked(coreRunner);
}
}
catch (CoreException ce) {
ce.printStackTrace();
}
}
示例10: runSearchInForeground
import org.eclipse.jface.operation.IRunnableContext; //导入依赖的package包/类
public IStatus runSearchInForeground(
IRunnableContext context, final ISearchQuery query, Object view) {
if (isQueryRunning(query)) {
return Status.CANCEL_STATUS;
}
// // prepare view
// if (view == null) {
// getSearchViewManager().activateSearchView(true);
// } else {
// getSearchViewManager().activateSearchView(view);
// }
addQuery(query);
SearchJobRecord sjr = new SearchJobRecord(query);
fSearchJobs.put(query, sjr);
//
// if (context == null)
// context= new ProgressMonitorDialog(null);
return doRunSearchInForeground(sjr, context);
}
示例11: run
import org.eclipse.jface.operation.IRunnableContext; //导入依赖的package包/类
public boolean run(Shell parent) throws InterruptedException, InvocationTargetException {
Refactoring ref= new MoveRefactoring(fMoveProcessor);
if (fMoveProcessor.hasAllInputSet()) {
IRunnableContext context= PlatformUI.getWorkbench().getActiveWorkbenchWindow();
fMoveProcessor.setCreateTargetQueries(new CreateTargetQueries(parent));
fMoveProcessor.setReorgQueries(new ReorgQueries(parent));
new RefactoringExecutionHelper(ref, RefactoringCore.getConditionCheckingFailedSeverity(), fMoveProcessor.getSaveMode(), parent, context).perform(false, false);
return true;
} else {
RefactoringWizard wizard= new ReorgMoveWizard(fMoveProcessor, ref);
/*
* We want to get the shell from the refactoring dialog but it's not known at this point,
* so we pass the wizard and then, once the dialog is open, we will have access to its shell.
*/
fMoveProcessor.setCreateTargetQueries(new CreateTargetQueries(wizard));
fMoveProcessor.setReorgQueries(new ReorgQueries(wizard));
return new RefactoringStarter().activate(wizard, parent, RefactoringMessages.OpenRefactoringWizardAction_refactoring, fMoveProcessor.getSaveMode());
}
}
示例12: doBrowseTypes
import org.eclipse.jface.operation.IRunnableContext; //导入依赖的package包/类
private void doBrowseTypes() {
IRunnableContext context= new BusyIndicatorRunnableContext();
IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
int style= IJavaElementSearchConstants.CONSIDER_ALL_TYPES;
try {
SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), context, scope, style, false, fNameDialogField.getText());
dialog.setTitle(PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_title);
dialog.setMessage(PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_description);
if (dialog.open() == Window.OK) {
IType res= (IType) dialog.getResult()[0];
fNameDialogField.setText(res.getFullyQualifiedName('.'));
}
} catch (JavaModelException e) {
ExceptionHandler.handle(e, getShell(), PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_title, PreferencesMessages.ImportOrganizeInputDialog_ChooseTypeDialog_error_message);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:17,代码来源:ImportOrganizeInputDialog.java
示例13: perform
import org.eclipse.jface.operation.IRunnableContext; //导入依赖的package包/类
/**
* Executes the rename refactoring without showing a dialog to gather
* additional user input (for example the new name of the <tt>IJavaElement</tt>).
* Only an error dialog is shown (if necessary) to present the result
* of the refactoring's full precondition checking.
* <p>
* The method has to be called from within the UI thread.
* </p>
*
* @param parent a shell used as a parent for the error dialog.
* @param context a {@link IRunnableContext} to execute the operation.
*
* @throws InterruptedException if the operation has been canceled by the
* user.
* @throws InvocationTargetException if an error occurred while executing the
* operation.
*
* @see #openDialog(Shell)
* @see IRunnableContext#run(boolean, boolean, org.eclipse.jface.operation.IRunnableWithProgress)
*/
public void perform(Shell parent, IRunnableContext context) throws InterruptedException, InvocationTargetException {
try {
ensureChecked();
if (fPreCheckStatus.hasFatalError()) {
showInformation(parent, fPreCheckStatus);
return;
}
RenameSelectionState state= createSelectionState();
RefactoringExecutionHelper helper= new RefactoringExecutionHelper(fRefactoring,
RefactoringCore.getConditionCheckingFailedSeverity(),
getJavaRenameProcessor().getSaveMode(),
parent,
context);
helper.perform(true, true);
restoreSelectionState(state);
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
}
示例14: doBrowseTypes
import org.eclipse.jface.operation.IRunnableContext; //导入依赖的package包/类
/**
* Creates the type hierarchy for type selection.
*/
private void doBrowseTypes() {
IRunnableContext context= new BusyIndicatorRunnableContext();
IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
int style= IJavaElementSearchConstants.CONSIDER_ALL_TYPES;
try {
SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), context, scope, style, false, fNameDialogField.getText());
dialog.setTitle(CallHierarchyMessages.CallHierarchyTypesOrMembersDialog_ChooseTypeDialog_title);
dialog.setMessage(CallHierarchyMessages.CallHierarchyTypesOrMembersDialog_ChooseTypeDialog_description);
if (dialog.open() == Window.OK) {
IType res= (IType)dialog.getResult()[0];
fNameDialogField.setText(res.getFullyQualifiedName('.'));
}
} catch (JavaModelException e) {
ExceptionHandler.handle(e, getShell(), CallHierarchyMessages.CallHierarchyTypesOrMembersDialog_ChooseTypeDialog_title,
CallHierarchyMessages.CallHierarchyTypesOrMembersDialog_ChooseTypeDialog_error_message);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:21,代码来源:ExpandWithConstructorsConfigurationBlock.java
示例15: getSelectedElementsWithoutContainedChildren
import org.eclipse.jface.operation.IRunnableContext; //导入依赖的package包/类
public static Object[] getSelectedElementsWithoutContainedChildren(ILaunchConfiguration launchconfig, JarPackageData data, IRunnableContext context, MultiStatus status) throws CoreException {
if (launchconfig == null)
return new Object[0];
String projectName= launchconfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
IPath[] classpath= getClasspath(launchconfig);
IPackageFragmentRoot[] classpathResources= getRequiredPackageFragmentRoots(classpath, projectName, status);
String mainClass= getMainClass(launchconfig, status);
IType mainType= findMainMethodByName(mainClass, classpathResources, context);
if (mainType == null) {
status.add(new Status(IStatus.ERROR, JavaUI.ID_PLUGIN, FatJarPackagerMessages.FatJarPackageWizardPage_error_noMainMethod));
}
data.setManifestMainClass(mainType);
return classpathResources;
}