Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.IProgressMonitor


  /*
   * find all types outside the project scope
   */
  private void findAllTypes(char[] prefix) {
    try {
      IProgressMonitor progressMonitor = new IProgressMonitor() {
        boolean isCanceled = false;
        public void beginTask(String name, int totalWork) {
          // implements interface method
        }
        public void done() {
View Full Code Here


      }
   
   
      msgHandler.clearMessages();
   
      final IProgressMonitor myMonitor = monitor;
      Lambda cancel = new Fun1<Boolean>() {     
        public Boolean eval(Object realworld) {
          return myMonitor.isCanceled()
        }
      };
   
      global = TGlobal.upd$sub(global,  TSubSt.upd$cancelled(
        TGlobal.sub(global),
View Full Code Here

   */
  protected void doSaveAs(URI uri, IEditorInput editorInput) {
    (editingDomain.getResourceSet().getResources().get(0)).setURI(uri);
    setInputWithNotify(editorInput);
    setPartName(editorInput.getName());
    IProgressMonitor progressMonitor =
      getActionBars().getStatusLineManager() != null ?
        getActionBars().getStatusLineManager().getProgressMonitor() :
        new NullProgressMonitor();
    doSave(progressMonitor);
  }
View Full Code Here

   */
  public IProject createProject() throws CoreException {
    if (created)
      throw new RuntimeException("Project '" + getProjectName() + "' was already created");
   
    IProgressMonitor monitor = getMonitor();
   
    // create a new project automatically
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IWorkspaceRoot root = workspace.getRoot();
    root.refreshLocal(5, monitor);
View Full Code Here

  protected void exportDiagramThenClose(EClass cls, DiagramDocumentEditor editor, IProgressMonitor monitor) throws CoreException {
    DiagramEditPart part = editor.getDiagramEditPart();
   
    // save this image
    // (even if there isn't anything in it)
    IProgressMonitor saveMonitor = new SubProgressMonitor(monitor, 2);
    saveMonitor.beginTask("Saving image for " + cls.getName(), 2);
   
    // issue 193: first save as png
    {
      IPath destination = generateImageDestination(cls, ".png");
      monitor.subTask("Saving PNG image " + destination.lastSegment());
      CopyToImageUtil img = getCopyToImageUtil();
      img.copyToImage(part, destination, ImageFileFormat.PNG, new SubProgressMonitor(monitor, 1));
      saveMonitor.worked(1);
    }

    // issue 193: then save as svg
    {
      IPath destination = generateImageDestination(cls, ".svg");
      monitor.subTask("Saving SVG image " + destination.lastSegment());
      CopyToImageUtil img = getCopyToImageUtil();
      img.copyToImage(part, destination, ImageFileFormat.SVG, new SubProgressMonitor(monitor, 1));
      saveMonitor.worked(1);
    }

    saveMonitor.done();
   
    // close the editor once we're done
    // (this is done asynchronously, so there might still be things going on in the
    // editor when the monitor is marked 'done')
   
View Full Code Here

          for (final T individual : result) {
            if (monitor.isCanceled())
              return;

            // create a new sub-progress
            IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1 * scale);
           
          final IStatus status = execute(individual, subMonitor);
          if (!status.isOK()) {
            // make a status to wrap it around
            IStatus multi = new MultiStatus(
View Full Code Here

   
    DiagramEditPart part = editor.getDiagramEditPart();
   
    // save this image if there is something in it
    if (part.getChildren().size() > 0) {
      IProgressMonitor saveMonitor = new SubProgressMonitor(monitor, 1);
      saveMonitor.beginTask("Saving container " + part.resolveSemanticElement(), 1 + formats.size());
      for (ImageFileFormat format : formats) {
        IPath destination = generateImageDestination(container, format);
        monitor.subTask("Saving image " + destination.lastSegment() + " ( " + format.getName() + ")");
        CopyToImageUtil img = getCopyToImageUtil();
        img.copyToImage(part, destination, format, new SubProgressMonitor(monitor, 1));
        imagesSaved++;
      }
      saveMonitor.done();
    }
   
    // get children
    for (Object obj : part.getChildren()) {
      if (monitor.isCanceled())
View Full Code Here

    Map<EObject, String> latexMap = new HashMap<EObject, String>();
   
    // do parent
    super.doExport(targetDiagram, container, new SubProgressMonitor(monitor, 70));
   
    IProgressMonitor finalMonitor = new SubProgressMonitor(monitor, 30);
    finalMonitor.beginTask("Writing HTML files", partDestinationMap.size() * 2);
   
    // get all image parts
    for (DiagramEditPart root : partDestinationMap.keySet()) {
      if (monitor.isCanceled())
        return;
     
      IPath destination = partDestinationMap.get(root);
      IPath htmlDestination = getHTMLDestinationFor(destination);
      EObject resolved = partEObjectMap.get(root);
      finalMonitor.subTask("Writing " + htmlDestination.lastSegment());
     
      // construct the HTML
      StringBuffer html = new StringBuffer();
      html.append(getHTMLHeader(targetDiagram, resolved))
        .append(getBreadcrumb(resolved))
        .append(getImageTag(destination))
        .append(getClickableMap(root))
        .append(getHTMLFooter());
     
      // add the SVG
      latexMap.put(resolved, getLatexTag(resolved, destination));
     
      finalMonitor.worked(1);
     
      // export HTML page
      try {
        File destFile = new File(htmlDestination.toOSString());
        FileWriter fw = new FileWriter(destFile);
        fw.write(html.toString());
        fw.close();
      } catch (IOException e) {
        throw new ExportImageException("Could not export individual HTML page '" + htmlDestination + "': " + e.getMessage(), e);
      }
      finalMonitor.worked(1);
    }
   
    // export Latex page
    IPath latexDestination = targetDiagram.getLocation().removeFileExtension().addFileExtension("tex");
    try {
      File destFile = new File(latexDestination.toOSString());
      FileWriter fw = new FileWriter(destFile);
     
      // we want to sort the latex output based on EObject depth
      List<EObject> objectList = new ArrayList<EObject>(latexMap.keySet());
      Collections.sort(objectList, new EObjectDepthComparator());
      for (EObject obj : objectList) {
        fw.write(latexMap.get(obj));
      }
      fw.close();
      finalMonitor.worked(5);
    } catch (IOException e) {
      throw new ExportImageException("Could not export Latex page '" + latexDestination + "': " + e.getMessage(), e);
    }
   
    finalMonitor.done();
   
    // once finished, refresh parent (folder, project)
    try {
      targetDiagram.getParent().refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 5));
    } catch (CoreException e) {
View Full Code Here

  /*
   * @see org.eclipse.ui.texteditor.quickdiff.IQuickDiffReferenceProvider#dispose()
   */
  public void dispose() {
    IProgressMonitor monitor= fProgressMonitor;
    if (monitor != null) {
      monitor.setCanceled(true);
    }

    IDocumentProvider provider= fDocumentProvider;

    synchronized (fLock) {
View Full Code Here

   *
   * @param input the editor input.
   */
  private void updateDocumentProvider(IEditorInput input) {

    IProgressMonitor rememberedProgressMonitor= null;

    IDocumentProvider provider= getDocumentProvider();
    if (provider != null) {
      provider.removeElementStateListener(fElementStateListener);
      if (provider instanceof IDocumentProviderExtension2) {
View Full Code Here

TOP

Related Classes of org.eclipse.core.runtime.IProgressMonitor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.