From: p.ciardelli Date: Mon, 8 Oct 2007 09:41:18 +0000 (+0000) Subject: Initial import after cleaning up renaming from "prototype1" to "designproposal1". X-Git-Tag: rcp.ss-first-working-version~1253 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/049dcfb159779fafac8aacbd2648691e137c573f Initial import after cleaning up renaming from "prototype1" to "designproposal1". --- diff --git a/.gitattributes b/.gitattributes index acb50b152..f85d48d07 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,7 +2,6 @@ eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/.classpath -text eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/.project -text eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/META-INF/MANIFEST.MF -text -eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/Prototype1.product -text eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/build.properties -text eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/icons/alt_window_16.gif -text eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/icons/alt_window_32.gif -text @@ -38,25 +37,6 @@ eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxedito eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/designproposal1/view/MySourceViewerConfig.java -text eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/designproposal1/view/NameEditorView.java -text eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/designproposal1/view/NameListView.java -text -eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/Activator.java -text -eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/Application.java -text -eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/ApplicationActionBarAdvisor.java -text -eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/ApplicationWorkbenchAdvisor.java -text -eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/ApplicationWorkbenchWindowAdvisor.java -text -eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/Perspective.java -text -eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/controller/CreateNameAction.java -text -eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/controller/OpenNameEditorAction.java -text -eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/controller/SaveNameAction.java -text -eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/model/NameEditorInput.java -text -eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/model/ObjectList.java -text -eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/CreateNameView.java -text -eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/EditNameProperties.java -text -eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/LastNameView.java -text -eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/MyCompletionProcessor.java -text -eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/MyRuleScanner.java -text -eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/MySourceViewerConfig.java -text -eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/NameEditorView.java -text -eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/NameListView.java -text eclipseprojects/eu.etaxonomy.taxeditor.prototype1/.classpath -text eclipseprojects/eu.etaxonomy.taxeditor.prototype1/.project -text eclipseprojects/eu.etaxonomy.taxeditor.prototype1/META-INF/MANIFEST.MF -text diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/META-INF/MANIFEST.MF b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/META-INF/MANIFEST.MF index 665dc1591..e7f0dd950 100644 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/META-INF/MANIFEST.MF +++ b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/META-INF/MANIFEST.MF @@ -1,9 +1,9 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: Mvctest Plug-in -Bundle-SymbolicName: eu.etaxonomy.taxeditor.prototype1;singleton:=true +Bundle-Name: Editor Design Proposal 1 +Bundle-SymbolicName: eu.etaxonomy.taxeditor.designproposal1;singleton:=true Bundle-Version: 1.0.0 -Bundle-Activator: eu.etaxonomy.taxeditor.prototype1.Activator +Bundle-Activator: eu.etaxonomy.taxeditor.designproposal1.Activator Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.ui.forms, diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/Prototype1.product b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/Prototype1.product deleted file mode 100644 index f76d0e90b..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/Prototype1.product +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - Thanks for all the laughs! - - - - - - - -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/plugin.xml b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/plugin.xml index a3be6e22b..d55c47ac9 100644 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/plugin.xml +++ b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/plugin.xml @@ -7,14 +7,14 @@ point="org.eclipse.core.runtime.applications"> + class="eu.etaxonomy.taxeditor.designproposal1.Application"> @@ -24,17 +24,17 @@ point="org.eclipse.ui.views"> @@ -42,7 +42,7 @@ diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/Activator.java b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/Activator.java deleted file mode 100644 index 82b17f99f..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/Activator.java +++ /dev/null @@ -1,89 +0,0 @@ -package eu.etaxonomy.taxeditor.prototype1; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -import eu.etaxonomy.cdm.api.application.CdmApplicationController; -import eu.etaxonomy.taxeditor.prototype1.model.ObjectList; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "eu.etaxonomy.mvctest"; - - // The shared instance - private static Activator plugin; - - private CdmApplicationController cdmApp = new CdmApplicationController(); - - private ObjectList objectList = new ObjectList(); - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - 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); - } - - - public Image getImage(String key) { - return getImageRegistry().get(key); - } - - /** - * @return the objectList - */ - public CdmApplicationController getApplicationController() { - return this.cdmApp; - } - - - /** - * @return the objectList - */ - public ObjectList getObjectList() { - return this.objectList; - } -} diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/Application.java b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/Application.java deleted file mode 100644 index 8b24049e1..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/Application.java +++ /dev/null @@ -1,45 +0,0 @@ -package eu.etaxonomy.taxeditor.prototype1; - -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 - */ -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/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/ApplicationActionBarAdvisor.java b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/ApplicationActionBarAdvisor.java deleted file mode 100644 index 234b5cd3f..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/ApplicationActionBarAdvisor.java +++ /dev/null @@ -1,48 +0,0 @@ -package eu.etaxonomy.taxeditor.prototype1; - -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.ui.IWorkbenchActionConstants; -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. - */ -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); - } - - 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); - } - - protected void fillMenuBar(IMenuManager menuBar) { - MenuManager fileMenu = new MenuManager("&File", - IWorkbenchActionConstants.M_FILE); - menuBar.add(fileMenu); - fileMenu.add(exitAction); - } - -} diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/ApplicationWorkbenchAdvisor.java b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/ApplicationWorkbenchAdvisor.java deleted file mode 100644 index 3a8fd15a6..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/ApplicationWorkbenchAdvisor.java +++ /dev/null @@ -1,20 +0,0 @@ -package eu.etaxonomy.taxeditor.prototype1; - -import org.eclipse.ui.application.IWorkbenchWindowConfigurer; -import org.eclipse.ui.application.WorkbenchAdvisor; -import org.eclipse.ui.application.WorkbenchWindowAdvisor; - -public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor { - - private static final String PERSPECTIVE_ID = "eu.etaxonomy.mvctest.perspective"; - - public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor( - IWorkbenchWindowConfigurer configurer) { - return new ApplicationWorkbenchWindowAdvisor(configurer); - } - - public String getInitialWindowPerspectiveId() { - return PERSPECTIVE_ID; - } - -} diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/ApplicationWorkbenchWindowAdvisor.java b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/ApplicationWorkbenchWindowAdvisor.java deleted file mode 100644 index ebcb421c8..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/ApplicationWorkbenchWindowAdvisor.java +++ /dev/null @@ -1,30 +0,0 @@ -package eu.etaxonomy.taxeditor.prototype1; - -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 eu.etaxonomy.taxeditor.prototype1.controller.PopulateNameListViewAction; - -public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { - - public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { - super(configurer); - } - - public ActionBarAdvisor createActionBarAdvisor( - IActionBarConfigurer configurer) { - return new ApplicationActionBarAdvisor(configurer); - } - - public void preWindowOpen() { - IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); - configurer.setInitialSize(new Point(800, 600)); - configurer.setShowCoolBar(false); - configurer.setShowStatusLine(false); - configurer.setTitle("EDIT Taxonomic Editor"); - } - -} diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/Perspective.java b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/Perspective.java deleted file mode 100644 index d4fbbef42..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/Perspective.java +++ /dev/null @@ -1,22 +0,0 @@ -package eu.etaxonomy.taxeditor.prototype1; - -import org.eclipse.ui.IFolderLayout; -import org.eclipse.ui.IPageLayout; -import org.eclipse.ui.IPerspectiveFactory; - -import eu.etaxonomy.taxeditor.prototype1.view.NameListView; - -public class Perspective implements IPerspectiveFactory { - - public static final String ID = "eu.etaxonomy.mvctest.perspective"; - - public void createInitialLayout(IPageLayout layout) { - String editorArea = layout.getEditorArea(); - IFolderLayout navigatorFolder = layout.createFolder("Navigator", - IPageLayout.LEFT, 0.25f, editorArea); - navigatorFolder.addView(NameListView.ID); - // navigatorFolder.addView(LastNameView.ID); - layout.getViewLayout(NameListView.ID).setCloseable(false); - // navigatorFolder.addView(LastNameView.ID); - } -} diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/controller/CreateNameAction.java b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/controller/CreateNameAction.java deleted file mode 100644 index 3ff82c87c..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/controller/CreateNameAction.java +++ /dev/null @@ -1,29 +0,0 @@ -package eu.etaxonomy.taxeditor.prototype1.controller; - -import org.eclipse.jface.action.Action; - -import eu.etaxonomy.cdm.api.service.INameService; -import eu.etaxonomy.cdm.model.name.TaxonName; -import eu.etaxonomy.taxeditor.prototype1.Activator; - -public class CreateNameAction extends Action { - - private TaxonName tn; - - public CreateNameAction(String genus, String spEpithet) { - - INameService ns = Activator.getDefault().getApplicationController().getNameService(); - this.tn = ns.getNewTaxonName(null); - tn.setGenus(genus); - tn.setSpecificEpithet(spEpithet); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.action.Action#run() - */ - public void run() { - //Application. - Activator.getDefault().getApplicationController().getNameService().saveTaxonName(tn); - Activator.getDefault().getObjectList().add(tn); - } -} diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/controller/OpenNameEditorAction.java b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/controller/OpenNameEditorAction.java deleted file mode 100644 index 7cc0e4c07..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/controller/OpenNameEditorAction.java +++ /dev/null @@ -1,30 +0,0 @@ -package eu.etaxonomy.taxeditor.prototype1.controller; - -import org.eclipse.jface.action.Action; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.PartInitException; - -import eu.etaxonomy.cdm.model.name.TaxonName; -import eu.etaxonomy.taxeditor.prototype1.Activator; -import eu.etaxonomy.taxeditor.prototype1.model.NameEditorInput; -import eu.etaxonomy.taxeditor.prototype1.view.NameEditorView; - -public class OpenNameEditorAction extends Action { - - private TaxonName taxonname; - - public OpenNameEditorAction(TaxonName taxonname) { - this.taxonname = taxonname; - } - - public void run() { - IEditorInput input = new NameEditorInput(taxonname); - try { - Activator.getDefault().getWorkbench().getActiveWorkbenchWindow(). - getActivePage().openEditor(input, NameEditorView.ID); - } catch (PartInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } -} \ No newline at end of file diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/controller/SaveNameAction.java b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/controller/SaveNameAction.java deleted file mode 100644 index c526f1de7..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/controller/SaveNameAction.java +++ /dev/null @@ -1,19 +0,0 @@ -package eu.etaxonomy.taxeditor.prototype1.controller; - -import org.eclipse.jface.action.Action; - -import eu.etaxonomy.cdm.model.name.TaxonName; -import eu.etaxonomy.taxeditor.prototype1.Activator; - -public class SaveNameAction extends Action { - TaxonName taxonname; - - public SaveNameAction(TaxonName taxonname) { - this.taxonname = taxonname; - } - - public void run() { - Activator.getDefault().getApplicationController().getNameService(). - saveTaxonName(taxonname); - } -} diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/model/NameEditorInput.java b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/model/NameEditorInput.java deleted file mode 100644 index 8bb492426..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/model/NameEditorInput.java +++ /dev/null @@ -1,49 +0,0 @@ -package eu.etaxonomy.taxeditor.prototype1.model; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IPersistableElement; - -import eu.etaxonomy.cdm.model.name.TaxonName; - -public class NameEditorInput implements IEditorInput { - - private TaxonName taxonname; - - public NameEditorInput (TaxonName taxonname) { - this.taxonname = taxonname; - } - - public boolean exists() { - // TODO Auto-generated method stub - return false; - } - - public ImageDescriptor getImageDescriptor() { - // TODO Auto-generated method stub - return null; - } - - public String getName() { - return taxonname.getName(); - } - - public IPersistableElement getPersistable() { - // TODO Auto-generated method stub - return null; - } - - public String getToolTipText() { - return taxonname.getName(); - } - - public Object getAdapter(Class adapter) { - - if (adapter == TaxonName.class) { - return this.taxonname; - } - - return null; - } - -} diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/model/ObjectList.java b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/model/ObjectList.java deleted file mode 100644 index 95efc6c50..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/model/ObjectList.java +++ /dev/null @@ -1,79 +0,0 @@ -package eu.etaxonomy.taxeditor.prototype1.model; - -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.util.ArrayList; -import java.util.List; - -import eu.etaxonomy.cdm.model.common.VersionableEntity; - -public class ObjectList { - - private List objectList = new ArrayList(); - - protected transient PropertyChangeSupport listeners = new PropertyChangeSupport(this); - - - //public class ObjectList extends PlatformObject { - - /** - * Adds a property-change listener. - * @param l the listener - */ - public void addPropertyChangeListener(PropertyChangeListener l){ - if (l == null) { - throw new IllegalArgumentException(); - } - this.listeners.addPropertyChangeListener(l); - } - - - public void removePropertyChangeListener(PropertyChangeListener l){ - this.listeners.removePropertyChangeListener(l); - } - - /** - * Notifies all listeners to a model-change - * @param prop the property-id - * @param old the old-value - * @param newValue the new value - */ - protected void firePropertyChange(String prop, Object old, Object newValue){ - if (this.listeners.hasListeners(prop)) { - this.listeners.firePropertyChange(prop, old, newValue); - } - } - - - /** - * @param o - * @return - * @see java.util.List#add(java.lang.Object) - */ - public void add(VersionableEntity ve) { - this.objectList.add(ve); - // model has changed --> fire - firePropertyChange("ITEM_ADD", null, ve); //$NON-NLS-1$ - } - - - /** - * @param o - * @return - * @see java.util.List#remove(java.lang.Object) - */ - public void remove(Object o) { - this.objectList.remove(o); -// model has changed --> fire - firePropertyChange("ITEM_REMOVE", o, null); //$NON-NLS-1$ - } - - - /** - * @return - * @see java.util.List#toArray() - */ - public Object[] toArray() { - return (Object[]) this.objectList.toArray(new Object[this.objectList.size()]); - } -} diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/CreateNameView.java b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/CreateNameView.java deleted file mode 100644 index 807754749..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/CreateNameView.java +++ /dev/null @@ -1,81 +0,0 @@ -package eu.etaxonomy.taxeditor.prototype1.view; - -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.part.ViewPart; - -import eu.etaxonomy.taxeditor.prototype1.controller.CreateNameAction; - -public class CreateNameView extends ViewPart { - private Text txtSpEpithet; - private Text txtGenus; - public static final String ID = "eu.etaxonomy.mvctest.view"; - - /** - * This is a callback that will allow us to create the viewer and initialize - * it. - */ - public void createPartControl(Composite parent) { - final GridLayout gridLayout = new GridLayout(); - gridLayout.numColumns = 2; - parent.setLayout(gridLayout); - - final Label genusLabel = new Label(parent, SWT.NONE); - genusLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); - genusLabel.setText("Genus:"); - - txtGenus = new Text(parent, SWT.BORDER); - final GridData gd_txtGenus = new GridData(SWT.FILL, SWT.CENTER, true, false); - txtGenus.setLayoutData(gd_txtGenus); - - final Label epithetLabel = new Label(parent, SWT.NONE); - epithetLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); - epithetLabel.setText("Epithet:"); - - txtSpEpithet = new Text(parent, SWT.BORDER); - final GridData gd_txtSpEpithet = new GridData(SWT.FILL, SWT.CENTER, true, false); - txtSpEpithet.setLayoutData(gd_txtSpEpithet); - new Label(parent, SWT.NONE); - - final Button saveNameButton = new Button(parent, SWT.NONE); - - saveNameButton.addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - new CreateNameAction(CreateNameView.this.txtGenus.getText(), - CreateNameView.this.txtSpEpithet.getText()).run(); - } - }); - - final GridData gd_saveNameButton = new GridData(SWT.RIGHT, SWT.CENTER, false, false); - saveNameButton.setLayoutData(gd_saveNameButton); - saveNameButton.setText("Save Name"); - initializeToolBar(); - } - - /** - * Passing the focus request to the viewer's control. - */ - public void setFocus() { - } - private void initializeToolBar() { - IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager(); - } -} \ No newline at end of file diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/EditNameProperties.java b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/EditNameProperties.java deleted file mode 100644 index 42f6645b3..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/EditNameProperties.java +++ /dev/null @@ -1,28 +0,0 @@ -package eu.etaxonomy.taxeditor.prototype1.view; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.dialogs.PropertyPage; - -public class EditNameProperties extends PropertyPage { - - /** - * Create the property page - */ - public EditNameProperties() { - super(); - } - - /** - * Create contents of the property page - * @param parent - */ - @Override - public Control createContents(Composite parent) { - Composite container = new Composite(parent, SWT.NULL); - // - return container; - } - -} diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/LastNameView.java b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/LastNameView.java deleted file mode 100644 index 1726cc33f..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/LastNameView.java +++ /dev/null @@ -1,86 +0,0 @@ -package eu.etaxonomy.taxeditor.prototype1.view; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; - -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.part.ViewPart; - -import eu.etaxonomy.cdm.model.name.TaxonName; -import eu.etaxonomy.taxeditor.prototype1.Activator; - -public class LastNameView extends ViewPart implements PropertyChangeListener { - - public static final String ID = "eu.etaxonomy.mvctest.view.LastNameView"; //$NON-NLS-1$ - private Label lblName; - /** - * Create contents of the view part - * @param parent - */ - @Override - public void createPartControl(Composite parent) { - Composite container = new Composite(parent, SWT.NONE); - final GridLayout gridLayout = new GridLayout(); - gridLayout.numColumns = 2; - container.setLayout(gridLayout); - - final Label theLastNameLabel = new Label(container, SWT.NONE); - theLastNameLabel.setText("The last name created was: "); - - lblName = new Label(container, SWT.NONE); - lblName.setText("none yet"); - lblName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); - - - new Label(container, SWT.NONE); - // - createActions(); - initializeToolBar(); - initializeMenu(); - - Activator.getDefault().getObjectList().addPropertyChangeListener(this); - - } - - /** - * Create the actions - */ - private void createActions() { - // Create the actions - } - - /** - * Initialize the toolbar - */ - private void initializeToolBar() { - IToolBarManager toolbarManager = getViewSite().getActionBars() - .getToolBarManager(); - } - - /** - * Initialize the menu - */ - private void initializeMenu() { - IMenuManager menuManager = getViewSite().getActionBars() - .getMenuManager(); - } - - @Override - public void setFocus() { - // Set the focus - } - - public void propertyChange(PropertyChangeEvent evt) { - if (evt.getPropertyName().equalsIgnoreCase("ITEM_ADD")){ - TaxonName tn = (TaxonName)evt.getNewValue(); - lblName.setText( tn.getName()); - } - } - -} diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/MyCompletionProcessor.java b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/MyCompletionProcessor.java deleted file mode 100644 index 215a0a765..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/MyCompletionProcessor.java +++ /dev/null @@ -1,104 +0,0 @@ -package eu.etaxonomy.taxeditor.prototype1.view; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.text.ITextViewer; -import org.eclipse.jface.text.contentassist.CompletionProposal; -import org.eclipse.jface.text.contentassist.ContextInformation; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.text.contentassist.IContextInformation; -import org.eclipse.jface.text.contentassist.IContextInformationValidator; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; - -import com.swtdesigner.ResourceManager; - -import eu.etaxonomy.taxeditor.prototype1.Activator; - -public class MyCompletionProcessor implements IContentAssistProcessor { - - protected final static String[] myProposals = { "Unknown synonymy", - "Create homotypic synonym", - "Create heterotypic synoynm", - "Create basionym", - "Create replaced synonym", - "Create homonym", - "Create orthographic variant", - "Create misapplied name", - "Create concept relation"}; - protected final static String[] myIcons = { "icons/unknown.gif", - "icons/homosyn.gif", - "icons/heterosyn.gif", - "icons/basionym.gif", - "icons/repsyn.gif", - "icons/homonym.gif", - "icons/orthovariant.gif", - "icons/misapplied.gif", - "icons/concept.gif"}; - protected final static String[] myContexts = { "To create a homotypic synonym, there are many things to consider. I could go on all day.", - "Create homotypic synonym", - "Create heterotypic synoynm", - "Create basionym", - "Create replaced synonym", - "Create homonym", - "Create orthographic variant", - "Create misapplied name", - "Create concept relation"}; - - /* (non-Javadoc) - * Method declared on IContentAssistProcessor - */ - public ICompletionProposal[] computeCompletionProposals( - ITextViewer viewer, int documentOffset) { -// Image img = ResourceManager.getPluginImage(Activator.getDefault(), "icons/unknown.gif"); - ICompletionProposal[] result = - new ICompletionProposal[myProposals.length]; - for (int i = 0; i < myProposals.length; i++) { - IContextInformation contextInfo = - new ContextInformation(null, myProposals[i]+" Style"); - result[i] = new CompletionProposal(myProposals[i],documentOffset, 0, - myProposals[i].length(), ResourceManager.getPluginImage(Activator.getDefault(), myIcons[i]), - myProposals[i], contextInfo, myContexts[i]); - - } - return result; - } - - /* (non-Javadoc) - * Method declared on IContentAssistProcessor - */ - public char[] getCompletionProposalAutoActivationCharacters() { - return new char[] { '=', (char) SWT.CR }; - } - - /* (non-Javadoc) - * Method declared on IContentAssistProcessor - */ - public char[] getContextInformationAutoActivationCharacters() { - return null; - } - - // For Context information - /* (non-Javadoc) - * Method declared on IContentAssistProcessor - */ - public IContextInformationValidator getContextInformationValidator() { - return null; - } - - /* (non-Javadoc) - * Method declared on IContentAssistProcessor - */ - public IContextInformation[] computeContextInformation( - ITextViewer viewer, - int documentOffset) { - return null; - } - - /* (non-Javadoc) - * Method declared on IContentAssistProcessor - */ - public String getErrorMessage() { - return null; - } -} diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/MyRuleScanner.java b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/MyRuleScanner.java deleted file mode 100644 index 8e4d4dc0c..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/MyRuleScanner.java +++ /dev/null @@ -1,31 +0,0 @@ -package eu.etaxonomy.taxeditor.prototype1.view; - -import org.eclipse.jface.text.TextAttribute; -import org.eclipse.jface.text.rules.EndOfLineRule; -import org.eclipse.jface.text.rules.IRule; -import org.eclipse.jface.text.rules.IToken; -import org.eclipse.jface.text.rules.RuleBasedScanner; -import org.eclipse.jface.text.rules.SingleLineRule; -import org.eclipse.jface.text.rules.Token; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.widgets.Display; - -public class MyRuleScanner extends RuleBasedScanner { - private static Color TAG_COLOR= new Color(Display.getCurrent(), new RGB(200, 0, 0)); - private static Color COMMENT_COLOR= new Color(Display.getCurrent(), new RGB(0, 200, 0)); - - public MyRuleScanner() { - IToken tagToken = - new Token( - new TextAttribute(TAG_COLOR)); - - IToken commentToken= new Token(new TextAttribute(COMMENT_COLOR)); - - IRule[] rules = new IRule[2]; - //Add rule for processing instructions - rules[0] = new SingleLineRule("", tagToken); - rules[1] = (new EndOfLineRule("//", commentToken)); //$NON-NLS-1$ - setRules(rules); - } -} diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/MySourceViewerConfig.java b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/MySourceViewerConfig.java deleted file mode 100644 index 7bc5678b1..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/MySourceViewerConfig.java +++ /dev/null @@ -1,64 +0,0 @@ -package eu.etaxonomy.taxeditor.prototype1.view; - -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.TextAttribute; -import org.eclipse.jface.text.contentassist.ContentAssistant; -import org.eclipse.jface.text.contentassist.IContentAssistant; -import org.eclipse.jface.text.presentation.IPresentationReconciler; -import org.eclipse.jface.text.presentation.PresentationReconciler; -import org.eclipse.jface.text.rules.DefaultDamagerRepairer; -import org.eclipse.jface.text.rules.Token; -import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.jface.text.source.SourceViewerConfiguration; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.widgets.Display; - -public class MySourceViewerConfig extends SourceViewerConfiguration { - private MyRuleScanner scanner; - private static Color DEFAULT_TAG_COLOR = - new Color(Display.getCurrent(), new RGB(0, 0, 200)); - - public MySourceViewerConfig() { - - } - - protected MyRuleScanner getTagScanner() { - if (scanner == null) { - scanner = new MyRuleScanner(); - scanner.setDefaultReturnToken( - new Token(new TextAttribute(DEFAULT_TAG_COLOR))); - } - return scanner; - } - - /** - * Define reconciler for MyEditor - */ - public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) { - PresentationReconciler reconciler = new PresentationReconciler(); - DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getTagScanner()); - reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE); - reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE); - return reconciler; - } - - public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { - - ContentAssistant assistant = new ContentAssistant(); - assistant.setContentAssistProcessor( - new MyCompletionProcessor(), - IDocument.DEFAULT_CONTENT_TYPE); - assistant.enableAutoActivation(true); - assistant.setAutoActivationDelay(50); - assistant.setProposalPopupOrientation( - IContentAssistant.PROPOSAL_OVERLAY); - assistant.setStatusLineVisible(true); - assistant.setStatusMessage("Create a nomenclatural or taxonomic relationship"); - assistant.setProposalSelectorBackground( - new Color(Display.getCurrent(), new RGB(255, 255, 255))); - assistant.setInformationControlCreator( - getInformationControlCreator(sourceViewer)); // this is what pops up the yellow context box - return assistant; - } -} \ No newline at end of file diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/NameEditorView.java b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/NameEditorView.java deleted file mode 100644 index d2c7a03d7..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/NameEditorView.java +++ /dev/null @@ -1,256 +0,0 @@ -package eu.etaxonomy.taxeditor.prototype1.view; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.text.Document; -import org.eclipse.jface.text.TextViewer; -import org.eclipse.jface.text.source.SourceViewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.PopupList; -import org.eclipse.swt.custom.StyledText; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; -import org.eclipse.swt.events.MouseAdapter; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.part.EditorPart; -import com.swtdesigner.ResourceManager; - -//import org.eclipse.ui.texteditor.AbstractTextEditor; - -import eu.etaxonomy.cdm.model.name.TaxonName; -import eu.etaxonomy.taxeditor.prototype1.Activator; -import eu.etaxonomy.taxeditor.prototype1.controller.SaveNameAction; - -public class NameEditorView extends EditorPart implements PropertyChangeListener { - - private StyledText styledText; - private TaxonName taxonname; - - private Text txtGenus; - private Text txtSpEpi; - private Text txtAuthor; - public static final String ID = "eu.etaxonomy.taxeditor.prototype1.view.NameEditorView"; //$NON-NLS-1$ - - /** - * Create contents of the editor part - * @param parent - */ - @Override - public void createPartControl(Composite parent) { - Composite container = new Composite(parent, SWT.NONE); - final GridLayout gridLayout = new GridLayout(); - gridLayout.numColumns = 2; - container.setLayout(gridLayout); - - final Label lblGenus = new Label(container, SWT.NONE); - lblGenus.setText("Genus:"); - - txtGenus = new Text(container, SWT.BORDER); - final GridData gd_txtGenus = new GridData(SWT.FILL, SWT.CENTER, true, false); - txtGenus.setLayoutData(gd_txtGenus); - - final Label lblSpEpi = new Label(container, SWT.NONE); - lblSpEpi.setText("Sp. Epithet:"); - - txtSpEpi = new Text(container, SWT.BORDER); - final GridData gd_txtSpEpi = new GridData(SWT.FILL, SWT.CENTER, true, false); - txtSpEpi.setLayoutData(gd_txtSpEpi); - - final Label lblAuthor = new Label(container, SWT.NONE); - lblAuthor.setText("Authorship:"); - - txtAuthor = new Text(container, SWT.BORDER); - final GridData gd_txtAuthor = new GridData(SWT.FILL, SWT.CENTER, true, false); - txtAuthor.setLayoutData(gd_txtAuthor); - new Label(container, SWT.NONE); - - final Button btnSaveName = new Button(container, SWT.NONE); - - btnSaveName.addMouseListener(new MouseAdapter() { - public void mouseDown(final MouseEvent e) { - - taxonname.setGenus(txtGenus.getText()); - taxonname.setSpecificEpithet(txtSpEpi.getText()); - - new SaveNameAction(taxonname).run(); - } - }); - final GridData gd_btnSaveName = new GridData(SWT.RIGHT, SWT.CENTER, false, false); - btnSaveName.setLayoutData(gd_btnSaveName); - btnSaveName.setText("Save Name"); - // - - -// txtPlay = new Text(container, SWT.BORDER); -// txtPlay.setCapture(true); -// final GridData gd_txtPlay = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1); -// gd_txtPlay.heightHint = 96; -// txtPlay.setLayoutData(gd_txtPlay); -//// txtPlay.addVerifyListener(new VerifyListener() { -//// @Override -//// public void verifyText(VerifyEvent e) { -//// e.doit = Character.isDigit(e.character); -//// } -//// }); -// txtPlay.addSelectionListener(new SelectionListener() { -// -// @Override -// public void widgetDefaultSelected(SelectionEvent e) { -// // TODO Auto-generated method stub -// -// } -// -// @Override -// public void widgetSelected(SelectionEvent e) { -// System.out.println(e.toString()); -// } -// -// -// }); -// -// -// txtPlay.addKeyListener(new KeyListener() { -// -// public void keyPressed(KeyEvent e) { -// System.out.println(e.character); -// if (e.character == '=') { -// Shell shell = Activator.getDefault().getWorkbench(). -// getActiveWorkbenchWindow().getShell(); -// PopupList list = new PopupList(shell, SWT.H_SCROLL | SWT.V_SCROLL); -// -//// Combo list = new Combo(shell, SWT.H_SCROLL | SWT.V_SCROLL); -// -// // Add the items to the list -// String[] OPTIONS = { "Create homo. syn.", -// "Create hetero. syn.", -// "Create mis. name", -// "Create homonym"}; -// -// list.setItems(OPTIONS); -// -// // Open the list and get the selected item -// String selected = list.open(txtPlay.getBounds()); -// -// // Print the item to the console -// System.out.println(selected); -// } -// -// } -// -// public void keyReleased(KeyEvent e) { -// // TODO Auto-generated method stub -// -// } -// }); - - Document doc = new Document(taxonname.getName()); - - SourceViewer sourceviewer = new SourceViewer(container, null, SWT.BORDER);; - sourceviewer.setTabsToSpacesConverter(null); - sourceviewer.setAnnotationHover(null); - styledText = sourceviewer.getTextWidget(); - final GridData gd_styledText_1 = new GridData(SWT.FILL, SWT.CENTER, - false, false, 2, 1); - gd_styledText_1.heightHint = 90; - styledText.setLayoutData(gd_styledText_1); - sourceviewer.setDocument(doc); - sourceviewer.configure(new MySourceViewerConfig()); - - populateForm(); - } - - private void populateForm() { - - String fulltext = ""; - - if (taxonname.getGenus() != null) { - txtGenus.setText(taxonname.getGenus()); - fulltext = taxonname.getGenus(); - } - - if (taxonname.getSpecificEpithet() != null) { - txtSpEpi.setText(taxonname.getSpecificEpithet()); - fulltext += " " + taxonname.getSpecificEpithet(); - } - - if (taxonname.getAuthorship() != null) { - txtAuthor.setText(taxonname.getAuthorship()); - fulltext += " " + taxonname.getAuthorship(); - } - -// txtPlay.setText(fulltext); -// txtPlay.setToolTipText("Joe mama\njoe daddy\njoe gramammy"); - - this.setPartName(taxonname.getName()); - } - - @Override - public void setFocus() { - // Set the focus - } - - @Override - public void doSave(IProgressMonitor monitor) { - // Do the Save operation - } - - @Override - public void doSaveAs() { - // Do the Save As operation - } - - @Override - public void init(IEditorSite site, IEditorInput input) throws PartInitException { - - if (!(input instanceof IEditorInput)) - throw new PartInitException( - "Invalid Input: Must be IFileEditorInput"); - - if (input.getAdapter(TaxonName.class) != null) { - taxonname = (TaxonName) input.getAdapter(TaxonName.class); - taxonname.addPropertyChangeListener(this); - } else { - - taxonname = null; - } - - setSite(site); - setInput(input); - } - - @Override - public boolean isDirty() { - return false; - } - - @Override - public boolean isSaveAsAllowed() { - return false; - } - - public void propertyChange(PropertyChangeEvent evt) { -// TaxonName taxonname = (TaxonName)evt.getNewValue(); - this.taxonname = (TaxonName)evt.getNewValue(); - System.out.println(((TaxonName)evt.getNewValue()).getName()); - populateForm(); - - // for individual fields, do something like: - // if (evt.getPropertyName().equalsIgnoreCase("genus")) - // txtGenus.setText ... - } - -} diff --git a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/NameListView.java b/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/NameListView.java deleted file mode 100644 index 8876cf286..000000000 --- a/eclipseprojects/eu.etaxonomy.taxeditor.designproposal1/src/eu/etaxonomy/taxeditor/prototype1/view/NameListView.java +++ /dev/null @@ -1,225 +0,0 @@ -package eu.etaxonomy.taxeditor.prototype1.view; - -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.viewers.DoubleClickEvent; -import org.eclipse.jface.viewers.IDoubleClickListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerLabel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.ExpandBar; -import org.eclipse.swt.widgets.ExpandItem; -import org.eclipse.ui.part.ViewPart; - -import eu.etaxonomy.cdm.api.service.INameService; -import eu.etaxonomy.cdm.model.name.TaxonName; -import eu.etaxonomy.taxeditor.prototype1.Activator; -import eu.etaxonomy.taxeditor.prototype1.controller.OpenNameEditorAction; - -public class NameListView extends ViewPart { - - - private Composite nameListComposite = null; - private Composite recentNamesComposite = null; - private Composite searchComposite = null; - private Composite top = null; - private ExpandBar expandBar = null; - private TableViewer viewer; - private ExpandItem nameListExpandItem; - private ExpandItem recentNamesExpandItem; - private ExpandItem searchExpandItem; - public static final String ID = "eu.etaxonomy.mvctest.view.NameListView"; //$NON-NLS-1$ - - class ViewContentProvider implements IStructuredContentProvider { - - public Object[] getElements(Object inputElement) { - INameService ns = Activator.getDefault().getApplicationController().getNameService(); - return ns.getAllNames().toArray(); - } - - public void dispose() { - // TODO Auto-generated method stub - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - // TODO Auto-generated method stub -// Notifies this content provider that the given viewer's input -// has been switched to a different element. - } - } - - class ViewLabelProvider extends LabelProvider implements ITableLabelProvider { - - public Image getColumnImage(Object element, int columnIndex) { - // TODO Auto-generated method stub - return null; - } - - public String getColumnText(Object element, int columnIndex) { - return ((TaxonName) element).getName(); - } - - public void updateLabel(ViewerLabel label, Object element) { - // TODO Auto-generated method stub - - } - - } - - /** - * Create contents of the view part - * @param parent - */ - @Override - public void createPartControl(Composite parent) { - // TODO Auto-generated method stub - GridLayout gridLayout = new GridLayout(); - gridLayout.horizontalSpacing = 0; - gridLayout.marginWidth = 0; - gridLayout.marginHeight = 0; - gridLayout.verticalSpacing = 0; - top = new Composite(parent, SWT.NONE); - createExpandBar(); - top.setLayout(gridLayout); - } - - /** - * This method initializes expandBar - * - */ - private void createExpandBar() { - expandBar = new ExpandBar(top, SWT.V_SCROLL); - GridData gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL; - gridData.grabExcessHorizontalSpace = true; - gridData.grabExcessVerticalSpace = true; - gridData.verticalAlignment = GridData.FILL; - expandBar.setLayoutData(gridData); - createNameListComposite(); - createRecentNamesComposite(); - createSearchComposite(); - - createActions(); - initializeToolBar(); - initializeMenu(); - - } - - private void createNameListComposite() { - nameListExpandItem = new ExpandItem(expandBar, SWT.NONE, 0); - nameListExpandItem.setText("Name List"); - nameListExpandItem.setExpanded(true); -// Image image = FileArrangerImages.getImageRegistry().get( -// IFileArrangerImages.IMG_HOME); -// nameListExpandItem.setImage(image); - - nameListComposite = new Composite(expandBar, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10; - layout.verticalSpacing = 5; - nameListComposite.setLayout(layout); - - viewer = new TableViewer(nameListComposite, SWT.MULTI | SWT.H_SCROLL - | SWT.V_SCROLL); - viewer.setContentProvider(new ViewContentProvider()); - viewer.setLabelProvider(new ViewLabelProvider()); - viewer.setInput(getViewSite()); - - viewer.addDoubleClickListener(new IDoubleClickListener(){ - - public void doubleClick(DoubleClickEvent event) { - TaxonName taxonname = null; - try { - taxonname = (TaxonName) ((StructuredSelection)event.getSelection()).getFirstElement(); - }catch (Exception e){ - e.printStackTrace(); - taxonname = null; - } - new OpenNameEditorAction(taxonname).run(); - } - }); - - nameListExpandItem.setHeight(nameListComposite.computeSize( - SWT.DEFAULT, SWT.DEFAULT).y); - nameListExpandItem.setControl(nameListComposite); - - } - - private void createRecentNamesComposite() { - recentNamesExpandItem = new ExpandItem(expandBar, SWT.NONE, 1); - recentNamesExpandItem.setText("Recently viewed names"); - recentNamesComposite = new Composite(expandBar, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10; - layout.verticalSpacing = 5; - recentNamesComposite.setLayout(layout); - - recentNamesExpandItem.setHeight(recentNamesComposite.computeSize( - SWT.DEFAULT, SWT.DEFAULT).y); - recentNamesExpandItem.setControl(recentNamesComposite); - -// Image image = FileArrangerImages.getImageRegistry().get( -// IFileArrangerImages.IMG_BOOKMARK); -// bookmarksExpandItem.setImage(image); - } - - private void createSearchComposite() { - searchExpandItem = new ExpandItem(expandBar, SWT.NONE, 2); - searchExpandItem.setText("Search"); - searchComposite = new Composite(expandBar, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10; - layout.verticalSpacing = 5; - searchComposite.setLayout(layout); - - searchExpandItem.setHeight(searchComposite.computeSize(SWT.DEFAULT, - SWT.DEFAULT).y); - searchExpandItem.setControl(searchComposite); - -// Image image = FileArrangerImages.getImageRegistry().get( -// IFileArrangerImages.IMG_FTP); -// ftpExpandItem.setImage(image); - } - - private void createActions() { - // Create the actions - } - - /** - * Initialize the toolbar - */ - private void initializeToolBar() { - IToolBarManager toolbarManager = getViewSite().getActionBars() - .getToolBarManager(); - } - - /** - * Initialize the menu - */ - private void initializeMenu() { - IMenuManager menuManager = getViewSite().getActionBars() - .getMenuManager(); - } - - @Override - public void setFocus() { - // Set the focus - } - - /** - * Refreshes a taxon name in the list - */ - public void refreshElement(TaxonName taxonname) { - this.viewer.refresh(taxonname); - } - -}