Author: mdryakhlenkov
Date: 2007-07-05 08:46:35 -0400 (Thu, 05 Jul 2007)
New Revision: 2324
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties
Log:
JBIDE-559: Hibernate diagram editor cleanup
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java 2007-07-05
12:46:35 UTC (rev 2324)
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * 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);
+ }
+ }
+ }
+
+}
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties
(rev 0)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties 2007-07-05
12:46:35 UTC (rev 2324)
@@ -0,0 +1,96 @@
+#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