org.eclipse.gef.DefaultEditDomain Java Examples

The following examples show how to use org.eclipse.gef.DefaultEditDomain. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainDiagramEditor.java    From erflute with Apache License 2.0 6 votes vote down vote up
public MainDiagramEditor(ERDiagram diagram, ERDiagramEditPartFactory editPartFactory,
        ZoomComboContributionItem zoomComboContributionItem, ERDiagramOutlinePage outlinePage) {
    Activator.debug(this, "constructor", "...Creating diagram editor: " + diagram);
    this.diagram = diagram;
    this.editPartFactory = editPartFactory;
    this.zoomComboContributionItem = zoomComboContributionItem;
    this.propertySheetPage = new PropertySheetPage();
    this.propertySheetPage.setPropertySourceProvider(new ERDiagramPropertySourceProvider());
    try {
        this.extensionLoader = new ExtensionLoader(this);
    } catch (final CoreException e) {
        Activator.showExceptionDialog(e);
    }
    setEditDomain(new DefaultEditDomain(this));
    initializeOutlinePage(outlinePage);
}
 
Example #2
Source File: GridEditorTools.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a basic GEF viewer in the specified container and with the
 * specified EditPartFactory.
 * 
 * @param container
 *            The Composite that will contain the viewer.
 * @param factory
 *            The factory used to create the viewer's EditParts.
 */
public static GraphicalViewer createViewer(Composite container,
		EditPartFactory factory) {
	// Create the GraphicalViewer. This is fairly standard procedure for
	// GEF.

	// Use this to test re-sizing of window (this viewer does not create
	// scroll bars).
	GraphicalViewer viewer = new GraphicalViewerImpl();
	viewer.setRootEditPart(new SimpleRootEditPart());
	viewer.createControl(container);

	// Pass the custom EditPartFactory and the Grid model to the
	// GraphicalViewer.
	viewer.setEditPartFactory(factory);

	// Set the GraphicalViewer's EditDomain to a default.
	viewer.setEditDomain(new DefaultEditDomain(null));

	return viewer;
}
 
Example #3
Source File: ERDiagramEditor.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
/**
	 * �R���X�g���N�^.
	 *
	 * @param diagram
	 *            ERDiagram
	 * @param editPartFactory
	 *            ERDiagramEditPartFactory
	 * @param zoomComboContributionItem
	 *            ZoomComboContributionItem
	 * @param outlinePage
	 *            ERDiagramOutlinePage
	 */
	public ERDiagramEditor(ERDiagram diagram,
			ERDiagramEditPartFactory editPartFactory,
			ZoomComboContributionItem zoomComboContributionItem,
			ERDiagramOutlinePage outlinePage) {
		DefaultEditDomain domain = new DefaultEditDomain(this);
		this.setEditDomain(domain);

		this.diagram = diagram;
		this.editPartFactory = editPartFactory;
		this.zoomComboContributionItem = zoomComboContributionItem;
		this.outlinePage = outlinePage;

		this.propertySheetPage = new PropertySheetPage();
		this.propertySheetPage
				.setPropertySourceProvider(new ERDiagramPropertySourceProvider());

		try {
			this.extensionLoader = new ExtensionLoader(this);
		} catch (CoreException e) {
			Activator.showExceptionDialog(e);
		}

//		setAction(ACTION_OUTLINE, new QuickOutlineAction());

	}
 
Example #4
Source File: ERDiagramEditor.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
/**
 * コンストラクタ.
 * 
 * @param diagram
 *            ERDiagram
 * @param editPartFactory
 *            ERDiagramEditPartFactory
 * @param outlinePage
 *            ERDiagramOutlinePage
 * @param editDomain
 *            DefaultEditDomain
 */
public ERDiagramEditor(final ERDiagram diagram, final ERDiagramEditPartFactory editPartFactory, final ERDiagramOutlinePage outlinePage, final DefaultEditDomain editDomain, final ERDiagramPaletteRoot palette) {
    this.diagram = diagram;
    this.editPartFactory = editPartFactory;
    this.outlinePage = outlinePage;
    this.palette = palette;

    setEditDomain(editDomain);

    try {
        extensionLoader = new ExtensionLoader(this);
    } catch (final CoreException e) {
        ERDiagramActivator.showExceptionDialog(e);
    }
}
 
Example #5
Source File: ERDiagramMultiPageEditor.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
public ERDiagramMultiPageEditor() {
    propertySheetPage = new PropertySheetPage();
    propertySheetPage.setPropertySourceProvider(new ERDiagramPropertySourceProvider(this));

    gotoMaker = new ERDiagramGotoMarker(this);
    editDomain = new DefaultEditDomain(this);
    pallet = new ERDiagramPaletteRoot();
}
 
Example #6
Source File: ProductSystemGraphEditor.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void init(IEditorSite site, IEditorInput input)
		throws PartInitException {
	setEditDomain(new DefaultEditDomain(this));
	if (input instanceof GraphicalEditorInput) {
		GraphicalEditorInput modelInput = (GraphicalEditorInput) input;
		if (modelInput.getDescriptor() != null) {
			setPartName(Labels.name(modelInput.getDescriptor()));
		}
	}
	super.init(site, input);
}
 
Example #7
Source File: SankeyDiagram.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
public SankeyDiagram(FullResult result, DQResult dqResult, CalculationSetup setup) {
	this.dqResult = dqResult;
	setEditDomain(new DefaultEditDomain(this));
	this.result = result;
	productSystem = setup.productSystem;
	linkSearchMap = new ProcessLinkSearchMap(productSystem.processLinks);
	sankeyResult = new SankeyResult(productSystem, result);
	if (productSystem != null) {
		setPartName(productSystem.name);
	}
}
 
Example #8
Source File: MainDiagramEditor.java    From erflute with Apache License 2.0 4 votes vote down vote up
public DefaultEditDomain getDefaultEditDomain() {
    return getEditDomain();
}
 
Example #9
Source File: VirtualDiagramEditor.java    From erflute with Apache License 2.0 4 votes vote down vote up
@Override
public DefaultEditDomain getDefaultEditDomain() {
    return getEditDomain();
}
 
Example #10
Source File: ReportEditorWithPalette.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public ReportEditorWithPalette( )
{
	super( );
	setEditDomain( new DefaultEditDomain( this ) );
}
 
Example #11
Source File: GridViewerLauncher.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Creates a GEF Viewer with the specified model and factory.
 * 
 * @param container
 *            The Composite that will contain the viewer.
 * @param model
 *            The model for the viewer.
 * @param factory
 *            The factory used to create the viewer's EditParts.
 */
public static GraphicalViewer createViewer(Composite container, Grid model,
		EditPartFactory factory) {
	// Create the GraphicalViewer. This is fairly standard procedure for
	// GEF.
	// GraphicalViewer viewer = new ScrollingGraphicalViewer();
	// Use this to test re-sizing of window (this viewer does not create
	// scroll bars).
	GraphicalViewer viewer = new GraphicalViewerImpl();
	viewer.setRootEditPart(new SimpleRootEditPart());
	viewer.createControl(container);
	// Pass the custom EditPartFactory and the Grid model to the
	// GraphicalViewer.
	viewer.setEditPartFactory(factory);
	viewer.setContents(model);
	// Set the GraphicalViewer's EditDomain to a default.
	viewer.setEditDomain(new DefaultEditDomain(null));

	/* -- Set the viewer's current selection of cells. -- */
	// Here, we need to set the viewer's current selection of EditParts to
	// the currently-selected Cells in the Grid model. This allows us to
	// show the user the Cells that were previously selected. To do this, we
	// need to add all of the EditParts for selected Cells to the viewer's
	// StructuredSelection.

	// Create the object array needed to create the StructuredSelection.
	List<Object> selectionList = new ArrayList<Object>();

	// Add the EditParts for all selected Cells to the ArrayList.
	for (Cell cell : model.getCells()) {
		if (cell.getSelected()) {
			// Get the Cell's EditPart.
			CellEditPart editPart = (CellEditPart) viewer
					.getEditPartRegistry().get(cell);

			// Add the CellEditPart to the array.
			selectionList.add(editPart);
		}
	}

	// Create the StructuredSelection from the array and pass it to viewer.
	viewer.setSelection(new StructuredSelection(selectionList.toArray()));
	/* -------------------------------------------------- */

	return viewer;
}
 
Example #12
Source File: ERDiagramEditor.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
public DefaultEditDomain getDefaultEditDomain() {
	return getEditDomain();
}
 
Example #13
Source File: EROneDiagramEditor.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
public DefaultEditDomain getDefaultEditDomain() {
	return getEditDomain();
}
 
Example #14
Source File: GraphicalEditorWithFlyoutPalette.java    From birt with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Sets the edit domain for this editor.
 * 
 * @param ed
 *            The new EditDomain
 */
protected void setEditDomain( DefaultEditDomain ed )
{
	super.setEditDomain( ed );
	getEditDomain( ).setPaletteRoot( getPaletteRoot( ) );
}