JBoss Tools SVN: r2319 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view: META-INF and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-07-05 08:22:44 -0400 (Thu, 05 Jul 2007)
New Revision: 2319
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/META-INF/MANIFEST.MF
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/plugin.properties
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/plugin.xml
Log:
JBIDE-559: Hibernate diagram editor cleanup
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 2007-07-05 12:22:17 UTC (rev 2318)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/META-INF/MANIFEST.MF 2007-07-05 12:22:44 UTC (rev 2319)
@@ -4,11 +4,11 @@
Bundle-SymbolicName: org.jboss.tools.hibernate.ui.view;singleton:=true
Bundle-Version: 2.0.0
Bundle-ClassPath: view.jar
-Bundle-Activator: org.jboss.tools.hibernate.view.ViewPlugin
+Bundle-Activator: org.jboss.tools.hibernate.ui.view.ViewPlugin
Bundle-Vendor: RedHat
Bundle-Localization: plugin
-Export-Package: org.jboss.tools.hibernate.view,
- org.jboss.tools.hibernate.view.views
+Export-Package: org.jboss.tools.hibernate.ui.view,
+ org.jboss.tools.hibernate.ui.view.views
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources,
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/plugin.properties
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/plugin.properties 2007-07-05 12:22:17 UTC (rev 2318)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/plugin.properties 2007-07-05 12:22:44 UTC (rev 2319)
@@ -2,11 +2,11 @@
actionSets_license.description=ORM Studio License
actionSets.license.label=&ORM Studio License
-org.jboss.tools.hibernate.view.ormmenu=ORM Studio
+org.jboss.tools.hibernate.ui.view.ormmenu=ORM Studio
popupMenus.action.addOrmNature=Add Hibernate Capabilities...
popupMenus.action.removeOrmNature=Remove Hibernate Capabilities...
-org.jboss.tools.hibernate.view.actionSet.label=ORM Explorer
-org.jboss.tools.hibernate.view.actions.ViewAction.label=ORM Explorer
-org.jboss.tools.hibernate.view.actions.ViewAction.tooltip=Show ORM Explorer
+org.jboss.tools.hibernate.ui.view.actionSet.label=ORM Explorer
+org.jboss.tools.hibernate.ui.view.actions.ViewAction.label=ORM Explorer
+org.jboss.tools.hibernate.ui.view.actions.ViewAction.tooltip=Show ORM Explorer
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/plugin.xml
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/plugin.xml 2007-07-05 12:22:17 UTC (rev 2318)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/plugin.xml 2007-07-05 12:22:44 UTC (rev 2319)
@@ -38,12 +38,12 @@
<filter name="nature" value="org.eclipse.jdt.core.javanature"/>
</objectContribution>
<objectContribution id="diagramEditorAction" objectClass="org.hibernate.mapping.RootClass">
- <menu id="org.jboss.tools.hibernate.view.openDiagram" label="Open Mapping Diagram" path="diagramEditorAction"/>
+ <menu id="org.jboss.tools.hibernate.ui.view.openDiagram" label="Open Mapping Diagram" path="diagramEditorAction"/>
<action
id="com.xyz.runXYZ"
label="Open Mapping Diagram"
icon="icons/runXYZ.gif"
- class="org.jboss.tools.hibernate.view.views.OpenDiagramActionDelegate">
+ class="org.jboss.tools.hibernate.ui.view.views.OpenDiagramActionDelegate">
</action>
</objectContribution>
</extension>
@@ -59,4 +59,4 @@
<page category="org.jboss.tools.common.model.ui" class="org.jboss.tools.hibernate.preference.OrmPreferencesPage" id="org.jboss.tools.hibernate.view.ormpref" name="ORM"/>
</extension>
-</plugin>
\ No newline at end of file
+</plugin>
17 years, 6 months
JBoss Tools SVN: r2316 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-07-05 08:17:24 -0400 (Thu, 05 Jul 2007)
New Revision: 2316
Removed:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/ViewPlugin.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/image.properties
Log:
JBIDE-559: Hibernate diagram editor cleanup
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/ViewPlugin.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/ViewPlugin.java 2007-07-05 12:15:59 UTC (rev 2315)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/ViewPlugin.java 2007-07-05 12:17:24 UTC (rev 2316)
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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
- *
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.ui.view;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.MissingResourceException;
-import java.util.Properties;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class ViewPlugin extends AbstractUIPlugin {
- //The shared instance.
- private static ViewPlugin plugin;
- //Resource bundle.
- private ResourceBundle resourceBundle;
-
- public static final ResourceBundle BUNDLE_IMAGE = ResourceBundle.getBundle(ViewPlugin.class.getPackage().getName() + ".image");
-
- // add Tau 28.04.2005 for trace
- public static boolean TRACE = false;
- public static boolean TRACE_VIEW = false;
- public static boolean TRACE_WIZARD = false;
-
- public static final String PLUGIN_ID = "org.jboss.tools.hibernate.view";
- public static final String autoMappingSettingPrefPage = "autoMappingSettingPrefPage";
-
- /**
- * The constructor.
- */
- public ViewPlugin() {
- super();
- plugin = this;
-
- try {
- resourceBundle = ResourceBundle.getBundle(PLUGIN_ID + ".EditPluginResources");
- } catch (MissingResourceException x) {
- resourceBundle = null;
- }
-
-// if (TRACE || TRACE_VIEW )
-// ExceptionHandler.logObjectPlugin("ViewPlugin()",PLUGIN_ID, null);
-
- }
-
- public static ImageDescriptor getImageDescriptor(String name) {
- String iconPath = "images/";
- try {
- URL installURL = getDefault().getBundle().getEntry("/");;
- URL url = new URL(installURL, iconPath + name);
- return ImageDescriptor.createFromURL(url);
- } catch (MalformedURLException e) {
- // should not happen
- return ImageDescriptor.getMissingImageDescriptor();
- }
- }
-
- /**
- * This method is called upon plug-in activation
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-
- /**
- * This method is called when the plug-in is stopped
- */
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- }
-
- /**
- * Returns the shared instance.
- */
- public static ViewPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns the string from the plugin's resource bundle,
- * or 'key' if not found.
- */
- public static String getResourceString(String key) {
- ResourceBundle bundle = ViewPlugin.getDefault().getResourceBundle();
- try {
- return (bundle != null) ? bundle.getString(key) : key;
- } catch (MissingResourceException e) {
- return key;
- }
- }
-
- /**
- * Returns the plugin's resource bundle,
- */
- public ResourceBundle getResourceBundle() {
- return resourceBundle;
- }
-
- // add tau 05.04.2005
- public static Shell getActiveWorkbenchShell() {
- IWorkbenchWindow window = getActiveWorkbenchWindow();
- if (window != null) {
- return window.getShell();
- }
- return null;
- }
-
- // add tau 05.04.2005
- public static IWorkbenchWindow getActiveWorkbenchWindow() {
- return getDefault().getWorkbench().getActiveWorkbenchWindow();
- }
-
- // add tau 19.04.2005
- public static IWorkbenchPage getPage(){
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
- return window.getActivePage();
- }
-
- // add Tau 28.04.2005 for trace
- static {
-
- String value = Platform.getDebugOption(PLUGIN_ID + "/debug");
- if (value != null && value.equalsIgnoreCase("true")) TRACE = true;
-
- value = Platform.getDebugOption(PLUGIN_ID + "/debug/view");
- if (value != null && value.equalsIgnoreCase("true")) TRACE_VIEW = true;
-
- value = Platform.getDebugOption(PLUGIN_ID + "/debug/view/wizard");
- if (value != null && value.equalsIgnoreCase("true")) TRACE_WIZARD = true;
-
- }
-
- // add tau 22.12.2005
- public static void loadPreferenceStoreProperties(Properties properties, String key){
- IPreferenceStore preferenceStore = ViewPlugin.getDefault().getPreferenceStore();
- String value = preferenceStore.getString(key);
- if (value.length() != 0){
- ByteArrayInputStream bain = new ByteArrayInputStream(value.getBytes());
- try {
- properties.load(bain);
- } catch (IOException e) {
-// ExceptionHandler.logThrowableError(e, null);
- }
- }
- }
-
-}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/image.properties
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/image.properties 2007-07-05 12:15:59 UTC (rev 2315)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/image.properties 2007-07-05 12:17:24 UTC (rev 2316)
@@ -1,96 +0,0 @@
-#OrmModelImageVisitor
-OrmModelImageVisitor.OrmModel=exdOrmModel.gif
-OrmModelImageVisitor.DatabaseSchema=exdDatabaseSchema.gif
-OrmModelImageVisitor.DatabaseTable=exdDatabaseTable.gif
-OrmModelImageVisitor.DatabaseView=exdDatabaseView.gif
-OrmModelImageVisitor.DatabaseConstraint=exdDatabaseConstraint1.gif
-OrmModelImageVisitor.Package=exdPackage.gif
-OrmModelImageVisitor.Mapping=exdMapping.gif
-OrmModelImageVisitor.MappingStorage=exdMappingStorage.gif
-OrmModelImageVisitor.PersistentClass=exdPersistentClass.gif
-OrmModelImageVisitor.PersistentField=exdPersistentField.gif
-
-OrmModelImageVisitor.PersistentClassMapping=exdPersistentClassMapping.gif
-#OrmModelImageVisitor.PersistentRootClassMapping=exdPersistentRootClassMapping.gif
-OrmModelImageVisitor.PersistentRootClassMapping=exdPersistentRootClassMappingC.gif
-OrmModelImageVisitor.PersistentSubclassMapping=exdPersistentSubclassMapping.gif
-OrmModelImageVisitor.PersistentUnionSubclassMapping=exdPersistentUnionSubclassMapping.gif
-OrmModelImageVisitor.PersistentJoinedSubclassMapping=exdPersistentJoinedSubclassMapping.gif
-
-
-OrmModelImageVisitor.PersistentFieldMapping=exdPersistentFieldMapping1.gif
-OrmModelImageVisitor.PersistentValueMapping=exdPersistentValueMapping1.gif
-
-##OrmModelImageVisitor for PersistentField
-OrmModelImageVisitor.PersistentFieldAny=any.gif
-OrmModelImageVisitor.PersistentFieldComponent=component.gif
-OrmModelImageVisitor.PersistentFieldComponent_id=component_id.gif
-OrmModelImageVisitor.PersistentFieldMany-to-any=many-to-any.gif
-OrmModelImageVisitor.PersistentFieldMany-to-many=many-to-many.gif
-OrmModelImageVisitor.PersistentFieldMany-to-one=many-to-one.gif
-OrmModelImageVisitor.PersistentFieldMany-to-one_id=many-to-one_id.gif
-OrmModelImageVisitor.PersistentFieldOne-to-many=one-to-many.gif
-OrmModelImageVisitor.PersistentFieldOne-to-one=one-to-one.gif
-OrmModelImageVisitor.PersistentFieldOne-to-one_id=one-to-one_id.gif
-OrmModelImageVisitor.PersistentFieldSimple=simple.gif
-OrmModelImageVisitor.PersistentFieldSimple_id=simple_id.gif
-OrmModelImageVisitor.PersistentFieldSimple_version=simple_version.gif
-OrmModelImageVisitor.PersistentFieldNot_mapped=not_mapped.gif
-OrmModelImageVisitor.PersistentFieldParent=parent.gif
-
-##OrmModelImageVisitor for Collection
-OrmModelImageVisitor.PersistentFieldCollection=collection.gif
-OrmModelImageVisitor.Collection_array=collection_array.gif
-OrmModelImageVisitor.Collection_primitive_array=collection_primitive_array.gif
-OrmModelImageVisitor.Collection_set=collection_set.gif
-OrmModelImageVisitor.Collection_bag=collection_bag.gif
-OrmModelImageVisitor.Collection_idbag=collection_idbag.gif
-OrmModelImageVisitor.Collection_list=collection_list.gif
-OrmModelImageVisitor.Collection_map=collection_map.gif
-OrmModelImageVisitor.NamedQueryMapping=hql.gif
-
-
-##OrmModelImageVisitor for IDatabaseColumn
-OrmModelImageVisitor.DatabaseColumn=exdDatabaseColumn.gif
-OrmModelImageVisitor.DatabasePrimaryKeyColumn=exdDatabasePrimaryKeyColumn.gif
-OrmModelImageVisitor.DatabaseForeignKeyColumn=exdDatabaseForeignKeyColumn.gif
-OrmModelImageVisitor.DatabaseDiscriminatorColumn=exdDatabaseDiscriminatorColumn.gif
-OrmModelImageVisitor.DatabaseVersionColumn=exdDatabaseVersionColumn.gif
-OrmModelImageVisitor.DatabasePrimaryForeignKeysColumn=exdDatabasePrimaryForeignKeysColumn.gif
-OrmModelImageVisitor.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
17 years, 6 months
JBoss Tools SVN: r2315 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-07-05 08:15:59 -0400 (Thu, 05 Jul 2007)
New Revision: 2315
Removed:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ActionOrmTree.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ContentProviderVisitor.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ObjectEditorInput.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OpenDiagramActionDelegate.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmContentProvider.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmLabelProvider.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmModelImageVisitor.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmModelNameVisitor.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ViewsAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/views.properties
Log:
JBIDE-559: Hibernate diagram editor cleanup
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ActionOrmTree.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ActionOrmTree.java 2007-07-05 12:10:59 UTC (rev 2314)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ActionOrmTree.java 2007-07-05 12:15:59 UTC (rev 2315)
@@ -1,66 +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.action.Action;
-import org.eclipse.jface.viewers.TreeViewer;
-
-// tau 22.11.2005
-// edit tau 27.01.2006
-
-public abstract class ActionOrmTree extends Action {
-
- private TreeViewer viewer;
-
- public ActionOrmTree() {
- super();
- }
-
- public void run(TreeViewer viewer) {
- this.viewer = viewer;
- run();
- }
-
- public void run() {
- try {
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("!TRY ActionOrmTree.run() lock(=" + OrmCore.lock + ").acquire(), Depth=" + OrmCore.lock.getDepth());
-// ((OrmContentProvider)viewer.getContentProvider()).lockMenu = true; // add tau 06.12.2005
-// OrmCore.lock.acquire(); // add tau 05.12.2005
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("!RUN ActionOrmTree.run() lock(=" + OrmCore.lock + ").acquire(), Depth=" + OrmCore.lock.getDepth());
-//
-// OrmCore.getDefault().setLockResourceChangeListener(true);
-
- this.rush();
-
- } finally {
-// OrmCore.lock.release();
-// ((OrmContentProvider)viewer.getContentProvider()).lockMenu = false; // add tau 06.12.2005
-//
-// // add tau 27.01.2006
-// OrmCore.getDefault().setLockResourceChangeListener(false);
-
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("!Finally ActionOrmTree.run() lock(=" + OrmCore.lock + ").acquire(), Depth=" + OrmCore.lock.getDepth());
- }
-
- }
-
- protected abstract void rush();
-
- public TreeViewer getViewer() {
- return viewer;
- }
-
- public ActionOrmTree setViewer(TreeViewer viewer) {
- this.viewer = viewer;
- return this;
- }
-
-}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ContentProviderVisitor.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ContentProviderVisitor.java 2007-07-05 12:10:59 UTC (rev 2314)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ContentProviderVisitor.java 2007-07-05 12:15:59 UTC (rev 2315)
@@ -1,28 +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.ResourceBundle;
-
-import org.hibernate.mapping.Column;
-
-
-public class ContentProviderVisitor {
-
- private static final Object[] nullChildren = new Object[0];
-
- private ResourceBundle BUNDLE = ResourceBundle.getBundle(ContentProviderVisitor.class.getPackage().getName() + ".views");
-
- public Object visitDatabaseColumn(Column column, Object argument) {
- return null;
- }
-
-}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ObjectEditorInput.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ObjectEditorInput.java 2007-07-05 12:10:59 UTC (rev 2314)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ObjectEditorInput.java 2007-07-05 12:15:59 UTC (rev 2315)
@@ -1,71 +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.cfg.Configuration;
-
-
-public class ObjectEditorInput implements IEditorInput{
-
- protected Object fObject;
- protected Configuration configuration;
-
- public ObjectEditorInput(Object object) {
- fObject = object;
- }
-
- public ObjectEditorInput(Configuration 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 "";
- }
-
-
- public IPersistableElement getPersistable() {
- return null;
- }
-
-
- public String getToolTipText() {
- return "";
- }
-
-
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- public Configuration getConfiguration() {
- return configuration;
- }
-
-}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OpenDiagramActionDelegate.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OpenDiagramActionDelegate.java 2007-07-05 12:10:59 UTC (rev 2314)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OpenDiagramActionDelegate.java 2007-07-05 12:15:59 UTC (rev 2315)
@@ -1,51 +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 org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TreeSelection;
-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.cfg.Configuration;
-import org.jboss.tools.hibernate.ui.view.ViewPlugin;
-
-public class OpenDiagramActionDelegate implements IObjectActionDelegate {
-
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- }
-
- public void run(IAction action) {
- HashMap hashMap = new HashMap();
- ObjectPluginAction objectPluginAction = (ObjectPluginAction)action;
- Object rootClass = ((TreeSelection)objectPluginAction.getSelection()).getFirstElement();
- ObjectEditorInput input = (ObjectEditorInput)hashMap.get(rootClass);
- Configuration configuration = (Configuration)(((TreeSelection)objectPluginAction.getSelection()).getPaths()[0]).getSegment(1);
- if(input == null) {
- input = new ObjectEditorInput(configuration, rootClass);
- hashMap.put(rootClass, input);
- }
- try {
- IDE.openEditor(ViewPlugin.getPage(),input ,"org.jboss.tools.hibernate.ui.veditor.editors.visualeditor");
- } catch (PartInitException e) {
-// ExceptionHandler.logThrowableError(e,"OpenEditor");
- }
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
-}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmContentProvider.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmContentProvider.java 2007-07-05 12:10:59 UTC (rev 2314)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmContentProvider.java 2007-07-05 12:15:59 UTC (rev 2315)
@@ -1,460 +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.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.TreeItem;
-
-
-public class OrmContentProvider implements ITreeContentProvider/*, IOrmModelListener, IOrmProjectChangedListener*/ {
-
- protected static final int PACKAGE_CLASS_FIELD_CONTENT_PROVIDER = 1;
- protected static final int CLASS_FIELD_CONTENT_PROVIDER = 2;
- protected static final int STORAGE_CLASS_FIELD_CONTENT_PROVIDER = 3;
-
- protected static final int SCHEMA_TABLE_COLUMN_CONTENT_PROVIDER = 4;
- protected static final int TABLE_COLUMN_CONTENT_PROVIDER = 5;
-
- protected TreeViewer viewer;
-
- private static final ContentProviderVisitor contentProviderVisitor = new ContentProviderVisitor();
- private static final Object[] nullChildren = new Object[0];
- private static Object[] children = new Object[0];
- private int tip;
- private boolean sorting;
-
- private Object[] expandedElements = null;
- private ISelection selectionElements = null;
-
- private String[] beforeChangeElements = null;
- private String beforeChangeSelectionElementQualifiedName = null;
-
- public boolean lockMenu = false;
-
-
- public OrmContentProvider(int tip){
- this.tip = tip;
- sorting = true; // default - sort
- }
-
- public Object[] getChildren(Object parentElement) {
- if (children == null)
- children = nullChildren;
-
- if (!sorting){
- sorting = true; // default - sort
- } else {
-// Arrays.sort(children, comparator);
- }
- return children;
- }
-
- public Object getParent(Object element) {
-
- //if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("!!! OrmContentProvider.getParent(Object element):" + element + ", tip="+tip);
-
- return null;
- }
-
- public boolean hasChildren(Object element) {
- //TODO EXP 3d
- //return getChildren(element).length > 0;
-// if (element instanceof IDatabaseColumn ||
-// element instanceof IDatabaseConstraint ||
-// element instanceof INamedQueryMapping ||
-// element instanceof String) {
-// return false;
-// } else
- return true;
- }
-
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- public void dispose() {
-
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("OrmContentProvider.inputChanged():"+", tip="+tip+", this= " + this);
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("OrmContentProvider.inputChanged(): OLD_INPUT= " + oldInput + ", tip="+tip);
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("OrmContentProvider.inputChanged(): NEW_INPUT= " + newInput + ", tip="+tip);
-//
-// this.viewer = (TreeViewer) viewer;
-//
-// if (oldInput != null) {
-// removeListenerFrom((IOrmModel) oldInput);
-// }
-//
-// if (newInput != null) {
-// addListenerTo((IOrmModel) newInput);
-// }
- }
-
-// protected void removeListenerFrom(IOrmModel model) {
-// model.removeListener(this);
-// IOrmProject[] projects = model.getOrmProjects();
-// for (int i = 0; i < projects.length; i++) {
-// IOrmProject project = projects[i];
-// project.removeChangedListener(this);
-// // add tau 12.09.2005
-// //project.removeBeforeChangeListener(this);
-// }
-// }
-
-// protected void addListenerTo(IOrmModel model) {
-// model.addListener(this);
-// IOrmProject[] projects = model.getOrmProjects();
-// for (int i = 0; i < projects.length; i++) {
-// IOrmProject project = projects[i];
-// project.addChangedListener(this);
-// // add tau 12.09.2005
-// //project.addBeforeChangeListener(this);
-// }
-// }
-
- /*
- * (non-Javadoc)
- *
- * @see org.jboss.tools.hibernate.core.IOrmModelListener#projectsChanged(org.jboss.tools.hibernate.core.OrmModelEvent)
- */
-// public void modelChanged(OrmModelEvent event) {
-//
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW )
-// ExceptionHandler.logInfo("OrmContentProvider.modelChanged(OrmModelEvent)" + ",tip="+tip);
-//
-// // Add tau 21.06.2005
-// int type = event.getType();
-// if (type == OrmModelEvent.AddProject){
-// ((IOrmProject) event.getProject()).addChangedListener(this);
-// // add tau 28.11.2005
-// //((IOrmProject) event.getProject()).addBeforeChangeListener(this);
-// }
-//
-//
-// // Update tau 18.05.2005
-// final IOrmModel model = event.getOrmModel();
-// viewerRefreshUpdate(model, false);
-//
-// /*
-// Control control = viewer.getControl();
-// if (control == null || control.isDisposed())
-// return;
-//
-// control.getDisplay().syncExec(new Runnable() {
-// public void run() {
-// if (!viewer.getControl().isDisposed()){
-// viewer.getTree().setRedraw(false);
-// viewer.refresh(model, true);
-// viewer.getTree().setRedraw(true);
-// // add 04.04.2005
-// //viewer.getControl().setFocus();
-// }
-// }
-// });
-// */
-//
-// }
-
- /*
- * edit 05.12.2005
- *
- * @see org.jboss.tools.hibernate.core.IOrmProjectListener#modelChanged(org.jboss.tools.hibernate.core.OrmProjectEvent)
- */
-// public void projectChanged(OrmProjectEvent event, boolean flagUpdate) {
-//
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("OrmContentProvider.projectChanged((eventSource=," + event.getSource()+ "), tip="+tip);
-//
-// final IOrmProject project = event.getProject();
-//
-// viewerRefreshUpdate(project, flagUpdate);
-//
-// /* del tau 05.2005
-// //!!! event from OrmBuilder == IOrmProject - edit tau 05.12.2005
-// if (event.getSource() instanceof IOrmProject || !(isBuilder(project.getProject()))){
-// viewerRefresh(project);
-// }
-// */
-// }
-
- /*
- public void projectBeforeChange(OrmProjectEvent event) {
-
- Control control = viewer.getControl();
- if (control == null || control.isDisposed()) {
- if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("->NO REFRESH, control="+ control + ",tip="+tip);
- return;
- }
-
- // add tau 17.11.2005
- if (beforeChangeElements != null){
- if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("->projectBeforeChange("+event.getSource()+")beforeChangeElements != null"+",tip="+tip);
- return;
- }
-
- // TODO (!tau->tau) asyncExec???
- //control.getDisplay().asyncExec(new Runnable() {
- control.getDisplay().syncExec(new Runnable() {
- public void run() {
- // edit tau 24.11.2005 +OrmCore.lock.acquire();
- try {
- if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("-> TRY projectBeforeChange(...) lock(=" + OrmCore.lock + ").acquire(), Depth=" + OrmCore.lock.getDepth() + ", tip="+tip);
- OrmCore.lock.acquire();
- lockMenu = true; // add tau 05.12.2005
- if (!viewer.getControl().isDisposed()) {
- beforeChangeElements = saveElements();
- beforeChangeSelectionElementQualifiedName = saveSelection();
- }
- } finally {
- OrmCore.lock.release();
- lockMenu = false; // add tau 05.12.2005
- if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("-> END projectBeforeChange(...)=lock(=" + OrmCore.lock.toString() + ").release(), Depth=" + OrmCore.lock.getDepth() + ", tip="+tip);
- }
- }
- });
- }
- */
-
-
- public int getTip() {
- return tip;
- }
-
- public void setSorting(boolean sorting) {
- this.sorting = sorting;
- }
-
- /*
- public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
- }
- */
-
- public Object[] getExpandedElements() {
- return expandedElements;
- }
-
- public void setExpandedElements(Object[] expandedElements) {
- this.expandedElements = expandedElements;
- }
-
- public ISelection getSelectionElements() {
- return selectionElements;
- }
-
- public void setSelectionElements(ISelection selectionElements) {
- this.selectionElements = selectionElements;
- }
-
- public void viewerRefreshUpdate(final Object element, final boolean flagUpdate) {
-
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("OrmContentProvider.viewerRefresh(...)1= " + element + " ,flagUpdate = "+ flagUpdate);
-
- Control control = viewer.getControl();
-
- if (control == null || control.isDisposed()) {
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("-> NO REFRESH, control="+ control + ",tip="+tip);
- return;
- }
-
- Display display = control.getDisplay();
-
- /*
- Thread tc = display.getSyncThread();
- boolean dd = display.isDisposed();
- boolean dd2 = display.isDisposed();
- Thread tt = display.getThread();
-
- // add tau 24.01.2006
- display.wake();
-
- if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("OrmContentProvider.viewerRefresh(...)4= " + tc + tt + dd + dd2);
- */
-
- // edit tau 30.01.2006
- //display.syncExec(new Runnable() {
- display.asyncExec(new Runnable() {
-
- public void run() {
- // add try and OrmCore.lock.acquire(); - tau 01.12.2005
- try {
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("-> TRY REFRESH lock(=" + OrmCore.lock + ").acquire(), Depth=" + OrmCore.lock.getDepth() + ", viewerRefresh("+element+"),tip="+tip);
-// OrmCore.lock.acquire();
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("-> RUN REFRESH, viewerRefresh("+element+"), isDisposed()="+ viewer.getControl().isDisposed() + ",tip="+tip);
-
- if (!viewer.getControl().isDisposed()) {
-
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("-> REFRESHing, viewerRefresh("+element+"),tip="+tip);
-
- viewer.getTree().setRedraw(false);
-
- // add tau 02.12.2005 SAVE
- if (beforeChangeElements == null){
- beforeChangeElements = saveElements();
- beforeChangeSelectionElementQualifiedName = saveSelection();
- }
-
- if (flagUpdate) {
- // Update
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("viewerRefresh("+element+") -> viewer.update(element, null), tip = "+tip);
- viewer.update(element, null);
- } else {
- // REFRESH
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("viewerRefresh("+element+") -> viewer.refresh(element, true), tip = "+tip);
- viewer.refresh(element, true);
- }
-
- // LOAD
- if (beforeChangeElements != null){
- restoreElements(beforeChangeElements, beforeChangeSelectionElementQualifiedName);
- beforeChangeElements = null;
- }
-
- viewer.getTree().setRedraw(true);
- }
- } finally {
-// OrmCore.lock.release();
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("-> END REFRESH=lock(=" + OrmCore.lock.toString() + ").release(), Depth=" + OrmCore.lock.getDepth() + ", viewerRefresh("+element+"),tip="+tip);
- }
- }
- });
- }
-
-
- // tau 08.11.2005
- private String[] saveElements() {
- // add tau 15.11.2005
- String [] expandedElements = null;
- int length = viewer.getExpandedElements().length;
- if (length != 0) {
- expandedElements = new String [length];
- }
- //
-
- int j = 0;
- TreeItem[] items = viewer.getTree().getItems();
- for (int i = 0; i < items.length; i++) {
- TreeItem item = items[i];
- j = saveItem(item, expandedElements, j);
- }
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW) ExceptionHandler.logInfo(".saveElements()= " + length + ",tip="+tip);
- return expandedElements;
- }
-
- // tau 08.11.2005
- private int saveItem(TreeItem treeItem, String [] expandedElements, int j) {
-// if (treeItem.getExpanded()) {
-// if (treeItem.getData() instanceof IOrmElement ){
-// expandedElements[j++] = ((IOrmElement)treeItem.getData()).getQualifiedName(treeItem);
-// TreeItem[] items = treeItem.getItems();
-// for (int i = 0; i < items.length; i++) {
-// j = saveItem(items[i], expandedElements, j);
-// }
-// } else {
-// return j;
-// }
-//
-// }
- return j;
- }
-
- private String saveSelection() {
- String selectionElementQualifiedName = ""; // default
- ISelection selection = viewer.getSelection();
- if (!selection.isEmpty()) {
- TreeItem[] selectionTreeItems = viewer.getTree().getSelection();
- if (selectionTreeItems.length != 0) {
- TreeItem selectionItem = selectionTreeItems[0];
- if (selection instanceof StructuredSelection) {
- // edit tau 05.04.2006 for /ESORM-562
- //IOrmElement selectionElement = (IOrmElement) ((StructuredSelection) selection).getFirstElement();
- Object selectionElement = ((StructuredSelection) selection).getFirstElement();
-// if (selectionElement instanceof IOrmElement) {
-// IOrmElement selectionOrmElement = (IOrmElement) selectionElement;
-// selectionElementQualifiedName = selectionOrmElement.getQualifiedName(selectionItem);
-// }
- }
- }
- }
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW) ExceptionHandler.logInfo(".saveSelection()= " + selectionElementQualifiedName + ",tip="+tip);
- return selectionElementQualifiedName;
- }
-
- private void restoreElements(String[] expandedElements, String selectionElementQualifiedName) {
- //viewer.getTree().setRedraw(false);
- checkItem(viewer.getTree().getItems(), expandedElements, selectionElementQualifiedName);
- //viewer.getTree().setRedraw(true);
- //if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW) ExceptionHandler.logInfo(".restoreElements()=" + expandedElements.length + ", tip="+tip);
- }
-
- // #changed# by Konstantin Mishin on 03.09.2005 fixed for ORMIISTUD-699
- private void checkItem(TreeItem[] items, String[] expandedElements, String selectionElementQualifiedName) {
- for (int j = 0; j < items.length; j++) {
- TreeItem item = items[j];
-
- // add tau 07.03.2006
-// if (!(item.getData() instanceof IOrmElement)){
-// continue;
-// }
-
-// IOrmElement itemElement = (IOrmElement) item.getData();
-// String itemElementQualifiedName = itemElement.getQualifiedName(item);
-// if (itemElementQualifiedName.equals("")) continue;
-//
-// if (selectionElementQualifiedName != null && selectionElementQualifiedName.equals(itemElementQualifiedName)) {
-// viewer.setSelection(new StructuredSelection(itemElement), true);
-// // add tau 28.11.2005
-// viewer.reveal(itemElement);
-// }
-//
-// for (int i = 0; i < expandedElements.length; i++) {
-// if (itemElementQualifiedName.equals(expandedElements[i])) {
-// viewer.setExpandedState(itemElement, true);
-// TreeItem[] childrenItems = item.getItems();
-// checkItem(childrenItems, expandedElements, selectionElementQualifiedName);
-// }
-// }
- }
- }
-
- private boolean isBuilder(IProject project){
- boolean flag = false;
- if (project.getWorkspace().isAutoBuilding()) {
- IProjectDescription description;
-// try {
-// description = project.getProject().getDescription();
-// ICommand[] builderCommands = description.getBuildSpec();
-// flag = false;
-// for (int i = 0; i < builderCommands.length; i++){
-// if (builderCommands[i].getBuilderName().equals(OrmHibernateNature.ORM_HIBERNATE_BUILDER_ID)) {
-// flag = true;
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("OrmContentProvider.isBuilder(...), tip="+tip + ",flagRefresh->"+flag);
-// break;
-// }
-// }
-// } catch (CoreException e) {
-// ExceptionHandler.logThrowableError(e, "projectChanged");
-// }
- }
- return flag;
- }
-
-}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmLabelProvider.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmLabelProvider.java 2007-07-05 12:10:59 UTC (rev 2314)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmLabelProvider.java 2007-07-05 12:15:59 UTC (rev 2315)
@@ -1,176 +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.Iterator;
-import java.util.Map;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-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.mapping.Column;
-import org.hibernate.mapping.Component;
-import org.hibernate.mapping.DependantValue;
-import org.hibernate.mapping.ManyToOne;
-import org.hibernate.mapping.OneToMany;
-import org.hibernate.mapping.Property;
-import org.hibernate.mapping.RootClass;
-import org.hibernate.mapping.SimpleValue;
-import org.hibernate.mapping.SingleTableSubclass;
-import org.hibernate.mapping.Table;
-
-public class OrmLabelProvider extends LabelProvider implements IColorProvider, IFontProvider {
-
- private Map imageCache = new HashMap(25);
- private OrmModelImageVisitor ormModelImageVisitor;
- private OrmModelNameVisitor ormModelNameVisitor;
-
- public OrmLabelProvider(OrmModelImageVisitor imageVisitor, OrmModelNameVisitor nameVisitor) {
- super();
- ormModelImageVisitor = imageVisitor;
- ormModelNameVisitor = nameVisitor;
- }
-
- public Image getImage(Object element) {
- ImageDescriptor descriptor = null;
-
- if (element instanceof RootClass) {
- descriptor = (ImageDescriptor) ((RootClass) element).accept(ormModelImageVisitor);
- } else if (element instanceof Property) {
- descriptor = (ImageDescriptor)ormModelImageVisitor.visitPersistentField((Property) element, null);
- } else if (element instanceof Table) {
- descriptor = (ImageDescriptor)ormModelImageVisitor.visitDatabaseTable((Table) element);
- } else if (element instanceof Column) {
- descriptor = (ImageDescriptor)ormModelImageVisitor.visitDatabaseColumn((Column) element);
- } else if (element instanceof DependantValue) {
- descriptor = (ImageDescriptor)ormModelImageVisitor.visitComponentKeyMapping((DependantValue) element, null);
- } else if (element instanceof Component) {
- descriptor = (ImageDescriptor)ormModelImageVisitor.visitComponentMapping((Component) element);
- } else {
- //throw unknownElement(element);
- return null;
- }
-
- Image image = (Image) imageCache.get(descriptor);
- if (image == null) {
- image = descriptor.createImage();
- imageCache.put(descriptor, image);
- }
- return image;
- }
-
- public String getText(Object element) {
- if (element instanceof RootClass) {
- String name = (String)ormModelNameVisitor.visitPersistentClass((RootClass)element, null);
- if (name == null) {
- return "OrmElement";
- } else {
- return name;
- }
- } else if (element instanceof SingleTableSubclass) {
- String name = (String)ormModelNameVisitor.visitPersistentClass((SingleTableSubclass)element, null);
- if (name == null) {
- return "OrmElement";
- } else {
- return name;
- }
- } else if (element instanceof Property) {
- String name = (String)ormModelNameVisitor.visitPersistentField((Property)element, null);
- if (name == null) {
- return "OrmElement";
- } else {
- return name;
- }
- } else if (element instanceof Column) {
- String name = (String)ormModelNameVisitor.visitDatabaseColumn((Column)element, null);
- if (name == null) {
- return "OrmElement";
- } else {
- return name;
- }
- } else if (element instanceof OneToMany || element instanceof ManyToOne) {
- String name = "element";
- if (name == null) {
- return "OrmElement";
- } else {
- return name;
- }
- } else if (element instanceof SimpleValue) {
- if (element instanceof DependantValue) {
- String name = (String)ormModelNameVisitor.visitCollectionKeyMapping((DependantValue)element, null);
- if (name == null) {
- return "OrmElement";
- } else {
- return name;
- }
- } else if (element instanceof Component) {
- String name = (String)ormModelNameVisitor.visitComponentMapping((Component)element, null);
- if (name == null) {
- return "OrmElement";
- } else {
- return name;
- }
- } else {
- return "element";
-// throw unknownElement(element);
- }
- } else if (element instanceof String){
- return (String) element;
- } else {
- throw unknownElement(element);
- }
-
- }
-
- protected RuntimeException unknownElement(Object element) {
- if (element != null && element.getClass() != null )
- return new RuntimeException("Unknown type of element in tree of type: " + element.getClass().getName());
- else return new RuntimeException("Unknown type of element in tree of type: " + element);
-
- }
-
- public void dispose() {
- for (Iterator i = imageCache.values().iterator(); i.hasNext();) {
- ((Image) 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) {
-/* if (element instanceof IOrmProject) {
- return JFaceResources.getFontRegistry().getBold(JFaceResources.getTextFont().getFontData()[0].getName());
- }*/
- return null;
- }
-
-}
\ No newline at end of file
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmModelImageVisitor.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmModelImageVisitor.java 2007-07-05 12:10:59 UTC (rev 2314)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmModelImageVisitor.java 2007-07-05 12:15:59 UTC (rev 2315)
@@ -1,100 +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.ResourceBundle;
-
-import org.hibernate.mapping.Column;
-import org.hibernate.mapping.Component;
-import org.hibernate.mapping.DependantValue;
-import org.hibernate.mapping.JoinedSubclass;
-import org.hibernate.mapping.PersistentClassVisitor;
-import org.hibernate.mapping.Property;
-import org.hibernate.mapping.RootClass;
-import org.hibernate.mapping.SingleTableSubclass;
-import org.hibernate.mapping.Subclass;
-import org.hibernate.mapping.Table;
-import org.hibernate.mapping.UnionSubclass;
-import org.jboss.tools.hibernate.ui.view.ViewPlugin;
-
-
-
-/**
- * @author Tau
- *
- */
-public class OrmModelImageVisitor implements /*IOrmModelVisitor, IHibernateMappingVisitor,*/ PersistentClassVisitor {
-
- private ResourceBundle BUNDLE = ViewPlugin.BUNDLE_IMAGE;
-
- private static Integer ID = new Integer(1);
- private static Integer VER = new Integer(2);
-
-
- public Object visitDatabaseTable(Table table) {
- return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabaseTable")); //$NON-NLS-1$
- }
-
- public Object visitDatabaseColumn(Column column) {
- if(column.isUnique()) {
- return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabaseUniqueKeyColumn"));
- } else return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabaseColumn")); //$NON-NLS-1$
-
- }
-
- public Object visitPersistentField(Property field, Object argument) {
- if (field !=null){
- if (field.getType().isCollectionType()) {
- return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldCollection")); //$NON-NLS-1$
- }
- }
- return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldNot_mapped")); //$NON-NLS-1$
- }
-
- public Object visitComponentMapping(Component mapping) {
- if (mapping != null){
- return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldComponent")); //$NON-NLS-1$
- }
- return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldNot_mapped")); //$NON-NLS-1$
- }
-
- public Object visitComponentKeyMapping(DependantValue mapping, Object argument) {
- if (argument == ID){
- return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldComponent_id")); //$NON-NLS-1$
- }
- return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldNot_mapped")); //$NON-NLS-1$
- }
-
- public Object visitDatabaseColumn(Column column, Object argument) {
- return null;
- }
-
- public Object accept(RootClass arg0) {
- return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentClass")); //$NON-NLS-1$
- }
-
- public Object accept(UnionSubclass arg0) {
- return null;
- }
-
- public Object accept(SingleTableSubclass arg0) {
- return null;
- }
-
- public Object accept(JoinedSubclass arg0) {
- return null;
- }
-
- public Object accept(Subclass arg0) {
- return null;
- }
-
-}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmModelNameVisitor.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmModelNameVisitor.java 2007-07-05 12:10:59 UTC (rev 2314)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmModelNameVisitor.java 2007-07-05 12:15:59 UTC (rev 2315)
@@ -1,707 +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.sql.Types;
-import java.util.ResourceBundle;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jface.viewers.ContentViewer;
-import org.hibernate.mapping.Column;
-import org.hibernate.mapping.Component;
-import org.hibernate.mapping.DependantValue;
-import org.hibernate.mapping.Property;
-import org.hibernate.mapping.RootClass;
-import org.hibernate.mapping.SingleTableSubclass;
-import org.hibernate.mapping.Table;
-
-/**
- * @author Tau from Minsk
- *
- */
-public class OrmModelNameVisitor /*implements IOrmModelVisitor*/ {
-
- private ContentViewer viewer;
-
- static private String SPACE = " ";
-
- static private String POINTER = " -> ";
-
- // add 16.03.2005 tau
- private ResourceBundle BUNDLE = ResourceBundle
- .getBundle(OrmModelNameVisitor.class.getPackage().getName()
- + ".views");
-
- public OrmModelNameVisitor(ContentViewer viewer) {
- super();
- this.viewer = viewer;
- }
-
- /**
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitOrmModel(org.jboss.tools.hibernate.core.IOrmProject, java.lang.Object)
- */
-// public Object visitOrmProject(IOrmProject schema, Object argument) {
-// return schema.getName();
-// }
-
- /**
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitDatabaseSchema(org.jboss.tools.hibernate.core.IDatabaseSchema, java.lang.Object)
- */
-// public Object visitDatabaseSchema(IDatabaseSchema schema, Object argument) {
-// if (schema.getName() == null || schema.getName().trim().length() == 0) {
-// return BUNDLE
-// .getString("OrmModelNameVisitor.DefaultDatabaseSchema");
-// } else {
-// return schema.getName();
-// }
-// }
-
- /**
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitDatabaseTable(org.jboss.tools.hibernate.core.IDatabaseTable, java.lang.Object)
- */
-// public Object visitDatabaseTable(IDatabaseTable table, Object argument) {
-// // Table name (Class1, Class2 ...)
-// // add tau 13.04.2005
-// // edit tau 28.04.2005 -> vs ()
-// StringBuffer name = new StringBuffer();
-// name.append(table.getName());
-//
-// IPersistentClassMapping[] classMappings = table
-// .getPersistentClassMappings();
-// if (classMappings.length != 0) {
-// name.append(POINTER);
-// for (int i = 0; i < classMappings.length; i++) {
-// IPersistentClass persistentClass = classMappings[i]
-// .getPersistentClass();
-// if (persistentClass != null) {
-// name.append(persistentClass.getName());
-// name.append(BUNDLE.getString("OrmModelNameVisitor.Comma"));
-// name.append(" ");
-// }
-// }
-// name.delete(name.length() - 2, name.length());
-// }
-// return name.toString();
-//
-// }
-
- /**
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitDatabaseColumn(org.jboss.tools.hibernate.core.IDatabaseColumn, java.lang.Object)
- */
-// public Object visitDatabaseColumn(IDatabaseColumn column, Object argument) {
-// // update tau 16.03.2005
-// StringBuffer name = new StringBuffer();
-// name.append(column.getName());
-// //by Nick 22.04.2005
-//
-// int length = -1;
-// int scale = -1;
-//
-// if (!column.isNativeType()) {
-// int typeCode = column.getSqlTypeCode();
-// String typeName = column.getSqlTypeName();
-//
-// if (typeName == null)
-// typeCode = Types.NULL;
-//
-// //by Nick
-//
-// // (tau->tau) Column types should be shown in the following manner:
-// /*
-//
-// Character types:
-// VARCHAR(length)
-// CHAR(length)
-//
-// Numeric types:
-// NUMBER(length, precision)
-// NUMERIC(length, precision)
-//
-// Other types:
-// BIT
-// INTEGER
-// BIGNINT
-// DATE
-// FLOAT
-// REAL
-// CLOB
-// BINARY
-// etc. */
-// //by Nick 22.04.2005
-// // TODO (tau->tau)
-// // testing for ORACLE
-// // edit tau 28.04.2005 -> vs ()
-// switch (typeCode) {
-// case Types.VARCHAR:
-// case Types.CHAR:
-// case Types.NUMERIC:
-// case Types.DECIMAL: //8.07.2005 by Nick DECIMAL JDBC type denotes Oracle NUMBER type
-// //changed by Nick 10.05.2005 - fixes "->" in SQL types
-// if (typeCode == Types.NUMERIC || typeCode == Types.DECIMAL) {
-// length = column.getPrecision();
-// scale = column.getScale();
-// } else {
-// length = column.getLength();
-// }
-//
-// default:
-// break;
-//
-// }
-// } else {
-// if (column.getLength() > Column.DEFAULT_LENGTH) {
-// length = column.getLength();
-// } else if (column.getPrecision() > Column.DEFAULT_PRECISION
-// || column.getScale() > Column.DEFAULT_SCALE) {
-// length = column.getPrecision() > Column.DEFAULT_PRECISION ? (column
-// .getPrecision())
-// : (column.getScale() > 0 ? column.getScale() : 1);
-// scale = column.getScale();
-// }
-// }
-//
-// StringBuffer typeName = new StringBuffer(column.getSqlTypeName());
-//
-// //by Nick
-//
-// // (tau->tau) Column types should be shown in the following manner:
-// /*
-//
-// Character types:
-// VARCHAR(length)
-// CHAR(length)
-//
-// Numeric types:
-// NUMBER(length, precision)
-// NUMERIC(length, precision)
-//
-// Other types:
-// BIT
-// INTEGER
-// BIGNINT
-// DATE
-// FLOAT
-// REAL
-// CLOB
-// BINARY
-// etc. */
-// //by Nick 22.04.2005
-// /*
-// switch (key) {
-// case value:
-//
-// break;
-//
-// default:
-// break;
-// }
-// */
-//
-// // TODO (tau->tau)
-// // testing for ORACLE
-//
-// StringBuffer lpBuffer = new StringBuffer();
-// //name.append(POINTER);
-//
-// if (length > Column.DEFAULT_LENGTH) {
-// lpBuffer.append(SPACE);
-// lpBuffer.append(BUNDLE
-// .getString("OrmModelNameVisitor.OpenBrackets"));
-// lpBuffer.append(length);
-// if (scale > Column.DEFAULT_SCALE) {
-// lpBuffer.append(BUNDLE.getString("OrmModelNameVisitor.Comma"));
-// lpBuffer.append(SPACE);
-// lpBuffer.append(scale);
-// }
-// lpBuffer.append(BUNDLE
-// .getString("OrmModelNameVisitor.CloseBrackets"));
-// }
-// //by Nick
-//
-// if (typeName.length() != 0) {
-// // edit tau 28.04.2005 -> vs ()
-// //8.07.2005 by Nick DECIMAL JDBC type denotes Oracle NUMBER type
-// //changed by Nick 10.05.2005 - fixes "->" in SQL types
-// name.append(BUNDLE.getString("OrmModelNameVisitor.Colon"));
-// name.append(SPACE);
-// typeName.append(lpBuffer);
-// }
-//
-// name.append(typeName);
-// // name.append(SPACE);
-//
-// // by Nick
-// return name.toString();
-//
-// }
-
- public Object visitDatabaseColumn(Column column, Object argument) {
- // update tau 16.03.2005
- StringBuffer name = new StringBuffer();
- name.append(column.getName());
- //by Nick 22.04.2005
-
- int length = -1;
- int scale = -1;
-
-// if (!column.isNativeType())
-// {
-// int typeCode = column.getSqlTypeCode();
-// String typeName = column.getSqlTypeName();
-//
-// if (typeName == null) typeCode = Types.NULL;
-//
-// //by Nick
-//
-// // (tau->tau) Column types should be shown in the following manner:
-// /*
-//
-// Character types:
-// VARCHAR(length)
-// CHAR(length)
-//
-// Numeric types:
-// NUMBER(length, precision)
-// NUMERIC(length, precision)
-//
-// Other types:
-// BIT
-// INTEGER
-// BIGNINT
-// DATE
-// FLOAT
-// REAL
-// CLOB
-// BINARY
-// etc. */
-// //by Nick 22.04.2005
-// /*
-// switch (key) {
-// case value:
-//
-// break;
-//
-// default:
-// break;
-// }
-// */
-//
-// // TODO (tau->tau)
-// // testing for ORACLE
-//
-// // edit tau 28.04.2005 -> vs ()
-//
-// switch (typeCode) {
-// case Types.VARCHAR:
-// case Types.CHAR:
-// case Types.NUMERIC:
-// case Types.DECIMAL: //8.07.2005 by Nick DECIMAL JDBC type denotes Oracle NUMBER type
-// //changed by Nick 10.05.2005 - fixes "->" in SQL types
-// if (typeCode == Types.NUMERIC || typeCode == Types.DECIMAL) {
-// length = column.getPrecision();
-// scale = column.getScale();
-// }
-// else
-// {
-// length = column.getLength();
-// }
-//
-// default:
-// break;
-//
-// }
-// }
-// else
-// {
-// if (column.getLength() > Column.DEFAULT_LENGTH)
-// {
-// length = column.getLength();
-// }
-// else if (column.getPrecision() > Column.DEFAULT_PRECISION || column.getScale() > Column.DEFAULT_SCALE)
-// {
-// length = column.getPrecision() > Column.DEFAULT_PRECISION ? (column.getPrecision()) : (column.getScale() > 0 ? column.getScale() : 1);
-// scale = column.getScale();
-// }
-// }
-
-// StringBuffer typeName = new StringBuffer(column.getSqlTypeName());
-//
-// //by Nick
-//
-// // (tau->tau) Column types should be shown in the following manner:
-// /*
-//
-// Character types:
-// VARCHAR(length)
-// CHAR(length)
-//
-// Numeric types:
-// NUMBER(length, precision)
-// NUMERIC(length, precision)
-//
-// Other types:
-// BIT
-// INTEGER
-// BIGNINT
-// DATE
-// FLOAT
-// REAL
-// CLOB
-// BINARY
-// etc. */
-// //by Nick 22.04.2005
-// /*
-// switch (key) {
-// case value:
-//
-// break;
-//
-// default:
-// break;
-// }
-// */
-//
-// // TODO (tau->tau)
-// // testing for ORACLE
-//
-//
-// StringBuffer lpBuffer = new StringBuffer();
-// //name.append(POINTER);
-//
-// if (length > Column.DEFAULT_LENGTH)
-// {
-// lpBuffer.append(SPACE);
-// lpBuffer.append(BUNDLE.getString("OrmModelNameVisitor.OpenBrackets"));
-// lpBuffer.append(length);
-// if (scale > Column.DEFAULT_SCALE)
-// {
-// lpBuffer.append(BUNDLE.getString("OrmModelNameVisitor.Comma"));
-// lpBuffer.append(SPACE);
-// lpBuffer.append(scale);
-// }
-// lpBuffer.append(BUNDLE.getString("OrmModelNameVisitor.CloseBrackets"));
-// }
-// //by Nick
-//
-// if (typeName.length() != 0)
-// {
-// // edit tau 28.04.2005 -> vs ()
-// //8.07.2005 by Nick DECIMAL JDBC type denotes Oracle NUMBER type
-// //changed by Nick 10.05.2005 - fixes "->" in SQL types
-// name.append(BUNDLE.getString("OrmModelNameVisitor.Colon"));
-// name.append(SPACE);
-// typeName.append(lpBuffer);
-// }
-//
-// name.append(typeName);
-//// name.append(SPACE);
-//
-// // by Nick
- return name.toString();
-
- }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitDatabaseConstraint(org.jboss.tools.hibernate.core.IDatabaseConstraint, java.lang.Object)
- */
-// public Object visitDatabaseConstraint(IDatabaseConstraint constraint,
-// Object argument) {
-// return constraint.getName();
-// }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitPackage(org.jboss.tools.hibernate.core.IPackage, java.lang.Object)
- */
-// public Object visitPackage(IPackage pakage, Object argument) {
-// if (pakage.getName() == null || pakage.getName().trim().length() == 0) {
-// return BUNDLE.getString("OrmModelNameVisitor.DefaultPackageName");
-// } else {
-// //return pakage.getName();
-// return pakage.getProjectQualifiedName();
-// }
-// }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitMapping(org.jboss.tools.hibernate.core.IMapping, java.lang.Object)
- */
-// public Object visitMapping(IMapping mapping, Object argument) {
-// return mapping.getName();
-// }
-
- /**
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitMappingStorage(org.jboss.tools.hibernate.core.IMappingStorage, java.lang.Object)
- */
-// public Object visitMappingStorage(IMappingStorage storage, Object argument) {
-// return storage.getName();
-// }
-
- /**
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitPersistentClass(org.jboss.tools.hibernate.core.IPersistentClass, java.lang.Object)
- */
-// public Object visitPersistentClass(IPersistentClass clazz, Object argument) {
-//
-// StringBuffer name = new StringBuffer();
-// if (((OrmContentProvider) viewer.getContentProvider()).getTip() == OrmContentProvider.PACKAGE_CLASS_FIELD_CONTENT_PROVIDER) {
-// name.append(clazz.getShortName());
-// } else {
-// name.append(clazz.getName());
-// }
-//
-// //edit tau 24.04.2006
-// IDatabaseTable table = clazz.getDatabaseTable(); // upd tau 06.06.2005
-// //IDatabaseTable table = HibernateAutoMappingHelper.getPrivateTable(classMapping); // upd tau 18.04.2005
-// if (table != null) {
-// String tableName = table.getName();
-// if (tableName != null) {
-// //name.append(" (");
-// name.append(POINTER);
-// name.append(tableName);
-// //name.append(")");
-// }
-// }
-//
-// return name.toString();
-// }
-
- public Object visitPersistentClass(RootClass clazz, Object argument) {
-
- StringBuffer name = new StringBuffer();
-// if (((OrmContentProvider) viewer.getContentProvider()).getTip() == OrmContentProvider.PACKAGE_CLASS_FIELD_CONTENT_PROVIDER) {
- name.append(clazz.getClassName());
-// } else {
-// name.append(clazz.getClassName());
-// }
-
- //edit tau 24.04.2006
- Table table = clazz.getTable(); // upd tau 06.06.2005
- //IDatabaseTable table = HibernateAutoMappingHelper.getPrivateTable(classMapping); // upd tau 18.04.2005
- if (table != null) {
- String tableName = table.getName();
- if (tableName != null) {
- //name.append(" (");
- name.append(POINTER);
- name.append(tableName);
- //name.append(")");
- }
- }
-
- return name.toString();
- }
-
- public Object visitPersistentClass(SingleTableSubclass clazz, Object argument) {
-
- StringBuffer name = new StringBuffer();
-// if (((OrmContentProvider) viewer.getContentProvider()).getTip() == OrmContentProvider.PACKAGE_CLASS_FIELD_CONTENT_PROVIDER) {
- name.append(clazz.getEntityName());
-// } else {
-// name.append(clazz.getClassName());
-// }
-
- //edit tau 24.04.2006
- Table table = clazz.getTable(); // upd tau 06.06.2005
- //IDatabaseTable table = HibernateAutoMappingHelper.getPrivateTable(classMapping); // upd tau 18.04.2005
- if (table != null) {
- String tableName = table.getName();
- if (tableName != null) {
- //name.append(" (");
- name.append(POINTER);
- name.append(tableName);
- //name.append(")");
- }
- }
-
- return name.toString();
- }
-
- /**
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitPersistentField(org.jboss.tools.hibernate.core.IPersistentField, java.lang.Object)
- */
-// public Object visitPersistentField(IPersistentField field, Object argument) {
-// StringBuffer name = new StringBuffer();
-// name.append(field.getName());
-// name.append(BUNDLE.getString("OrmModelNameVisitor.Colon"));
-// String typeString = field.getType();
-//
-// if (typeString != null) {
-// //added by Nick 31.03.2005
-// IPersistentValueMapping value = null;
-// if (field.getMapping() != null)
-// value = field.getMapping().getPersistentValueMapping();
-//
-// //added by Nick 18.04.2005 - to handle BLOB mappings
-// if (Signature.getArrayCount(typeString) != 0) {
-// // changed by Nick 20.10.2005
-// int depth = Signature.getArrayCount(typeString);
-// typeString = Signature.getElementType(typeString);
-// for (int i = 0; i < depth; i++) {
-// typeString += "[]";
-// }
-// // by Nick
-// }
-//
-// //by Nick
-// if (value != null && value instanceof CollectionMapping
-// && !(value instanceof ArrayMapping)) {
-// String elementsClsName = ((CollectionMapping) value)
-// .getCollectionElementClassName();
-// if (elementsClsName != null)
-// typeString = field.getType() + "(" + elementsClsName + ")";
-// }
-//
-// if (value != null && value instanceof CollectionMapping) {
-// //added by Nick 12.05.2005 to show collection table in explorer
-// IDatabaseTable collectionTable = ((CollectionMapping) value)
-// .getCollectionTable();
-// if (collectionTable != null
-// && collectionTable.getShortName() != null)
-// typeString += POINTER + collectionTable.getShortName();
-// //by Nick
-// }
-// //by Nick
-// name.append(typeString);
-//
-// // added by Nick 29.07.2005
-// if (field.getGenerifiedTypes() != null) {
-// String[] types = field.getGenerifiedTypes();
-//
-// StringBuffer buf = new StringBuffer("<");
-//
-// for (int i = 0; i < types.length; i++) {
-// String string = types[i];
-// buf.append(string);
-//
-// if (i != types.length - 1)
-// buf.append(", ");
-// }
-//
-// buf.append(">");
-//
-// name.append(buf);
-// }
-// // by Nick
-// }
-// return name.toString();
-//
-// }
-
- public Object visitPersistentField(Property field, Object argument) {
- StringBuffer name = new StringBuffer();
- name.append(field.getName());
- name.append(BUNDLE.getString("OrmModelNameVisitor.Colon"));
- String typeString = field.getType().getReturnedClass().getName();
-
- if (typeString != null) {
-/* IPersistentValueMapping value = null;
- if (field.getMapping() != null)
- value = field.getMapping().getPersistentValueMapping();
-
- if (Signature.getArrayCount(typeString) != 0)
- {
- int depth = Signature.getArrayCount(typeString);
- typeString = Signature.getElementType(typeString);
- for (int i = 0; i < depth; i++) {
- typeString += "[]";
- }
- }
-
- if (value != null && value instanceof CollectionMapping && !(value instanceof ArrayMapping))
- {
- String elementsClsName = ((CollectionMapping)value).getCollectionElementClassName();
- if (elementsClsName != null)
- typeString = field.getType() + "(" + elementsClsName + ")";
- }
-
- if (value != null && value instanceof CollectionMapping)
- {
- IDatabaseTable collectionTable = ((CollectionMapping)value).getCollectionTable();
- if (collectionTable != null && collectionTable.getShortName() != null)
- typeString += POINTER + collectionTable.getShortName();
- }*/
- name.append(typeString);
-
-/* if (field.getGenerifiedTypes() != null)
- {
- String[] types = field.getGenerifiedTypes();
-
- StringBuffer buf = new StringBuffer("<");
-
- for (int i = 0; i < types.length; i++) {
- String string = types[i];
- buf.append(string);
-
- if (i != types.length - 1)
- buf.append(", ");
- }
-
- buf.append(">");
-
- name.append(buf);
- }*/
- }
- return name.toString();
-
- }
-
- /**
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitPersistentClassMapping(org.jboss.tools.hibernate.core.IPersistentClassMapping, java.lang.Object)
- */
-// public Object visitPersistentClassMapping(IPersistentClassMapping mapping,
-// Object argument) {
-// // add tau 22.04.2005
-// // Class mapping should be shown as Class name -> table name
-//
-// StringBuffer name = new StringBuffer();
-// name.append(mapping.getName());
-//
-// IDatabaseTable table = HibernateAutoMappingHelper
-// .getPrivateTable(mapping); // upd tau 22.04.2005
-// if (table != null) {
-// String tableName = table.getName();
-// if (tableName != null) {
-// name.append(POINTER);
-// name.append(tableName);
-// }
-// }
-//
-// return name.toString();
-//
-// }
-
- /**
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitPersistentFieldMapping(org.jboss.tools.hibernate.core.IPersistentFieldMapping, java.lang.Object)
- */
-// public Object visitPersistentFieldMapping(IPersistentFieldMapping mapping,
-// Object argument) {
-// return mapping.getName();
-// }
-
- /**
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitPersistentValueMapping(org.jboss.tools.hibernate.core.IPersistentValueMapping, java.lang.Object)
- */
-// public Object visitPersistentValueMapping(IPersistentValueMapping mapping,
-// Object argument) {
-// return mapping.getName();
-// }
-
- // add tau 27.07.2005
-// public Object visitNamedQueryMapping(INamedQueryMapping mapping,
-// Object argument) {
-// return mapping.getName();
-// }
-
-
- public Object visitCollectionKeyMapping(DependantValue mapping, Object argument) {
- return "key";
- }
-
- public Object visitComponentMapping(Component mapping, Object argument) {
- return "element";
- }
-}
\ No newline at end of file
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ViewsAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ViewsAction.java 2007-07-05 12:10:59 UTC (rev 2314)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ViewsAction.java 2007-07-05 12:15:59 UTC (rev 2315)
@@ -1,46 +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.ResourceBundle;
-
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.ide.IDE;
-import org.jboss.tools.hibernate.ui.view.ViewPlugin;
-
-
-public class ViewsAction {
- static ActionOrmTree openEditorAction;
-
- static private ResourceBundle BUNDLE_IMAGE = ViewPlugin.BUNDLE_IMAGE;
- static private ResourceBundle BUNDLE = ResourceBundle.getBundle(ViewsAction.class.getPackage().getName() + ".views");
-
- static {
- openEditorAction = new ActionOrmTree() {
- HashMap<Object,ObjectEditorInput> hashMap = new HashMap<Object,ObjectEditorInput>();
- public void rush() {
- ObjectEditorInput input = hashMap.get(this.getViewer().getTree().getSelection()[0].getData());
- if(input == null) {
- input = new ObjectEditorInput(this.getViewer().getTree().getSelection()[0].getData());
- hashMap.put(this.getViewer().getTree().getSelection()[0].getData(), input);
- }
- try {
- IDE.openEditor(ViewPlugin.getPage(),input ,"org.jboss.tools.hibernate.ui.veditor.editors.visualeditor");
- } catch (PartInitException e) {
-// ExceptionHandler.logThrowableError(e,"OpenEditor");
- }
- }
- };
- openEditorAction.setText(BUNDLE.getString("Explorer.OpenEditorActionName"));
- openEditorAction.setToolTipText(BUNDLE.getString("Explorer.OpenEditorActionToolTipText"));
- }
-}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/views.properties
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/views.properties 2007-07-05 12:10:59 UTC (rev 2314)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/views.properties 2007-07-05 12:15:59 UTC (rev 2315)
@@ -1,245 +0,0 @@
-//Explorer
-Explorer.ActionRootPackageClassFieldName=project -> mapping -> package -> class(table) -> field -> column(s)
-Explorer.ActionRootPackageClassFieldContentDescription=project -> mapping -> package -> class(table) -> field
-Explorer.ActionRootPackageClassFieldToolTipText=Group by package
-
-Explorer.ActionRootClassFieldName=project -> mapping -> class(table) -> field -> column(s)
-Explorer.ActionRootClassFieldContentDescription=project -> mapping -> class(table) -> field -> column(s)
-Explorer.ActionRootClassFieldToolTipText=Group by mapping
-
-Explorer.ActionRootStorageClassFieldName=project -> mapping -> mapping storage -> class(table) -> field -> column(s)
-Explorer.ActionRootStorageClassFieldContentDescription=project -> mapping -> mapping storage -> class(table) -> field -> column(s)
-Explorer.ActionRootStorageClassFieldToolTipText=Group by storage
-
-Explorer.HibernateConnectionWizardName=Edit Hibernate Configuration...
-Explorer.HibernateConnectionWizardToolTipText=Hibernate configuration wizard
-
-Explorer.PersistentClassesWizardName=Add Persistent Classes...
-Explorer.PersistentClassesWizardToolTipText=Add persistent classes wizard
-
-Explorer.GenerateDAOWizardName=Generate DAO Classes...
-Explorer.GenerateDAOWizardToolTipText=Generate DAO wizard
-
-Explorer.FieldMappingWizardName=Edit Mapping...
-Explorer.FieldMappingWizardToolTipText=Field mapping wizard
-//Kuzmin 06.10.2005
-Explorer.FieldMappingWizardNameNew=New Mapping...
-
-Explorer.TablesClassesWizardName=Reverse Engineer Database Schema...
-Explorer.TablesClassesWizardToolTipText=Add tables classes wizard
-Explorer.TablesClassesWizardInfoCreate=Created classes
-Explorer.TablesClassesWizardInfonoPK=Tables have no PK
-Explorer.TablesClassesWizardInfoLink=Many-to-many link tables
-Explorer.TablesClassesWizardInfoTitle=Red Hat Developer Studio Reversing Operation Report
-
-Explorer.AddNamedQueryName=Add Named Query...
-Explorer.AddNamedQueryToolTipText=Create new named query
-Explorer.AddNamedQuery.DefaultNewName=New query
-
-Explorer.TestQueryName=Query Test...
-Explorer.TestQueryToolTipText=Query test
-Explorer.TestQuery.DefaultQuery=from {0}
-
-Explorer.EditNamedQueryName=Edit Named Query...
-Explorer.EditNamedQueryToolTipText=Edit selected named query
-
-Explorer.RemoveNamedQueryName=Remove Named Query
-Explorer.RemoveNamedQueryToolTipText=Remove selected named query
-Explorer.RemoveNamedQueryTitle=Confirm Remove Named Query
-Explorer.RemoveNamedQueryMessage=Do you want to remove the Named Query "{0}"?
-
-Explorer.DuplicateQueryNameErrorTitle=Duplicate Query Name Error
-
-Explorer.MappingWizardName=Edit Mapping...
-Explorer.MappingWizardToolTipText=Edit mapping
-
-Explorer.GenerateDDLWizardName=Generate DDL Wizard...
-Explorer.GenerateDDLWizardToolTipText=Generate DDL file
-Explorer.GenerateDDLErrorTitle=Generate DDL Error
-
-Explorer.AutoBuildingFalseTitle=Warning
-Explorer.AutoBuildingFalseMessage=Build Automaticaly is switch off.\nContinue?
-
-Explorer.HibernateCacheWizardName=Hibernate Cache Wizard...
-Explorer.HibernateCacheWizardToolTipText=Hibernate cache wizard
-
-Explorer.AutoMappingSettingName=Auto Mapping Settings...
-Explorer.AutoMappingSettingToolTipText=Auto mapping settings
-
-Explorer.RunTimeSettingName=Edit hibernate.properties...
-Explorer.RunTimeSettingToolTipText=Hibernate properties
-
-#new 11.05.2005
-Explorer.ClearPackageMappingName=Clear Mapping...
-Explorer.ClearPackageMappingToolTipText=Clear mapping
-Explorer.ClearPackageMappingTitle=Confirm Clear Mapping
-Explorer.ClearPackageMappingQuestion=Are you sure you want to remove the mapping\nfor the "{0}"?
-
-
-Explorer.ClearClassMappingName=Clear Mapping...
-Explorer.ClearClassMappingToolTipText=Clear mapping
-Explorer.ClearClassMappingTitle=Confirm Clear Mapping
-Explorer.ClearClassMappingQuestion=Are you sure you want to remove the mapping\nfor the "{0}"?
-
-
-Explorer.RemoveClassActionName=Remove Persistent Class...
-Explorer.RemoveClassActionToolTipText=Remove a persistent class
-Explorer.RemoveClassAction.QuestionDialog.Title=Remove Persistent Class
-Explorer.RemoveClassAction.QuestionDialog.Message=Do you want to remove "{0}" ?
-Explorer.RemoveClassAction.QuestionDialog.Radio1=Delete mapping file (if empty)
-Explorer.RemoveClassAction.QuestionDialog.Radio2=Delete source code
-
-Explorer.RemoveClassesActionName=Remove Persistent Classes...
-Explorer.RemoveClassesActionToolTipText=Remove persistent classes
-Explorer.RemoveClassesAction.QuestionDialog.Title=Remove Persistent Classes
-Explorer.RemoveClassesAction.QuestionDialog.Message=Do you want to remove all classes in "{0}"?
-Explorer.RemoveClassesAction.QuestionDialog.Radio1=Delete mapping files (if empty)
-Explorer.RemoveClassesAction.QuestionDialog.Radio2=Delete source code
-
-Explorer.ClearFieldMappingActionName=Clear Mapping...
-Explorer.ClearFieldMappingActionToolTipText=Clear mapping
-Explorer.ClearFieldMappingTitle=Confirm Clear Mapping
-Explorer.ClearFieldMappingQuestion=Are you sure you want to remove the mapping\nfor the "{0}"?
-
-Explorer.ClassAutoMappingActionName=Auto Mapping
-Explorer.ClassAutoMappingActionToolTipText=Auto mapping
-
-Explorer.RefreshClassSchemaMappingActionName=Synchronize Mapping...
-Explorer.RefreshClassSchemaMappingActionToolTipText=Synchronize Mapping
-Explorer.RefreshClassSchemaMappingTitle=Warning
-Explorer.RefreshClassSchemaMappingQuestion=Red Hat Developer Studio will automatically synchronize mapping with the source code.\n\nPress OK to continue.
-
-
-Explorer.PackageAutoMappingActionName=Auto Mapping
-Explorer.PackageAutoMappingActionToolTipText=Auto mapping
-Explorer.PackageAutoMappingAction.ProgressMonitor=Auto mapping "{0}"
-
-Explorer.RefreshPackageSchemaMappingActionName=Synchronize Mapping...
-Explorer.RefreshPackageSchemaMappingActionToolTipText=Synchronize Mapping
-Explorer.RefreshPackageSchemaMappingTitle=Warning
-Explorer.RefreshPackageSchemaMappingQuestion=Red Hat Developer Studio will automatically synchronize mapping with the source code.\n\nPress OK to continue.
-
-Explorer.RefreshMappingSchemaMappingActionName=Synchronize Mapping...
-Explorer.RefreshMappingSchemaMappingActionToolTipText=Synchronize Mapping
-Explorer.RefreshMappingSchemaMapping.ProgressMonitor=Synchronize Mapping "{0}"
-Explorer.RefreshMappingSchemaMappingTitle=Warning
-Explorer.RefreshMappingSchemaMappingQuestion=Red Hat Developer Studio will automatically synchronize mapping with the source code.\n\nPress OK to continue.
-
-Explorer.RefactoringDialogClassActionName=Rename Class...
-Explorer.RefactoringDialogClassActionToolTipText=Rename a class
-
-Explorer.RefactoringDialogFieldActionName=Rename Field...
-Explorer.refactoringDialogFieldActionToolTipText=Rename a field
-
-Explorer.FetchStrategyWizarddName=Fetch Strategy Wizard...
-Explorer.FetchStrategyWizardToolTipText=Fetch strategy
-
-Explorer.CollapseAllActionName=Collapse All
-Explorer.CollapseAllActionToolTipText=Collapse all
-
-Explorer.ExpandAllActionName=Expand All
-Explorer.ExpandAllActionToolTipText=Expand all
-
-Explorer.refreshMappingActionName=Refresh
-Explorer.refreshMappingActionToolTipText=Refresh
-Explorer.refreshMappingAction.ProgressMonitor=Refresh
-
-Explorer.refreshOrmProjectActionName=Refresh
-Explorer.refreshOrmProjectActionToolTipText=Refresh
-Explorer.refreshOrmProjectAction.ProgressMonitor=Refresh "{0}"
-
-Explorer.removeConfigAction.ProgressMonitor=Remove "{0}"
-Explorer.removeConfigActionName=Remove Hibernate Configuration...
-Explorer.removeConfigActionToolTipText=Remove Hibernate configuration
-Explorer.removeConfigAction.QuestionDialog.Title=Confirm Remove Hibernate Configuration
-Explorer.removeConfigAction.QuestionDialog.Message=Do you want to remove the Hibernate Configuration "{0}"?
-Explorer.removeConfigAction.QuestionDialog.Radio1=Also delete the mapping files
-Explorer.removeConfigAction.QuestionDialog.Radio2=Do not delete the mapping files
-
-Explorer.RenameTableObjectActionName=Rename Table...
-Explorer.RenameTableObjectActionToolTipText=Rename table
-
-Explorer.AddColumnDialogActionName=Add Column...
-Explorer.AddColumnDialogActionToolTipText=Add column
-
-Explorer.RemoveTableActionName=Remove Table...
-Explorer.RemoveTableActionTipText=Remove table
-Explorer.RemoveTableQuestion=Are you sure you want to remove table '
-Explorer.RemoveTableConfirmDeleteTitle=Confirm Delete
-
-Explorer.renameTableObjectDialogForColumnActionName=Rename Column...
-Explorer.renameTableObjectDialogForColumnActionToolTipText=Rename column
-
-Explorer.AddMappingStorageActionName=Add Mapping Files...
-Explorer.AddMappingStorageActionMessage=Choose mapping files to be added to the current Hibernate configuration:
-Explorer.AddMappingStorageActionTipText=Add a Hibernate mapping file
-Explorer.FileNoErrorProjectDialogTitle=Action Explorer Visitor
-Explorer.FileNoErrorProjectDialogMessage=File "{0}" is outside of project "{1}"
-Explorer.ConfirmProjectToPathDialogTitle=Confirm Add Project to the Build Path
-Explorer.ConfirmProjectToPathDialogMessage=Do you want to add project "{0}" to the build path and mapping files to the current Hibernate configuration?
-Explorer.ConfirmProjectToPathDialogButtonLabelOK=OK
-Explorer.ConfirmProjectToPathDialogButtonLabelCancel=Cancel
-Explorer.XMLFileStorageDublicateTitle=Add Mapping Files
-Explorer.XMLFileStorageDublicateMessage=File "{0}" contains mapping for existing persistent class "{1}".\nThe file will be ignored.
-
-
-Explorer.ColumnPropertyDialogActionName=Properties...
-Explorer.ColumnPropertyDialogActionToolTipText=Properties
-
-Explorer.ViewTableActionName=View Table
-Explorer.ViewTableActionToolTipText=View table
-
-Explorer.ormProjectsNotFound=There are no projects available with Hibernate capabilities!
-Explorer.ormProjectsWasFound=
-
-Explorer.openSourceActionName=Open Source Code
-Explorer.openSourceActionToolTipText=Open a source file
-
-Explorer.openMappingStorageActionName=Open Mapping
-Explorer.openMappingStorageActionToolTipText=Open a mapping storage file
-
-Explorer.openMappingActionName=Open Mapping
-Explorer.openMappingActionToolTipText=Open a Hibernate configuration file
-
-Explorer.hibernateAddMappingWizardName=New Hibernate Configuration...
-Explorer.hibernateAddMappingWizardToolTipText=New Hibernate Configuration...
-
-Explorer.RefreshSchemaMappingActionName=Synchronize Schema Mapping...
-Explorer.RefreshSchemaMappingActionToolTipText=Synchronize Schema Mapping
-Explorer.RefreshSchemaMappingTitle=Warning
-Explorer.RefreshSchemaMappingQuestion=Warning.\nRed Hat Developer Studio will automatically synchronize mapping with the Data Schema.
-
-
-Explorer.RefreshDatabaseTableSchemaMappingActionName=Synchronize Table Mapping...
-Explorer.RefreshDatabaseTableSchemaMappingActionToolTipText=Synchronize Table Mapping
-Explorer.RefreshDatabaseTableSchemaTitle=Warning
-Explorer.RefreshDatabaseTableSchemaQuestion=Warning.\nRed Hat Developer Studio will automatically synchronize mapping with the Data Schema.
-
-Explorer.HQLConsole=HQL Console
-Explorer.HQLConsoleToolTipText=HQL Console
-Explorer.HibernateConsole=Hibernate Console
-Explorer.HibernateConsoleToolTipText=Hibernate Console
-
-Explorer.OpenEditorActionName=Open Mapping Diagram
-Explorer.OpenEditorActionToolTipText=Open Mapping Diagram
-
-#ExplorerBase
-ExplorerBase.ActionRootSchemaTableColumnName=project -> mapping -> schema -> table -> column
-ExplorerBase.ActionRootSchemaTableColumnContentDescription=project -> mapping -> schema -> table -> column
-ExplorerBase.ActionRootSchemaTableColumnToolTipText=Show Relational Schema
-
-ExplorerBase.ActionRootTableColumnName=project -> mapping -> table -> column
-ExplorerBase.ActionRootTableColumnContentDescription=project -> mapping -> table -> column
-ExplorerBase.ActionRootTableColumnToolTipText=Show columns
-OrmExplorer.licenceTitle=Evaluation Period
-OrmExplorer.licencemessage=Evaluation period expired.
-#OrmModelNameVisitor
-OrmModelNameVisitor.DefaultPackageName=Default Package
-OrmModelNameVisitor.DefaultDatabaseSchema=Default Schema
-OrmModelNameVisitor.Colon=:
-OrmModelNameVisitor.OpenBrackets=(
-OrmModelNameVisitor.Comma=,
-OrmModelNameVisitor.CloseBrackets=)
-
-#Job
-Job.LoadMapping=Loading mappings...
17 years, 6 months
JBoss Tools SVN: r2314 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src: com/exadel/orm2/wizard and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-07-05 08:10:59 -0400 (Thu, 05 Jul 2007)
New Revision: 2314
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/
Removed:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/com/exadel/orm2/view/
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/com/exadel/orm2/wizard/hibernatecachewizard/
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/ViewPlugin.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/image.properties
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ActionOrmTree.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ContentProviderVisitor.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ObjectEditorInput.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OpenDiagramActionDelegate.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmContentProvider.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmLabelProvider.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmModelImageVisitor.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmModelNameVisitor.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ViewsAction.java
Log:
JBIDE-559: Hibernate diagram editor cleanup
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/ViewPlugin.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/ViewPlugin.java 2007-07-05 12:01:50 UTC (rev 2313)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/ViewPlugin.java 2007-07-05 12:10:59 UTC (rev 2314)
@@ -8,7 +8,7 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.view;
+package org.jboss.tools.hibernate.ui.view;
import java.io.ByteArrayInputStream;
import java.io.IOException;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/image.properties
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/image.properties 2007-07-05 12:01:50 UTC (rev 2313)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/image.properties 2007-07-05 12:10:59 UTC (rev 2314)
@@ -91,6 +91,6 @@
TreeModelLabel.file_obj=file_obj.gif
TreeModelLabel.fldr_obj=fldr_obj.gif
-#VizualMapping
-VizualMapping.shevronUp=shevron_up.gif
-VizualMapping.shevronDown=shevron_down.gif
+#VisualMapping
+VisualMapping.shevronUp=shevron_up.gif
+VisualMapping.shevronDown=shevron_down.gif
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ActionOrmTree.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ActionOrmTree.java 2007-07-05 12:01:50 UTC (rev 2313)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ActionOrmTree.java 2007-07-05 12:10:59 UTC (rev 2314)
@@ -1,14 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * 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
*
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.view.views;
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.ui.view.views;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.TreeViewer;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ContentProviderVisitor.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ContentProviderVisitor.java 2007-07-05 12:01:50 UTC (rev 2313)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ContentProviderVisitor.java 2007-07-05 12:10:59 UTC (rev 2314)
@@ -1,351 +1,27 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * 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
*
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.view.views;
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.ui.view.views;
import java.util.ResourceBundle;
import org.hibernate.mapping.Column;
-/**
- * @author Tau from Minsk
- *
- */
public class ContentProviderVisitor {
private static final Object[] nullChildren = new Object[0];
private ResourceBundle BUNDLE = ResourceBundle.getBundle(ContentProviderVisitor.class.getPackage().getName() + ".views");
-// public Object visitOrmProject(IOrmProject project, Object argument) {
-// return project.getMappings();
-// }
-//
-// public Object visitDatabaseSchema(IDatabaseSchema schema, Object argument) {
-// return schema.getDatabaseTables();
-// }
-//
-// public Object visitDatabaseTable(IDatabaseTable table, Object argument) {
-// return table.getColumns();
-// }
-//
-// public Object visitDatabaseColumn(IDatabaseColumn column, Object argument) {
-// return nullChildren;
-// }
-//
-// public Object visitDatabaseConstraint(IDatabaseConstraint constraint, Object argument) {
-// return nullChildren;
-// }
-//
-// public Object visitPackage(IPackage pakage, Object argument) {
-// return pakage.getPersistentClasses();
-// }
-//
-// public Object visitMapping(final IMapping mapping, final Object argument) {
-// // start job
-// if (mapping.isFlagDirty()) {
-// //if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("0-ContentProviderVisitor.visitMapping(...), parentElement= " + mapping);
-// Job job = new Job(BUNDLE.getString("Job.LoadMapping")) {
-// protected IStatus run(IProgressMonitor monitor) {
-// ((OrmContentProvider)argument).lockMenu = true; // add tau 09.03.2006
-// mapping.getMappingStorages();
-// return Status.OK_STATUS;
-// }
-// };
-//
-// job.addJobChangeListener(new JobChangeAdapter() {
-// public void done(IJobChangeEvent event) {
-// if (event.getJob().getState() != Job.NONE) return; // Job not finished
-// //if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("1-ContentProviderVisitor.visitMapping(...), parentElement= " + mapping);
-// ((OrmContentProvider)argument).lockMenu = false; // add tau 09.03.2006
-// if (event.getResult().isOK()){
-// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("2-ContentProviderVisitor.visitMapping(...), parentElement= " + mapping);
-// ((OrmContentProvider)argument).viewerRefreshUpdate(mapping, false);
-// }
-// }
-// });
-// job.setPriority(Job.INTERACTIVE);
-// job.schedule(); // start as soon as possible
-// return new String []{BUNDLE.getString("Job.LoadMapping")};
-// } else {
-// if (((OrmContentProvider)argument).getTip() == OrmContentProvider.CLASS_FIELD_CONTENT_PROVIDER) return mapping.getPertsistentClasses();
-// else if (((OrmContentProvider)argument).getTip() == OrmContentProvider.PACKAGE_CLASS_FIELD_CONTENT_PROVIDER) return mapping.getPackages();
-// else if (((OrmContentProvider)argument).getTip() == OrmContentProvider.STORAGE_CLASS_FIELD_CONTENT_PROVIDER) return mapping.getMappingStorages();
-// else if (((OrmContentProvider)argument).getTip() == OrmContentProvider.SCHEMA_TABLE_COLUMN_CONTENT_PROVIDER) return mapping.getDatabaseSchemas();
-// else if (((OrmContentProvider)argument).getTip() == OrmContentProvider.TABLE_COLUMN_CONTENT_PROVIDER) return mapping.getDatabaseTables();
-// else return nullChildren;
-// }
-//
-// }
-//
-// public Object visitMappingStorage(IMappingStorage storage, Object argument) {
-// //storage.getNamedQueryMappings(); 26.07.2005
-// //return storage.getPersistentClassMappings();
-// // add tau 27.07.2005
-// Object[] namedQueryMappings = storage.getNamedQueryMappings();
-// Object[] persistentClassMappings = storage.getPersistentClassMappings();
-// Object[] mappings = new Object[namedQueryMappings.length + persistentClassMappings.length];
-// System.arraycopy(namedQueryMappings, 0, mappings, 0, namedQueryMappings.length);
-// System.arraycopy(persistentClassMappings, 0, mappings, namedQueryMappings.length, persistentClassMappings.length);
-//
-// ((OrmContentProvider)argument).setSorting(false); // add 28.07.2005 tau
-// return mappings;
-// }
-//
-// public Object visitPersistentClass(IPersistentClass clazz, Object argument) {
-// ((OrmContentProvider)argument).setSorting(false);
-// return clazz.getFields();
-// }
-//
-// public Object visitPersistentField(IPersistentField field, Object argument) {
-// IPersistentFieldMapping mapping = field.getMapping();
-// if (mapping != null){
-// return mapping.accept(this, argument);
-// }
-//
-// return nullChildren;
-// }
-//
-// public Object visitPersistentClassMapping(IPersistentClassMapping mapping, Object argument) {
-// IPersistentClass persistentClass = mapping.getPersistentClass();
-// if (persistentClass != null){
-// ((OrmContentProvider)argument).setSorting(false);
-// return persistentClass.getFields();
-// }
-// return nullChildren;
-// }
-//
-// public Object visitPersistentFieldMapping(IPersistentFieldMapping mapping, Object argument) {
-// IPersistentValueMapping valueMapping = mapping.getPersistentValueMapping();
-// if (valueMapping != null){
-// return valueMapping.accept(this, argument);
-// }
-// return nullChildren;
-// }
-//
-// public Object visitPersistentValueMapping(IPersistentValueMapping mapping, Object argument) {
-// // added by Nick 06.09.2005
-// ((OrmContentProvider)argument).setSorting(false);
-// // by Nick
-//
-// Iterator iter = mapping.getColumnIterator();
-// if (iter != null){
-// ArrayList list = new ArrayList();
-// while (iter.hasNext()) {
-// list.add(iter.next());
-// }
-// return list.toArray();
-// }
-// return nullChildren;
-// }
-//
-// private Object[] visitCollectionMapping(ICollectionMapping mapping, Object argument){
-// IHibernateValueMapping elem=mapping.getElement();
-// // added by Nick 06.09.2005
-// ((OrmContentProvider)argument).setSorting(false);
-// // by Nick
-// IHibernateValueMapping key=mapping.getKey();
-// return new Object[]{key,elem};
-// }
-// private Object[] visitIndexedCollectionMapping(IIndexedCollectionMapping mapping, Object argument){
-// IHibernateValueMapping elem=mapping.getElement();
-// // added by Nick 06.09.2005
-// ((OrmContentProvider)argument).setSorting(false);
-// // by Nick
-// IHibernateValueMapping key=mapping.getKey();
-// return new Object[]{key, elem, mapping.getIndex()};
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitAnyMapping(org.jboss.tools.hibernate.core.hibernate.IAnyMapping, java.lang.Object)
-// */
-// public Object visitAnyMapping(IAnyMapping mapping, Object argument) {
-// return visitPersistentValueMapping(mapping, argument);
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitArrayMapping(org.jboss.tools.hibernate.core.hibernate.IArrayMapping, java.lang.Object)
-// */
-// public Object visitArrayMapping(IArrayMapping mapping, Object argument) {
-// return visitIndexedCollectionMapping(mapping, argument);
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitBagMapping(org.jboss.tools.hibernate.core.hibernate.IBagMapping, java.lang.Object)
-// */
-// public Object visitBagMapping(IBagMapping mapping, Object argument) {
-// return visitCollectionMapping(mapping, argument);
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitComponentMapping(org.jboss.tools.hibernate.core.hibernate.IComponentMapping, java.lang.Object)
-// */
-// public Object visitComponentMapping(IComponentMapping mapping, Object argument) {
-// //changed on 06/07/05 by alex
-// ((OrmContentProvider)argument).setSorting(false);
-// return mapping.getComponentClass().getFields();
-///*
-// * Iterator iter = mapping.getPropertyIterator();
-// if (iter != null){
-// ArrayList list = new ArrayList();
-// while (iter.hasNext()) {
-// //added 13.05.2005 by Nick - show type for component elements
-// Object obj = iter.next();
-// boolean added = false;
-// if (obj instanceof IPersistentFieldMapping) {
-// IPersistentFieldMapping fm = (IPersistentFieldMapping) obj;
-// if (fm.getPersistentField() != null)
-// {
-// added = true;
-// list.add(fm.getPersistentField());
-// }
-// }
-// if (!added)
-// list.add(obj);
-// //by Nick
-// }
-// return list.toArray(nullChildren);
-// }*/
-// //return nullChildren;
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitIdBagMapping(org.jboss.tools.hibernate.core.hibernate.IIdBagMapping, java.lang.Object)
-// */
-// public Object visitIdBagMapping(IIdBagMapping mapping, Object argument) {
-// IHibernateValueMapping elem=mapping.getElement();
-// IHibernateValueMapping key=mapping.getKey();
-// IHibernateValueMapping id=mapping.getIdentifier();
-// return new Object[]{key,elem, id};
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitJoinedSubclassMapping(org.jboss.tools.hibernate.core.hibernate.IJoinedSubclassMapping, java.lang.Object)
-// */
-// public Object visitJoinedSubclassMapping(IJoinedSubclassMapping mapping, Object argument) {
-// return visitPersistentClassMapping(mapping, argument);
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitJoinMapping(org.jboss.tools.hibernate.core.hibernate.IJoinMapping, java.lang.Object)
-// */
-// public Object visitJoinMapping(IJoinMapping mapping, Object argument) {
-// return null;
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitListMapping(org.jboss.tools.hibernate.core.hibernate.IListMapping, java.lang.Object)
-// */
-// public Object visitListMapping(IListMapping mapping, Object argument) {
-// return visitIndexedCollectionMapping(mapping, argument);
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitManyToAnyMapping(org.jboss.tools.hibernate.core.hibernate.IManyToAnyMapping, java.lang.Object)
-// */
-// public Object visitManyToAnyMapping(IManyToAnyMapping mapping, Object argument) {
-// return visitPersistentValueMapping(mapping, argument);
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitManyToManyMapping(org.jboss.tools.hibernate.core.hibernate.IManyToManyMapping, java.lang.Object)
-// */
-// public Object visitManyToManyMapping(IManyToManyMapping mapping, Object argument) {
-// return visitPersistentValueMapping(mapping, argument);
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitManyToOneMapping(org.jboss.tools.hibernate.core.hibernate.IManyToOneMapping, java.lang.Object)
-// */
-// public Object visitManyToOneMapping(IManyToOneMapping mapping, Object argument) {
-// return visitPersistentValueMapping(mapping, argument);
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitMapMapping(org.jboss.tools.hibernate.core.hibernate.IMapMapping, java.lang.Object)
-// */
-// public Object visitMapMapping(IMapMapping mapping, Object argument) {
-// return visitIndexedCollectionMapping(mapping, argument);
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitOneToManyMapping(org.jboss.tools.hibernate.core.hibernate.IOneToManyMapping, java.lang.Object)
-// */
-// public Object visitOneToManyMapping(IOneToManyMapping mapping, Object argument) {
-// return visitPersistentValueMapping(mapping, argument);
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitOneToOneMapping(org.jboss.tools.hibernate.core.hibernate.IOneToOneMapping, java.lang.Object)
-// */
-// public Object visitOneToOneMapping(IOneToOneMapping mapping, Object argument) {
-// return visitPersistentValueMapping(mapping, argument);
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitPrimitiveArrayMapping(org.jboss.tools.hibernate.core.hibernate.IPrimitiveArrayMapping, java.lang.Object)
-// */
-// public Object visitPrimitiveArrayMapping(IPrimitiveArrayMapping mapping, Object argument) {
-// return visitIndexedCollectionMapping(mapping, argument);
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitPropertyMapping(org.jboss.tools.hibernate.core.hibernate.IPropertyMapping, java.lang.Object)
-// */
-// public Object visitPropertyMapping(IPropertyMapping mapping, Object argument) {
-// return visitPersistentFieldMapping(mapping, argument);
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitRootClassMapping(org.jboss.tools.hibernate.core.hibernate.IRootClassMapping, java.lang.Object)
-// */
-// public Object visitRootClassMapping(IRootClassMapping mapping, Object argument) {
-// return visitPersistentClassMapping(mapping, argument);
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitSetMapping(org.jboss.tools.hibernate.core.hibernate.ISetMapping, java.lang.Object)
-// */
-// public Object visitSetMapping(ISetMapping mapping, Object argument) {
-// return visitCollectionMapping(mapping, argument);
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitSimpleValueMapping(org.jboss.tools.hibernate.core.hibernate.ISimpleValueMapping, java.lang.Object)
-// */
-// public Object visitSimpleValueMapping(ISimpleValueMapping simple, Object argument) {
-// return visitPersistentValueMapping(simple, argument);
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitSubclassMapping(org.jboss.tools.hibernate.core.hibernate.ISubclassMapping, java.lang.Object)
-// */
-// public Object visitSubclassMapping(ISubclassMapping mapping, Object argument) {
-// return visitPersistentClassMapping(mapping, argument);
-// }
-//
-// /* (non-Javadoc)
-// * @see org.jboss.tools.hibernate.core.hibernate.IHibernateMappingVisitor#visitUnionSubclassMapping(org.jboss.tools.hibernate.core.hibernate.IUnionSubclassMapping, java.lang.Object)
-// */
-// public Object visitUnionSubclassMapping(IUnionSubclassMapping mapping, Object argument) {
-// return visitPersistentClassMapping(mapping, argument);
-// }
-//
-// // add tau 27.07.2005
-// public Object visitNamedQueryMapping(INamedQueryMapping mapping, Object argument) {
-// return null;
-// }
-
public Object visitDatabaseColumn(Column column, Object argument) {
- // TODO Auto-generated method stub
return null;
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ObjectEditorInput.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ObjectEditorInput.java 2007-07-05 12:01:50 UTC (rev 2313)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ObjectEditorInput.java 2007-07-05 12:10:59 UTC (rev 2314)
@@ -1,14 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * 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
*
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.view.views;
+ * 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;
@@ -16,10 +16,6 @@
import org.hibernate.cfg.Configuration;
-/**
- * @author Konstantin Mishin
- *
- */
public class ObjectEditorInput implements IEditorInput{
protected Object fObject;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OpenDiagramActionDelegate.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OpenDiagramActionDelegate.java 2007-07-05 12:01:50 UTC (rev 2313)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OpenDiagramActionDelegate.java 2007-07-05 12:10:59 UTC (rev 2314)
@@ -1,14 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * 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
*
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.view.views;
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.ui.view.views;
import java.util.HashMap;
@@ -21,7 +21,7 @@
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.internal.ObjectPluginAction;
import org.hibernate.cfg.Configuration;
-import org.jboss.tools.hibernate.view.ViewPlugin;
+import org.jboss.tools.hibernate.ui.view.ViewPlugin;
public class OpenDiagramActionDelegate implements IObjectActionDelegate {
@@ -31,7 +31,6 @@
public void run(IAction action) {
HashMap hashMap = new HashMap();
ObjectPluginAction objectPluginAction = (ObjectPluginAction)action;
-// TreeSelection treeSelection = (TreeSelection)objectPluginAction.getSelection();
Object rootClass = ((TreeSelection)objectPluginAction.getSelection()).getFirstElement();
ObjectEditorInput input = (ObjectEditorInput)hashMap.get(rootClass);
Configuration configuration = (Configuration)(((TreeSelection)objectPluginAction.getSelection()).getPaths()[0]).getSegment(1);
@@ -40,16 +39,13 @@
hashMap.put(rootClass, input);
}
try {
-// IDE.openEditor(ViewPlugin.getPage(),input ,"org.hibernate.eclipse.orm.veditor.editors.VizualEditor");
- IDE.openEditor(ViewPlugin.getPage(),input ,"org.jboss.tools.hibernate.veditor.editors.vizualeditor");
+ IDE.openEditor(ViewPlugin.getPage(),input ,"org.jboss.tools.hibernate.ui.veditor.editors.visualeditor");
} catch (PartInitException e) {
// ExceptionHandler.logThrowableError(e,"OpenEditor");
}
}
public void selectionChanged(IAction action, ISelection selection) {
- // TODO Auto-generated method stub
-
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmContentProvider.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmContentProvider.java 2007-07-05 12:01:50 UTC (rev 2313)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmContentProvider.java 2007-07-05 12:10:59 UTC (rev 2314)
@@ -1,14 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * 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
*
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.view.views;
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.ui.view.views;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
@@ -22,23 +22,16 @@
import org.eclipse.swt.widgets.TreeItem;
-/**
- * @author Tau from Minsk
- */
public class OrmContentProvider implements ITreeContentProvider/*, IOrmModelListener, IOrmProjectChangedListener*/ {
- //ExplorerClass
protected static final int PACKAGE_CLASS_FIELD_CONTENT_PROVIDER = 1;
protected static final int CLASS_FIELD_CONTENT_PROVIDER = 2;
protected static final int STORAGE_CLASS_FIELD_CONTENT_PROVIDER = 3;
- //ExplorerBase
protected static final int SCHEMA_TABLE_COLUMN_CONTENT_PROVIDER = 4;
protected static final int TABLE_COLUMN_CONTENT_PROVIDER = 5;
protected TreeViewer viewer;
-// protected IOrmProject ormProject;
-// protected IOrmModel ormModel;
private static final ContentProviderVisitor contentProviderVisitor = new ContentProviderVisitor();
private static final Object[] nullChildren = new Object[0];
@@ -46,15 +39,12 @@
private int tip;
private boolean sorting;
- // add 27.06.2005
private Object[] expandedElements = null;
private ISelection selectionElements = null;
- // add 09.11.2005
private String[] beforeChangeElements = null;
private String beforeChangeSelectionElementQualifiedName = null;
- // add tau 05.12.2005
public boolean lockMenu = false;
@@ -63,20 +53,7 @@
sorting = true; // default - sort
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
- */
- // edit tau 07.03.2006
public Object[] getChildren(Object parentElement) {
-// if (parentElement instanceof IOrmModel) {
-// children = ((IOrmModel) parentElement).getOrmProjects();
-// } else if (parentElement instanceof IOrmElement) {
-// children = (Object[]) ((IOrmElement) parentElement).accept(contentProviderVisitor, viewer.getContentProvider());
-// } else children = nullChildren;
-
- // add Tau 05.05.2005
if (children == null)
children = nullChildren;
@@ -88,48 +65,6 @@
return children;
}
-// static protected Comparator<Object> comparator = new Comparator<Object>() {
-// private Collator fCollator = Collator.getInstance();
-//
-// public int compare(Object o1, Object o2) {
-//
-// String name1 = null;
-// String name2 = null;
-// if (o1 instanceof IOrmElement )
-// name1 = ((IOrmElement) o1).getName();
-//
-// if (o2 instanceof IOrmElement )
-// name2 = ((IOrmElement) o2).getName();
-//
-// /* del tau 29.09.2005
-// //akuzmin 21.08.2005
-// if ((name1==null)&&(name2==null))
-// {
-// ExceptionHandler.logInfo("Error when compare element "+o1.toString()+" and "+o2.toString());
-// name1="";
-// name2="";
-// }
-// else
-// if (name1==null)
-// {
-// ExceptionHandler.logInfo("Error when compare element null and "+name2);
-// name1="";
-// }
-// else if (name2==null)
-// {
-// ExceptionHandler.logInfo("Error when compare element "+name1+" and null");
-// name2="";
-// }
-// */
-// return fCollator.compare(name1, name2);
-// }
-// };
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
- */
public Object getParent(Object element) {
//if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("!!! OrmContentProvider.getParent(Object element):" + element + ", tip="+tip);
@@ -137,11 +72,6 @@
return null;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
- */
public boolean hasChildren(Object element) {
//TODO EXP 3d
//return getChildren(element).length > 0;
@@ -154,30 +84,14 @@
return true;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
public Object[] getElements(Object inputElement) {
return getChildren(inputElement);
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
public void dispose() {
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
- * java.lang.Object, java.lang.Object)
- */
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
// if (ViewPlugin.TRACE || ViewPlugin.TRACE_VIEW ) ExceptionHandler.logInfo("OrmContentProvider.inputChanged():"+", tip="+tip+", this= " + this);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmLabelProvider.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmLabelProvider.java 2007-07-05 12:01:50 UTC (rev 2313)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmLabelProvider.java 2007-07-05 12:10:59 UTC (rev 2314)
@@ -1,14 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * 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
*
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.view.views;
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.ui.view.views;
import java.util.HashMap;
import java.util.Iterator;
@@ -35,36 +35,22 @@
import org.hibernate.mapping.SingleTableSubclass;
import org.hibernate.mapping.Table;
-/**
- * @author Tau from Minsk
- *
- */
public class OrmLabelProvider extends LabelProvider implements IColorProvider, IFontProvider {
private Map imageCache = new HashMap(25);
private OrmModelImageVisitor ormModelImageVisitor;
private OrmModelNameVisitor ormModelNameVisitor;
- /**
- * @param ormModelImageVisitor
- */
public OrmLabelProvider(OrmModelImageVisitor imageVisitor, OrmModelNameVisitor nameVisitor) {
super();
ormModelImageVisitor = imageVisitor;
ormModelNameVisitor = nameVisitor;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
- */
public Image getImage(Object element) {
ImageDescriptor descriptor = null;
-/// if (element instanceof IOrmElement) {
if (element instanceof RootClass) {
-/// descriptor = (ImageDescriptor) ((IOrmElement) element).accept(ormModelImageVisitor, null);
descriptor = (ImageDescriptor) ((RootClass) element).accept(ormModelImageVisitor);
} else if (element instanceof Property) {
descriptor = (ImageDescriptor)ormModelImageVisitor.visitPersistentField((Property) element, null);
@@ -77,12 +63,10 @@
} else if (element instanceof Component) {
descriptor = (ImageDescriptor)ormModelImageVisitor.visitComponentMapping((Component) element);
} else {
- // edit tau 07.03.2006
//throw unknownElement(element);
return null;
}
- // obtain the cached image corresponding to the descriptor
Image image = (Image) imageCache.get(descriptor);
if (image == null) {
image = descriptor.createImage();
@@ -91,13 +75,7 @@
return image;
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
- */
public String getText(Object element) {
-/// if (element instanceof IOrmElement) {
if (element instanceof RootClass) {
String name = (String)ormModelNameVisitor.visitPersistentClass((RootClass)element, null);
if (name == null) {
@@ -127,7 +105,6 @@
return name;
}
} else if (element instanceof OneToMany || element instanceof ManyToOne) {
-// String name = (String)ormModelNameVisitor.visitComponentMapping((Component)element, null);
String name = "element";
if (name == null) {
return "OrmElement";
@@ -162,7 +139,6 @@
}
protected RuntimeException unknownElement(Object element) {
- // TODO (tau->tau) go to Eclipse Exception
if (element != null && element.getClass() != null )
return new RuntimeException("Unknown type of element in tree of type: " + element.getClass().getName());
else return new RuntimeException("Unknown type of element in tree of type: " + element);
@@ -176,9 +152,6 @@
imageCache.clear();
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object)
- */
public Color getForeground(Object element) {
if (element instanceof RootClass) {
return Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GREEN);
@@ -189,16 +162,10 @@
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object)
- */
public Color getBackground(Object element) {
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IFontProvider#getFont(java.lang.Object)
- */
public Font getFont(Object element) {
/* if (element instanceof IOrmProject) {
return JFaceResources.getFontRegistry().getBold(JFaceResources.getTextFont().getFontData()[0].getName());
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmModelImageVisitor.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmModelImageVisitor.java 2007-07-05 12:01:50 UTC (rev 2313)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmModelImageVisitor.java 2007-07-05 12:10:59 UTC (rev 2314)
@@ -1,14 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * 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
*
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.view.views;
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.ui.view.views;
import java.util.ResourceBundle;
@@ -23,7 +23,7 @@
import org.hibernate.mapping.Subclass;
import org.hibernate.mapping.Table;
import org.hibernate.mapping.UnionSubclass;
-import org.jboss.tools.hibernate.view.ViewPlugin;
+import org.jboss.tools.hibernate.ui.view.ViewPlugin;
@@ -39,146 +39,17 @@
private static Integer VER = new Integer(2);
- /* (non-Javadoc)
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitOrmModel(org.jboss.tools.hibernate.core.IOrmProject, java.lang.Object)
- */
-// public Object visitOrmProject(IOrmProject schema, Object argument) {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.OrmModel")); //$NON-NLS-1$
-// }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitDatabaseSchema(org.jboss.tools.hibernate.core.IDatabaseSchema, java.lang.Object)
- */
-// public Object visitDatabaseSchema(IDatabaseSchema schema, Object argument) {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabaseSchema")); //$NON-NLS-1$
-// }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitDatabaseTable(org.jboss.tools.hibernate.core.IDatabaseTable, java.lang.Object)
- */
-// public Object visitDatabaseTable(IDatabaseTable table, Object argument) {
-// if ((table != null) && table.isView() ){
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabaseView")); //$NON-NLS-1$
-// }
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabaseTable")); //$NON-NLS-1$
-// }
-
public Object visitDatabaseTable(Table table) {
-// if ((table != null) && table.isView() ){
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabaseView")); //$NON-NLS-1$
-// }
return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabaseTable")); //$NON-NLS-1$
}
- /* (non-Javadoc)
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitDatabaseColumn(org.jboss.tools.hibernate.core.IDatabaseColumn, java.lang.Object)
- */
-// public Object visitDatabaseColumn(IDatabaseColumn column, Object argument) {
-// // #added# by Konstantin Mishin on 24.12.2005 fixed for ESORM-256
-// if(column.isUnique())
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabaseUniqueKeyColumn"));
-// // #added#
-// else if (column.isPrimaryKey()&& column.getOwnerTable() != null && column.getOwnerTable().isForeignKey(column.getName())){
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabasePrimaryForeignKeysColumn"));
-// } else if (column.isPrimaryKey()){
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabasePrimaryKeyColumn")); //$NON-NLS-1$
-// } else if (column.getOwnerTable() != null && column.getOwnerTable().isForeignKey(column.getName())){
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabaseForeignKeyColumn")); //$NON-NLS-1$
-// } else return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabaseColumn")); //$NON-NLS-1$
-//
-// }
-
public Object visitDatabaseColumn(Column column) {
- // #added# by Konstantin Mishin on 24.12.2005 fixed for ESORM-256
if(column.isUnique()) {
return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabaseUniqueKeyColumn"));
- // #added#
-// } else if (column.isPrimaryKey()&& column.getOwnerTable() != null && column.getOwnerTable().isForeignKey(column.getName())){
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabasePrimaryForeignKeysColumn"));
-// } else if (column.isPrimaryKey()){
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabasePrimaryKeyColumn")); //$NON-NLS-1$
-// } else if (column.getOwnerTable() != null && column.getOwnerTable().isForeignKey(column.getName())){
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabaseForeignKeyColumn")); //$NON-NLS-1$
} else return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabaseColumn")); //$NON-NLS-1$
}
- /* (non-Javadoc)
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitDatabaseConstraint(org.jboss.tools.hibernate.core.IDatabaseConstraint, java.lang.Object)
- */
-// public Object visitDatabaseConstraint(IDatabaseConstraint constraint, Object argument) {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.DatabaseConstraint")); //$NON-NLS-1$
-// }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitPackage(org.jboss.tools.hibernate.core.IPackage, java.lang.Object)
- */
-// public Object visitPackage(IPackage pakage, Object argument) {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.Package")); //$NON-NLS-1$
-// }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitMapping(org.jboss.tools.hibernate.core.IMapping, java.lang.Object)
- */
-// public Object visitMapping(IMapping mapping, Object argument) {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.Mapping")); //$NON-NLS-1$
-// }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitMappingStorage(org.jboss.tools.hibernate.core.IMappingStorage, java.lang.Object)
- */
-// public Object visitMappingStorage(IMappingStorage storage, Object argument) {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.MappingStorage")); //$NON-NLS-1$
-// }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitPersistentClass(org.jboss.tools.hibernate.core.IPersistentClass, java.lang.Object)
- */
-// public Object visitPersistentClass(IPersistentClass clazz, Object argument) {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentClass")); //$NON-NLS-1$
-// }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitPersistentField(org.jboss.tools.hibernate.core.IPersistentField, java.lang.Object)
- */
-// public Object visitPersistentField(IPersistentField field, Object argument) {
-//
-// //((IHibernateClassMapping)field.getOwnerClass().getPersistentClassMapping()).getIdentifierProperty();
-// //==propertyMapping
-//
-// //add tau 08.04.2005
-//
-// if (field !=null){
-// IPersistentFieldMapping mapping = field.getMapping();
-// if (mapping != null){
-// IPersistentValueMapping valueMapping = mapping.getPersistentValueMapping();
-// if (valueMapping != null){
-// IPersistentClass pClass = field.getOwnerClass();
-// if (pClass != null){
-// IPersistentClassMapping classMapping = pClass.getPersistentClassMapping();
-// if (classMapping != null){
-// if (mapping == ((IHibernateClassMapping)classMapping).getIdentifierProperty()){
-// argument = ID;
-// } else if (mapping == ((IHibernateClassMapping)classMapping).getVersion()){
-// argument = VER;
-// }
-// }
-// }
-// //akuzmin 14.09.2005 show parent image
-// if ((((PropertyMapping)field.getMapping()).getPropertyMappingHolder() instanceof ComponentMapping)
-// &&(field.getName().equals(((ComponentMapping)((PropertyMapping)field.getMapping()).getPropertyMappingHolder()).getParentProperty())))
-// {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldParent"));//parent image
-// }
-// else
-// return valueMapping.accept(this, argument);
-// }
-// }
-// }
-//
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldNot_mapped")); //$NON-NLS-1$
-// }
-
public Object visitPersistentField(Property field, Object argument) {
if (field !=null){
if (field.getType().isCollectionType()) {
@@ -188,68 +59,6 @@
return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldNot_mapped")); //$NON-NLS-1$
}
- /* (non-Javadoc)
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitPersistentClassMapping(org.jboss.tools.hibernate.core.IPersistentClassMapping, java.lang.Object)
- */
-// public Object visitPersistentClassMapping(IPersistentClassMapping mapping, Object argument) {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentClassMapping")); //$NON-NLS-1$
-// }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitPersistentFieldMapping(org.jboss.tools.hibernate.core.IPersistentFieldMapping, java.lang.Object)
- */
-// public Object visitPersistentFieldMapping(IPersistentFieldMapping mapping, Object argument) {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldMapping")); //$NON-NLS-1$
-// }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.hibernate.core.IOrmModelVisitor#visitPersistentValueMapping(org.jboss.tools.hibernate.core.IPersistentValueMapping, java.lang.Object)
- */
-// public Object visitPersistentValueMapping(IPersistentValueMapping mapping, Object argument) {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentValueMapping")); //$NON-NLS-1$
-// }
-
- // add tau 08.04.2005 for PersistentField icons
-// public Object visitSimpleValueMapping(ISimpleValueMapping simple, Object argument) {
-// if (argument == ID){
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldSimple_id")); //$NON-NLS-1$
-// } else if (argument == VER){
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldSimple_version")); //$NON-NLS-1$
-// } else {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldSimple")); //$NON-NLS-1$
-// }
-//
-// }
-
-// public Object visitAnyMapping(IAnyMapping mapping, Object argument) {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldAny")); //$NON-NLS-1$
-// }
-
-// public Object visitListMapping(IListMapping column, Object argument) {
-// if (column !=null){
-// // edit tau 13.05.2005
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.Collection_list")); //$NON-NLS-1$
-// }
-//
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldNot_mapped")); //$NON-NLS-1$
-// }
-
-// public Object visitArrayMapping(IArrayMapping kage, Object argument) {
-// if (kage !=null){
-// // edit tau 13.05.2005
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.Collection_array")); //$NON-NLS-1$
-// }
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldNot_mapped")); //$NON-NLS-1$
-// }
-
-// public Object visitComponentMapping(IComponentMapping mapping, Object argument) {
-// if (argument == ID){
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldComponent_id")); //$NON-NLS-1$
-// } else {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldComponent")); //$NON-NLS-1$
-// }
-// }
-
public Object visitComponentMapping(Component mapping) {
if (mapping != null){
return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldComponent")); //$NON-NLS-1$
@@ -264,110 +73,7 @@
return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldNot_mapped")); //$NON-NLS-1$
}
-// public Object visitBagMapping(IBagMapping bagMapping, Object argument) {
-// if (bagMapping !=null){
-// // edit tau 13.05.2005
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.Collection_bag")); //$NON-NLS-1$
-// }
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldNot_mapped")); //$NON-NLS-1$
-// }
-
-// public Object visitIdBagMapping(IIdBagMapping table, Object argument) {
-// if (table !=null){
-// // edit tau 13.05.2005
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.Collection_idbag")); //$NON-NLS-1$
-// }
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldNot_mapped")); //$NON-NLS-1$
-// }
-
-// public Object visitPrimitiveArrayMapping(IPrimitiveArrayMapping constraint, Object argument) {
-// if (constraint !=null){
-// // edit tau 13.05.2005
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.Collection_primitive_array")); //$NON-NLS-1$
-// }
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldNot_mapped")); //$NON-NLS-1$
-// }
-
-// public Object visitMapMapping(IMapMapping mapping, Object argument) {
-// if (mapping !=null){
-// // edit tau 13.05.2005
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.Collection_map")); //$NON-NLS-1$
-// }
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldNot_mapped")); //$NON-NLS-1$
-// }
-
-// public Object visitSetMapping(ISetMapping mapping, Object argument) {
-// if (mapping !=null){
-// // edit tau 13.05.2005
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.Collection_set")); //$NON-NLS-1$
-// }
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldNot_mapped")); //$NON-NLS-1$
-// }
-
-// public Object visitOneToManyMapping(IOneToManyMapping mapping, Object argument) {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldOne-to-many")); //$NON-NLS-1$
-// }
-
-// public Object visitManyToManyMapping(IManyToManyMapping mapping, Object argument) {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldMany-to-many")); //$NON-NLS-1$
-// }
-
-// public Object visitManyToAnyMapping(IManyToAnyMapping mapping, Object argument) {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldMany-to-any")); //$NON-NLS-1$
-// }
-
-// public Object visitManyToOneMapping(IManyToOneMapping mapping, Object argument) {
-// if (argument == ID){
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldMany-to-one_id")); //$NON-NLS-1$
-// } else {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldMany-to-one")); //$NON-NLS-1$
-// }
-// }
-
-// public Object visitOneToOneMapping(IOneToOneMapping mapping, Object argument) {
-// if (argument == ID){
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldOne-to-one_id")); //$NON-NLS-1$
-// } else {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldOne-to-one")); //$NON-NLS-1$
-// }
-// }
-
-// public Object visitJoinMapping(IJoinMapping mapping, Object argument) {
-// // ??
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentJoinedSubclassMapping")); //$NON-NLS-1$
-// }
-
-// public Object visitRootClassMapping(IRootClassMapping mapping, Object argument) {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentRootClassMapping")); //$NON-NLS-1$
-// }
-
-// public Object visitSubclassMapping(ISubclassMapping mapping, Object argument) {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentSubclassMapping")); //$NON-NLS-1$
-// }
-
-// public Object visitJoinedSubclassMapping(IJoinedSubclassMapping mapping, Object argument) {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentJoinedSubclassMapping")); //$NON-NLS-1$
-// }
-
-// public Object visitUnionSubclassMapping(IUnionSubclassMapping mapping, Object argument) {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentUnionSubclassMapping")); //$NON-NLS-1$
-// }
-
-// public Object visitPropertyMapping(IPropertyMapping mapping, Object argument) {
-// if (mapping != null){
-// IHibernateValueMapping valueMapping = mapping.getValue();
-// if (valueMapping != null) return valueMapping.accept(this, argument);
-// }
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.PersistentFieldNot_mapped")); //$NON-NLS-1$
-// }
-
- // add tau 27.07.2005
-// public Object visitNamedQueryMapping(INamedQueryMapping mapping, Object argument) {
-// return ViewPlugin.getImageDescriptor(BUNDLE.getString("OrmModelImageVisitor.NamedQueryMapping")); //$NON-NLS-1$
-// }
-
public Object visitDatabaseColumn(Column column, Object argument) {
- // TODO Auto-generated method stub
return null;
}
@@ -376,22 +82,18 @@
}
public Object accept(UnionSubclass arg0) {
- // TODO Auto-generated method stub
return null;
}
public Object accept(SingleTableSubclass arg0) {
- // TODO Auto-generated method stub
return null;
}
public Object accept(JoinedSubclass arg0) {
- // TODO Auto-generated method stub
return null;
}
public Object accept(Subclass arg0) {
- // TODO Auto-generated method stub
return null;
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmModelNameVisitor.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmModelNameVisitor.java 2007-07-05 12:01:50 UTC (rev 2313)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/OrmModelNameVisitor.java 2007-07-05 12:10:59 UTC (rev 2314)
@@ -1,14 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * 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
*
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.view.views;
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.ui.view.views;
import java.sql.Types;
import java.util.ResourceBundle;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ViewsAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ViewsAction.java 2007-07-05 12:01:50 UTC (rev 2313)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/view/views/ViewsAction.java 2007-07-05 12:10:59 UTC (rev 2314)
@@ -1,118 +1,29 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * 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
*
- * Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.view.views;
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.ui.view.views;
import java.util.HashMap;
import java.util.ResourceBundle;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.ide.IDE;
-import org.jboss.tools.hibernate.view.ViewPlugin;
+import org.jboss.tools.hibernate.ui.view.ViewPlugin;
public class ViewsAction {
-
- //TODO (tau-tau) for Exception ALL
-
-// static ActionOrmTree hibernateConnectionWizardAction;
-// static ActionOrmTree hibernateAddMappingWizardAction;
-// static ActionOrmTree persistentClassesWizardAction;
-// static ActionOrmTree fieldMappingWizardAction;
- //akuzmin 06.10.2005
-// static ActionOrmTree fieldMappingWizardNewAction;
-//
-// static ActionOrmTree tablesClassesWizardAction;
-// static ActionOrmTree mappingWizardAction;
-// static ActionOrmTree cacheWizardAction;
-//
-// static ActionOrmTree clearPackageMappingAction;
-// static ActionOrmTree clearClassMappingAction;
-// static ActionOrmTree clearFieldMappingAction;
-//
-// static ActionOrmTree removeClassAction;
-//
-// static ActionOrmTree classAutoMappingAction;
-// static ActionOrmTree packageAutoMappingAction;
-//
-// static ActionOrmTree autoMappingSettingAction;
-// static ActionOrmTree runTimeSettingAction;
-
- // add 22.04.2005
-// static ActionOrmTree generateDDLWizard;
-
- // add 23.05.2005
-// static ActionOrmTree refactoringDialogClassAction;
-// static ActionOrmTree refactoringDialogFieldAction;
-// static ActionOrmTree fetchStrategyWizardAction;
-// static ActionOrmTree collapseAllAction;
-// static ActionOrmTree expandAllAction;
-
- // add 24.05.2005
-// static ActionOrmTree refreshMappingAction;
-// static ActionOrmTree renameTableObjectAction;
-// static ActionOrmTree addColumnDialogAction;
-// static ActionOrmTree removeTableAction;
-
- // add 26.05.2005
-// static ActionOrmTree renameTableObjectDialogForColumnAction;
-
- // add 31.05.2005
-// static ActionOrmTree addMappingStorageAction;
-
- // add 03.06.2005
-// static ActionOrmTree columnPropertyDialogAction;
-// static ActionOrmTree viewTableAction;
-
- // add 16.06.2005
-// static ActionOrmTree refreshOrmProjectAction;
-
- // 20050618 <yan>
-// static ActionOrmTree removeClassesAction;
-
-// static ActionOrmTree removeConfigAction;
- //</yan>
-
- // 20050620 <yan>
-// static ActionOrmTree openSourceAction;
-// static ActionOrmTree openMappingStorageAction;
-// static ActionOrmTree openMappingAction;
- // </yan>
-
- // 20050727 <yan>
-// static ActionOrmTree editNamedQueryAction,addNamedQueryAction,removeNamedQueryAction,testQueryAction;
- // </yan>
-
- // add tau 12.07.2005
-// static ActionOrmTree refreshSchemaMappingAction;
-
- // add tau 20.07.2005
-// static ActionOrmTree refreshClassSchemaMappingAction;
-// static ActionOrmTree refreshPackageSchemaMappingAction;
-// static ActionOrmTree refreshMappingSchemaMappingAction;
-
- // add tau 26.07.2005
-// static ActionOrmTree refreshDatabaseTableSchemaMappingAction;
- //akuzmin 16.08.2005
-// static ActionOrmTree GenerateDAOWizardAction;
- // #added# by Konstantin Mishin on 25.03.2006 fixed for ESORM-28
static ActionOrmTree openEditorAction;
- // #added#
- // add 09.03.2005
static private ResourceBundle BUNDLE_IMAGE = ViewPlugin.BUNDLE_IMAGE;
static private ResourceBundle BUNDLE = ResourceBundle.getBundle(ViewsAction.class.getPackage().getName() + ".views");
- // added by yk 12.09.2005.
-// static ActionOrmTree showHibernateConsole;
-
static {
openEditorAction = new ActionOrmTree() {
HashMap<Object,ObjectEditorInput> hashMap = new HashMap<Object,ObjectEditorInput>();
@@ -123,7 +34,7 @@
hashMap.put(this.getViewer().getTree().getSelection()[0].getData(), input);
}
try {
- IDE.openEditor(ViewPlugin.getPage(),input ,"org.jboss.tools.hibernate.veditor.editors.vizualeditor");
+ IDE.openEditor(ViewPlugin.getPage(),input ,"org.jboss.tools.hibernate.ui.veditor.editors.visualeditor");
} catch (PartInitException e) {
// ExceptionHandler.logThrowableError(e,"OpenEditor");
}
@@ -131,89 +42,5 @@
};
openEditorAction.setText(BUNDLE.getString("Explorer.OpenEditorActionName"));
openEditorAction.setToolTipText(BUNDLE.getString("Explorer.OpenEditorActionToolTipText"));
- // #added#
}
-
- /**
- * @return IOrmProject
- */
-// static private IOrmProject getOrmProject(Tree tree) {
-// TreeItem[] items = tree.getSelection();
-//
-// // 20050623 <yan>
-// if (items.length==0) return null;
-// // </yan>
-//
-// TreeItem parentItem = items[0];
-// TreeItem ormItem;
-// do {
-// ormItem = parentItem;
-// parentItem = parentItem.getParentItem();
-// } while (parentItem != null);
-// return (IOrmProject)ormItem.getData();
-// }
-
- // #added# by Konstantin Mishin on 11.09.2005 fixed for ORMIISTUD-660
-// static private void traverse(IContainer container, HashSet<Object> hs, HBMViewerFilter vf) {
-// try {
-// IResource[] resources = container.members();
-// for (int i = 0; i < resources.length; i++) {
-// IResource resource = resources[i];
-// if (resource instanceof IFile) {
-// String ext = resource.getName();
-// if ((ext != null && (ext.toLowerCase().endsWith(".hbm") || ext.toLowerCase().endsWith(".hbm.xml"))) && vf.isSelectedMappingStorage(resource) && vf.isSrc(resource.getFullPath().toString())) {
-// hs.add(resource);
-// }
-// } else if (resource.isAccessible() && resource instanceof IContainer) {
-// traverse((IContainer)resource, hs, vf);
-// }
-// }
-// } catch (CoreException e) {
-// ExceptionHandler.logThrowableError(e, null);
-// }
-// }
- // #added#
-
- // yan 2005.09.22
-// static private void removePersistentClass(IPersistentClass pc, boolean delSource, boolean delMapping, HashSet<IMapping> refrMaps) throws CoreException {
-// if (!delMapping) {
-// pc.getProjectMapping().removePersistentClass(pc.getName(),false);
-// refrMaps.add(pc.getProjectMapping());
-// } else {
-// IMapping[] maps = ClassUtils.getReferencedMappings(pc);
-// for(int i=0; i<maps.length; i++) {
-//
-// maps[i].removePersistentClass(pc.getName(),true);
-// refrMaps.add(maps[i]);
-//
-// }
-//
-// }
-// }
- // yan
- // yan 2005.09.22
-// static private void clearPersistentClassMapping(IPersistentClass pc, HashSet<IMapping> refrMaps) throws CoreException {
-// IMapping[] maps = ClassUtils.getReferencedMappings(pc);
-// for(int i = 0; i < maps.length; i++) {
-// IPersistentClass tpc = maps[i].findClass(pc.getName());
-// if (tpc!=null) {
-// tpc.clearMapping();
-// refrMaps.add(maps[i]);
-// }
-// }
-// }
-
-// static private void refreshMappings(HashSet refrMaps) {
-// for(Iterator it=refrMaps.iterator(); it.hasNext();) {
-// try {
-// ((IMapping)it.next()).save();
-// } catch (IOException e) {
-// ExceptionHandler.logThrowableError(e,"Save project's mapping.");
-// } catch (CoreException e) {
-// ExceptionHandler.logThrowableWarning(e,"Save project's mapping.");
-// }
-// }
-// }
- // yan
-
}
17 years, 6 months
JBoss Tools SVN: r2313 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts.
by jbosstools-commits@lists.jboss.org
Author: mdryakhlenkov
Date: 2007-07-05 08:01:50 -0400 (Thu, 05 Jul 2007)
New Revision: 2313
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ComponentShapeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ConnectionEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/Messages.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmEditPartFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmShapeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ResourceManager.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/messages.properties
Log:
JBIDE-559: Hibernate diagram editor cleanup
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ComponentShapeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ComponentShapeEditPart.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ComponentShapeEditPart.java 2007-07-05 12:01:50 UTC (rev 2313)
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * 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.veditor.editors.parts;
+
+import java.beans.PropertyChangeEvent;
+import java.util.List;
+
+import org.eclipse.draw2d.FocusBorder;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.swt.graphics.RGB;
+import org.jboss.tools.hibernate.ui.veditor.editors.figures.ComponentFigure;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.ComponentShape;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmDiagram;
+
+
+public class ComponentShapeEditPart extends ExpandeableShapeEditPart {
+
+ protected IFigure createFigure() {
+ if (getModel() instanceof ComponentShape) {
+ IFigure figure = new ComponentFigure();
+ figure.setLayoutManager(new ToolbarLayout());
+ Label label = new Label();
+ label.setText(ormLabelProvider.getText(getCastedModel().getOrmElement()));
+ label.setBackgroundColor(getColor());
+ label.setOpaque(true);
+ label.setIcon(ormLabelProvider.getImage(getCastedModel().getOrmElement()));
+ label.setLabelAlignment(PositionConstants.LEFT);
+ label.setBorder(new MarginBorder(1,2,1,2));
+ figure.add(label,-2);
+ figure.setBorder(new FocusBorder());
+ figure.setSize(-1,-1);
+ return figure;
+ } else {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ public void performRequest(Request req) {
+ if(RequestConstants.REQ_OPEN.equals(req.getType()) && getModel() instanceof ComponentShape) {
+ ((ComponentShape)getModel()).refreshChildsHiden(((OrmDiagram)getViewer().getContents().getModel()));
+ }
+ }
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ String prop = evt.getPropertyName();
+ if (ComponentShape.SET_CHILDS_HIDEN.equals(prop)) {
+ int i = figure.getPreferredSize().width;
+ ((ComponentFigure)figure).setChildsHiden(((Boolean)evt.getNewValue()).booleanValue());
+ if(((Boolean)evt.getNewValue()).booleanValue())
+ figure.setSize(i,-1);
+ else
+ figure.setSize(-1,-1);
+
+ refresh();
+// ((OrmDiagram)getParent().getModel()).setDirty(true);
+ } else {
+ super.propertyChange(evt);
+ }
+ }
+
+ protected void refreshVisuals() {
+ Rectangle bounds = null;
+ if (getModel() instanceof ComponentShape) {
+ bounds = new Rectangle(new Point(0,0), getFigure().getSize());
+ }
+ if (bounds != null) ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), bounds);
+ }
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ConnectionEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ConnectionEditPart.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ConnectionEditPart.java 2007-07-05 12:01:50 UTC (rev 2313)
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * 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.veditor.editors.parts;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PolygonDecoration;
+import org.eclipse.draw2d.PolylineConnection;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.editparts.AbstractConnectionEditPart;
+import org.eclipse.gef.editpolicies.SelectionEditPolicy;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.hibernate.mapping.Column;
+import org.hibernate.mapping.Component;
+import org.hibernate.mapping.Property;
+import org.hibernate.mapping.RootClass;
+import org.hibernate.mapping.SingleTableSubclass;
+import org.hibernate.mapping.Table;
+import org.jboss.tools.hibernate.ui.veditor.editors.figures.RoundPolylineConnection;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.Connection;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.ModelElement;
+
+
+
+class ConnectionEditPart extends AbstractConnectionEditPart
+implements PropertyChangeListener {
+
+ public void activate() {
+ if (!isActive()) {
+ super.activate();
+ ((ModelElement) getModel()).addPropertyChangeListener(this);
+ }
+ }
+
+ protected void createEditPolicies() {
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ShapesSelectionEditPolicy());
+ }
+
+ protected IFigure createFigure() {
+ PolylineConnection connection = new RoundPolylineConnection();
+ connection.setForegroundColor(getColor());
+ connection.setTargetDecoration(new PolygonDecoration());
+ connection.setVisible(!getCastedModel().isHiden());
+ return connection;
+ }
+
+ public void deactivate() {
+ if (isActive()) {
+ super.deactivate();
+ ((ModelElement) getModel()).removePropertyChangeListener(this);
+ }
+ }
+
+ public void propertyChange(PropertyChangeEvent event) {
+ String property = event.getPropertyName();
+ if (Connection.SHOW_SELECTION.equals(property))
+ getFigure().setForegroundColor(getSelectionColor());
+ else if (Connection.HIDE_SELECTION.equals(property))
+ getFigure().setForegroundColor(getColor());
+ else if (Connection.SET_HIDEN.equals(property))
+ getFigure().setVisible(!((Boolean)event.getNewValue()).booleanValue());
+ }
+
+ private Connection getCastedModel() {
+ return (Connection) getModel();
+ }
+
+ private Color getColor() {
+ Object element = getCastedModel().getTarget().getOrmElement();
+ if (element instanceof RootClass || element instanceof SingleTableSubclass)
+ return ResourceManager.getInstance().getColor(new RGB(210,155,100));
+ else if (element instanceof Column || element instanceof Table || element instanceof Property)
+ return ResourceManager.getInstance().getColor(new RGB(160, 160, 160));
+ else
+ throw new IllegalArgumentException();
+ }
+
+ private Color getSelectionColor() {
+ if (getCastedModel().getTarget().getOrmElement() instanceof RootClass)
+ return ResourceManager.getInstance().getColor(new RGB(112,161,99));
+ else if (getCastedModel().getTarget().getOrmElement() instanceof Column ||
+ getCastedModel().getTarget().getOrmElement() instanceof Table ||
+ getCastedModel().getTarget().getOrmElement() instanceof Component)
+ return ResourceManager.getInstance().getColor(new RGB(66,173,247));
+ else
+ throw new IllegalArgumentException();
+ }
+
+ private class ShapesSelectionEditPolicy extends SelectionEditPolicy {
+
+ protected void hideSelection() {
+ getCastedModel().hideSelection();
+ }
+
+ protected void showSelection() {
+ getCastedModel().showSelection();
+ }
+
+ }
+}
\ No newline at end of file
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java 2007-07-05 12:01:50 UTC (rev 2313)
@@ -0,0 +1,435 @@
+/*******************************************************************************
+ * 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.veditor.editors.parts;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.ConnectionLayer;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.FreeformLayer;
+import org.eclipse.draw2d.FreeformLayout;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.ManhattanConnectionRouter;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.DefaultEditDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.editpolicies.XYLayoutEditPolicy;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gef.requests.CreateRequest;
+import org.hibernate.mapping.Collection;
+import org.hibernate.mapping.Component;
+import org.hibernate.mapping.RootClass;
+import org.hibernate.mapping.Table;
+import org.jboss.tools.hibernate.ui.veditor.editors.VisualEditor;
+import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.AutoLayout;
+import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.IItemInfo;
+import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.ILinkInfo;
+import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.IDiagramInfo;
+import org.jboss.tools.hibernate.ui.veditor.editors.command.ShapeSetConstraintCommand;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.Connection;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.ModelElement;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmDiagram;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmShape;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.Shape;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.SpecialOrmShape;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.SpecialRootClass;
+
+class DiagramEditPart extends OrmEditPart implements PropertyChangeListener {
+
+ protected void createEditPolicies() {
+ installEditPolicy(EditPolicy.LAYOUT_ROLE,
+ new ShapesXYLayoutEditPolicy());
+ }
+
+ protected IFigure createFigure() {
+ Figure f = new FreeformLayer();
+ f.setBorder(new MarginBorder(3));
+ f.setLayoutManager(new FreeformLayout());
+
+ ConnectionLayer connLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
+ connLayer.setConnectionRouter(new ManhattanConnectionRouter());
+
+ return f;
+ }
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ String prop = evt.getPropertyName();
+ if (OrmDiagram.REFRESH.equals(prop)) {
+ refresh();
+ autolayout();
+ // restore();
+ } else if (OrmDiagram.DIRTY.equals(prop))
+ ((VisualEditor) ((DefaultEditDomain) getViewer().getEditDomain())
+ .getEditorPart()).refreshDirty();
+ }
+
+ public void restore() {
+ boolean dirty = getCastedModel().isDirty();
+ HashMap hashMap = getCastedModel().getCloneElements();
+ String childrenLocations[] = getCastedModel().getChildrenLocations();
+ int tempPoint = 1;
+ OrmShape ormShape;
+ int point = 1;
+ int pointX = calculateTableLocation();
+ String string, xy[];
+ for (int i = 0; i < childrenLocations.length; i++)
+ if (childrenLocations[i].indexOf('@') != -1
+ && childrenLocations[i].indexOf(';') != -1) {
+ string = childrenLocations[i].substring(0, childrenLocations[i]
+ .indexOf('@'));
+ ormShape = (OrmShape) hashMap.remove(string);
+ if (ormShape != null) {
+ string = childrenLocations[i]
+ .substring(childrenLocations[i].indexOf('@') + 1);
+ xy = string.split(";");
+ if (xy.length > 1)
+ try {
+ ormShape.setLocation(new Point(Integer
+ .parseInt(xy[0]), Integer.parseInt(xy[1])));
+ } catch (NumberFormatException e) {
+ }
+ if (xy.length > 2)
+ if ((new Boolean(xy[2])).booleanValue())
+ ormShape.refreshHiden();
+ tempPoint = ormShape.getLocation().y
+ + getChildrenFigurePreferredHeight(ormShape) + 20;
+ if (tempPoint > point)
+ point = tempPoint;
+ }
+ }
+ if (getCastedModel().getOrmElement() instanceof RootClass) {
+ RootClass persistentClass = (RootClass) getCastedModel()
+ .getOrmElement();
+ ormShape = (OrmShape) hashMap
+ .remove(persistentClass.getClassName());
+ if (ormShape != null) {
+ ormShape.setLocation(new Point(20, 20));
+ tempPoint = 40 + getChildrenFigurePreferredHeight(ormShape);
+ }
+ Table table = persistentClass.getTable();
+ ormShape = (OrmShape) hashMap.remove(table.getSchema() + "."
+ + table.getName());
+ if (ormShape != null) {
+ ormShape.setLocation(new Point(pointX, 20));
+ point = 40 + getChildrenFigurePreferredHeight(ormShape);
+ }
+ if (tempPoint > point)
+ point = tempPoint;
+
+ }
+ Object objects[] = hashMap.keySet().toArray();
+ for (int i = 0; i < objects.length; i++) {
+ ormShape = (OrmShape) hashMap.get(objects[i]);
+ if (ormShape != null
+ && (ormShape.getOrmElement() instanceof RootClass || ormShape
+ .getOrmElement() instanceof SpecialOrmShape)) {
+ ormShape.setLocation(new Point(20, point));
+ tempPoint = point + getChildrenFigurePreferredHeight(ormShape)
+ + 20;
+ // if (ormShape.getOrmElement() instanceof SpecialRootClass) {
+ Component component = (Component) ((Collection) ((SpecialRootClass) (ormShape
+ .getOrmElement())).getProperty().getValue())
+ .getElement();
+ Table ownerTable = component.getOwner().getTable();
+ ormShape = (OrmShape) hashMap.remove(ownerTable.getSchema()
+ + "." + ownerTable.getName());
+ // }
+ // if (ormShape != null ) {
+ // ormShape.setLocation(new Point(pointX,point));
+ // point = point + getChildrenFigurePreferredHeight(ormShape) +
+ // 20;
+ // }
+ if (tempPoint > point)
+ point = tempPoint;
+ }
+ }
+ Iterator iterator = hashMap.values().iterator();
+ while (iterator.hasNext()) {
+ ormShape = (OrmShape) iterator.next();
+ if (ormShape.getOrmElement() instanceof Table) {
+ ormShape.setLocation(new Point(pointX, point));
+ point = point + getChildrenFigurePreferredHeight(ormShape) + 20;
+ }
+ }
+ getCastedModel().setDirty(dirty);
+ }
+
+ private OrmDiagram getCastedModel() {
+ return (OrmDiagram) getModel();
+ }
+
+ private int getChildrenFigurePreferredHeight(OrmShape ormShape) {
+ GraphicalEditPart part;
+ for (int i = 0; i < getChildren().size(); i++) {
+ part = (GraphicalEditPart) getChildren().get(i);
+ if (ormShape.equals(part.getModel()))
+ return part.getFigure().getPreferredSize().height;
+ }
+ return 0;
+ }
+
+ private int calculateTableLocation() {
+ int j = 0;
+ IFigure figure;
+ for (int i = 0; i < getFigure().getChildren().size(); i++) {
+ figure = (IFigure) getFigure().getChildren().get(i);
+ if (figure.getPreferredSize().width > j)
+ j = figure.getPreferredSize().width;
+ }
+ return j + 120;
+ }
+
+ protected List getModelChildren() {
+ return getCastedModel().getChildren();
+ }
+
+ public void activate() {
+ if (!isActive()) {
+ super.activate();
+ ((ModelElement) getModel()).addPropertyChangeListener(this);
+ autolayout();
+ // restore();
+ }
+ }
+
+ public void autolayout() {
+ IDiagramInfo process = new DiagramInfo(getCastedModel());
+ AutoLayout layout = new AutoLayout();
+ layout.setGridStep("" + 5);
+ layout.setOverride(true);
+ layout.setProcess(process);
+ }
+
+ public void setToFront(EditPart ep) {
+ int index = getChildren().indexOf(ep);
+ if (index == -1)
+ return;
+ if (index != getChildren().size() - 1)
+ reorderChild(ep, getChildren().size() - 1);
+ }
+
+ public void deactivate() {
+ if (isActive()) {
+ super.deactivate();
+ ((ModelElement) getModel()).removePropertyChangeListener(this);
+ }
+ }
+
+ private static class ShapesXYLayoutEditPolicy extends XYLayoutEditPolicy {
+
+ protected Command createChangeConstraintCommand(
+ ChangeBoundsRequest request, EditPart child, Object constraint) {
+ if (child instanceof OrmShapeEditPart
+ && constraint instanceof Rectangle) {
+ return new ShapeSetConstraintCommand((OrmShape) child
+ .getModel(), request, ((Rectangle) constraint)
+ .getLocation());
+ }
+ return super.createChangeConstraintCommand(request, child,
+ constraint);
+ }
+
+ protected Command createAddCommand(EditPart child, Object constraint) {
+ return null;
+ }
+
+ protected Command createChangeConstraintCommand(EditPart child,
+ Object constraint) {
+ return null;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+
+ protected Command getDeleteDependantCommand(Request request) {
+ return null;
+ }
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ return new NonResizableEditPolicy();
+ }
+ }
+
+
+class DiagramInfo implements IDiagramInfo {
+
+ ArrayList items = new ArrayList();
+ OrmDiagram diagram;
+
+ public DiagramInfo(OrmDiagram diagram) {
+ IItemInfo item;
+ this.diagram = diagram;
+
+ for (int i = 0; i < diagram.getChildren().size(); i++) {
+ item = new DiagramElementInfo((OrmShape) diagram.getChildren().get(
+ i));
+ addItem(item);
+ }
+ }
+
+ /**
+ *
+ */
+ public IItemInfo[] getItems() {
+ return (IItemInfo[]) items.toArray(new IItemInfo[0]);
+ }
+
+ /**
+ *
+ * @param item
+ */
+ public void addItem(IItemInfo item) {
+ items.add(item);
+ }
+
+ class DiagramElementInfo implements IItemInfo {
+ OrmShape element;
+
+ ArrayList links = new ArrayList();
+
+ /**
+ *
+ * @param element
+ */
+ public DiagramElementInfo(OrmShape element) {
+ ILinkInfo link;
+ this.element = element;
+ for (int i = 0; i < element.getSourceConnections().size(); i++) {
+ link = new LinkInfo((Connection) element.getSourceConnections()
+ .get(i));
+ addLink(link);
+ }
+ Shape child;
+ for (int j = 0; j < element.getChildren().size(); j++) {
+ child = (Shape) element.getChildren().get(j);
+ if (child.getSourceConnections().size() == 0) {
+ link = new LinkInfo(getID());
+ addLink(link);
+ }
+ for (int i = 0; i < child.getSourceConnections().size(); i++) {
+ link = new LinkInfo((Connection) child
+ .getSourceConnections().get(i));
+ addLink(link);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ public String getID() {
+ return element.toString();
+ }
+
+ /**
+ *
+ */
+ public boolean isComment() {
+ return false;
+ }
+
+ /**
+ *
+ */
+ public int[] getShape() {
+ int[] shape = new int[4];
+ shape[0] = element.getLocation().x;
+ shape[1] = element.getLocation().y;
+ OrmShapeEditPart part = (OrmShapeEditPart)getViewer().getEditPartRegistry().get(element);
+ if(part != null){
+ IFigure fig = part.getFigure();
+ shape[2] = fig.getPreferredSize().width;
+ shape[3] = fig.getPreferredSize().height;
+ }else{
+ shape[2] = 600;
+ shape[3] = 100;
+ }
+ return shape;
+ }
+
+ /**
+ *
+ */
+ public ILinkInfo[] getLinks() {
+ return (ILinkInfo[]) links.toArray(new ILinkInfo[0]);
+ }
+
+ /**
+ *
+ * @param link
+ */
+ public void addLink(ILinkInfo link) {
+ links.add(link);
+ }
+
+ /**
+ *
+ */
+ public void setShape(int[] s) {
+ element.setLocation(new Point(s[0], s[1]));
+ }
+
+ }
+
+ class LinkInfo implements ILinkInfo {
+ Connection link = null;
+
+ String id = null;
+
+ /**
+ *
+ * @param link
+ */
+ public LinkInfo(Connection link) {
+ this.link = link;
+ }
+
+ /**
+ *
+ * @param id
+ */
+ public LinkInfo(String id) {
+ this.id = id;
+ }
+
+ /**
+ *
+ */
+ public String getTargetID() {
+ if (id != null)
+ return id;
+ if (link.getTarget() != null)
+ return link.getTarget().toString();
+ else
+ return "";
+ }
+
+ /**
+ *
+ */
+ public void setLinkShape(int[] vs) {
+ }
+ }
+}}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java 2007-07-05 12:01:50 UTC (rev 2313)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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.veditor.editors.parts;
+
+import java.beans.PropertyChangeEvent;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.swt.graphics.RGB;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.ExpandeableShape;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.Shape;
+
+
+public class ExpandeableShapeEditPart extends ShapeEditPart {
+
+ public void performRequest(Request req) {
+ if(RequestConstants.REQ_OPEN.equals(req.getType())) {
+ ((ExpandeableShape)getModel()).refreshReferences(getViewer().getContents().getModel());
+ }
+ }
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ String prop = evt.getPropertyName();
+ if (Shape.SHOW_SELECTION.equals(prop)) {
+ if(getFigure().getChildren().size() > 0){
+ ((IFigure)getFigure().getChildren().get(0)).setBackgroundColor(getSelectionColor());
+ ((IFigure)getFigure().getChildren().get(0)).setForegroundColor(ResourceManager.getInstance().getColor(new RGB(255,255,255)));
+ }
+ } else if (Shape.HIDE_SELECTION.equals(prop)) {
+ if(getFigure().getChildren().size() > 0){
+ ((IFigure)getFigure().getChildren().get(0)).setBackgroundColor(getColor());
+ ((IFigure)getFigure().getChildren().get(0)).setForegroundColor(ResourceManager.getInstance().getColor(new RGB(0,0,0)));
+ }
+ }else if (ExpandeableShape.SHOW_REFERENCES.equals(prop)) {
+// ((IFigure)getFigure().getChildren().get(0)).setBackgroundColor(getSelectionColor());
+// ((IFigure)getFigure().getChildren().get(0)).setForegroundColor(ResourceManager.getInstance().getColor(new RGB(255,255,255)));
+ } else {
+ super.propertyChange(evt);
+ }
+ }
+
+ protected List getModelChildren() {
+ return ((ExpandeableShape)getModel()).getChildren();
+ }
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/Messages.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/Messages.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/Messages.java 2007-07-05 12:01:50 UTC (rev 2313)
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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.veditor.editors.parts;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.tools.hibernate.ui.veditor.editors.parts.messages"; //$NON-NLS-1$
+
+ private Messages() {
+ }
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ public static String Colors_PersistentClassR;
+
+ public static String Colors_PersistentClassG;
+
+ public static String Colors_PersistentClassB;
+
+ public static String Colors_PersistentFieldR;
+
+ public static String Colors_PersistentFieldG;
+
+ public static String Colors_PersistentFieldB;
+
+ public static String Colors_DatabaseTableR;
+
+ public static String Colors_DatabaseTableG;
+
+ public static String Colors_DatabaseTableB;
+
+ public static String Colors_DatabaseColumnR;
+
+ public static String Colors_DatabaseColumnG;
+
+ public static String Colors_DatabaseColumnB;
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmEditPart.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmEditPart.java 2007-07-05 12:01:50 UTC (rev 2313)
@@ -0,0 +1,168 @@
+/*******************************************************************************
+ * 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.veditor.editors.parts;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartListener;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+
+public class OrmEditPart extends AbstractGraphicalEditPart implements EditPartListener{
+
+ public void setModel(Object model) {
+ super.setModel(model);
+ addEditPartListener(this);
+ }
+
+ public void childAdded(EditPart child, int index) {
+ }
+
+ public void partActivated(EditPart editpart) {
+ }
+
+ public void partDeactivated(EditPart editpart) {
+ }
+
+ public void removingChild(EditPart child, int index) {
+ }
+
+ public void selectedStateChanged(EditPart editpart) {
+ if(this.getSelected() == EditPart.SELECTED_PRIMARY && OrmEditPart.this.getParent() instanceof DiagramEditPart) {
+ ((DiagramEditPart)OrmEditPart.this.getParent()).setToFront(this);
+ }
+ }
+
+ protected IFigure createFigure() {
+ return null;
+ }
+
+ protected void createEditPolicies() {
+ }
+
+ protected void refreshSourceConnections() {
+ int i;
+ org.eclipse.gef.ConnectionEditPart editPart;
+ Object model;
+
+ Map modelToEditPart = new HashMap();
+ List editParts = getSourceConnections();
+
+ for (i = 0; i < editParts.size(); i++) {
+ editPart = (ConnectionEditPart) editParts.get(i);
+ modelToEditPart.put(editPart.getModel(), editPart);
+ }
+
+ List modelObjects = getModelSourceConnections();
+ if (modelObjects == null)
+ modelObjects = new ArrayList();
+
+ for (i = 0; i < modelObjects.size(); i++) {
+ model = modelObjects.get(i);
+
+ if (i < editParts.size()) {
+ editPart = (ConnectionEditPart) editParts.get(i);
+ if (editPart.getModel() == model) {
+ if (editPart.getSource() != this)
+ editPart.setSource(this);
+ continue;
+ }
+ }
+
+ editPart = (ConnectionEditPart) modelToEditPart.get(model);
+ if (editPart != null)
+ reorderSourceConnection(editPart, i);
+ else {
+ editPart = createOrFindConnection(model);
+ addSourceConnection(editPart, i);
+ }
+ }
+
+ // Remove the remaining EditParts
+ List trash = new ArrayList();
+ for (; i < editParts.size(); i++)
+ trash.add(editParts.get(i));
+ for (i = 0; i < trash.size(); i++)
+ removeSourceConnection((ConnectionEditPart) trash.get(i));
+ }
+
+ protected void refreshTargetConnections() {
+ int i;
+ org.eclipse.gef.ConnectionEditPart editPart;
+ Object model;
+
+ Map mapModelToEditPart = new HashMap();
+ List connections = getTargetConnections();
+
+ for (i = 0; i < connections.size(); i++) {
+ editPart = (ConnectionEditPart) connections.get(i);
+ mapModelToEditPart.put(editPart.getModel(), editPart);
+ }
+
+ List modelObjects = getModelTargetConnections();
+ if (modelObjects == null)
+ modelObjects = new ArrayList();
+
+ for (i = 0; i < modelObjects.size(); i++) {
+ model = modelObjects.get(i);
+
+ if (i < connections.size()) {
+ editPart = (org.eclipse.gef.ConnectionEditPart) connections
+ .get(i);
+ if (editPart.getModel() == model) {
+ if (editPart.getTarget() != this)
+ editPart.setTarget(this);
+ continue;
+ }
+ }
+
+ editPart = (org.eclipse.gef.ConnectionEditPart) mapModelToEditPart
+ .get(model);
+ if (editPart != null)
+ reorderTargetConnection(editPart, i);
+ else {
+ editPart = createOrFindConnection(model);
+ addTargetConnection(editPart, i);
+ }
+ }
+
+ // Remove the remaining Connection EditParts
+ List trash = new ArrayList();
+ for (; i < connections.size(); i++)
+ trash.add(connections.get(i));
+ for (i = 0; i < trash.size(); i++)
+ removeTargetConnection((ConnectionEditPart) trash.get(i));
+ }
+
+ protected void removeSourceConnection(ConnectionEditPart connection) {
+ if (connection.getSource() != this)
+ return;
+ fireRemovingSourceConnection(connection, getSourceConnections()
+ .indexOf(connection));
+ connection.deactivate();
+ connection.setSource(null);
+ primRemoveSourceConnection(connection);
+ }
+
+ protected void removeTargetConnection(ConnectionEditPart connection) {
+ if (connection.getTarget() != this)
+ return;
+ fireRemovingTargetConnection(connection, getTargetConnections()
+ .indexOf(connection));
+ connection.setTarget(null);
+ primRemoveTargetConnection(connection);
+ }
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmEditPartFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmEditPartFactory.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmEditPartFactory.java 2007-07-05 12:01:50 UTC (rev 2313)
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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.veditor.editors.parts;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartFactory;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.ComponentShape;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.Connection;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.ExpandeableShape;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmDiagram;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmShape;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.Shape;
+
+
+public class OrmEditPartFactory implements EditPartFactory {
+
+
+ public EditPart createEditPart(EditPart context, Object modelElement) {
+ EditPart part = getPartForElement(modelElement);
+ part.setModel(modelElement);
+ return part;
+ }
+
+ private EditPart getPartForElement(Object modelElement) {
+ if (modelElement instanceof OrmDiagram) {
+ return new DiagramEditPart();
+ }
+ if (modelElement instanceof OrmShape) {
+ return new OrmShapeEditPart();
+ }
+ if (modelElement instanceof ComponentShape) {
+ return new ComponentShapeEditPart();
+ }
+ if (modelElement instanceof ExpandeableShape) {
+ return new ExpandeableShapeEditPart();
+ }
+ if (modelElement instanceof Shape) {
+ return new ShapeEditPart();
+ }
+ if (modelElement instanceof Connection) {
+ return new ConnectionEditPart();
+ }
+ throw new RuntimeException(
+ "Can't create part for model element: "
+ + ((modelElement != null) ? modelElement.getClass().getName() : "null"));
+ }
+
+}
\ No newline at end of file
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmShapeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmShapeEditPart.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmShapeEditPart.java 2007-07-05 12:01:50 UTC (rev 2313)
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * 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.veditor.editors.parts;
+
+import java.beans.PropertyChangeEvent;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+import org.hibernate.mapping.Bag;
+import org.hibernate.mapping.Collection;
+import org.hibernate.mapping.Component;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.Property;
+import org.hibernate.mapping.RootClass;
+import org.hibernate.mapping.SingleTableSubclass;
+import org.hibernate.mapping.Table;
+import org.jboss.tools.hibernate.ui.veditor.editors.figures.RoundLineBorder;
+import org.jboss.tools.hibernate.ui.veditor.editors.figures.TitleFigure;
+import org.jboss.tools.hibernate.ui.veditor.editors.figures.TitleLabel;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.ExpandeableShape;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmDiagram;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmShape;
+
+
+public class OrmShapeEditPart extends ExpandeableShapeEditPart{
+
+ protected IFigure createFigure() {
+ if (getModel() instanceof OrmShape) {
+ TitleFigure figure = new TitleFigure();
+ figure.setLayoutManager(new ToolbarLayout());
+ TitleLabel label = new TitleLabel();
+ String text = "";
+ Object element = getCastedModel().getOrmElement();
+ if (element instanceof RootClass) {
+ text = ormLabelProvider.getText((PersistentClass)element);
+ } else if (element instanceof Table) {
+ Table table = (Table)element;
+ text = table.getSchema() + "." + table.getName();
+ }
+ label.setText(text);
+ label.setIcon(ormLabelProvider.getImage(getCastedModel().getOrmElement()));
+ FontData fontData[] = Display.getCurrent().getSystemFont().getFontData();
+ fontData[0].setStyle(SWT.BOLD);
+ //fontData[0].height++;
+ label.setFont(ResourceManager.getInstance().getFont(fontData[0]));
+ label.setBackgroundColor(getColor());
+ label.setIcon(ormLabelProvider.getImage(getCastedModel().getOrmElement()));
+ label.setLabelAlignment(PositionConstants.LEFT);
+ label.setBorder(new MarginBorder(1,2,1,2));
+ figure.add(label,-2);
+ label.setOpaque(true);
+ figure.setBackgroundColor(getBackgroundColor());
+ RoundLineBorder border = new RoundLineBorder();
+ border.setColor(ResourceManager.getInstance().getColor(new RGB(160, 160, 160)));
+ figure.setBorder(border);
+ figure.setSize(-1,-1);
+ return figure;
+ } else {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ public void performRequest(Request req) {
+ if(RequestConstants.REQ_OPEN.equals(req.getType()) && getModel() instanceof OrmShape) {
+ ((OrmShape)getModel()).refreshHiden();
+ }
+ }
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ String prop = evt.getPropertyName();
+ if (OrmShape.LOCATION_PROP.equals(prop)) {
+ refreshVisuals();
+ ((OrmDiagram)getParent().getModel()).setDirty(true);
+ } else if (OrmShape.SET_HIDEN.equals(prop)) {
+ int i = figure.getPreferredSize().width;
+ ((TitleFigure)figure).setHiden(((Boolean)evt.getNewValue()).booleanValue());
+ ((TitleLabel)figure.getChildren().get(0)).setHiden(((Boolean)evt.getNewValue()).booleanValue());
+ if(((Boolean)evt.getNewValue()).booleanValue())
+ figure.setSize(i,-1);
+ else
+ figure.setSize(-1,-1);
+ refresh();
+ ((OrmDiagram)getParent().getModel()).setDirty(true);
+ } else {
+ super.propertyChange(evt);
+ }
+ }
+
+ protected void refreshVisuals() {
+ Rectangle bounds = null;
+ if (getModel() instanceof OrmShape) {
+ bounds = new Rectangle(((OrmShape)getModel()).getLocation(), getFigure().getSize());
+ }
+ if (bounds != null) ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), bounds);
+ }
+
+ protected Color getBackgroundColor() {
+ Object element = getCastedModel().getOrmElement();
+ if (element instanceof PersistentClass || element instanceof Component)
+ return ResourceManager.getInstance().getColor(new RGB(0,0,0));
+ else if (element instanceof Table || element instanceof Property)
+ return ResourceManager.getInstance().getColor(new RGB(
+ Integer.parseInt(Messages.Colors_DatabaseColumnR),
+ Integer.parseInt(Messages.Colors_DatabaseColumnG),
+ Integer.parseInt(Messages.Colors_DatabaseColumnB)));
+ else
+ throw new IllegalArgumentException();
+ }
+
+}
\ No newline at end of file
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ResourceManager.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ResourceManager.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ResourceManager.java 2007-07-05 12:01:50 UTC (rev 2313)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.veditor.editors.parts;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+
+public class ResourceManager {
+ private Map<RGB,Color> fColorTable = new HashMap<RGB,Color>(10);
+
+ private Map<FontData,Font> fFontTable = new HashMap<FontData,Font>(10);
+
+ private static ResourceManager resourceManager = new ResourceManager();
+
+ public static ResourceManager getInstance() {
+ return resourceManager;
+ }
+
+ private ResourceManager() {};
+
+ private void dispose() {
+ Iterator e = fColorTable.values().iterator();
+ while (e.hasNext())
+ ((Color) e.next()).dispose();
+ e = fFontTable.values().iterator();
+ while (e.hasNext())
+ ((Font) e.next()).dispose();
+ }
+ public Color getColor(RGB rgb) {
+ Color color = (Color) fColorTable.get(rgb);
+ if (color == null) {
+ color = new Color(Display.getCurrent(), rgb);
+ fColorTable.put(rgb, color);
+ }
+ return color;
+ }
+
+ public Font getFont(FontData fontData) {
+ Font font = (Font) fFontTable.get(fontData);
+ if (font == null) {
+ font = new Font(Display.getCurrent(), fontData);
+ fFontTable.put(fontData, font);
+ }
+ return font;
+ }
+
+ protected void finalize() throws Throwable {
+ dispose();
+ }
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java 2007-07-05 12:01:50 UTC (rev 2313)
@@ -0,0 +1,275 @@
+/*******************************************************************************
+ * 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.veditor.editors.parts;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.ChopboxAnchor;
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.NodeEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.gef.editpolicies.SelectionEditPolicy;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.hibernate.mapping.Any;
+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.RootClass;
+import org.hibernate.mapping.SimpleValue;
+import org.hibernate.mapping.Table;
+import org.jboss.tools.hibernate.ui.veditor.editors.figures.TitleFigure;
+import org.jboss.tools.hibernate.ui.veditor.editors.figures.TopLineBorder;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.Connection;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.ModelElement;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.Shape;
+import org.jboss.tools.hibernate.ui.veditor.editors.model.SpecialRootClass;
+import org.jboss.tools.hibernate.ui.view.views.OrmLabelProvider;
+import org.jboss.tools.hibernate.ui.view.views.OrmModelImageVisitor;
+import org.jboss.tools.hibernate.ui.view.views.OrmModelNameVisitor;
+
+
+public class ShapeEditPart extends
+OrmEditPart implements PropertyChangeListener, NodeEditPart {
+
+ static protected OrmLabelProvider ormLabelProvider =
+ new OrmLabelProvider(new OrmModelImageVisitor(), new OrmModelNameVisitor(null));
+
+ protected void createEditPolicies() {
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ShapesSelectionEditPolicy());
+ }
+
+
+ protected IFigure createFigure() {
+ if (getModel() instanceof Shape) {
+ Label label = new Label();
+ label.setText(ormLabelProvider.getText(getElement()));
+ label.setBackgroundColor(getColor());
+ label.setIcon(ormLabelProvider.getImage(getElement()));
+ label.setLabelAlignment(PositionConstants.LEFT);
+ label.setOpaque(true);
+ TopLineBorder border = new TopLineBorder(1,2+getCastedModel().getIndent(),1,2);
+ border.setColor(getOrmShapeEditPart().getColor());
+ label.setBorder(border);
+ return label;
+ } else {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ String prop = evt.getPropertyName();
+ if (Shape.SHOW_SELECTION.equals(prop)) {
+ getFigure().setBackgroundColor(getSelectionColor());
+ getFigure().setForegroundColor(ResourceManager.getInstance().getColor(new RGB(255,255,255)));
+ } else if (Shape.HIDE_SELECTION.equals(prop)) {
+ getFigure().setBackgroundColor(getColor());
+ getFigure().setForegroundColor(ResourceManager.getInstance().getColor(new RGB(0,0,0)));
+ } else if (Shape.SET_FOCUS.equals(prop)) {
+ getViewer().select(this);
+ getViewer().reveal(this);
+ }
+ refresh();
+ }
+
+ public void performRequest(Request req) {
+ if(RequestConstants.REQ_OPEN.equals(req.getType())) {
+// if (getCastedModel().getOrmElement() instanceof IDatabaseColumn) {
+ if (getCastedModel().getOrmElement() instanceof Column) {
+ if(getCastedModel().getTargetConnections().size() > 0)
+ ((Connection)getCastedModel().getTargetConnections().get(0)).getSource().setFocus();
+ } else {
+ if(getCastedModel().getSourceConnections().size() > 0)
+ ((Connection)getCastedModel().getSourceConnections().get(0)).getTarget().setFocus();
+ }
+ }
+ }
+
+ public void activate() {
+ if (!isActive()) {
+ super.activate();
+ ((ModelElement) getModel()).addPropertyChangeListener(this);
+ }
+ }
+
+ public void deactivate() {
+ if (isActive()) {
+ super.deactivate();
+ ((ModelElement) getModel()).removePropertyChangeListener(this);
+ }
+ }
+
+ protected Shape getCastedModel() {
+ return (Shape) getModel();
+ }
+
+ protected List getModelSourceConnections() {
+ return getCastedModel().getSourceConnections();
+ }
+
+ protected List getModelTargetConnections() {
+ return getCastedModel().getTargetConnections();
+ }
+
+ public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connection) {
+ return getConnectionAnchor();
+ }
+
+ public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connection) {
+ return getConnectionAnchor();
+ }
+
+ public ConnectionAnchor getSourceConnectionAnchor(Request request) {
+ return getConnectionAnchor();
+ }
+
+ public ConnectionAnchor getTargetConnectionAnchor(Request request) {
+ return getConnectionAnchor();
+ }
+
+ protected ConnectionAnchor getConnectionAnchor() {
+ ChopboxAnchor anchor = new ChopboxAnchor(getFigure()){
+ public Point getLocation(Point reference) {
+ Rectangle r = getOwner().getBounds().getCopy();
+ getOwner().translateToAbsolute(r);
+ if (getOwner() instanceof TitleFigure) {
+ r = ((IFigure)getOwner().getChildren().get(0)).getBounds().getCopy();
+ ((IFigure)getOwner().getChildren().get(0)).translateToAbsolute(r);
+ }
+ OrmShapeEditPart part = getOrmShapeEditPart();
+ Point p = r.getCenter();
+ if (reference.x < p.x)
+ p.x-=part.getFigure().getBounds().width/2;
+ else
+ p.x+=part.getFigure().getBounds().width/2;
+ return p;
+ }
+ };
+ return anchor;
+ }
+
+ private OrmShapeEditPart getOrmShapeEditPart() {
+ int i = 0;
+ EditPart part = this;
+ while (!((part instanceof OrmShapeEditPart))) {
+ part = part.getParent();
+ if(i++ > 4)
+ throw new RuntimeException();
+ }
+ return (OrmShapeEditPart)part;
+ }
+
+ protected Color getColor() {
+ Object element = getCastedModel().getOrmElement();
+ if (element instanceof PersistentClass || element instanceof Component)
+ return ResourceManager.getInstance().getColor(new RGB(
+ Integer.parseInt(Messages.Colors_PersistentClassR),
+ Integer.parseInt(Messages.Colors_PersistentClassG),
+ Integer.parseInt(Messages.Colors_PersistentClassB)));
+//R if (getCastedModel().getOrmElement() instanceof IPersistentField || getCastedModel().getOrmElement() instanceof IHibernateValueMapping)
+ else if (element instanceof Property || element instanceof SimpleValue)
+ return ResourceManager.getInstance().getColor(new RGB(
+ Integer.parseInt(Messages.Colors_PersistentFieldR),
+ Integer.parseInt(Messages.Colors_PersistentFieldG),
+ Integer.parseInt(Messages.Colors_PersistentFieldB)));
+//R else if (getCastedModel().getOrmElement() instanceof IDatabaseColumn)
+ else if (element instanceof Column)
+ return ResourceManager.getInstance().getColor(new RGB(
+ Integer.parseInt(Messages.Colors_DatabaseColumnR),
+ Integer.parseInt(Messages.Colors_DatabaseColumnG),
+ Integer.parseInt(Messages.Colors_DatabaseColumnB)));
+//R else if (getCastedModel().getOrmElement() instanceof IPersistentClass)
+//R else if (getCastedModel().getOrmElement() instanceof IDatabaseTable)
+ else if (element instanceof Table)
+ return ResourceManager.getInstance().getColor(new RGB(
+ Integer.parseInt(Messages.Colors_DatabaseTableR),
+ Integer.parseInt(Messages.Colors_DatabaseTableG),
+ Integer.parseInt(Messages.Colors_DatabaseTableB)));
+ else if (element instanceof DependantValue)
+ return ResourceManager.getInstance().getColor(new RGB(
+ Integer.parseInt(Messages.Colors_DatabaseTableR),
+ Integer.parseInt(Messages.Colors_DatabaseTableG),
+ Integer.parseInt(Messages.Colors_DatabaseTableB)));
+ else if (element instanceof OneToMany)
+ return ResourceManager.getInstance().getColor(new RGB(
+ Integer.parseInt(Messages.Colors_DatabaseTableR),
+ Integer.parseInt(Messages.Colors_DatabaseTableG),
+ Integer.parseInt(Messages.Colors_DatabaseTableB)));
+ else
+ throw new IllegalArgumentException();
+ }
+
+ protected Color getSelectionColor() {
+ if (getCastedModel().getOrmElement() instanceof PersistentClass ||
+ getCastedModel().getOrmElement() instanceof Property ||
+ getCastedModel().getOrmElement() instanceof SimpleValue ||
+ getCastedModel().getOrmElement() instanceof OneToMany)
+ return ResourceManager.getInstance().getColor(new RGB(112,161,99));
+ else if (getCastedModel().getOrmElement() instanceof Table || getCastedModel().getOrmElement() instanceof Column)
+ return ResourceManager.getInstance().getColor(new RGB(66,173,247));
+ else
+ throw new IllegalArgumentException();
+ }
+
+ private class ShapesSelectionEditPolicy extends SelectionEditPolicy {
+
+ protected void hideSelection() {
+ getCastedModel().hideSelection();
+ Iterator iter = getCastedModel().getSourceConnections().iterator();
+ while (iter.hasNext()) {
+ Connection element = (Connection) iter.next();
+ element.hideSelection();
+ }
+ iter = getCastedModel().getTargetConnections().iterator();
+ while (iter.hasNext()) {
+ Connection element = (Connection) iter.next();
+ element.hideSelection();
+ }
+ }
+
+ protected void showSelection() {
+ getCastedModel().showSelection();
+ Iterator iter = getCastedModel().getSourceConnections().iterator();
+ while (iter.hasNext()) {
+ Connection element = (Connection) iter.next();
+ element.showSelection();
+ }
+ iter = getCastedModel().getTargetConnections().iterator();
+ while (iter.hasNext()) {
+ Connection element = (Connection) iter.next();
+ element.showSelection();
+ }
+ }
+
+ }
+
+ private Object getElement() {
+ Object element = getCastedModel().getOrmElement();
+ if (element instanceof SpecialRootClass) element = (RootClass)element;
+ return element;
+ }
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/messages.properties
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/messages.properties (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/messages.properties 2007-07-05 12:01:50 UTC (rev 2313)
@@ -0,0 +1,12 @@
+Colors_PersistentClassR=255
+Colors_PersistentClassG=247
+Colors_PersistentClassB=206
+Colors_PersistentFieldR=255
+Colors_PersistentFieldG=255
+Colors_PersistentFieldB=239
+Colors_DatabaseTableR=222
+Colors_DatabaseTableG=231
+Colors_DatabaseTableB=239
+Colors_DatabaseColumnR=239
+Colors_DatabaseColumnG=247
+Colors_DatabaseColumnB=255
\ No newline at end of file
17 years, 6 months