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


Java Tool类代码示例

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


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

示例1: getOverlappingEditParts

import org.eclipse.gef.Tool; //导入依赖的package包/类
/**
 * The best way to think about this method is to imaging that you are shooting
 * an arrow through a violation indicator on the timeline. When that arrow gets
 * pinned to the timeline, it will be going through one or more violations
 * (or even no violations if you didn't shoot at a violation). To find out which
 * violations you "pinned," use this method.
 *
 * @param scaleTimelineMarkerEditPart
 * @return the overlapping edit parts
 */
public static List<EditPart> getOverlappingEditParts(ScaleTimelineMarkerEditPart
		scaleTimelineMarkerEditPart)
{
	Tool tool = scaleTimelineMarkerEditPart.getViewer().getEditDomain().getActiveTool();
	List<EditPart> editParts = null;
	if(tool instanceof TimelineTool) {
		TimelineTool timelineTool = (TimelineTool)tool;

		editParts = timelineTool.getEditPartsForRequest
			(new Request(TimelineConstants.REQ_ERASE_TOOLTIP_FEEDBACK));
	}

	/*
	 * there is a case where a child tooltip is displayed from a parent
	 * and as such the above timeline tool method to get the edit parts fails
	 * because it uses the current viewer for the tool (the current viewer is
	 * null in this case).
	 */
	if(editParts == null) {
		editParts = new ArrayList<EditPart>();
		editParts.add(scaleTimelineMarkerEditPart);
	}
	return editParts;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:35,代码来源:ScaleTimelineMarkerTooltip.java

示例2: eraseTargetFeedback

import org.eclipse.gef.Tool; //导入依赖的package包/类
@Override
public void eraseTargetFeedback(Request request) {
	super.eraseTargetFeedback(request);
	if (request instanceof LocationRequest 
			&& tooltipShell != null
			&& !tooltipShell.isDisposed()) {
		Timeline activeEditPart = TimelineUtils.getTimeline(this);
		if (activeEditPart != null) {
			EditDomain editDomain = activeEditPart.getEditDomain();
			Tool tool = editDomain.getActiveTool();
			if(tool instanceof TimelineTool) {
				TimelineTool timelineTool = (TimelineTool)tool;
				if(timelineTool != null
						&& timelineTool.getTargetUnderMouse() != null
						&& !timelineTool.getTargetUnderMouse().equals(this.getHost())) {
					tooltipShell.dispose();
					tooltipShell = null;
				}
			}
		}
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:23,代码来源:HeatMapDataEditPartHoverEditPolicy.java

示例3: getCurrentLocation

import org.eclipse.gef.Tool; //导入依赖的package包/类
/**
 * Returns the current cursor location for Diagram.
 * 
 * @param argumentEditPart
 *            the argument edit part.
 * @return the current point.
 */
public static Point getCurrentLocation(ArgumentEditPart argumentEditPart) {
	IDiagramGraphicalViewer viewer = DcaseEditorUtil
			.getCurrentDcaseEditor().getDiagramGraphicalViewer();
	FigureCanvas canvas = (FigureCanvas) viewer.getControl();
	// the position of scrollable diagram.
	Point viewPoint = canvas.getViewport().getViewLocation();
	Tool tool = argumentEditPart.getViewer().getEditDomain()
			.getActiveTool();
	AbstractTool aTool = (AbstractTool) tool;
	Point toolLocation = null;
	try {
		Method method = AbstractTool.class.getDeclaredMethod("getLocation"); //$NON-NLS-1$
		method.setAccessible(true);
		toolLocation = ((org.eclipse.draw2d.geometry.Point) method
				.invoke(aTool)).getCopy();
	} catch (Exception e) {
		MessageWriter.writeMessageToConsole(
				Messages.AddPatternContributionItem_0,
				MessageTypeImpl.CREATE_PATTERN_FAILED);
		return new Point(0, 0);
	}
	return new Point(viewPoint.x + toolLocation.x, viewPoint.y
			+ toolLocation.y);
}
 
开发者ID:d-case,项目名称:d-case_editor,代码行数:32,代码来源:ModuleUtil.java

示例4: createTool

import org.eclipse.gef.Tool; //导入依赖的package包/类
@Override
public Tool createTool() {
    final InsertedImageTool tool = new InsertedImageTool();
    tool.setProperties(getToolProperties());

    return tool;
}
 
开发者ID:roundrop,项目名称:ermasterr,代码行数:8,代码来源:InsertImageTool.java

示例5: createTool

import org.eclipse.gef.Tool; //导入依赖的package包/类
@Override
public Tool createTool() {
	InsertedImageTool tool = new InsertedImageTool();
	tool.setProperties(getToolProperties());

	return tool;
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:8,代码来源:InsertImageTool.java

示例6: CreationToolEntry

import org.eclipse.gef.Tool; //导入依赖的package包/类
public CreationToolEntry(String label, String shortDesc, IElementType elementType, ImageDescriptor iconSmall,
		ImageDescriptor iconLarge, boolean directEdit) {
	super(label, shortDesc, null, iconSmall, iconLarge);
	this.elementType = elementType;
	this.directEdit = directEdit;
	// Use of 'dummy' PaletteToolEntry here is required because of an
	// instanceof check in PaletteToolTransferDragSourceListener
	setTemplate(new PaletteToolEntry(null, null, null) {
		@Override
		public Tool createTool() {
			return CreationToolEntry.this.createTool();
		}
	});
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:15,代码来源:DefaultSCTPaletteFactory.java

示例7: getCurrentTool

import org.eclipse.gef.Tool; //导入依赖的package包/类
private Tool getCurrentTool() {
	if(timeline != null) {
		List<TimelineViewer> timelineViewers = timeline.getTimelineViewers();
		for(TimelineViewer timelineViewer : timelineViewers) {
			EditDomain editDomain = timelineViewer.getEditDomain();
			if(editDomain != null) {
				return editDomain.getActiveTool();
			}
		}
	}
	return null;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:13,代码来源:HeatMapDataEditPartHoverEditPolicy.java

示例8: findThePaletteTool

import org.eclipse.gef.Tool; //导入依赖的package包/类
private Tool findThePaletteTool(final EditPartViewer theEditPartViewer, final String toolPath) {
	final EditDomain theDomain = theEditPartViewer.getEditDomain();
	final PaletteViewer thePaletteViewer = theDomain.getPaletteViewer();
	final ToolEntry toolEntry = findByLabel(thePaletteViewer.getPaletteRoot(), toolPath);
	thePaletteViewer.setActiveTool(toolEntry);

	final Tool theTool = toolEntry.createTool();
	theTool.setViewer(theEditPartViewer);
	theTool.setEditDomain(theDomain);

	return theTool;
}
 
开发者ID:timezra,项目名称:UML-Testing-Tool,代码行数:13,代码来源:ClassDiagramPaletteTest.java

示例9: doubleClick

import org.eclipse.gef.Tool; //导入依赖的package包/类
private void doubleClick(final Tool theTool, final EditPartViewer theEditPartViewer) {
	final Event theEvent = new Event();
	theEvent.widget = theEditPartViewer.getControl();
	final MouseEvent mouseEvent = new MouseEvent(theEvent);
	mouseEvent.button = 1;
	theTool.mouseDoubleClick(mouseEvent, theEditPartViewer);
}
 
开发者ID:timezra,项目名称:UML-Testing-Tool,代码行数:8,代码来源:ClassDiagramPaletteTest.java

示例10: should_add_a_niem_property_to_the_diagram

import org.eclipse.gef.Tool; //导入依赖的package包/类
@Ignore
@Theory
public void should_add_a_niem_property_to_the_diagram(final NIEMAttributeData attributeData) throws ServiceException,
        InterruptedException {
    final IMultiDiagramEditor theActiveEditor = (IMultiDiagramEditor) get_the_active_editor();

    final EditPart theExchangeEditPart = navigate(theActiveEditor, THE_EXCHANGE_NAME);

    final EditPartViewer theViewer = theExchangeEditPart.getViewer();
    doubleClick(findThePaletteTool(theExchangeEditPart, "Nodes/Class"), theViewer);

    final Tool thePaletteTool = findThePaletteTool(theExchangeEditPart, attributeData.thePalettePath);
    leftClick(thePaletteTool, theViewer);

    final GraphicalEditPart theContainingType = (GraphicalEditPart) findByName(theExchangeEditPart, "Class1");
    final GraphicalEditPart theAttributeCompartment = (GraphicalEditPart) theContainingType.getChildren().get(1);

    // theViewer.reveal(theAttributeCompartment);
    // theViewer.select(theAttributeCompartment);

    leftClick(thePaletteTool, theAttributeCompartment);

    // final Request request = new Request();
    // request.setType(RequestConstants.REQ_DIRECT_EDIT);
    // theAttributeCompartment.performRequest(request);

    final NamedElement theNewAttribute = findNamedElements(
            getUmlResource(theActiveEditor.getServicesRegistry().getService(ModelSet.class)),
            join(asList("Data", THE_PIM_NAME, THE_EXCHANGE_NAME, "Class1", attributeData.theNewAttributeName),
                    NamedElement.SEPARATOR)).iterator().next();
    assertThat(theNewAttribute, has_applied_stereotype(attributeData.theExpectedStereotype));
}
 
开发者ID:info-sharing-environment,项目名称:NIEM-Modeling-Tool,代码行数:33,代码来源:NiemUmlEditorTest.java

示例11: leftClick

import org.eclipse.gef.Tool; //导入依赖的package包/类
public static void leftClick(final Tool theTool, final EditPartViewer theViewer) {
    theTool.mouseDown(newLeftClick(theViewer), theViewer);
    // theTool.mouseDrag(newLeftClick(theViewer), theViewer);
    // theTool.mouseUp(newLeftClick(theViewer), theViewer);

    theViewer.getEditDomain().setActiveTool(theTool);
}
 
开发者ID:info-sharing-environment,项目名称:NIEM-Modeling-Tool,代码行数:8,代码来源:PapyrusUtils.java

示例12: findThePaletteTool

import org.eclipse.gef.Tool; //导入依赖的package包/类
public static Tool findThePaletteTool(final EditPart theEditPart, final String toolPath) {
    final EditPartViewer theEditPartViewer = theEditPart.getViewer();
    final PaletteViewer thePaletteViewer = theEditPartViewer.getEditDomain().getPaletteViewer();
    final ToolEntry toolEntry = findByLabel(thePaletteViewer.getPaletteRoot(), toolPath);
    thePaletteViewer.setActiveTool(toolEntry);

    final Tool theTool = toolEntry.createTool();
    theTool.setViewer(theEditPartViewer);
    theTool.setEditDomain(theEditPartViewer.getEditDomain());

    return theTool;
}
 
开发者ID:info-sharing-environment,项目名称:NIEM-Modeling-Tool,代码行数:13,代码来源:PapyrusUtils.java

示例13: getDefaultTool

import org.eclipse.gef.Tool; //导入依赖的package包/类
public Tool getDefaultTool() {
	if (selectionTool == null)
		selectionTool = new RevisionGraphSelectionTool();
	return selectionTool;
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:6,代码来源:RevisionGraphEditDomain.java

示例14: isSelectable

import org.eclipse.gef.Tool; //导入依赖的package包/类
/**
 * @see org.eclipse.gef.editparts.AbstractEditPart#isSelectable()
 */
@Override
public boolean isSelectable() {
    Tool activeTool = getViewer().getEditDomain().getActiveTool();
    return super.isSelectable();
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:9,代码来源:LifeLineEditPart.java

示例15: createTool

import org.eclipse.gef.Tool; //导入依赖的package包/类
@Override
public Tool createTool() {
	if (tool == null)
		tool = new DirectEditCreationTool(elementType, directEdit);
	return tool;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:7,代码来源:DefaultSCTPaletteFactory.java


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