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


Java OpenStrategy类代码示例

本文整理汇总了Java中org.eclipse.jface.util.OpenStrategy的典型用法代码示例。如果您正苦于以下问题:Java OpenStrategy类的具体用法?Java OpenStrategy怎么用?Java OpenStrategy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: handleDoubleClick

import org.eclipse.jface.util.OpenStrategy; //导入依赖的package包/类
void handleDoubleClick(DoubleClickEvent event) {
	TreeViewer viewer= fPart.getTreeViewer();
	IStructuredSelection selection= (IStructuredSelection)event.getSelection();
	Object element= selection.getFirstElement();
	if (viewer.isExpandable(element)) {
		if (doubleClickGoesInto()) {
			// don't zoom into compilation units and class files
			if (element instanceof ICompilationUnit || element instanceof IClassFile)
				return;
			if (element instanceof IOpenable || element instanceof IContainer || element instanceof IWorkingSet) {
				fZoomInAction.run();
			}
		} else {
			IAction openAction= fNavigateActionGroup.getOpenAction();
			if (openAction != null && openAction.isEnabled() && OpenStrategy.getOpenMethod() == OpenStrategy.DOUBLE_CLICK)
				return;
			if (selection instanceof ITreeSelection) {
				TreePath[] paths= ((ITreeSelection)selection).getPathsFor(element);
				for (int i= 0; i < paths.length; i++) {
					viewer.setExpandedState(paths[i], !viewer.getExpandedState(paths[i]));
				}
			} else {
				viewer.setExpandedState(element, !viewer.getExpandedState(element));
			}
		}
	} else if (element instanceof IProject && !((IProject) element).isOpen()) {
		OpenProjectAction openProjectAction= fProjectActionGroup.getOpenProjectAction();
		if (openProjectAction.isEnabled()) {
			openProjectAction.run();
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:33,代码来源:PackageExplorerActionGroup.java

示例2: run

import org.eclipse.jface.util.OpenStrategy; //导入依赖的package包/类
@Override
public void run(IStructuredSelection selection) {
       if (!checkEnabled(selection))
           return;

       for (Iterator<?> iter= selection.iterator(); iter.hasNext();) {
        boolean noError= CallHierarchyUI.openInEditor(iter.next(), getShell(), OpenStrategy.activateOnOpen());
        if (! noError)
        	return;
	}
   }
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:OpenLocationAction.java

示例3: open

import org.eclipse.jface.util.OpenStrategy; //导入依赖的package包/类
@Override
protected void open(ISelection selection, boolean activate) {
	if (selection instanceof IStructuredSelection) {
		for (Iterator<?> iter= ((IStructuredSelection)selection).iterator(); iter.hasNext();) {
			boolean noError= CallHierarchyUI.openInEditor(iter.next(), getSite().getShell(), OpenStrategy.activateOnOpen());
			if (!noError)
				return;
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:11,代码来源:CallHierarchyViewPart.java

示例4: openFile1

import org.eclipse.jface.util.OpenStrategy; //导入依赖的package包/类
/**
 * Opens an editor on the given file resource.
 * @param file
 *            the file resource
 */
void openFile1(IFile file) throws Exception{
	try {
		boolean activate = OpenStrategy.activateOnOpen();
		if (editorDescriptor == null) {
			// 如果是nattble打开的,就验证其是否已经被打开
			if (!validIsopened(file)) {
				return;
			}
			String filePath = file.getFullPath().toOSString();
			// Bug #2519
			if (CommonFunction.validXlfExtensionByFileName(file.getName())
					|| (filePath.startsWith(File.separator + file.getProject().getName() + File.separator
							+ "Intermediate" + File.separator + "Report") && file.getName().endsWith(".html"))) {
				// 之前的这块验证 xliff 文件的代码是放在 nattable 打开时,现在改为在调用 nattable 打开之前
				// html 是不会验证路径的
				if (!file.getFullPath().getFileExtension().equals("html")) {
					if (XLFValidator.validateXliffFile(file)) {
						IDE.openEditor(page, file, activate);
					}
				}else {
					IDE.openEditor(page, file, activate);
				}
			} else {
				boolean openReult = Program.launch(file.getLocation().toOSString());
				if (!openReult) {
					MessageDialog.openWarning(page.getWorkbenchWindow().getShell(), WorkbenchNavigatorMessages.navigator_all_dialog_warning,
							MessageFormat.format(WorkbenchNavigatorMessages.actions_OpenFileWithValidAction_notFindProgram, new Object[]{file.getLocation().getFileExtension()}));
				}
			}
		} else {
			if (ensureFileLocal(file)) {
				if (!file.getFullPath().getFileExtension().equals("html")) {
					if (XLFValidator.validateXliffFile(file)) {
						page.openEditor(new FileEditorInput(file), editorDescriptor.getId(), activate);
					}
				}else {
					page.openEditor(new FileEditorInput(file), editorDescriptor.getId(), activate);
				}
			}
		}
	} catch (PartInitException e) {
		DialogUtil.openError(page.getWorkbenchWindow().getShell(),
				IDEWorkbenchMessages.OpenFileAction_openFileShellTitle, e.getMessage(), e);
	}
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:51,代码来源:OpenFileWithValidAction.java

示例5: run

import org.eclipse.jface.util.OpenStrategy; //导入依赖的package包/类
public void run( )
{
	FileDialog dialog = new FileDialog( fWindow.getShell( ), SWT.OPEN
			| SWT.MULTI );
	dialog.setText( DesignerWorkbenchMessages.Dialog_openFile );
	dialog.setFilterExtensions( filterExtensions );
	dialog.setFilterPath( ResourcesPlugin.getWorkspace( )
			.getRoot( )
			.getProjectRelativePath( )
			.toOSString( ) );
	dialog.open( );
	String[] names = dialog.getFileNames( );

	if ( names != null )
	{
		String fFilterPath = dialog.getFilterPath( );

		int numberOfFilesNotFound = 0;
		StringBuffer notFound = new StringBuffer( );
		for ( int i = 0; i < names.length; i++ )
		{
			File file = new File( fFilterPath + File.separator + names[i] );
			if ( file.exists( ) )
			{
				IWorkbenchPage page = fWindow.getActivePage( );
				IEditorInput input = new ReportEditorInput( file );
				IEditorDescriptor editorDesc = getEditorDescriptor( input,
						OpenStrategy.activateOnOpen( ) );
				try
				{
					page.openEditor( input, editorDesc.getId( ) );
				}
				catch ( Exception e )
				{
					ExceptionUtil.handle( e );
				}
			}
			else
			{
				if ( ++numberOfFilesNotFound > 1 )
					notFound.append( '\n' );
				notFound.append( file.getName( ) );
			}
		}
		if ( numberOfFilesNotFound > 0 )
		{
			// String msgFmt= numberOfFilesNotFound == 1 ?
			// TextEditorMessages.OpenExternalFileAction_message_fileNotFound
			// :
			// TextEditorMessages.OpenExternalFileAction_message_filesNotFound;
			// String msg= MessageFormat.format(msgFmt, new Object[] {
			// notFound.toString() });
			// MessageDialog.openError(fWindow.getShell(),
			// TextEditorMessages.OpenExternalFileAction_title, msg);
		}
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:58,代码来源:OpenFileAction.java


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