當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。