Author: vyemialyanchyk
Date: 2009-07-02 13:45:17 -0400 (Thu, 02 Jul 2009)
New Revision: 16350
Removed:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/images/
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ImageBundle.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.properties
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/HibernateUtils.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ObjectEditorInput.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmImageMap.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelMap.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelProvider.java
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/META-INF/MANIFEST.MF
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/plugin.xml
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4524 - rename veditor plugin
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/META-INF/MANIFEST.MF
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/META-INF/MANIFEST.MF 2009-07-02
17:42:29 UTC (rev 16349)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/META-INF/MANIFEST.MF 2009-07-02
17:45:17 UTC (rev 16350)
@@ -7,20 +7,7 @@
Bundle-Activator: org.jboss.tools.hibernate.ui.view.ViewPlugin
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin
-Export-Package: org.jboss.tools.hibernate.ui.view,
- org.jboss.tools.hibernate.ui.view.views
+Export-Package: org.jboss.tools.hibernate.ui.view
Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.jdt.core,
- org.eclipse.jdt.ui,
- org.eclipse.core.resources,
- org.eclipse.ui.ide,
- org.eclipse.ui.views,
- org.eclipse.ltk.core.refactoring,
- org.eclipse.ui.editors,
- org.eclipse.jface.text,
- org.hibernate.eclipse,
- org.eclipse.debug.core,
- org.hibernate.eclipse.console
-Eclipse-LazyStart: true
+ org.eclipse.core.runtime
+Bundle-ActivationPolicy: lazy
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/plugin.xml
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/plugin.xml 2009-07-02
17:42:29 UTC (rev 16349)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/plugin.xml 2009-07-02
17:45:17 UTC (rev 16350)
@@ -1,15 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?><?eclipse
version="3.0"?>
<plugin>
-
- <extension point="org.eclipse.ui.popupMenus">
- <objectContribution id="diagramEditorAction"
objectClass="org.hibernate.mapping.PersistentClass">
- <menu id="org.jboss.tools.hibernate.ui.view.openDiagram"
label="Open Mapping Diagram" path="diagramEditorAction"/>
- <action
- id="org.jboss.tools.hibernate.ui.view.openDiagramAction"
- label="Open Mapping Diagram"
- icon="images/hibernate_small_icon.gif"
-
class="org.jboss.tools.hibernate.ui.view.views.OpenDiagramActionDelegate">
- </action>
- </objectContribution>
- </extension>
</plugin>
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ImageBundle.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ImageBundle.java 2009-07-02
17:42:29 UTC (rev 16349)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ImageBundle.java 2009-07-02
17:45:17 UTC (rev 16350)
@@ -1,22 +0,0 @@
-package org.jboss.tools.hibernate.ui.view;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class ImageBundle {
- private static final String BUNDLE_NAME =
"org.jboss.tools.hibernate.ui.view.image"; //$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(BUNDLE_NAME);
-
- private ImageBundle() {
- }
-
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-}
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.java 2009-07-02
17:42:29 UTC (rev 16349)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.java 2009-07-02
17:45:17 UTC (rev 16350)
@@ -1,21 +0,0 @@
-package org.jboss.tools.hibernate.ui.view;
-
-import org.eclipse.osgi.util.NLS;
-
-public class UIViewMessages extends NLS {
- private static final String BUNDLE_NAME =
"org.jboss.tools.hibernate.ui.view.UIViewMessages"; //$NON-NLS-1$
- public static String BaseUIPlugin_hibernate_console;
- public static String ViewPlugin_canot_load_preference_store_properties;
- public static String OrmLabelProvider_element;
- public static String OrmLabelProvider_orm_element;
- public static String OrmLabelProvider_unknown_type_of_element_in_tree_of_type;
- public static String ViewPlugin_no_message_1;
- public static String ViewPlugin_no_message_2;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, UIViewMessages.class);
- }
-
- private UIViewMessages() {
- }
-}
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.properties
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.properties 2009-07-02
17:42:29 UTC (rev 16349)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.properties 2009-07-02
17:45:17 UTC (rev 16350)
@@ -1,9 +0,0 @@
-BaseUIPlugin_hibernate_console=Hibernate Console
-ViewPlugin_canot_load_preference_store_properties=Can't load preference store
properties
-
-OrmLabelProvider_element=element
-OrmLabelProvider_orm_element=OrmElement
-OrmLabelProvider_unknown_type_of_element_in_tree_of_type=Unknown type of element in tree
of type:
-
-ViewPlugin_no_message_1=: <no message>
-ViewPlugin_no_message_2=<No message>
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java 2009-07-02
17:42:29 UTC (rev 16349)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java 2009-07-02
17:45:17 UTC (rev 16350)
@@ -35,17 +35,6 @@
setPlugin(this);
}
- public static ImageDescriptor getImageDescriptor(String name) {
- final String iconPath = "images/"; //$NON-NLS-1$
- final URL installURL = getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
- URL url = null;
- try {
- url = new URL(installURL, iconPath + name);
- } catch (MalformedURLException e) {
- }
- return ImageDescriptor.createFromURL(url);
- }
-
public void start(BundleContext context) throws Exception {
super.start(context);
}
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties 2009-07-02
17:42:29 UTC (rev 16349)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties 2009-07-02
17:45:17 UTC (rev 16350)
@@ -1,100 +0,0 @@
-# START NON-TRANSLATABLE
-
-#Image
-Image_OrmModel=exdOrmModel.gif
-Image_DatabaseSchema=exdDatabaseSchema.gif
-Image_DatabaseTable=exdDatabaseTable.gif
-Image_DatabaseView=exdDatabaseView.gif
-Image_DatabaseConstraint=exdDatabaseConstraint1.gif
-Image_Package=exdPackage.gif
-Image_Mapping=exdMapping.gif
-Image_MappingStorage=exdMappingStorage.gif
-Image_PersistentClass=exdPersistentClass.gif
-Image_PersistentField=exdPersistentField.gif
-
-Image_PersistentClassMapping=exdPersistentClassMapping.gif
-#Image_PersistentRootClassMapping=exdPersistentRootClassMapping.gif
-Image_PersistentRootClassMapping=exdPersistentRootClassMappingC.gif
-Image_PersistentSubclassMapping=exdPersistentSubclassMapping.gif
-Image_PersistentUnionSubclassMapping=exdPersistentUnionSubclassMapping.gif
-Image_PersistentJoinedSubclassMapping=exdPersistentJoinedSubclassMapping.gif
-
-
-Image_PersistentFieldMapping=exdPersistentFieldMapping1.gif
-Image_PersistentValueMapping=exdPersistentValueMapping1.gif
-
-##Image for PersistentField
-Image_PersistentFieldAny=any.gif
-Image_PersistentFieldComponent=component.gif
-Image_PersistentFieldComponent_id=component_id.gif
-Image_PersistentFieldMany-to-any=many-to-any.gif
-Image_PersistentFieldMany-to-many=many-to-many.gif
-Image_PersistentFieldMany-to-one=many-to-one.gif
-Image_PersistentFieldMany-to-one_id=many-to-one_id.gif
-Image_PersistentFieldOne-to-many=one-to-many.gif
-Image_PersistentFieldOne-to-one=one-to-one.gif
-Image_PersistentFieldOne-to-one_id=one-to-one_id.gif
-Image_PersistentFieldSimple=simple.gif
-Image_PersistentFieldSimple_id=simple_id.gif
-Image_PersistentFieldSimple_version=simple_version.gif
-Image_PersistentFieldNot_mapped=not_mapped.gif
-Image_PersistentFieldParent=parent.gif
-
-##Image for Collection
-Image_Collection=collection.gif
-Image_Collection_array=collection_array.gif
-Image_Collection_primitive_array=collection_primitive_array.gif
-Image_Collection_set=collection_set.gif
-Image_Collection_bag=collection_bag.gif
-Image_Collection_idbag=collection_idbag.gif
-Image_Collection_list=collection_list.gif
-Image_Collection_map=collection_map.gif
-Image_NamedQueryMapping=hql.gif
-
-
-##Image for IDatabaseColumn
-Image_DatabaseColumn=exdDatabaseColumn.gif
-Image_DatabasePrimaryKeyColumn=exdDatabasePrimaryKeyColumn.gif
-Image_DatabaseForeignKeyColumn=exdDatabaseForeignKeyColumn.gif
-Image_DatabaseDiscriminatorColumn=exdDatabaseDiscriminatorColumn.gif
-Image_DatabaseVersionColumn=exdDatabaseVersionColumn.gif
-Image_DatabasePrimaryForeignKeysColumn=exdDatabasePrimaryForeignKeysColumn.gif
-Image_DatabaseUniqueKeyColumn=unique_key.gif
-
-#Explorer
-Explorer.RootPackageClassField=exdPackage.gif
-Explorer.RootClassField=exdPersistentClassMapping.gif
-Explorer.RootStorageClassField=exdPersistentField.gif
-Explorer.WizardAction=exdWizardAction1.gif
-Explorer.DialogAction=exdDialogAction1.gif
-Explorer.Delete=delete_edit.gif
-Explorer.hibernateAddMappingWizard=exdMapping_new.gif
-Explorer.refreshOrmGef=refresh_orm_gef.gif
-
-ExplorerBase.RootSchemaTableColumn=exdDatabaseSchema.gif
-ExplorerBase.RootTableColumn=exdDatabaseColumn.gif
-
-#Wizard
-Wizard.Title=wiz_icon.gif
-
-#Decorator
-Decorator.Error=error_view.gif
-Decorator.Warning=warning_vew.gif
-Decorator.Unknown=unknown.gif
-
-#NamedQueriesWizard
-NamedQueriesWizard.object=object.gif
-NamedQueriesWizard.object_none=object_none.gif
-NamedQueriesWizard.property=property.gif
-NamedQueriesWizard.error=error_st_obj.gif
-
-#TreeModel
-TreeModelLabel.jar_obj=jar_obj.gif
-TreeModelLabel.file_obj=file_obj.gif
-TreeModelLabel.fldr_obj=fldr_obj.gif
-
-#VisualMapping
-VisualMapping.shevronUp=shevron_up.gif
-VisualMapping.shevronDown=shevron_down.gif
-
-# END NON-TRANSLATABLE
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/HibernateUtils.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/HibernateUtils.java 2009-07-02
17:42:29 UTC (rev 16349)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/HibernateUtils.java 2009-07-02
17:45:17 UTC (rev 16350)
@@ -1,70 +0,0 @@
-package org.jboss.tools.hibernate.ui.view.views;
-
-import java.util.Iterator;
-
-import org.hibernate.mapping.Column;
-import org.hibernate.mapping.ForeignKey;
-import org.hibernate.mapping.PersistentClass;
-import org.hibernate.mapping.Table;
-
-public class HibernateUtils {
-
- public static String getTableName(String catalog, String schema, String name) {
- return (catalog != null ? catalog + "." : "") + (schema != null ?
schema + "." : "") + name; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
//$NON-NLS-4$
- }
-
- public static String getTableName(Table table) {
- return getTableName(table.getCatalog(), table.getSchema(), table.getName());
- }
-
- public static String getPersistentClassName(PersistentClass rootClass) {
- if (rootClass == null) {
- return ""; //$NON-NLS-1$
- }
- return rootClass.getEntityName() != null ? rootClass.getEntityName() :
rootClass.getClassName();
- }
-
- public static String getPersistentClassName(String className) {
- if (className == null) {
- return ""; //$NON-NLS-1$
- } else if (className.indexOf(".") < 0) { //$NON-NLS-1$
- return "default." + className; //$NON-NLS-1$
- }
- return className;
- }
-
- public static boolean isPrimaryKey(Column column) {
- Table table = getTable(column);
- if (table != null) {
- if (table.getPrimaryKey() != null) {
- if (table.getPrimaryKey().containsColumn(column)) {
- return true;
- }
- }
- }
- return false;
- }
-
- @SuppressWarnings("unchecked")
- public static boolean isForeignKey(Column column){
- Table table = getTable(column);
- if (table != null) {
- Iterator<ForeignKey> iter = table.getForeignKeyIterator();
- while (iter.hasNext()) {
- ForeignKey fk = iter.next();
- if (fk.containsColumn(column)) {
- return true;
- }
- }
- }
- return false;
-
- }
-
- public static Table getTable(Column column){
- if (column.getValue() != null) {
- return column.getValue().getTable();
- }
- return null;
- }
-}
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ObjectEditorInput.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ObjectEditorInput.java 2009-07-02
17:42:29 UTC (rev 16349)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ObjectEditorInput.java 2009-07-02
17:45:17 UTC (rev 16350)
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.ui.view.views;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-import org.hibernate.console.ConsoleConfiguration;
-
-
-public class ObjectEditorInput implements IEditorInput{
-
- protected Object fObject;
- protected ConsoleConfiguration configuration;
-
- public ObjectEditorInput(ConsoleConfiguration configuration, Object object) {
- fObject = object;
- this.configuration = configuration;
- }
-
- public Object getObject() {
- return fObject;
- }
-
-
- public boolean exists() {
- return false;
- }
-
-
- public ImageDescriptor getImageDescriptor() {
- return ImageDescriptor.getMissingImageDescriptor();
- }
-
-
- public String getName() {
- return ""; //$NON-NLS-1$
- }
-
-
- public IPersistableElement getPersistable() {
- return null;
- }
-
-
- public String getToolTipText() {
- return ""; //$NON-NLS-1$
- }
-
-
- @SuppressWarnings("unchecked")
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- public ConsoleConfiguration getConfiguration() {
- return configuration;
- }
-
- public boolean equals(Object obj) {
- return (obj instanceof ObjectEditorInput && ((ObjectEditorInput)obj).fObject ==
fObject);
- }
-
- public int hashCode() {
- return fObject.hashCode();
- }
-}
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java 2009-07-02
17:42:29 UTC (rev 16349)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java 2009-07-02
17:45:17 UTC (rev 16350)
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.ui.view.views;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.internal.ObjectPluginAction;
-import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.eclipse.console.HibernateConsolePlugin;
-import org.hibernate.mapping.PersistentClass;
-import org.hibernate.mapping.RootClass;
-import org.jboss.tools.hibernate.ui.view.ViewPlugin;
-
-@SuppressWarnings("restriction")
-public class OpenDiagramActionDelegate implements IObjectActionDelegate {
-
- private HashMap<Object, ObjectEditorInput> hashMap = new HashMap<Object,
ObjectEditorInput>();
- //private IWorkbenchPart fPart;
-
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- //this.fPart = targetPart;
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- public void run(IAction action) {
- ObjectPluginAction objectPluginAction = (ObjectPluginAction)action;
- Map<ConsoleConfiguration, Set<PersistentClass>> mapCC_PCs = new
HashMap<ConsoleConfiguration, Set<PersistentClass>>();
- TreePath[] paths = ((TreeSelection)objectPluginAction.getSelection()).getPaths();
- for (int i = 0; i < paths.length; i++) {
- Object last_el = paths[i].getLastSegment();
- if (last_el instanceof PersistentClass) {
- PersistentClass persClass = (PersistentClass) last_el;
- ConsoleConfiguration consoleConfiguration =
(ConsoleConfiguration)(paths[i].getFirstSegment());
- Set<PersistentClass> setPC = mapCC_PCs.get(consoleConfiguration);
- if (null == setPC) {
- setPC = new HashSet<PersistentClass>();
- mapCC_PCs.put(consoleConfiguration, setPC);
- }
- setPC.add(persClass);
- }
- }
- for (Iterator<ConsoleConfiguration> it = mapCC_PCs.keySet().iterator();
it.hasNext(); ) {
- ConsoleConfiguration consoleConfiguration = it.next();
- Set<PersistentClass> setPC = mapCC_PCs.get(consoleConfiguration);
- try {
- openEditor(setPC, consoleConfiguration);
- } catch (PartInitException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("Can't open mapping
view.", e); //$NON-NLS-1$
- }
- }
- }
-
- public IEditorPart openEditor(PersistentClass persClass,
- ConsoleConfiguration consoleConfiguration) throws PartInitException {
- ObjectEditorInput input = hashMap.get(persClass.getRootClass());
- if (input == null) {
- input = new ObjectEditorInput(consoleConfiguration, persClass.getRootClass());
- hashMap.put(persClass.getRootClass(), input);
- }
-
- return IDE.openEditor(ViewPlugin.getPage(),input,
"org.jboss.tools.hibernate.ui.veditor.editors.visualeditor"); //$NON-NLS-1$
- }
-
- public IEditorPart openEditor(Set<PersistentClass> setPC, ConsoleConfiguration
consoleConfiguration) throws PartInitException {
-
- if (0 >= setPC.size()) {
- return null;
- }
-
- RootClass[] rcArr = new RootClass[setPC.size()];
- String id = ""; //$NON-NLS-1$
- PersistentClass persClass = null;
- int i = 0;
- for (Iterator<PersistentClass> it = setPC.iterator(); it.hasNext(); ) {
- persClass = it.next();
- id += "@" + persClass.toString(); //$NON-NLS-1$
- rcArr[i++] = persClass.getRootClass();
- }
- ObjectEditorInput input = hashMap.get(id);
- if (null == input) {
- input = new ObjectEditorInput(consoleConfiguration, rcArr);
- hashMap.put(id, input);
- }
-
- return IDE.openEditor(ViewPlugin.getPage(),input,
"org.jboss.tools.hibernate.ui.veditor.editors.visualeditor"); //$NON-NLS-1$
- }
-}
\ No newline at end of file
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmImageMap.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmImageMap.java 2009-07-02
17:42:29 UTC (rev 16349)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmImageMap.java 2009-07-02
17:45:17 UTC (rev 16350)
@@ -1,202 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.ui.view.views;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.hibernate.mapping.Any;
-import org.hibernate.mapping.Array;
-import org.hibernate.mapping.Bag;
-import org.hibernate.mapping.Column;
-import org.hibernate.mapping.Component;
-import org.hibernate.mapping.DependantValue;
-import org.hibernate.mapping.IdentifierBag;
-import org.hibernate.mapping.List;
-import org.hibernate.mapping.ManyToOne;
-import org.hibernate.mapping.Map;
-import org.hibernate.mapping.OneToMany;
-import org.hibernate.mapping.OneToOne;
-import org.hibernate.mapping.PersistentClass;
-import org.hibernate.mapping.PrimitiveArray;
-import org.hibernate.mapping.Property;
-import org.hibernate.mapping.Set;
-import org.hibernate.mapping.SimpleValue;
-import org.hibernate.mapping.Table;
-import org.hibernate.mapping.Value;
-import org.jboss.tools.hibernate.ui.view.ImageBundle;
-import org.jboss.tools.hibernate.ui.view.ViewPlugin;
-
-/**
- * Map: ORM object -> Image descriptor
- */
-public class OrmImageMap {
-
- private OrmImageMap() {}
-
- public static ImageDescriptor getImageDescriptor(final Object obj) {
- String imageName = null;
- if (obj instanceof Table) {
- imageName = getImageName((Table)obj);
- } else if (obj instanceof Column) {
- imageName = getImageName((Column)obj);
- } else if (obj instanceof Property) {
- imageName = getImageName((Property)obj);
- } else if (obj instanceof OneToMany) {
- imageName = getImageName((OneToMany)obj);
- } else if (obj instanceof SimpleValue) {
- imageName = getImageName((SimpleValue)obj);
- } else if (obj instanceof PersistentClass) {
- imageName = getImageName((PersistentClass)obj);
- }
- return ViewPlugin.getImageDescriptor(ImageBundle.getString(imageName));
- }
-
- /**
- * the image name for hierarchy:
- * Table
- * @param table
- * @return
- */
- public static String getImageName(Table table) {
- return "Image_DatabaseTable"; //$NON-NLS-1$
- }
-
- /**
- * the image name for hierarchy:
- * Column
- * @param column
- * @return
- */
- public static String getImageName(Column column) {
- String str = "Image_DatabaseColumn"; //$NON-NLS-1$
- final boolean primaryKey = HibernateUtils.isPrimaryKey(column);
- final boolean foreignKey = HibernateUtils.isForeignKey(column);
- final Table table = HibernateUtils.getTable(column);
- if (column.isUnique()) {
- str = "Image_DatabaseUniqueKeyColumn"; //$NON-NLS-1$
- } else if (primaryKey && table != null && foreignKey) {
- str = "Image_DatabasePrimaryForeignKeysColumn"; //$NON-NLS-1$
- } else if (primaryKey) {
- str = "Image_DatabasePrimaryKeyColumn"; //$NON-NLS-1$
- } else if (table != null && foreignKey) {
- str = "Image_DatabaseForeignKeyColumn"; //$NON-NLS-1$
- }
- return str;
-
- }
-
- /**
- * the image name for hierarchy:
- * Property
- * @param field
- * @return
- */
- public static String getImageName(Property field) {
- String str = "Image_PersistentFieldSimple"; //$NON-NLS-1$
- if (field == null) {
- return str;
- }
- final PersistentClass persistentClass = field.getPersistentClass();
- if (persistentClass != null && persistentClass.getVersion() == field) {
- str = "Image_PersistentFieldSimple_version"; //$NON-NLS-1$
- } else if (persistentClass != null && persistentClass.getIdentifierProperty()
== field) {
- str = "Image_PersistentFieldSimple_id"; //$NON-NLS-1$
- } else if (field.getValue() != null) {
- final Value value = field.getValue();
- if (value instanceof OneToMany) {
- str = "Image_PersistentFieldOne-to-many"; //$NON-NLS-1$
- } else if (value instanceof OneToOne) {
- str = "Image_PersistentFieldOne-to-one"; //$NON-NLS-1$
- } else if (value instanceof ManyToOne) {
- str = "Image_PersistentFieldMany-to-one"; //$NON-NLS-1$
- } else if (value instanceof Any) {
- str = "Image_PersistentFieldAny"; //$NON-NLS-1$
- } else if (field.getType() != null && field.getType().isCollectionType()) {
- if (value instanceof PrimitiveArray) {
- str = "Image_Collection_primitive_array"; //$NON-NLS-1$
- } else if (value instanceof Array) {
- str = "Image_Collection_array"; //$NON-NLS-1$
- } else if (value instanceof List) {
- str = "Image_Collection_list"; //$NON-NLS-1$
- } else if (value instanceof Set) {
- str = "Image_Collection_set"; //$NON-NLS-1$
- } else if (value instanceof Map) {
- str = "Image_Collection_map"; //$NON-NLS-1$
- } else if (value instanceof Bag) {
- str = "Image_Collection_bag"; //$NON-NLS-1$
- } else if (value instanceof IdentifierBag) {
- str = "Image_Collection_idbag"; //$NON-NLS-1$
- } else {
- str = "Image_Collection"; //$NON-NLS-1$
- }
- }
- } else if ("parent".equals(field.getName())) { //$NON-NLS-1$
- str = "Image_PersistentFieldParent"; //$NON-NLS-1$
- }
- return str;
- }
-
- /**
- * the image name for hierarchy:
- * OneToMany
- * @param field
- * @return
- */
- public static String getImageName(OneToMany field) {
- return "Image_PersistentFieldOne-to-many"; //$NON-NLS-1$
- }
-
- /**
- * the image name for hierarchy:
- * SimpleValue
- * |-- Any
- * |-- Component
- * |-- DependantValue
- * |-- ToOne
- * |-- ManyToOne
- * |-- OneToOne
- * @param field
- * @return
- */
- public static String getImageName(SimpleValue field) {
- String res = "Image_PersistentFieldSimple"; //$NON-NLS-1$
- if (field instanceof Any) {
- res = "Image_PersistentFieldMany-to-any"; //$NON-NLS-1$
- } else if (field instanceof Component) {
- res = "Image_PersistentFieldComponent"; //$NON-NLS-1$
- } else if (field instanceof DependantValue) {
- DependantValue mapping = (DependantValue)field;
- if (mapping.getTable().getIdentifierValue() == mapping) {
- res = "Image_PersistentFieldComponent_id"; //$NON-NLS-1$
- }
- } else if (field instanceof ManyToOne) {
- res = "Image_PersistentFieldMany-to-many"; //$NON-NLS-1$
- }
- return res;
- }
-
- /**
- * the image name for hierarchy:
- * PersistentClass
- * |-- RootClass
- * | |-- SpecialRootClass
- * |
- * |-- Subclass
- * |-- JoinedSubclass
- * |-- SingleTableSubclass
- * |-- UnionSubclass
- * @param persistentClass
- * @return
- */
- public static String getImageName(PersistentClass persistentClass) {
- return "Image_PersistentClass"; //$NON-NLS-1$
- }
-
-}
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelMap.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelMap.java 2009-07-02
17:42:29 UTC (rev 16349)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelMap.java 2009-07-02
17:45:17 UTC (rev 16350)
@@ -1,202 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.ui.view.views;
-
-import org.hibernate.eclipse.console.workbench.TypeNameValueVisitor;
-import org.hibernate.mapping.Column;
-import org.hibernate.mapping.Component;
-import org.hibernate.mapping.DependantValue;
-import org.hibernate.mapping.OneToMany;
-import org.hibernate.mapping.PersistentClass;
-import org.hibernate.mapping.Property;
-import org.hibernate.mapping.SimpleValue;
-import org.hibernate.mapping.Table;
-import org.hibernate.mapping.Value;
-import org.hibernate.type.Type;
-import org.jboss.tools.hibernate.ui.view.UIViewMessages;
-
-/**
- * Map: ORM object -> label
- */
-public class OrmLabelMap {
-
- static private String SPACE = " "; //$NON-NLS-1$
- static private String POINTER = " -> "; //$NON-NLS-1$
-
- private OrmLabelMap() {}
-
- public static String getLabel(final Object obj) {
- String label = null;
- if (obj instanceof Table) {
- label = getParticularLabel((Table)obj);
- } else if (obj instanceof Column) {
- label = getParticularLabel((Column)obj);
- } else if (obj instanceof Property) {
- label = getParticularLabel((Property)obj);
- } else if (obj instanceof OneToMany) {
- label = getParticularLabel((OneToMany)obj);
- } else if (obj instanceof SimpleValue) {
- label = getParticularLabel((SimpleValue)obj);
- } else if (obj instanceof PersistentClass) {
- label = getParticularLabel((PersistentClass)obj);
- } else if (obj instanceof String) {
- label = (String)obj;
- } else {
- throw unknownElement(obj);
- }
- if (label == null) {
- label = UIViewMessages.OrmLabelProvider_orm_element;
- }
- return label;
- }
-
- public static String getParticularLabel(Table table) {
- return HibernateUtils.getTableName(table);
- }
-
- public static String getParticularLabel(Column column) {
- final String sqlType = column.getSqlType();
- StringBuffer name = new StringBuffer();
- name.append(column.getName());
- if (sqlType != null) {
- name.append(" ["); //$NON-NLS-1$
- name.append(sqlType.toUpperCase());
- name.append(column.isNullable() ? " Nullable" : ""); //$NON-NLS-1$
//$NON-NLS-2$
- name.append(HibernateUtils.getTable(column) != null
- && HibernateUtils.isPrimaryKey(column) ? " PK" : "");
//$NON-NLS-1$ //$NON-NLS-2$
- name.append(HibernateUtils.getTable(column) != null
- && HibernateUtils.isForeignKey(column) ? " FK" : "");
//$NON-NLS-1$ //$NON-NLS-2$
- name.append("]"); //$NON-NLS-1$
- }
- return name.toString();
- }
-
- public static String getParticularLabel(Property field) {
- StringBuffer name = new StringBuffer();
- name.append(field.getName());
- name.append(" :"); //$NON-NLS-1$
- String typeString = null;
- Type type = null;
- try {
- type = field.getType();
- } catch (Exception e) {
- // ignore - this is only way to catch java.lang.reflect.InvocationTargetException
- }
- if (type != null && type.getReturnedClass() != null) {
- typeString = type.getReturnedClass().getName();
- } else {
- if (field.getValue() instanceof Component) {
- typeString = ((Component)field.getValue()).getComponentClassName();
- } else if (field.getValue()!= null && field.getValue().isSimpleValue()) {
- typeString = ((SimpleValue)field.getValue()).getTypeName();
- }
- }
- if (typeString != null) {
- typeString = correctTypeString(typeString);
- name.append(SPACE);
- name.append(typeString);
- return name.toString();
- }
- Value value = field.getValue();
- String typeName = null;
- if (value != null) {
- typeName = (String) value.accept(new TypeNameValueVisitor(false));
- if (typeName != null) {
- return field.getName() + " : " + typeName; //$NON-NLS-1$
- }
- }
- return field.getName();
- }
-
- public static String getParticularLabel(OneToMany field) {
- return UIViewMessages.OrmLabelProvider_element;
- }
-
- /**
- * the label for hierarchy:
- * SimpleValue
- * |-- Any
- * |-- Component
- * |-- DependantValue
- * |-- ToOne
- * |-- ManyToOne
- * |-- OneToOne
- * @param field
- * @return
- */
- public static String getParticularLabel(SimpleValue field) {
- String label = UIViewMessages.OrmLabelProvider_element;
- if (field instanceof DependantValue) {
- label = "key"; //$NON-NLS-1$
- } else if (field instanceof Component) {
- label = "element"; //$NON-NLS-1$
- }
- return label;
- }
-
- /**
- * the label for hierarchy:
- * PersistentClass
- * |-- RootClass
- * | |-- SpecialRootClass
- * |
- * |-- Subclass
- * |-- JoinedSubclass
- * |-- SingleTableSubclass
- * |-- UnionSubclass
- * @param persistentClass
- * @return
- */
- public static String getParticularLabel(PersistentClass persistentClass) {
- StringBuffer name = new StringBuffer();
- name.append(persistentClass.getEntityName() != null ?
- persistentClass.getEntityName() : persistentClass.getClassName());
- Table table = persistentClass.getTable();
- if (table != null) {
- final String tableName = HibernateUtils.getTableName(table);
- if (tableName != null) {
- name.append(POINTER);
- name.append(tableName);
- }
- }
- return name.toString();
- }
-
- private static String correctTypeString(String str) {
- String ret = str;
- while (ret.startsWith("[")) { //$NON-NLS-1$
- ret = ret.substring(1).concat("[]"); //$NON-NLS-1$
- }
- switch (ret.toCharArray()[0]) {
- case 'Z': ret = "boolean".concat(ret.substring(1));break;
//$NON-NLS-1$
- case 'B': ret = "byte".concat(ret.substring(1));break; //$NON-NLS-1$
- case 'C': ret = "char".concat(ret.substring(1));break; //$NON-NLS-1$
- case 'L': ret = ret.substring(1);break;
- case 'D': ret = "double".concat(ret.substring(1));break;
//$NON-NLS-1$
- case 'F': ret = "float".concat(ret.substring(1));break;
//$NON-NLS-1$
- case 'I': ret = "int".concat(ret.substring(1));break; //$NON-NLS-1$
- case 'J': ret = "long".concat(ret.substring(1));break; //$NON-NLS-1$
- case 'S': ret = "short".concat(ret.substring(1));break;
//$NON-NLS-1$
- }
- return ret;
- }
-
- private static RuntimeException unknownElement(Object element) {
- String msg = UIViewMessages.OrmLabelProvider_unknown_type_of_element_in_tree_of_type;
- if (element != null && element.getClass() != null ) {
- msg = msg + element.getClass().getName();
- } else {
- msg = msg + element;
- }
- return new RuntimeException(msg);
-
- }
-}
\ No newline at end of file
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelProvider.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelProvider.java 2009-07-02
17:42:29 UTC (rev 16349)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelProvider.java 2009-07-02
17:45:17 UTC (rev 16350)
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.ui.view.views;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IColorProvider;
-import org.eclipse.jface.viewers.IFontProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.cfg.Environment;
-import org.hibernate.dialect.Dialect;
-import org.hibernate.eclipse.console.HibernateConsolePlugin;
-import org.hibernate.engine.Mapping;
-import org.hibernate.mapping.Column;
-import org.hibernate.mapping.Property;
-import org.hibernate.mapping.RootClass;
-
-public class OrmLabelProvider extends LabelProvider implements IColorProvider,
IFontProvider {
-
- private Map<ImageDescriptor, Image> imageCache = new HashMap<ImageDescriptor,
Image>(25);
-
- protected Configuration config = null;
- protected Mapping mapping = null;
- protected Dialect dialect = null;
-
- public OrmLabelProvider() {
- }
-
- public OrmLabelProvider(Configuration config) {
- super();
- setConfig(config);
- }
-
- public void setConfig(Configuration config) {
- if (this.config == config) {
- return;
- }
- this.config = config;
- mapping = null;
- dialect = null;
- }
-
- @Override
- public Image getImage(Object element) {
- ImageDescriptor descriptor = OrmImageMap.getImageDescriptor(element);
- if (descriptor == null) {
- return null;
- }
- Image image = imageCache.get(descriptor);
- if (image == null) {
- image = descriptor.createImage();
- imageCache.put(descriptor, image);
- }
- return image;
- }
-
- @Override
- public String getText(Object obj) {
- if (obj instanceof Column) {
- updateColumnSqlType((Column)obj);
- }
- return OrmLabelMap.getLabel(obj);
- }
-
- public void dispose() {
- for (Iterator<Image> i = imageCache.values().iterator(); i.hasNext();) {
- i.next().dispose();
- }
- imageCache.clear();
- }
-
- public Color getForeground(Object element) {
- if (element instanceof RootClass) {
- return Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GREEN);
- } else if (element instanceof Property) {
- return Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE);
- }
- return null;
- }
-
- public Color getBackground(Object element) {
- return null;
- }
-
- public Font getFont(Object element) {
- //return
JFaceResources.getFontRegistry().getBold(JFaceResources.getTextFont().getFontData()[0].getName());
- return null;
- }
-
- /**
- * For correct label creation should update column sql type.
- * @param column
- * @return
- */
- public boolean updateColumnSqlType(final Column column) {
- String sqlType = column.getSqlType();
- if (sqlType != null) {
- return false;
- }
- if (mapping == null) {
- mapping = config.buildMapping();
- }
- if (dialect == null) {
- final String dialectName = config.getProperty(Environment.DIALECT);
- if (dialectName != null) {
- try {
- dialect = (Dialect) Class.forName(dialectName).newInstance();
- } catch (InstantiationException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("Exception: ", e);
//$NON-NLS-1$
- } catch (IllegalAccessException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("Exception: ", e);
//$NON-NLS-1$
- } catch (ClassNotFoundException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("Exception: ", e);
//$NON-NLS-1$
- }
- }
- }
- sqlType = column.getSqlType(dialect, mapping);
- column.setSqlType(sqlType);
- return true;
- }
-
-}
\ No newline at end of file