当前位置: 首页>>代码示例>>Java>>正文


Java IDocumentProvider.connect方法代码示例

本文整理汇总了Java中org.eclipse.ui.texteditor.IDocumentProvider.connect方法的典型用法代码示例。如果您正苦于以下问题:Java IDocumentProvider.connect方法的具体用法?Java IDocumentProvider.connect怎么用?Java IDocumentProvider.connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.ui.texteditor.IDocumentProvider的用法示例。


在下文中一共展示了IDocumentProvider.connect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPosition

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
public static Position getPosition(IFile file, TextSpan textSpan) throws BadLocationException {
	ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager();
	ITextFileBuffer buffer = bufferManager.getTextFileBuffer(file.getLocation(), LocationKind.IFILE);
	if (buffer != null) {
		return getPosition(buffer.getDocument(), textSpan);
	}
	IDocumentProvider provider = new TextFileDocumentProvider();
	try {
		provider.connect(file);
		IDocument document = provider.getDocument(file);
		if (document != null) {
			return getPosition(document, textSpan);
		}
	} catch (CoreException e) {
	} finally {
		provider.disconnect(file);
	}
	return null;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:20,代码来源:EditorUtils.java

示例2: validate

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
@Override
public ValidationResult validate(IResource resource, int kind,
		ValidationState state, IProgressMonitor monitor) {
	IDocument document = null;
	// get document
	try {
		final IDocumentProvider provider = new TextFileDocumentProvider();
		provider.connect(resource);
		document = provider.getDocument(resource);
		provider.disconnect(resource);
	} catch (CoreException e) {
		e.printStackTrace();
	}

	ValidationResult result = new ValidationResult();
	if (document != null) {
		// validate definitions names
		List<ElementRegion> definitionNameRegions = tilesXmlParser
				.getDefinitionNameRegions(document);
		validateRegions(resource, document, result, definitionNameRegions,
				DUP_DEFINITION_MESSAGE_TEXT, IMarker.SEVERITY_WARNING);
	}

	return result;
}
 
开发者ID:aleksandr-m,项目名称:strutsclipse,代码行数:26,代码来源:TilesXmlValidator.java

示例3: getDocument

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
private IDocument getDocument(IDocumentProvider provider, IEditorInput input) {
	if (input == null)
		return null;
	IDocument result= null;
	try {
		provider.connect(input);
		result= provider.getDocument(input);
	} catch (CoreException e) {
	} finally {
		provider.disconnect(input);
	}
	return result;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:14,代码来源:JavaStatusContextViewer.java

示例4: doSetInput

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
protected void doSetInput(final IEditorInput input) throws CoreException {
    if (input == null) {
        close(isSaveOnCloseNeeded());

    } else {
        final IEditorInput oldInput = getEditorInput();
        if (oldInput != null)
            getDocumentProvider().disconnect(oldInput);

        super.setInput(input);

        updateDocumentProvider(input);

        final IDocumentProvider provider = getDocumentProvider();

        provider.connect(input);

        initializeTitle(input);

        if (fSourceViewer != null) {
            initializeSourceViewer(input);

        }

    }

}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:28,代码来源:TestEditor.java

示例5: doSetInput

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
protected void doSetInput(IEditorInput input) throws CoreException {
	if (input == null) {
		close(isSaveOnCloseNeeded());

	} else {
		IEditorInput oldInput = getEditorInput();
		if (oldInput != null)
			getDocumentProvider().disconnect(oldInput);

		super.setInput(input);

		updateDocumentProvider(input);

		IDocumentProvider provider = getDocumentProvider();

		provider.connect(input);

		initializeTitle(input);

		if (fSourceViewer != null) {
			initializeSourceViewer(input);

		}

	}

}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:28,代码来源:TestEditor.java

示例6: addMarkers

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
private void addMarkers(Set<String> deletedKeys) throws Exception {
	
	
	targetFile.deleteMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
	
	
	if (deletedKeys == null || deletedKeys.isEmpty()) {
		//do nothing
		return;
	}
	
	IDocumentProvider provider = new TextFileDocumentProvider();
	provider.connect(targetFile);
	IDocument targetFileDocument  = provider.getDocument(targetFile);
	FindReplaceDocumentAdapter adapter = new FindReplaceDocumentAdapter(targetFileDocument);
	
	
	for (String deletedkey: deletedKeys) {
		
		IRegion region = adapter.find(0, deletedkey, true, false, false, false); 
		
		IMarker marker = targetFile.createMarker(IMarker.PROBLEM);
		
		int lineNumber = targetFileDocument.getLineOfOffset(region.getOffset());
		
		if (marker.exists()) {
			
			marker.setAttribute(IMarker.MESSAGE, "Property might not be used within mule configs.");
			marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
			marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
		    marker.setAttribute(IMarker.LINE_NUMBER, lineNumber + 1);
		    marker.setAttribute(IMarker.CHAR_START, region.getOffset());
		    marker.setAttribute(IMarker.CHAR_END, region.getOffset() + region.getLength());
			
		}
		
		
		
	}
	
	provider.disconnect(targetFile);
	
}
 
开发者ID:mulesoft,项目名称:mule-tooling-incubator,代码行数:44,代码来源:ExtractPlaceholdersJob.java


注:本文中的org.eclipse.ui.texteditor.IDocumentProvider.connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。