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


Java NullProgressMonitor類代碼示例

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


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

示例1: generateEMFCode

import org.eclipse.core.runtime.NullProgressMonitor; //導入依賴的package包/類
/**
 * TODO merge monitor
 */
private void generateEMFCode(String genModelPath) throws InvocationTargetException, InterruptedException {
	/*
	 * Generate model & edit
	 */
	List<URI> uris = new ArrayList<URI>();
	uris.add(URI.createFileURI(genModelPath));
	List<GenModel> genModels = GeneratorUIUtil.loadGenModels(new NullProgressMonitor(), uris, shell);
	GeneratorUIUtil.GeneratorOperation editOp = new GeneratorUIUtil.GeneratorOperation(shell);
	editOp.addGeneratorAndArguments(GenModelUtil.createGenerator(genModels.get(0)), genModels.get(0),
			"org.eclipse.emf.codegen.ecore.genmodel.generator.EditProject", "Edit");
	editOp.addGeneratorAndArguments(GenModelUtil.createGenerator(genModels.get(0)), genModels.get(0),
			"org.eclipse.emf.codegen.ecore.genmodel.generator.ModelProject", "Model");
	ProgressMonitorDialog progressMonitorDialog = new ProgressMonitorDialog(shell);
	progressMonitorDialog.run(true, true, editOp);
}
 
開發者ID:occiware,項目名稱:OCCI-Studio,代碼行數:19,代碼來源:OCCI2EMFGeneratorAction.java

示例2: tearDownExternalLibraries

import org.eclipse.core.runtime.NullProgressMonitor; //導入依賴的package包/類
/** Tears down the external libraries. */
protected void tearDownExternalLibraries(boolean tearDownShippedCode) throws Exception {
	((TypeDefinitionGitLocationProviderImpl) gitLocationProvider).setGitLocation(PUBLIC_DEFINITION_LOCATION);

	final URI nodeModulesLocation = locationProvider.getTargetPlatformNodeModulesLocation();
	externalLibraryPreferenceStore.remove(nodeModulesLocation);
	final IStatus result = externalLibraryPreferenceStore.save(new NullProgressMonitor());
	assertTrue("Error while saving external library preference changes.", result.isOK());

	if (tearDownShippedCode) {
		shippedCodeInitializeTestHelper.teardowneBuiltIns();
	}

	// cleanup leftovers in the file system
	File nodeModuleLocationFile = new File(nodeModulesLocation);
	assertTrue("Provided npm location does not exist.", nodeModuleLocationFile.exists());
	assertTrue("Provided npm location is not a folder.", nodeModuleLocationFile.isDirectory());
	FileDeleter.delete(nodeModuleLocationFile);
	assertFalse("Provided npm location should be deleted.", nodeModuleLocationFile.exists());

	waitForAutoBuild();

	super.tearDown();
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:25,代碼來源:AbstractBuilderParticipantTest.java

示例3: setupWorkspace

import org.eclipse.core.runtime.NullProgressMonitor; //導入依賴的package包/類
/**
 * Loads (and indexes) all the required external libraries. Also imports all the workspace projects.
 */
@Before
public void setupWorkspace() throws Exception {
	final IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
	assertTrue("Expected empty workspace. Projects were in workspace: " + Arrays.toString(projects),
			0 == projects.length);
	final URI externalRootLocation = getResourceUri(PROBANDS, EXT_LOC);
	externalLibraryPreferenceStore.add(externalRootLocation);
	final IStatus result = externalLibraryPreferenceStore.save(new NullProgressMonitor());
	assertTrue("Error while saving external library preference changes.", result.isOK());
	waitForAutoBuild();
	for (final String projectName : ALL_PROJECT_IDS) {
		final File projectsRoot = new File(getResourceUri(PROBANDS, WORKSPACE_LOC));
		ProjectUtils.importProject(projectsRoot, projectName);
	}
	waitForAutoBuild();
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:20,代碼來源:RunExternalLibrariesPluginTest.java

示例4: runClientWithTwoClosedWorkspaceProjectsWithTransitiveDependency

import org.eclipse.core.runtime.NullProgressMonitor; //導入依賴的package包/類
/***/
@Test
public void runClientWithTwoClosedWorkspaceProjectsWithTransitiveDependency() throws CoreException {

	for (final String libProjectName : newArrayList(PB, PD)) {
		getProjectByName(libProjectName).close(new NullProgressMonitor());
		waitForAutoBuildCheckIndexRigid();
	}

	final ProcessResult result = runClient();
	// @formatter:off
	assertEquals("Unexpected output after running the client module: " + result,
			"Workspace A<init>" + NL +
			"External B<init>" + NL +
			"Workspace C<init>" + NL +
			"External D<init>" + NL,
			result.getStdOut());
	// @formatter:on
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:20,代碼來源:RunExternalLibrariesPluginTest.java

示例5: runClientWithTwoClosedWorkspaceProjectsWithDirectDependency

import org.eclipse.core.runtime.NullProgressMonitor; //導入依賴的package包/類
/***/
@Test
public void runClientWithTwoClosedWorkspaceProjectsWithDirectDependency() throws CoreException {

	for (final String libProjectName : newArrayList(PB, PC)) {
		getProjectByName(libProjectName).close(new NullProgressMonitor());
		waitForAutoBuildCheckIndexRigid();
	}

	final ProcessResult result = runClient();
	// @formatter:off
	assertEquals("Unexpected output after running the client module: " + result,
			"Workspace A<init>" + NL +
			"External B<init>" + NL +
			"External C<init>" + NL +
			"Workspace D<init>" + NL,
			result.getStdOut());
	// @formatter:on
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:20,代碼來源:RunExternalLibrariesPluginTest.java

示例6: runClientWithAllDeletedWorkspaceProjects

import org.eclipse.core.runtime.NullProgressMonitor; //導入依賴的package包/類
/***/
@Test
public void runClientWithAllDeletedWorkspaceProjects() throws CoreException {

	for (final String libProjectName : LIB_PROJECT_IDS) {
		getProjectByName(libProjectName).delete(true, new NullProgressMonitor());
		waitForAutoBuildCheckIndexRigid();
	}

	final ProcessResult result = runClient();
	// @formatter:off
	assertEquals("Unexpected output after running the client module: " + result,
			"External A<init>" + NL +
			"External B<init>" + NL +
			"External C<init>" + NL +
			"External D<init>" + NL,
			result.getStdOut());
	// @formatter:on
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:20,代碼來源:RunExternalLibrariesPluginTest.java

示例7: updateMarker

import org.eclipse.core.runtime.NullProgressMonitor; //導入依賴的package包/類
private void updateMarker(IResource resource, String message, int start, int end, int severity,
		IMarker marker) {
	try {
		marker.setAttribute(IMarker.MESSAGE, message);
		marker.setAttribute(IMarker.SEVERITY, severity);
		if (resource.getType() != IResource.FILE) {
			return;
		}
		IFile file = (IFile) resource;
		ITextFileBufferManager manager = FileBuffers.getTextFileBufferManager();
		ITextFileBuffer textFileBuffer = manager.getTextFileBuffer(file.getFullPath(), LocationKind.IFILE);

		if (textFileBuffer == null) {
			manager.connect(file.getFullPath(), LocationKind.IFILE, new NullProgressMonitor());
			textFileBuffer = manager.getTextFileBuffer(file.getFullPath(), LocationKind.IFILE);
		}

		IDocument document = textFileBuffer.getDocument();

		marker.setAttribute(IMarker.CHAR_START, start);
		marker.setAttribute(IMarker.CHAR_END, end);
		marker.setAttribute(IMarker.LINE_NUMBER, document.getLineOfOffset(start) + 1);
	} catch (CoreException | BadLocationException e) {
		e.printStackTrace();
	}
}
 
開發者ID:angelozerr,項目名稱:ec4e,代碼行數:27,代碼來源:ValidateEditorConfigStrategy.java

示例8: getModelOutputFile

import org.eclipse.core.runtime.NullProgressMonitor; //導入依賴的package包/類
public File getModelOutputFile (String outputName) throws CoreException, InterruptedException, FileNotFoundException {
	IFile file = ResourceManager.toIFile(sourceFileModel);
	IFolder folder = ResourceManager.ensureFolder(file.getProject(), ".gw4eoutput", new NullProgressMonitor());

	
	IFile outfile = folder.getFile(new Path(outputName));
	InputStream source = new ByteArrayInputStream("".getBytes());
	if (outfile.exists()) {
		outfile.setContents(source, IResource.FORCE, new NullProgressMonitor());
	} else {
		outfile.create(source, IResource.FORCE, new NullProgressMonitor());
	}
	outfile.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
	long max = System.currentTimeMillis() + 15 * 1000;
	while (true) {
		IFile out = folder.getFile(new Path(outputName));
		if (out.exists()) break;
		if (System.currentTimeMillis() > max) {
			throw new InterruptedException (out.getFullPath() + " does not exist.");
		}
		Thread.sleep(500);
	}
	return ResourceManager.toFile(outfile.getFullPath());
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:25,代碼來源:GraphElementPage.java

示例9: isGraphWalkerExecutionContextClass

import org.eclipse.core.runtime.NullProgressMonitor; //導入依賴的package包/類
/**
 * @param testInterface
 * @return
 * @throws JavaModelException
 */
public static boolean isGraphWalkerExecutionContextClass(ICompilationUnit unit) throws JavaModelException {
	IType[] types = unit.getAllTypes();

	if (types == null || types.length == 0) {
		ResourceManager.logInfo(unit.getJavaProject().getProject().getName(),
				"getAllTypes return null" + unit.getPath());
		return false;
	}
	IType execContextType = unit.getJavaProject().findType(ExecutionContext.class.getName());

	for (int i = 0; i < types.length; i++) {
		IType type = types[i];
		String typeNname = type.getFullyQualifiedName();
		String compilationUnitName = JDTManager.getJavaFullyQualifiedName(unit);
		if (typeNname.equals(compilationUnitName)) {
			try {
				ITypeHierarchy th = types[0].newTypeHierarchy(new NullProgressMonitor());
				return th.contains(execContextType);
			} catch (Exception e) {
				ResourceManager.logException(e);
			}
		}
	}
	return false;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:31,代碼來源:JDTManager.java

示例10: touchProject

import org.eclipse.core.runtime.NullProgressMonitor; //導入依賴的package包/類
private void touchProject(IProject project)
{
	if( WorkspacePluginModelManager.isPluginProject(project) )
	{
		try
		{
			// set session property on project
			// to be read and reset in ManifestConsistencyChecker
			project.setSessionProperty(JPFClasspathPlugin.TOUCH_PROJECT, Boolean.TRUE);
			// touch project so that ManifestConsistencyChecker#build(..)
			// gets invoked
			project.touch(new NullProgressMonitor());
		}
		catch( CoreException e )
		{
			JPFClasspathLog.logError(e);
		}
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:20,代碼來源:JPFPluginRebuilder.java

示例11: execute

import org.eclipse.core.runtime.NullProgressMonitor; //導入依賴的package包/類
@Override
public void execute() throws CoreException, IOException, MalformedURLException {
    Logger log = Logger.getLogger(this.getClass().getName());
    if(log.isLoggable(Level.FINE)) {
        log.log(Level.FINE, "executing GetTaskDataCommand for attachment id: {0}", ta.getValue()); // NOI18N
    }
    AbstractTaskAttachmentHandler taskAttachmentHandler = repositoryConnector.getTaskAttachmentHandler();
    if (!taskAttachmentHandler.canGetContent(taskRepository, task)) {
        throw new IOException("Cannot get content for attachment with id: " + ta.getValue());
    }
    InputStream is = taskAttachmentHandler.getContent(taskRepository, task, ta, new NullProgressMonitor());
    try {
        byte [] buffer = new byte[4096];
        int n;
        while ((n = is.read(buffer)) != -1) {
            os.write(buffer, 0, n);
        }
    } finally {
        is.close();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:GetAttachmentCommand.java

示例12: createFileDeleteIfExists

import org.eclipse.core.runtime.NullProgressMonitor; //導入依賴的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

示例13: createSubjobInSpecifiedFolder

import org.eclipse.core.runtime.NullProgressMonitor; //導入依賴的package包/類
/**
 * @param subJobXMLPath
 * @param parameterFilePath
 * @param parameterFile
 * @param subJobFile
 * @param importFromPath
 * @param subjobPath
 * @return
 * @throws InstantiationException
 * @throws IllegalAccessException
 * @throws InvocationTargetException
 * @throws NoSuchMethodException
 * @throws JAXBException
 * @throws ParserConfigurationException
 * @throws SAXException
 * @throws IOException
 * @throws CoreException
 * @throws FileNotFoundException
 */
public static Container createSubjobInSpecifiedFolder(IPath subJobXMLPath, IPath parameterFilePath, IFile parameterFile,
		IFile subJobFile, IPath importFromPath,String subjobPath) throws InstantiationException, IllegalAccessException,
		InvocationTargetException, NoSuchMethodException, JAXBException, ParserConfigurationException,
		SAXException, IOException, CoreException, FileNotFoundException {
	UiConverterUtil converterUtil = new UiConverterUtil();
	Object[] subJobContainerArray=null;
		IFile xmlFile = ResourcesPlugin.getWorkspace().getRoot().getFile(subJobXMLPath);
		File file = new File(xmlFile.getFullPath().toString());
	if (file.exists()) {
		subJobContainerArray = converterUtil.convertToUiXml(importFromPath.toFile(), subJobFile, parameterFile,true);
	} else {
		IProject iProject = ResourcesPlugin.getWorkspace().getRoot().getProject(parameterFilePath.segment(1));
		IFolder iFolder = iProject.getFolder(subjobPath.substring(0, subjobPath.lastIndexOf('/')));
		if (!iFolder.exists()) {
			iFolder.create(true, true, new NullProgressMonitor());
		}
		IFile subjobXmlFile = iProject.getFile(subjobPath);
		subJobContainerArray = converterUtil.convertToUiXml(importFromPath.toFile(), subJobFile, parameterFile,true);
		if (!subjobXmlFile.exists() && subJobContainerArray[1] == null) {
			subjobXmlFile.create(new FileInputStream(importFromPath.toString()), true, new NullProgressMonitor());
		}
	}
	return (Container) subJobContainerArray[0];
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:44,代碼來源:SubjobUiConverterUtil.java

示例14: createSubtask

import org.eclipse.core.runtime.NullProgressMonitor; //導入依賴的package包/類
public NbTask createSubtask (NbTask parentTask) throws CoreException {
    ensureTaskListLoaded();
    TaskRepository taskRepository = taskRepositoryManager.getRepository(parentTask.getDelegate().getRepositoryUrl());
    if (taskRepository == null || parentTask.isUnsubmittedRepositoryTask()) {
        throw new IllegalStateException("Task repository: " + parentTask.getDelegate().getRepositoryUrl()
                + " - parent: " + parentTask.isUnsubmittedRepositoryTask());
    }
    AbstractTask task = createNewTask(taskRepository);
    AbstractRepositoryConnector repositoryConnector = taskRepositoryManager.getRepositoryConnector(taskRepository.getConnectorKind());
    AbstractTaskDataHandler taskDataHandler = repositoryConnector.getTaskDataHandler();
    
    TaskAttributeMapper attributeMapper = repositoryConnector.getTaskDataHandler().getAttributeMapper(taskRepository);
    TaskData taskData = new TaskData(attributeMapper, repositoryConnector.getConnectorKind(), taskRepository.getRepositoryUrl(), "");
    taskDataHandler.initializeSubTaskData(taskRepository, taskData, parentTask.getTaskDataState().getRepositoryData(), new NullProgressMonitor());
    initializeTask(repositoryConnector, taskData, task, taskRepository);        
    return MylynSupport.getInstance().toNbTask(task);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:MylynSupport.java

示例15: renameFile

import org.eclipse.core.runtime.NullProgressMonitor; //導入依賴的package包/類
/**
 * @param container
 * @param filename
 * @throws CoreException
 */
public static void renameFile(IContainer container, String oldName, String newName) throws CoreException {
	if (oldName.equals(newName))
		return;
	IResource[] members = container.members();
	for (IResource member : members) {
		if (member instanceof IContainer) {
			renameFile((IContainer) member, oldName, newName);
		} else if (member instanceof IFile) {
			IFile file = (IFile) member;
			if (file.getName().equals(oldName)) {
				IProgressMonitor monitor = new NullProgressMonitor();
				IPath path = file.getFullPath().removeLastSegments(1).append(newName);
				ResourceManager.logInfo(file.getProject().getName(),
						"Renaming " + file.getFullPath() + " into " + path);
				file.copy(path, true, monitor);
				file.delete(true, monitor);
			}
		}
	}
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:26,代碼來源:ResourceManager.java


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