JBoss Tools SVN: r42742 - in trunk: jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2012-07-26 17:44:16 -0400 (Thu, 26 Jul 2012)
New Revision: 42742
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/ModelUIImages.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java
Log:
Make Quick Fix "Add tag library definition" work with KB Model instead of using plain tag library list https://issues.jboss.org/browse/JBIDE-12304
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/ModelUIImages.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/ModelUIImages.java 2012-07-26 19:09:05 UTC (rev 42741)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/ModelUIImages.java 2012-07-26 21:44:16 UTC (rev 42742)
@@ -39,6 +39,8 @@
public static String JAVA_CLASS = "java/class.gif"; //$NON-NLS-1$
public static String JAVA_INTERFACE = "java/interface.gif"; //$NON-NLS-1$
public static String JAVA_PACKAGE = "java/package.gif"; //$NON-NLS-1$
+
+ public static String TAGLIB_FILE = "editors/taglibs_file.gif"; //$NON-NLS-1$
// this blok staye witout changes for compatibility
private static ModelUIImages INSTANCE;
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java 2012-07-26 19:09:05 UTC (rev 42741)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/AddTLDMarkerResolution.java 2012-07-26 21:44:16 UTC (rev 42742)
@@ -29,6 +29,7 @@
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.DocumentProviderRegistry;
import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.jboss.tools.common.model.ui.ModelUIImages;
import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
import org.jboss.tools.common.quickfix.IBaseMarkerResolution;
import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPPaletteInsertHelper;
@@ -44,16 +45,18 @@
*/
public class AddTLDMarkerResolution implements IBaseMarkerResolution, IJavaCompletionProposal{
private IFile file;
- private Properties properties;
private String resolutionName;
private int start, end;
private String uri, prefix;
- public AddTLDMarkerResolution(IFile file, String name, Properties properties){
+ public AddTLDMarkerResolution(IFile file, String name, int start, int end, String uri, String prefix){
this.file = file;
- this.properties = properties;
this.resolutionName = name;
+ this.start = start;
+ this.end = end;
+ this.uri = uri;
+ this.prefix = prefix;
}
public AddTLDMarkerResolution(String name, int start, int end, String uri, String prefix){
@@ -63,6 +66,35 @@
this.uri = uri;
this.prefix = prefix;
}
+
+ private Properties getProperties(){
+ Properties properties = new Properties();
+ properties.put(JSPPaletteInsertHelper.PROPOPERTY_ADD_TAGLIB, "true"); //$NON-NLS-1$
+ properties.put(PaletteInsertHelper.PROPOPERTY_START_TEXT, ""); //$NON-NLS-1$
+ properties.put(JSPPaletteInsertHelper.PROPOPERTY_TAGLIBRARY_URI, uri);
+ properties.put(JSPPaletteInsertHelper.PROPOPERTY_DEFAULT_PREFIX, prefix);
+ properties.put(PaletteInsertHelper.PROPOPERTY_SELECTION_PROVIDER, new ISelectionProvider() {
+
+ @Override
+ public void setSelection(ISelection selection) {
+ }
+
+ @Override
+ public void removeSelectionChangedListener(
+ ISelectionChangedListener listener) {
+ }
+
+ @Override
+ public ISelection getSelection() {
+ return new TextSelection(start, end-start);
+ }
+
+ @Override
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ }
+ });
+ return properties;
+ }
@Override
public String getLabel() {
@@ -81,7 +113,7 @@
IDocument document = provider.getDocument(input);
PaletteTaglibInserter inserter = new PaletteTaglibInserter();
- inserter.inserTaglib(document, properties);
+ inserter.inserTaglib(document, getProperties());
if(!dirty){
provider.aboutToChange(input);
@@ -102,39 +134,15 @@
@Override
public Image getImage() {
- return null;//ImageDescriptor.createFromFile(AddTLDMarkerResolution.class, "images/xstudio/editors/taglibs_file.gif").createImage(); //$NON-NLS-1$
+ return ModelUIImages.getImageDescriptor(ModelUIImages.TAGLIB_FILE).createImage();
}
@Override
public void apply(IDocument document) {
- properties = new Properties();
- properties.put(JSPPaletteInsertHelper.PROPOPERTY_ADD_TAGLIB, "true"); //$NON-NLS-1$
- properties.put(PaletteInsertHelper.PROPOPERTY_START_TEXT, ""); //$NON-NLS-1$
- properties.put(JSPPaletteInsertHelper.PROPOPERTY_TAGLIBRARY_URI, uri);
- properties.put(JSPPaletteInsertHelper.PROPOPERTY_DEFAULT_PREFIX, prefix);
- properties.put(PaletteInsertHelper.PROPOPERTY_SELECTION_PROVIDER, new ISelectionProvider() {
-
- @Override
- public void setSelection(ISelection selection) {
- }
-
- @Override
- public void removeSelectionChangedListener(
- ISelectionChangedListener listener) {
- }
-
- @Override
- public ISelection getSelection() {
- return new TextSelection(start, end-start);
- }
-
- @Override
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- }
- });
+ Properties properties = getProperties();
- Properties p = PaletteTaglibInserter.getPrefixes(document, properties);
+ PaletteTaglibInserter.getPrefixes(document, properties);
PaletteTaglibInserter inserter = new PaletteTaglibInserter();
inserter.inserTaglib(document, properties);
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java 2012-07-26 19:09:05 UTC (rev 42741)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java 2012-07-26 21:44:16 UTC (rev 42742)
@@ -12,33 +12,28 @@
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Properties;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IMarkerResolutionGenerator2;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.texteditor.DocumentProviderRegistry;
-import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
import org.jboss.tools.common.quickfix.IQuickFixGenerator;
-import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPPaletteInsertHelper;
-import org.jboss.tools.jst.jsp.jspeditor.dnd.PaletteTaglibInserter;
+import org.jboss.tools.common.refactoring.MarkerResolutionUtils;
+import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.jst.web.kb.KbProjectFactory;
+import org.jboss.tools.jst.web.kb.internal.taglib.TLDLibrary;
+import org.jboss.tools.jst.web.kb.taglib.INameSpace;
+import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
import org.jboss.tools.jst.web.ui.WebUiPlugin;
/**
@@ -66,142 +61,134 @@
libs.put("c", "http://java.sun.com/jstl/core"); //$NON-NLS-1$ //$NON-NLS-2$
}
- private IFile file;
- private Properties properties;
- private String resolutionName;
-
@Override
public IMarkerResolution[] getResolutions(IMarker marker) {
try{
- if(isOurCase(marker)){
- return new IMarkerResolution[] {
- new AddTLDMarkerResolution(file, resolutionName, properties)
- };
- }
+ return isOurCase(marker);
}catch(CoreException ex){
WebUiPlugin.getPluginLog().logError(ex);
}
return new IMarkerResolution[]{};
}
- private IJavaCompletionProposal isOurCase(Annotation annotation){
+ private IJavaCompletionProposal[] isOurCase(Annotation annotation){
+ ArrayList<IJavaCompletionProposal> proposals = new ArrayList<IJavaCompletionProposal>();
if(!(annotation instanceof TemporaryAnnotation)){
- return null;
+ return new IJavaCompletionProposal[]{};
}
TemporaryAnnotation ta = (TemporaryAnnotation)annotation;
-
String message = annotation.getText();
if(ta.getPosition() == null)
- return null;
+ return new IJavaCompletionProposal[]{};
final int start = ta.getPosition().getOffset();
final int end = ta.getPosition().getOffset()+ta.getPosition().getLength();
if(!message.startsWith(UNKNOWN_TAG))
- return null;
+ return new IJavaCompletionProposal[]{};
String prefix = getPrifix(message);
if(prefix == null)
- return null;
+ return new IJavaCompletionProposal[]{};
- if(!libs.containsKey(prefix))
- return null;
-
Object additionalInfo = ta.getAdditionalFixInfo();
if(additionalInfo instanceof IDocument){
IStructuredModel model = StructuredModelManager.getModelManager().getModelForRead((IStructuredDocument)additionalInfo);
IDOMDocument xmlDocument = (model instanceof IDOMModel) ? ((IDOMModel) model).getDocument() : null;
- if(xmlDocument != null && xmlDocument.isXMLType()){
- resolutionName = "xmlns: "+prefix+" = \""+libs.get(prefix)+"\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }else{
- resolutionName = "<%@ taglib uri = \""+libs.get(prefix)+"\" prefix=\""+prefix+"\" %>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ IFile file = MarkerResolutionUtils.getFile();
+ if(file == null)
+ return new IJavaCompletionProposal[]{};
+
+ IKbProject kbProject = KbProjectFactory.getKbProject(file.getProject(), true);
+
+ ITagLibrary[] libraries = kbProject.getTagLibraries();
+ for(ITagLibrary l : libraries){
+ if(l instanceof TLDLibrary){
+ ((TLDLibrary) l).createDefaultNameSpace();
+ }
+ INameSpace ns = l.getDefaultNameSpace();
+ if(ns != null && ns.getPrefix() != null && ns.getPrefix().equals(prefix)){
+ String uri = ns.getURI();
+ String resolutionName = getResolutionName(xmlDocument != null && xmlDocument.isXMLType(), true, prefix, uri);
+ if(resolutionName != null){
+ proposals.add(new AddTLDMarkerResolution(resolutionName, start, end, uri, prefix));
+ }
+ }
}
+ if(proposals.size() == 0 && libs.containsKey(prefix)){
+ String uri = libs.get(prefix);
+ String resolutionName = getResolutionName(xmlDocument != null && xmlDocument.isXMLType(), true, prefix, uri);
+ if(resolutionName != null){
+ proposals.add(new AddTLDMarkerResolution(resolutionName, start, end, uri, prefix));
+ }
+ }
}
-
-
- return new AddTLDMarkerResolution(resolutionName, start, end, libs.get(prefix), prefix);
+ return proposals.toArray(new IJavaCompletionProposal[]{});
}
- private boolean isOurCase(IMarker marker) throws CoreException{
+ private String getResolutionName(boolean xml, boolean noXML, String prefix, String uri){
+ if(xml){
+ return "xmlns: "+prefix+" = \""+uri+"\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }else if(noXML){
+ return "<%@ taglib uri = \""+uri+"\" prefix=\""+prefix+"\" %>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ return null;
+ }
+
+ private IMarkerResolution[] isOurCase(IMarker marker) throws CoreException{
+ ArrayList<IMarkerResolution> resolutions = new ArrayList<IMarkerResolution>();
String message = (String)marker.getAttribute(IMarker.MESSAGE);
Integer attribute = ((Integer)marker.getAttribute(IMarker.CHAR_START));
if(attribute == null)
- return false;
+ return new IMarkerResolution[]{};
final int start = attribute.intValue();
attribute = ((Integer)marker.getAttribute(IMarker.CHAR_END));
if(attribute == null)
- return false;
+ return new IMarkerResolution[]{};
final int end = attribute.intValue();
if(!message.startsWith(UNKNOWN_TAG))
- return false;
+ return new IMarkerResolution[]{};
String prefix = getPrifix(message);
if(prefix == null)
- return false;
+ return new IMarkerResolution[]{};
- if(!libs.containsKey(prefix))
- return false;
- file = (IFile)marker.getResource();
+ IFile file = (IFile)marker.getResource();
- FileEditorInput input = new FileEditorInput(file);
- IDocumentProvider provider = DocumentProviderRegistry.getDefault().getDocumentProvider(input);
- try {
- provider.connect(input);
- } catch (CoreException e) {
- WebUiPlugin.getPluginLog().logError(e);
- }
+ IKbProject kbProject = KbProjectFactory.getKbProject(file.getProject(), true);
- IDocument document = provider.getDocument(input);
-
- properties = new Properties();
- properties.put(JSPPaletteInsertHelper.PROPOPERTY_ADD_TAGLIB, "true"); //$NON-NLS-1$
- properties.put(PaletteInsertHelper.PROPOPERTY_START_TEXT, ""); //$NON-NLS-1$
- properties.put(JSPPaletteInsertHelper.PROPOPERTY_TAGLIBRARY_URI, libs.get(prefix));
- properties.put(JSPPaletteInsertHelper.PROPOPERTY_DEFAULT_PREFIX, prefix);
- properties.put(PaletteInsertHelper.PROPOPERTY_SELECTION_PROVIDER, new ISelectionProvider() {
-
- @Override
- public void setSelection(ISelection selection) {
+ ITagLibrary[] libraries = kbProject.getTagLibraries();
+ for(ITagLibrary l : libraries){
+ if(l instanceof TLDLibrary){
+ ((TLDLibrary) l).createDefaultNameSpace();
}
-
- @Override
- public void removeSelectionChangedListener(
- ISelectionChangedListener listener) {
+ INameSpace ns = l.getDefaultNameSpace();
+ if(ns != null && ns.getPrefix() != null && ns.getPrefix().equals(prefix)){
+ String uri = ns.getURI();
+ String resolutionName = getResolutionName(marker.getType().equals(HTML_VALIDATOR_MARKER) || marker.isSubtypeOf(HTML_VALIDATOR_MARKER), marker.getType().equals(JSP_VALIDATOR_MARKER) || marker.isSubtypeOf(JSP_VALIDATOR_MARKER), prefix, uri);
+ if(resolutionName != null){
+ resolutions.add(new AddTLDMarkerResolution(file, resolutionName, start, end, uri, prefix));
+ }
}
-
- @Override
- public ISelection getSelection() {
- return new TextSelection(start, end-start);
- }
-
- @Override
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- }
- });
-
-
- Properties p = PaletteTaglibInserter.getPrefixes(document, properties);
-
- provider.disconnect(input);
-
- if(p.containsValue(prefix))
- return false;
-
- if(marker.getType().equals(HTML_VALIDATOR_MARKER) || marker.isSubtypeOf(HTML_VALIDATOR_MARKER)){
- resolutionName = "xmlns: "+prefix+" = \""+libs.get(prefix)+"\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }else if(marker.getType().equals(JSP_VALIDATOR_MARKER) || marker.isSubtypeOf(JSP_VALIDATOR_MARKER)){
- resolutionName = "<%@ taglib uri = \""+libs.get(prefix)+"\" prefix=\""+prefix+"\" %>"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
- return true;
+ if(resolutions.size() == 0 && libs.containsKey(prefix)){
+ String uri = libs.get(prefix);
+ String resolutionName = getResolutionName(marker.getType().equals(HTML_VALIDATOR_MARKER) || marker.isSubtypeOf(HTML_VALIDATOR_MARKER), marker.getType().equals(JSP_VALIDATOR_MARKER) || marker.isSubtypeOf(JSP_VALIDATOR_MARKER), prefix, uri);
+ if(resolutionName != null){
+ resolutions.add(new AddTLDMarkerResolution(file, resolutionName, start, end, uri, prefix));
+ }
+ }
+ return resolutions.toArray(new IMarkerResolution[]{});
}
public static String getPrifix(String message){
@@ -239,11 +226,6 @@
@Override
public IJavaCompletionProposal[] getProposals(Annotation annotation) {
- ArrayList<IJavaCompletionProposal> proposals = new ArrayList<IJavaCompletionProposal>();
- IJavaCompletionProposal proposal = isOurCase(annotation);
- if(proposal != null){
- proposals.add(proposal);
- }
- return proposals.toArray(new IJavaCompletionProposal[]{});
+ return isOurCase(annotation);
}
}
\ No newline at end of file
13 years, 2 months
JBoss Tools SVN: r42741 - trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2012-07-26 15:09:05 -0400 (Thu, 26 Jul 2012)
New Revision: 42741
Modified:
trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java
Log:
JBIDE-12376 - Maven Library Provider throws NPE if template contains some plugin
Modified: trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java
===================================================================
--- trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java 2012-07-26 15:51:05 UTC (rev 42740)
+++ trunk/maven/plugins/org.jboss.tools.maven.core/src/org/jboss/tools/maven/core/MavenCoreActivator.java 2012-07-26 19:09:05 UTC (rev 42741)
@@ -533,7 +533,7 @@
if (libraryBuild == null) {
return;
}
- List<org.eclipse.m2e.model.edit.pom.Plugin> libraryPlugins = projectModel.getBuild().getPlugins();
+ List<org.eclipse.m2e.model.edit.pom.Plugin> libraryPlugins = libraryModel.getBuild().getPlugins();
for (org.eclipse.m2e.model.edit.pom.Plugin plugin:libraryPlugins) {
org.eclipse.m2e.model.edit.pom.Build projectBuild = projectModel.getBuild();
if (projectBuild == null) {
13 years, 2 months
JBoss Tools SVN: r42740 - in trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test: editor/pagedesign and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2012-07-26 11:51:05 -0400 (Thu, 26 Jul 2012)
New Revision: 42740
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/JspFileEditingTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/MultiSelectionTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VPEEditorTestCase.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/EditingELValueTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/IncludedCssFilesJSPTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/IncludedCssFilesTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/ManipulatingELValueTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/PageDesignTestCase.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/SubstitutedELExressionsTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java
Log:
Fixes for JBT 3.4. Use more reliable waiting methods.
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/JspFileEditingTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/JspFileEditingTest.java 2012-07-26 13:59:18 UTC (rev 42739)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/JspFileEditingTest.java 2012-07-26 15:51:05 UTC (rev 42740)
@@ -93,8 +93,10 @@
final SWTBotEclipseEditor jspTextEditor = botExt.editorByTitle(TEST_PAGE)
.toTextEditor();
jspTextEditor.save();
- botExt.toolbarButtonWithTooltip(SWTJBTExt.isRunningOnMacOs() ?
- IDELabel.ToolbarButton.REFRESH_MAC_OS: IDELabel.ToolbarButton.REFRESH).click();
+ final String toolbarButtonRefreshTooltip = SWTJBTExt.isRunningOnMacOs() ?
+ IDELabel.ToolbarButton.REFRESH_MAC_OS: IDELabel.ToolbarButton.REFRESH;
+ util.waitForToolbarButtonWithTooltipIsFound(toolbarButtonRefreshTooltip, Timing.time10S());
+ botExt.toolbarButtonWithTooltip(toolbarButtonRefreshTooltip).click();
botExt.sleep(Timing.time1S());
String editorText = jspTextEditor.getText();
String testText = "<h:outputText value=\"" + outputTextValue + "\">";
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/MultiSelectionTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/MultiSelectionTest.java 2012-07-26 13:59:18 UTC (rev 42739)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/MultiSelectionTest.java 2012-07-26 15:51:05 UTC (rev 42740)
@@ -14,6 +14,7 @@
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
import org.jboss.tools.ui.bot.ext.SWTBotExt;
import org.jboss.tools.ui.bot.ext.SWTJBTExt;
+import org.jboss.tools.ui.bot.ext.Timing;
import org.jboss.tools.vpe.ui.bot.test.tools.SWTBotWebBrowser;
import org.mozilla.interfaces.nsIDOMNode;
/**
@@ -70,6 +71,8 @@
0,
0,
0);
+
+ util.waitForNonIgnoredJobs(true,Timing.time3S());
assertSelectedNodeHasText(webBrowser, MultiSelectionTest.OUTPUT_TEXT_1_TEXT);
@@ -79,6 +82,8 @@
0,
0,
0);
+
+ util.waitForNonIgnoredJobs(true,Timing.time3S());
assertSelectedNodeHasText(webBrowser, MultiSelectionTest.OUTPUT_TEXT_0_TEXT);
@@ -89,10 +94,14 @@
jspEditor.selectRange(yPos, xPos,
tagsLine.indexOf(MultiSelectionTest.OUTPUT_TEXT_1_TEXT) - tagsLine.indexOf(MultiSelectionTest.OUTPUT_TEXT_0_TEXT));
+ util.waitForNonIgnoredJobs(true,Timing.time3S());
+
assertSelectedNodeHasText(webBrowser, MultiSelectionTest.OUTPUT_TEXT_0_TEXT);
jspEditor.selectCurrentLine();
+ util.waitForNonIgnoredJobs(true,Timing.time3S());
+
assertTrue("Multiple selection doesn't contain proper nodes.",
webBrowser.selectionContainsNodes(false, MultiSelectionTest.OUTPUT_TEXT_0_TEXT
, MultiSelectionTest.OUTPUT_TEXT_1_TEXT));
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VPEEditorTestCase.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VPEEditorTestCase.java 2012-07-26 13:59:18 UTC (rev 42739)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VPEEditorTestCase.java 2012-07-26 15:51:05 UTC (rev 42740)
@@ -68,7 +68,9 @@
SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
SWTBotTree tree = innerBot.tree();
tree.expandNode(JBT_TEST_PROJECT_NAME)
- .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick(); //$NON-NLS-1$ //$NON-NLS-2$
+ .expandNode("WebContent").expandNode("pages").getNode(TEST_PAGE).doubleClick(); //$NON-NLS-1$ //$NON-NLS-2$
+ // wait for page to be opened
+ bot.editorByTitle(TEST_PAGE);
}
void checkVPE(String testPage) throws Throwable{
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/EditingELValueTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/EditingELValueTest.java 2012-07-26 13:59:18 UTC (rev 42739)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/EditingELValueTest.java 2012-07-26 15:51:05 UTC (rev 42740)
@@ -69,6 +69,7 @@
"Template file is not found: \"templates/common.xhtml\"",
EditingELValueTest.INPUT_NAME_PAGE_NAME);
// Opens Page Design Options Dialog
+ util.waitForToolbarButtonWithTooltipIsFound(PAGE_DESIGN, Timing.time10S());
bot.toolbarButtonWithTooltip(PAGE_DESIGN).click();
SWTBot optionsDialogBot = bot.shell(IDELabel.Shell.PAGE_DESIGN_OPTIONS).activate().bot();
optionsDialogBot.tabItem(IDELabel.PageDesignOptionsDialog.SUBSTITUTED_EL_EXPRESSIONS_TAB).activate();
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/IncludedCssFilesJSPTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/IncludedCssFilesJSPTest.java 2012-07-26 13:59:18 UTC (rev 42739)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/IncludedCssFilesJSPTest.java 2012-07-26 15:51:05 UTC (rev 42740)
@@ -86,6 +86,7 @@
bot.sleep(Timing.time3S());
util.waitForJobs(JobName.BUILDING_WS);
// add CSS File Reference
+ util.waitForToolbarButtonWithTooltipIsFound(PAGE_DESIGN, Timing.time10S());
bot.toolbarButtonWithTooltip(PAGE_DESIGN).click();
optionsDialogBot = bot.shell(IDELabel.Shell.PAGE_DESIGN_OPTIONS).activate().bot();
optionsDialogBot.tabItem(IDELabel.PageDesignOptionsDialog.INCLUDED_CSS_FILES_TAB).activate();
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/IncludedCssFilesTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/IncludedCssFilesTest.java 2012-07-26 13:59:18 UTC (rev 42739)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/IncludedCssFilesTest.java 2012-07-26 15:51:05 UTC (rev 42740)
@@ -82,6 +82,7 @@
bot.sleep(Timing.time3S());
util.waitForJobs(JobName.BUILDING_WS);
// add CSS File Reference
+ util.waitForToolbarButtonWithTooltipIsFound(PAGE_DESIGN, Timing.time10S());
bot.toolbarButtonWithTooltip(PAGE_DESIGN).click();
optionsDialogBot = bot.shell(IDELabel.Shell.PAGE_DESIGN_OPTIONS).activate().bot();
optionsDialogBot.tabItem(IDELabel.PageDesignOptionsDialog.INCLUDED_CSS_FILES_TAB).activate();
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/ManipulatingELValueTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/ManipulatingELValueTest.java 2012-07-26 13:59:18 UTC (rev 42739)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/ManipulatingELValueTest.java 2012-07-26 15:51:05 UTC (rev 42740)
@@ -54,9 +54,11 @@
createJspPage(ManipulatingELValueTest.TEST_IN_PAGE_FOLDER_PAGE_NAME);
testInPageFolderEditor = botExt.editorByTitle(ManipulatingELValueTest.TEST_IN_PAGE_FOLDER_PAGE_NAME).toTextEditor();
testInPageFolderEditor.setText(ManipulatingELValueTest.PAGE_TEXT);
+ testInPageFolderEditor.save();
createJspPage(ManipulatingELValueTest.TEST_IN_MAIN_FOLDER_PAGE_NAME , JBT_TEST_PROJECT_NAME , "WebContent");
testInMainFolderEditor = botExt.editorByTitle(ManipulatingELValueTest.TEST_IN_MAIN_FOLDER_PAGE_NAME).toTextEditor();
testInMainFolderEditor.setText(ManipulatingELValueTest.PAGE_TEXT);
+ testInMainFolderEditor.save();
testInPageFolderEditor.show();
addELSubstitution(ManipulatingELValueTest.EL_VARIABLE_NAME, ManipulatingELValueTest.EL_IN_PAGE_FOLDER_VARIABLE_VALUE,
IDELabel.PageDesignOptionsDialog.SUBSTITUTED_EL_EXPRESSIONS_SCOPE_FOLDER);
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/PageDesignTestCase.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/PageDesignTestCase.java 2012-07-26 13:59:18 UTC (rev 42739)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/PageDesignTestCase.java 2012-07-26 15:51:05 UTC (rev 42740)
@@ -64,6 +64,7 @@
* Deletes all defined EL Substitutions. VPE has to be opened when called this method
*/
public void deleteAllELSubstitutions(){
+ util.waitForToolbarButtonWithTooltipIsFound(PAGE_DESIGN, Timing.time10S());
bot.toolbarButtonWithTooltip(PAGE_DESIGN).click();
SWTBot optionsDialogBot = bot.shell(IDELabel.Shell.PAGE_DESIGN_OPTIONS).activate().bot();
optionsDialogBot.tabItem(IDELabel.PageDesignOptionsDialog.SUBSTITUTED_EL_EXPRESSIONS_TAB).activate();
@@ -82,6 +83,7 @@
* @param scope
*/
public void addELSubstitution (String elName , String value , String scope){
+ util.waitForToolbarButtonWithTooltipIsFound(PAGE_DESIGN, Timing.time10S());
bot.toolbarButtonWithTooltip(PAGE_DESIGN).click();
SWTBot optionsDialogBot = bot.shell(IDELabel.Shell.PAGE_DESIGN_OPTIONS).activate().bot();
optionsDialogBot.tabItem(IDELabel.PageDesignOptionsDialog.SUBSTITUTED_EL_EXPRESSIONS_TAB).activate();
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/SubstitutedELExressionsTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/SubstitutedELExressionsTest.java 2012-07-26 13:59:18 UTC (rev 42739)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/pagedesign/SubstitutedELExressionsTest.java 2012-07-26 15:51:05 UTC (rev 42740)
@@ -13,6 +13,7 @@
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
+import org.jboss.tools.ui.bot.ext.Timing;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
/**
@@ -28,6 +29,7 @@
public void testSubstitutedELExressions(){
openPage();
+ util.waitForToolbarButtonWithTooltipIsFound(PAGE_DESIGN, Timing.time10S());
bot.toolbarButtonWithTooltip(PAGE_DESIGN).click();
optionsDialogBot = bot.shell(IDELabel.Shell.PAGE_DESIGN_OPTIONS).activate().bot();
optionsDialogBot.tabItem(IDELabel.PageDesignOptionsDialog.SUBSTITUTED_EL_EXPRESSIONS_TAB).activate();
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java 2012-07-26 13:59:18 UTC (rev 42739)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/wizard/ExternalizeStringsDialogTest.java 2012-07-26 15:51:05 UTC (rev 42740)
@@ -230,6 +230,7 @@
/*
* Get toolbar button
*/
+ util.waitForToolbarButtonWithTooltipIsFound(TOOL_TIP, Timing.time3S());
tbButton = bot.toolbarButtonWithTooltip(TOOL_TIP);
util.waitForToolbarButtonEnabled(tbButton,Timing.time5S());
tbButton.click();
@@ -245,6 +246,7 @@
JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_PROPERTIES_KEY,
JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_PROPS_STRINGS_GROUP);
assertNotNull("Cannot find 'Property Key' text field", defKeyText); //$NON-NLS-1$
+ util.waitForNonIgnoredJobs(true, Timing.time3S());
assertText("User_1",defKeyText); //$NON-NLS-1$
assertTrue("(OK) button should be enabled.", //$NON-NLS-1$
bot.button(WidgetVariables.OK_BUTTON).isEnabled());
@@ -299,6 +301,7 @@
JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_PROPERTIES_KEY,
JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_PROPS_STRINGS_GROUP);
assertNotNull("Cannot find 'Property Key' text field", defKeyText); //$NON-NLS-1$
+ util.waitForNonIgnoredJobs(true, Timing.time3S());
assertText("User_1",defKeyText); //$NON-NLS-1$
defKeyText.setText("user.compoundKey"); //$NON-NLS-1$
SWTBotText defValueText = bot.textWithLabelInGroup(
@@ -368,6 +371,7 @@
/*
* Get toolbar button
*/
+ util.waitForToolbarButtonWithTooltipIsFound(TOOL_TIP, Timing.time3S());
SWTBotToolbarButton tbButton = bot.toolbarButtonWithTooltip(TOOL_TIP);
util.waitForToolbarButtonEnabled(tbButton,Timing.time5S());
tbButton.click();
@@ -484,6 +488,7 @@
* But for this test it's ok, so just ignore this exception.
*/
setException(null);
+ util.waitForToolbarButtonWithTooltipIsFound(TOOL_TIP, Timing.time3S());
SWTBotToolbarButton tbButton = bot.toolbarButtonWithTooltip(TOOL_TIP);
util.waitWhileToolbarButtonisDisabled(tbButton,Timing.time5S());
/*
@@ -533,7 +538,10 @@
/*
* Activate the dialog
*/
- bot.toolbarButtonWithTooltip(TOOL_TIP).click();
+ util.waitForToolbarButtonWithTooltipIsFound(TOOL_TIP, Timing.time3S());
+ SWTBotToolbarButton tbExternalizeStrings = (bot.toolbarButtonWithTooltip(TOOL_TIP));
+ util.waitForToolbarButtonEnabled(tbExternalizeStrings, Timing.time3S());
+ tbExternalizeStrings.click();
bot.shell(JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_TITLE).setFocus();
bot.shell(JstUIMessages.EXTERNALIZE_STRINGS_DIALOG_TITLE).activate();
isUnusedDialogOpened = true;
@@ -599,6 +607,7 @@
/*
* Activate the dialog
*/
+ util.waitForToolbarButtonWithTooltipIsFound(TOOL_TIP, Timing.time3S());
assertTrue(TOOLBAR_ICON_ENABLED, bot
.toolbarButtonWithTooltip(TOOL_TIP)
.isEnabled());
@@ -856,6 +865,7 @@
* Rewrite the taglib
*/
editor.toTextEditor().typeText(" "); //$NON-NLS-1$
+ editor.save();
/*
* Make sure that taglib doesn't present
*/
@@ -911,6 +921,7 @@
* Rewrite the taglib
*/
editor.toTextEditor().typeText(" "); //$NON-NLS-1$
+ editor.save();
/*
* Make sure that taglib doesn't present
*/
@@ -921,6 +932,7 @@
/*
* Get toolbar button
*/
+ util.waitForToolbarButtonWithTooltipIsFound(TOOL_TIP, Timing.time3S());
SWTBotToolbarButton tbButton = bot.toolbarButtonWithTooltip(TOOL_TIP);
util.waitForToolbarButtonEnabled(tbButton,Timing.time5S());
tbButton.click();
@@ -1001,8 +1013,16 @@
/*
* Get toolbar button
*/
+ util.waitForToolbarButtonWithTooltipIsFound(TOOL_TIP, Timing.time3S());
+ SWTBotToolbarButton tbExternalizeStrings = (bot.toolbarButtonWithTooltip(TOOL_TIP));
+ if (enabled){
+ util.waitForToolbarButtonEnabled(tbExternalizeStrings, Timing.time3S());
+ }
+ else{
+ util.waitWhileToolbarButtonisDisabled(tbExternalizeStrings, Timing.time3S());
+ }
assertEquals(enabled ? TOOLBAR_ICON_ENABLED : TOOLBAR_ICON_DISABLED,
- enabled, bot.toolbarButtonWithTooltip(TOOL_TIP).isEnabled());
+ enabled, tbExternalizeStrings.isEnabled());
}
/**
@@ -1027,6 +1047,7 @@
/*
* Get toolbar button
*/
+ util.waitForToolbarButtonWithTooltipIsFound(TOOL_TIP, Timing.time3S());
SWTBotToolbarButton tbButton = bot.toolbarButtonWithTooltip(TOOL_TIP);
util.waitForToolbarButtonEnabled(tbButton,Timing.time5S());
tbButton.click();
13 years, 2 months
JBoss Tools SVN: r42739 - in trunk/hibernatetools/plugins: org.hibernate.eclipse.console/src/org/hibernate/eclipse/console and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2012-07-26 09:59:18 -0400 (Thu, 26 Jul 2012)
New Revision: 42739
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/Messages.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/SelectConnectionProfileDialog.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/messages.properties
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/wizards/NewConfigurationWizard.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/NewConfigurationWizardPage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConnectionProfileCtrl.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConnectionProfileUtil.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/ConfigurationFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConfigurationFactory.java
Log:
https://issues.jboss.org/browse/JBIDE-7996
Updated layout of new hibernate configuration file wizard
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java 2012-07-26 11:12:17 UTC (rev 42738)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java 2012-07-26 13:59:18 UTC (rev 42739)
@@ -133,25 +133,10 @@
@SuppressWarnings("unused")
private void autoConfigureDialect(Configuration localCfg) {
if (localCfg.getProperty(Environment.DIALECT) == null) {
- String url = localCfg.getProperty(Environment.URL);
- String user = localCfg.getProperty(Environment.USER);
- String pass = localCfg.getProperty(Environment.PASS);
- Connection connection = null;
- try {
- connection = DriverManager.getConnection(url, user, pass);
- // SQL Dialect:
- Dialect dialect = DialectFactory.buildDialect(localCfg.getProperties(), connection);
- localCfg.setProperty(Environment.DIALECT, dialect.toString());
- } catch (SQLException e) {
- // can't determine dialect
+ String dialect = ConnectionProfileUtil.autoDetectDialect(localCfg.getProperties());
+ if (dialect != null){
+ localCfg.setProperty(Environment.DIALECT, dialect);
}
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException e) {
- // ignore
- }
- }
}
}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConnectionProfileUtil.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConnectionProfileUtil.java 2012-07-26 11:12:17 UTC (rev 42738)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConnectionProfileUtil.java 2012-07-26 13:59:18 UTC (rev 42739)
@@ -21,6 +21,9 @@
*/
package org.hibernate.console;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
import java.util.Properties;
import org.eclipse.datatools.connectivity.ConnectionProfileConstants;
@@ -29,6 +32,8 @@
import org.eclipse.datatools.connectivity.drivers.DriverInstance;
import org.eclipse.datatools.connectivity.drivers.jdbc.IJDBCDriverDefinitionConstants;
import org.hibernate.cfg.Environment;
+import org.hibernate.dialect.Dialect;
+import org.hibernate.dialect.resolver.DialectFactory;
/**
* @author Vitali Yemialyanchyk
@@ -100,4 +105,32 @@
}
return props;
}
+
+ public static String autoDetectDialect(Properties properties) {
+ if (properties.getProperty(Environment.DIALECT) == null) {
+ String url = properties.getProperty(Environment.URL);
+ String user = properties.getProperty(Environment.USER);
+ String pass = properties.getProperty(Environment.PASS);
+ Connection connection = null;
+ try {
+ connection = DriverManager.getConnection(url, user, pass);
+ // SQL Dialect:
+ Dialect dialect = DialectFactory.buildDialect(properties, connection);
+ return dialect.toString();
+ } catch (SQLException e) {
+ // can't determine dialect
+ } finally {
+ if (connection != null) {
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ // ignore
+ }
+ }
+ }
+ return null;
+ } else {
+ return properties.getProperty(Environment.DIALECT);
+ }
+ }
}
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 2012-07-26 11:12:17 UTC (rev 42738)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java 2012-07-26 13:59:18 UTC (rev 42739)
@@ -201,6 +201,8 @@
public static String NewConfigurationWizardPage_filefile_name;
public static String NewConfigurationWizardPage_fileoutside_classpath;
public static String NewConfigurationWizardPage_fileshould_pass_configuration;
+
+ public static String NewConfigurationWizardPage_getValuesFromConnection;
public static String NewConfigurationWizardPage_hibernate_config_file;
public static String NewConfigurationWizardPage_password;
public static String NewConfigurationWizardPage_project_must_be_writable;
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 2012-07-26 11:12:17 UTC (rev 42738)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties 2012-07-26 13:59:18 UTC (rev 42739)
@@ -196,6 +196,7 @@
NewConfigurationWizardPage_filefile_name=hibernate.cfg.xml
NewConfigurationWizardPage_fileoutside_classpath=Configuration placed outside CLASSPATH will not be available at run-time
NewConfigurationWizardPage_fileshould_pass_configuration=To load Configuration from ''{0}'' you''ll have to pass file name to Configuration.configure() method
+NewConfigurationWizardPage_getValuesFromConnection=<a>Get values from Connection</a>
NewConfigurationWizardPage_hibernate_config_file=Hibernate Configuration File (cfg.xml)
NewConfigurationWizardPage_password=&Password:
NewConfigurationWizardPage_project_must_be_writable=Project must be writable
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/Messages.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/Messages.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/Messages.java 2012-07-26 13:59:18 UTC (rev 42739)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.hibernate.eclipse.console.wizards;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Dmitry Geraskov (geraskov(a)gmail.com)
+ *
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.hibernate.eclipse.console.wizards.messages"; //$NON-NLS-1$
+ public static String ConnectionProfile;
+ public static String SelectConnectionProfile;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/NewConfigurationWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/NewConfigurationWizard.java 2012-07-26 11:12:17 UTC (rev 42738)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/NewConfigurationWizard.java 2012-07-26 13:59:18 UTC (rev 42739)
@@ -191,18 +191,11 @@
putIfNotNull(props, Environment.DIALECT, connectionInfoPage.getDialect() );
putIfNotNull(props, Environment.DEFAULT_CATALOG, connectionInfoPage.getDefaultCatalog() );
putIfNotNull(props, Environment.DEFAULT_SCHEMA, connectionInfoPage.getDefaultSchema() );
- if (connectionInfoPage.getConnectionProfileName() != null){
- String cpName = connectionInfoPage.getConnectionProfileName();
- IConnectionProfile profile = ProfileManager.getInstance().getProfileByName(cpName);
- if (profile != null) {
- props.putAll(ConnectionProfileUtil.getHibernateConnectionProperties(profile));
- }
- } else {
- putIfNotNull(props, Environment.DRIVER, connectionInfoPage.getDriver() );
- putIfNotNull(props, Environment.URL, connectionInfoPage.getConnectionURL() );
- putIfNotNull(props, Environment.USER, connectionInfoPage.getUsername() );
- putIfNotNull(props, Environment.PASS, connectionInfoPage.getPassword() );
- }
+ putIfNotNull(props, Environment.DRIVER, connectionInfoPage.getDriver() );
+ putIfNotNull(props, Environment.URL, connectionInfoPage.getConnectionURL() );
+ putIfNotNull(props, Environment.USER, connectionInfoPage.getUsername() );
+ putIfNotNull(props, Environment.PASS, connectionInfoPage.getPassword() );
+
final IFile file = cPage.createNewFile();
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/NewConfigurationWizardPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/NewConfigurationWizardPage.java 2012-07-26 11:12:17 UTC (rev 42738)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/NewConfigurationWizardPage.java 2012-07-26 13:59:18 UTC (rev 42739)
@@ -21,16 +21,22 @@
*/
package org.hibernate.eclipse.console.wizards;
+import java.util.Properties;
+
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
+import org.eclipse.datatools.connectivity.IConnectionProfile;
+import org.eclipse.datatools.connectivity.ProfileManager;
import org.eclipse.jface.dialogs.IDialogPage;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
@@ -38,14 +44,16 @@
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.hibernate.cfg.Environment;
+import org.hibernate.console.ConnectionProfileUtil;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.utils.DriverClassHelpers;
-import org.hibernate.eclipse.launch.ConnectionProfileCtrl;
/**
* Wizard for creating basic hibernate.cfg.xml
@@ -59,12 +67,6 @@
private Label fileText;
private Text sessionFactoryNameText;
-
- private Button useDTPConnection;
-
- private Label dtpConnection;
-
- private ConnectionProfileCtrl connectionProfileCtrl;
private Combo dialectCombo;
@@ -87,7 +89,7 @@
private boolean beenShown = false;
- private Group driverManagerTabContainer;
+ private String defaultConnectionProfile = null;
/**
* Constructor for SampleNewWizardPage.
@@ -158,6 +160,24 @@
sessionFactoryNameText.setLayoutData(gd);
sessionFactoryNameText.addModifyListener(listener);
+ Link link = new Link(container, SWT.RIGHT);
+ link.setText(HibernateConsoleMessages.NewConfigurationWizardPage_getValuesFromConnection);
+ link.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ SelectConnectionProfileDialog dialog = new SelectConnectionProfileDialog(shell);
+ if (defaultConnectionProfile != null) dialog.setDefaultValue(defaultConnectionProfile);
+ if (dialog.open() == Window.OK){
+ defaultConnectionProfile = dialog.getConnectionProfileName();
+ fillPropertiesFromConnectionProfile(defaultConnectionProfile);
+ }
+ }
+ });
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalSpan = 2;
+ link.setLayoutData(gd);
+
label = new Label(container, SWT.NULL);
label.setText(HibernateConsoleMessages.NewConfigurationWizardPage_database_dialect);
dialectCombo = new Combo(container, SWT.NULL);
@@ -178,41 +198,8 @@
gd.horizontalAlignment = SWT.TOP;
gd.verticalAlignment = SWT.TOP;
label.setLayoutData(gd);
-
-
-
- useDTPConnection = new Button(container, SWT.CHECK);
- useDTPConnection.setText("Use DTP Connection");
- useDTPConnection.addSelectionListener(selectionListener);
- GridData gd2 = new GridData(SWT.NULL, SWT.NULL, false, false, 2, 1);
- useDTPConnection.setLayoutData(gd2);
-
- dtpConnection = new Label(container, SWT.NULL);
- dtpConnection.setText("DTP Connection");
- dtpConnection.setLayoutData(gd);
- dtpConnection.setEnabled(false);
-
- connectionProfileCtrl = new ConnectionProfileCtrl(container, 1, ""); //$NON-NLS-1$
- connectionProfileCtrl.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- if (connectionProfileCtrl.hasConnectionProfileSelected()){
- setPageComplete(connectionProfileCtrl.hasConnectionProfileSelected());
- }
- }
- });
- connectionProfileCtrl.setEnabled(false);
-
-
- driverManagerTabContainer = new Group(container, SWT.NONE);
- driverManagerTabContainer.setText("Custom");
- driverManagerTabContainer.setLayout(layout);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- driverManagerTabContainer.setLayoutData(gd);
-
- //Composite driverManagerTabContainer = container;
+ Composite driverManagerTabContainer = container;
label = new Label(driverManagerTabContainer, SWT.NULL);
label.setText(HibernateConsoleMessages.NewConfigurationWizardPage_driver_class);
driver_classCombo = new Combo(driverManagerTabContainer, SWT.NULL);
@@ -239,6 +226,20 @@
urlCombo.addModifyListener(listener);
label = new Label(driverManagerTabContainer, SWT.NULL);
+ label.setText(HibernateConsoleMessages.NewConfigurationWizardPage_default_schema);
+ defaultSchemaText = new Text(driverManagerTabContainer, SWT.BORDER | SWT.SINGLE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ defaultSchemaText.setLayoutData(gd);
+ defaultSchemaText.addModifyListener(listener);
+
+ label = new Label(driverManagerTabContainer, SWT.NULL);
+ label.setText(HibernateConsoleMessages.NewConfigurationWizardPage_default_catalog);
+ defaultCatalogText = new Text(driverManagerTabContainer, SWT.BORDER | SWT.SINGLE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ defaultCatalogText.setLayoutData(gd);
+ defaultCatalogText.addModifyListener(listener);
+
+ label = new Label(driverManagerTabContainer, SWT.NULL);
label.setText(HibernateConsoleMessages.NewConfigurationWizardPage_user_name);
usernameText = new Text(driverManagerTabContainer, SWT.BORDER | SWT.SINGLE);
gd = new GridData(GridData.FILL_HORIZONTAL);
@@ -251,23 +252,10 @@
gd = new GridData(GridData.FILL_HORIZONTAL);
passwordText.setLayoutData(gd);
passwordText.addModifyListener(listener);
-
- label = new Label(container, SWT.NULL);
- label.setText(HibernateConsoleMessages.NewConfigurationWizardPage_default_schema);
- defaultSchemaText = new Text(container, SWT.BORDER | SWT.SINGLE);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- defaultSchemaText.setLayoutData(gd);
- defaultSchemaText.addModifyListener(listener);
- label = new Label(container, SWT.NULL);
- label.setText(HibernateConsoleMessages.NewConfigurationWizardPage_default_catalog);
- defaultCatalogText = new Text(container, SWT.BORDER | SWT.SINGLE);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- defaultCatalogText.setLayoutData(gd);
- defaultCatalogText.addModifyListener(listener);
-
fillLabel(container);
fillLabel(container);
+
fillLabel(container);
createConsoleConfiguration = new Button(container, SWT.CHECK);
@@ -284,6 +272,7 @@
setControl(sc);
}
+
/**
* @param urlCombo2
*/
@@ -336,19 +325,6 @@
* Ensures that contents is ok.
*/
private void dialogChanged() {
- dtpConnection.setEnabled(useDTPConnection.getSelection());
- connectionProfileCtrl.setEnabled(useDTPConnection.getSelection());
- if (useDTPConnection.getSelection()){
- setPageComplete(connectionProfileCtrl.hasConnectionProfileSelected());
- } else {
- setPageComplete(true);
- }
-
- driverManagerTabContainer.setEnabled(!useDTPConnection.getSelection());
- for (Control control : driverManagerTabContainer.getChildren()) {
- control.setEnabled(!useDTPConnection.getSelection());
- }
-
IResource container = ResourcesPlugin.getWorkspace().getRoot()
.findMember(new Path(getContainerName() ) );
String fileName = getFileName();
@@ -481,18 +457,31 @@
public String getDefaultSchema() {
return nullIfEmpty(defaultSchemaText.getText());
}
-
- public void setConnectionProfileName(String cpName){
- if (cpName != null){
- useDTPConnection.setSelection(true);
- connectionProfileCtrl.selectValue(cpName);
- }
+
+ public String getConnectionProfileName() {
+ return defaultConnectionProfile;
}
+
+ public void setConnectionProfileName(String selectedConnectionName) {
+ this.defaultConnectionProfile = selectedConnectionName;
+ }
- public String getConnectionProfileName(){
- if (useDTPConnection.getSelection()){
- return connectionProfileCtrl.getSelectedConnectionName();
+
+ private void fillPropertiesFromConnectionProfile(String cpName){
+ IConnectionProfile profile = ProfileManager.getInstance().getProfileByName(cpName);
+ Properties p = ConnectionProfileUtil.getHibernateConnectionProperties(profile);
+ driver_classCombo.setText(p.getProperty(Environment.DRIVER));
+ urlCombo.setText(p.getProperty(Environment.URL));
+ if (p.containsKey(Environment.USER)){
+ usernameText.setText(p.getProperty(Environment.USER));
}
- return null;
- }
+ if (p.containsKey(Environment.PASS)){
+ passwordText.setText(p.getProperty(Environment.PASS));
+ }
+ /*this causes very long timeouts when db is not started
+ String dialect = ConnectionProfileUtil.autoDetectDialect(p);
+ if (dialect != null){
+ dialectCombo.setText(dialect);
+ }*/
+ }
}
\ No newline at end of file
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/SelectConnectionProfileDialog.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/SelectConnectionProfileDialog.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/SelectConnectionProfileDialog.java 2012-07-26 13:59:18 UTC (rev 42739)
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.hibernate.eclipse.console.wizards;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.hibernate.eclipse.launch.ConnectionProfileCtrl;
+
+/**
+ *
+ * @author Dmitry Geraskov (geraskov(a)gmail.com)
+ *
+ */
+public class SelectConnectionProfileDialog extends Dialog {
+
+ private ConnectionProfileCtrl connectionProfileCtrl;
+ private String selectedCP = null;
+
+ /**
+ * @param shell
+ */
+ protected SelectConnectionProfileDialog(Shell shell) {
+ super(shell);
+ }
+
+ public void setDefaultValue(String str){
+ selectedCP = str;
+ }
+
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ shell.setText(Messages.SelectConnectionProfile);
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Control c = super.createContents(parent);
+ getButton(IDialogConstants.OK_ID).setEnabled(selectedCP != null);
+ return c;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite container) {
+ Composite parent = (Composite) super.createDialogArea(container);
+
+
+ Label label = new Label(parent, SWT.NULL);
+ label.setText(Messages.ConnectionProfile);
+ connectionProfileCtrl = new ConnectionProfileCtrl(parent, 1, ""); //$NON-NLS-1$
+ if (selectedCP != null){
+ connectionProfileCtrl.selectValue(selectedCP);
+ }
+ connectionProfileCtrl.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ getButton(IDialogConstants.OK_ID).setEnabled(connectionProfileCtrl.hasConnectionProfileSelected());
+ selectedCP = connectionProfileCtrl.getSelectedConnectionName();
+ }
+ });
+
+
+ return parent;
+ }
+
+
+
+ public String getConnectionProfileName(){
+ return selectedCP;
+ }
+
+}
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/messages.properties
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/messages.properties (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/wizards/messages.properties 2012-07-26 13:59:18 UTC (rev 42739)
@@ -0,0 +1,2 @@
+ConnectionProfile=Connection Profile
+SelectConnectionProfile=Select Connection Profile
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConnectionProfileCtrl.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConnectionProfileCtrl.java 2012-07-26 11:12:17 UTC (rev 42738)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ConnectionProfileCtrl.java 2012-07-26 13:59:18 UTC (rev 42739)
@@ -360,7 +360,7 @@
buttonEdit.setEnabled(enabled);
}
- public void notifyModifyListeners() {
+ protected void notifyModifyListeners() {
for (int i = 0; i < modifyListeners.size(); i++) {
modifyListeners.get(i).modifyText(null);
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/ConfigurationFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/ConfigurationFactory.java 2012-07-26 11:12:17 UTC (rev 42738)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/ConfigurationFactory.java 2012-07-26 13:59:18 UTC (rev 42739)
@@ -16,7 +16,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
-import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
@@ -46,8 +45,6 @@
import org.hibernate.console.HibernateConsoleRuntimeException;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences.ConfigurationMode;
-import org.hibernate.dialect.Dialect;
-import org.hibernate.dialect.resolver.DialectFactory;
import org.hibernate.util.ConfigHelper;
import org.hibernate.util.XMLHelper;
import org.w3c.dom.Document;
@@ -135,25 +132,10 @@
@SuppressWarnings("unused")
private void autoConfigureDialect(Configuration localCfg) {
if (localCfg.getProperty(Environment.DIALECT) == null) {
- String url = localCfg.getProperty(Environment.URL);
- String user = localCfg.getProperty(Environment.USER);
- String pass = localCfg.getProperty(Environment.PASS);
- Connection connection = null;
- try {
- connection = DriverManager.getConnection(url, user, pass);
- // SQL Dialect:
- Dialect dialect = DialectFactory.buildDialect(localCfg.getProperties(), connection);
- localCfg.setProperty(Environment.DIALECT, dialect.toString());
- } catch (SQLException e) {
- // can't determine dialect
+ String dialect = ConnectionProfileUtil.autoDetectDialect(localCfg.getProperties());
+ if (dialect != null){
+ localCfg.setProperty(Environment.DIALECT, dialect);
}
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException e) {
- // ignore
- }
- }
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConfigurationFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConfigurationFactory.java 2012-07-26 11:12:17 UTC (rev 42738)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConfigurationFactory.java 2012-07-26 13:59:18 UTC (rev 42739)
@@ -135,26 +135,10 @@
@SuppressWarnings("unused")
private void autoConfigureDialect(Configuration localCfg, ServiceRegistry serviceRegistry) {
if (localCfg.getProperty(Environment.DIALECT) == null) {
- String url = localCfg.getProperty(Environment.URL);
- String user = localCfg.getProperty(Environment.USER);
- String pass = localCfg.getProperty(Environment.PASS);
- Connection connection = null;
- try {
- connection = DriverManager.getConnection(url, user, pass);
- // SQL Dialect:
- JdbcServices jdbcServices = serviceRegistry.getService(JdbcServices.class);
- Dialect dialect = jdbcServices.getDialect();
- localCfg.setProperty(Environment.DIALECT, dialect.toString());
- } catch (SQLException e) {
- // can't determine dialect
+ String dialect = ConnectionProfileUtil.autoDetectDialect(localCfg.getProperties());
+ if (dialect != null){
+ localCfg.setProperty(Environment.DIALECT, dialect);
}
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException e) {
- // ignore
- }
- }
}
}
13 years, 2 months
JBoss Tools SVN: r42737 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2012-07-26 05:42:59 -0400 (Thu, 26 Jul 2012)
New Revision: 42737
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ExplorerBase.java
Log:
Improve finding of editor containing opened file when using method openFile().
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ExplorerBase.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ExplorerBase.java 2012-07-26 09:30:27 UTC (rev 42736)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ExplorerBase.java 2012-07-26 09:42:59 UTC (rev 42737)
@@ -122,7 +122,14 @@
}
item.select().doubleClick();
log.info("File Opened:" + builder.toString());
- SWTBotEditor editor = bot.activeEditor();
+ SWTBotEditor editor = null;
+ // Try to find editor containing opened file
+ try{
+ editor = bot.editorByTitle(path[path.length - 1]);
+ } catch (WidgetNotFoundException wnfe){
+ // in case name of opened file is different then editor title of editor containing opened file
+ editor = bot.activeEditor();
+ }
return editor;
}
/**
13 years, 2 months
JBoss Tools SVN: r42736 - trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core.
by jbosstools-commits@lists.jboss.org
Author: ppalaga
Date: 2012-07-26 05:30:27 -0400 (Thu, 26 Jul 2012)
New Revision: 42736
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/
Log:
org.jboss.tools.cdi.deltaspike.core/bin added to svn:ignore.
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core
___________________________________________________________________
Modified: svn:ignore
- target
+ target
bin
13 years, 2 months
JBoss Tools SVN: r42735 - trunk/cdi/tests/org.jboss.tools.cdi.deltaspike.core.test.
by jbosstools-commits@lists.jboss.org
Author: ppalaga
Date: 2012-07-26 05:30:09 -0400 (Thu, 26 Jul 2012)
New Revision: 42735
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.deltaspike.core.test/
Log:
org.jboss.tools.cdi.deltaspike.core.test/bin added to svn:ignore.
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.deltaspike.core.test
___________________________________________________________________
Modified: svn:ignore
- target
+ target
bin
13 years, 2 months
JBoss Tools SVN: r42734 - trunk/central/tests/org.jboss.tools.central.test.ui.bot.
by jbosstools-commits@lists.jboss.org
Author: ppalaga
Date: 2012-07-26 05:29:28 -0400 (Thu, 26 Jul 2012)
New Revision: 42734
Modified:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/
Log:
org.jboss.tools.central.test.ui.bot/bin added to svn:ignore.
Property changes on: trunk/central/tests/org.jboss.tools.central.test.ui.bot
___________________________________________________________________
Modified: svn:ignore
- target
+ target
bin
13 years, 2 months
JBoss Tools SVN: r42733 - trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test.
by jbosstools-commits@lists.jboss.org
Author: ppalaga
Date: 2012-07-26 05:28:27 -0400 (Thu, 26 Jul 2012)
New Revision: 42733
Modified:
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/
Log:
org.jboss.tools.runtime.as.ui.bot.test/bin added to svn:ignore.
Property changes on: trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test
___________________________________________________________________
Modified: svn:ignore
- screenshots
+ screenshots
bin
13 years, 2 months