[jbosstools-commits] JBoss Tools SVN: r20758 - in trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console: properties and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Mar 11 09:35:45 EST 2010


Author: dgeraskov
Date: 2010-03-11 09:35:44 -0500 (Thu, 11 Mar 2010)
New Revision: 20758

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.console/src/org/hibernate/eclipse/console/properties/HibernatePropertyPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5960

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	2010-03-11 14:31:17 UTC (rev 20757)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java	2010-03-11 14:35:44 UTC (rev 20758)
@@ -102,6 +102,8 @@
 	public static String HibernateConsolePreferencePage_text_pref;
 	//
 	public static String HibernatePropertyPage_default_hibernate_console_config;
+
+	public static String HibernatePropertyPage_details;
 	public static String HibernatePropertyPage_enable_hibernate3_support;
 	public static String HibernatePropertyPage_open_url;
 	public static String HibernatePropertyPage_unable_open_webbrowser_for_url;

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	2010-03-11 14:31:17 UTC (rev 20757)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties	2010-03-11 14:35:44 UTC (rev 20758)
@@ -95,6 +95,7 @@
 HibernateConsolePreferencePage_text_pref=A &text preference:
 
 HibernatePropertyPage_default_hibernate_console_config=Default Hibernate Console configuration:
+HibernatePropertyPage_details=<a>Details ...</a>
 HibernatePropertyPage_enable_hibernate3_support=Enable Hibernate 3 support
 HibernatePropertyPage_open_url=Open URL
 HibernatePropertyPage_unable_open_webbrowser_for_url=Unable to open webbrowser for url:

Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/properties/HibernatePropertyPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/properties/HibernatePropertyPage.java	2010-03-11 14:31:17 UTC (rev 20757)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/properties/HibernatePropertyPage.java	2010-03-11 14:35:44 UTC (rev 20758)
@@ -54,6 +54,7 @@
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.browser.IWebBrowser;
@@ -64,12 +65,14 @@
 import org.hibernate.console.KnownConfigurations;
 import org.hibernate.eclipse.console.HibernateConsoleMessages;
 import org.hibernate.eclipse.console.HibernateConsolePlugin;
+import org.hibernate.eclipse.console.actions.EditConsoleConfiguration;
 import org.hibernate.eclipse.console.utils.EclipseImages;
 import org.hibernate.eclipse.console.utils.LaunchHelper;
 import org.hibernate.eclipse.console.utils.ProjectUtils;
 import org.osgi.service.prefs.BackingStoreException;
 import org.osgi.service.prefs.Preferences;
 
+ at SuppressWarnings("restriction")
 public class HibernatePropertyPage extends PropertyPage {
 
 	Control[] settings;
@@ -78,11 +81,15 @@
 
 	private Combo selectedConfiguration;
 	
+	private Link details;
+	
 	private Button enableNamingStrategy;
 	
 	private Label nsSeparator;
 	
 	private boolean initNamingStrategy;
+	
+	private static final String NONE = "<None>"; //$NON-NLS-1$
 
 
 	/**
@@ -185,25 +192,43 @@
 	}
 
 	private void addSecondSection(Composite parent) {
-		Composite settingsPart = createDefaultComposite(parent,2);
-
 		// Label for owner field
-		Label ownerLabel = new Label(settingsPart, SWT.NONE);
+		Label ownerLabel = new Label(parent, SWT.NONE);
 		ownerLabel.setText(HibernateConsoleMessages.HibernatePropertyPage_default_hibernate_console_config);
 
-		selectedConfiguration = new Combo(parent, SWT.DROP_DOWN);
+		Composite settingsPart = createDefaultComposite(parent,2);
+		selectedConfiguration = new Combo(settingsPart, SWT.DROP_DOWN | SWT.READ_ONLY);
 		GridData gd = new GridData();
 		gd.widthHint = convertWidthInCharsToPixels(50);
 		selectedConfiguration.setLayoutData(gd);
 
+		selectedConfiguration.add(NONE);
 		// Populate owner text field
 		ConsoleConfiguration[] configurations = LaunchHelper.findFilteredSortedConsoleConfigs();
 		for (int i = 0; i < configurations.length; i++) {
 			ConsoleConfiguration configuration = configurations[i];
 			selectedConfiguration.add(configuration.getName() );
 		}
+		
+		details = new Link(settingsPart, SWT.NONE);
+		details.setText(HibernateConsoleMessages.HibernatePropertyPage_details);
+		details.addSelectionListener(new SelectionAdapter() {
+			public void widgetSelected(SelectionEvent e) {
+				ConsoleConfiguration config = KnownConfigurations.getInstance().find(selectedConfiguration.getText());
+				if (config != null) {
+					new EditConsoleConfiguration(config).run();
+				}				
+			}
+		});
+		
+		selectedConfiguration.addSelectionListener(new SelectionAdapter() {
+			public void widgetSelected(SelectionEvent e) {
+				details.setEnabled(selectedConfiguration.getSelectionIndex() != 0);
+			}
+		});
+				
 
-		settings = new Control[] { ownerLabel, selectedConfiguration };
+		settings = new Control[] { ownerLabel, selectedConfiguration, details};
 	}
 	
 	private void addThirdSection(Composite parent) {
@@ -255,7 +280,7 @@
 
 	protected void performDefaults() {
 		enableHibernate.setSelection(false);
-		selectedConfiguration.setText(""); //$NON-NLS-1$
+		selectedConfiguration.select(0);
 	}
 	
 	private boolean isHibernateJpaProject(){
@@ -293,9 +318,10 @@
 			String cfg = node.get(HibernatePropertiesConstants.DEFAULT_CONFIGURATION, project.getName() );
 			ConsoleConfiguration configuration = KnownConfigurations.getInstance().find(cfg);
 			if(configuration==null) {
-				selectedConfiguration.setText(""); //$NON-NLS-1$
+				selectedConfiguration.select(0);
+				details.setEnabled(false);
 			} else {
-				selectedConfiguration.setText(cfg);
+				selectedConfiguration.setText(cfg);				
 			}
 			initNamingStrategy = node.getBoolean(HibernatePropertiesConstants.NAMING_STRATEGY_ENABLED, true);
 			enableNamingStrategy.setSelection(initNamingStrategy);
@@ -313,7 +339,6 @@
 			try {
 				node.flush();
 				final IWorkspaceRunnable wr = new IWorkspaceRunnable() {
-					@SuppressWarnings("restriction")
 					public void run(IProgressMonitor monitor)
 							throws CoreException {
 						JpaModelManager.instance().rebuildJpaProject(getProject());
@@ -338,7 +363,7 @@
 					new ProgressMonitorDialog(getShell()).run(true, false, op);
 				}
 				catch (InterruptedException e) {
-					return false;
+					return false;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          !
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             !
                                                               !
         
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             !
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             !
                                                               !
         
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             !
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             !
                                                               !
         
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             !
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             !
                                                               !
         
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             !
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             !
                                                               !
         
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             !
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
 				}
 				catch (InvocationTargetException e) {
 					final Throwable te = e.getTargetException();
@@ -355,7 +380,8 @@
 	}
 	
 	public boolean performOk() {
-		ProjectUtils.toggleHibernateOnProject( getProject(), enableHibernate.getSelection(), selectedConfiguration.getText());
+		ProjectUtils.toggleHibernateOnProject( getProject(), enableHibernate.getSelection(),
+				selectedConfiguration.getSelectionIndex() != 0 ? selectedConfiguration.getText() : ""); //$NON-NLS-1$
 		saveNamigStrategyChanges();
 		return true;
 	}
@@ -366,6 +392,9 @@
 			Control comp = settings[i];
 			comp.setEnabled(selection);
 		}
+		if (selection) {
+			details.setEnabled(selectedConfiguration.getSelectionIndex() != 0);
+		}
 	}
 
 }
\ No newline at end of file



More information about the jbosstools-commits mailing list