Java Code Examples for org.eclipse.jface.operation.IRunnableWithProgress

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project bndtools, under directory /bndtools.core/src/bndtools/internal/testcaseselection/.

Source file: JavaSearchScopeTestCaseLister.java

  22 
vote

public void search(List<String> types,final List<IJavaElement> testCaseList) throws TestCaseListException {
  IRunnableWithProgress operation=new SearchOperation(types,testCaseList,scope);
  try {
    runContext.run(true,true,operation);
  }
 catch (  InvocationTargetException e) {
    throw new TestCaseListException(e.getCause());
  }
catch (  InterruptedException e) {
    throw new TestCaseListException(Messages.JavaSearchScopeTestCaseLister_2);
  }
}
 

Example 2

From project Eclipse, under directory /com.mobilesorcery.sdk.deployment/src/com/mobilesorcery/sdk/deployment/internal/ui/ftp/.

Source file: FTPDeploymentWizard.java

  22 
vote

public boolean performFinish(){
  IRunnableWithProgress deploymentRunnable=new DeploymentRunnable(project,deploymentPage.getStrategy(),assignProfilesPage.getDeviceFilter(),addToDeployFilePage.getDeployFile());
  try {
    getContainer().run(true,true,deploymentRunnable);
  }
 catch (  Exception e) {
    Policy.getStatusHandler().show(new Status(IStatus.ERROR,DeploymentPlugin.PLUGIN_ID,e.getMessage()),"Could not deploy application");
    return false;
  }
  return true;
}
 

Example 3

From project eclipsefp, under directory /net.sf.eclipsefp.haskell.ui/src/net/sf/eclipsefp/haskell/ui/internal/wizards/.

Source file: ProjectCreationWizard.java

  22 
vote

private IRunnableWithProgress configureOperation(){
  operation.setProjectName(page.getProjectName());
  operation.setProjectLocation(page.getProjectLocationPath().toString());
  IRunnableWithProgress rwp=new IRunnableWithProgress(){
    public void run(    final IProgressMonitor monitor){
      operation.run(monitor);
    }
  }
;
  return rwp;
}
 

Example 4

From project libra, under directory /plugins/org.eclipse.libra.facet.ui/src/org/eclipse/libra/facet/ui/wizards/.

Source file: ConvertProjectsToBundlesWizard.java

  22 
vote

public boolean performFinish(){
  IProject[] projects=mainPage.getProjects();
  IRunnableWithProgress convertOperation=new ConvertProjectsToBundlesOperation(projects);
  try {
    getContainer().run(false,true,convertOperation);
  }
 catch (  InvocationTargetException e) {
    e.printStackTrace();
  }
catch (  InterruptedException e) {
    e.printStackTrace();
  }
  return true;
}
 

Example 5

From project BPMN2-Editor-for-Eclipse, under directory /org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/.

Source file: BPMN2DiagramWizard.java

  21 
vote

/** 
 * This method is called when 'Finish' button is pressed in the wizard. We will create an operation and run it using wizard as execution context.
 */
@Override public boolean performFinish(){
  final String fileName=page.getFileName();
  final IResource container=page.getDiagramContainer();
  IRunnableWithProgress op=new IRunnableWithProgress(){
    @Override public void run(    IProgressMonitor monitor) throws InvocationTargetException {
      try {
        IPath path=container.getFullPath().append(fileName);
        IFolder folder=null;
        BPMN2DiagramCreator factory=new BPMN2DiagramCreator();
        folder=BPMN2DiagramCreator.getTempFolder(path);
        factory.setDiagramFile(BPMN2DiagramCreator.getTempFile(path,folder));
        factory.setDiagramFolder(folder);
        factory.createDiagram();
      }
 catch (      CoreException e) {
        throw new InvocationTargetException(e);
      }
 finally {
        monitor.done();
      }
    }
  }
;
  try {
    getContainer().run(true,false,op);
  }
 catch (  InterruptedException e) {
    return false;
  }
catch (  InvocationTargetException e) {
    Throwable realException=e.getTargetException();
    MessageDialog.openError(getShell(),"Error",realException.getMessage());
    return false;
  }
  return true;
}
 

Example 6

From project bundlemaker, under directory /main/org.bundlemaker.core.ui/src/org/bundlemaker/core/ui/handler/exporter/.

Source file: AbstractExportHandler.java

  21 
vote

/** 
 * Executes the given exporter on a non-UI thread. The user gets feedback via ProgressMonitor
 * @param exporter
 * @param modularizedSystem
 * @param exporterContext
 * @throws Exception
 */
protected void doExport(final ModularizedSystemExporterAdapter adapter,final IModularizedSystem modularizedSystem,final IModuleExporterContext exporterContext) throws Exception {
  PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress(){
    @Override public void run(    final IProgressMonitor monitor) throws InvocationTargetException {
      try {
        doExport(monitor,adapter,modularizedSystem,exporterContext);
      }
 catch (      Exception ex) {
        throw new InvocationTargetException(ex);
      }
    }
  }
);
}
 

Example 7

From project ceylon-ide-eclipse, under directory /plugins/com.redhat.ceylon.eclipse.ui/src/com/redhat/ceylon/eclipse/code/wizard/.

Source file: NewCeylonProjectWizardPageTwo.java

  21 
vote

/** 
 * Removes the provisional project. The provisional project is typically removed when the user cancels the wizard or goes back to the first page.
 */
protected void removeProvisonalProject(){
  if (!fCurrProject.exists()) {
    fCurrProject=null;
    return;
  }
  IRunnableWithProgress op=new IRunnableWithProgress(){
    public void run(    IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
      doRemoveProject(monitor);
    }
  }
;
  try {
    getContainer().run(true,true,new WorkspaceModifyDelegatingOperation(op));
  }
 catch (  InvocationTargetException e) {
    final String title=NewWizardMessages.NewJavaProjectWizardPageTwo_error_remove_title;
    final String message=NewWizardMessages.NewJavaProjectWizardPageTwo_error_remove_message;
    ExceptionHandler.handle(e,getShell(),title,message);
  }
catch (  InterruptedException e) {
  }
}
 

Example 8

From project dawn-common, under directory /org.dawb.common.ui/src/org/dawb/common/ui/project/.

Source file: DADWizard.java

  21 
vote

/** 
 * This method is called when 'Finish' button is pressed in the wizard. We will create an operation and run it using wizard as execution context.
 */
public boolean performFinish(){
  final IContainer container=page.getProjectContainer();
  final String seqName=page.getSequenceName();
  IRunnableWithProgress op=new IRunnableWithProgress(){
    public void run(    IProgressMonitor monitor) throws InvocationTargetException {
      try {
        doFinish(container,seqName,monitor);
      }
 catch (      Exception e) {
        throw new InvocationTargetException(e);
      }
 finally {
        monitor.done();
      }
    }
  }
;
  try {
    getContainer().run(true,false,op);
  }
 catch (  InterruptedException e) {
    return false;
  }
catch (  InvocationTargetException e) {
    Throwable realException=e.getTargetException();
    MessageDialog.openError(getShell(),"Error",realException.getMessage());
    return false;
  }
  return true;
}
 

Example 9

From project dawn-isenciaui, under directory /com.teaminabox.eclipse.wiki/src/com/teaminabox/eclipse/wiki/export/.

Source file: WikiExportWizard.java

  21 
vote

@Override public boolean performFinish(){
  persistExportProperties();
  return runOperationInContainer(new IRunnableWithProgress(){
    public void run(    final IProgressMonitor monitor) throws InvocationTargetException {
      doExport(monitor);
    }
  }
);
}
 

Example 10

From project dawn-ui, under directory /org.dawb.workbench.ui/src/org/dawb/workbench/ui/project/.

Source file: DataNewProjectWizard.java

  21 
vote

/** 
 * This method is called when 'Finish' button is pressed in the wizard. We will create an operation and run it using wizard as execution context.
 */
public boolean performFinish(){
  final String projectName=page.getProjectName();
  final boolean examples=page.isExamples();
  IRunnableWithProgress op=new IRunnableWithProgress(){
    public void run(    IProgressMonitor monitor) throws InvocationTargetException {
      try {
        doFinish(projectName,examples,monitor);
      }
 catch (      CoreException e) {
        throw new InvocationTargetException(e);
      }
 finally {
        monitor.done();
      }
    }
  }
;
  try {
    getContainer().run(true,false,op);
  }
 catch (  InterruptedException e) {
    return false;
  }
catch (  InvocationTargetException e) {
    Throwable realException=e.getTargetException();
    MessageDialog.openError(getShell(),"Error",realException.getMessage());
    return false;
  }
  return true;
}
 

Example 11

From project dawn-workflow, under directory /org.dawb.passerelle.common/src/org/dawb/passerelle/common/project/.

Source file: PasserelleNewProjectWizard.java

  21 
vote

/** 
 * This method is called when 'Finish' button is pressed in the wizard. We will create an operation and run it using wizard as execution context.
 */
public boolean performFinish(){
  final String projectName=page.getProjectName();
  final boolean isExamples=page.isExamples();
  IRunnableWithProgress op=new IRunnableWithProgress(){
    public void run(    IProgressMonitor monitor) throws InvocationTargetException {
      try {
        doFinish(projectName,isExamples,monitor);
      }
 catch (      CoreException e) {
        throw new InvocationTargetException(e);
      }
 finally {
        monitor.done();
      }
    }
  }
;
  try {
    getContainer().run(true,false,op);
  }
 catch (  InterruptedException e) {
    return false;
  }
catch (  InvocationTargetException e) {
    Throwable realException=e.getTargetException();
    MessageDialog.openError(getShell(),"Error",realException.getMessage());
    return false;
  }
  return true;
}
 

Example 12

From project Diver, under directory /ca.uvic.chisel.javasketch/src/ca/uvic/chisel/javasketch/.

Source file: SketchPlugin.java

  21 
vote

/** 
 * Sets the active sketch to the given sketch. May be null.
 * @param sketch the new active sketch. May be null.
 */
public synchronized void setActiveSketch(final IProgramSketch sketch){
  IProgramSketch activeSketch=doi.getActiveSketch();
  if (doi.getActiveSketch() != null) {
    if (activeSketch.getTraceData() != null) {
      activeSketch.getTraceData().removeListener(staticJavaModelListener);
    }
  }
  try {
    IRunnableWithProgress runnable=new IRunnableWithProgress(){
      @Override public void run(      IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
        doi.setActiveSketch(sketch,monitor);
        if (sketch != null) {
          sketch.getTraceData().addListener(staticJavaModelListener);
        }
        SketchUI.INSTANCE.refreshJavaUI();
      }
    }
;
    if (Display.getCurrent() != null) {
      getWorkbench().getProgressService().busyCursorWhile(runnable);
    }
 else {
      runnable.run(new NullProgressMonitor());
    }
  }
 catch (  InterruptedException e) {
  }
catch (  Exception e) {
    log(e);
    doi.setActiveSketch(null,new NullProgressMonitor());
    SketchUI.INSTANCE.refreshJavaUI();
  }
}
 

Example 13

From project dolphin, under directory /com.sysdeo.eclipse.tomcat/src/com/sysdeo/eclipse/tomcat/.

Source file: TomcatProjectCreationWizard.java

  21 
vote

public boolean performFinish(){
  IRunnableWithProgress op=new WorkspaceModifyDelegatingOperation(fJavaPage.getRunnable());
  try {
    getContainer().run(false,true,op);
    TomcatProject.addTomcatNature(fJavaPage.getNewJavaProject());
    TomcatProject tomcatPrj=TomcatProject.create(fJavaPage.getNewJavaProject());
    tomcatPrj.setWebPath(fTomcatPage.getWebpath());
    tomcatPrj.setUpdateXml(fTomcatPage.getUpdateXml());
    tomcatPrj.setRootDir(fTomcatPage.getRootDir());
    tomcatPrj.saveProperties();
    tomcatPrj.fullConfiguration();
  }
 catch (  InvocationTargetException e) {
    String title=NewWizardMessages.JavaProjectWizard_op_error_title;
    String message=NewWizardMessages.JavaProjectWizard_op_error_create_message;
    ExceptionHandler.handle(e,getShell(),title,message);
    return false;
  }
catch (  InterruptedException e) {
    return false;
  }
catch (  CoreException e) {
    return false;
  }
catch (  IOException e) {
    return false;
  }
  BasicNewProjectResourceWizard.updatePerspective(fConfigElement);
  selectAndReveal(fJavaPage.getNewJavaProject().getProject());
  return true;
}
 

Example 14

From project eclipse-integration-cloudfoundry, under directory /org.cloudfoundry.ide.eclipse.server.ui/src/org/cloudfoundry/ide/eclipse/internal/server/ui/.

Source file: CloudUiUtil.java

  21 
vote

public static IStatus runForked(final ICoreRunnable coreRunner,IWizard wizard){
  try {
    IRunnableWithProgress runner=new IRunnableWithProgress(){
      public void run(      final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
        try {
          coreRunner.run(monitor);
        }
 catch (        Exception e) {
          throw new InvocationTargetException(e);
        }
 finally {
          monitor.done();
        }
      }
    }
;
    wizard.getContainer().run(true,false,runner);
  }
 catch (  InvocationTargetException e) {
    IStatus status;
    if (e.getCause() instanceof CoreException) {
      status=new Status(IStatus.ERROR,CloudFoundryServerUiPlugin.PLUGIN_ID,NLS.bind("The operation failed: {0}",e.getCause().getMessage()),e);
    }
 else {
      status=new Status(IStatus.ERROR,CloudFoundryServerUiPlugin.PLUGIN_ID,NLS.bind("Unexpected error: {0}",e.getMessage()),e);
    }
    CloudFoundryServerUiPlugin.getDefault().getLog().log(status);
    IWizardPage page=wizard.getContainer().getCurrentPage();
    if (page instanceof DialogPage) {
      ((DialogPage)page).setErrorMessage(status.getMessage());
    }
    return status;
  }
catch (  InterruptedException e) {
    return Status.CANCEL_STATUS;
  }
  return Status.OK_STATUS;
}
 

Example 15

From project eclipse-integration-commons, under directory /org.springsource.ide.eclipse.commons.ui/src/org/springsource/ide/eclipse/commons/ui/.

Source file: UiUtil.java

  21 
vote

public static void busyCursorWhile(final ICoreRunnable coreRunner) throws OperationCanceledException, CoreException {
  try {
    IRunnableWithProgress runner=new IRunnableWithProgress(){
      public void run(      final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
        try {
          coreRunner.run(monitor);
        }
 catch (        CoreException e) {
          throw new InvocationTargetException(e);
        }
 finally {
          monitor.done();
        }
      }
    }
;
    PlatformUI.getWorkbench().getProgressService().busyCursorWhile(runner);
  }
 catch (  InvocationTargetException e) {
    if (e.getCause() instanceof CoreException) {
      throw (CoreException)e.getCause();
    }
 else {
      StatusHandler.log(new Status(IStatus.ERROR,UiPlugin.PLUGIN_ID,"Unexpected exception",e));
    }
  }
catch (  InterruptedException e) {
    throw new OperationCanceledException();
  }
}
 

Example 16

From project eclipse.platform.runtime, under directory /bundles/org.eclipse.core.tools/src/org/eclipse/core/tools/nls/.

Source file: ConvertMessageBundleAction.java

  21 
vote

public void run(IAction action){
  if (fAccessorUnit == null)   return;
  try {
    final GotoResourceAction pAction=new GotoResourceAction(fPart);
    IRunnableWithProgress runnable=new IRunnableWithProgress(){
      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);
  }
}
 

Example 17

From project Foglyn, under directory /com.foglyn.ui/src/com/foglyn/ui/.

Source file: FoglynAdvancedSearchPage.java

  21 
vote

private void initializePage(IRunnableContext runnableContext){
  final FoglynRepositoryConnector connector=(FoglynRepositoryConnector)TasksUi.getRepositoryManager().getRepositoryConnector(FoglynCorePlugin.CONNECTOR_KIND);
  final AtomicReference<FogBugzClient> clientRef=new AtomicReference<FogBugzClient>(null);
  try {
    IRunnableWithProgress runnable=new IRunnableWithProgress(){
      public void run(      IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
        try {
          monitor.beginTask("Fetching repository details",IProgressMonitor.UNKNOWN);
          FogBugzClient client=connector.getClientManager().getFogbugzClient(getTaskRepository(),monitor);
          clientRef.set(client);
          monitor.done();
        }
 catch (        CoreException e) {
          throw new InvocationTargetException(e,e.getMessage());
        }
      }
    }
;
    runnableContext.run(true,true,runnable);
  }
 catch (  InvocationTargetException e) {
    FoglynUIPlugin.log("Cannot fetch repository data from FogBugz",e);
    setErrorMessage("Cannot fetch repository data from FogBugz");
  }
catch (  InterruptedException e) {
    FoglynUIPlugin.log("Cannot fetch repository data from FogBugz",e);
    setErrorMessage("Cannot fetch repository data from FogBugz");
  }
  FogBugzClient client=clientRef.get();
  if (client != null) {
    setupComponentsFromClient(client);
  }
  if (inSearchContainer()) {
    restoreState();
  }
 else   if (initialQuery != null) {
    setupComponentsFromInitialQuery();
  }
}
 

Example 18

From project mylyn-mantis, under directory /com.itsolut.mantis.ui/src/com/itsolut/mantis/ui/util/.

Source file: MantisUIUtil.java

  21 
vote

public static void updateRepositoryConfiguration(IRunnableContext container,TaskRepository repository,IMantisClientManager clientManager){
  final IMantisClient client;
  try {
    client=clientManager.getRepository(repository);
  }
 catch (  MantisException e) {
    MantisUIPlugin.handleError(e,"Failed getting the repository.",true);
    return;
  }
  try {
    IRunnableWithProgress runnable=new IRunnableWithProgress(){
      public void run(      IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
        try {
          client.updateAttributes(monitor);
        }
 catch (        MantisException e) {
          throw new InvocationTargetException(e);
        }
      }
    }
;
    if (container != null)     container.run(true,true,runnable);
 else     PlatformUI.getWorkbench().getProgressService().busyCursorWhile(runnable);
  }
 catch (  InvocationTargetException e) {
    MantisUIPlugin.handleError(e,"Failed updating the repository attributes.",true);
    return;
  }
catch (  InterruptedException e) {
    Thread.currentThread().interrupt();
    return;
  }
}
 

Example 19

From project mylyn.incubator, under directory /org.eclipse.mylyn.sandbox.tests/src/org/eclipse/mylyn/monitor/usage/tests/.

Source file: InteractionEventLoggerTest.java

  21 
vote

private void runWith(final File monitorFile) throws InvocationTargetException, InterruptedException {
  ProgressMonitorDialog dialog=new ProgressMonitorDialog(Display.getCurrent().getActiveShell());
  dialog.run(true,true,new IRunnableWithProgress(){
    public void run(    IProgressMonitor monitor){
      monitor.beginTask("Running test job",1);
      InteractionEventLogger l=new InteractionEventLogger(null);
      l.getHistoryFromFile(monitorFile,new SubProgressMonitor(monitor,1));
      monitor.done();
    }
  }
);
}
 

Example 20

From project org.openscada.orilla, under directory /org.openscada.da.client.test/src/org/openscada/da/client/test/wizards/.

Source file: WriteAttributesOperationWizard.java

  21 
vote

@Override public boolean performFinish(){
  final Item item=this.page.getItem();
  final Map<String,Variant> attributes=this.page.getAttributes();
  final IRunnableWithProgress op=new IRunnableWithProgress(){
    @Override public void run(    final IProgressMonitor monitor) throws InvocationTargetException {
      try {
        doFinish(monitor,item,attributes);
      }
 catch (      final Exception e) {
        throw new InvocationTargetException(e);
      }
 finally {
        monitor.done();
      }
    }
  }
;
  try {
    getContainer().run(true,true,op);
  }
 catch (  final InterruptedException e) {
    return false;
  }
catch (  final InvocationTargetException e) {
    final Throwable realException=e.getTargetException();
    MessageDialog.openError(getShell(),Messages.getString("WriteAttributesOperationWizard.WriteError_Title"),realException.getMessage());
    return false;
  }
  return true;
}
 

Example 21

From project org.openscada.othala, under directory /org.openscada.da.project/src/org/openscada/da/project/wizards/.

Source file: RealtimeListNewWizard.java

  21 
vote

/** 
 * This method is called when 'Finish' button is pressed in the wizard. We will create an operation and run it using wizard as execution context.
 */
public boolean performFinish(){
  final String containerName=this.page.getContainerName();
  final String fileName=this.page.getFileName();
  final IRunnableWithProgress op=new IRunnableWithProgress(){
    public void run(    final IProgressMonitor monitor) throws InvocationTargetException {
      try {
        doFinish(containerName,fileName,monitor);
      }
 catch (      final CoreException e) {
        throw new InvocationTargetException(e);
      }
 finally {
        monitor.done();
      }
    }
  }
;
  try {
    getContainer().run(true,false,op);
  }
 catch (  final InterruptedException e) {
    return false;
  }
catch (  final InvocationTargetException e) {
    final Throwable realException=e.getTargetException();
    MessageDialog.openError(getShell(),"Error",realException.getMessage());
    return false;
  }
  return true;
}
 

Example 22

From project phing-eclipse, under directory /org.ganoro.phing.ui/src/org/ganoro/phing/ui/editors/.

Source file: AntEditorCompletionProcessor.java

  21 
vote

protected ISchema getDtd(){
  if (fgDtd == null) {
    IRunnableWithProgress runnable=new IRunnableWithProgress(){
      public void run(      IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
        try {
          fgDtd=parseDtd();
        }
 catch (        IOException e) {
          PhingUi.log(e);
        }
catch (        ParseError e) {
          PhingUi.log(e);
        }
      }
    }
;
    IProgressService service=PlatformUI.getWorkbench().getProgressService();
    try {
      service.busyCursorWhile(runnable);
    }
 catch (    InvocationTargetException e) {
    }
catch (    InterruptedException e) {
    }
  }
  return fgDtd;
}
 

Example 23

From project radrails, under directory /plugins/com.aptana.ide.editor.erb/src/com/aptana/ide/editor/erb/wizards/.

Source file: ERBNewFileWizard.java

  21 
vote

public boolean performFinish(){
  SimpleNewWizardPage page=(SimpleNewWizardPage)getPages()[0];
  final String containerName=page.getContainerName();
  final String fileName=page.getFileName();
  IRunnableWithProgress op=new IRunnableWithProgress(){
    public void run(    IProgressMonitor monitor) throws InvocationTargetException {
      try {
        doFinish(containerName,fileName,monitor);
      }
 catch (      CoreException e) {
        throw new InvocationTargetException(e);
      }
 finally {
        monitor.done();
      }
    }
  }
;
  try {
    getContainer().run(true,false,op);
  }
 catch (  InterruptedException e) {
    return false;
  }
catch (  InvocationTargetException e) {
    Throwable realException=e.getTargetException();
    MessageDialog.openError(getShell(),com.aptana.ide.editors.wizards.Messages.SimpleNewFileWizard_Error,realException.getMessage());
    return false;
  }
  return true;
}
 

Example 24

From project sketch, under directory /org.eclipse.sketch.examples.shapes.diagram/src/org/eclipse/sketch/examples/shapes/diagram/part/.

Source file: ShapesCreationWizard.java

  21 
vote

/** 
 * @generated
 */
public boolean performFinish(){
  IRunnableWithProgress op=new IRunnableWithProgress(){
    public void run(    IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
      diagram=ShapesDiagramEditorUtil.createDiagram(diagramModelFilePage.getURI(),monitor);
      if (isOpenNewlyCreatedDiagramEditor() && diagram != null) {
        try {
          ShapesDiagramEditorUtil.openDiagram(diagram);
        }
 catch (        PartInitException e) {
          ErrorDialog.openError(getContainer().getShell(),Messages.ShapesCreationWizardOpenEditorError,null,e.getStatus());
        }
      }
    }
  }
;
  try {
    getContainer().run(false,true,op);
  }
 catch (  InterruptedException e) {
    return false;
  }
catch (  InvocationTargetException e) {
    if (e.getTargetException() instanceof CoreException) {
      ErrorDialog.openError(getContainer().getShell(),Messages.ShapesCreationWizardCreationError,null,((CoreException)e.getTargetException()).getStatus());
    }
 else {
      ShapesDiagramEditorPlugin.getInstance().logError("Error creating diagram",e.getTargetException());
    }
    return false;
  }
  return diagram != null;
}
 

Example 25

From project studio2-rcp, under directory /plugins/com.aptana.ide.rcp/src/com/aptana/ide/rcp/.

Source file: IDEWorkbenchAdvisor.java

  21 
vote

/** 
 * Disconnect from the core workspace.
 */
private void disconnectFromWorkspace(){
  final MultiStatus status=new MultiStatus(IDEWorkbenchPlugin.IDE_WORKBENCH,1,IDEWorkbenchMessages.ProblemSavingWorkbench,null);
  IRunnableWithProgress runnable=new IRunnableWithProgress(){
    public void run(    IProgressMonitor monitor){
      try {
        status.merge(ResourcesPlugin.getWorkspace().save(true,monitor));
      }
 catch (      CoreException e) {
        status.merge(e.getStatus());
      }
    }
  }
;
  try {
    new ProgressMonitorJobsDialog(null).run(true,false,runnable);
  }
 catch (  InvocationTargetException e) {
    status.merge(new Status(IStatus.ERROR,IDEWorkbenchPlugin.IDE_WORKBENCH,1,IDEWorkbenchMessages.InternalError,e.getTargetException()));
  }
catch (  InterruptedException e) {
    status.merge(new Status(IStatus.ERROR,IDEWorkbenchPlugin.IDE_WORKBENCH,1,IDEWorkbenchMessages.InternalError,e));
  }
  ErrorDialog.openError(null,IDEWorkbenchMessages.ProblemsSavingWorkspace,null,status,IStatus.ERROR | IStatus.WARNING);
  if (!status.isOK()) {
    IDEWorkbenchPlugin.log(IDEWorkbenchMessages.ProblemsSavingWorkspace,status);
  }
}
 

Example 26

From project sveditor, under directory /sveditor/plugins/net.sf.sveditor.ui/src/net/sf/sveditor/ui/wizards/.

Source file: AbstractNewSVItemFileWizard.java

  21 
vote

@Override public boolean performFinish(){
  IContainer c=SVFileUtils.getWorkspaceFolder(fPage.getOption(AbstractNewSVItemFileWizardPage.SOURCE_FOLDER,null));
  final IFile file_path=c.getFile(new Path(fPage.getOption(AbstractNewSVItemFileWizardPage.FILE_NAME,null)));
  IRunnableWithProgress op=new IRunnableWithProgress(){
    public void run(    IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
      generate(monitor,file_path);
    }
  }
;
  try {
    getContainer().run(false,false,op);
  }
 catch (  Exception e) {
    return false;
  }
  try {
    SVEditorUtil.openEditor("${workspace_loc}/" + file_path.getFullPath());
  }
 catch (  PartInitException e) {
    e.printStackTrace();
  }
  return true;
}
 

Example 27

From project texlipse, under directory /net.sourceforge.texlipse/source/net/sourceforge/texlipse/wizards/.

Source file: TexlipseProjectCreationWizard.java

  21 
vote

/** 
 * Finish the project creation, i.e. run the ProjectCreationOperation.
 * @return false on error
 */
public boolean performFinish(){
  TexlipseProjectCreationOperation runnable=new TexlipseProjectCreationOperation(attributes);
  IRunnableWithProgress op=new WorkspaceModifyDelegatingOperation(runnable);
  boolean result=true;
  try {
    getContainer().run(false,true,op);
  }
 catch (  InterruptedException e) {
    result=false;
  }
catch (  InvocationTargetException e) {
    handleTargetException(e.getTargetException());
    result=false;
  }
  BasicNewProjectResourceWizard.updatePerspective(configElement);
  return result;
}
 

Example 28

From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.elasticbeanstalk/src/com/amazonaws/eclipse/elasticbeanstalk/server/ui/.

Source file: ImportEnvironmentsWizard.java

  20 
vote

@Override public boolean performFinish(){
  try {
    getContainer().run(true,false,new IRunnableWithProgress(){
      public void run(      IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
        monitor.beginTask("Importing servers",toImport.length * 3);
        try {
          for (          Object elasticBeanstalkEnv : toImport) {
            try {
              ElasticBeanstalkPlugin.importEnvironment((EnvironmentDescription)elasticBeanstalkEnv,monitor);
            }
 catch (            CoreException e) {
              throw new RuntimeException(e);
            }
          }
        }
  finally {
          monitor.done();
        }
      }
    }
);
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
  return true;
}
 

Example 29

From project dawn-tango, under directory /org.dawb.tango.extensions/src/org/dawb/tango/extensions/editors/.

Source file: MultiScanEditor.java

  20 
vote

/** 
 * @param selections - takes copy and possibly modifies it
 */
protected void updatePlot(final List<AbstractDataset> sel){
  if (doingUpdate)   return;
  try {
    doingUpdate=true;
    if (sel == null || sel.size() < 1) {
      plottingSystem.reset();
      return;
    }
    final List<AbstractDataset> selections=new ArrayList<AbstractDataset>(sel);
    IProgressService service=getEditorSite() != null ? (IProgressService)getSite().getService(IProgressService.class) : (IProgressService)PlatformUI.getWorkbench().getService(IProgressService.class);
    try {
      service.run(true,true,new IRunnableWithProgress(){
        @Override public void run(        final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
          monitor.beginTask("Updating selected DataSets",100);
          final AbstractDataset x=selections.remove(0);
          plottingSystem.clear();
          plottingSystem.createPlot1D(x,selections,monitor);
          monitor.done();
        }
      }
);
    }
 catch (    Exception e) {
      logger.error("Cannot create plot required.",e);
    }
  }
  finally {
    doingUpdate=false;
  }
}
 

Example 30

From project edna-rcp, under directory /org.edna.plugingenerator/src/org/edna/plugingenerator/wizards/.

Source file: NewEDNAPluginWizard.java

  20 
vote

@Override public boolean performFinish(){
  try {
    getContainer().run(true,true,new IRunnableWithProgress(){
      @Override public void run(      IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
        try {
          if (model.getPluginCopyMode().equals(EDNAPluginGeneratorModel.COPY)) {
            copyPlugin(monitor);
            return;
          }
          generatePlugin(monitor);
        }
 catch (        Exception e) {
          new ErrorDialog(getShell(),"Plugin Generation Failed","The plugin generation has failed because of the following error \n" + e.getLocalizedMessage(),Status.CANCEL_STATUS,0);
        }
      }
    }
);
  }
 catch (  Exception e) {
    return false;
  }
  return true;
}
 

Example 31

From project egit-github, under directory /org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/internal/github/ui/.

Source file: RepositorySearchWizardPage.java

  20 
vote

private void search(final String language,final String text,final TableViewer viewer){
  viewer.setSelection(StructuredSelection.EMPTY);
  try {
    getContainer().run(true,true,new IRunnableWithProgress(){
      public void run(      IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
        monitor.beginTask(MessageFormat.format(Messages.RepositorySearchWizardPage_Searching,text),10);
        try {
          StringBuilder query=new StringBuilder();
          for (          String term : text.split("\n"))           query.append(UrlUtils.encode(term.trim())).append('+');
          query.deleteCharAt(query.length() - 1);
          final List<SearchRepository> repositories=repositoryService.searchRepositories(query.toString(),language);
          PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable(){
            public void run(){
              if (viewer.getControl().isDisposed())               return;
              setMessage(MessageFormat.format(Messages.RepositorySearchWizardPage_Found,repositories.size()),INFORMATION);
              viewer.setInput(repositories);
              validate(viewer);
            }
          }
);
        }
 catch (        IOException e) {
          throw new InvocationTargetException(GitHubException.wrap(e));
        }
      }
    }
);
    setErrorMessage(null);
  }
 catch (  InvocationTargetException e) {
    viewer.setInput(Collections.emptyList());
    Throwable cause=e.getCause();
    if (cause == null)     cause=e;
    setErrorMessage(MessageFormat.format(Messages.RepositorySearchWizardPage_Error,cause.getLocalizedMessage()));
  }
catch (  InterruptedException e) {
    GitHubUi.logError(e);
  }
}
 

Example 32

From project gmc, under directory /src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/actions/.

Source file: AbstractMonitoredActionDelegate.java

  20 
vote

@Override protected void performAction(final IAction action){
  try {
    new ProgressMonitorDialog(getShell()).run(false,false,new IRunnableWithProgress(){
      @Override public void run(      IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
        performAction(action,monitor);
      }
    }
);
  }
 catch (  Exception e) {
    String errMsg="Exception while performing action [" + action.getDescription() + "] : ["+ e.getMessage()+ "]";
    logger.error(errMsg,e);
    showErrorDialog(ConsoleConstants.CONSOLE_TITLE,errMsg);
  }
}
 

Example 33

From project JGit, under directory /org.spearce.egit.ui/src/org/spearce/egit/ui/internal/actions/.

Source file: AbstractOperationAction.java

  20 
vote

public void run(final IAction act){
  if (op != null) {
    try {
      try {
        wp.getSite().getWorkbenchWindow().run(true,false,new IRunnableWithProgress(){
          public void run(          final IProgressMonitor monitor) throws InvocationTargetException {
            try {
              op.run(monitor);
            }
 catch (            CoreException ce) {
              throw new InvocationTargetException(ce);
            }
          }
        }
);
      }
  finally {
        postOperation();
      }
    }
 catch (    Throwable e) {
      final String msg=NLS.bind(UIText.GenericOperationFailed,act.getText());
      final IStatus status;
      if (e instanceof InvocationTargetException) {
        e=e.getCause();
      }
      if (e instanceof CoreException) {
        status=((CoreException)e).getStatus();
        e=status.getException();
      }
 else {
        status=new Status(IStatus.ERROR,Activator.getPluginId(),1,msg,e);
      }
      Activator.logError(msg,e);
      ErrorDialog.openError(wp.getSite().getShell(),act.getText(),msg,status,status.getSeverity());
    }
  }
}
 

Example 34

From project phresco-eclipse, under directory /com.photon.phresco.ui/src/com/photon/phresco/ui/wizards/.

Source file: PhrescoProjectWizard.java

  20 
vote

@Override public boolean performFinish(){
  if (!appInfoPage.isPageComplete()) {
    return false;
  }
  projectInfo=new ProjectInfo();
  projectInfo.setCustomerId("photon");
  projectInfo.setName(appInfoPage.projectTxt.getText());
  String projectName="PHR_" + appInfoPage.projectTxt.getText();
  projectInfo.setCode(projectName);
  projectInfo.setProjectCode(projectName);
  if (appInfoPage.versionTxt.getText().isEmpty()) {
    projectInfo.setVersion("1.0.0");
  }
 else {
    projectInfo.setVersion(appInfoPage.versionTxt.getText());
  }
  projectInfo.setApplication(appInfoPage.appTypeConstant);
  Technology technology=appInfoPage.technologies.get(appInfoPage.technologyCombo.getSelectionIndex());
  projectInfo.setTechnology(technology);
  projectInfo.setTechId(technology.getId());
  path=ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString() + "/projects/" + projectName;
  try {
    getContainer().run(true,true,new IRunnableWithProgress(){
      public void run(      IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
        PhrescoUtils.createProject(projectInfo,user,path,monitor);
      }
    }
);
  }
 catch (  InvocationTargetException e) {
    e.printStackTrace();
    return false;
  }
catch (  InterruptedException e) {
    return false;
  }
  return true;
}
 

Example 35

From project samolisov-demo, under directory /Eclipse/RCP/Hyperbola/org.eclipselabs.p2.rcpupdate.utils/src/org/eclipselabs/p2/rcpupdate/utils/.

Source file: P2Util.java

  20 
vote

public static void checkForUpdates(){
  try {
    ProgressMonitorDialog progressDialog=new ProgressMonitorDialog(null);
    progressDialog.run(true,true,new IRunnableWithProgress(){
      public void run(      IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
        doCheckForUpdates(new AccumulatingProgressMonitor(monitor,Display.getDefault()));
      }
    }
);
  }
 catch (  InvocationTargetException e) {
    Activator.log(e);
  }
catch (  InterruptedException e) {
    Activator.log(e);
  }
}
 

Example 36

From project sandbox, under directory /xeclipse/org.xwiki.eclipse.ui/src/main/java/org/xwiki/eclipse/ui/handlers/.

Source file: DataManagerConnectHandler.java

  20 
vote

public Object execute(ExecutionEvent event) throws ExecutionException {
  ISelection selection=HandlerUtil.getCurrentSelection(event);
  Set selectedObjects=UIUtils.getSelectedObjectsFromSelection(selection);
  for (  Object selectedObject : selectedObjects) {
    if (selectedObject instanceof DataManager) {
      final DataManager dataManager=(DataManager)selectedObject;
      try {
        UIUtils.runWithProgress(new IRunnableWithProgress(){
          public void run(          IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            monitor.beginTask(String.format("Connecting %s",dataManager.getName()),IProgressMonitor.UNKNOWN);
            SafeRunner.run(new XWikiEclipseSafeRunnable(){
              public void run() throws Exception {
                dataManager.connect();
              }
            }
);
            monitor.done();
          }
        }
,HandlerUtil.getActiveShell(event));
      }
 catch (      Exception e) {
        throw new ExecutionException("Unable to connect",e);
      }
    }
  }
  return null;
}
 

Example 37

From project scisoft-ui, under directory /uk.ac.diamond.scisoft.analysis.rcp/src/uk/ac/diamond/scisoft/analysis/rcp/util/.

Source file: CSVUtils.java

  20 
vote

/** 
 * Constructs a csv file with the same name in the same project.
 * @param dataFile
 * @param dataSetNames
 */
public static void createCSV(final IFile dataFile,final Object[] dataSetNames){
  final IFile csv=EclipseUtils.getUniqueFile(dataFile,"csv");
  final IProgressService service=PlatformUI.getWorkbench().getProgressService();
  try {
    service.run(true,true,new IRunnableWithProgress(){
      @Override public void run(      IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
        try {
          final DataHolder dh=LoaderFactory.getData(dataFile.getLocation().toOSString(),new ProgressMonitorWrapper(monitor));
          csv.create(getCVSStream(dh,dataSetNames),true,monitor);
          csv.getParent().refreshLocal(IResource.DEPTH_INFINITE,monitor);
          PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable(){
            @Override public void run(){
              try {
                EclipseUtils.openEditor(csv);
              }
 catch (              PartInitException e) {
                logger.error("Cannot open editor for " + csv,e);
              }
            }
          }
);
        }
 catch (        Exception e) {
          throw new InvocationTargetException(e,e.getMessage());
        }
      }
    }
);
  }
 catch (  Exception ne) {
    final String message="The file '" + dataFile.getName() + "' was not converted to '"+ csv.getName()+ "'";
    ErrorDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),"File Not Converted",ne.getMessage(),new Status(IStatus.WARNING,"org.edna.workbench.actions",message,ne));
  }
}
 

Example 38

From project substeps-eclipse-plugin, under directory /com.technophobia.substeps.testlauncher/src/main/java/com/technophobia/substeps/junit/action/.

Source file: OpenEditorAction.java

  20 
vote

protected final IType findType(final IJavaProject project,final String testClassName){
  final IType[] result={null};
  final String dottedName=testClassName.replace('$','.');
  try {
    PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress(){
      @Override public void run(      final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
        try {
          if (project != null) {
            result[0]=internalFindType(project,dottedName,new HashSet<IJavaProject>(),monitor);
          }
          if (result[0] == null) {
            final int lastDot=dottedName.lastIndexOf('.');
            final TypeNameMatchRequestor nameMatchRequestor=new TypeNameMatchRequestor(){
              @Override public void acceptTypeNameMatch(              final TypeNameMatch match){
                result[0]=match.getType();
              }
            }
;
            new SearchEngine().searchAllTypeNames(lastDot >= 0 ? dottedName.substring(0,lastDot).toCharArray() : null,SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE,(lastDot >= 0 ? dottedName.substring(lastDot + 1) : dottedName).toCharArray(),SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE,IJavaSearchConstants.TYPE,SearchEngine.createWorkspaceScope(),nameMatchRequestor,IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,monitor);
          }
        }
 catch (        final JavaModelException e) {
          throw new InvocationTargetException(e);
        }
      }
    }
);
  }
 catch (  final InvocationTargetException e) {
    FeatureRunnerPlugin.log(e);
  }
catch (  final InterruptedException e) {
  }
  return result[0];
}
 

Example 39

From project titanium_studio_sdk, under directory /desktop/plugins/com.appcelerator.titanium.desktop/src/com/appcelerator/titanium/desktop/ui/wizard/.

Source file: DistributeDesktopWizard.java

  20 
vote

@Override public boolean performFinish(){
  try {
    mainPage.saveWidgetValues();
    final Set<String> platforms=mainPage.getPlatforms();
    final String visibility=mainPage.getVisibility();
    final String runtime=mainPage.getInstallerType();
    final boolean release=mainPage.releaseToUsers();
    final boolean showSplash=mainPage.showSplash();
    getContainer().run(true,true,new IRunnableWithProgress(){
      public void run(      IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
        IStatus status=new Packager().distribute(DistributeDesktopWizard.this.project,platforms,runtime,release,visibility,showSplash,monitor);
        if (!status.isOK()) {
          throw new InvocationTargetException(new CoreException(status));
        }
      }
    }
);
  }
 catch (  Throwable e) {
    if (e instanceof InvocationTargetException) {
      Throwable t=((InvocationTargetException)e).getTargetException();
      if (t != null) {
        e=t;
      }
    }
    IdeLog.logError(DesktopPlugin.getDefault(),e);
    MessageDialog.openError(getShell(),Messages.DistributeDesktopWizard_ErrorDialogTitle,e.getMessage());
  }
  return true;
}
 

Example 40

From project tycho-demo, under directory /exercises/Exercise_02_Add_Test_Fragment/tychodemo.bundle/src/tychodemo/bundle/handlers/.

Source file: SaveHandler.java

  20 
vote

@Execute public void execute(IEclipseContext context,@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,@Named(IServiceConstants.ACTIVE_PART) final MContribution contribution) throws InvocationTargetException, InterruptedException {
  final IEclipseContext pmContext=context.createChild();
  ProgressMonitorDialog dialog=new ProgressMonitorDialog(shell);
  dialog.open();
  dialog.run(true,true,new IRunnableWithProgress(){
    public void run(    IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
      pmContext.set(IProgressMonitor.class.getName(),monitor);
      if (contribution != null) {
        Object clientObject=contribution.getObject();
      }
    }
  }
);
  pmContext.dispose();
}
 

Example 41

From project warlock2, under directory /stormfront/cc.warlock.rcp.stormfront/src/cc/warlock/rcp/stormfront/ui/wizards/.

Source file: AccountWizardPage.java

  20 
vote

@Override public void pageExited(int button){
  accountName=account.getText();
  savedAccount=ProfileConfiguration.instance().getAccount(account.getText());
  if (savedAccount == null) {
    boolean save=MessageDialog.openQuestion(Display.getDefault().getActiveShell(),WizardMessages.AccountWizardPage_saveAccount_title,WizardMessages.AccountWizardPage_saveAccount_description);
    if (save) {
      savedAccount=new Account(account.getText(),password.getText());
      ProfileConfiguration.instance().addAccount(savedAccount);
    }
  }
  try {
    getContainer().run(false,true,new IRunnableWithProgress(){
      public void run(      IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
        listener.setProgressMonitor(monitor);
        monitor.beginTask(WizardMessages.bind(WizardMessages.AccountWizardPage_progressMessage,account.getText()),4);
        if (!connection.isConnected()) {
          connection.connect();
        }
 else {
          connection.login(account.getText(),password.getText());
        }
        monitor.worked(1);
      }
    }
);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
 

Example 42

From project xwiki-eclipse, under directory /plugins/org.xwiki.eclipse.ui/src/main/java/org/xwiki/eclipse/ui/handlers/.

Source file: DataManagerConnectHandler.java

  20 
vote

public Object execute(ExecutionEvent event) throws ExecutionException {
  ISelection selection=HandlerUtil.getCurrentSelection(event);
  Set selectedObjects=UIUtils.getSelectedObjectsFromSelection(selection);
  for (  Object selectedObject : selectedObjects) {
    if (selectedObject instanceof DataManager) {
      final DataManager dataManager=(DataManager)selectedObject;
      try {
        UIUtils.runWithProgress(new IRunnableWithProgress(){
          public void run(          IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            monitor.beginTask(String.format("Connecting %s",dataManager.getName()),IProgressMonitor.UNKNOWN);
            SafeRunner.run(new XWikiEclipseSafeRunnable(){
              public void run() throws Exception {
                dataManager.connect();
              }
            }
);
            monitor.done();
          }
        }
,HandlerUtil.getActiveShell(event));
      }
 catch (      Exception e) {
        throw new ExecutionException("Unable to connect",e);
      }
    }
  }
  return null;
}
 

Example 43

From project p2-browser, under directory /com.ifedorenko.p2browser/src/com/ifedorenko/p2browser/views/.

Source file: AbstractInstallableUnitHierarchyView.java

  19 
vote

protected void run(IRunnableWithProgress runnable){
  try {
    getViewSite().getWorkbenchWindow().run(true,true,runnable);
  }
 catch (  InvocationTargetException e) {
    e.printStackTrace();
  }
catch (  InterruptedException e) {
    e.printStackTrace();
  }
}