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


Java IDocumentProvider.isDeleted方法代码示例

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


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

示例1: hack_AbstractTextEditor_doSave

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
private void hack_AbstractTextEditor_doSave(IProgressMonitor progressMonitor) {

        IDocumentProvider p = getDocumentProvider();
        if (p == null)
            return;

        if (p.isDeleted(getEditorInput())) {

            if (isSaveAsAllowed()) {

                /*
                 * 1GEUSSR: ITPUI:ALL - User should never loose changes made in the editors. Changed Behavior to make
                 * sure that if called inside a regular save (because of deletion of input element) there is a way to
                 * report back to the caller.
                 */
                performSaveAs(progressMonitor);

            } else {

                Shell shell = getSite().getShell();
                String title = "Cannot Save";
                String msg = "The file has been deleted or is not accessible.";
                MessageDialog.openError(shell, title, msg);
            }

        } else {
            updateState(getEditorInput());
            validateState(getEditorInput());
            performSave(false, progressMonitor);
        }
    }
 
开发者ID:RepreZen,项目名称:KaiZen-OpenAPI-Editor,代码行数:32,代码来源:JsonEditor.java

示例2: handleEditorInputChanged

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的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();
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:51,代码来源:AbstractFoldingEditor.java

示例3: doSave

import org.eclipse.ui.texteditor.IDocumentProvider; //导入方法依赖的package包/类
@Override
public void doSave(IProgressMonitor progressMonitor) {

	IDocumentProvider p= getDocumentProvider();
	if (p == null) {
		// editor has been closed
		return;
	}

	if (p.isDeleted(getEditorInput())) {

		if (isSaveAsAllowed()) {

			/*
			 * 1GEUSSR: ITPUI:ALL - User should never loose changes made in the editors.
			 * Changed Behavior to make sure that if called inside a regular save (because
			 * of deletion of input element) there is a way to report back to the caller.
			 */
			 performSaveAs(progressMonitor);

		} else {

			/*
			 * 1GF5YOX: ITPJUI:ALL - Save of delete file claims it's still there
			 * Missing resources.
			 */
			Shell shell= getSite().getShell();
			MessageDialog.openError(shell, JavaEditorMessages.CompilationUnitEditor_error_saving_title1, JavaEditorMessages.CompilationUnitEditor_error_saving_message1);
		}

	} else {

		setStatusLineErrorMessage(null);

		updateState(getEditorInput());
		validateState(getEditorInput());

		IWorkingCopyManager manager= JavaPlugin.getDefault().getWorkingCopyManager();
		ICompilationUnit unit= manager.getWorkingCopy(getEditorInput());

		if (unit != null) {
			synchronized (unit) {
				performSave(false, progressMonitor);
			}
		} else
			performSave(false, progressMonitor);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:49,代码来源:CompilationUnitEditor.java


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