本文整理汇总了Java中org.eclipse.ui.texteditor.IDocumentProviderExtension类的典型用法代码示例。如果您正苦于以下问题:Java IDocumentProviderExtension类的具体用法?Java IDocumentProviderExtension怎么用?Java IDocumentProviderExtension使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IDocumentProviderExtension类属于org.eclipse.ui.texteditor包,在下文中一共展示了IDocumentProviderExtension类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeSourceViewer
import org.eclipse.ui.texteditor.IDocumentProviderExtension; //导入依赖的package包/类
private void initializeSourceViewer(final IEditorInput input) {
final IDocumentProvider documentProvider = getDocumentProvider();
final IAnnotationModel model = documentProvider.getAnnotationModel(input);
final IDocument document = documentProvider.getDocument(input);
if (document != null) {
fSourceViewer.setDocument(document, model);
fSourceViewer.setEditable(isEditable());
fSourceViewer.showAnnotations(model != null);
}
if (fElementStateListener instanceof IElementStateListenerExtension) {
boolean isStateValidated = false;
if (documentProvider instanceof IDocumentProviderExtension)
isStateValidated = ((IDocumentProviderExtension) documentProvider).isStateValidated(input);
final IElementStateListenerExtension extension = (IElementStateListenerExtension) fElementStateListener;
extension.elementStateValidationChanged(input, isStateValidated);
}
}
示例2: updateState
import org.eclipse.ui.texteditor.IDocumentProviderExtension; //导入依赖的package包/类
protected void updateState(final IEditorInput input) {
final IDocumentProvider provider = getDocumentProvider();
if (provider instanceof IDocumentProviderExtension) {
final IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;
try {
extension.updateStateCache(input);
if (fSourceViewer != null)
fSourceViewer.setEditable(isEditable());
} catch (final CoreException e) {
ERDiagramActivator.log(e);
}
}
}
示例3: initializeSourceViewer
import org.eclipse.ui.texteditor.IDocumentProviderExtension; //导入依赖的package包/类
private void initializeSourceViewer(IEditorInput input) {
IDocumentProvider documentProvider = getDocumentProvider();
IAnnotationModel model = documentProvider.getAnnotationModel(input);
IDocument document = documentProvider.getDocument(input);
if (document != null) {
fSourceViewer.setDocument(document, model);
fSourceViewer.setEditable(isEditable());
fSourceViewer.showAnnotations(model != null);
}
if (fElementStateListener instanceof IElementStateListenerExtension) {
boolean isStateValidated = false;
if (documentProvider instanceof IDocumentProviderExtension)
isStateValidated = ((IDocumentProviderExtension) documentProvider)
.isStateValidated(input);
IElementStateListenerExtension extension = (IElementStateListenerExtension) fElementStateListener;
extension.elementStateValidationChanged(input, isStateValidated);
}
}
示例4: updateState
import org.eclipse.ui.texteditor.IDocumentProviderExtension; //导入依赖的package包/类
protected void updateState(IEditorInput input) {
IDocumentProvider provider = getDocumentProvider();
if (provider instanceof IDocumentProviderExtension) {
IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;
try {
extension.updateStateCache(input);
if (fSourceViewer != null)
fSourceViewer.setEditable(isEditable());
} catch (CoreException e) {
ERDiagramActivator.log(e);
}
}
}
示例5: isEditable
import org.eclipse.ui.texteditor.IDocumentProviderExtension; //导入依赖的package包/类
public boolean isEditable() {
final IDocumentProvider provider = getDocumentProvider();
if (provider instanceof IDocumentProviderExtension) {
final IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;
return extension.isModifiable(getEditorInput());
}
return false;
}
示例6: validateState
import org.eclipse.ui.texteditor.IDocumentProviderExtension; //导入依赖的package包/类
protected void validateState(final IEditorInput input) {
final IDocumentProvider provider = getDocumentProvider();
if (!(provider instanceof IDocumentProviderExtension))
return;
final IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;
try {
extension.validateState(input, getSite().getShell());
} catch (final CoreException x) {
final IStatus status = x.getStatus();
if (status == null || status.getSeverity() != IStatus.CANCEL) {
final Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID);
final ILog log = Platform.getLog(bundle);
log.log(x.getStatus());
final Shell shell = getSite().getShell();
final String title = "EditorMessages.Editor_error_validateEdit_title";
final String msg = "EditorMessages.Editor_error_validateEdit_message";
ErrorDialog.openError(shell, title, msg, x.getStatus());
}
return;
}
if (fSourceViewer != null)
fSourceViewer.setEditable(isEditable());
}
示例7: isEditable
import org.eclipse.ui.texteditor.IDocumentProviderExtension; //导入依赖的package包/类
public boolean isEditable() {
IDocumentProvider provider = getDocumentProvider();
if (provider instanceof IDocumentProviderExtension) {
IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;
return extension.isModifiable(getEditorInput());
}
return false;
}
示例8: validateState
import org.eclipse.ui.texteditor.IDocumentProviderExtension; //导入依赖的package包/类
protected void validateState(IEditorInput input) {
IDocumentProvider provider = getDocumentProvider();
if (!(provider instanceof IDocumentProviderExtension))
return;
IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;
try {
extension.validateState(input, getSite().getShell());
} catch (CoreException x) {
IStatus status = x.getStatus();
if (status == null || status.getSeverity() != IStatus.CANCEL) {
Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID);
ILog log = Platform.getLog(bundle);
log.log(x.getStatus());
Shell shell = getSite().getShell();
String title = "EditorMessages.Editor_error_validateEdit_title";
String msg = "EditorMessages.Editor_error_validateEdit_message";
ErrorDialog.openError(shell, title, msg, x.getStatus());
}
return;
}
if (fSourceViewer != null)
fSourceViewer.setEditable(isEditable());
}
示例9: handleEditorInputChanged
import org.eclipse.ui.texteditor.IDocumentProviderExtension; //导入依赖的package包/类
/**
* This code auto-refreshes files that are out of synch when we first open them. This is a bit of a hack that looks
* to see if it seems we're out of sync and the file isn't open yet. If it is already open, we call super so it pops
* a dialog asking if you want to update the file contents.
*/
@Override
protected void handleEditorInputChanged()
{
final IDocumentProvider provider = getDocumentProvider();
if (provider == null)
{
// fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=15066
close(false);
return;
}
final IEditorInput input = getEditorInput();
boolean wasActivated = true;
try
{
Field f = AbstractTextEditor.class.getDeclaredField("fHasBeenActivated"); //$NON-NLS-1$
f.setAccessible(true);
wasActivated = (Boolean) f.get(this);
}
catch (Exception e1)
{
// ignore
}
if (!wasActivated && !provider.isDeleted(input))
{
try
{
if (provider instanceof IDocumentProviderExtension)
{
IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;
extension.synchronize(input);
}
else
{
doSetInput(input);
}
return;
}
catch (Exception e)
{
// ignore
}
}
super.handleEditorInputChanged();
}