Author: dgeraskov
Date: 2008-01-11 03:46:03 -0500 (Fri, 11 Jan 2008)
New Revision: 5610
Removed:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingActionDelegate.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenSourceActionDelegate.java
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingAction.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/viewers/xpl/MTreeViewer.java
Log:
changed to jdk 1.4.
OpenMappingActionDelegate and OpenSourceActionDelegate removed as unnecessary
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingAction.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingAction.java 2008-01-11
07:29:01 UTC (rev 5609)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingAction.java 2008-01-11
08:46:03 UTC (rev 5610)
@@ -264,7 +264,7 @@
Cfg2HbmTool tool = new Cfg2HbmTool();
String[] patterns = new String[4];
- StringBuilder pattern = new StringBuilder("<");
+ StringBuffer pattern = new StringBuffer("<");
pattern.append(tool.getTag(persClass));
pattern.append("[\\s]+[.[^>]]*");
pattern.append(HIBERNATE_TAG_NAME);
@@ -273,7 +273,7 @@
pattern.append('\"');
patterns[0] = pattern.toString();
- pattern = new StringBuilder("<");
+ pattern = new StringBuffer("<");
pattern.append(tool.getTag(persClass));
pattern.append("[\\s]+[.[^>]]*");
pattern.append(HIBERNATE_TAG_NAME);
@@ -282,7 +282,7 @@
pattern.append('\"');
patterns[1] = pattern.toString();
- pattern = new StringBuilder("<");
+ pattern = new StringBuffer("<");
pattern.append(tool.getTag(persClass));
pattern.append("[\\s]+[.[^>]]*");
pattern.append(HIBERNATE_TAG_ENTITY_NAME);
@@ -291,7 +291,7 @@
pattern.append('\"');
patterns[2] = pattern.toString();
- pattern = new StringBuilder("<");
+ pattern = new StringBuffer("<");
pattern.append(tool.getTag(persClass));
pattern.append("[\\s]+[.[^>]]*");
pattern.append(HIBERNATE_TAG_ENTITY_NAME);
@@ -304,7 +304,7 @@
private static String generatePattern(Property property){
Cfg2HbmTool tool = new Cfg2HbmTool();
- StringBuilder pattern = new StringBuilder("<");
+ StringBuffer pattern = new StringBuffer("<");
if(property.getPersistentClass() != null &&
property.getPersistentClass().getIdentifierProperty()==property) {
pattern.append("id");
Deleted:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingActionDelegate.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingActionDelegate.java 2008-01-11
07:29:01 UTC (rev 5609)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingActionDelegate.java 2008-01-11
08:46:03 UTC (rev 5610)
@@ -1,70 +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.hibernate.eclipse.console.actions;
-
-import org.dom4j.Document;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.internal.ObjectPluginAction;
-import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.eclipse.console.HibernateConsolePlugin;
-import org.hibernate.eclipse.console.utils.ProjectUtils;
-import org.hibernate.mapping.RootClass;
-import org.hibernate.util.XMLHelper;
-
-/**
- * @author Dmitry Geraskov
- * @deprecated - Can't shine selected element in the Editor.
- * Use OpenMappingAction instead of this.
- */
-
-public class OpenMappingActionDelegate extends OpenActionDelegate {
- private static XMLHelper helper = new XMLHelper();
-
- public void run(IAction action) {
- ObjectPluginAction objectPluginAction = (ObjectPluginAction)action;
- TreeSelection selection = (TreeSelection)objectPluginAction.getSelection();
- RootClass rootClass = (RootClass)(selection).getFirstElement();
- ConsoleConfiguration consoleConfiguration =
(ConsoleConfiguration)((selection).getPaths()[0]).getSegment(0);
- openMapping(rootClass, consoleConfiguration);
- }
-
- static public void openMapping(RootClass rootClass,
- ConsoleConfiguration consoleConfiguration) {
- IJavaProject proj = ProjectUtils.findJavaProject(consoleConfiguration);
- java.io.File configXMLFile = consoleConfiguration.getPreferences().getConfigXMLFile();
- Document doc = OpenFileActionUtils.getDocument(consoleConfiguration, configXMLFile);
-// IResource resource = OpenFileActionUtils.getResource(consoleConfiguration, proj,
doc, configXMLFile, rootClass);
- IResource resource = OpenFileActionUtils.getResource(consoleConfiguration, proj,
configXMLFile, rootClass);
-
- if (resource == null) {
- String fullyQualifiedName = OpenFileActionUtils.getPersistentClassName(rootClass);
- try {
- resource = proj.findType(fullyQualifiedName).getResource();
- } catch (JavaModelException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("Can't find mapping
file.", e);
- }
- }
-
- if (resource != null && resource instanceof IFile){
- try {
-
OpenFileActionUtils.openEditor(HibernateConsolePlugin.getDefault().getActiveWorkbenchWindow().getActivePage(),
(IFile) resource);
- } catch (PartInitException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("Can't open
mapping or source file.", e);
- }
- }
- }
-}
\ No newline at end of file
Deleted:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenSourceActionDelegate.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenSourceActionDelegate.java 2008-01-11
07:29:01 UTC (rev 5609)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenSourceActionDelegate.java 2008-01-11
08:46:03 UTC (rev 5610)
@@ -1,61 +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.hibernate.eclipse.console.actions;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.internal.ObjectPluginAction;
-import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.eclipse.console.HibernateConsolePlugin;
-import org.hibernate.eclipse.console.utils.ProjectUtils;
-import org.hibernate.mapping.RootClass;
-
-/**
- * @author Dmitry Geraskov
- * @deprecated - Can't shine selected element in the Editor.
- * Use OpenSourceAction instead of this.
- */
-public class OpenSourceActionDelegate extends OpenActionDelegate {
-
- public void run(IAction action) {
- ObjectPluginAction objectPluginAction = (ObjectPluginAction)action;
- RootClass rootClass =
(RootClass)((TreeSelection)objectPluginAction.getSelection()).getFirstElement();
- ConsoleConfiguration consoleConfiguration =
(ConsoleConfiguration)(((TreeSelection)objectPluginAction.getSelection()).getPaths()[0]).getSegment(0);
- IJavaProject proj = ProjectUtils.findJavaProject(consoleConfiguration);
-
- IResource resource = null;
- String fullyQualifiedName = OpenFileActionUtils.getPersistentClassName(rootClass);
- try {
- IType type = proj.findType(fullyQualifiedName);
- if (type != null) resource = type.getResource();
- } catch (JavaModelException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("Can't find source
file.", e);
- }
-
- if (resource instanceof IFile){
- try {
-
OpenFileActionUtils.openEditor(HibernateConsolePlugin.getDefault().getActiveWorkbenchWindow().getActivePage(),
(IFile) resource);
- } catch (PartInitException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("Can't open source
file.", e);
- }
- }
- if (resource == null) {
- MessageDialog.openInformation(HibernateConsolePlugin.getDefault().getShell(),
"Open Source File", "Source file for class '" + fullyQualifiedName
+ "' not found.");
- }
- }
-}
\ No newline at end of file
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/viewers/xpl/MTreeViewer.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/viewers/xpl/MTreeViewer.java 2008-01-11
07:29:01 UTC (rev 5609)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/viewers/xpl/MTreeViewer.java 2008-01-11
08:46:03 UTC (rev 5610)
@@ -53,10 +53,10 @@
Object obj = null;
Class clazz = org.eclipse.jface.viewers.ColumnViewer.class;
try {
- Method hiddenMethod = clazz.getDeclaredMethod("isBusy");
+ Method hiddenMethod = clazz.getDeclaredMethod("isBusy", new Class[0]);
if (null != hiddenMethod) {
hiddenMethod.setAccessible(true);
- obj = hiddenMethod.invoke(this);
+ obj = hiddenMethod.invoke(this, new Object[0]);
}
} catch (IllegalArgumentException e) {
e.printStackTrace();
@@ -168,9 +168,9 @@
* the element
* @return Widget
*/
- protected ArrayList<Widget> internalFindItem(Item parent, Object element) {
+ protected ArrayList internalFindItem(Item parent, Object element) {
- ArrayList<Widget> ret = new ArrayList<Widget>();
+ ArrayList ret = new ArrayList();
// compare with node
Object data = parent.getData();
if (data != null) {
@@ -183,7 +183,7 @@
Item[] items = getChildren(parent);
for (int i = 0; i < items.length; i++) {
Item item = items[i];
- ArrayList<Widget> o = internalFindItem(item, element);
+ ArrayList o = internalFindItem(item, element);
if (null != o) {
ret.addAll(o);
}
@@ -198,17 +198,17 @@
if (null == root) {
return ret;
}
- ArrayList<Widget> res = new ArrayList<Widget>();
+ ArrayList res = new ArrayList();
Item[] items = getChildren(getControl());
if (items != null) {
for (int i = 0; i < items.length; i++) {
- ArrayList<Widget> o = internalFindItem(items[i], element);
+ ArrayList o = internalFindItem(items[i], element);
if (null != o) {
res.addAll(o);
}
}
}
- ret = res.toArray(ret);
+ ret = (Widget[])res.toArray(new Widget[0]);
return ret;
}