Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-07-19 08:22:04 +0000
committerEike Stepper2012-07-19 08:22:04 +0000
commit1460904fd3c193ffaf809913b2983a400fce9d94 (patch)
tree72f3a17b75fedba3ae1060df1d32c9c7889be954 /plugins/org.gastro.rcp/src
parent5f360965ae87478e0681899bf310a210cafc2c44 (diff)
downloadcdo-1460904fd3c193ffaf809913b2983a400fce9d94.tar.gz
cdo-1460904fd3c193ffaf809913b2983a400fce9d94.tar.xz
cdo-1460904fd3c193ffaf809913b2983a400fce9d94.zip
Fix line endings in master (dos2unix)
Diffstat (limited to 'plugins/org.gastro.rcp/src')
-rw-r--r--plugins/org.gastro.rcp/src/org/gastro/internal/rcp/Activator.java210
-rw-r--r--plugins/org.gastro.rcp/src/org/gastro/internal/rcp/Application.java150
-rw-r--r--plugins/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationActionBarAdvisor.java108
-rw-r--r--plugins/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationWorkbenchAdvisor.java76
-rw-r--r--plugins/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationWorkbenchWindowAdvisor.java108
-rw-r--r--plugins/org.gastro.rcp/src/org/gastro/internal/rcp/Configuration.java146
-rw-r--r--plugins/org.gastro.rcp/src/org/gastro/internal/rcp/Model.java466
-rw-r--r--plugins/org.gastro.rcp/src/org/gastro/rcp/IConfiguration.java72
-rw-r--r--plugins/org.gastro.rcp/src/org/gastro/rcp/IModel.java96
9 files changed, 716 insertions, 716 deletions
diff --git a/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/Activator.java b/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/Activator.java
index 2712fc5945..fda57af585 100644
--- a/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/Activator.java
+++ b/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/Activator.java
@@ -1,105 +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);
- }
-}
+/*
+ * 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.gastro.rcp/src/org/gastro/internal/rcp/Application.java b/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/Application.java
index be914ebd5e..23788865ad 100644
--- a/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/Application.java
+++ b/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/Application.java
@@ -1,75 +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();
- }
- }
- });
- }
-}
+/*
+ * 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.gastro.rcp/src/org/gastro/internal/rcp/ApplicationActionBarAdvisor.java b/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationActionBarAdvisor.java
index 3b211392b0..206a54f4ea 100644
--- a/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationActionBarAdvisor.java
+++ b/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationActionBarAdvisor.java
@@ -1,54 +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);
- }
-}
+/*
+ * 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.gastro.rcp/src/org/gastro/internal/rcp/ApplicationWorkbenchAdvisor.java b/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationWorkbenchAdvisor.java
index 4fa7b9dfa3..7bd14456ec 100644
--- a/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationWorkbenchAdvisor.java
+++ b/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationWorkbenchAdvisor.java
@@ -1,38 +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";
- }
-}
+/*
+ * 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.gastro.rcp/src/org/gastro/internal/rcp/ApplicationWorkbenchWindowAdvisor.java b/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationWorkbenchWindowAdvisor.java
index 4cee5a6815..3f16c55177 100644
--- a/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationWorkbenchWindowAdvisor.java
+++ b/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/ApplicationWorkbenchWindowAdvisor.java
@@ -1,54 +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);
- // }
-}
+/*
+ * 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.gastro.rcp/src/org/gastro/internal/rcp/Configuration.java b/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/Configuration.java
index 5709a49383..3aa32ee7c1 100644
--- a/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/Configuration.java
+++ b/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/Configuration.java
@@ -1,73 +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();
- }
-}
+/*
+ * 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.gastro.rcp/src/org/gastro/internal/rcp/Model.java b/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/Model.java
index eaf1952396..77dd27c027 100644
--- a/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/Model.java
+++ b/plugins/org.gastro.rcp/src/org/gastro/internal/rcp/Model.java
@@ -1,233 +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();
- }
-}
+/*
+ * 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.gastro.rcp/src/org/gastro/rcp/IConfiguration.java b/plugins/org.gastro.rcp/src/org/gastro/rcp/IConfiguration.java
index c5329b661f..7f3fefa4b1 100644
--- a/plugins/org.gastro.rcp/src/org/gastro/rcp/IConfiguration.java
+++ b/plugins/org.gastro.rcp/src/org/gastro/rcp/IConfiguration.java
@@ -1,36 +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();
-}
+/*
+ * 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.gastro.rcp/src/org/gastro/rcp/IModel.java b/plugins/org.gastro.rcp/src/org/gastro/rcp/IModel.java
index a77757ffff..d422d67a71 100644
--- a/plugins/org.gastro.rcp/src/org/gastro/rcp/IModel.java
+++ b/plugins/org.gastro.rcp/src/org/gastro/rcp/IModel.java
@@ -1,48 +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);
- }
-}
+/*
+ * 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