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


Java HandlerUtil.getActivePart方法代码示例

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


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

示例1: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
	ImageView imageView = (ImageView) activePart;
	SWTImageCanvas imageCanvas = imageView.imageCanvas;
	if (imageCanvas == null) {
		return null;
	}

	Shell shell = HandlerUtil.getActiveShell(event);

	FileDialog dialog = new FileDialog(shell, SWT.SAVE);
	dialog.setFilterExtensions(new String[] { "*.png", "*.*" });
	dialog.setFilterNames(new String[] { "PNG Files", "All Files" });
	String fileSelected = dialog.open();

	if (fileSelected != null) {
		ImageLoader imageLoader = new ImageLoader();
		imageLoader.data = new ImageData[] { imageCanvas.getImageData() };

		System.out.println("Selected file: " + fileSelected);
		imageLoader.save(fileSelected, SWT.IMAGE_PNG);
	}

	return null;
}
 
开发者ID:NineWorlds,项目名称:xstreamer,代码行数:27,代码来源:ImageViewSaveAsHandler.java

示例2: getOperationContext

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
protected BookmarkPartOperationContext getOperationContext(ExecutionEvent event) {
	IWorkbenchPart part = HandlerUtil.getActivePart(event);
	ISelection selection;
	if (part != null) {
		// see bug #375220 or #282969 to understand why we don't use
		// HandlerUtil.getCurrentSelection(event);
		selection = part.getSite().getSelectionProvider().getSelection();
	} else {
		selection = HandlerUtil.getCurrentSelection(event);
	}
	if (part instanceof BookmarksView) {
		part = ((BookmarksView) part).getPreviousActivePart();
		if (part != null) {
			selection = part.getSite().getSelectionProvider().getSelection();
		}
	}
	return new BookmarkPartOperationContext(part, selection);
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:19,代码来源:AbstractBookmarkPartOperationHandler.java

示例3: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	final AbstractTimelineView timelineView = (AbstractTimelineView)HandlerUtil.getActivePart(event);
	final Command command = event.getCommand();
	final boolean oldValue = HandlerUtil.toggleCommandState(command);
	timelineView.setFollow(!oldValue);
	return null;
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:9,代码来源:FollowHandler.java

示例4: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbenchPart part = HandlerUtil.getActivePart(event);
	if(part instanceof CommonNavigator){
		DeleteAction action=new DeleteAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().getSite());
		action.run();
	}
	
	else if (part instanceof ELTGraphicalEditor) {
		IEditorPart editor = HandlerUtil.getActiveEditor(event);
		((ELTGraphicalEditor) editor).deleteSelection();
		((ELTGraphicalEditor) editor).hideToolTip();
	}
	return null;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:16,代码来源:DeleteHandler.java

示例5: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	List<IFile> jobFiles = new ArrayList<>();
	List<IFile> pastedFileList = new ArrayList<>();
	IWorkbenchPart part = HandlerUtil.getActivePart(event);
	if(part instanceof CommonNavigator){
		PasteAction action = new PasteAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().getSite());
		action.run();
		IWorkspaceRoot workSpaceRoot = ResourcesPlugin.getWorkspace().getRoot();
		IProject project = workSpaceRoot.getProject(JobCopyParticipant.getCopyToPath().split("/")[1]);
		IFolder jobFolder = project.getFolder(
				JobCopyParticipant.getCopyToPath().substring(JobCopyParticipant.getCopyToPath().indexOf('/', 2)));
		IFolder paramFolder = project.getFolder(PARAMETER_FOLDER_NAME);
		try {
			createCurrentJobFileList(jobFolder, jobFiles);
			pastedFileList=getPastedFileList(jobFiles);
			generateUniqueJobIdForPastedFiles(pastedFileList);
			createXmlFilesForPastedJobFiles(pastedFileList);
			List<String> copiedPropertiesList = getCopiedPropertiesList();
			createPropertiesFilesForPastedFiles(paramFolder, pastedFileList, copiedPropertiesList);
			JobCopyParticipant.cleanUpStaticResourcesAfterPasteOperation();

		} catch (CoreException  coreException) {
			logger.warn("Error while copy paste jobFiles",coreException.getMessage() );
		}
		
	}
	
	else if(part instanceof ELTGraphicalEditor){
		IEditorPart editor = HandlerUtil.getActiveEditor(event);
		((ELTGraphicalEditor)editor).pasteSelection();
	}
	
	return null;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:36,代码来源:PasteHandler.java

示例6: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbenchPart part = HandlerUtil.getActivePart(event);
	if(part instanceof ELTGraphicalEditor){
		copy.execute(event);
		cut.execute(event);
	}
	return null;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:10,代码来源:CutHandler.java

示例7: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbenchPart part = HandlerUtil.getActivePart(event);
	if(part instanceof CommonNavigator){
		CopyToClipboardAction action=new CopyToClipboardAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().getSite());
		action.run();
	}

	else if(part instanceof ELTGraphicalEditor){
		IEditorPart editor = HandlerUtil.getActiveEditor(event);
		((ELTGraphicalEditor)editor).copySelection();
	}
	return null;	
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:15,代码来源:CopyHandler.java

示例8: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
	if (activePart instanceof AvroSchemaEditorDebugView) {
		return execute((AvroSchemaEditorDebugView)activePart, event);
	}
	return null;
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:9,代码来源:AbstractDebugHandler.java

示例9: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
	if (activePart instanceof SchemaRegistryView) {
		SchemaRegistryView registryView = (SchemaRegistryView) activePart;
		AvroSchemaEditor editor = registryView.getEditor();
		if (editor != null) {
			return execute(registryView, editor, event);
		}
	}
	return null;
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:13,代码来源:AbstractRegistryViewHandler.java

示例10: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {

	IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
	
	if (activePart instanceof IWithAvroSchemaEditor) {
		
		AvroSchemaEditor editor = ((IWithAvroSchemaEditor) activePart).getEditor();
		
		EditorLayout editorLayout = editor.getContentPart().getEditorLayout();
		EditorLayout newLayout = null;
		switch (editorLayout) {
		case TREE_AND_ATTRIBUTES:
			newLayout = EditorLayout.TWO_TREES;
			break;
		case TWO_TREES:
			newLayout = EditorLayout.TREE_AND_ATTRIBUTES;
			break;
		default:
			throw new UnsupportedOperationException();
		}
		editor.getContentPart().setEditorLayout(newLayout);
		
	}
	
	return null;
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:28,代码来源:SwitchEditorLayoutHandler.java

示例11: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
	ImageView imageView = (ImageView) activePart;
	SWTImageCanvas imageCanvas = imageView.imageCanvas;
	if (imageCanvas == null) {
		return null;
	}
	
	imageCanvas.zoomIn();

	return null;
}
 
开发者ID:NineWorlds,项目名称:xstreamer,代码行数:14,代码来源:ImageViewZoomInHandler.java

示例12: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
	ImageView imageView = (ImageView) activePart;
	SWTImageCanvas imageCanvas = imageView.imageCanvas;
	if (imageCanvas == null) {
		return null;
	}
	
	imageCanvas.fitCanvas();

	return null;
}
 
开发者ID:NineWorlds,项目名称:xstreamer,代码行数:14,代码来源:ImageViewFitHandler.java

示例13: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
	ImageView imageView = (ImageView) activePart;
	SWTImageCanvas imageCanvas = imageView.imageCanvas;
	if (imageCanvas == null) {
		return null;
	}
	
	imageCanvas.zoomOut();

	return null;
}
 
开发者ID:NineWorlds,项目名称:xstreamer,代码行数:14,代码来源:ImageViewZoomOutHandler.java

示例14: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
	ImageView imageView = (ImageView) activePart;
	SWTImageCanvas imageCanvas = imageView.imageCanvas;
	
	imageCanvas.onFileOpen();

	return null;
}
 
开发者ID:NineWorlds,项目名称:xstreamer,代码行数:11,代码来源:ImageViewOpenHandler.java

示例15: execute

import org.eclipse.ui.handlers.HandlerUtil; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
	ImageView imageView = (ImageView) activePart;
	SWTImageCanvas imageCanvas = imageView.imageCanvas;
	if (imageCanvas == null) {
		return null;
	}
	
	imageCanvas.showOriginal();

	return null;
}
 
开发者ID:NineWorlds,项目名称:xstreamer,代码行数:14,代码来源:ImageViewShowOriginalHandler.java


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