Author: dgeraskov
Date: 2009-05-18 05:21:04 -0400 (Mon, 18 May 2009)
New Revision: 15322
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFilePage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3457
Messages added and externalized, code refactored,
Next and Finish validation added.
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java 2009-05-18
08:36:28 UTC (rev 15321)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java 2009-05-18
09:21:04 UTC (rev 15322)
@@ -192,6 +192,8 @@
public static String NewConfigurationWizardPage_session_factory_name;
public static String NewConfigurationWizardPage_this_wizard_creates;
public static String NewConfigurationWizardPage_user_name;
+ public static String NewHibernateMappingElementsSelectionPage_select;
+
public static String NewHibernateMappingFilePage_browse;
public static String NewHibernateMappingFilePage_class_to_map;
public static String NewHibernateMappingFilePage_container;
@@ -209,7 +211,13 @@
public static String NewHibernateMappingFileWizard_create_hibernate_xml_mapping_file;
public static String NewHibernateMappingFileWizard_create_new_xml_mapping_file;
public static String NewHibernateMappingFileWizard_creating;
+
+ public static String NewHibernateMappingFileWizard_error;
+
+ public static String NewHibernateMappingFileWizard_finding_dependent_cu;
public static String NewHibernateMappingFileWizard_opening_file_for_editing;
+
+ public static String NewHibernateMappingFileWizard_selection_cant_be_empty;
public static String
NewReverseEngineeringFileWizard_create_hibernate_reverse_engineering_file;
public static String NewReverseEngineeringFileWizard_create_new_hibernate_reveng_xml;
public static String NewReverseEngineeringFileWizard_creating;
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties 2009-05-18
08:36:28 UTC (rev 15321)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties 2009-05-18
09:21:04 UTC (rev 15322)
@@ -188,6 +188,7 @@
NewConfigurationWizardPage_session_factory_name=&Session factory name:
NewConfigurationWizardPage_this_wizard_creates=This wizard creates a new configuration
file to use with Hibernate.
NewConfigurationWizardPage_user_name=User&name:
+NewHibernateMappingElementsSelectionPage_select=Select compilation units or containers.
NewHibernateMappingFilePage_browse=Browse...
NewHibernateMappingFilePage_class_to_map=Class to &map:
NewHibernateMappingFilePage_container=&Container:
@@ -203,9 +204,12 @@
NewHibernateMappingFilePage_the_class_will_be_used_when=The class will be used when
generating the hbm.xml file
NewHibernateMappingFilePage_this_wizard_creates=This wizard creates a new Hibernate XML
Mapping file
NewHibernateMappingFileWizard_create_hibernate_xml_mapping_file=Create Hibernate XML
Mapping file (hbm.xml)
-NewHibernateMappingFileWizard_create_new_xml_mapping_file=Create a new XML Mapping file.
+NewHibernateMappingFileWizard_create_new_xml_mapping_file=Create new XML Mapping files.
NewHibernateMappingFileWizard_creating=Creating
+NewHibernateMappingFileWizard_error=Must use WizardDialog implementation as
WizardContainer
+NewHibernateMappingFileWizard_finding_dependent_cu=Finding dependent compilation
units...
NewHibernateMappingFileWizard_opening_file_for_editing=Opening file for editing...
+NewHibernateMappingFileWizard_selection_cant_be_empty=Selection can't be empty
NewReverseEngineeringFileWizard_create_hibernate_reverse_engineering_file=Create
Hibernate Reverse Engineering file (reveng.xml)
NewReverseEngineeringFileWizard_create_new_hibernate_reveng_xml=Create a new
hibernate.reveng.xml.
NewReverseEngineeringFileWizard_creating=Creating
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage.java 2009-05-18
08:36:28 UTC (rev 15321)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage.java 2009-05-18
09:21:04 UTC (rev 15322)
@@ -20,7 +20,7 @@
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Tree;
+import org.hibernate.eclipse.console.HibernateConsoleMessages;
public class NewHibernateMappingElementsSelectionPage extends WizardPage {
@@ -31,12 +31,8 @@
private boolean fAllowMultiple = true;
- private int fWidth = 50;
-
- private int fHeight = 18;
-
public NewHibernateMappingElementsSelectionPage(IStructuredSelection selection) {
- super("", "", null);
+ super("", "", null); //$NON-NLS-1$ //$NON-NLS-2$
fCurrentSelection = selection;
}
@@ -44,31 +40,53 @@
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
createTreeViewer(composite);
-
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = convertWidthInCharsToPixels(fWidth);
- data.heightHint = convertHeightInCharsToPixels(fHeight);
-
- Tree treeWidget = fViewer.getTree();
- treeWidget.setLayoutData(data);
+ fViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
setControl(composite);
}
+
+ public IStructuredSelection getSelection(){
+ return fCurrentSelection;
+ }
+
+ public void setAllowMultiple(boolean isAllowMultiple){
+ fAllowMultiple = isAllowMultiple;
+ }
+
protected TreeViewer createTreeViewer(Composite composite) {
int style = SWT.BORDER | (fAllowMultiple ? SWT.MULTI : SWT.SINGLE);
- fViewer = new TreeViewer(new Tree(composite, style));
+ fViewer = new TreeViewer(composite, style);
fViewer.setContentProvider(new StandardJavaElementContentProvider());
fViewer.setLabelProvider(new JavaElementLabelProvider());
fViewer.setFilters(getFilters());
- fViewer.addSelectionChangedListener(getSelectionChangedListener());
+ fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ fCurrentSelection = (IStructuredSelection) event.getSelection();
+ updateStatus();
+ }
+ });
fViewer.setInput(getInput());
fViewer.setSelection(fCurrentSelection, true);
return fViewer;
}
protected ViewerFilter[] getFilters(){
- return new ViewerFilter[] { new ViewerFilter() {
+ return new ViewerFilter[] { new ViewerFilter() {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement,
+ Object element) {
+ if (element instanceof JarPackageFragmentRoot) {
+ return false;
+ } else if (element instanceof ICompilationUnit) {
+ return true;
+ } else if (element instanceof IParent) {
+ return hasCompilationUnits((IParent)element);
+ } else {
+ return false;
+ }
+ }
+
public boolean hasCompilationUnits(IParent parent){
IJavaElement[] elements;
try {
@@ -89,20 +107,6 @@
return false;
}
- @Override
- public boolean select(Viewer viewer, Object parentElement,
- Object element) {
- if (element instanceof JarPackageFragmentRoot) {
- return false;
- } else if (element instanceof ICompilationUnit) {
- return true;
- } else if (element instanceof IParent) {
- return hasCompilationUnits((IParent)element);
- } else {
- return false;
- }
- }
-
} };
}
@@ -110,24 +114,13 @@
return JavaCore.create( ResourcesPlugin.getWorkspace().getRoot() );
}
- public IStructuredSelection getSelection(){
- return fCurrentSelection;
- }
-
- protected ISelectionChangedListener getSelectionChangedListener() {
- return new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- fCurrentSelection = (IStructuredSelection) event.getSelection();
- updateStatus();
- }
- };
- }
-
- public void setAllowMultiple(boolean isAllowMultiple){
- fAllowMultiple = isAllowMultiple;
- }
-
protected void updateStatus() {
- // TODO Auto-generated method stub
+ setPageComplete((fCurrentSelection != null && !fCurrentSelection.isEmpty()));
+ if (isPageComplete()){
+ setMessage(null);
+ } else {
+ setMessage(HibernateConsoleMessages.NewHibernateMappingElementsSelectionPage_select);
+ }
}
+
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFilePage.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFilePage.java 2009-05-18
08:36:28 UTC (rev 15321)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFilePage.java 2009-05-18
09:21:04 UTC (rev 15322)
@@ -54,7 +54,7 @@
* @param pageName
*/
protected NewHibernateMappingFilePage() {
- super("");
+ super(""); //$NON-NLS-1$
setTitle(HibernateConsoleMessages.NewHibernateMappingFilePage_hibernate_xml_mapping_file);
setDescription(HibernateConsoleMessages.NewHibernateMappingFilePage_this_wizard_creates);
}
@@ -83,6 +83,12 @@
sc.setMinSize(container.computeSize(SWT.DEFAULT, SWT.DEFAULT));
setControl(container);
}
+
+ public void setInput(Map<IJavaProject, Collection<EntityInfo>>
project_infos){
+ viewer.setInput(project_infos);
+ //Hide "project" column if only 1 project's CUs selected
+ viewer.getTable().getColumn(1).setWidth(project_infos.size() == 1 ? 0 : 120);
+ }
private void createTableColumns(Table table){
int coulmnIndex = 0;
@@ -109,23 +115,16 @@
private TableViewer createTableViewer(Table table) {
TableViewer result = new TableViewer( table );
result.setUseHashlookup( true );
- //if (project_infos.keySet().size() > 1){
- result.setColumnProperties( new String[] {"create", "project",
//$NON-NLS-1$//$NON-NLS-2$
- "class", "file",} ); //$NON-NLS-1$ //$NON-NLS-2$
- /*} else {
- result.setColumnProperties( new String[] {"create", //$NON-NLS-1$
- "class", "file",} ); //$NON-NLS-1$ //$NON-NLS-2$
- }*/
+ result.setColumnProperties( new String[] {Columns.CREATE.toString(),
+ Columns.PROJECT.toString(), Columns.CLASS.toString(), Columns.FILE.toString()} );
+
CellEditor[] editors = new CellEditor[result.getColumnProperties().length];
editors[0] = new CheckboxCellEditor( result.getTable() );
editors[1] = new TextCellEditor( result.getTable() );
editors[2] = new TextCellEditor( result.getTable() );
- //if (project_infos.keySet().size() > 1){
editors[3] = new TextCellEditor( result.getTable() );
- //}
-
result.setCellEditors( editors );
result.setCellModifier( new TableCellModifier(result) );
result.setLabelProvider(new TableLableProvider(result));
@@ -133,10 +132,6 @@
return result;
}
- public void setInput(Map<IJavaProject, Collection<EntityInfo>>
project_infos){
- viewer.setInput(project_infos);
- }
-
private class TableLine {
public String projectName;
@@ -159,6 +154,13 @@
}
}
+
+ private enum Columns {
+ PROJECT,
+ CLASS,
+ FILE,
+ CREATE
+ }
private class TableContentProvider implements IStructuredContentProvider {
@@ -194,7 +196,7 @@
public Image getColumnImage(Object element, int columnIndex) {
String property = (String) tv.getColumnProperties()[columnIndex];
- if("create".equals(property)) {
+ if(Columns.CREATE.toString().equals(property)) {
TableLine tl = (TableLine) element;
String key = tl.isCreate ? null : ImageConstants.CLOSE ; // TODO: find a better
image
return EclipseImages.getImage(key);
@@ -206,14 +208,14 @@
String property = (String) tv.getColumnProperties()[columnIndex];
TableLine tl = (TableLine) element;
- if ("class".equals(property)){
+ if (Columns.CLASS.toString().equals(property)){
return tl.className;
- } else if ("project".equals(property)){
+ } else if (Columns.PROJECT.toString().equals(property)){
return tl.projectName;
- } else if ("file".equals(property)){
+ } else if (Columns.FILE.toString().equals(property)){
return tl.fileName;
} else {
- return "";
+ return "";//$NON-NLS-1$
}
}
}
@@ -231,13 +233,13 @@
}
public Object getValue(Object element, String property) {
- if ("class".equals(property)){
+ if (Columns.CLASS.toString().equals(property)){//$NON-NLS-1$
return ((TableLine)element).className;
- } else if ("project".equals(property)){
+ } else if (Columns.PROJECT.toString().equals(property)){//$NON-NLS-1$
return ((TableLine)element).projectName;
- } else if ("file".equals(property)){
+ } else if (Columns.FILE.toString().equals(property)){//$NON-NLS-1$
return ((TableLine)element).fileName;
- } else if ("create".equals(property)){
+ } else if (Columns.CREATE.toString().equals(property)){//$NON-NLS-1$
return ((TableLine)element).isCreate;
}
return null;
@@ -245,13 +247,13 @@
public void modify(Object element, String property, Object value) {
TableLine tl = (TableLine)((TableItem)element).getData();
- if ("class".equals(property)){
+ if (Columns.CLASS.toString().equals(property)){
tl.className = (String)value;
- } else if ("project".equals(property)){
+ } else if (Columns.PROJECT.toString().equals(property)){
tl.projectName = (String)value;
- } else if ("file".equals(property)){
+ } else if (Columns.FILE.toString().equals(property)){
tl.fileName = (String)value;
- } else if ("create".equals(property)){
+ } else if (Columns.CREATE.toString().equals(property)){
tl.isCreate = (Boolean)value;
}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java 2009-05-18
08:36:28 UTC (rev 15321)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java 2009-05-18
09:21:04 UTC (rev 15322)
@@ -19,15 +19,14 @@
import java.util.Set;
import java.util.Map.Entry;
-import org.eclipse.core.internal.resources.File;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.core.JavaElement;
import org.eclipse.jdt.internal.core.JavaElementInfo;
@@ -49,7 +48,6 @@
import org.hibernate.eclipse.console.utils.EclipseImages;
import org.hibernate.eclipse.jdt.ui.internal.jpa.collect.AllEntitiesInfoCollector;
import org.hibernate.eclipse.jdt.ui.internal.jpa.common.EntityInfo;
-import org.hibernate.eclipse.jdt.ui.internal.jpa.common.Utils;
import org.hibernate.tool.hbm2x.HibernateMappingExporter;
import org.hibernate.tool.hbm2x.HibernateMappingGlobalSettings;
@@ -63,16 +61,16 @@
* Selected compilation units for startup processing,
* result of processing selection
*/
- private Set<ICompilationUnit> selectionCU = new
HashSet<ICompilationUnit>();
+ private Set<ICompilationUnit> selectionCU = null;
private Map<IJavaProject, Collection<EntityInfo>> project_infos = new
HashMap<IJavaProject, Collection<EntityInfo>>();
- private IStructuredSelection selection;
+ private IStructuredSelection selection;
+ private NewHibernateMappingElementsSelectionPage page1 = null;
+
private NewHibernateMappingFilePage page2 = null;
- private NewHibernateMappingElementsSelectionPage page1 = null;
-
public NewHibernateMappingFileWizard(){
setDefaultPageImageDescriptor(EclipseImages.getImageDescriptor(ImageConstants.NEW_WIZARD)
);
setNeedsProgressMonitor(true);
@@ -90,41 +88,14 @@
if (getContainer() instanceof WizardDialog) {
((WizardDialog) getContainer()).addPageChangingListener(this);
} else {
- throw new IllegalArgumentException("Must use WizardDialog implementation as
WizardContainer");
+ throw new
IllegalArgumentException(HibernateConsoleMessages.NewHibernateMappingFileWizard_error);
}
}
public void handlePageChanging(PageChangingEvent event) {
if (event.getTargetPage() == page2){
- selection = page1.getSelection();
- try {
- getContainer().run(false, false, new IRunnableWithProgress(){
-
- public void run(IProgressMonitor monitor) throws InvocationTargetException,
- InterruptedException {
- monitor.beginTask("Find dependent compilation units", selection.size() +
1);
- Iterator it = selection.iterator();
- int done = 1;
- while (it.hasNext()) {
- Object obj = it.next();
- processJavaElements(obj);
- monitor.worked(done++);
- Thread.currentThread();
- Thread.sleep(1000);
- }
- initEntitiesInfo();
- monitor.worked(1);
- monitor.done();
- }
- });
- } catch (InvocationTargetException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- page2.setInput(project_infos);
+ updateCompilationUnits();
+ page2.setInput(project_infos);
}
}
@@ -134,6 +105,7 @@
@Override
public boolean performFinish() {
+ updateCompilationUnits();
Map<IJavaProject, Configuration> configs = createConfigurations();
for (Entry<IJavaProject, Configuration> entry : configs.entrySet()) {
Configuration config = entry.getValue();
@@ -198,81 +170,44 @@
collector.collect(icu);
}
collector.resolveRelations();
- //I don't check here if any non abstract class selected
project_infos.put(javaProject, collector.getMapCUs_Info().values());
}
}
protected void processJavaElements(Object obj) {
- if (obj instanceof ICompilationUnit) {
- ICompilationUnit cu = (ICompilationUnit)obj;
- selectionCU.add(cu);
- }
- else if (obj instanceof File) {
- File file = (File)obj;
- if (file != null && file.getProject() != null) {
- IJavaProject javaProject = JavaCore.create(file.getProject());
- ICompilationUnit[] cus = Utils.findCompilationUnits(javaProject,
- file.getFullPath());
- if (cus != null) {
- for (ICompilationUnit cu : cus) {
- selectionCU.add(cu);
- }
- }
- }
- }
- else if (obj instanceof JavaProject) {
- JavaProject javaProject = (JavaProject)obj;
- IPackageFragmentRoot[] pfr = null;
- try {
- pfr = javaProject.getAllPackageFragmentRoots();
- } catch (JavaModelException e) {
- // just ignore it!
- //HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException:
", e); //$NON-NLS-1$
- }
- if (pfr != null) {
+ try {
+ if (obj instanceof ICompilationUnit) {
+ ICompilationUnit cu = (ICompilationUnit) obj;
+ selectionCU.add(cu);
+ } else if (obj instanceof JavaProject) {
+ JavaProject javaProject = (JavaProject) obj;
+ IPackageFragmentRoot[] pfr = javaProject.getAllPackageFragmentRoots();
for (IPackageFragmentRoot element : pfr) {
processJavaElements(element);
}
- }
- }
- else if (obj instanceof PackageFragment) {
- PackageFragment packageFragment = (PackageFragment)obj;
- ICompilationUnit[] cus = null;
- try {
- cus = packageFragment.getCompilationUnits();
- } catch (JavaModelException e) {
- // just ignore it!
- //HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException:
", e); //$NON-NLS-1$
- }
- if (cus != null) {
+ } else if (obj instanceof PackageFragment) {
+ PackageFragment packageFragment = (PackageFragment) obj;
+ ICompilationUnit[] cus = packageFragment.getCompilationUnits();
for (ICompilationUnit cu : cus) {
selectionCU.add(cu);
}
- }
- }
- else if (obj instanceof PackageFragmentRoot) {
- JavaElement javaElement = (JavaElement)obj;
- JavaElementInfo javaElementInfo = null;
- try {
- javaElementInfo = (JavaElementInfo)javaElement.getElementInfo();
- } catch (JavaModelException e) {
- // just ignore it!
- //HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException:
", e); //$NON-NLS-1$
- }
- if (javaElementInfo != null) {
+ } else if (obj instanceof PackageFragmentRoot) {
+ JavaElement javaElement = (JavaElement) obj;
+ JavaElementInfo javaElementInfo = (JavaElementInfo) javaElement.getElementInfo();
IJavaElement[] je = javaElementInfo.getChildren();
for (IJavaElement element : je) {
processJavaElements(element);
}
+ } else if (obj instanceof JavaElement) {
+ JavaElement javaElement = (JavaElement) obj;
+ ICompilationUnit cu = javaElement.getCompilationUnit();
+ selectionCU.add(cu);
}
+ } catch (JavaModelException e) {
+ // just ignore it!
+ //HibernateConsolePlugin.getDefault().logErrorMessage("JavaModelException:
", e); //$NON-NLS-1$
}
- else if (obj instanceof JavaElement) {
- JavaElement javaElement = (JavaElement)obj;
- ICompilationUnit cu = javaElement.getCompilationUnit();
- selectionCU.add(cu);
- }
}
@@ -282,4 +217,37 @@
return configs;
}
+
+ protected void updateCompilationUnits(){
+ Assert.isNotNull(page1.getSelection(),
HibernateConsoleMessages.NewHibernateMappingFileWizard_selection_cant_be_empty);
+ if ((selectionCU == null) || !page1.getSelection().equals(selection)) {
+ selectionCU = new HashSet<ICompilationUnit>();
+ project_infos.clear();
+ selection = page1.getSelection();
+ try {
+ getContainer().run(false, false, new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException,
+ InterruptedException {
+ monitor.beginTask(HibernateConsoleMessages.NewHibernateMappingFileWizard_finding_dependent_cu,
selection.size() + 1);
+ Iterator it = selection.iterator();
+ int done = 1;
+ while (it.hasNext()) {
+ Object obj = it.next();
+ processJavaElements(obj);
+ monitor.worked(done++);
+ }
+ initEntitiesInfo();
+ monitor.worked(1);
+ monitor.done();
+ }
+ });
+ } catch (InvocationTargetException e) {
+ HibernateConsolePlugin.getDefault().log(e);
+ } catch (InterruptedException e) {
+ HibernateConsolePlugin.getDefault().log(e);
+ }
+ }
+ }
}