Author: dgeraskov
Date: 2009-12-17 05:29:24 -0500 (Thu, 17 Dec 2009)
New Revision: 19402
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage2.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-5330
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage2.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage2.java 2009-12-17
10:20:22 UTC (rev 19401)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingElementsSelectionPage2.java 2009-12-17
10:29:24 UTC (rev 19402)
@@ -18,7 +18,6 @@
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.TableItem;
-import org.hibernate.eclipse.jdt.ui.internal.JdtUiMessages;
/**
* @author Dmitry Geraskov
@@ -33,7 +32,6 @@
public NewHibernateMappingElementsSelectionPage2(String pageName, IStructuredSelection
selection) {
super(pageName);
this.selection = selection;
- setDescription(JdtUiMessages.NewHibernateMappingElementsSelectionPage2_description);
}
public void createControl(Composite parent) {
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-12-17
10:20:22 UTC (rev 19401)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFilePage.java 2009-12-17
10:29:24 UTC (rev 19402)
@@ -45,6 +45,8 @@
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.model.IWorkbenchAdapter;
import org.hibernate.console.ImageConstants;
import org.hibernate.eclipse.console.utils.EclipseImages;
@@ -59,14 +61,15 @@
public class NewHibernateMappingFilePage extends WizardPage {
private TableViewer viewer;
+
+ private boolean hideFilename;
/**
* @param pageName
*/
- protected NewHibernateMappingFilePage() {
+ protected NewHibernateMappingFilePage(boolean hideFilename) {
super(""); //$NON-NLS-1$
- setTitle(JdtUiMessages.NewHibernateMappingFilePage_hibernate_xml_mapping_file);
- setMessage(JdtUiMessages.NewHibernateMappingFilePage_this_wizard_creates, WARNING);
+ this.hideFilename = hideFilename;
}
public void createControl(Composite parent) {
@@ -97,7 +100,16 @@
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);
+ if (project_infos.size() == 1){
+ viewer.getTable().getColumn(1).setWidth(0);
+ } else {
+ viewer.getTable().getColumn(1).setWidth(120);
+ viewer.getTable().getColumn(1).pack();
+ }
+ viewer.getTable().getColumn(2).pack();
+ if (!hideFilename){
+ viewer.getTable().getColumn(3).pack();
+ }
}
private void createTableColumns(Table table){
@@ -107,6 +119,7 @@
/* Hide the column while JBIDE-4269 is not implemented.
* (Filtering generated elements)
*/
+ //if (hideFilename)
column.setWidth(0);
column.setResizable(false);
@@ -118,9 +131,11 @@
column.setText(JdtUiMessages.NewHibernateMappingFilePage_class_name_column);
column.setWidth(200);
- column = new TableColumn(table, SWT.LEFT, coulmnIndex++);
- column.setText(JdtUiMessages.NewHibernateMappingFilePage_file_name_column);
- column.setWidth(150);
+ if (!hideFilename) {
+ column = new TableColumn(table, SWT.LEFT, coulmnIndex++);
+ column.setText(JdtUiMessages.NewHibernateMappingFilePage_file_name_column);
+ column.setWidth(150);
+ }
}
private TableViewer createTableViewer(Table table) {
@@ -135,7 +150,9 @@
editors[coulmnIndex++] = new CheckboxCellEditor( result.getTable() );
editors[coulmnIndex++] = new TextCellEditor( result.getTable() );
editors[coulmnIndex++] = new TextCellEditor( result.getTable() );
- editors[coulmnIndex++] = new TextCellEditor( result.getTable() );
+ if (!hideFilename) {
+ editors[coulmnIndex++] = new TextCellEditor( result.getTable() );
+ }
result.setCellEditors( editors );
result.setCellModifier( new TableCellModifier(result) );
@@ -210,6 +227,8 @@
private final ImageDescriptorRegistry registry =
JavaPlugin.getImageDescriptorRegistry();
+ private ImageDescriptor DESC_OBJ_PROJECT = null;
+
public TableLableProvider(TableViewer tv) {
this.tv = tv;
}
@@ -233,6 +252,12 @@
new JavaElementImageDescriptor(descriptor, 0, IMAGE_SIZE));
}
}
+ } else if (Columns.PROJECT.toString().equals(property)){
+ if (DESC_OBJ_PROJECT == null) {
+ ISharedImages images= JavaPlugin.getDefault().getWorkbench().getSharedImages();
+ DESC_OBJ_PROJECT= images.getImageDescriptor(IDE.SharedImages.IMG_OBJ_PROJECT);
+ }
+ return registry.get(new JavaElementImageDescriptor(DESC_OBJ_PROJECT, 0,
IMAGE_SIZE));
}
return null;
}
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-12-17
10:20:22 UTC (rev 19401)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.jdt.ui/src/org/hibernate/eclipse/jdt/ui/wizards/NewHibernateMappingFileWizard.java 2009-12-17
10:29:24 UTC (rev 19402)
@@ -42,6 +42,7 @@
import org.eclipse.jdt.internal.core.JavaProject;
import org.eclipse.jdt.internal.core.PackageFragment;
import org.eclipse.jdt.internal.core.PackageFragmentRoot;
+import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.dialogs.IPageChangingListener;
import org.eclipse.jface.dialogs.PageChangingEvent;
import org.eclipse.jface.operation.IRunnableWithProgress;
@@ -89,8 +90,6 @@
private NewHibernateMappingElementsSelectionPage2 page0 = null;
private WizardNewFileCreationPage cPage;
-
- //private NewHibernateMappingElementsSelectionPage page1 = null;
private NewHibernateMappingFilePage page2 = null;
@@ -109,20 +108,19 @@
}
page0 = new
NewHibernateMappingElementsSelectionPage2(JdtUiMessages.NewHibernateMappingFileWizard_create_hibernate_xml_mapping_file,
selection);
+ page0.setDescription(JdtUiMessages.NewHibernateMappingElementsSelectionPage2_description);
addPage(page0);
- //page1 = new NewHibernateMappingElementsSelectionPage(selection);
- //page1.setTitle(
HibernateConsoleMessages.NewHibernateMappingFileWizard_create_hibernate_xml_mapping_file
);
- //page1.setDescription(
HibernateConsoleMessages.NewHibernateMappingFileWizard_create_new_xml_mapping_file );
- //addPage(page1);
-
cPage = new WizardNewFileCreationPage( "Ccfgxml", selection ); //$NON-NLS-1$
cPage.setTitle(
JdtUiMessages.NewHibernateMappingFileWizard_create_hibernate_xml_mapping_file );
cPage.setDescription(
JdtUiMessages.NewHibernateMappingFileWizard_create_empty_xml_mapping_file );
cPage.setFileName("hibernate.hbm.xml"); //$NON-NLS-1$
addPage( cPage );
- page2 = new NewHibernateMappingFilePage();
+ page2 = new NewHibernateMappingFilePage(true);
+ page2.setTitle(JdtUiMessages.NewHibernateMappingFilePage_hibernate_xml_mapping_file);
+ page2.setMessage(JdtUiMessages.NewHibernateMappingFilePage_this_wizard_creates,
IMessageProvider.WARNING);
+
addPage(page2);
}