diff options
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.ui')
3 files changed, 106 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF index 88bb64549e..56befc6cbb 100644 --- a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF @@ -22,7 +22,10 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)";reso org.eclipse.emf.cdo.edit;bundle-version="[4.0.0,5.0.0)";visibility:=reexport, org.eclipse.emf.cdo.transfer.ui;bundle-version="[4.2.0,5.0.0)";visibility:=reexport, org.eclipse.emf.cdo.transfer.repository;bundle-version="[4.2.0,5.0.0)";visibility:=reexport, - org.eclipse.emf.cdo.ui.shared;bundle-version="[4.0.0,5.0.0)" + org.eclipse.emf.cdo.ui.shared;bundle-version="[4.0.0,5.0.0)", + org.eclipse.emf.ecp.edit;bundle-version="[1.5.0,2.0.0)";resolution:=optional, + org.eclipse.emf.ecp.edit.swt;bundle-version="[1.5.0,2.0.0)";resolution:=optional, + org.eclipse.emf.ecp.ui.view.swt;bundle-version="[1.5.0,2.0.0)";resolution:=optional Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.4.0"; x-friends:="org.eclipse.emf.cdo.ui.defs, org.eclipse.emf.cdo.ui.ide, diff --git a/plugins/org.eclipse.emf.cdo.ui/component.ext b/plugins/org.eclipse.emf.cdo.ui/component.ext new file mode 100644 index 0000000000..dccd5f1aa9 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.ui/component.ext @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<targlets:ComponentExtension + xmi:version="2.0" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:targlets="http://www.eclipse.org/oomph/targlets/1.0" + xsi:schemaLocation="http://www.eclipse.org/oomph/targlets/1.0 http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/models/Targlets.ecore"> + <requirement + name="org.eclipse.emf.ecp.view.model.provider.generator" + optional="true"/> +</targlets:ComponentExtension> diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/EditObjectDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/EditObjectDialog.java new file mode 100644 index 0000000000..aa862f7002 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/EditObjectDialog.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2004-2014 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.emf.cdo.internal.ui.dialogs; + +import org.eclipse.emf.cdo.ui.shared.SharedIcons; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecp.ui.view.swt.DefaultReferenceService; +import org.eclipse.emf.ecp.ui.view.swt.ECPSWTViewRenderer; +import org.eclipse.emf.ecp.view.spi.context.ViewModelContext; +import org.eclipse.emf.ecp.view.spi.context.ViewModelContextFactory; +import org.eclipse.emf.ecp.view.spi.provider.ViewProviderHelper; + +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; + +/** + * @author Eike Stepper + */ +public class EditObjectDialog extends TitleAreaDialog +{ + private final EObject eObject; + + public EditObjectDialog(Shell parentShell, EObject eObject) + { + super(parentShell); + this.eObject = eObject; + + setShellStyle(SWT.CLOSE | SWT.RESIZE | SWT.TITLE | SWT.APPLICATION_MODAL); + } + + @Override + protected Control createDialogArea(Composite parent) + { + String title = "Edit Object"; + getShell().setText(title); + setTitle(title); + setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_EDIT)); + setMessage("Edit the object."); + + Composite area = (Composite)super.createDialogArea(parent); + Composite container = new Composite(area, SWT.NONE); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + GridLayout containerGridLayout = new GridLayout(2, false); + containerGridLayout.marginWidth = 10; + containerGridLayout.marginHeight = 10; + container.setLayout(containerGridLayout); + + try + { + ViewModelContext viewModelContext = ViewModelContextFactory.INSTANCE.createViewModelContext( + ViewProviderHelper.getView(eObject, null), eObject, new DefaultReferenceService()); + + ECPSWTViewRenderer.INSTANCE.render(container, viewModelContext); + } + catch (RuntimeException ex) + { + throw ex; + } + catch (Error ex) + { + throw ex; + } + catch (Throwable ex) + { + throw new RuntimeException(ex); + } + + return area; + } + + @Override + protected Point getInitialSize() + { + return new Point(600, 500); + } +} |