當前位置: 首頁>>代碼示例>>Java>>正文


Java SubMonitor類代碼示例

本文整理匯總了Java中org.eclipse.core.runtime.SubMonitor的典型用法代碼示例。如果您正苦於以下問題:Java SubMonitor類的具體用法?Java SubMonitor怎麽用?Java SubMonitor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SubMonitor類屬於org.eclipse.core.runtime包,在下文中一共展示了SubMonitor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: cleanCacheInternal

import org.eclipse.core.runtime.SubMonitor; //導入依賴的package包/類
private IStatus cleanCacheInternal(final IProgressMonitor monitor) {
	checkNotNull(monitor, "monitor");

	final SubMonitor subMonitor = SubMonitor.convert(monitor, 1);
	try {

		subMonitor.setTaskName("Cleaning npm cache");

		performGitPull(subMonitor.newChild(1, SubMonitor.SUPPRESS_ALL_LABELS));
		final File targetInstallLocation = new File(locationProvider.getTargetPlatformInstallLocation());
		return clean(targetInstallLocation);

	} finally {
		subMonitor.done();
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:17,代碼來源:NpmManager.java

示例2: configureResourceSet

import org.eclipse.core.runtime.SubMonitor; //導入依賴的package包/類
private static void configureResourceSet(ResourceSet rs, URI modelURI, HashMap<String, String> nsURIMapping,
		SubMonitor subMonitor) {

	subMonitor.subTask("Configuring ResourceSet");
	subMonitor.newChild(1);

	final String fileExtension = modelURI.fileExtension();
	// indicates which melange query should be added to the xml uri handler
	// for a given extension
	// use to resolve cross ref URI during XMI parsing
	final XMLURIHandler handler = new XMLURIHandler(modelURI.query(), fileExtension);
	handler.setResourceSet(rs);
	rs.getLoadOptions().put(XMLResource.OPTION_URI_HANDLER, handler);

	final MelangeURIConverter converter = new MelangeURIConverter(nsURIMapping);
	rs.setURIConverter(converter);
	// fix sirius to prevent non intentional model savings
	converter.getURIHandlers().add(0, new DebugURIHandler(converter.getURIHandlers()));
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:20,代碼來源:DefaultModelLoader.java

示例3: clean

import org.eclipse.core.runtime.SubMonitor; //導入依賴的package包/類
@Override
protected void clean(IProgressMonitor monitor) throws CoreException
{
	SubMonitor localmonitor = SubMonitor.convert(monitor, "JPF Manifest validation", 1);
	try
	{
		// clean problem markers on the project
		cleanProblems(getProject(), IResource.DEPTH_ZERO);
		// clean the manifest directory (since errors can be created on
		// manifest files with incorrect casing)
		IFile manifestFile = JPFProject.getManifest(getProject());
		cleanProblems(manifestFile.getParent(), IResource.DEPTH_ONE);
		localmonitor.worked(1);
	}
	finally
	{
		localmonitor.done();
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:20,代碼來源:JPFManifestBuilder.java

示例4: rename

import org.eclipse.core.runtime.SubMonitor; //導入依賴的package包/類
/**
 * The gw generated code contains a classname that might be different from the filename chosen in the wizard , which lead to a compile error.
 * We need to fix that by modifying the source code so that names are aligned.
 * @param monitor
 * @return
 */
private void rename(IProgressMonitor monitor)  {
	SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
	 try {
		 String newClassname = getConvertedFile().getName();
		 newClassname  = newClassname.substring(0,newClassname.indexOf("."));
		
		 String oldClassname = context.getSelectedGraphFileName();
		 oldClassname  = oldClassname.substring(0,oldClassname.indexOf("."));
		 subMonitor.split(10);
		 convertedFile =  JDTManager.renameClass(getConvertedFile(), oldClassname, newClassname,monitor);
	} catch (Exception e) {
		ResourceManager.logException(e);
	} finally {
		subMonitor.split(90);
	}
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:23,代碼來源:JavaModelBasedPostConversionImpl.java

示例5: generateOffline

import org.eclipse.core.runtime.SubMonitor; //導入依賴的package包/類
public static void generateOffline(final IResource resource, IPackageFragment pkg, String classfile , BuildPolicy[]  generators, int timeout, IWorkbenchWindow aww) {
	Job job = new Job("GW4E Offline Generation Source Job") {
		@Override
		public IStatus run(IProgressMonitor monitor) {
			try {
				if (resource instanceof IFile) {
					SubMonitor subMonitor = SubMonitor.convert(monitor, 120);
					IFile file = (IFile) resource;
					if (PreferenceManager.isGraphModelFile(file)) {
						AbstractPostConversion converter = getOfflineConversion(file,pkg,classfile,generators,timeout);
						ConversionRunnable runnable = converter.createConversionRunnable(aww);
						subMonitor.subTask("Processing converter ");
						SubMonitor child = subMonitor.split(1);
						runnable.run(child);
					}						
				}
			} catch (Exception e) {
				e.printStackTrace();
				ResourceManager.logException(e);
			}
			return Status.OK_STATUS;
		}
	};
	job.setUser(true);
	job.schedule();
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:27,代碼來源:GraphWalkerContextManager.java

示例6: createFileDeleteIfExists

import org.eclipse.core.runtime.SubMonitor; //導入依賴的package包/類
/**
 * Create a file in a folder with the specified name and content
 * 
 * @param fullpath
 * @param filename
 * @param content
 * @throws CoreException
 * @throws InterruptedException
 */
public static IFile createFileDeleteIfExists(String fullpath, String filename, String content,
		IProgressMonitor monitor) throws CoreException, InterruptedException {
	SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
	subMonitor.setTaskName("Create file delete if it exists " + fullpath);
	IFile newFile;
	try {
		IWorkspaceRoot wroot = ResourcesPlugin.getWorkspace().getRoot();
		IContainer container = (IContainer) wroot.findMember(new Path(fullpath));
		newFile = container.getFile(new Path(filename));
		if (newFile.exists()) {
			JDTManager.rename(newFile, new NullProgressMonitor());
			newFile.delete(true, new NullProgressMonitor());
		}
		subMonitor.split(30);
		byte[] source = content.getBytes(Charset.forName("UTF-8"));
		newFile.create(new ByteArrayInputStream(source), true, new NullProgressMonitor());
		subMonitor.split(70);
	} finally {
		subMonitor.done();
	}
	return newFile;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:32,代碼來源:ResourceManager.java

示例7: createJob

import org.eclipse.core.runtime.SubMonitor; //導入依賴的package包/類
/**
 * @param jobname
 * @param tasks
 * @return
 */
public static Job createJob(String jobname, List<UITask.Task> tasks) {
	Job job = new Job(jobname) {
		@Override
		protected IStatus run(IProgressMonitor monitor) {
			SubMonitor subMonitor = SubMonitor.convert(monitor, tasks.size());
			for (UITask.Task task : tasks) {
				try {
					subMonitor.setTaskName(task.getSummary());
					workOnTask(task, subMonitor.split(1));
				} catch (Exception e) {
					return Status.CANCEL_STATUS;
				}
			}
			return Status.OK_STATUS;
		}
	};
	job.setUser(true);
	return job;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:25,代碼來源:UITask.java

示例8: performTest

import org.eclipse.core.runtime.SubMonitor; //導入依賴的package包/類
private void performTest(DbSource source)
        throws IOException, InterruptedException, CoreException {
    assertFalse("DB source should not be loaded", source.isLoaded());

    try{
        source.getDbObject();
        fail("Source is not loaded yet, exception expected");
    }catch(IllegalStateException ex){
        // do nothing: expected behavior
    }
    PgDatabase dbSource = source.get(SubMonitor.convert(null, "", 1));

    assertTrue("DB source should be loaded", source.isLoaded());

    assertEquals("Db loaded not equal to predefined db", dbPredefined, dbSource);
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:17,代碼來源:DbSourceTest.java

示例9: loadInternal

import org.eclipse.core.runtime.SubMonitor; //導入依賴的package包/類
@Override
protected PgDatabase loadInternal(SubMonitor monitor)
        throws IOException, InterruptedException, CoreException {
    String charset = proj.getProjectCharset();
    monitor.subTask(Messages.dbSource_loading_tree);
    IProject project = proj.getProject();

    int filesCount = PgUIDumpLoader.countFiles(project);
    monitor.setWorkRemaining(filesCount);

    IEclipsePreferences pref = proj.getPrefs();
    return PgUIDumpLoader.loadDatabaseSchemaFromIProject(
            project.getProject(),
            getPgDiffArgs(charset, pref.getBoolean(PROJ_PREF.FORCE_UNIX_NEWLINES, true)),
            monitor, null, errors);
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:17,代碼來源:DbSource.java

示例10: run

import org.eclipse.core.runtime.SubMonitor; //導入依賴的package包/類
@Override
public void run(IProgressMonitor monitor)
        throws InvocationTargetException, InterruptedException {
    try {
        Log.log(Log.LOG_INFO, "Init project at " + proj.getPathToProject()); //$NON-NLS-1$

        SubMonitor pm = SubMonitor.convert(monitor,
                Messages.initProjectFromSource_initializing_project, 75);

        initRepoFromSource(pm);

        monitor.done();
    } catch (IOException | CoreException ex) {
        throw new InvocationTargetException(ex, MessageFormat.format(
                Messages.initProjectFromSource_ioexception_while_creating_project,
                ex.getLocalizedMessage()));
    }
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:19,代碼來源:InitProjectFromSource.java

示例11: run

import org.eclipse.core.runtime.SubMonitor; //導入依賴的package包/類
@Override
protected IStatus run(IProgressMonitor monitor) {
    SubMonitor pm = SubMonitor.convert(
            monitor, Messages.commitPartDescr_commiting, 2);

    Log.log(Log.LOG_INFO, "Applying diff tree to db"); //$NON-NLS-1$
    pm.newChild(1).subTask(Messages.commitPartDescr_modifying_db_model); // 1
    pm.newChild(1).subTask(Messages.commitPartDescr_exporting_db_model); // 2

    try {
        Collection<TreeElement> checked = new TreeFlattener()
                .onlySelected()
                .onlyEdits(dbProject.getDbObject(), dbRemote.getDbObject())
                .flatten(tree);
        new ProjectUpdater(dbRemote.getDbObject(), dbProject.getDbObject(),
                checked, proj).updatePartial();
        monitor.done();
    } catch (IOException | CoreException e) {
        return new Status(Status.ERROR, PLUGIN_ID.THIS,
                Messages.ProjectEditorDiffer_commit_error, e);
    }
    if (monitor.isCanceled()) {
        return Status.CANCEL_STATUS;
    }
    return Status.OK_STATUS;
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:27,代碼來源:ProjectEditorDiffer.java

示例12: run

import org.eclipse.core.runtime.SubMonitor; //導入依賴的package包/類
@Override
protected IStatus run(IProgressMonitor monitor) {
    try {
        Log.log(Log.LOG_INFO, "Update DDL starting"); //$NON-NLS-1$
        SubMonitor.convert(monitor).setTaskName(Messages.SqlEditor_update_ddl);

        scriptThread.start();

        while(scriptThread.isAlive()) {
            Thread.sleep(20);
            if(monitor.isCanceled()) {
                ConsoleFactory.write(Messages.sqlScriptDialog_script_execution_interrupted);
                Log.log(Log.LOG_INFO, "Script execution interrupted by user"); //$NON-NLS-1$

                scriptThread.interrupt();
                return Status.CANCEL_STATUS;
            }
        }
        return Status.OK_STATUS;
    } catch (InterruptedException ex) {
        scriptThread.interrupt();
        return Status.CANCEL_STATUS;
    } finally {
        monitor.done();
    }
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:27,代碼來源:SQLEditor.java

示例13: build

import org.eclipse.core.runtime.SubMonitor; //導入依賴的package包/類
@Override
public void build(IBuildContext context, IProgressMonitor monitor) throws CoreException {
	SubMonitor progress = SubMonitor.convert(monitor);
	if (!prefs.isCompilerEnabled()) {
		return;
	}
	final List<IResourceDescription.Delta> deltas = getRelevantDeltas(context);
	if (deltas.isEmpty()) {
		return;
	}
	if (progress.isCanceled()) {
		throw new OperationCanceledException();
	}
	progress.beginTask("Compiling solidity...", deltas.size());

	List<URI> uris = deltas.stream().map(delta -> delta.getUri()).collect(Collectors.toList());
	compiler.compile(uris, progress);
	context.getBuiltProject().refreshLocal(IProject.DEPTH_INFINITE, progress);
	progress.done();

}
 
開發者ID:Yakindu,項目名稱:solidity-ide,代碼行數:22,代碼來源:SolidityBuilderParticipant.java

示例14: createConfigFiles

import org.eclipse.core.runtime.SubMonitor; //導入依賴的package包/類
/**
 * Creates an appengine-web.xml file in the WEB-INF folder if it doesn't exist.
 */
@VisibleForTesting
void createConfigFiles(IProject project, IProgressMonitor monitor)
    throws CoreException {
  SubMonitor progress = SubMonitor.convert(monitor, 10);

  IFile appEngineWebXml = WebProjectUtil.findInWebInf(project, new Path(APPENGINE_WEB_XML));
  if (appEngineWebXml != null && appEngineWebXml.exists()) {
    return;
  }

  // Use the virtual component model decide where to create the appengine-web.xml
  appEngineWebXml = WebProjectUtil.createFileInWebInf(project, new Path(APPENGINE_WEB_XML),
      new ByteArrayInputStream(new byte[0]), progress.newChild(2));
  String configFileLocation = appEngineWebXml.getLocation().toString();
  Map<String, String> parameters = new HashMap<>();
  parameters.put("runtime", "java8");
  Templates.createFileContent(configFileLocation, Templates.APPENGINE_WEB_XML_TEMPLATE,
      parameters);
  progress.worked(4);
  appEngineWebXml.refreshLocal(IFile.DEPTH_ZERO, progress.newChild(1));
}
 
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:25,代碼來源:StandardFacetInstallDelegate.java

示例15: process

import org.eclipse.core.runtime.SubMonitor; //導入依賴的package包/類
/** {@inheritDoc} */
@Override
public void process(final Delta delta, final ResourceSet resourceSet, final IProgressMonitor monitor) {
  URI uri = delta.getUri();
  ILanguageSpecificResourcePostProcessor postProcessor = getPostProcessor(uri);
  if (postProcessor != null) {
    try {
      traceSet.started(ResourcePostProcessingEvent.class, uri);
      SubMonitor subMonitor = SubMonitor.convert(monitor, 1);
      if (delta.getNew() != null) {
        if (resourceSet == null) {
          throw new IllegalArgumentException("resourceSet may not be null for changed resources."); //$NON-NLS-1$
        }
        postProcessor.processChanged(uri, resourceSet.getResource(uri, true), resourceSet, subMonitor.newChild(1));
      } else {
        postProcessor.processDeleted(uri, resourceSet, subMonitor.newChild(1));
      }
    } finally {
      traceSet.ended(ResourcePostProcessingEvent.class);
    }
  }
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:23,代碼來源:DefaultResourcePostProcessor.java


注:本文中的org.eclipse.core.runtime.SubMonitor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。