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


Java GraphicalViewer类代码示例

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


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

示例1: save

import org.eclipse.gef.GraphicalViewer; //导入依赖的package包/类
public static boolean save(IEditorPart editorPart, GraphicalViewer viewer,
		String saveFilePath, int format) {
	Assert.isNotNull(editorPart,
			"null editorPart passed to ImageSaveUtil::save");
	Assert.isNotNull(viewer, "null viewer passed to ImageSaveUtil::save");
	Assert.isNotNull(saveFilePath,
			"null saveFilePath passed to ImageSaveUtil::save");

	if (format != SWT.IMAGE_BMP && format != SWT.IMAGE_JPEG
			&& format != SWT.IMAGE_PNG && format != SWT.IMAGE_GIF)
		throw new IllegalArgumentException("Save format not supported");

	try {
		saveEditorContentsAsImage(editorPart, viewer, saveFilePath, format);
	} catch (Exception ex) {
		MessageDialog.openError(editorPart.getEditorSite().getShell(),
				"Save Error", "Could not save editor contents");
		return false;
	}

	return true;
}
 
开发者ID:ShoukriKattan,项目名称:ForgedUI-Eclipse,代码行数:23,代码来源:ImageSaveUtil.java

示例2: configureGraphicalViewer

import org.eclipse.gef.GraphicalViewer; //导入依赖的package包/类
@Override
protected void configureGraphicalViewer() {
	super.configureGraphicalViewer();
	getGraphicalViewer().getControl().setBackground(ColorConstants.button);

	GraphicalViewer graphicalViewer = getGraphicalViewer();
	MainDesignerRootEditPart rootEditPart = new MainDesignerRootEditPart();

	graphicalViewer.setRootEditPart(rootEditPart);
	// set EditPartFactory
	graphicalViewer.setEditPartFactory(new JasperDesignEditPartFactory());

	// set rulers providers
	RulerProvider provider = new ReportRulerProvider(new ReportRuler(true, RulerProvider.UNIT_PIXELS));
	graphicalViewer.setProperty(RulerProvider.PROPERTY_HORIZONTAL_RULER, provider);

	provider = new ReportRulerProvider(new ReportRuler(false, RulerProvider.UNIT_PIXELS));
	graphicalViewer.setProperty(RulerProvider.PROPERTY_VERTICAL_RULER, provider);

	Boolean isRulerVisible = jrContext.getPropertyBoolean(RulersGridPreferencePage.P_PAGE_RULERGRID_SHOWRULER);

	graphicalViewer.setProperty(RulerProvider.PROPERTY_RULER_VISIBILITY, isRulerVisible);

	createAdditionalActions();
	graphicalViewer.setKeyHandler(new JSSGraphicalViewerKeyHandler(graphicalViewer));
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:27,代码来源:CrosstabEditor.java

示例3: save

import org.eclipse.gef.GraphicalViewer; //导入依赖的package包/类
public static boolean save(IEditorPart editorPart, GraphicalViewer viewer) {
	Assert.isNotNull(editorPart, "null editorPart passed to ImageSaveUtil::save");
	Assert.isNotNull(viewer, "null viewer passed to ImageSaveUtil::save");

	String saveFilePath = getSaveFilePath(editorPart, viewer, -1);
	if (saveFilePath == null)
		return false;
	int format = SWT.IMAGE_JPEG;
	if (saveFilePath.endsWith(".jpeg"))
		format = SWT.IMAGE_JPEG;
	else if (saveFilePath.endsWith(".bmp"))
		format = SWT.IMAGE_BMP;
	// else if (saveFilePath.endsWith(".ico"))
	// format = SWT.IMAGE_ICO;
	return save(editorPart, viewer, saveFilePath, format);
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:17,代码来源:ImageSaveUtil.java

示例4: getSaveFilePath

import org.eclipse.gef.GraphicalViewer; //导入依赖的package包/类
private static String getSaveFilePath(IEditorPart editorPart, GraphicalViewer viewer, int format) {
	FileDialog fileDialog = new FileDialog(editorPart.getEditorSite().getShell(), SWT.SAVE);
	String[] filterExtensions = new String[] { "*.jpeg",
			"*.bmp"/*
					 * , "*.ico" , "*.png", "*.gif"
					 */ };
	if (format == SWT.IMAGE_BMP)
		filterExtensions = new String[] { "*.bmp" };
	else if (format == SWT.IMAGE_JPEG)
		filterExtensions = new String[] { "*.jpeg" };
	// else if (format == SWT.IMAGE_ICO)
	// filterExtensions = new String[] { "*.ico" };
	fileDialog.setFilterExtensions(filterExtensions);

	return fileDialog.open();
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:17,代码来源:ImageSaveUtil.java

示例5: getAdapter

import org.eclipse.gef.GraphicalViewer; //导入依赖的package包/类
public Object getAdapter(Class adapter) {

		if (adapter == GraphicalViewer.class || adapter == EditPartViewer.class)
			return getGraphicalViewer();
		else if (adapter == CommandStack.class)
			return getCommandStack();
		else if (adapter == EditDomain.class)
			return getEditDomain();
		else if (adapter == ActionRegistry.class)
			return getActionRegistry();
		else if (adapter == IPropertySheetPage.class)
			return new PropertiesView(true);
		else if (adapter == IContentOutlinePage.class) {
			return new GW4EOutlinePage();
		} else if (adapter == ZoomManager.class)
			return ((ScalableRootEditPart) getGraphicalViewer().getRootEditPart()).getZoomManager();
		return super.getAdapter(adapter);
	}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:19,代码来源:GW4EEditor.java

示例6: checkWatcher

import org.eclipse.gef.GraphicalViewer; //导入依赖的package包/类
/**
 * Return true if watch point enable otherwise false
 *
 * @return boolean
 */
public boolean checkWatcher(Component selectedComponent, String portName) {
	ELTGraphicalEditor editor = (ELTGraphicalEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
			.getActiveEditor();
	GraphicalViewer graphicalViewer = (GraphicalViewer) ((GraphicalEditor) editor).getAdapter(GraphicalViewer.class);

	for (Iterator<EditPart> iterator = graphicalViewer.getEditPartRegistry().values().iterator(); iterator.hasNext();) {
		EditPart editPart = iterator.next();
		if (editPart instanceof ComponentEditPart) {
			Component comp = ((ComponentEditPart) editPart).getCastedModel();
			if (comp.equals(selectedComponent)) {
				List<PortEditPart> portEditParts = editPart.getChildren();
				for (AbstractGraphicalEditPart part : portEditParts) {
					if (part instanceof PortEditPart) {
						String port_Name = ((PortEditPart) part).getCastedModel().getTerminal();
						if (port_Name.equals(portName)) {
							return ((PortEditPart) part).getPortFigure().isWatched();
						}
					}
				}
			}
		}
	}
	return false;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:30,代码来源:ViewDataUtils.java

示例7: getSubJobList

import org.eclipse.gef.GraphicalViewer; //导入依赖的package包/类
/**
 * Collect all subjob file from active editor, also check for nested subjob. 
 * @return list of subjob.
 */
public List<String> getSubJobList() {
	ArrayList<String> subJobList=new ArrayList<>();
	ELTGraphicalEditor editor = (ELTGraphicalEditor)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
	if (editor != null && editor instanceof ELTGraphicalEditor) {
		GraphicalViewer graphicalViewer = (GraphicalViewer) ((GraphicalEditor) editor)
				.getAdapter(GraphicalViewer.class);
		for (Iterator<EditPart> ite = graphicalViewer.getEditPartRegistry().values().iterator(); ite.hasNext();) {
			EditPart editPart = ite.next();
			if (editPart instanceof ComponentEditPart) {
				Component component = ((ComponentEditPart) editPart).getCastedModel();
				if(Constants.SUBJOB_COMPONENT.equals(component.getComponentName())){
				  String subJobPath=(String) component.getProperties().get(Constants.PATH_PROPERTY_NAME);
				  subJobList.add(subJobPath);
				  checkNestedSubJob(subJobList, subJobPath);
				}
			}
		}
	}
	return subJobList;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:25,代码来源:JobScpAndProcessUtility.java

示例8: execute

import org.eclipse.gef.GraphicalViewer; //导入依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	if (DebugHelper.INSTANCE.hasMoreWatchPoints()) {
		ELTGraphicalEditor editor = (ELTGraphicalEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow()
				.getActivePage().getActiveEditor();
		GraphicalViewer graphicalViewer = (GraphicalViewer) ((GraphicalEditor) editor)
				.getAdapter(GraphicalViewer.class);
		for (Iterator<EditPart> iterator = graphicalViewer.getEditPartRegistry().values().iterator(); iterator
				.hasNext();) {
			EditPart editPart = (EditPart) iterator.next();
			if (editPart instanceof ComponentEditPart) {
				Component comp = ((ComponentEditPart) editPart).getCastedModel();
				comp.clearWatchers();
			} else if (editPart instanceof PortEditPart) {
				((PortEditPart) editPart).getPortFigure().removeWatcherColor();
				((PortEditPart) editPart).getPortFigure().setWatched(false);
				((PortEditPart) editPart).getCastedModel().setWatched(false);
			}
		}
		showMessage(Messages.WATCH_POINT_REMOVED_SUCCESSFULLY);
	} else {
		showMessage(Messages.NO_WATCH_POINT_AVAILABLE);
	}
	return null;

}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:27,代码来源:RemoveDebugHandler.java

示例9: getUniqueJobId

import org.eclipse.gef.GraphicalViewer; //导入依赖的package包/类
/**
 * Gets the unique job id.
 *
 * @return the unique job id
 */
private String getUniqueJobId(){
	ELTGraphicalEditor editor = (ELTGraphicalEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
			.getActiveEditor();
	String uniqueJobId = editor.getJobId();
	isJobUpdated =false;
	GraphicalViewer graphicalViewer = (GraphicalViewer) ((GraphicalEditor) editor).getAdapter(GraphicalViewer.class);
		for (Iterator<EditPart> ite = graphicalViewer.getEditPartRegistry().values().iterator();ite.hasNext();){ 
			EditPart editPart = (EditPart) ite.next();
			if (editPart instanceof ComponentEditPart){
				Component component = ((ComponentEditPart) editPart)
						.getCastedModel();
				if(component.getStatus()!= ComponentExecutionStatus.BLANK){
					isJobUpdated = true;
					break;
				}
			}
		}
	
	return uniqueJobId;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:26,代码来源:ExecutionTrackingConsoleUtils.java

示例10: clearTrackingStatusForEditor

import org.eclipse.gef.GraphicalViewer; //导入依赖的package包/类
/**
 * Clear tracking status for editor.
 * 
 * @param editor
 *            the editor
 */
public void clearTrackingStatusForEditor(ELTGraphicalEditor editor) {
	GraphicalViewer graphicalViewer = (GraphicalViewer) ((GraphicalEditor) editor)
			.getAdapter(GraphicalViewer.class);
	for (Iterator<EditPart> ite = graphicalViewer.getEditPartRegistry()
			.values().iterator(); ite.hasNext();) {
		EditPart editPart = ite.next();
		if (editPart instanceof ComponentEditPart) {
			Component component = ((ComponentEditPart) editPart)
					.getCastedModel();
			component.updateStatus(ComponentExecutionStatus.BLANK.value());
		} else if (editPart instanceof LinkEditPart) {
			((LinkEditPart) editPart).clearRecordCountAtPort();
		}
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:22,代码来源:TrackingDisplayUtils.java

示例11: hasMoreWatchPoints

import org.eclipse.gef.GraphicalViewer; //导入依赖的package包/类
/**
 * This function will check watch point in the graph and return true if any watch point exist 
 *
 */
public boolean hasMoreWatchPoints(){
	IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
	if(activeEditor instanceof ELTGraphicalEditor){
		ELTGraphicalEditor editor=(ELTGraphicalEditor) activeEditor;
		if(editor!=null){
			GraphicalViewer	graphicalViewer =(GraphicalViewer) ((GraphicalEditor)editor).getAdapter(GraphicalViewer.class);
			for (Object objectEditPart : graphicalViewer.getEditPartRegistry().values()){
				if(objectEditPart instanceof ComponentEditPart){
					List<PortEditPart> portEditParts = ((EditPart) objectEditPart).getChildren();
					for(AbstractGraphicalEditPart part : portEditParts) {	
						if(part instanceof PortEditPart){
							boolean isWatch = ((PortEditPart)part).getPortFigure().isWatched();
							if(isWatch){
								return isWatch;
							}
						}
					}
				}
			}
		}
	}
	return false;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:28,代码来源:DebugHelper.java

示例12: showComponentCreationOnCanvas

import org.eclipse.gef.GraphicalViewer; //导入依赖的package包/类
/**
 * Creation of content assist
 * @param event
 * @param viewer
 * @param paletteRoot
 */
public void showComponentCreationOnCanvas(KeyEvent event, GraphicalViewer viewer, PaletteRoot paletteRoot) {
	this.graphicViewer = viewer;
	this.graphicControl = viewer.getControl();
	this.triggerChar = event.character;
	this.paletteRoot = paletteRoot;
	Point cursorRelativePosition = calculatePosition();
	if (cursorRelativePosition == null) {
		return;
	}

	disposeAssistText();

	createAssistText(cursorRelativePosition);

	initializeListneres();

	activateAssist(triggerChar);

}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:26,代码来源:ComponentSearchUtility.java

示例13: removeWatch

import org.eclipse.gef.GraphicalViewer; //导入依赖的package包/类
private void removeWatch(Port sourcePort, Component sourceComponent){
	ELTGraphicalEditor editor=(ELTGraphicalEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
	GraphicalViewer	graphicalViewer =(GraphicalViewer) ((GraphicalEditor)editor).getAdapter(GraphicalViewer.class);
	for (Object objectEditPart : graphicalViewer.getEditPartRegistry().values()) 
	{
		EditPart editPart = (EditPart) objectEditPart;
		if(editPart instanceof ComponentEditPart) 
		{
			Component comp = ((ComponentEditPart)editPart).getCastedModel();
			if(comp.equals(sourceComponent)){
				List<PortEditPart> portEditParts = editPart.getChildren();
				for(AbstractGraphicalEditPart part:portEditParts)
				{
					if(part instanceof PortEditPart){
						if(((PortEditPart)part).getCastedModel().getTerminal().equals(sourcePort.getTerminal())){
							((PortEditPart)part).getPortFigure().removeWatcherColor();
							((PortEditPart)part).getPortFigure().setWatched(false);
						} 
					}
				}
			}
		} 
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:25,代码来源:ComponentDeleteCommand.java

示例14: removeWatch

import org.eclipse.gef.GraphicalViewer; //导入依赖的package包/类
private void removeWatch(Port sourcePort, Component sourceComponent){
	ELTGraphicalEditor editor=(ELTGraphicalEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
	GraphicalViewer	graphicalViewer =(GraphicalViewer) ((GraphicalEditor)editor).getAdapter(GraphicalViewer.class);
	for (Iterator<EditPart> iterator = graphicalViewer.getEditPartRegistry().values().iterator(); iterator.hasNext();)
	{
		EditPart editPart = (EditPart) iterator.next();
		if(editPart instanceof ComponentEditPart) 
		{
			Component comp = ((ComponentEditPart)editPart).getCastedModel();
			if(comp.equals(sourceComponent)){
				List<PortEditPart> portEditParts = editPart.getChildren();
				for(AbstractGraphicalEditPart part:portEditParts)
				{
					if(part instanceof PortEditPart){
						if(((PortEditPart)part).getCastedModel().getTerminal().equals(sourcePort.getTerminal())){
							((PortEditPart)part).getPortFigure().removeWatcherColor();
							((PortEditPart)part).getPortFigure().setWatched(false);
						} 
					}
				}
			}
		} 
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:25,代码来源:LinkDeleteCommand.java

示例15: createEditor

import org.eclipse.gef.GraphicalViewer; //导入依赖的package包/类
/**
 * Overrides the underlying editor widget to add the date slider to it.
 * @param parent
 */
public void createEditor(Composite parent){
	GraphicalViewer viewer = new ScrollingGraphicalViewer();
	Control control = viewer.createControl(parent);

	if(parent.getLayout() instanceof GridLayout){ 
		GridData gridData = new GridData();
		gridData.horizontalSpan = 2;
		gridData.horizontalAlignment = SWT.FILL;
		gridData.grabExcessHorizontalSpace = true;
		gridData.verticalAlignment = SWT.FILL;
		gridData.grabExcessVerticalSpace = true;
		control.setLayoutData(gridData);
	}

	setGraphicalViewer(viewer);
	configureGraphicalViewer();
	hookGraphicalViewer();
	initializeGraphicalViewer();
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:24,代码来源:DwGraphicalFeatureModelViewer.java


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