Search in sources :

Example 1 with WorkbenchRunnableAdapter

use of org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter in project eclipse.platform.runtime by eclipse.

the class ConvertMessageBundleAction method run.

@Override
public void run(IAction action) {
    if (fAccessorUnit == null)
        return;
    try {
        final GotoResourceAction pAction = new GotoResourceAction(fPart);
        IRunnableWithProgress runnable = new IRunnableWithProgress() {

            @Override
            public void run(IProgressMonitor monitor) {
                pAction.run();
            }
        };
        PlatformUI.getWorkbench().getProgressService().run(false, false, runnable);
        IFile propertiesFile = (IFile) pAction.getResource();
        if (propertiesFile == null)
            return;
        MessageBundleRefactoring refactoring = new MessageBundleRefactoring(fAccessorUnit.getTypes()[0], propertiesFile);
        PerformRefactoringOperation op = new PerformRefactoringOperation(refactoring, CheckConditionsOperation.ALL_CONDITIONS);
        PlatformUI.getWorkbench().getProgressService().run(false, false, new WorkbenchRunnableAdapter(op));
    } catch (CoreException e) {
        throw new RuntimeException(e);
    } catch (InterruptedException e) {
        throw new RuntimeException(e);
    } catch (InvocationTargetException e) {
        throw new RuntimeException(e);
    }
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IFile(org.eclipse.core.resources.IFile) CoreException(org.eclipse.core.runtime.CoreException) WorkbenchRunnableAdapter(org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter) PerformRefactoringOperation(org.eclipse.ltk.core.refactoring.PerformRefactoringOperation) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 2 with WorkbenchRunnableAdapter

use of org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter in project eclipse.platform.runtime by eclipse.

the class RemoveUnusedMessagesAction method run.

@Override
public void run(IAction action) {
    if (fAccessorUnit == null)
        return;
    try {
        final GotoResourceAction pAction = new GotoResourceAction(fPart);
        IRunnableWithProgress runnable = new IRunnableWithProgress() {

            @Override
            public void run(IProgressMonitor monitor) {
                pAction.run();
            }
        };
        PlatformUI.getWorkbench().getProgressService().run(false, false, runnable);
        IFile propertiesFile = (IFile) pAction.getResource();
        if (propertiesFile == null)
            return;
        RemoveUnusedMessages refactoring = new RemoveUnusedMessages(fAccessorUnit.getTypes()[0], propertiesFile);
        PerformRefactoringOperation op = new PerformRefactoringOperation(refactoring, CheckConditionsOperation.ALL_CONDITIONS);
        PlatformUI.getWorkbench().getProgressService().run(false, true, new WorkbenchRunnableAdapter(op));
    } catch (CoreException e) {
        throw new RuntimeException(e);
    } catch (InterruptedException e) {
        throw new RuntimeException(e);
    } catch (InvocationTargetException e) {
        throw new RuntimeException(e);
    }
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IFile(org.eclipse.core.resources.IFile) CoreException(org.eclipse.core.runtime.CoreException) WorkbenchRunnableAdapter(org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter) PerformRefactoringOperation(org.eclipse.ltk.core.refactoring.PerformRefactoringOperation) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)2 IFile (org.eclipse.core.resources.IFile)2 CoreException (org.eclipse.core.runtime.CoreException)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 WorkbenchRunnableAdapter (org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter)2 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)2 PerformRefactoringOperation (org.eclipse.ltk.core.refactoring.PerformRefactoringOperation)2