Author: mdryakhlenkov
Date: 2007-09-05 10:00:02 -0400 (Wed, 05 Sep 2007)
New Revision: 3459
Removed:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/Example.java
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Item.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Items.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialOrmShape.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/ShapeEditPart.java
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/views/OrmContentProvider.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ViewsAction.java
Log:
JBIDE-882: Clean out hibernate plugins code
Deleted:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/Example.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/Example.java 2007-09-05
13:55:01 UTC (rev 3458)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/Example.java 2007-09-05
14:00:02 UTC (rev 3459)
@@ -1,132 +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.veditor.editors.autolayout;
-
-import java.util.ArrayList;
-
-public class Example {
-
- public static IDiagramInfo generateRandomProcess(int nodeCount, int linkCount) {
- ProcessInfoImpl process = new ProcessInfoImpl();
- for (int i = 0; i < nodeCount; i++) {
- ItemInfoImpl item = new ItemInfoImpl();
- item.setID("n_" + i);
- process.addItem(item);
- }
- IItemInfo[] items = process.getItems();
- for (int i = 0; i < linkCount; i++) {
- int n1 = (int)(nodeCount * Math.random());
- int n2 = (int)(nodeCount * Math.random());
- String target = ((ItemInfoImpl)items[n2]).getID();
- LinkInfoImpl link = new LinkInfoImpl();
- link.setTargetID(target);
- ((ItemInfoImpl)items[n1]).addLink(link);
- }
- return process;
- }
-
- static void printProcess(IDiagramInfo process) {
- IItemInfo[] items = process.getItems();
- for (int i = 0; i < items.length; i++) printItem(items[i]);
- }
-
- static void printItem(IItemInfo item) {
- System.out.print(item.getID() + " (");
- int[] shape = item.getShape();
- for (int i = 0; i < shape.length; i++) {
- if(i > 0) System.out.print(",");
- System.out.print(shape[i]);
- }
- System.out.print(") -->");
- ILinkInfo[] links = item.getLinks();
- for (int i = 0; i < links.length; i++) {
- if(i > 0) System.out.print(",");
- System.out.print(links[i].getTargetID());
- }
- System.out.println("");
- }
-
- public static void main(String[] args) {
- IDiagramInfo process = generateRandomProcess(10, 17);
- System.out.println("Before Layout");
- printProcess(process);
- AutoLayout layout = new AutoLayout();
- layout.setGridStep("" + 8);
- layout.setOverride(true);
- layout.setProcess(process);
- System.out.println("After Layout");
- printProcess(process);
- }
-}
-
-class ProcessInfoImpl implements IDiagramInfo {
- ArrayList items = new ArrayList();
-
- public IItemInfo[] getItems() {
- return (IItemInfo[])items.toArray(new IItemInfo[0]);
- }
-
- public void addItem(IItemInfo item) {
- items.add(item);
- }
-
-}
-
-class ItemInfoImpl implements IItemInfo {
- String id = "";
- int[] shape = new int[0];
- ArrayList links = new ArrayList();
-
- public void setID(String id) {
- this.id = id;
- }
-
- public String getID() {
- return id;
- }
-
- public boolean isComment() {
- return false;
- }
-
- public int[] getShape() {
- return shape;
- }
-
- public ILinkInfo[] getLinks() {
- return (ILinkInfo[])links.toArray(new ILinkInfo[0]);
- }
-
- public void addLink(ILinkInfo link) {
- links.add(link);
- }
-
- public void setShape(int[] s) {
- this.shape = s;
- }
-
-}
-
-class LinkInfoImpl implements ILinkInfo {
- String target;
-
- public void setTargetID(String target) {
- this.target = target;
- }
-
- public String getTargetID() {
- return target;
- }
-
- public void setLinkShape(int[] vs) {
- }
-
-}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Item.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Item.java 2007-09-05
13:55:01 UTC (rev 3458)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Item.java 2007-09-05
14:00:02 UTC (rev 3459)
@@ -72,9 +72,6 @@
}
public void print() {
-// StringBuffer sb = new StringBuffer();
-/// sb.append(object.getPathPart() + " " + n + " g = " + group
+ " ix = " + ix + " iy = " + iy);
-/// System.out.println(sb.toString());
}
public boolean isComment() {
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Items.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Items.java 2007-09-05
13:55:01 UTC (rev 3458)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Items.java 2007-09-05
14:00:02 UTC (rev 3459)
@@ -12,6 +12,7 @@
import java.util.*;
+import org.jboss.tools.hibernate.ui.veditor.VisualEditorPlugin;
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;
@@ -38,7 +39,7 @@
public void setProcess(IDiagramInfo process) {
this.process = process;
- try { load(); } catch (Exception e) { e.printStackTrace(); }
+ try { load(); } catch (Exception e) {
VisualEditorPlugin.getPluginLog().logError(e); }
}
private void load() {
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-09-05
13:55:01 UTC (rev 3458)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-09-05
14:00:02 UTC (rev 3459)
@@ -607,7 +607,7 @@
FileOutputStream fos = new FileOutputStream(file);
properties.store(fos, "");
} catch (IOException e) {
- VisualEditorPlugin.getDefault().logError("Can't save layout of
mapping.", e);
+ VisualEditorPlugin.getPluginLog().logError("Can't save layout of
mapping.", e);
}
}
@@ -624,7 +624,7 @@
file.create(source, true, null);
}
} catch (CoreException e) {
- VisualEditorPlugin.getDefault().logError(e);
+ VisualEditorPlugin.getPluginLog().logError(e);
}
}
return file;
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialOrmShape.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialOrmShape.java 2007-09-05
13:55:01 UTC (rev 3458)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialOrmShape.java 2007-09-05
14:00:02 UTC (rev 3459)
@@ -14,6 +14,7 @@
import org.hibernate.mapping.Property;
import org.hibernate.mapping.RootClass;
+import org.jboss.tools.hibernate.ui.veditor.VisualEditorPlugin;
public class SpecialOrmShape extends OrmShape {
private Shape parentShape;
@@ -49,6 +50,7 @@
}
getChildren().add(bodyOrmShape);
} catch (Exception e) {
+ VisualEditorPlugin.getPluginLog().logError(e);
}
}
}
Modified:
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 2007-09-05
13:55:01 UTC (rev 3458)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java 2007-09-05
14:00:02 UTC (rev 3459)
@@ -41,6 +41,7 @@
import org.hibernate.mapping.Component;
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.Table;
+import org.jboss.tools.hibernate.ui.veditor.VisualEditorPlugin;
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;
@@ -109,6 +110,7 @@
ormShape.setLocation(new Point(Integer
.parseInt(xy[0]), Integer.parseInt(xy[1])));
} catch (NumberFormatException e) {
+ VisualEditorPlugin.getPluginLog().logError(e);
}
if (xy.length > 2)
if ((new Boolean(xy[2])).booleanValue())
Modified:
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 2007-09-05
13:55:01 UTC (rev 3458)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java 2007-09-05
14:00:02 UTC (rev 3459)
@@ -98,7 +98,6 @@
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();
@@ -190,20 +189,16 @@
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),
@@ -221,7 +216,6 @@
Integer.parseInt(Messages.Colors_PersistentFieldB)));
else
return ResourceManager.getInstance().getColor(new RGB(255, 0, 0));
-// throw new IllegalArgumentException();
}
protected Color getSelectionColor() {
@@ -232,8 +226,6 @@
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();
return ResourceManager.getInstance().getColor(new RGB(255,0,0));
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java 2007-09-05
13:55:01 UTC (rev 3458)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java 2007-09-05
14:00:02 UTC (rev 3459)
@@ -60,10 +60,6 @@
} catch (MissingResourceException x) {
resourceBundle = null;
}
-
-// if (TRACE || TRACE_VIEW )
-// ExceptionHandler.logObjectPlugin("ViewPlugin()",PLUGIN_ID, null);
-
}
public static ImageDescriptor getImageDescriptor(String name) {
@@ -73,7 +69,6 @@
URL url = new URL(installURL, iconPath + name);
return ImageDescriptor.createFromURL(url);
} catch (MalformedURLException e) {
- // should not happen
return ImageDescriptor.getMissingImageDescriptor();
}
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmContentProvider.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmContentProvider.java 2007-09-05
13:55:01 UTC (rev 3458)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmContentProvider.java 2007-09-05
14:00:02 UTC (rev 3459)
@@ -20,6 +20,7 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.TreeItem;
+import org.jboss.tools.hibernate.ui.view.ViewPlugin;
public class OrmContentProvider implements ITreeContentProvider/*, IOrmModelListener,
IOrmProjectChangedListener*/ {
@@ -50,7 +51,7 @@
public OrmContentProvider(int tip){
this.tip = tip;
- sorting = true; // default - sort
+ sorting = true;
}
public Object[] getChildren(Object parentElement) {
@@ -58,29 +59,16 @@
children = nullChildren;
if (!sorting){
- sorting = true; // default - sort
- } else {
-// Arrays.sort(children, comparator);
+ sorting = true;
}
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;
}
@@ -93,147 +81,8 @@
}
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;
}
@@ -242,12 +91,6 @@
this.sorting = sorting;
}
- /*
- public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
- }
- */
-
public Object[] getExpandedElements() {
return expandedElements;
}
@@ -265,64 +108,30 @@
}
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;
@@ -330,24 +139,20 @@
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);
- }
+ } catch (Exception e) {
+ ViewPlugin.getDefault().logError(e);
+ }
}
});
}
- // 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();
@@ -355,83 +160,35 @@
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
+ String selectionElementQualifiedName = "";
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);
-// }
-// }
}
}
@@ -439,20 +196,6 @@
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;
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java 2007-09-05
13:55:01 UTC (rev 3458)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmModelNameVisitor.java 2007-09-05
14:00:02 UTC (rev 3459)
@@ -15,6 +15,7 @@
import org.eclipse.jdt.core.Signature;
import org.eclipse.jface.text.TextUtilities;
import org.eclipse.jface.viewers.ContentViewer;
+import org.hibernate.cfg.reveng.JDBCToHibernateTypeHelper;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.DependantValue;
@@ -35,7 +36,6 @@
static private String POINTER = " -> ";
- // add 16.03.2005 tau
private ResourceBundle BUNDLE = ResourceBundle
.getBundle(OrmModelNameVisitor.class.getPackage().getName()
+ ".views");
@@ -48,163 +48,9 @@
public Object visitDatabaseColumn(Column column, Object argument) {
StringBuffer name = new StringBuffer();
name.append(column.getName());
-
- 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
+// String s =
JDBCToHibernateTypeHelper.getJDBCTypeName(column.getSqlTypeCode().intValue());
+
return name.toString();
}
@@ -212,22 +58,14 @@
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.getEntityName() != null ? clazz.getEntityName() :
clazz.getClassName());
-// } else {
-// name.append(clazz.getEntityName());
-// }
+ name.append(clazz.getEntityName() != null ? clazz.getEntityName() :
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 = HibernateUtils.getTableName(table);
if (tableName != null) {
- //name.append(" (");
name.append(POINTER);
name.append(tableName);
- //name.append(")");
}
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ViewsAction.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ViewsAction.java 2007-09-05
13:55:01 UTC (rev 3458)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ViewsAction.java 2007-09-05
14:00:02 UTC (rev 3459)
@@ -36,7 +36,7 @@
try {
IDE.openEditor(ViewPlugin.getPage(),input
,"org.jboss.tools.hibernate.ui.veditor.editors.visualeditor");
} catch (PartInitException e) {
-// ExceptionHandler.logThrowableError(e,"OpenEditor");
+ ViewPlugin.getDefault().logError(e);
}
}
};