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


Java IFile.isAccessible方法代碼示例

本文整理匯總了Java中org.eclipse.core.resources.IFile.isAccessible方法的典型用法代碼示例。如果您正苦於以下問題:Java IFile.isAccessible方法的具體用法?Java IFile.isAccessible怎麽用?Java IFile.isAccessible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.core.resources.IFile的用法示例。


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

示例1: displayComparisonView

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
 * Display comparison view of test file with expected and actual xpect expectation
 */
private void displayComparisonView(ComparisonFailure cf, Description desc) {
	IXpectURIProvider uriProfider = XpectRunner.INSTANCE.getUriProvider();
	IFile fileTest = null;
	if (uriProfider instanceof N4IDEXpectTestURIProvider) {
		N4IDEXpectTestURIProvider fileCollector = (N4IDEXpectTestURIProvider) uriProfider;
		fileTest = ResourcesPlugin.getWorkspace().getRoot()
				.getFileForLocation(new Path(fileCollector.findRawLocation(desc)));
	}

	if (fileTest != null && fileTest.isAccessible()) {
		N4IDEXpectCompareEditorInput inp = new N4IDEXpectCompareEditorInput(fileTest, cf);
		CompareUI.openCompareEditor(inp);
	} else {
		throw new RuntimeException("paths in descriptions changed!");
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:20,代碼來源:XpectCompareCommandHandler.java

示例2: onDoubleClick

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
 * Invoked when user double-clicks a result node in the UI.
 */
protected void onDoubleClick() {
	final ISelection selection = testTreeViewer.getSelection();
	final ResultNode resultNode = (ResultNode) ((IStructuredSelection) selection).getFirstElement();

	if (resultNode == null) {
		return;
	}

	TestElement testElement = resultNode.getElement();
	if (testElement instanceof TestCase) {

		final URI testCaseURI = ((TestCase) testElement).getURI();
		if (testCaseURI == null) {
			return;
		}

		final IN4JSEclipseProject project = core.findProject(testCaseURI).orNull();
		if (null != project && project.exists()) {
			final URI moduleLocation = testCaseURI.trimFragment();
			final String[] projectRelativeSegments = moduleLocation.deresolve(project.getLocation()).segments();
			final String path = Joiner.on(SEPARATOR)
					.join(copyOfRange(projectRelativeSegments, 1, projectRelativeSegments.length));
			final IFile module = project.getProject().getFile(path);
			if (null != module && module.isAccessible()) {
				uriOpener.open(testCaseURI, true);
			} else {
				openError(getShell(), "Cannot open editor", "Test class not found in selected project.");
			}
		} else {
			openError(getShell(), "Cannot open editor", "The container project not found in the workspace.");
		}

	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:38,代碼來源:TestResultsView.java


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