Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro')
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/Activator.java105
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/Application.java75
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationActionBarAdvisor.java54
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationWorkbenchAdvisor.java38
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationWorkbenchWindowAdvisor.java54
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/Configuration.java73
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/Model.java233
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/rcp/IConfiguration.java36
-rw-r--r--plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/rcp/IModel.java48
9 files changed, 716 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/Activator.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/Activator.java
new file mode 100644
index 0000000000..fda57af585
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/Activator.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2004 - 2012 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
+ *
+ * Initial Publication:
+ * Eclipse Magazin - http://www.eclipse-magazin.de
+ */
+package org.gastro.internal.rcp;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+import org.osgi.framework.BundleContext;
+
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Properties;
+
+/**
+ * The activator class controls the plug-in life cycle
+ *
+ * @author Eike Stepper
+ */
+public class Activator extends AbstractUIPlugin
+{
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.gastro.internal.rcp";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator()
+ {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception
+ {
+ super.start(context);
+ plugin = this;
+
+ String configName = System.getProperty("gastro.config", "gastro.properties");
+ InputStream fis = new FileInputStream(configName);
+
+ try
+ {
+ Properties properties = new Properties();
+ properties.load(fis);
+ Configuration.INSTANCE.setProperties(properties);
+ }
+ finally
+ {
+ fis.close();
+ }
+
+ Model.INSTANCE.activate();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception
+ {
+ Model.INSTANCE.deactivate();
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault()
+ {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given plug-in relative path
+ *
+ * @param path
+ * the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path)
+ {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/Application.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/Application.java
new file mode 100644
index 0000000000..23788865ad
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/Application.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2004 - 2012 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
+ *
+ * Initial Publication:
+ * Eclipse Magazin - http://www.eclipse-magazin.de
+ */
+package org.gastro.internal.rcp;
+
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * This class controls all aspects of the application's execution
+ *
+ * @author Eike Stepper
+ */
+public class Application implements IApplication
+{
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
+ */
+ public Object start(IApplicationContext context)
+ {
+ Display display = PlatformUI.createDisplay();
+ try
+ {
+ int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
+ if (returnCode == PlatformUI.RETURN_RESTART)
+ {
+ return IApplication.EXIT_RESTART;
+ }
+
+ return IApplication.EXIT_OK;
+ }
+ finally
+ {
+ display.dispose();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.equinox.app.IApplication#stop()
+ */
+ public void stop()
+ {
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+ if (workbench == null)
+ {
+ return;
+ }
+ final Display display = workbench.getDisplay();
+ display.syncExec(new Runnable()
+ {
+ public void run()
+ {
+ if (!display.isDisposed())
+ {
+ workbench.close();
+ }
+ }
+ });
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationActionBarAdvisor.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationActionBarAdvisor.java
new file mode 100644
index 0000000000..206a54f4ea
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationActionBarAdvisor.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2004 - 2012 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
+ *
+ * Initial Publication:
+ * Eclipse Magazin - http://www.eclipse-magazin.de
+ */
+package org.gastro.internal.rcp;
+
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
+import org.eclipse.ui.application.ActionBarAdvisor;
+import org.eclipse.ui.application.IActionBarConfigurer;
+
+/**
+ * An action bar advisor is responsible for creating, adding, and disposing of the actions added to a workbench window.
+ * Each window will be populated with new actions.
+ *
+ * @author Eike Stepper
+ */
+public class ApplicationActionBarAdvisor extends ActionBarAdvisor
+{
+ // Actions - important to allocate these only in makeActions, and then use
+ // them
+ // in the fill methods. This ensures that the actions aren't recreated
+ // when fillActionBars is called with FILL_PROXY.
+ private IWorkbenchAction exitAction;
+
+ public ApplicationActionBarAdvisor(IActionBarConfigurer configurer)
+ {
+ super(configurer);
+ }
+
+ @Override
+ protected void makeActions(final IWorkbenchWindow window)
+ {
+ // Creates the actions and registers them.
+ // Registering is needed to ensure that key bindings work.
+ // The corresponding commands keybindings are defined in the plugin.xml
+ // file.
+ // Registering also provides automatic disposal of the actions when
+ // the window is closed.
+
+ exitAction = ActionFactory.QUIT.create(window);
+ register(exitAction);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationWorkbenchAdvisor.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationWorkbenchAdvisor.java
new file mode 100644
index 0000000000..7bd14456ec
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationWorkbenchAdvisor.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2004 - 2012 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
+ *
+ * Initial Publication:
+ * Eclipse Magazin - http://www.eclipse-magazin.de
+ */
+package org.gastro.internal.rcp;
+
+import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
+import org.eclipse.ui.application.WorkbenchAdvisor;
+import org.eclipse.ui.application.WorkbenchWindowAdvisor;
+
+import org.gastro.rcp.IConfiguration;
+
+/**
+ * @author Eike Stepper
+ */
+public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor
+{
+ @Override
+ public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer)
+ {
+ return new ApplicationWorkbenchWindowAdvisor(configurer);
+ }
+
+ @Override
+ public String getInitialWindowPerspectiveId()
+ {
+ return "org.gastro.rcp." + IConfiguration.INSTANCE.getPerspective() + ".perspective";
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationWorkbenchWindowAdvisor.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationWorkbenchWindowAdvisor.java
new file mode 100644
index 0000000000..3f16c55177
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationWorkbenchWindowAdvisor.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2004 - 2012 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
+ *
+ * Initial Publication:
+ * Eclipse Magazin - http://www.eclipse-magazin.de
+ */
+package org.gastro.internal.rcp;
+
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.ui.application.ActionBarAdvisor;
+import org.eclipse.ui.application.IActionBarConfigurer;
+import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
+import org.eclipse.ui.application.WorkbenchWindowAdvisor;
+
+import org.gastro.rcp.IConfiguration;
+
+/**
+ * @author Eike Stepper
+ */
+public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor
+{
+ public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer)
+ {
+ super(configurer);
+ }
+
+ @Override
+ public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer)
+ {
+ return new ApplicationActionBarAdvisor(configurer);
+ }
+
+ @Override
+ public void preWindowOpen()
+ {
+ IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
+ configurer.setInitialSize(new Point(800, 600));
+ configurer.setShowCoolBar(false);
+ configurer.setShowStatusLine(false);
+ configurer.setTitle(IConfiguration.INSTANCE.getRestaurant() + " - " + IConfiguration.INSTANCE.getStation());
+ }
+
+ // public void postWindowCreate()
+ // {
+ // PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setMaximized(true);
+ // }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/Configuration.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/Configuration.java
new file mode 100644
index 0000000000..3aa32ee7c1
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/Configuration.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2004 - 2012 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
+ *
+ * Initial Publication:
+ * Eclipse Magazin - http://www.eclipse-magazin.de
+ */
+package org.gastro.internal.rcp;
+
+import org.gastro.rcp.IConfiguration;
+
+import java.util.Date;
+import java.util.Properties;
+
+/**
+ * @author Eike Stepper
+ */
+public class Configuration implements IConfiguration
+{
+ public static final Configuration INSTANCE = new Configuration();
+
+ private Properties properties;
+
+ private Configuration()
+ {
+ }
+
+ public Properties getProperties()
+ {
+ return properties;
+ }
+
+ public void setProperties(Properties properties)
+ {
+ this.properties = properties;
+ }
+
+ public String getPerspective()
+ {
+ return properties.getProperty("perspective");
+ }
+
+ public String getStation()
+ {
+ return properties.getProperty("station");
+ }
+
+ public String getServer()
+ {
+ return properties.getProperty("server");
+ }
+
+ public String getRepository()
+ {
+ return properties.getProperty("repository");
+ }
+
+ public String getRestaurant()
+ {
+ return properties.getProperty("restaurant");
+ }
+
+ public Date getBusinessDay()
+ {
+ return new Date();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/Model.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/Model.java
new file mode 100644
index 0000000000..77dd27c027
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/internal/rcp/Model.java
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 2004 - 2012 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
+ *
+ * Initial Publication:
+ * Eclipse Magazin - http://www.eclipse-magazin.de
+ */
+package org.gastro.internal.rcp;
+
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.net4j.CDONet4jSession;
+import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
+import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CommitException;
+import org.eclipse.emf.cdo.view.CDOAdapterPolicy;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.net4j.Net4jUtil;
+import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.util.WrappedException;
+import org.eclipse.net4j.util.container.IPluginContainer;
+import org.eclipse.net4j.util.lifecycle.Lifecycle;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.edit.EMFEditPlugin;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+
+import org.gastro.business.BusinessDay;
+import org.gastro.business.BusinessFactory;
+import org.gastro.inventory.InventoryFactory;
+import org.gastro.inventory.MenuCard;
+import org.gastro.inventory.Restaurant;
+import org.gastro.inventory.Station;
+import org.gastro.rcp.IConfiguration;
+import org.gastro.rcp.IModel;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * @author Eike Stepper
+ */
+public class Model extends Lifecycle implements IModel
+{
+ public static final Model INSTANCE = new Model();
+
+ private AdapterFactory adapterFactory;
+
+ private CDONet4jSession session;
+
+ private CDOView view;
+
+ private Restaurant restaurant;
+
+ private BusinessDay businessDay;
+
+ private Station station;
+
+ private Model()
+ {
+ adapterFactory = new ComposedAdapterFactory(EMFEditPlugin.getComposedAdapterFactoryDescriptorRegistry());
+ }
+
+ public AdapterFactory getAdapterFactory()
+ {
+ return adapterFactory;
+ }
+
+ public synchronized Restaurant getRestaurant()
+ {
+ if (restaurant == null)
+ {
+ String name = IConfiguration.INSTANCE.getRestaurant();
+ String path = name + "/inventory";
+ if (!view.hasResource(path))
+ {
+ CDOTransaction transaction = session.openTransaction();
+ Restaurant restaurant = InventoryFactory.eINSTANCE.createRestaurant();
+ restaurant.setName(name);
+
+ try
+ {
+ CDOResource resource = transaction.createResource(path);
+ resource.getContents().add(restaurant);
+ transaction.commit();
+ }
+ catch (CommitException ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ finally
+ {
+ transaction.close();
+ }
+ }
+
+ CDOResource resource = view.getResource(path);
+ restaurant = (Restaurant)resource.getContents().get(0);
+ }
+
+ return restaurant;
+ }
+
+ public synchronized BusinessDay getBusinessDay()
+ {
+ if (businessDay == null)
+ {
+ Restaurant restaurant = getRestaurant();
+ Date date = IConfiguration.INSTANCE.getBusinessDay();
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
+ String path = restaurant.getName() + "/" + formatter.format(date);
+ if (!view.hasResource(path))
+ {
+ CDOTransaction transaction = session.openTransaction();
+ Restaurant txRestaurant = transaction.getObject(restaurant);
+ EList<MenuCard> menuCards = txRestaurant.getMenuCards();
+ if (menuCards.isEmpty())
+ {
+ MenuCard menuCard = InventoryFactory.eINSTANCE.createMenuCard();
+ menuCard.setTitle("Untitled");
+ menuCards.add(menuCard);
+ }
+
+ BusinessDay businessDay = BusinessFactory.eINSTANCE.createBusinessDay();
+ businessDay.setDate(date);
+ businessDay.setMenuCard(menuCards.get(0));
+
+ try
+ {
+ CDOResource resource = transaction.createResource(path);
+ resource.getContents().add(businessDay);
+ transaction.commit();
+ }
+ catch (CommitException ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ finally
+ {
+ transaction.close();
+ }
+ }
+
+ CDOResource resource = view.getResource(path);
+ businessDay = (BusinessDay)resource.getContents().get(0);
+ }
+
+ return businessDay;
+ }
+
+ public synchronized Station getStation()
+ {
+ if (station == null)
+ {
+ String id = IConfiguration.INSTANCE.getStation();
+ for (Station station : getRestaurant().getStations())
+ {
+ if (station.getStationID().equalsIgnoreCase(id))
+ {
+ this.station = station;
+ break;
+ }
+ }
+ }
+
+ return station;
+ }
+
+ public <T extends CDOObject> Object modify(T object, ITransactionalOperation<T> operation)
+ {
+ CDOTransaction transaction = session.openTransaction();
+
+ try
+ {
+ T transactionalObject = transaction.getObject(object);
+ Object result = operation.execute(transactionalObject);
+ transaction.commit();
+
+ if (result instanceof CDOObject)
+ {
+ return view.getObject((CDOObject)result);
+ }
+
+ return result;
+ }
+ catch (CommitException ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ finally
+ {
+ transaction.close();
+ }
+ }
+
+ @Override
+ protected void doActivate() throws Exception
+ {
+ super.doActivate();
+ String server = IConfiguration.INSTANCE.getServer();
+ String repository = IConfiguration.INSTANCE.getRepository();
+
+ IConnector connector = Net4jUtil.getConnector(IPluginContainer.INSTANCE, "tcp", server);
+
+ CDONet4jSessionConfiguration config = CDONet4jUtil.createNet4jSessionConfiguration();
+ config.setConnector(connector);
+ config.setRepositoryName(repository);
+
+ session = config.openNet4jSession();
+ view = session.openView();
+ view.options().addChangeSubscriptionPolicy(CDOAdapterPolicy.ALL);
+ }
+
+ @Override
+ protected void doDeactivate() throws Exception
+ {
+ session.close();
+ session = null;
+ view = null;
+ restaurant = null;
+ station = null;
+ super.doDeactivate();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/rcp/IConfiguration.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/rcp/IConfiguration.java
new file mode 100644
index 0000000000..7f3fefa4b1
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/rcp/IConfiguration.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2004 - 2012 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
+ *
+ * Initial Publication:
+ * Eclipse Magazin - http://www.eclipse-magazin.de
+ */
+package org.gastro.rcp;
+
+import java.util.Date;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IConfiguration
+{
+ public static final IConfiguration INSTANCE = org.gastro.internal.rcp.Configuration.INSTANCE;
+
+ public String getPerspective();
+
+ public String getStation();
+
+ public String getServer();
+
+ public String getRepository();
+
+ public String getRestaurant();
+
+ public Date getBusinessDay();
+}
diff --git a/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/rcp/IModel.java b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/rcp/IModel.java
new file mode 100644
index 0000000000..d422d67a71
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.examples.installer/examples/org.gastro.rcp/src/org/gastro/rcp/IModel.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2004 - 2012 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
+ *
+ * Initial Publication:
+ * Eclipse Magazin - http://www.eclipse-magazin.de
+ */
+package org.gastro.rcp;
+
+import org.eclipse.emf.cdo.CDOObject;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+
+import org.gastro.business.BusinessDay;
+import org.gastro.inventory.Restaurant;
+import org.gastro.inventory.Station;
+
+/**
+ * @author Eike Stepper
+ */
+public interface IModel
+{
+ public static final IModel INSTANCE = org.gastro.internal.rcp.Model.INSTANCE;
+
+ public AdapterFactory getAdapterFactory();
+
+ public Restaurant getRestaurant();
+
+ public BusinessDay getBusinessDay();
+
+ public Station getStation();
+
+ public <T extends CDOObject> Object modify(T object, ITransactionalOperation<T> operation);
+
+ /**
+ * @author Eike Stepper
+ */
+ public interface ITransactionalOperation<T extends CDOObject>
+ {
+ public Object execute(T object);
+ }
+}

Back to the top