Author: Grid.Qian
Date: 2011-06-27 01:26:07 -0400 (Mon, 27 Jun 2011)
New Revision: 32367
Added:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/WSRuntimeSelectionChangedListener.java
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JBossWSRuntime.java
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JBossWSRuntimeListConverter.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimeListFieldEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimePreferencePage.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/project/facet/JBossWSRuntimeConfigBlock.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JBossWSUIUtils.java
Log:
JBIDE-7141: add the details of web serivce runtime implemetation and version
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JBossWSRuntime.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JBossWSRuntime.java 2011-06-27
03:22:15 UTC (rev 32366)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JBossWSRuntime.java 2011-06-27
05:26:07 UTC (rev 32367)
@@ -31,6 +31,9 @@
private boolean userConfigClasspath;
+ private String impl;
+ private String versionDetail;
+
/**
* Default constructor
*/
@@ -119,5 +122,23 @@
public void setVersion(String version) {
this.version = version;
}
+
+
+ public String getImpl() {
+ return impl;
+ }
+ public void setImpl(String impl) {
+ this.impl = impl;
+ }
+
+ public String getVersionDetail() {
+ return versionDetail;
+ }
+
+ public void setVersionDetail(String versionDetail) {
+ this.versionDetail = versionDetail;
+ }
+
+
}
Modified:
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JBossWSRuntimeListConverter.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JBossWSRuntimeListConverter.java 2011-06-27
03:22:15 UTC (rev 32366)
+++
trunk/ws/plugins/org.jboss.tools.ws.core/src/org/jboss/tools/ws/core/classpath/JBossWSRuntimeListConverter.java 2011-06-27
05:26:07 UTC (rev 32367)
@@ -29,6 +29,8 @@
private static final String NAME = "name"; //$NON-NLS-1$
private static final String USER_CONFIG_CLASSPATH = "userConfig";
//$NON-NLS-1$
private static final String LIBRARY = "libraries"; //$NON-NLS-1$
+ private static final String IMPL= "impl"; //$NON-NLS-1$
+ private static final String VDETAIL = "vdetail"; //$NON-NLS-1$
/**
* Load String to JBossWSRuntime map from String
@@ -63,12 +65,16 @@
rt.setVersion(value);
} else if (DEFAULT.equals(name)) {
rt.setDefault(Boolean.parseBoolean(value));
- }else if(USER_CONFIG_CLASSPATH.equals(name)){
+ } else if (USER_CONFIG_CLASSPATH.equals(name)){
rt.setUserConfigClasspath(Boolean.parseBoolean(value));
- }else if(LIBRARY.equals(name)){
+ } else if (LIBRARY.equals(name)){
if(value != null && !EMPTY_STRING.equals(value)){
rt.setLibraries(getLibrariesFromString(value));
}
+ } else if (IMPL.equals(name)) {
+ rt.setImpl(value);
+ } else if (VDETAIL.equals(name)) {
+ rt.setVersionDetail(value);
}
}
@@ -129,6 +135,10 @@
buffer.append(runtimes[i].isDefault());
buffer.append(FIELD_SEPARATOR).append(USER_CONFIG_CLASSPATH).append(FIELD_SEPARATOR);
buffer.append(runtimes[i].isUserConfigClasspath());
+ buffer.append(FIELD_SEPARATOR).append(IMPL).append(FIELD_SEPARATOR);
+ buffer.append(runtimes[i].getImpl());
+ buffer.append(FIELD_SEPARATOR).append(VDETAIL).append(FIELD_SEPARATOR);
+ buffer.append(runtimes[i].getVersionDetail());
buffer.append(FIELD_SEPARATOR).append(LIBRARY).append(FIELD_SEPARATOR);
buffer.append(convertListToString(runtimes[i].getLibraries()));
if (i != runtimes.length - 1) {
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties 2011-06-27
03:22:15 UTC (rev 32366)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties 2011-06-27
05:26:07 UTC (rev 32367)
@@ -34,6 +34,9 @@
JBossWS_Runtime_List_Field_Editor_Name2=Name:
JBossWS_Runtime_Check_Field_Default_Classpath=Customize JBoss Web Service runtime jars
JBossWS_Preference_Page_Runtimes=JBossWS Runtimes
+Runtime_Details=Runtime Details
+Runtime_Details_Impl=Implementation:
+Runtime_Details_Version=Version:
JBossWSLibraryListFieldEditor_ActionAdd=&Add
JBossWSLibraryListFieldEditor_ActionRemove=&Remove
JBossWSLibraryListFieldEditor_LIBRARY_JARS=Library Jars
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java 2011-06-27
03:22:15 UTC (rev 32366)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUIMessages.java 2011-06-27
05:26:07 UTC (rev 32367)
@@ -66,6 +66,9 @@
public static String JBossWS_Runtime_List_Field_Editor_Name2;
public static String JBossWS_Runtime_Check_Field_Default_Classpath;
public static String JBossWS_Preference_Page_Runtimes;
+ public static String Runtime_Details;
+ public static String Runtime_Details_Impl;
+ public static String Runtime_Details_Version;
public static String JBossWSLibraryListFieldEditor_ActionAdd;
public static String JBossWSLibraryListFieldEditor_ActionRemove;
public static String JBossWSLibraryListFieldEditor_LIBRARY_JARS;
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimeListFieldEditor.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimeListFieldEditor.java 2011-06-27
03:22:15 UTC (rev 32366)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimeListFieldEditor.java 2011-06-27
05:26:07 UTC (rev 32367)
@@ -54,6 +54,7 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
@@ -62,10 +63,10 @@
import org.jboss.tools.common.ui.widget.editor.ButtonFieldEditor;
import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
import org.jboss.tools.common.ui.widget.editor.IFieldEditorFactory;
-import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
-import org.jboss.tools.ws.ui.utils.JBossWSUIUtils;
import org.jboss.tools.ws.core.classpath.JBossWSRuntime;
import org.jboss.tools.ws.core.classpath.JBossWSRuntimeManager;
+import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
+import org.jboss.tools.ws.ui.utils.JBossWSUIUtils;
/**
* @author Grid Qian
@@ -210,8 +211,7 @@
TableColumn tc3 = new TableColumn(tableView.getTable(), SWT.LEFT);
tc3.setWidth(TC_VERSION_WIDTH);
- tc3
- .setText(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Version);
+ tc3.setText(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Version);
TableColumn tc4 = new TableColumn(tableView.getTable(), SWT.LEFT);
tc4.setWidth(TC_PATH_WIDTH);
@@ -420,28 +420,23 @@
List<JBossWSRuntime> value = null;
- IFieldEditor name = IFieldEditorFactory.INSTANCE.createTextEditor(
- SRT_NAME,
+ IFieldEditor name = IFieldEditorFactory.INSTANCE.createTextEditor(SRT_NAME,
JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Name2, "");
//$NON-NLS-1$
- IFieldEditor version = IFieldEditorFactory.INSTANCE.createComboEditor(
- SRT_VERSION,
- JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Version,
- getWSFacetVersions(), ""); //$NON-NLS-1$
+ IFieldEditor version = IFieldEditorFactory.INSTANCE.createComboEditor(SRT_VERSION,
+ JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Version, getWSFacetVersions(),
""); //$NON-NLS-1$
- IFieldEditor homeDir = IFieldEditorFactory.INSTANCE
- .createBrowseFolderEditor(
- SRT_HOMEDIR,
- JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Home_Folder,
- ""); //$NON-NLS-1$
+ IFieldEditor homeDir =
IFieldEditorFactory.INSTANCE.createBrowseFolderEditor(SRT_HOMEDIR,
+ JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Home_Folder,"");
//$NON-NLS-1$
+
+ Label impl;
+ Label vDetail;
JBossWSRuntime current = null;
-
IFieldEditor jars = null;
public JBossWSRuntimeWizardPage(List<JBossWSRuntime> editedList) {
- super(
- JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_New_Runtime);
+ super(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_New_Runtime);
setMessage(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Create_A_Runtime);
setTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Runtime);
value = editedList;
@@ -450,8 +445,7 @@
/**
* Create Wizard page content
*
- * @param parent
- * Composite - parent composite
+ * @param parent Composite - parent composite
*/
public void createControl(Composite parent) {
parent.setLayout(new GridLayout(GL_PARENT_COLUMNS, false));
@@ -472,11 +466,18 @@
version.setValue(getWSFacetVersions().get(1));
homeDir.doFillIntoGrid(root);
homeDir.addPropertyChangeListener(this);
+
+ Label[] texts = JBossWSUIUtils.createWSRuntimeDetailsGroup(root, 3);
+ impl = texts[0];
+ vDetail = texts[1];
+ if (current != null) {
+ impl.setText(current.getImpl());
+ vDetail.setText(current.getVersionDetail());
+ }
jars = new JBossWSLibraryListFieldEditor("", "", current);
//$NON-NLS-1$ //$NON-NLS-2$
jars.doFillIntoGrid(root);
-
-
+
jars.addPropertyChangeListener(this);
setPageComplete(false);
setControl(root);
@@ -486,20 +487,18 @@
* Process evt: setup default values based on JBossWS Home folder and
* validate user input
*
- * @param evt
- * PropertyChangeEvent describes changes in wizard
+ * @param evt PropertyChangeEvent describes changes in wizard
*/
public void propertyChange(java.beans.PropertyChangeEvent evt) {
if ("homeDir".equals(evt.getPropertyName())) { //$NON-NLS-1$
- if (name.getValueAsString() == null
- || "".equals(name.getValueAsString().trim()) //$NON-NLS-1$
+ if (name.getValueAsString() == null ||
"".equals(name.getValueAsString().trim()) //$NON-NLS-1$
|| this.getErrorMessage() != null) {
String homeDirName = homeDir.getValueAsString();
if (homeDirName != null && !"".equals(homeDirName.trim())) {
//$NON-NLS-1$
File folder = new File(homeDirName);
homeDirName = folder.getName();
}
- name.setValue(homeDirName);
+ name.setValue(homeDirName);
}
}
@@ -510,8 +509,7 @@
return;
}
- if (!name.getValueAsString().matches(
- "[a-zA-Z_][a-zA-Z0-9_\\-\\. ]*")) { //$NON-NLS-1$
+ if (!name.getValueAsString().matches("[a-zA-Z_][a-zA-Z0-9_\\-\\. ]*")) {
//$NON-NLS-1$
setErrorMessage(JBossWSUIMessages.Error_JBossWS_Runtime_List_Field_Editor_Runtime_Name_Is_Not_Correct);
setPageComplete(false);
return;
@@ -521,9 +519,7 @@
continue;
}
if (rt.getName().equals(name.getValueAsString())) {
- setErrorMessage(NLS
- .bind(
- JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Runtime_Already_Exists,
+ setErrorMessage(NLS.bind(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Runtime_Already_Exists,
name.getValueAsString()));
setPageComplete(false);
return;
@@ -536,37 +532,37 @@
&& current.getName().equals(name.getValueAsString())
&& current.getHomeDir().equals(homeDir.getValueAsString())
&& current.getVersion().equals(version.getValueAsString())
- && current.isUserConfigClasspath() == jarJbws
- .isUserConfigClasspath()
+ && current.isUserConfigClasspath() == jarJbws.isUserConfigClasspath()
&& (!jarJbws.isUserConfigClasspath() || hasSameLibraies(
- current.getLibraries(), jarJbws.getLibraries()))) {
-
+ current.getLibraries(), jarJbws.getLibraries()))) {
setErrorMessage(null);
setPageComplete(false);
return;
}
- if (jarJbws.isUserConfigClasspath()
- && jarJbws.getLibraries().size() == 0) {
+ if (jarJbws.isUserConfigClasspath()&& jarJbws.getLibraries().size() == 0) {
setErrorMessage(JBossWSUIMessages.JBossRuntimeListFieldEditor_ErrorMessageAtLeastOneJar);
setPageComplete(false);
return;
}
}
- if (homeDir.getValueAsString() == null
- || "".equals(homeDir.getValueAsString().trim())) { //$NON-NLS-1$
+ if (homeDir.getValueAsString() == null ||
"".equals(homeDir.getValueAsString().trim())) { //$NON-NLS-1$
setErrorMessage(JBossWSUIMessages.Error_JBossWS_Runtime_List_Field_Editor_Path_To_Home_Diretory_Cannot_Be_Empty);
setPageComplete(false);
return;
- }
+ }
if (!runtimeExist(homeDir.getValueAsString())) {
setErrorMessage(JBossWSUIMessages.Error_JBossWS_Label_Runtime_Load);
setPageComplete(false);
return;
+ } else if ("homeDir".equals(evt.getPropertyName())) { //$NON-NLS-1$
+ String[] strs = JBossWSUIUtils.getWSRuntimeDetail(homeDir.getValueAsString());
+ impl.setText(strs[0]);
+ vDetail.setText(strs[1]);
}
-
+
setErrorMessage(null);
setPageComplete(true);
}
@@ -578,7 +574,6 @@
if (!lib2.contains(jar))
return false;
}
-
return true;
}
@@ -587,12 +582,10 @@
*/
private List<String> getWSFacetVersions() {
List<String> versions = new ArrayList<String>();
- IProjectFacet wsFacet = ProjectFacetsManager
- .getProjectFacet("jbossws.core"); //$NON-NLS-1$
+ IProjectFacet wsFacet =
ProjectFacetsManager.getProjectFacet("jbossws.core"); //$NON-NLS-1$
for (IProjectFacetVersion version : wsFacet.getVersions()) {
versions.add(version.getVersionString());
}
-
return versions;
}
@@ -606,6 +599,8 @@
newRt.setName(name.getValueAsString());
newRt.setVersion(version.getValueAsString());
newRt.setHomeDir(homeDir.getValueAsString());
+ newRt.setImpl(impl.getText());
+ newRt.setVersionDetail(vDetail.getText());
JBossWSRuntime rt = (JBossWSRuntime) jars.getValue();
newRt.setLibraries(rt.getLibraries());
newRt.setUserConfigClasspath(rt.isUserConfigClasspath());
@@ -617,11 +612,9 @@
return new ButtonFieldEditor.ButtonPressedAction(buttonName) {
@Override
public void run() {
- DirectoryDialog dialog = new DirectoryDialog(Display
- .getCurrent().getActiveShell());
+ DirectoryDialog dialog = new
DirectoryDialog(Display.getCurrent().getActiveShell());
dialog.setFilterPath(getFieldEditor().getValueAsString());
- dialog
- .setMessage(JBossWSUIMessages.JBossWS_SWT_Field_Editor_Factory_Select_Home_Folder);
+ dialog.setMessage(JBossWSUIMessages.JBossWS_SWT_Field_Editor_Factory_Select_Home_Folder);
dialog.setFilterPath(getFieldEditor().getValueAsString());
String directory = dialog.open();
if (directory != null) {
@@ -632,23 +625,13 @@
}
private boolean runtimeExist(String path) {
-
File jbosswsHomeDir = new File(path);
if (!jbosswsHomeDir.isDirectory())
return false;
- String[] newNode = { JBossWSUIMessages.Bin,
- JBossWSUIMessages.Command };
+ String[] newNode = { JBossWSUIMessages.Bin, JBossWSUIMessages.Command };
String jbosswsBinPath = JBossWSUIUtils.addNodesToPath(
jbosswsHomeDir.getAbsolutePath(), newNode);
- if (new File(jbosswsBinPath).isFile()
- && new File(JBossWSUIUtils.addAnotherNodeToPath(
- jbosswsHomeDir.getAbsolutePath(),
- JBossWSUIMessages.Client)).isDirectory()
- && new File(JBossWSUIUtils
- .addNodesToPath(jbosswsHomeDir.getAbsolutePath(),
- new String[] { JBossWSUIMessages.Lib,
- JBossWSUIMessages.Endorsed }))
- .isDirectory()) {
+ if (new File(jbosswsBinPath).isFile()) {
return true;
}
return false;
@@ -665,8 +648,7 @@
List<JBossWSRuntime> added = null;
List<JBossWSRuntime> value = null;
- public JBossWSRuntimeNewWizard(List<JBossWSRuntime> exist,
- List<JBossWSRuntime> added) {
+ public JBossWSRuntimeNewWizard(List<JBossWSRuntime>
exist,List<JBossWSRuntime> added) {
super();
setWindowTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_New_Runtime);
page1 = new JBossWSRuntimeWizardPage(exist);
@@ -726,10 +708,8 @@
super();
setWindowTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Edit_Runtime);
page1 = new JBossWSRuntimeWizardPage(existing);
- page1
- .setMessage(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Modify_Runtime);
- page1
- .setTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Edit_Runtime);
+ page1.setMessage(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Modify_Runtime);
+ page1.setTitle(JBossWSUIMessages.JBossWS_Runtime_List_Field_Editor_Edit_Runtime);
addPage(page1);
this.value = existing;
this.added = added;
@@ -756,6 +736,8 @@
source.setVersion(rt.getVersion());
source.setUserConfigClasspath(rt.isUserConfigClasspath());
source.setLibraries(rt.getLibraries());
+ source.setImpl(rt.getImpl());
+ source.setVersionDetail(rt.getVersionDetail());
} else {
changed.put(rt, source);
if (source.isDefault()) {
@@ -1106,4 +1088,8 @@
}
}
}
+
+ public CheckboxTableViewer getTableView() {
+ return tableView;
+ }
}
\ No newline at end of file
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimePreferencePage.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimePreferencePage.java 2011-06-27
03:22:15 UTC (rev 32366)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JBossWSRuntimePreferencePage.java 2011-06-27
05:26:07 UTC (rev 32367)
@@ -20,11 +20,13 @@
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.jboss.tools.ws.core.classpath.JBossWSRuntime;
import org.jboss.tools.ws.core.classpath.JBossWSRuntimeManager;
import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
+import org.jboss.tools.ws.ui.utils.JBossWSUIUtils;
/**
* @author Grid Qian
@@ -42,6 +44,9 @@
JBossWSRuntimeListFieldEditor jbossWSRuntimes = new JBossWSRuntimeListFieldEditor(
"rtlist", JBossWSUIMessages.JBossWS_Preference_Page_Runtimes, new
ArrayList<JBossWSRuntime>(Arrays.asList(JBossWSRuntimeManager.getInstance().getRuntimes())));
//$NON-NLS-1$
+ Label impl;
+ Label vDetail;
+
/**
* Create contents of JBossWS preferences page. JBossWSRuntime list editor
* is created
@@ -52,6 +57,12 @@
GridLayout gl = new GridLayout(COLUMNS, false);
root.setLayout(gl);
jbossWSRuntimes.doFillIntoGrid(root);
+
+ Label[] texts = JBossWSUIUtils.createWSRuntimeDetailsGroup(root, 2);
+ impl = texts[0];
+ vDetail = texts[1];
+
+ jbossWSRuntimes.getTableView().addSelectionChangedListener(new
WSRuntimeSelectionChangedListener(impl, vDetail));
return root;
}
Added:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/WSRuntimeSelectionChangedListener.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/WSRuntimeSelectionChangedListener.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/WSRuntimeSelectionChangedListener.java 2011-06-27
05:26:07 UTC (rev 32367)
@@ -0,0 +1,34 @@
+package org.jboss.tools.ws.ui.preferences;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Label;
+import org.jboss.tools.ws.core.classpath.JBossWSRuntime;
+
+public class WSRuntimeSelectionChangedListener implements
+ ISelectionChangedListener {
+
+ private Label impl;
+ private Label vdetail;
+
+ public WSRuntimeSelectionChangedListener(Label impl, Label vdetail) {
+ this.impl = impl;
+ this.vdetail = vdetail;
+ }
+
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ ISelection selection = event.getSelection();
+ if (selection instanceof StructuredSelection) {
+ JBossWSRuntime runtime =
(JBossWSRuntime)((StructuredSelection)selection).getFirstElement();
+ if (runtime == null) {
+ return;
+ }
+ impl.setText(runtime.getImpl());
+ vdetail.setText(runtime.getVersionDetail());
+ }
+ }
+
+}
Property changes on:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/WSRuntimeSelectionChangedListener.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/project/facet/JBossWSRuntimeConfigBlock.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/project/facet/JBossWSRuntimeConfigBlock.java 2011-06-27
03:22:15 UTC (rev 32366)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/project/facet/JBossWSRuntimeConfigBlock.java 2011-06-27
05:26:07 UTC (rev 32367)
@@ -42,6 +42,7 @@
import org.jboss.tools.ws.ui.JBossWSUIPlugin;
import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
import org.jboss.tools.ws.ui.preferences.JBossWSRuntimeListFieldEditor;
+import org.jboss.tools.ws.ui.utils.JBossWSUIUtils;
public class JBossWSRuntimeConfigBlock {
@@ -50,6 +51,8 @@
private Combo cmbRuntimes;
private Button btnDeploy;
private Button btnNew;
+ private Label impl;
+ private Label vDetail;
private String errMsg;
private IMessageNotifier notifier;
@@ -96,8 +99,7 @@
setServerSuppliedSelection(e);
}
});
- lblServerSupplied
- .setText(JBossWSUIMessages.JBossWSFacetInstallPage_ServerSuppliedJBossWS);
+ lblServerSupplied.setText(JBossWSUIMessages.JBossWSFacetInstallPage_ServerSuppliedJBossWS);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
lblServerSupplied.setLayoutData(gd);
@@ -115,8 +117,7 @@
cmbRuntimes.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
String runtimeName = cmbRuntimes.getText();
- JBossWSRuntime jr = (JBossWSRuntime) cmbRuntimes
- .getData(runtimeName);
+ JBossWSRuntime jr = (JBossWSRuntime) cmbRuntimes.getData(runtimeName);
saveJBosswsRuntimeToModel(jr);
changePageStatus();
}
@@ -132,18 +133,19 @@
});
btnDeploy = new Button(composite, SWT.CHECK);
- btnDeploy
- .setText(JBossWSUIMessages.JBossWSFacetInstallPage_Deploy);
+ btnDeploy.setText(JBossWSUIMessages.JBossWSFacetInstallPage_Deploy);
btnDeploy.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- model.setBooleanProperty(
- IJBossWSFacetDataModelProperties.JBOSS_WS_DEPLOY,
- btnDeploy.getSelection());
+ model.setBooleanProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_DEPLOY,
btnDeploy.getSelection());
}
});
gd = new GridData();
gd.horizontalSpan = 3;
btnDeploy.setLayoutData(gd);
+
+ Label[] texts = JBossWSUIUtils.createWSRuntimeDetailsGroup(composite, 2);
+ impl = texts[0];
+ vDetail = texts[1];
setInitialValues();
changePageStatus();
@@ -152,7 +154,7 @@
}
- private void validateTargetRuntime() {
+ private void validateandDisplayTargetRuntime() {
IFacetedProjectWorkingCopy fpWorkingCopy = (IFacetedProjectWorkingCopy) model
.getProperty(JBossWSFacetInstallDataModelProvider.FACETED_PROJECT_WORKING_COPY);
IRuntime runtime = null;
@@ -181,7 +183,11 @@
return;
}
}
-
+
+ String[] strs =
JBossWSUIUtils.getWSRuntimeDetail(serverRuntime.getLocation().toFile().getAbsolutePath());
+ impl.setText(strs[0]);
+ vDetail.setText(strs[1]);
+
setErrorMessage(null);
}
@@ -216,33 +222,21 @@
StatusUtils.errorStatus(e1));
}
if ("".equals(duplicateMsg)) { //$NON-NLS-1$
- model.setStringProperty(
- IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_HOME,
- jbws.getHomeDir());
- model.setStringProperty(
- IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_ID, jbws
- .getName());
+ model.setStringProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_HOME,
jbws.getHomeDir());
+ model.setStringProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_ID,
jbws.getName());
} else {
- model.setStringProperty(
- IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_ID, null);
- model.setStringProperty(
- IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_HOME,
- null);
+ model.setStringProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_ID, null);
+ model.setStringProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_HOME,
null);
}
}
protected void setServerSuppliedSelection(EventObject e) {
btnServerSupplied.setSelection(true);
btnUserSupplied.setSelection(false);
- model
- .setBooleanProperty(
- IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_IS_SERVER_SUPPLIED,
- true);
+ model.setBooleanProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_IS_SERVER_SUPPLIED,
true);
// remove user supplied properties
- model.setStringProperty(
- IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_ID, null);
- model.setStringProperty(
- IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_HOME, null);
+ model.setStringProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_ID, null);
+ model.setStringProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_HOME, null);
enableUserSupplied(false);
changePageStatus();
@@ -252,13 +246,9 @@
protected void setUserSuppliedSelection(EventObject e) {
btnServerSupplied.setSelection(false);
btnUserSupplied.setSelection(true);
- model
- .setBooleanProperty(
- IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_IS_SERVER_SUPPLIED,
- false);
+ model.setBooleanProperty(IJBossWSFacetDataModelProperties.JBOSS_WS_RUNTIME_IS_SERVER_SUPPLIED,
false);
String runtimeId = cmbRuntimes.getText();
- JBossWSRuntime jbws = JBossWSRuntimeManager.getInstance()
- .findRuntimeByName(runtimeId);
+ JBossWSRuntime jbws =
JBossWSRuntimeManager.getInstance().findRuntimeByName(runtimeId);
if (jbws != null) {
saveJBosswsRuntimeToModel(jbws);
@@ -281,8 +271,7 @@
// int selectIndex = 0;
int defaultIndex = 0;
cmRuntime.removeAll();
- JBossWSRuntime[] runtimes = JBossWSRuntimeManager.getInstance()
- .getRuntimes();
+ JBossWSRuntime[] runtimes = JBossWSRuntimeManager.getInstance().getRuntimes();
for (int i = 0; i < runtimes.length; i++) {
JBossWSRuntime jr = runtimes[i];
if (jbossWSVersion.compareTo(jr.getVersion()) > 0) {
@@ -348,22 +337,27 @@
setErrorMessage(JBossWSUIMessages.Error_WS_Chose_runtime);
} else if (btnUserSupplied.getSelection()) {
String duplicateMsg = ""; //$NON-NLS-1$
+ String jr = cmbRuntimes.getText();
try {
- duplicateMsg = getDuplicateJars(cmbRuntimes.getText());
+ duplicateMsg = getDuplicateJars(jr);
} catch (JavaModelException e1) {
JBossWSUIPlugin.getDefault().getLog().log(
StatusUtils.errorStatus(e1));
}
if (!duplicateMsg.equals("")) { //$NON-NLS-1$
- setErrorMessage(MessageFormat
- .format(
- JBossWSUIMessages.Error_JBossWSRuntimeConfigBlock_Duplicated_Jar,
- duplicateMsg));
+ setErrorMessage(MessageFormat.format(JBossWSUIMessages.Error_JBossWSRuntimeConfigBlock_Duplicated_Jar,duplicateMsg));
} else {
setErrorMessage(null);
}
+ if (jr != null) {
+ JBossWSRuntime r = (JBossWSRuntime)cmbRuntimes.getData(jr);
+ if (r != null) {
+ impl.setText(r.getImpl());
+ vDetail.setText(r.getVersionDetail());
+ }
+ }
} else if (btnServerSupplied.getSelection()) {
- validateTargetRuntime();
+ validateandDisplayTargetRuntime();
} else {
setErrorMessage(null);
}
@@ -397,8 +391,7 @@
protected String getDuplicateJars(String jbwsName)
throws JavaModelException {
- String prjName = model
- .getStringProperty(IFacetDataModelProperties.FACET_PROJECT_NAME);
+ String prjName =
model.getStringProperty(IFacetDataModelProperties.FACET_PROJECT_NAME);
if (prjName == null || "".equals(prjName)) { //$NON-NLS-1$
return ""; //$NON-NLS-1$
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JBossWSUIUtils.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JBossWSUIUtils.java 2011-06-27
03:22:15 UTC (rev 32366)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/utils/JBossWSUIUtils.java 2011-06-27
05:26:07 UTC (rev 32367)
@@ -12,7 +12,10 @@
package org.jboss.tools.ws.ui.utils;
import java.io.File;
+import java.io.IOException;
import java.net.URI;
+import java.util.jar.Attributes;
+import java.util.jar.JarFile;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
@@ -27,6 +30,12 @@
import org.eclipse.jdt.core.JavaConventions;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
import org.jboss.tools.ws.core.utils.StatusUtils;
import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
import org.jboss.tools.ws.ui.JBossWSUIPlugin;
@@ -38,6 +47,14 @@
public class JBossWSUIUtils {
private static String JAVA = ".java"; //$NON-NLS-1$
private static String CLASS = ".class"; //$NON-NLS-1$
+ private static final String WS_NATIVE_JAR = "jbossws-native-client.jar";
//$NON-NLS-1$
+ private static final String WS_CXF_JAR = "jbossws-cxf-client.jar";
//$NON-NLS-1$
+ private static final String WS_METRO_JAR = "jbossws-metro-client.jar";
//$NON-NLS-1$
+ private static final String CLIENT_FOLDER = "client"; //$NON-NLS-1$
+ private static final String CLIENT_AS7_FOLDER =
"modules:org:jboss:ws:jaxws-client:main"; //$NON-NLS-1$
+ private static final String WS_IMPL = "Implementation-Title"; //$NON-NLS-1$
+ private static final String WS_VERSION = "Implementation-Version";
//$NON-NLS-1$
+ private static final String WS_JAR = "jbossws-client.jar"; //$NON-NLS-1$
public static String addAnotherNodeToPath(String currentPath, String newNode) {
return currentPath + File.separator + newNode;
@@ -157,5 +174,95 @@
return new String[] { JavaCore.getOption(JavaCore.COMPILER_SOURCE),
JavaCore.getOption(JavaCore.COMPILER_COMPLIANCE) };
}
+
+
+ public static String[] getWSRuntimeDetail(String serverHome) {
+ String[] strs = null;
+ File jbosswsHomeDir = new File(serverHome);
+
+ String jarPath = JBossWSUIUtils.addNodesToPath(jbosswsHomeDir.getAbsolutePath(), new
String[] {CLIENT_FOLDER, WS_CXF_JAR});
+ strs = getWSRuntimeDetailFromPath(jarPath);
+ if (strs != null) {
+ return strs;
+ }
+ jarPath = JBossWSUIUtils.addNodesToPath(jbosswsHomeDir.getAbsolutePath(), new String[]
{CLIENT_FOLDER, WS_NATIVE_JAR});
+ strs = getWSRuntimeDetailFromPath(jarPath);
+ if (strs != null) {
+ return strs;
+ }
+ jarPath = JBossWSUIUtils.addNodesToPath(jbosswsHomeDir.getAbsolutePath(), new String[]
{CLIENT_FOLDER, WS_METRO_JAR});
+ strs = getWSRuntimeDetailFromPath(jarPath);
+ if (strs != null) {
+ return strs;
+ }
+ jarPath = JBossWSUIUtils.addNodesToPath(jbosswsHomeDir.getAbsolutePath(), new String[]
{CLIENT_FOLDER, WS_JAR});
+ strs = getWSRuntimeDetailFromPath(jarPath);
+ if (strs != null) {
+ return strs;
+ }
+
+ String as7 = JBossWSUIUtils.addNodesToPath(jbosswsHomeDir.getAbsolutePath(),
CLIENT_AS7_FOLDER.split(":")); //$NON-NLS-1$
+ File as7File = new File(as7);
+ if (!as7File.isDirectory()) {
+ return new String[] {"", ""}; //$NON-NLS-1$ //$NON-NLS-2$;
+ }
+ File[] files = as7File.listFiles();
+ String jarName = ""; //$NON-NLS-1$
+ for (int i = 0 ; i < files.length ; i++) {
+ jarName = files[i].getName();
+ if (jarName.contains(WS_CXF_JAR.substring(0, WS_CXF_JAR.length()-5))
+ || jarName.contains(WS_CXF_JAR.substring(0, WS_NATIVE_JAR.length()-5))
+ || jarName.contains(WS_CXF_JAR.substring(0, WS_METRO_JAR.length()-5))) {
+ strs = getWSRuntimeDetailFromPath(files[i].getAbsolutePath());
+ if (strs != null) {
+ return strs;
+ }
+ }
+ }
+ return new String[] {"", ""}; //$NON-NLS-1$ //$NON-NLS-2$;
+ }
+
+ public static String[] getWSRuntimeDetailFromPath(String path) {
+ File jarFile = new File(path);
+ if (!jarFile.isFile()) {
+ return null;
+ }
+ String[] strs = new String[] {"", ""}; //$NON-NLS-1$ //$NON-NLS-2$
+ JarFile jar;
+ try {
+ jar = new JarFile(jarFile);
+ Attributes attributes = jar.getManifest().getMainAttributes();
+ strs[0] = attributes.getValue(WS_IMPL);
+ strs[1] = attributes.getValue(WS_VERSION);
+ } catch (IOException e) {
+ return strs;
+ }
+ return strs;
+ }
+ public static Label[] createWSRuntimeDetailsGroup(Composite root, int horizontalSpan) {
+ Group wsRuntimeDetails = new Group(root, SWT.NONE);
+ wsRuntimeDetails.setText(JBossWSUIMessages.Runtime_Details);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = horizontalSpan;
+ wsRuntimeDetails.setLayout(new GridLayout(2, false));
+ wsRuntimeDetails.setLayoutData(gd);
+
+ new Label(wsRuntimeDetails, SWT.NONE).setText(JBossWSUIMessages.Runtime_Details_Impl);
+ Label impl = new Label(wsRuntimeDetails, SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ impl.setLayoutData(gd);
+
+ new Label(wsRuntimeDetails,
SWT.NONE).setText(JBossWSUIMessages.Runtime_Details_Version);
+ Label vDetail = new Label(wsRuntimeDetails, SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ vDetail.setLayoutData(gd);
+
+ Label[] labels = new Label[] {impl, vDetail};
+
+ return labels;
+
+
+ }
+
}
\ No newline at end of file