Author: vyemialyanchyk
Date: 2009-09-11 12:04:04 -0400 (Fri, 11 Sep 2009)
New Revision: 17527
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/META-INF/MANIFEST.MF
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.properties
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramContentOutlinePage.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4715 - possible to sort items alphabetically
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/META-INF/MANIFEST.MF
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/META-INF/MANIFEST.MF 2009-09-11
15:03:19 UTC (rev 17526)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/META-INF/MANIFEST.MF 2009-09-11
16:04:04 UTC (rev 17527)
@@ -16,6 +16,7 @@
org.eclipse.core.resources,
org.hibernate.eclipse,
org.eclipse.jdt.core,
+ org.eclipse.jdt.ui,
org.hibernate.eclipse.console
Bundle-Version: 2.0.0
Export-Package: org.jboss.tools.hibernate.ui.diagram,
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.java 2009-09-11
15:03:19 UTC (rev 17526)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.java 2009-09-11
16:04:04 UTC (rev 17527)
@@ -50,4 +50,7 @@
public static String MoveGuideCommand_Label;
public static String DiagramContentOutlinePage_Outline;
public static String DiagramContentOutlinePage_Overview;
+ public static String DiagramViewer_OutlinePage_Sort_label;
+ public static String DiagramViewer_OutlinePage_Sort_tooltip;
+ public static String DiagramViewer_OutlinePage_Sort_description;
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.properties
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.properties 2009-09-11
15:03:19 UTC (rev 17526)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.properties 2009-09-11
16:04:04 UTC (rev 17527)
@@ -26,3 +26,6 @@
MoveGuideCommand_Label=Move Guide
DiagramContentOutlinePage_Outline=Outline
DiagramContentOutlinePage_Overview=Overview
+DiagramViewer_OutlinePage_Sort_label=Sort
+DiagramViewer_OutlinePage_Sort_tooltip=Sort
+DiagramViewer_OutlinePage_Sort_description=Enable Sorting
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramContentOutlinePage.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramContentOutlinePage.java 2009-09-11
15:03:19 UTC (rev 17526)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramContentOutlinePage.java 2009-09-11
16:04:04 UTC (rev 17527)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
+ * Copyright (c) 2007-2009 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -35,6 +35,7 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -166,6 +167,9 @@
"org.jboss.tools.hibernate.ui.diagram.editors.popup.outline.contextmenu",
//$NON-NLS-1$
provider, getSite().getSelectionProvider());
IToolBarManager tbm = getSite().getActionBars().getToolBarManager();
+
+ tbm.add(new LexicalSortingAction());
+
showOutlineAction = new Action() {
public void run() {
showPage(ID_OUTLINE);
@@ -347,4 +351,39 @@
return actionRegistry;
}
+ class LexicalSortingAction extends Action {
+
+ @SuppressWarnings("restriction")
+ public LexicalSortingAction() {
+ super();
+ setText(DiagramViewerMessages.DiagramViewer_OutlinePage_Sort_label);
+ org.eclipse.jdt.internal.ui.JavaPluginImages.setLocalImageDescriptors(this,
"alphab_sort_co.gif"); //$NON-NLS-1$
+ setToolTipText(DiagramViewerMessages.DiagramViewer_OutlinePage_Sort_tooltip);
+ setDescription(DiagramViewerMessages.DiagramViewer_OutlinePage_Sort_description);
+
+ boolean checked = getOrmDiagram().isDeepIntoSort();
+ valueChanged(checked);
+ }
+
+ public void run() {
+ valueChanged(isChecked());
+ }
+
+ private void valueChanged(final boolean on) {
+ setChecked(on);
+ BusyIndicator.showWhile(outline.getDisplay(), new Runnable() {
+ public void run() {
+ if (on) {
+ getOrmDiagram().setDeepIntoSort(true);
+ getOrmDiagram().refresh();
+ setContents(getOrmDiagram());
+ } else {
+ getOrmDiagram().setDeepIntoSort(false);
+ getOrmDiagram().refresh();
+ setContents(getOrmDiagram());
+ }
+ }
+ });
+ }
+ }
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2009-09-11
15:03:19 UTC (rev 17526)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2009-09-11
16:04:04 UTC (rev 17527)
@@ -72,7 +72,8 @@
private boolean gridEnabled = false;
private double zoom = 1.0;
private float fontHeight = 8.5f;
-
+ private boolean deepIntoSort = false;
+
//
private boolean fileLoadSuccessfull = false;
@@ -86,7 +87,7 @@
entityNames = new String[1];
entityNames[0] = ioe.getEntityName();
recreateChildren();
- sortChildren(false);
+ sortChildren(deepIntoSort);
loadFromFile();
refreshDiagramElements();
setDirty(false);
@@ -107,7 +108,7 @@
entityNames[i] = ormElements[i].getEntityName();
}
recreateChildren();
- sortChildren(false);
+ sortChildren(deepIntoSort);
loadFromFile();
refreshDiagramElements();
setDirty(false);
@@ -260,7 +261,7 @@
Properties properties = new Properties();
saveInProperties(properties);
recreateChildren();
- sortChildren(false);
+ sortChildren(deepIntoSort);
// -> load just from properties
loadFromProperties(properties);
refreshDiagramElements();
@@ -346,6 +347,8 @@
gridEnabled = Boolean.valueOf(str).booleanValue();
str = properties.getProperty("zoom", "1.0"); //$NON-NLS-1$
//$NON-NLS-2$
zoom = Double.valueOf(str).doubleValue();
+ str = properties.getProperty("deepIntoSort", "false");
//$NON-NLS-1$ //$NON-NLS-2$
+ deepIntoSort = Boolean.valueOf(str).booleanValue();
}
@Override
@@ -354,6 +357,7 @@
properties.put("snapToGeometry", "" + snapToGeometry);
//$NON-NLS-1$ //$NON-NLS-2$
properties.put("gridEnabled", "" + gridEnabled); //$NON-NLS-1$
//$NON-NLS-2$
properties.put("zoom", "" + zoom); //$NON-NLS-1$ //$NON-NLS-2$
+ properties.put("deepIntoSort", "" + deepIntoSort); //$NON-NLS-1$
//$NON-NLS-2$
super.saveInProperties(properties);
}
@@ -504,4 +508,12 @@
public OrmLabelProvider getLabelProvider() {
return labelProvider;
}
+
+ public boolean isDeepIntoSort() {
+ return deepIntoSort;
+ }
+
+ public void setDeepIntoSort(boolean deepIntoSort) {
+ this.deepIntoSort = deepIntoSort;
+ }
}