JBoss Tools SVN: r8563 - trunk/common/plugins/org.jboss.tools.common.model/resources/help.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-06-05 05:13:17 -0400 (Thu, 05 Jun 2008)
New Revision: 8563
Modified:
trunk/common/plugins/org.jboss.tools.common.model/resources/help/keys-model.properties
Log:
Dialog title 'Properties' is made common
so that not to keep a lot of ..._Properties.WindowTitle
constants in *.properties files.
Modified: trunk/common/plugins/org.jboss.tools.common.model/resources/help/keys-model.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/resources/help/keys-model.properties 2008-06-05 08:46:09 UTC (rev 8562)
+++ trunk/common/plugins/org.jboss.tools.common.model/resources/help/keys-model.properties 2008-06-05 09:13:17 UTC (rev 8563)
@@ -1,3 +1,5 @@
+Properties.WindowTitle=Properties
+
##### File Systems #####
FileSystems=/model/FileSystems.html
@@ -3,5 +5,4 @@
FileSystems_Properties=/model/noHelpYet.html
-FileSystems_Properties.WindowTitle=Properties
FileSystems_Properties.Title=Project
@@ -33,7 +34,6 @@
FileSystemFolder=/model/FileSystemFolder.html
FileSystemFolder_Properties=/model/FolderProperty.html
-FileSystemFolder_Properties.WindowTitle=Properties
FileSystemFolder_Properties.Title=Folder System
FileSystemFolder_CreateFolder=/model/CreateFile.html
@@ -48,7 +48,6 @@
FileSystemJar=/model/FileSystemJar.html
FileSystemJar_Properties=/model/FileSystemJar_Properties.html
-FileSystemJar_Properties.WindowTitle=Properties
FileSystemJar_Properties.Title=File System
##### Folder #####
@@ -56,7 +55,6 @@
FileFolder=/model/FileFolder.html
FileFolder_Properties=/model/FolderProperty.html
-FileFolder_Properties.WindowTitle=Properties
FileFolder_Properties.Title=Folder
FileFolder_CreateFolder=/model/CreateFile.html
@@ -68,12 +66,10 @@
JarFolder=/model/JarFolder.html
JarFolder_Properties=/model/JarFolder_Properties.html
-JarFolder_Properties.WindowTitle=Properties
JarFolder_Properties.Title=Jar Folder
FileGIF=/model/FileGIF.html
FileGIF_Properties=/model/FileProperty.html
-FileGIF_Properties.WindowTitle=Properties
FileGIF_Properties.Title=File GIF
##### File Properties #####
@@ -82,12 +78,10 @@
FilePROPERTIES_Rename=/model/FilePROPERTIES.html
-FilePROPERTIES_Properties.WindowTitle=Properties
FilePROPERTIES_Properties.Title=File Properties
Property=/model/Property.html
-Property_Properties.WindowTitle=Properties
Property_Properties.Title=Property
Property_Edit.WindowTitle=Edit
@@ -101,25 +95,21 @@
FileAnyAuxiliary=/model/FileAny.html
FileAnyAuxiliary_Properties=/model/FileProperty.html
-FileAnyAuxiliary_Properties.WindowTitle=Properties
FileAnyAuxiliary_Properties.Title=File
FileAny=/model/FileAny.html
FileAny_Properties=/model/FileProperty.html
-FileAny_Properties.WindowTitle=Properties
FileAny_Properties.Title=File
FileAnyLong=/model/FileAny.html
FileAnyLong_Properties=/model/FileProperty.html
-FileAnyLong_Properties.WindowTitle=Properties
FileAnyLong_Properties.Title=File
FileTXT=/model/FileTXT.html
FileTXT_Properties=/model/FileProperty.html
-FileTXT_Properties.WindowTitle=Properties
FileTXT_Properties.Title=File
##### Create File #####
@@ -137,7 +127,6 @@
FileJSP=/model/FileJSP.html
FileJSP_Properties=/model/FileJSP.html
-FileJSP_Properties.WindowTitle=Properties
FileJSP_Properties.Title=File JSP
FileJSP_Rename=/model/FileJSP.html
@@ -156,7 +145,6 @@
##### File XHTML #####
FileXHTML_Properties=/model/FileProperty.html
-FileXHTML_Properties.WindowTitle=Properties
FileXHTML_Properties.Title=File XHTML
FileXHTML_Rename=/model/FileXHTML.html
@@ -176,7 +164,6 @@
FileHTML=/model/FileHTML.html
FileHTML_Properties=/model/FileProperty.html
-FileHTML_Properties.WindowTitle=Properties
FileHTML_Properties.Title=File HTML
FileHTML_Rename=/model/FileHTML.html
@@ -195,7 +182,6 @@
FileXSL=/model/FileXSL.html
FileXSL_Properties=/model/FileProperty.html
-FileXSL_Properties.WindowTitle=Properties
FileXSL_Properties.Title=File XSL
##### Create File XSL #####
@@ -225,7 +211,6 @@
FileANT=/model/FileANT.html
FileANT_Properties=/model/FileProperty.html
-FileANT_Properties.WindowTitle=Properties
FileANT_Properties.Title=File ANT
##### Create File ANT #####
@@ -240,7 +225,6 @@
FileCLASS=/model/FileCLASS.html
FileCLASS_Properties=/model/FileProperty.html
-FileCLASS_Properties.WindowTitle=Properties
FileCLASS_Properties.Title=Java Class File
##### File *.java #####
@@ -248,7 +232,6 @@
FileJAVA=/model/FileJAVA.html
FileJAVA_Properties=/model/FileProperty.html
-FileJAVA_Properties.WindowTitle=Properties
FileJAVA_Properties.Title=Java File
#### Create file *.java #####
@@ -269,13 +252,11 @@
SharableIcon=/model/PaletteEditor.html
SharableIcon_Properties=/model/PaletteEditor.html
-SharableIcon_Properties.WindowTitle=Properties
SharableIcon_Properties.Title=Icon
SharableIcons=/model/PaletteEditor.html
SharableIcons_Properties=/model/PaletteEditor.html
-SharableIcons_Properties.WindowTitle=Properties
SharableIcons_Properties.Title=Icons Folder
SharableIcons_CreateIconSet=/model/PaletteEditor.html
@@ -293,7 +274,6 @@
SharableXStudioIcons_CreateIcons.Title=Icon Set
SharableXStudioIcons_Properties=/model/PaletteEditor.html
-SharableXStudioIcons_Properties.WindowTitle=Properties
SharableXStudioIcons_Properties.Title=
SharablePalette=/model/PaletteEditor.html
@@ -303,7 +283,6 @@
SharablePalette_CreatePageTabHTML_0.Title=Palette Top-Level Group
SharablePalette_Properties=/model/PaletteEditor.html
-SharablePalette_Properties.WindowTitle=Properties
SharablePalette_Properties.Title=
SharablePalette_HiddenTabs=/model/PaletteEditor.html
@@ -313,7 +292,6 @@
SharableXStudio=/model/PaletteEditor.html
SharableXStudio_Properties=/model/PaletteEditor.html
-SharableXStudio_Properties.WindowTitle=Properties
SharableGroup=/model/PaletteEditor.html
@@ -324,7 +302,6 @@
SharableGroup_CreateMacro.WindowTitle=Add Palette Macro
SharableGroup_Properties=/model/PaletteEditor.html
-SharableGroup_Properties.WindowTitle=Properties
SharableGroup_Properties.Title=
SharableGroupHTML=/model/PaletteEditor.html
@@ -334,7 +311,6 @@
SharableGroupHTML_CreateMacro.Title=Palette Macro
SharableGroupHTML_Properties=/model/PaletteEditor.html
-SharableGroupHTML_Properties.WindowTitle=Properties
SharableGroupHTML_Properties.Title=
SharableGroupHTML_Edit=/model/PaletteEditor.html
@@ -344,7 +320,6 @@
SharableMacro=/model/PaletteEditor.html
SharableMacro_Properties=/model/PaletteEditor.html
-SharableMacro_Properties.WindowTitle=Properties
SharableMacro_Properties.Title=Macro
SharableMacroHTML=/model/PaletteEditor.html
@@ -353,7 +328,6 @@
SharableMacroHTML_Edit_start_text=/model/PaletteEditor.html
SharableMacroHTML_Edit_end_text=/model/PaletteEditor.html
SharableMacroHTML_Properties=/model/PaletteEditor.html
-SharableMacroHTML_Properties.WindowTitle=Properties
SharableMacroHTML_Properties.Title=Macro
SharableMacroHTML_Edit_description=/model/noHelpYet.html
@@ -373,7 +347,6 @@
SharablePageTab_CreateMacro.Title=Edit Description
SharablePageTab_Properties=/model/PaletteEditor.html
-SharablePageTab_Properties.WindowTitle=Properties
SharablePageTab_Properties.Title=
SharablePageTabHTML=/model/PaletteEditor.html
@@ -389,7 +362,6 @@
SharablePageTabHTML_CreateMacro_0=/model/PaletteEditor.html
SharablePageTabHTML_Properties=/model/PaletteEditor.html
-SharablePageTabHTML_Properties.WindowTitle=Properties
SharablePageTabHTML_Properties.Title=
SharablePageTabHTML_Edit.WindowTitle=Edit
15 years, 10 months
JBoss Tools SVN: r8562 - in trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui: wizards/query and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-06-05 04:46:09 -0400 (Thu, 05 Jun 2008)
New Revision: 8562
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/PropertiesWizard.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/query/AbstractQueryWizard.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/query/AbstractQueryWizardView.java
Log:
Dialog title 'Properties' is made common
so that not to keep a lot of ..._Properties.WindowTitle
constants in *.properties files.
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/PropertiesWizard.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/PropertiesWizard.java 2008-06-05 07:28:36 UTC (rev 8561)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/objecteditor/PropertiesWizard.java 2008-06-05 08:46:09 UTC (rev 8562)
@@ -12,6 +12,7 @@
import java.util.Properties;
+import org.jboss.tools.common.meta.key.WizardKeys;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.ui.wizards.query.AbstractQueryWizard;
import org.jboss.tools.common.model.ui.wizards.query.AbstractQueryWizardView;
@@ -54,6 +55,9 @@
try {
objectEditor.setModelObject((XModelObject)dataObject);
Properties p = findProperties(data);
+ if(windowTitle == null) {
+ windowTitle = WizardKeys.getHeader("Properties");
+ }
boolean viewMode = p != null && "true".equals(p.getProperty("viewMode"));
objectEditor.setViewMode(viewMode);
} catch (Exception e) {
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/query/AbstractQueryWizard.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/query/AbstractQueryWizard.java 2008-06-05 07:28:36 UTC (rev 8561)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/query/AbstractQueryWizard.java 2008-06-05 08:46:09 UTC (rev 8562)
@@ -44,6 +44,7 @@
} else {
String title = p.getProperty("title");
if(title == null) title = WizardKeys.getHeader(key);
+ if(title == null) title = WizardKeys.getHeader("Properties"); // NON-NLS-1
if(title == null) title = "Title is not found for key \"" + key + "\"";
view.setWindowTitle(title);
String subtitle = p.getProperty("subtitle");
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/query/AbstractQueryWizardView.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/query/AbstractQueryWizardView.java 2008-06-05 07:28:36 UTC (rev 8561)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/wizards/query/AbstractQueryWizardView.java 2008-06-05 08:46:09 UTC (rev 8562)
@@ -35,7 +35,7 @@
protected CommandBar commandBar = new CommandBar();
protected XModel model;
- private String windowTitle;
+ protected String windowTitle;
private String title = "";
private String message;
private String errorMessage;
15 years, 10 months
JBoss Tools SVN: r8561 - in trunk/common/plugins/org.jboss.tools.common.model/resources: meta and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-06-05 03:28:36 -0400 (Thu, 05 Jun 2008)
New Revision: 8561
Modified:
trunk/common/plugins/org.jboss.tools.common.model/resources/help/keys-model.properties
trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta
Log:
http://jira.jboss.com/jira/browse/JBIDE-2111, slider control added, source-visual editors sash weights configuration now available.
Modified: trunk/common/plugins/org.jboss.tools.common.model/resources/help/keys-model.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/resources/help/keys-model.properties 2008-06-05 07:28:30 UTC (rev 8560)
+++ trunk/common/plugins/org.jboss.tools.common.model/resources/help/keys-model.properties 2008-06-05 07:28:36 UTC (rev 8561)
@@ -659,6 +659,7 @@
SharableNewProject.Register_Web_Context_in_server.xml=Register Web Context in server.xml
SharableVPEEditor.option_list=Default Editor Tab
+SharableVPEEditor.source_visual_editors_weights=Source-Visual Editor Weights
##### XBundle model #####
Modified: trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta 2008-06-05 07:28:30 UTC (rev 8560)
+++ trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta 2008-06-05 07:28:36 UTC (rev 8561)
@@ -1231,6 +1231,9 @@
</Constraint>
<Editor name="List"/>
</XModelAttribute>
+ <XModelAttribute default="500" name="Source-Visual Editors Weights" xmlname="source_visual_editors_weights">
+ <Editor name="Slider"/>
+ </XModelAttribute>
</XModelAttributes>
<XActionItem kind="list"/>
<XDependencies/>
15 years, 10 months
JBoss Tools SVN: r8560 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-06-05 03:28:30 -0400 (Thu, 05 Jun 2008)
New Revision: 8560
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/VpePreference.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-2111, slider control added, source-visual editors sash weights configuration now available.
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/VpePreference.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/VpePreference.java 2008-06-05 07:28:26 UTC (rev 8559)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/VpePreference.java 2008-06-05 07:28:30 UTC (rev 8560)
@@ -21,6 +21,7 @@
public static String ATT_USE_ABSOLUTE_POSITION = "";
public static String ATT_ALWAYS_PROMPT_FOR_TAG_ATTRIBUTES_DURING_TAG_INSERT = "always prompt for tag attributes during tag insert";
public static String ATT_OPTION_LIST = "option list";
+ public static String ATT_SOURCE_VISUAL_EDITORS_WEIGHTS = "Source-Visual Editors Weights";
public static String ATT_SHOW_SELECTION_TAG_BAR = "show selection tag bar";
public static String ATT_ALWAYS_HIDE_SELECTION_BAR_WITHOUT_PROMT="always hide selection bar without prompt";
@@ -33,6 +34,7 @@
public static final Preference USE_ABSOLUTE_POSITION = new VpePreference(VPE_EDITOR_PATH, ATT_USE_ABSOLUTE_POSITION);
public static final Preference ALWAYS_REQUEST_FOR_ATTRIBUTE = new VpePreference(VPE_EDITOR_PATH, ATT_ALWAYS_PROMPT_FOR_TAG_ATTRIBUTES_DURING_TAG_INSERT);
public static final Preference EDITOR_VIEW_OPTION = new VpePreference(VPE_EDITOR_PATH, ATT_OPTION_LIST);
+ public static final Preference SOURCE_VISUAL_EDITORS_WEIGHTS= new VpePreference(VPE_EDITOR_PATH, ATT_SOURCE_VISUAL_EDITORS_WEIGHTS);
public static final Preference SHOW_SELECTION_TAG_BAR = new VpePreference(VPE_EDITOR_PATH,ATT_SHOW_SELECTION_TAG_BAR);
public static final Preference ALWAYS_HIDE_SELECTION_BAR_WITHOUT_PROMT = new VpePreference(VPE_EDITOR_PATH,ATT_ALWAYS_HIDE_SELECTION_BAR_WITHOUT_PROMT);
15 years, 10 months
JBoss Tools SVN: r8559 - in trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe: messages and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-06-05 03:28:26 -0400 (Thu, 05 Jun 2008)
New Revision: 8559
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashSetting.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
Log:
http://jira.jboss.com/jira/browse/JBIDE-2111, slider control added, source-visual editors sash weights configuration now available.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashSetting.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashSetting.java 2008-06-05 07:28:21 UTC (rev 8558)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashSetting.java 2008-06-05 07:28:26 UTC (rev 8559)
@@ -9,6 +9,7 @@
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IEditorPart;
+import org.jboss.tools.jst.jsp.preferences.VpePreference;
import org.jboss.tools.vpe.VpePlugin;
@@ -114,6 +115,28 @@
sash.setWeights(weights);
if (saved>=0)
sash.setCurrentSavedWeight(saved);
+ } else {
+ /*
+ * Set weights from the preference page
+ */
+ String stringValue = VpePreference.SOURCE_VISUAL_EDITORS_WEIGHTS.getValue();
+ try {
+ int intValue = Integer.parseInt(stringValue);
+ int[] weights = sash.getWeights();
+ if (weights.length > 2) {
+ if (intValue == 0) {
+ sash.maxUp();
+ } else if (intValue == 1000) {
+ sash.maxDown();
+ } else {
+ weights[0] = intValue;
+ weights[1] = 1000 - intValue;
+ sash.setWeights(weights);
+ }
+ }
+ } catch (Exception e) {
+ // Do nothing
+ }
}
} catch (CoreException e1) {
VpePlugin.getPluginLog().logError(e1);
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java 2008-06-05 07:28:21 UTC (rev 8558)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/VpeUIMessages.java 2008-06-05 07:28:26 UTC (rev 8559)
@@ -55,6 +55,7 @@
public static String USE_ABSOLUTE_POSITION;
public static String ALWAYS_PROMPT_FOR_TAG_ATTRIBUTES_DURING_TAG_INSERT;
public static String OPTION_LIST;
+ public static String SOURCE_VISUAL_EDITORS_WEIGHTS;
public static String GENERAL;
public static String TEMPLATES;
public static String TEMPLATE;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2008-06-05 07:28:21 UTC (rev 8558)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2008-06-05 07:28:26 UTC (rev 8559)
@@ -15,6 +15,7 @@
USE_ABSOLUTE_POSITION=use absolute position
ALWAYS_PROMPT_FOR_TAG_ATTRIBUTES_DURING_TAG_INSERT=always prompt for tag attributes during tag insert
OPTION_LIST=option list
+SOURCE_VISUAL_EDITORS_WEIGHTS=Source-Visual Editors Weights
GENERAL=General
TEMPLATES=Templates
TEMPLATE=Template
15 years, 10 months
JBoss Tools SVN: r8558 - in trunk/common/plugins/org.jboss.tools.common.model.ui: src/org/jboss/tools/common/model/ui/attribute/editor and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-06-05 03:28:21 -0400 (Thu, 05 Jun 2008)
New Revision: 8558
Added:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderCellEditorEx.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderEditor.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderFieldEditor.java
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-2111, slider control added, source-visual editors sash weights configuration now available.
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2008-06-05 07:20:39 UTC (rev 8557)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2008-06-05 07:28:21 UTC (rev 8558)
@@ -107,8 +107,12 @@
</attributeEditor>
<attributeEditor class="org.jboss.tools.common.model.ui.attribute.editor.MutableMultipleChoiceEditor" id="MutableMultipleChoice">
</attributeEditor>
+ <attributeEditor class="org.jboss.tools.common.model.ui.attribute.editor.SliderEditor" id="Slider">
+ </attributeEditor>
</extension>
<extension point="org.jboss.tools.common.model.ui.attributeAdapter">
+ <attributeAdapter class="org.jboss.tools.common.model.ui.attribute.adapter.DefaultValueAdapter" id="Slider">
+ </attributeAdapter>
<attributeAdapter class="org.jboss.tools.common.model.ui.attribute.adapter.DefaultValueAdapter" id="Default">
</attributeAdapter>
<attributeAdapter class="org.jboss.tools.common.model.ui.attribute.adapter.custom.FileSystemListAdapter" id="CommonFileSystem">
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderCellEditorEx.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderCellEditorEx.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderCellEditorEx.java 2008-06-05 07:28:21 UTC (rev 8558)
@@ -0,0 +1,67 @@
+package org.jboss.tools.common.model.ui.attribute.editor;
+
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Slider;
+
+public class SliderCellEditorEx extends CellEditor {
+
+ private Slider slider = null;
+ private int style = SWT.HORIZONTAL;
+ private static final int MAX_SLIDER_VALUE = 1000;
+ private static final int MIN_SLIDER_VALUE = 0;
+ private static final int INCREMENT_SLIDER_VALUE = 10;
+ private static final int DEFAULT_SLIDER_VALUE = 500;
+ public SliderCellEditorEx() {
+ super();
+ }
+
+ public SliderCellEditorEx(Composite parent) {
+ super(parent);
+ }
+
+ public SliderCellEditorEx(Composite parent, int style) {
+ super(parent, style);
+ this.style = style;
+ }
+
+ @Override
+ protected Control createControl(Composite parent) {
+ slider = new Slider(parent, this.style);
+ slider.setMaximum(MAX_SLIDER_VALUE);
+ slider.setMinimum(MIN_SLIDER_VALUE);
+ slider.setIncrement(INCREMENT_SLIDER_VALUE);
+ slider.setSelection(DEFAULT_SLIDER_VALUE);
+ return slider;
+ }
+
+ @Override
+ protected Object doGetValue() {
+ if (null != slider) {
+ slider.getSelection();
+ }
+ return null;
+ }
+
+ @Override
+ protected void doSetFocus() {
+ if (null != slider) {
+ slider.setFocus();
+ }
+ }
+
+ @Override
+ protected void doSetValue(Object value) {
+ try {
+ int intValue = Integer.parseInt(value.toString());
+ if (intValue <= MAX_SLIDER_VALUE && intValue >= MIN_SLIDER_VALUE) {
+ slider.setSelection(intValue);
+ }
+ } catch (Exception e) {
+ // Do nothing
+ }
+ }
+
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderCellEditorEx.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderEditor.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderEditor.java 2008-06-05 07:28:21 UTC (rev 8558)
@@ -0,0 +1,41 @@
+package org.jboss.tools.common.model.ui.attribute.editor;
+
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.common.model.ui.widgets.IWidgetSettings;
+
+public class SliderEditor extends ValueEditor {
+
+ public SliderEditor() {}
+
+ public SliderEditor(IWidgetSettings settings) {
+ super(settings);
+ lineEditor = true;
+ }
+
+ public void dispose() {
+ super.dispose();
+ if (cellEditor != null) {
+ cellEditor.dispose();
+ }
+ cellEditor = null;
+ if (fieldEditor != null) {
+ fieldEditor.dispose();
+ }
+ fieldEditor = null;
+ }
+
+ @Override
+ protected CellEditor createCellEditor(Composite parent) {
+ cellEditor = new SliderCellEditorEx();
+ return cellEditor;
+ }
+
+ @Override
+ protected ExtendedFieldEditor createFieldEditor(Composite parent) {
+ fieldEditor = new SliderFieldEditor();
+ fieldEditor.setLabelText(getLabelText());
+ return fieldEditor;
+ }
+
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderEditor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderFieldEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderFieldEditor.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderFieldEditor.java 2008-06-05 07:28:21 UTC (rev 8558)
@@ -0,0 +1,284 @@
+package org.jboss.tools.common.model.ui.attribute.editor;
+
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+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.swt.widgets.Slider;
+import org.jboss.tools.common.model.ui.IAttributeErrorProvider;
+import org.jboss.tools.common.model.ui.IValueChangeListener;
+import org.jboss.tools.common.model.ui.IValueProvider;
+import org.jboss.tools.common.model.ui.widgets.IWidgetSettings;
+
+public class SliderFieldEditor extends ExtendedFieldEditor implements
+ IFieldEditor, IPropertyFieldEditor, IPropertyChangeListener,
+ PropertyChangeListener {
+
+ protected IPropertyEditor propertyEditor;
+
+ protected IValueProvider valueProvider;
+ protected IValueChangeListener valueChangeListener;
+
+ private static final String SLIDER_LABEL_DEFAULT_TEXT = "50% / 50% "; //$NON-NLS-1$
+ private static final int MAX_SLIDER_VALUE = 1000;
+ private static final int MIN_SLIDER_VALUE = 0;
+ private static final int INCREMENT_SLIDER_VALUE = 10;
+ private static final int DEFAULT_SLIDER_VALUE = 500;
+ private Composite composite = null;
+ private Label sliderLabel = null;
+ private Slider slider = null;
+ private SelectionListener selectionListener = null;
+ private int intValue = 0;
+
+ public SliderFieldEditor() {
+ super();
+ }
+
+ public SliderFieldEditor(IWidgetSettings settings) {
+ super(settings);
+ }
+
+ public SliderFieldEditor(IPropertyEditor propertyEditor) {
+ super();
+ this.propertyEditor = propertyEditor;
+ }
+
+ /**
+ * Initializes the slider.
+ */
+ protected void init() {
+ /*
+ * Initialize slider selection value with stored value
+ */
+ try {
+ intValue = Integer.parseInt(valueProvider.getStringValue(true));
+ } catch (Exception e) {
+ // Do nothing
+ }
+ setPropertyChangeListener(this);
+ valueProvider.addValueChangeListener(this);
+ }
+
+ @Override
+ protected void adjustForNumColumns(int numColumns) {
+ if (null != composite) {
+ if (null != composite.getLayoutData()) {
+ ((GridData)slider.getLayoutData()).horizontalSpan = numColumns;
+ }
+ }
+ }
+
+ @Override
+ protected void doFillIntoGrid(Composite parent, int numColumns) {
+ getLabelComposite(parent);
+ Control control = createSpinnerControl(parent);
+ GridData gd;
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ control.setLayoutData(gd);
+ }
+
+ @Override
+ protected void doLoad() {
+ if (null != slider) {
+ slider.setSelection(getPreferenceStore().getInt(getPreferenceName()));
+ valueChanged();
+ }
+ }
+
+ @Override
+ protected void doLoadDefault() {
+ if (null != slider) {
+ slider.setSelection(getPreferenceStore().getDefaultInt(getPreferenceName()));
+ valueChanged();
+ }
+ }
+
+ @Override
+ protected void doStore() {
+ if (null != slider) {
+ getPreferenceStore().setValue(getPreferenceName(), slider.getSelection());
+ }
+ }
+
+ @Override
+ public int getNumberOfControls() {
+ return 2;
+ }
+
+ @Override
+ public Control[] getControls(Composite parent) {
+ return new Control[] {
+ getLabelComposite(parent),
+ createSpinnerControl(parent)
+ };
+ }
+
+ @Override
+ public void setPropertyEditor(IPropertyEditor propertyEditor) {
+ this.propertyEditor = propertyEditor;
+ if (null != propertyEditor) {
+ valueProvider = (IValueProvider)propertyEditor.getAdapter(IValueProvider.class);
+ valueChangeListener = (IValueChangeListener)propertyEditor.getAdapter(IValueChangeListener.class);
+ setErrorProvider((IAttributeErrorProvider)propertyEditor.getAdapter(IAttributeErrorProvider.class));
+ }
+ init();
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if(ExtendedFieldEditor.VALUE.equals(event.getProperty())) {
+ setPropertyChangeListener(null);
+ java.beans.PropertyChangeEvent e = new java.beans.PropertyChangeEvent(this, IPropertyEditor.VALUE, event.getOldValue(), event.getNewValue());
+ valueChangeListener.valueChange(e);
+ setPropertyChangeListener(this);
+ }
+ }
+
+ @Override
+ public void propertyChange(java.beans.PropertyChangeEvent evt) {
+ valueProvider.removeValueChangeListener(this);
+ if (IPropertyEditor.VALUE.equals(evt.getPropertyName())) {
+ Object v = evt.getNewValue();
+ if (null != v) {
+ this.setStringValue(v.toString());
+ }
+ }
+ valueProvider.addValueChangeListener(this);
+ }
+
+ protected Control createSpinnerControl(Composite parent) {
+ /*
+ * Create composite control with label and slider in it.
+ */
+ composite = new Composite(parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+ gridLayout.horizontalSpacing = HORIZONTAL_GAP;
+ composite.setLayout(gridLayout);
+ GridData gd;
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ composite.setLayoutData(gd);
+
+ /*
+ * Create label
+ */
+ sliderLabel = new Label(composite,SWT.NONE);
+ gd = new GridData(SWT.LEFT);
+ sliderLabel.setLayoutData(gd);
+ sliderLabel.setText(SLIDER_LABEL_DEFAULT_TEXT);
+ Point size = sliderLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ sliderLabel.setSize(size);
+
+ /*
+ * Create slider
+ */
+ slider = new Slider(composite, SWT.HORIZONTAL);
+ gd = new GridData(SWT.RIGHT | GridData.FILL_HORIZONTAL);
+ slider.setLayoutData(gd);
+
+ slider.setMaximum(MAX_SLIDER_VALUE + slider.getThumb());
+ slider.setMinimum(MIN_SLIDER_VALUE);
+ slider.setIncrement(INCREMENT_SLIDER_VALUE);
+
+ /*
+ * Add listener to handle value change
+ */
+ selectionListener = new SelectionListener() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ valueChanged();
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // Do nothing
+ }
+ };
+ slider.addSelectionListener(selectionListener);
+ try {
+ intValue = Integer.parseInt(valueProvider.getStringValue(true).toString());
+ } catch (Exception e) {
+ intValue = DEFAULT_SLIDER_VALUE;
+ }
+
+ /*
+ * Initialize slider presentation
+ */
+ slider.setSelection(intValue);
+ String weightsString = "" + (intValue /10)+"% / " + ((100 - intValue/10)) + "%"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ slider.setToolTipText(weightsString);
+ sliderLabel.setText(weightsString);
+
+ slider.pack();
+ sliderLabel.pack();
+ return composite;
+ }
+
+ /**
+ * Notifies listeners of value change.
+ */
+ protected void valueChanged() {
+ int newValue = slider.getSelection();
+ int oldValue = this.intValue;
+ intValue = newValue;
+ java.beans.PropertyChangeEvent event = new java.beans.PropertyChangeEvent(
+ this, IPropertyEditor.VALUE, oldValue, newValue);
+ valueChangeListener.valueChange(event);
+ }
+
+ /**
+ * Sets the value to slider and updates controls presentation.
+ *
+ * @param stringValue the new slider value
+ */
+ private void setStringValue(String stringValue) {
+ if (null != slider) {
+ try {
+ intValue = Integer.parseInt(stringValue);
+ slider.setSelection(intValue);
+ /*
+ * Show value in percents.
+ */
+ String weightsString = "" + (intValue / 10) + "% / " //$NON-NLS-1$ //$NON-NLS-2$
+ + ((100 - intValue / 10)) + "%"; //$NON-NLS-1$
+ slider.setToolTipText(weightsString);
+ if (null != sliderLabel) {
+ sliderLabel.setText(weightsString);
+ }
+ } catch (Exception e) {
+ // Do nothing
+ }
+ }
+ }
+
+ @Override
+ public void copy() {
+
+ }
+
+ @Override
+ public void cut() {
+
+ }
+
+ @Override
+ public void delete() {
+
+ }
+
+ @Override
+ public void paste() {
+
+ }
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderFieldEditor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
15 years, 10 months
JBoss Tools SVN: r8557 - trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/core/refactoring.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-06-05 03:20:39 -0400 (Thu, 05 Jun 2008)
New Revision: 8557
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/core/refactoring/LaunchConfigurationResourceNameChange.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-2250
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/core/refactoring/LaunchConfigurationResourceNameChange.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/core/refactoring/LaunchConfigurationResourceNameChange.java 2008-06-05 06:46:49 UTC (rev 8556)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/core/refactoring/LaunchConfigurationResourceNameChange.java 2008-06-05 07:20:39 UTC (rev 8557)
@@ -10,10 +10,15 @@
******************************************************************************/
package org.hibernate.eclipse.launch.core.refactoring;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.ltk.core.refactoring.Change;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
@@ -71,6 +76,24 @@
* @see org.eclipse.ltk.core.refactoring.Change#perform(org.eclipse.core.runtime.IProgressMonitor)
*/
public Change perform(IProgressMonitor pm) throws CoreException {
+ if (!fLaunchConfiguration.exists()){
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceRoot root = workspace.getRoot();
+ IPath rootLoacation = root.getLocation();
+ IPath oldConfigLocation = fLaunchConfiguration.getLocation();
+ int matchSegment = oldConfigLocation.matchingFirstSegments(rootLoacation);
+ IPath relativePath = oldConfigLocation.removeFirstSegments(matchSegment);
+ relativePath = relativePath.setDevice(null).makeAbsolute();
+
+ if (HibernateRefactoringUtil.isAttributeChanged(relativePath.toOSString(), fOldPath)){
+ matchSegment = relativePath.matchingFirstSegments(fOldPath);
+ IPath newLaunchPath = fNewPath.append(relativePath.removeFirstSegments(matchSegment));
+ IFile[] files = root.findFilesForLocation(rootLoacation.append(newLaunchPath));
+ if (files.length > 0){
+ fLaunchConfiguration = DebugPlugin.getDefault().getLaunchManager().getLaunchConfiguration(files[0]);
+ }
+ }
+ }
fLaunchConfiguration = HibernateRefactoringUtil.updateLaunchConfig(fLaunchConfiguration, fOldPath, fNewPath);
return new LaunchConfigurationResourceNameChange(fLaunchConfiguration, fNewPath, fOldPath);
}
15 years, 10 months
JBoss Tools SVN: r8556 - in trunk/ws/plugins: org.jboss.tools.ws.ui/META-INF and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2008-06-05 02:46:49 -0400 (Thu, 05 Jun 2008)
New Revision: 8556
Added:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/BaseField.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/BaseFieldEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/ButtonFieldEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/CompositeEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/IFieldEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/INamedElement.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossRuntimeListFieldEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntime.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntimeListConverter.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntimeManager.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntimePreferencePage2.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/LabelFieldEditor.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/PushButtonField.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/TextField.java
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/TextFieldEditor.java
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java
trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF
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
Log:
JBIDE-2261: implement define multi jbossws runtime
Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java 2008-06-04 21:01:55 UTC (rev 8555)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/MergeWebXMLCommand.java 2008-06-05 06:46:49 UTC (rev 8556)
@@ -101,7 +101,7 @@
org.eclipse.jst.j2ee.webapplication.WebApp webapp) {
List theServlets = webapp.getServlets();
for (int i = 0; i < theServlets.size(); i++) {
- Servlet aServlet = (Servlet) theServlets.get(i);
+ org.eclipse.jst.j2ee.webapplication.Servlet aServlet = (org.eclipse.jst.j2ee.webapplication.Servlet) theServlets.get(i);
if (aServlet.getServletName().equals(servletDescriptor._name)) {
return;
}
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF 2008-06-04 21:01:55 UTC (rev 8555)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/META-INF/MANIFEST.MF 2008-06-05 06:46:49 UTC (rev 8556)
@@ -8,7 +8,9 @@
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources,
- org.jboss.tools.ws.core
+ org.jboss.tools.ws.core,
+ org.eclipse.ui.ide,
+ org.eclipse.wst.common.project.facet.core
Eclipse-LazyStart: true
Export-Package: org.jboss.tools.ws.ui,
org.jboss.tools.ws.ui.preferences
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 2008-06-04 21:01:55 UTC (rev 8555)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JbossWSUI.properties 2008-06-05 06:46:49 UTC (rev 8556)
@@ -38,4 +38,32 @@
WAR_STATUS_LOCATION_FILE=war.properties
COMMOND=wsconsume.sh
-BIN=bin
\ No newline at end of file
+BIN=bin
+
+JBOSSWS_BASIC_EDITOR_COMPOSITE=Parent control should be Composite
+JBOSSWS_BASIC_EDITOR_SUPPORT=Editor supports only grid layout
+JBOSSWS_BASE_EDITOR_DIFFERENT=Parent for label is different
+JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_NAME=Name
+JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_PATH=Path
+JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_INPUTELEMENT_MUST_BE=inputElement must be
+JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_AN_INSTANCEOF_OF_LIST=an instance of List<JBossWSRuntime>.
+JBOSSWS_RUNTIME_DELETE_CONFIRM_TITLE=Confirm Runtime Delete
+JBOSSWS_RUNTIME_DELETE_USED_CONFIRM=Runtime ''{0}'' is used by JBossWS projects. Are you sure you want to delete it?
+JBOSSWS_RUNTIME_DELETE_NOT_USED_CONFIRM=Are you sure you want to delete runtime ''{0}''?
+JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_EDIT_RUNTIME=Edit JBossWS Runtime
+JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_MODIFY_RUNTIME=Input new values
+JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_NEW_RUNTIME=New JBossWS Runtime
+JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_PATH_TO_HOME_DIRECTORY_CANNOT_BE_EMPTY=Path to JBossWS home directory cannot be empty
+JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_ALREADY_EXISTS=' already exists
+JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_RUNTIME=JBossWS Runtime
+JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_RUNTIME_NAME_IS_NOT_CORRECT=Runtime name is not correct
+JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_NAME_CANNOT_BE_EMPTY=Name cannot be empty
+JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_CREATE_A_RUNTIME=Create a JBossWS Runtime
+JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_HOME_FOLDER=Home Folder:
+JBOSSWS_COMPOSITE_EDITOR_THIS_METOD_CAN_BE_INVOKED=This metod can be invoked after getEditorControls(parent) only
+JBOSSWS_BUTTON_FIELD_EDITOR_BROWSE=Browse...
+JBOSSWS_BUTTON_FIELD_EDITOR_NOT_IMPLEMENTED_YET=Not implemented yet. Please setup real acion for editor.
+JBOSSWS_SWT_FIELD_EDITOR_FACTORY_BROWSE=Browse...
+JBOSSWS_SWT_FIELD_EDITOR_FACTORY_SELECT_HOME_FOLDER=Select JBossWS Home Folder
+JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_NAME2=Name:
+JBOSSWS_PREFERENCE_PAGE_RUNTIMES=JBossWS Runtimes
\ No newline at end of file
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 2008-06-04 21:01:55 UTC (rev 8555)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JbossWSUIMessages.java 2008-06-05 06:46:49 UTC (rev 8556)
@@ -68,6 +68,35 @@
public static String BIN;
public static String COMMOND;
+ public static String JBOSSWS_BASIC_EDITOR_COMPOSITE;
+ public static String JBOSSWS_BASIC_EDITOR_SUPPORT;
+ public static String JBOSSWS_BASE_EDITOR_DIFFERENT;
+ public static String JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_NAME;
+ public static String JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_PATH;
+ public static String JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_INPUTELEMENT_MUST_BE;
+ public static String JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_AN_INSTANCEOF_OF_LIST;
+ public static String JBOSSWS_RUNTIME_DELETE_CONFIRM_TITLE;
+ public static String JBOSSWS_RUNTIME_DELETE_USED_CONFIRM;
+ public static String JBOSSWS_RUNTIME_DELETE_NOT_USED_CONFIRM;
+ public static String JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_EDIT_RUNTIME;
+ public static String JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_MODIFY_RUNTIME;
+ public static String JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_NEW_RUNTIME;
+ public static String JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_PATH_TO_HOME_DIRECTORY_CANNOT_BE_EMPTY;
+ public static String JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_ALREADY_EXISTS;
+ public static String JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_RUNTIME;
+ public static String JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_RUNTIME_NAME_IS_NOT_CORRECT;
+ public static String JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_NAME_CANNOT_BE_EMPTY;
+ public static String JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_CREATE_A_RUNTIME;
+ public static String JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_HOME_FOLDER;
+ public static String JBOSSWS_COMPOSITE_EDITOR_THIS_METOD_CAN_BE_INVOKED;
+ public static String JBOSSWS_BUTTON_FIELD_EDITOR_BROWSE;
+ public static String JBOSSWS_BUTTON_FIELD_EDITOR_NOT_IMPLEMENTED_YET;
+ public static String JBOSSWS_SWT_FIELD_EDITOR_FACTORY_BROWSE;
+ public static String JBOSSWS_SWT_FIELD_EDITOR_FACTORY_SELECT_HOME_FOLDER;
+ public static String JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_NAME2;
+ public static String JBOSSWS_PREFERENCE_PAGE_RUNTIMES;
+
+
static {
NLS.initializeMessages(BUNDLE_NAME, JbossWSUIMessages.class);
}
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/BaseField.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/BaseField.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/BaseField.java 2008-06-05 06:46:49 UTC (rev 8556)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.preferences;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+
+import org.eclipse.swt.widgets.Control;
+
+public abstract class BaseField {
+
+ public static final String PROPERTY_NAME = "value"; //$NON-NLS-1$
+
+ private PropertyChangeSupport pcs = new PropertyChangeSupport(this);
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ pcs.addPropertyChangeListener(listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ pcs.removePropertyChangeListener(listener);
+ }
+
+ public void firePropertyChange(Object oldValue, Object newValue) {
+ pcs.firePropertyChange(PROPERTY_NAME, oldValue, newValue);
+ }
+
+ abstract public Control getControl();
+}
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/BaseFieldEditor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/BaseFieldEditor.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/BaseFieldEditor.java 2008-06-05 06:46:49 UTC (rev 8556)
@@ -0,0 +1,328 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.preferences;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Widget;
+import org.jboss.tools.ws.ui.messages.JbossWSUIMessages;
+
+/**
+ * @author Grid Qian
+ */
+public abstract class BaseFieldEditor implements IFieldEditor {
+
+ PropertyChangeSupport pcs = new PropertyChangeSupport(this);
+
+ Set<DisposeListener> disposeListeners = new HashSet<DisposeListener>();
+
+ private Object value = new Object();
+
+ private String labelText;
+
+ private String nameText = null;
+
+ Label labelControl = null;
+
+ protected Map<Object, Object> data = null;
+
+ private boolean enabled = true;
+
+ /**
+ *
+ * @param name
+ * @param label
+ * @param defaultValue
+ */
+ public BaseFieldEditor(String name, String label,Object defaultValue) {
+ this.value = defaultValue;
+ this.labelText = label;
+ this.nameText = name;
+ }
+
+ /**
+ *
+ * @param parent
+ */
+ public void doFillIntoGrid(Object parent) {
+ Assert.isTrue(parent instanceof Composite, JbossWSUIMessages.JBOSSWS_BASIC_EDITOR_COMPOSITE);
+ Assert.isTrue(((Composite)parent).getLayout() instanceof GridLayout,JbossWSUIMessages.JBOSSWS_BASIC_EDITOR_SUPPORT);
+ Composite aComposite = (Composite) parent;
+ final Control[] controls = (Control[])getEditorControls(aComposite);
+ GridLayout gl = (GridLayout)((Composite)parent).getLayout();
+
+ doFillIntoGrid(aComposite,gl.numColumns);
+ if(controls.length>0) {
+ controls[0].addDisposeListener(new DisposeListener(){
+ public void widgetDisposed(DisposeEvent e) {
+ dispose();
+ controls[0].removeDisposeListener(this);
+ }
+ });
+ }
+ }
+
+ /**
+ * @param composite
+ * @param numColumns
+ */
+ protected void doFillIntoGrid(Composite composite, int numColumns) {
+
+ }
+
+ /**
+ *
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ pcs.addPropertyChangeListener(listener);
+ }
+
+ /**
+ *
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ pcs.removePropertyChangeListener(listener);
+ }
+
+ /**
+ *
+ * @param parent
+ * @return
+ */
+ public Label createLabelControl(Composite parent) {
+ if(labelControl==null) {
+ labelControl = new Label(parent,SWT.NO_BACKGROUND);
+ labelControl.setText(this.labelText);
+ } else if(parent!=null) {
+ if(labelControl.getParent()!=parent)
+ throw new IllegalArgumentException(JbossWSUIMessages.JBOSSWS_BASE_EDITOR_DIFFERENT);
+ }
+ return labelControl;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public Label getLabelControl() {
+ return createLabelControl(null);
+ }
+
+ /**
+ *
+ */
+ public abstract Object[] getEditorControls(Object composite);
+
+ /**
+ *
+ */
+ public abstract Object[] getEditorControls();
+
+ /**
+ *
+ * @return
+ */
+ public Control[] getSwtControls() {
+ return (Control[])getEditorControls();
+ }
+
+ /**
+ *
+ */
+ public abstract int getNumberOfControls();
+
+ /**
+ *
+ */
+ public Object getValue() {
+ return value;
+ }
+
+ /**
+ *
+ */
+ public String getValueAsString() {
+ return getValue().toString();
+ }
+
+ /**
+ *
+ */
+ public boolean isEnabled() {
+ return this.enabled ;
+ }
+
+ /**
+ *
+ */
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ Control[] controls = getSwtControls();
+ if(controls==null) {
+ return;
+ }
+ for(int i=0;i<controls.length;i++) {
+ Control control = controls[i];
+ control.setEnabled(enabled);
+ if(control instanceof Composite) {
+ setEnabled((Composite)control, enabled);
+ }
+ }
+ }
+
+ private void setEnabled(Composite composite, boolean enabled) {
+ Control[] controls = composite.getChildren();
+ for(int i=0;i<controls.length;i++) {
+ Control control = controls[i];
+ control.setEnabled(enabled);
+ if(control instanceof Composite) {
+ setEnabled((Composite)control, enabled);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ public boolean setFocus() {
+ return true;
+ }
+
+ /**
+ *
+ * @param newValue
+ */
+ public void setValue(Object newValue) {
+ Object oldValue = value;
+ value = newValue;
+ pcs.firePropertyChange(nameText,oldValue,newValue);
+ }
+
+ /**
+ *
+ */
+ public void setValueAsString(String stringValue) {
+ value = stringValue;
+ }
+
+ /**
+ *
+ */
+ public String getName() {
+ return nameText;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.IFieldEditor#dispose()
+ */
+ public void dispose() {
+ PropertyChangeListener[] listeners = pcs.getPropertyChangeListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ PropertyChangeListener propertyChangeListener = listeners[i];
+ pcs.removePropertyChangeListener(propertyChangeListener);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.IFieldEditor#dispose(org.eclipse.swt.events.DisposeEvent)
+ */
+ public void dispose(DisposeEvent e) {
+ dispose();
+ for (DisposeListener disposeListener : disposeListeners) {
+ disposeListener.widgetDisposed(e);
+ }
+ disposeListeners.clear();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.IFieldEditor#addDisposeListener(org.eclipse.swt.events.DisposeListener)
+ */
+ public void addDisposeListener(DisposeListener listener) {
+ disposeListeners.add(listener);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.IFieldEditor#removeDisposeListener(org.eclipse.swt.events.DisposeListener)
+ */
+ public void removeDisposeListener(DisposeListener listener) {
+ disposeListeners.remove(listener);
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getLabelText() {
+ return labelText;
+ }
+
+ /**
+ *
+ * @param labelText
+ */
+ public void setLabelText(String labelText) {
+ this.labelText = labelText;
+ }
+
+ /**
+ *
+ */
+ private boolean editable = true;
+
+ /**
+ *
+ */
+ public boolean isEditable() {
+ return editable;
+ }
+
+ /**
+ *
+ */
+ public void setEditable(boolean aEditable) {
+ this.editable = aEditable;
+ }
+
+ public Object getData(Object key) {
+ if(data==null) {
+ return null;
+ }
+ return data.get(key);
+ }
+
+ public void setData(Object key, Object value) {
+ if(data==null) {
+ data = new HashMap<Object, Object>();
+ }
+ data.put(key, value);
+ }
+}
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/ButtonFieldEditor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/ButtonFieldEditor.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/ButtonFieldEditor.java 2008-06-05 06:46:49 UTC (rev 8556)
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.preferences;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.jboss.tools.ws.ui.messages.JbossWSUIMessages;
+
+/**
+ * @author eskimo
+ *
+ */
+public class ButtonFieldEditor extends BaseFieldEditor {
+
+ PushButtonField button= null;
+
+ private ButtonPressedAction buttonAction = new ButtonPressedAction(JbossWSUIMessages.JBOSSWS_BUTTON_FIELD_EDITOR_BROWSE) {
+ @Override
+ public void run() {
+ throw new RuntimeException(JbossWSUIMessages.JBOSSWS_BUTTON_FIELD_EDITOR_NOT_IMPLEMENTED_YET);
+ }
+ };
+
+ public ButtonFieldEditor(String name, String label) {
+ super(name, label, new Object());
+ }
+
+ public ButtonFieldEditor(String name, ButtonPressedAction action, Object defaultValue) {
+ super(name, action.getText(), defaultValue);
+ buttonAction = action;
+ buttonAction.setFieldEditor(this);
+ }
+
+ @Override
+ public void doFillIntoGrid(Object parent) {
+ }
+
+ @Override
+ public Object[] getEditorControls() {
+ if(button==null) {
+ return null;
+ }
+ return new Control[]{button.getControl()};
+ }
+
+ @Override
+ public boolean isEditable() {
+ return false;
+ }
+
+ public void save(Object object) {
+ }
+
+ @Override
+ public void setEditable(boolean ediatble) {
+ }
+
+ @Override
+ public Object[] getEditorControls(Object composite) {
+ if(button==null && composite!=null) {
+ button = new PushButtonField((Composite)composite,buttonAction);
+ setEnabled(isEnabled());
+ }
+ return new Control[]{button.getControl()};
+ }
+
+ public ButtonPressedAction getButtonaction() {
+ return buttonAction;
+ }
+
+ public static class ButtonPressedAction extends Action implements SelectionListener{
+
+ private IFieldEditor editor = null;
+
+ public ButtonPressedAction(String label) {
+ super(label);
+ }
+
+ public void setFieldEditor(IFieldEditor newEditor) {
+ editor = newEditor;
+ }
+
+ public IFieldEditor getFieldEditor() {
+ return editor;
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ run();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.BaseFieldEditor#getNumberOfControls()
+ */
+ @Override
+ public int getNumberOfControls() {
+ return 1;
+ }
+}
\ No newline at end of file
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/CompositeEditor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/CompositeEditor.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/CompositeEditor.java 2008-06-05 06:46:49 UTC (rev 8556)
@@ -0,0 +1,167 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.preferences;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.jboss.tools.ws.ui.messages.JbossWSUIMessages;
+
+/**
+ * @author eskimo
+ *
+ */
+public class CompositeEditor extends BaseFieldEditor implements PropertyChangeListener {
+
+ public CompositeEditor(String name, String label, Object defaultValue) {
+ super(name, label, defaultValue);
+ }
+
+ @Override
+ public void doFillIntoGrid(Object parent) {
+ Assert.isTrue(parent instanceof Composite,
+ JbossWSUIMessages.JBOSSWS_BASIC_EDITOR_COMPOSITE);
+ Assert.isTrue(((Composite) parent).getLayout() instanceof GridLayout,
+ JbossWSUIMessages.JBOSSWS_BASIC_EDITOR_SUPPORT);
+
+ Composite aComposite = (Composite) parent;
+ final Control[] controls = (Control[]) getEditorControls(aComposite);
+ GridLayout gl = (GridLayout) ((Composite) parent).getLayout();
+
+ for (int i = 0; i < controls.length; i++) {
+ GridData gd = new GridData();
+ gd.horizontalSpan = i == 1 ? gl.numColumns - controls.length + 1 : 1;
+ if (controls[i] instanceof Combo && i == (controls.length - 1)) {
+ gd.horizontalAlignment = SWT.BEGINNING;
+ } else {
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = (i == 1);
+ }
+
+ controls[i].setLayoutData(gd);
+ controls[i].setEnabled(isEnabled());
+
+ if(i==0) {
+ controls[i].addDisposeListener(new DisposeListener(){
+ public void widgetDisposed(DisposeEvent e) {
+ dispose();
+ controls[0].removeDisposeListener(this);
+ }
+ });
+ }
+ }
+ }
+
+ List<Control> controls = new ArrayList<Control>();
+
+ @Override
+ public Object[] getEditorControls() {
+ if(controls.size()>0) return controls.toArray();
+ else throw new IllegalStateException(JbossWSUIMessages.JBOSSWS_COMPOSITE_EDITOR_THIS_METOD_CAN_BE_INVOKED);
+ }
+
+ @Override
+ public Object[] getEditorControls(Object parent) {
+ for (IFieldEditor editor : editors) {
+ controls.addAll(Arrays.asList((Control[])editor.getEditorControls(parent)));
+ }
+ return controls.toArray(new Control[]{});
+ }
+
+ @Override
+ public int getNumberOfControls() {
+ return editors.size();
+ }
+
+ @Override
+ public boolean isEditable() {
+ return true;
+ }
+
+ public void save(Object object) {
+ }
+
+ @Override
+ public void setEditable(boolean ediatble) {
+ }
+
+ List<IFieldEditor> editors = new ArrayList<IFieldEditor>();
+
+ public CompositeEditor addFieldEditors(IFieldEditor[] editors) {
+ this.editors.addAll( Arrays.asList(editors));
+ for (IFieldEditor editor : Arrays.asList(editors)) {
+ editor.addPropertyChangeListener(this);
+ }
+ return this;
+ }
+
+ @Override
+ public void setValue(Object newValue) {
+ for (IFieldEditor editor : editors) {
+ editor.removePropertyChangeListener(this);
+ editor.setValue(newValue);
+ editor.addPropertyChangeListener(this);
+ }
+ super.setValue(newValue);
+ }
+
+ public void propertyChange(PropertyChangeEvent event) {
+ for (IFieldEditor editor : editors) {
+ if(event.getSource()!=editor) {
+ editor.removePropertyChangeListener(this);
+ editor.setValue(event.getNewValue());
+ editor.addPropertyChangeListener(this);
+ }
+ }
+ super.setValue(event.getNewValue());
+ }
+
+ @Override
+ public void setEnabled(boolean set) {
+ for (IFieldEditor editor : editors) {
+ editor.setEnabled(set);
+ }
+ }
+
+ public List<IFieldEditor> getEditors() {
+ return Collections.unmodifiableList(editors);
+ }
+
+ public IFieldEditor getEditorByName(String name) {
+ for (IFieldEditor editor : editors) {
+ if(name.equals(editor.getName())) {
+ return editor;
+ }
+ }
+ return null;
+ }
+
+ public void setData(Object key, Object value) {
+ super.setData(key, value);
+ for (IFieldEditor editor : editors) {
+ editor.setData(key, value);
+ }
+ }
+}
\ No newline at end of file
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/IFieldEditor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/IFieldEditor.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/IFieldEditor.java 2008-06-05 06:46:49 UTC (rev 8556)
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.preferences;
+
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+
+/**
+ * @author Grid Qian
+ */
+public interface IFieldEditor extends INamedElement {
+
+ /**
+ *
+ * @param composite
+ */
+ public Object[] getEditorControls(Object composite);
+
+ /**
+ *
+ * @return
+ */
+ public Object[] getEditorControls();
+
+ /**
+ *
+ * @return
+ */
+ public int getNumberOfControls();
+
+ /**
+ *
+ * @param parent
+ */
+ public void doFillIntoGrid(Object parent);
+
+ /**
+ *
+ * @param listener
+ */
+ public void addPropertyChangeListener(PropertyChangeListener listener);
+
+ /**
+ *
+ * @param listener
+ */
+ public void addDisposeListener(DisposeListener listener);
+
+ /**
+ *
+ * @param listener
+ */
+ public void removeDisposeListener(DisposeListener listener);
+
+ /**
+ *
+ * @param listener
+ */
+ public void removePropertyChangeListener(PropertyChangeListener listener);
+
+ /**
+ *
+ * @return
+ */
+ public boolean isEditable();
+
+ /**
+ *
+ * @param aEdiatble
+ */
+ public void setEditable(boolean aEdiatble);
+
+ /**
+ * @return
+ *
+ */
+ public boolean setFocus();
+
+ /**
+ *
+ * @return
+ */
+ public boolean isEnabled();
+
+ /**
+ *
+ * @param enabled
+ */
+ public void setEnabled(boolean enabled);
+
+ /**
+ *
+ */
+ public void dispose();
+
+ /**
+ *
+ * @param e
+ */
+ public void dispose(DisposeEvent e);
+
+ /**
+ * Sets the application defined property of this editor
+ *
+ * @param data
+ * @param key
+ */
+ public void setData(Object key, Object data);
+
+ /**
+ * Gets the application defined property of this editor
+ *
+ * @param key
+ * @return
+ */
+ public Object getData(Object key);
+
+}
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/INamedElement.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/INamedElement.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/INamedElement.java 2008-06-05 06:46:49 UTC (rev 8556)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.preferences;
+
+/**
+ * @author Grid Qian
+ */
+public interface INamedElement {
+
+ public abstract String getName();
+
+ /**
+ *
+ * @return
+ */
+ public abstract Object getValue();
+
+ /**
+ *
+ */
+ public abstract void setValue(Object newValue);
+
+ /**
+ *
+ * @return
+ */
+ public abstract String getValueAsString();
+
+ /**
+ *
+ * @param aValue
+ */
+ public abstract void setValueAsString(String aValue);
+
+}
\ No newline at end of file
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossRuntimeListFieldEditor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossRuntimeListFieldEditor.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossRuntimeListFieldEditor.java 2008-06-05 06:46:49 UTC (rev 8556)
@@ -0,0 +1,999 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.preferences;
+
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.TableColumn;
+import org.jboss.tools.ws.ui.messages.JbossWSUIMessages;
+
+/**
+ * @author Grid Qian
+ */
+public class JbossRuntimeListFieldEditor extends BaseFieldEditor {
+
+ // ------------------------------------------------------------------------
+ // Layout parameters
+ // ------------------------------------------------------------------------
+
+ static final int GL_COLUMNS = 2;
+ static final int GL_HINT_HEIGHT = 200;
+ static final int TC_DEFAULT_WIDTH = 21;
+ static final int TC_NAME_WIDTH = 100;
+ static final int TC_VERSION_WIDTH = 50;
+ static final int TC_PATH_WIDTH = 100;
+
+ // ------------------------------------------------------------------------
+ // Field declarations
+ // ------------------------------------------------------------------------
+
+ private CheckboxTableViewer tableView = null;
+
+ private Composite root = null;
+
+ private ActionPanel actionPanel;
+
+ private Map<JbossWSRuntime, JbossWSRuntime> changed = new HashMap<JbossWSRuntime, JbossWSRuntime>();
+
+ private List<JbossWSRuntime> checkedElements = new ArrayList<JbossWSRuntime>();
+
+ private List<JbossWSRuntime> added = new ArrayList<JbossWSRuntime>();
+
+ private List<JbossWSRuntime> removed = new ArrayList<JbossWSRuntime>();
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Control for editing jbossWSRuntime list
+ *
+ * @param name
+ * String
+ * @param label
+ * String
+ * @param defaultValue
+ * Object
+ */
+ public JbossRuntimeListFieldEditor(String name, String label,
+ Object defaultValue) {
+ super(name, label, defaultValue);
+ }
+
+ /**
+ * TBD
+ *
+ * @return List<JbossWSRuntime>
+ */
+ public List<JbossWSRuntime> getDefaultJbossWSRuntimes() {
+ return checkedElements;
+ }
+
+ /**
+ * TBD
+ *
+ * @return List<JbossWSRuntime>
+ */
+ public List<JbossWSRuntime> getAddedJbossWSRuntimes() {
+ return added;
+ }
+
+ /**
+ * TBD
+ *
+ * @return List<JbossWSRuntime>
+ */
+ public Map<JbossWSRuntime, JbossWSRuntime> getChangedJbossWSRuntimes() {
+ return changed;
+ }
+
+ /**
+ * TBD
+ *
+ * @return List<JbossWSRuntime>
+ */
+ public List<JbossWSRuntime> getRemoved() {
+ return removed;
+ }
+
+ /**
+ * TBD
+ *
+ * @param composite
+ * Object - instance of Composite
+ * @return Object[]
+ */
+ @Override
+ public Object[] getEditorControls(Object composite) {
+
+ root = new Composite((Composite) composite, SWT.NONE);
+ GridData gd = new GridData();
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = true;
+ root.setLayoutData(gd);
+
+ root.setLayout(new FormLayout());
+ createTableView();
+ createActionBar();
+
+ FormData tableData = new FormData();
+ tableData.left = new FormAttachment(0,5);
+ tableData.right = new FormAttachment(actionPanel, -5);
+ tableData.top = new FormAttachment(0,5);
+ tableData.bottom = new FormAttachment(100,-5);
+ tableView.getControl().setLayoutData(tableData);
+
+ FormData actionsData = new FormData();
+ actionsData.top = new FormAttachment(0,5);
+ actionsData.bottom = new FormAttachment(100,-5);
+ actionsData.right = new FormAttachment(100,-5);
+ actionPanel.setLayoutData(actionsData);
+ return new Control[] {root};
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void createTableView() {
+ tableView = CheckboxTableViewer.newCheckList(root, SWT.V_SCROLL
+ | SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE);
+
+ TableColumn tc1 = new TableColumn(tableView.getTable(), SWT.CENTER);
+ tc1.setWidth(TC_DEFAULT_WIDTH);
+ tc1.setResizable(false);
+
+ TableColumn tc2 = new TableColumn(tableView.getTable(), SWT.LEFT);
+ tc2.setWidth(TC_NAME_WIDTH);
+ tc2.setText(JbossWSUIMessages.JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_NAME);
+
+ TableColumn tc3 = new TableColumn(tableView.getTable(), SWT.LEFT);
+ tc3.setWidth(TC_PATH_WIDTH);
+ tc3.setText(JbossWSUIMessages.JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_PATH);
+
+ tableView.setContentProvider(new IStructuredContentProvider() {
+
+ @SuppressWarnings("unchecked")
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof List) {
+ return ((List<JbossWSRuntime>) inputElement).toArray();
+ } else {
+ throw new IllegalArgumentException(
+ JbossWSUIMessages.JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_INPUTELEMENT_MUST_BE
+ + JbossWSUIMessages.JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_AN_INSTANCEOF_OF_LIST);
+ }
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
+ viewer.refresh();
+ }
+ });
+
+ tableView.setLabelProvider(new ITableLabelProvider() {
+
+ private static final int TC_DEFAULT_NUMBER = 0;
+ private static final int TC_NAME_NUMBER = 1;
+ private static final int TC_PATH_NUMBER = 2;
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ JbossWSRuntime rt = (JbossWSRuntime) element;
+ if (columnIndex == TC_DEFAULT_NUMBER) {
+ return ""; //$NON-NLS-1$
+ }
+ if (columnIndex == TC_NAME_NUMBER) {
+ return rt.getName();
+ }
+ if (columnIndex == TC_PATH_NUMBER) {
+ return rt.getHomeDir();
+ }
+ return ""; //$NON-NLS-1$
+ }
+ });
+
+ tableView.setInput(getValue());
+ tableView.getTable().setLinesVisible(true);
+ tableView.getTable().setHeaderVisible(true);
+ tableView.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ JbossWSRuntime selRt = (JbossWSRuntime) event.getElement();
+ if (event.getChecked()) {
+ JbossWSRuntime deselRt = null;
+ Object[] selRts = tableView.getCheckedElements();
+
+ for (int i = 0; i < selRts.length; i++) {
+ JbossWSRuntime rt = (JbossWSRuntime) selRts[i];
+ if (rt != selRt) {
+ deselRt = rt;
+ break;
+ }
+ }
+
+ if (deselRt != null) {
+ Object[] newChecked = new Object[selRts.length - 1];
+ checkedElements.clear();
+ int i = 0;
+ for (Object object : selRts) {
+ JbossWSRuntime rt = (JbossWSRuntime) object;
+ if (rt == selRt) {
+ newChecked[i] = rt;
+ checkedElements.add(rt);
+ i++;
+ }
+ }
+ tableView.setCheckedElements(newChecked);
+ } else {
+ checkedElements.add((JbossWSRuntime)event.getElement());
+ }
+ } else {
+ checkedElements.remove(selRt);
+ }
+ pcs.firePropertyChange(getName(), null, getValue());
+ }
+ });
+
+ for (JbossWSRuntime rt : (List<JbossWSRuntime>) getValue()) {
+ if (rt.isDefault()) {
+ tableView.setChecked(rt, true);
+ checkedElements.add(rt);
+ }
+ }
+ }
+
+ protected void createActionBar() {
+ actionPanel = new ActionPanel(root, new BaseAction[] {
+ new AddAction(), new EditAction(), new RemoveAction()});
+ tableView.addSelectionChangedListener(actionPanel);
+ }
+
+ /**
+ * Checks all runtimes and set default one if user did not do it.
+ */
+ @SuppressWarnings("unchecked")
+ private void setDefaultRuntimes() {
+ List<JbossWSRuntime> runtimes = (List<JbossWSRuntime>)getValue();
+ for (JbossWSRuntime jbossWSRuntime : runtimes) {
+ boolean checked = false;
+ for(JbossWSRuntime checkedElement: checkedElements) {
+ if(checkedElement == jbossWSRuntime) {
+ checked = true;
+ break;
+ }
+ }
+ if(!checked) {
+ tableView.setChecked(jbossWSRuntime, true);
+ checkedElements.add(jbossWSRuntime);
+ }
+ }
+ }
+
+ /**
+ * Return array of Controls that forms and editor
+ *
+ * @return Control[]
+ */
+ @Override
+ public Object[] getEditorControls() {
+ return new Control[] {root};
+ }
+
+ /**
+ * Return number of controls in editor
+ *
+ * @return int
+ */
+ @Override
+ public int getNumberOfControls() {
+ return 1;
+ }
+
+ /**
+ * Fill wizard page with editors
+ *
+ * @param parent
+ * Composite - parent composite
+ */
+ @Override
+ public void doFillIntoGrid(Object parent) {
+ Assert
+ .isTrue(
+ parent instanceof Composite,
+ JbossWSUIMessages.JBOSSWS_BASIC_EDITOR_COMPOSITE);
+ Assert
+ .isTrue(
+ ((Composite) parent).getLayout() instanceof GridLayout,
+ JbossWSUIMessages.JBOSSWS_BASIC_EDITOR_SUPPORT);
+ Composite aComposite = (Composite) parent;
+ getEditorControls(aComposite);
+ GridLayout gl = (GridLayout) ((Composite) parent).getLayout();
+
+ GridData gd = new GridData();
+ gd.horizontalSpan = gl.numColumns;
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalAlignment = GridData.FILL;
+
+ ((Control) getEditorControls()[0]).setLayoutData(gd);
+ }
+
+ /**
+ * Wizard page for editing JbossWS Runtime parameters
+ *
+ */
+ public static class JbossWSRuntimeWizardPage extends WizardPage implements
+ PropertyChangeListener {
+
+ private static final String SRT_NAME = "name";
+ private static final String SRT_HOMEDIR = "homeDir";
+
+ private static final int GL_PARENT_COLUMNS = 1;
+ private static final int GL_CONTENT_COLUMNS = 3;
+
+ List<JbossWSRuntime> value = null;
+
+ IFieldEditor name = createTextEditor(
+ SRT_NAME, JbossWSUIMessages.JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_NAME2,
+ ""); //$NON-NLS-1$
+
+ IFieldEditor homeDir = createBrowseFolderEditor(
+ SRT_HOMEDIR,
+ JbossWSUIMessages.JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_HOME_FOLDER,
+ ""); //$NON-NLS-1$
+
+ JbossWSRuntime current = null;
+
+ public JbossWSRuntimeWizardPage(List<JbossWSRuntime> editedList) {
+ 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;
+ }
+
+ /**
+ * Create Wizard page content
+ *
+ * @param parent
+ * Composite - parent composite
+ */
+ public void createControl(Composite parent) {
+ parent.setLayout(new GridLayout(GL_PARENT_COLUMNS, false));
+ GridData dg = new GridData();
+ dg.horizontalAlignment = GridData.FILL;
+ dg.grabExcessHorizontalSpace = true;
+ Composite root = new Composite(parent, SWT.NONE);
+ root.setLayoutData(dg);
+ GridLayout gl = new GridLayout(GL_CONTENT_COLUMNS, false);
+ root.setLayout(gl);
+ homeDir.doFillIntoGrid(root);
+ homeDir.addPropertyChangeListener(this);
+ name.doFillIntoGrid(root);
+ name.addPropertyChangeListener(this);
+ setPageComplete(false);
+ setControl(root);
+ }
+
+ /**
+ * Process evt: setup default values based on JbossWS Home folder and
+ * validate user input
+ *
+ * @param evt
+ * PropertyChangeEvent describes changes in wizard
+ */
+ public void propertyChange(java.beans.PropertyChangeEvent evt) {
+ if ("homeDir".equals(evt.getPropertyName())) {
+ if (name.getValueAsString() == null
+ || "".equals(name.getValueAsString().trim())) {
+ String homeDirName = homeDir.getValueAsString();
+ if (homeDirName != null && !"".equals(homeDirName.trim())) {
+ File folder = new File(homeDirName);
+ homeDirName = folder.getName();
+ }
+ name.setValue(homeDirName);
+ }
+ }
+
+ if (name.getValueAsString() == null || "".equals(//$NON-NLS-1$
+ name.getValueAsString().toString().trim())) {
+ setErrorMessage(JbossWSUIMessages.JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_NAME_CANNOT_BE_EMPTY);
+ setPageComplete(false);
+ return;
+ }
+
+ if (!name.getValueAsString().matches(
+ "[a-zA-Z_][a-zA-Z0-9_\\-\\. ]*")) { //$NON-NLS-1$
+ setErrorMessage(JbossWSUIMessages.JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_RUNTIME_NAME_IS_NOT_CORRECT);
+ setPageComplete(false);
+ return;
+ }
+ for (JbossWSRuntime rt : value) {
+ if (current != null && current.getName().equals(rt.getName())) {
+ continue;
+ }
+ if (rt.getName().equals(name.getValueAsString())) {
+ setErrorMessage(JbossWSUIMessages.JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_RUNTIME
+ + name.getValueAsString()
+ + JbossWSUIMessages.JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_ALREADY_EXISTS);
+ setPageComplete(false);
+ return;
+ }
+ }
+
+ if (current != null
+ && current.getName().equals(name.getValueAsString())
+ && current.getHomeDir().equals(homeDir.getValueAsString())) {
+ setErrorMessage(null);
+ setPageComplete(false);
+ return;
+ }
+
+ if (homeDir.getValueAsString() == null
+ || "".equals(homeDir.getValueAsString().trim())) { //$NON-NLS-1$
+ setErrorMessage(JbossWSUIMessages.JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_PATH_TO_HOME_DIRECTORY_CANNOT_BE_EMPTY);
+ setPageComplete(false);
+ return;
+ }
+
+ setErrorMessage(null);
+ setPageComplete(true);
+ }
+
+ /**
+ * Return JbossWS Runtime instance initialized by user input
+ *
+ * @return JbossWSRuntime instance
+ */
+ public JbossWSRuntime getRuntime() {
+ JbossWSRuntime newRt = new JbossWSRuntime();
+ newRt.setName(name.getValueAsString());
+ newRt.setHomeDir(homeDir.getValueAsString());
+ return newRt;
+ }
+
+ public IFieldEditor createTextEditor(String name, String label, String defaultValue) {
+ CompositeEditor editor = new CompositeEditor(name,label, defaultValue);
+ editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
+ new TextFieldEditor(name,label, defaultValue)});
+ return editor;
+ }
+
+ public IFieldEditor createBrowseFolderEditor(String name, String label, String defaultValue) {
+ CompositeEditor editor = new CompositeEditor(name, label, defaultValue);
+ editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
+ new TextFieldEditor(name,label, defaultValue),
+ new ButtonFieldEditor(name,createSelectFolderAction(JbossWSUIMessages.JBOSSWS_SWT_FIELD_EDITOR_FACTORY_BROWSE),defaultValue)});
+ return editor;
+ }
+
+ public ButtonFieldEditor.ButtonPressedAction createSelectFolderAction(String buttonName) {
+ return new ButtonFieldEditor.ButtonPressedAction(buttonName) {
+ @Override
+ public void run() {
+ DirectoryDialog dialog = new DirectoryDialog(Display.getCurrent().getActiveShell());
+ dialog.setFilterPath(getFieldEditor().getValueAsString());
+ dialog.setMessage(JbossWSUIMessages.JBOSSWS_SWT_FIELD_EDITOR_FACTORY_SELECT_HOME_FOLDER);
+ dialog.setFilterPath(getFieldEditor().getValueAsString());
+ String directory = dialog.open();
+ if(directory!=null) {
+ getFieldEditor().setValue(directory);
+ }
+ }
+ };
+ }
+ }
+
+ /**
+ * Wizard collect information and creates new JbossWSRuntime instances.
+ *
+ */
+ public static class JbossWSRuntimeNewWizard extends Wizard {
+
+ JbossWSRuntimeWizardPage page1 = null;
+ List<JbossWSRuntime> added = null;
+ List<JbossWSRuntime> value = null;
+
+ public JbossWSRuntimeNewWizard(List<JbossWSRuntime> exist,List<JbossWSRuntime> added) {
+ super();
+ setWindowTitle(JbossWSUIMessages.JBOSSWS_RUNTIME_LIST_FIELD_EDITOR_NEW_RUNTIME);
+ page1 = new JbossWSRuntimeWizardPage(exist);
+ addPage(page1);
+ this.value = exist;
+ this.added = added;
+ }
+
+ /**
+ * Do finish steps
+ *
+ * @return boolean
+ */
+ @Override
+ public boolean performFinish() {
+ JbossWSRuntime rt = page1.getRuntime();
+ added.add(rt);
+ value.add(rt);
+ return true;
+ }
+ }
+
+ /**
+ * Wizard for editing JbossWS Runrtime parameters: name, version and path to
+ * home folder
+ *
+ */
+ public static class JbossWSRuntimeEditWizard extends Wizard {
+ JbossWSRuntimeWizardPage page1 = null;
+ List<JbossWSRuntime> added = null;
+ Map<JbossWSRuntime, JbossWSRuntime> changed = null;
+ List<JbossWSRuntime> value = null;
+ JbossWSRuntime source = null;
+
+ /**
+ * Constructor with almost all initialization parameters
+ *
+ * @param existing
+ * List<JbossWSRuntime> - edited list of JbossWS Runtimes
+ * @param source
+ * JbossWSRuntime - edited JbossWS Runtime
+ * @param added
+ * List<JbossWSRuntime> - TBD
+ * @param changed
+ * List<JbossWSRuntime> - TBD
+ */
+ public JbossWSRuntimeEditWizard(List<JbossWSRuntime> existing,
+ JbossWSRuntime source, List<JbossWSRuntime> added,
+ Map<JbossWSRuntime, JbossWSRuntime> changed) {
+ 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);
+ addPage(page1);
+ this.value = existing;
+ this.added = added;
+ this.changed = changed;
+ this.source = source;
+ page1.name.setValue(source.getName());
+ page1.homeDir.setValue(source.getHomeDir());
+ page1.current = source;
+ }
+
+ /**
+ * Perform operations to finish editing JbossWS Runtime parameters
+ *
+ * @return boolean - always true
+ */
+ @Override
+ public boolean performFinish() {
+ JbossWSRuntime rt = page1.getRuntime();
+ if (rt.getName().equals(source.getName())
+ && rt.getHomeDir().equals(source.getHomeDir())) {
+ return true;
+ }
+ if (added.contains(source) || changed.containsKey(source)) {
+ source.setName(rt.getName());
+ source.setHomeDir(rt.getName());
+ } else {
+ changed.put(rt, source);
+ int i = value.indexOf(source);
+ if (i >= 0) {
+ value.set(i, rt);
+ } else {
+ value.remove(source);
+ value.add(rt);
+ }
+ }
+ return true;
+ }
+ }
+
+ /**
+ * Composite that holds list of BaseActions and presents them as column of
+ * buttons
+ *
+ */
+ public static class ActionPanel extends Composite implements
+ ISelectionChangedListener {
+
+ private BaseAction[] actions = null;
+
+ /**
+ * Constructor creates panel with style, grid layout and buttons
+ * represented the actions
+ *
+ * @param parent
+ * Composite
+ * @param style
+ * int
+ * @param actions
+ * BaseAction[]
+ */
+ public ActionPanel(Composite parent, int style, BaseAction[] actions) {
+ super(parent, style);
+ this.actions = actions;
+ setLayout(new GridLayout(1, false));
+ for (BaseAction action : this.actions) {
+ new ActionButton(this, SWT.PUSH, action);
+ }
+ }
+
+ /**
+ * Constructor creates panel with default style, grid layout and buttons
+ * represented the actions
+ *
+ * @param parent
+ * Composite
+ * @param actions
+ * BaseAction[]
+ */
+ public ActionPanel(Composite parent, BaseAction[] actions) {
+ this(parent, SWT.NONE, actions);
+ }
+
+ /**
+ * Listen to the selection changes and update actions state
+ * (enable/disable)
+ *
+ * @param event
+ * SelectionChangeEvent
+ * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ for (BaseAction action : actions) {
+ action.setSelection(event.getSelection());
+ }
+ }
+ }
+
+ /**
+ * Class represents an BaseAction as SWT button control and runs action when
+ * button is prtessed
+ *
+ */
+ public static class ActionButton implements IPropertyChangeListener {
+
+ private Button button;
+ private BaseAction action;
+
+ /**
+ * Create Button control with parent control and style that represents
+ * action
+ *
+ * @param parent
+ * Composite
+ * @param style
+ * int
+ * @param action
+ * BaseAction
+ */
+ public ActionButton(Composite parent, int style, BaseAction action) {
+ this.button = new Button(parent, style);
+ this.action = action;
+
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL,
+ GridData.CENTER, false, false);
+
+ gd.horizontalAlignment = GridData.FILL;
+ gd.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
+ this.button.setLayoutData(gd);
+ this.action.addPropertyChangeListener(this);
+ this.button.setText(action.getText());
+ this.button.setEnabled(action.isEnabled());
+ this.button.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ ActionButton.this.action.run();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ }
+
+ /**
+ * Return SWT button control that calls provided action
+ *
+ * @return Control - button swt control
+ */
+ public Control getControl() {
+ return button;
+ }
+
+ /**
+ * Update enabled/disabled button state
+ *
+ * @param event
+ * PropertyChangeEvent
+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getProperty().equals(IAction.ENABLED)) {
+ button.setEnabled(((Boolean) event.getNewValue())
+ .booleanValue());
+ }
+ }
+ }
+
+ /**
+ * Action that changes state enable/disable based on current table selection
+ *
+ */
+ public abstract class BaseAction extends Action {
+
+ JbossWSRuntime[] runtimes = new JbossWSRuntime[0];
+
+ /**
+ * Constructor creates action with provided name
+ *
+ * @param name
+ * String - action name
+ */
+ public BaseAction(String name) {
+ super(name);
+ updateEnablement();
+ }
+
+ /**
+ * Set current selection
+ *
+ * @param selection
+ * ISelection - selected items
+ */
+ public void setSelection(ISelection selection) {
+ if (selection instanceof IStructuredSelection) {
+ List<JbossWSRuntime> rts = new ArrayList<JbossWSRuntime>();
+ for (Object rt : ((IStructuredSelection) selection).toArray()) {
+ rts.add((JbossWSRuntime) rt);
+ }
+ runtimes = rts.toArray(new JbossWSRuntime[] {});
+ } else {
+ runtimes = new JbossWSRuntime[0];
+ }
+ updateEnablement();
+ }
+
+ protected abstract void updateEnablement();
+ }
+
+ /**
+ * Action that invokes New JbossWS Runtime Dialog
+ *
+ */
+ public class AddAction extends BaseAction {
+
+ static final String ACTION_NAME = "&Add";
+
+ /**
+ * Constructor create Add action with default name
+ */
+ public AddAction() {
+ super(ACTION_NAME);
+ // This action is always available
+ setEnabled(true);
+ }
+
+ /**
+ * Do nothing, because Add action should be always available
+ */
+ @Override
+ protected void updateEnablement() {
+ // Add button is always available
+ }
+
+ /**
+ * Invoke New JbossWS Runtime Dialog
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void run() {
+ Wizard wiz = new JbossWSRuntimeNewWizard(
+ (List<JbossWSRuntime>) getValue(), added);
+ WizardDialog dialog = new WizardDialog(Display.getCurrent()
+ .getActiveShell(), wiz);
+ dialog.open();
+ tableView.refresh();
+ setDefaultRuntimes();
+ }
+ }
+
+ /**
+ * Action starts an editing selected JbossWS Runtime in Edit JbossWS Runtime
+ * dialog
+ *
+ */
+ public class EditAction extends BaseAction {
+
+ static final String ACTION_NAME = "&Edit";
+
+
+ /**
+ * Create EditAction with default name
+ *
+ * @param text
+ */
+ public EditAction() {
+ super(ACTION_NAME);
+ }
+
+ /**
+ * Edit action is enabled when the only JbossWS Runtime is selected
+ */
+ @Override
+ protected void updateEnablement() {
+ // available when the only JbossWSRuntime is selected
+ setEnabled(runtimes.length == 1);
+ }
+
+ /**
+ * Start editing selected JbossWS Runtime in Edit JbossWS Runtime Wizard
+ * Dialog
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void run() {
+ JbossWSRuntime selected = runtimes[0];
+ Wizard wiz = new JbossWSRuntimeEditWizard(
+ (List<JbossWSRuntime>) getValue(), runtimes[0], added, changed);
+ WizardDialog dialog = new WizardDialog(Display.getCurrent()
+ .getActiveShell(), wiz);
+ dialog.open();
+ tableView.refresh();
+ if (changed.containsValue(selected)) {
+ JbossWSRuntime c = findChangedRuntime(selected);
+ if (c != null) {
+ tableView.setSelection(new StructuredSelection(c));
+ }
+ }
+ }
+
+ private JbossWSRuntime findChangedRuntime(JbossWSRuntime source) {
+ for (JbossWSRuntime r : changed.keySet()) {
+ if (source == changed.get(r)) {
+ return r;
+ }
+ }
+ return null;
+ }
+ }
+
+ /**
+ * Action deletes all selected JbossWS Runtimes. A warning message is shown for
+ * used JbossWS Runtimes
+ *
+ */
+ public class RemoveAction extends BaseAction {
+
+ static final String ACTION_NAME = "&Remove";
+ /**
+ * Create DeleteAction action with default name
+ */
+ public RemoveAction() {
+ super(ACTION_NAME);
+ }
+
+ @Override
+ protected void updateEnablement() {
+ setEnabled(runtimes.length > 0);
+ }
+
+ /**
+ * Remove all selected JbossWS Runtimes one by one
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ for (JbossWSRuntime rt : runtimes) {
+ removeRuntime(rt);
+ }
+ tableView.refresh();
+ setDefaultRuntimes();
+ }
+
+ @SuppressWarnings("unchecked")
+ private void removeRuntime(JbossWSRuntime r) {
+ boolean used = isRuntimeUsed(r.getName());
+ String title = JbossWSUIMessages.JBOSSWS_RUNTIME_DELETE_CONFIRM_TITLE;
+ String message = (used) ? NLS.bind(
+ JbossWSUIMessages.JBOSSWS_RUNTIME_DELETE_USED_CONFIRM, r.getName())
+ : NLS.bind(JbossWSUIMessages.JBOSSWS_RUNTIME_DELETE_NOT_USED_CONFIRM,
+ r.getName());
+ boolean b = MessageDialog.openConfirm(tableView.getControl()
+ .getShell(), title, message);
+ if (b) {
+ if (changed.containsKey(r)) {
+ r = changed.remove(r);
+ }
+ removed.add(r);
+ if (added.contains(r)) {
+ added.remove(r);
+ }
+ ((List) getValue()).remove(r);
+ }
+ checkedElements.remove(r);
+ }
+
+ private boolean isRuntimeUsed(String runtimeName) {
+// IProject[] ps = ResourcesPlugin.getWorkspace().getRoot()
+// .getProjects();
+// for (int i = 0; i < ps.length; i++) {
+// ISeamProject sp = SeamCorePlugin.getSeamProject(ps[i], false);
+// if (sp != null && runtimeName.equals(sp.getRuntimeName())) {
+// return true;
+// }
+// }
+ return false;
+ }
+ }
+}
\ No newline at end of file
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntime.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntime.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntime.java 2008-06-05 06:46:49 UTC (rev 8556)
@@ -0,0 +1,128 @@
+package org.jboss.tools.ws.ui.preferences;
+
+public class JbossWSRuntime {
+
+ String name = null;
+
+ String homeDir = null;
+
+ boolean defaultRt = false;
+
+ /**
+ * Default constructor
+ */
+ public JbossWSRuntime() {
+ }
+
+ /**
+ * Get JbossWSRuntime name
+ *
+ * @return name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Get path to home directory
+ *
+ * @return home directory path as string
+ */
+ public String getHomeDir() {
+ return homeDir;
+ }
+
+ /**
+ * Set JbossWSRuntime name
+ *
+ * @param name
+ * new JbossWSRuntime name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Set home directory
+ *
+ * @param homeDir
+ * new JbossWSRuntime's home directory
+ */
+ public void setHomeDir(String homeDir) {
+ this.homeDir = homeDir;
+ }
+
+ /**
+ * Mark runtime as default
+ *
+ * @param b
+ * new value for default property
+ */
+ public void setDefault(boolean b) {
+ this.defaultRt = b;
+ }
+
+ /**
+ * Get default flag
+ *
+ * @return default property
+ */
+ public boolean isDefault() {
+ return defaultRt;
+ }
+
+ /**
+ * Calculate path to seam-gen
+ *
+ * @return absolute path to seam-gen folder
+ */
+ public String getSeamGenDir() {
+ return getHomeDir() + "/seam-gen"; //$NON-NLS-1$
+ }
+
+ /**
+ * Calculate path to source templates
+ *
+ * @return absolute path to source templates
+ */
+ public String getSrcTemplatesDir() {
+ return getSeamGenDir() + "/src"; //$NON-NLS-1$
+ }
+
+ /**
+ * Calculate path to view templates
+ *
+ * @return absolute path to view templates
+ */
+ public String getViewTemplatesDir() {
+ return getSeamGenDir() + "/view"; //$NON-NLS-1$
+ }
+
+ /**
+ * Calculate path to resource templates
+ *
+ * @return absolute path to resource templates
+ */
+ public String getResourceTemplatesDir() {
+ return getSeamGenDir() + "/resources"; //$NON-NLS-1$
+ }
+
+ /**
+ * Calculate path to test templates
+ *
+ * @return absolute path to test templates
+ */
+ public String getTestTemplatesDir() {
+ return getSeamGenDir() + "/test"; //$NON-NLS-1$
+ }
+
+ /**
+ * Calculate path to templates root directory
+ *
+ * @return absolute path to templates root directory
+ */
+ public String getTemplatesDir() {
+ return getSeamGenDir();
+ }
+
+}
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntimeListConverter.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntimeListConverter.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntimeListConverter.java 2008-06-05 06:46:49 UTC (rev 8556)
@@ -0,0 +1,87 @@
+package org.jboss.tools.ws.ui.preferences;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+public class JbossWSRuntimeListConverter {
+
+ /*
+ * Constants definitions
+ */
+ private static final String REGEXP_ESCAPE = "\\";
+ private static final String COMMA = ",";
+ private static final String EMPTY_STRING = "";
+ private static final String FIELD_SEPARATOR = "|";
+ private static final String DEFAULT = "default";
+ private static final String HOME_DIR = "homeDir";
+ private static final String NAME = "name";
+
+ /**
+ * Load String to SeamRuntime map from String
+ * @param input
+ * String representation of map
+ * @return
+ * Map<String, SeamRuntime> loaded from string
+ * TODO - switch to XML?
+ * TODO - write converter from old serialization format to XML?
+ * TODO - handle errors in string format
+ */
+ public Map<String, JbossWSRuntime> getMap(String input) {
+
+ Map<String, JbossWSRuntime> result = new HashMap<String, JbossWSRuntime>();
+ if (input == null || EMPTY_STRING.equals(input.trim())) {
+ return result;
+ }
+ StringTokenizer runtimes = new StringTokenizer(input, COMMA);
+ while (runtimes.hasMoreTokens()) {
+ String runtime = runtimes.nextToken();
+ String[] map = runtime.split(REGEXP_ESCAPE + FIELD_SEPARATOR);
+ JbossWSRuntime rt = new JbossWSRuntime();
+ final int step = 2;
+ for (int i = 0; i < map.length; i += step) {
+ String name = map[i];
+ String value = i + 1 < map.length ? map[i + 1] : EMPTY_STRING;
+ if (NAME.equals(name)) {
+ rt.setName(value);
+ } else if (HOME_DIR.equals(name)) {
+ rt.setHomeDir(value);
+ } else if (DEFAULT.equals(name)) {
+ rt.setDefault(Boolean.parseBoolean(value));
+ }
+ }
+ result.put(rt.getName(), rt);
+ }
+
+ return result;
+ }
+
+ /**
+ * Convert map String to SeamRUntime to string representation
+ * @param runtimeMap
+ * Map<String, SeamRuntime> - map of String to Seam Runtime to convert
+ * in String
+ * @return
+ * String representation of String to Seam Runtime map
+ */
+ public String getString(Map<String, JbossWSRuntime> runtimeMap) {
+ StringBuffer buffer = new StringBuffer();
+ JbossWSRuntime[] runtimes = runtimeMap.values().toArray(
+ new JbossWSRuntime[runtimeMap.size()]);
+ for (int i = 0; i < runtimes.length; i++) {
+ buffer.append(NAME).append(FIELD_SEPARATOR);
+ buffer.append(runtimes[i].getName());
+ buffer.append(FIELD_SEPARATOR).append(HOME_DIR).append(
+ FIELD_SEPARATOR);
+ buffer.append(runtimes[i].getHomeDir());
+ buffer.append(FIELD_SEPARATOR).append(DEFAULT).append(
+ FIELD_SEPARATOR);
+ buffer.append(runtimes[i].isDefault());
+ if (i != runtimes.length - 1) {
+ buffer.append(COMMA);
+ }
+ }
+ return buffer.toString();
+ }
+ }
+
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntimeManager.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntimeManager.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntimeManager.java 2008-06-05 06:46:49 UTC (rev 8556)
@@ -0,0 +1,259 @@
+package org.jboss.tools.ws.ui.preferences;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.preference.IPersistentPreferenceStore;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.jboss.tools.ws.core.JbossWSCorePlugin;
+
+public class JbossWSRuntimeManager {
+
+ private static JbossWSRuntimeListConverter converter = new JbossWSRuntimeListConverter();
+
+ private Map<String, JbossWSRuntime> runtimes = new HashMap<String, JbossWSRuntime>();
+
+ /**
+ * Private constructor
+ */
+ private JbossWSRuntimeManager() {
+ IPreferenceStore ps = JbossWSCorePlugin.getDefault().getPreferenceStore();
+
+ String runtimeListString = ps.getDefaultString("jbosswsruntimelocation");
+
+ runtimes = converter.getMap(runtimeListString);
+ }
+
+ /**
+ * This class make Java Runtime responsible for solving synchronization
+ * problems during initialization if there is any
+ *
+ */
+ static class JbossWSRuntimeManagerHolder {
+ private static final JbossWSRuntimeManager INSTANCE = new JbossWSRuntimeManager();
+ }
+
+ /**
+ * Return SeamRuntimeManaher instance
+ *
+ * @return
+ * SeamRuntimeManager instance
+ */
+ public static JbossWSRuntimeManager getInstance() {
+ return JbossWSRuntimeManagerHolder.INSTANCE;
+ }
+
+ /**
+ * Return Array of configured SeamRuntimes
+ *
+ * @return
+ * SeamRuntime[]
+ */
+ public JbossWSRuntime[] getRuntimes() {
+ Collection<JbossWSRuntime> c = runtimes.values();
+ return c.toArray(new JbossWSRuntime[runtimes.size()]);
+ }
+
+ /**
+ * Add new SeamRuntime
+ *
+ * @param runtime
+ * SeamRuntime
+ */
+ public void addRuntime(JbossWSRuntime runtime) {
+ if (runtimes.size() == 0) {
+ runtime.setDefault(true);
+ }
+
+ JbossWSRuntime oldDefaultRuntime = getDefaultRuntime();
+ if (oldDefaultRuntime != null && runtime.isDefault()) {
+ oldDefaultRuntime.setDefault(false);
+ }
+ runtimes.put(runtime.getName(), runtime);
+ save();
+ }
+
+ /**
+ * Add new SeamRuntime with given parameters
+ *
+ * @param name
+ * String - runtime name
+ * @param path
+ * String - runtime home folder
+ * @param version
+ * String - string representation of version number
+ * @param defaultRt
+ * boolean - default flag
+ */
+ public void addRuntime(String name, String path,
+ boolean defaultRt) {
+ JbossWSRuntime seamRt = new JbossWSRuntime();
+ seamRt.setHomeDir(path);
+ seamRt.setName(name);
+ seamRt.setDefault(defaultRt);
+ addRuntime(seamRt);
+ }
+
+ /**
+ * Return SeamRuntime by given name
+ *
+ * @param name
+ * String - SeamRuntime name
+ * @return
+ * SeamRuntime - found SeamRuntime instance or null
+ */
+ public JbossWSRuntime findRuntimeByName(String name) {
+ for (JbossWSRuntime seamRuntime : runtimes.values()) {
+ if (seamRuntime.getName().equals(name)) {
+ return seamRuntime;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Remove given SeamRuntime from manager
+ * @param rt
+ * SeamRuntime
+ */
+ public void removeRuntime(JbossWSRuntime rt) {
+ runtimes.remove(rt.getName());
+ }
+
+
+ /**
+ * Save preference value and force save changes to disk
+ */
+ public void save() {
+ JbossWSCorePlugin.getDefault().getPreferenceStore().setValue(
+ "jbosswsruntimelocation",
+ converter.getString(runtimes));
+ IPreferenceStore store = JbossWSCorePlugin.getDefault().getPreferenceStore();
+ if (store instanceof IPersistentPreferenceStore) {
+ try {
+ ((IPersistentPreferenceStore) store).save();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Marks this runtime as default. Marks other runtimes with the same version as not default.
+ * @param runtime
+ */
+ public void setDefaultRuntime(JbossWSRuntime runtime) {
+ JbossWSRuntime[] runtimes = getRuntimes();
+ for (int i = 0; i < runtimes.length; i++) {
+ runtimes[i].setDefault(false);
+ }
+ runtime.setDefault(true);
+ }
+
+ /**
+ * Return first default SeamRuntime
+ *
+ * @return
+ * SeamRuntime
+ */
+ public JbossWSRuntime getDefaultRuntime() {
+ for (JbossWSRuntime rt : runtimes.values()) {
+ if (rt.isDefault()) {
+ return rt;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * If project has seam facet then this method returns default seam runtime for proper version of facet.
+ * Otherwise return first default runtime.
+ * @param project
+ * @return
+ */
+ public static JbossWSRuntime getDefaultRuntimeForProject(IProject project) {
+ if(project==null) {
+ throw new IllegalArgumentException("Project must not be null.");
+ }
+ try {
+ IProjectFacet facet = ProjectFacetsManager.getProjectFacet("jbossws.core");
+ IFacetedProject facetedProject = ProjectFacetsManager.create(project);
+ if(facetedProject!=null) {
+ return getInstance().getDefaultRuntime();
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ }
+ return getInstance().getDefaultRuntime();
+ }
+
+ /**
+ * Return list of available SeamRuntime names
+ *
+ * @return
+ * List<String>
+ */
+ public List<String> getRuntimeNames() {
+ JbossWSRuntime[] rts = getRuntimes();
+ List<String> result = new ArrayList<String>();
+ for (JbossWSRuntime seamRuntime : rts) {
+ result.add(seamRuntime.getName());
+ }
+ return result;
+ }
+
+ /**
+ * Return a list of all runtime names
+ *
+ * @return
+ * List of all runtime names
+ */
+ public List<String> getAllRuntimeNames() {
+ JbossWSRuntime[] rts = getRuntimes();
+ List<String> result = new ArrayList<String>();
+ for (JbossWSRuntime seamRuntime : rts) {
+ result.add(seamRuntime.getName());
+ }
+ return result;
+ }
+
+ /**
+ * TBD
+ *
+ * @param oldName
+ * old runtime name
+ * @param newName
+ * new runtime name
+ */
+ public void changeRuntimeName(String oldName, String newName) {
+ JbossWSRuntime o = findRuntimeByName(oldName);
+ if (o == null) {
+ return;
+ }
+ o.setName(newName);
+ onRuntimeNameChanged(oldName, newName);
+ }
+
+ private void onRuntimeNameChanged(String oldName, String newName) {
+ IProject[] ps = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+// for (int i = 0; i < ps.length; i++) {
+// ISeamProject sp = SeamCorePlugin.getSeamProject(ps[i], false);
+// if (sp != null && oldName.equals(sp.getRuntimeName())) {
+// sp.setRuntimeName(newName);
+// }
+// }
+ }
+}
\ No newline at end of file
Copied: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntimePreferencePage2.java (from rev 8527, 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/JbossWSRuntimePreferencePage2.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/JbossWSRuntimePreferencePage2.java 2008-06-05 06:46:49 UTC (rev 8556)
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.preferences;
+
+import java.io.File;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+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.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.jboss.tools.ws.core.JbossWSCorePlugin;
+import org.jboss.tools.ws.core.messages.JbossWSCoreMessages;
+import org.jboss.tools.ws.ui.JbossWSUIPlugin;
+import org.jboss.tools.ws.ui.messages.JbossWSUIMessages;
+import org.jboss.tools.ws.ui.utils.UIUtils;
+
+/**
+ * @author Grid Qian
+ */
+public class JbossWSRuntimePreferencePage2 extends PreferencePage implements
+ IWorkbenchPreferencePage {
+
+ private Text jbosswsPath;
+ private Label statusLabel;
+
+ protected Control createContents(Composite superparent) {
+
+ IPreferenceStore ps = JbossWSCorePlugin.getDefault()
+ .getPreferenceStore();
+ this.setPreferenceStore(ps);
+
+ UIUtils uiUtils = new UIUtils(JbossWSUIPlugin.PLUGIN_ID);
+ final Composite mainComp = uiUtils.createComposite(superparent, 1);
+
+ TabFolder jbosswsPreferenceTab = new TabFolder(mainComp, SWT.WRAP);
+ jbosswsPreferenceTab.setLayoutData(new GridData(
+ GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
+ | GridData.FILL_BOTH));
+
+ TabItem runtimeInstalLocationItem = new TabItem(jbosswsPreferenceTab,
+ SWT.WRAP);
+ runtimeInstalLocationItem.setText(JbossWSUIMessages.JBOSSWS_RUNTIME);
+ runtimeInstalLocationItem
+ .setToolTipText(JbossWSUIMessages.JBOSSWS_RUNTIME_TOOLTIP);
+
+ Composite runtimeTab = uiUtils.createComposite(jbosswsPreferenceTab, 1);
+ runtimeTab.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.GRAB_VERTICAL | GridData.FILL_BOTH));
+ Composite runtimeGroup = uiUtils.createComposite(runtimeTab, 3);
+
+ runtimeInstalLocationItem.setControl(runtimeTab);
+ runtimeTab.setToolTipText(JbossWSUIMessages.JBOSSWS_RUNTIME_TOOLTIP);
+
+ jbosswsPath = uiUtils.createText(runtimeGroup,
+ JbossWSUIMessages.JBOSSWS_RUNTIME_LOCATION, null, null,
+ SWT.BORDER);
+
+ Button browseButton = uiUtils.createPushButton(runtimeGroup,
+ JbossWSUIMessages.LABEL_BROUSE, null, null);
+ browseButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ handleBrowse(mainComp.getShell());
+ }
+ });
+
+ jbosswsPath.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ statusUpdate(runtimeExist(jbosswsPath.getText()));
+
+ }
+ });
+ new Label(runtimeTab, SWT.HORIZONTAL);
+ statusLabel = new Label(runtimeTab, SWT.BACKGROUND | SWT.READ_ONLY | SWT.CENTER | SWT.WRAP | SWT.H_SCROLL);
+ statusLabel.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.GRAB_VERTICAL | GridData.FILL_BOTH));
+
+ initializeValues();
+ jbosswsPreferenceTab.setEnabled(true);
+ jbosswsPreferenceTab.setVisible(true);
+ return mainComp;
+ }
+
+ public void init(IWorkbench workbench) {
+ }
+
+ /**
+ * Pops up the file browse dialog box
+ */
+ private void handleBrowse(Shell parent) {
+ DirectoryDialog fileDialog = new DirectoryDialog(parent);
+ String fileName = fileDialog.open();
+ if (fileName != null) {
+ jbosswsPath.setText(fileName);
+ }
+ }
+
+ private void statusUpdate(boolean status) {
+ if (statusLabel != null) {
+ if (!jbosswsPath.getText().equals("")) {
+ if (status) {
+ statusLabel
+ .setText(JbossWSUIMessages.LABEL_JBOSSWS_RUNTIME_LOAD);
+ } else {
+ statusLabel
+ .setText(JbossWSUIMessages.LABEL_JBOSSWS_RUNTIME_LOAD_ERROR);
+ }
+ } else {
+ statusLabel
+ .setText(JbossWSUIMessages.LABEL_JBOSSWS_RUNTIME_NOT_EXIT);
+ }
+ }
+ }
+
+ private boolean runtimeExist(String path) {
+
+ File jbosswsHomeDir = new File(path);
+ if (!jbosswsHomeDir.isDirectory())
+ return false;
+ String[] newNode = {JbossWSUIMessages.BIN, JbossWSUIMessages.COMMOND};
+ String jbosswsBinPath = UIUtils.addNodesToPath(jbosswsHomeDir.getAbsolutePath(), newNode);
+ if(new File(jbosswsBinPath).isFile()){
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * store the location to the preference
+ */
+ private void storeValues() {
+ IPreferenceStore store = this.getPreferenceStore();
+ store.setValue(JbossWSCoreMessages.WS_LOCATION, jbosswsPath.getText());
+ }
+
+ /**
+ * Initializes location using default values in the preference store.
+ */
+ private void initializeDefaults() {
+ IPreferenceStore preferenceStore = this.getPreferenceStore();
+ jbosswsPath.setText(preferenceStore
+ .getDefaultString("jbosswsruntimelocation"));
+ }
+
+ /**
+ * Initializes the location using default values in the preference
+ */
+ private void initializeValues() {
+ IPreferenceStore preferenceStore = this.getPreferenceStore();
+ jbosswsPath
+ .setText(preferenceStore.getString("jbosswsruntimelocation"));
+
+ }
+
+ /**
+ * Default button has been pressed.
+ */
+ protected void performDefaults() {
+ super.performDefaults();
+ initializeDefaults();
+ }
+
+ /**
+ * Apply button has been pressed.
+ */
+ protected void performApply() {
+ performOk();
+ }
+
+ /**
+ * OK button has been pressed.
+ */
+ public boolean performOk() {
+ storeValues();
+ return true;
+ }
+
+}
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/LabelFieldEditor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/LabelFieldEditor.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/LabelFieldEditor.java 2008-06-05 06:46:49 UTC (rev 8556)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.preferences;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * @author eskimo
+ *
+ */
+public class LabelFieldEditor extends BaseFieldEditor {
+
+ public LabelFieldEditor(String name, String label) {
+ super(name, label, ""); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.BaseFieldEditor#doFillIntoGrid(java.lang.Object)
+ */
+ @Override
+ public void doFillIntoGrid(Object parent) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.BaseFieldEditor#getEditorControls(java.lang.Object)
+ */
+ @Override
+ public Object[] getEditorControls(Object composite) {
+ // TODO Auto-generated method stub
+ return new Control[]{createLabelControl((Composite)composite)};
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.BaseFieldEditor#getEditorControls()
+ */
+ @Override
+ public Object[] getEditorControls() {
+ return getEditorControls(null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.IFieldEditor#isEditable()
+ */
+ @Override
+ public boolean isEditable() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.IFieldEditor#save(java.lang.Object)
+ */
+ public void save(Object object) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.IFieldEditor#setEditable(boolean)
+ */
+ @Override
+ public void setEditable(boolean ediatble) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setValue(Object value) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.BaseFieldEditor#getNumberOfControls()
+ */
+ @Override
+ public int getNumberOfControls() {
+ // TODO Auto-generated method stub
+ return 1;
+ }
+}
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/PushButtonField.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/PushButtonField.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/PushButtonField.java 2008-06-05 06:46:49 UTC (rev 8556)
@@ -0,0 +1,31 @@
+package org.jboss.tools.ws.ui.preferences;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.jboss.tools.ws.ui.preferences.ButtonFieldEditor.ButtonPressedAction;
+
+/**
+ * @author eskimo
+ *
+ */
+public class PushButtonField extends BaseField {
+
+ Button button;
+
+ /**
+ *
+ */
+ @Override
+ public Control getControl() {
+ return button;
+ }
+
+
+ public PushButtonField(Composite composite, ButtonPressedAction listener) {
+ button = new Button(composite,SWT.PUSH);
+ button.setText(listener.getText());
+ button.addSelectionListener(listener);
+ }
+}
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/TextField.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/TextField.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/TextField.java 2008-06-05 06:46:49 UTC (rev 8556)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.preferences;
+
+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.Text;
+
+public class TextField extends BaseField implements ModifyListener{
+
+
+ Text textField = null;
+
+ public TextField(Composite parent, int style) {
+ textField = new Text(parent,style);
+ textField.addModifyListener(this);
+ }
+
+ public void modifyText(ModifyEvent e) {
+ firePropertyChange(new Object(),((Text)e.widget).getText().trim());
+ }
+
+ public Text getTextControl() {
+ return textField;
+ }
+
+ public Control getControl() {
+ return getTextControl();
+ }
+}
Added: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/TextFieldEditor.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/TextFieldEditor.java (rev 0)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/preferences/TextFieldEditor.java 2008-06-05 06:46:49 UTC (rev 8556)
@@ -0,0 +1,249 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.preferences;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Collection;
+
+import org.eclipse.core.runtime.Assert;
+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.Control;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.ws.ui.messages.JbossWSUIMessages;
+
+/**
+ *
+ * @author eskimo
+ *
+ */
+public class TextFieldEditor extends BaseFieldEditor implements PropertyChangeListener{
+
+ /**
+ *
+ */
+ public static final int UNLIMITED = -1;
+
+ protected int style = -1;
+
+ /**
+ *
+ * @param name
+ * @param aLabelText
+ * @param defaultvalue
+ */
+ public TextFieldEditor(String name,String aLabelText,String defaultvalue) {
+ super(name, aLabelText, defaultvalue);
+ }
+
+ /**
+ *
+ * @param name
+ * @param aLabelText
+ * @param defaultvalue
+ * @param editable
+ */
+ public TextFieldEditor(String name,String aLabelText,String defaultvalue,boolean editable) {
+ super(name, aLabelText, defaultvalue);
+ setEditable(editable);
+ }
+
+ /**
+ *
+ */
+ protected TextField fTextField = null;
+
+ /**
+ *
+ */
+ protected int fWidthInChars = 0;
+
+ /**
+ *
+ */
+ @Override
+ public Object[] getEditorControls() {
+ return new Control[] {getTextControl()};
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.BaseFieldEditor#doFillIntoGrid(java.lang.Object)
+ */
+ @Override
+ public void doFillIntoGrid(Object aParent) {
+ Assert.isTrue(aParent instanceof Composite, JbossWSUIMessages.JBOSSWS_BASIC_EDITOR_COMPOSITE);
+ Assert.isTrue(((Composite)aParent).getLayout() instanceof GridLayout,JbossWSUIMessages.JBOSSWS_BASIC_EDITOR_SUPPORT);
+ Composite aComposite = (Composite) aParent;
+ getEditorControls(aComposite);
+ GridLayout gl = (GridLayout)((Composite)aParent).getLayout();
+ getTextControl(aComposite);
+
+ GridData gd = new GridData();
+
+ gd.horizontalSpan = gl.numColumns - 1;
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = true;
+
+ fTextField.getTextControl().setLayoutData(gd);
+ }
+
+ /**
+ *
+ * @param parent
+ * @return
+ */
+ public Text getTextControl(Composite parent) {
+ if (fTextField == null) {
+ fTextField = new TextField(parent, getInitialStyle());
+ Text textField = fTextField.getTextControl();
+ textField.setFont(parent.getFont());
+ textField.setText(getValue().toString());
+ textField.setEditable(isEditable());
+ textField.setEnabled(isEnabled());
+ fTextField.addPropertyChangeListener(this);
+ } else if (parent!=null){
+ Assert.isTrue(parent==fTextField.getTextControl().getParent());
+ }
+ return fTextField.getTextControl();
+ }
+
+ /**
+ *
+ */
+ protected void updateWidgetValues() {
+ setValueAsString(getValueAsString());
+ }
+
+ /**
+ *
+ * @return
+ */
+ protected int getInitialStyle() {
+ if(this.style >= 0) return style;
+ return SWT.SINGLE | SWT.BORDER;
+ }
+
+ /*
+ * @param value
+ * @return
+ */
+ @SuppressWarnings({ "unchecked", "unused" })
+ private String checkCollection(Object value){
+
+ return value != null && (((Collection)value).size() > 0) ? prepareCollectionToString((Collection)value) : ""; //$NON-NLS-1$
+ }
+
+ /*
+ * @param collection
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ private String prepareCollectionToString(Collection collection)
+ {
+ String stringValue = ""; //$NON-NLS-1$
+ Object[] objects = collection.toArray();
+ for(int i = 0; i < objects.length; i++){
+ stringValue += objects[i];
+ if(i < objects.length - 1)
+ stringValue += " "; //$NON-NLS-1$
+ }
+ return stringValue;
+ }
+
+
+ /*
+ * @param value
+ * @return
+ */
+ @SuppressWarnings("unused")
+ private String checkSimple(Object value){
+ return (value != null) ? value.toString() : ""; //$NON-NLS-1$
+ }
+
+ /**
+ *
+ */
+ @Override
+ public int getNumberOfControls() {
+ return 2;
+ }
+
+ /**
+ * Returns this field editor's text control.
+ *
+ * @return the text control, or <code>null</code> if no
+ * text field is created yet
+ */
+ protected Text getTextControl() {
+ return fTextField!=null?fTextField.getTextControl():null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.BaseFieldEditor#setFocus()
+ */
+ @Override
+ public boolean setFocus() {
+ boolean setfocus = false;
+ if(fTextField!=null && !fTextField.getTextControl().isDisposed())
+ setfocus = fTextField.getTextControl().setFocus();
+ return setfocus;
+ }
+
+ /**
+ *
+ */
+ @Override
+ public Object[] getEditorControls(Object composite) {
+ return new Control[]{getTextControl((Composite)composite)};
+ }
+
+ /**
+ *
+ * @param object
+ */
+ public void save(Object object) {
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void setValue(Object newValue) {
+ super.setValue(newValue);
+ if(fTextField!=null){
+ fTextField.removePropertyChangeListener(this);
+ fTextField.getTextControl().setText(newValue.toString());
+ fTextField.addPropertyChangeListener(this);
+ }
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void setEditable(boolean aEditable) {
+ super.setEditable(aEditable);
+ if(getTextControl()!=null) getTextControl().setEditable(aEditable);
+ }
+
+ /**
+ *
+ */
+ public void propertyChange(PropertyChangeEvent evt) {
+ super.setValue(evt.getNewValue());
+ }
+}
\ No newline at end of file
15 years, 10 months
JBoss Tools SVN: r8555 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/plugin.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-06-04 17:01:55 -0400 (Wed, 04 Jun 2008)
New Revision: 8555
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/plugin/ModelPlugin.java
Log:
FIXME comment added
/*
FIXME That's not right solution to obtain workbench because there could be no workbench yet
If so it leads to the exception below and problem with model plug-in activation
java.lang.IllegalStateException: Workbench has not been created yet.
[java] at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:92)
[java] at org.jboss.tools.common.model.plugin.ModelPlugin.start(ModelPlugin.java:76)
[java] at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:1009)
[java] at java.security.AccessController.doPrivileged(Native Method)
*/
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/plugin/ModelPlugin.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/plugin/ModelPlugin.java 2008-06-04 20:51:29 UTC (rev 8554)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/plugin/ModelPlugin.java 2008-06-04 21:01:55 UTC (rev 8555)
@@ -73,6 +73,16 @@
System.setProperty(XModelConstants.HOME, EclipseResourceUtil.getInstallPath(context.getBundle()));
super.start(context);
try {
+ /*
+ FIXME That's not right solution to obtain workbench because there could be no workbench yet
+ If so it leads to the exception below and problem with model plug-in activation
+ java.lang.IllegalStateException: Workbench has not been created yet.
+ [java] at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:92)
+ [java] at org.jboss.tools.common.model.plugin.ModelPlugin.start(ModelPlugin.java:76)
+ [java] at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:1009)
+ [java] at java.security.AccessController.doPrivileged(Native Method)
+ */
+
PlatformUI.getWorkbench().addWindowListener(this);
} catch (Exception e) {
getPluginLog().logError(e);
15 years, 10 months
JBoss Tools SVN: r8554 - in trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui: actions and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-06-04 16:51:29 -0400 (Wed, 04 Jun 2008)
New Revision: 8554
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUIPlugin.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUISharedImages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/DeployAction.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/console/ELExceptionsMatcher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/PollerSection.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/PortSection.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerPasswordSection.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/SecurityFailureHandler.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/perspective/ASPerspective.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/PropertySheetFactory.java
Log:
Internationalization / string externalization
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUIPlugin.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUIPlugin.java 2008-06-04 18:40:13 UTC (rev 8553)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUIPlugin.java 2008-06-04 20:51:29 UTC (rev 8554)
@@ -43,7 +43,7 @@
private ResourceBundle resourceBundle;
// UI plugin id
- public static final String PLUGIN_ID = "org.jboss.ide.eclipse.as.ui";
+ public static final String PLUGIN_ID = "org.jboss.ide.eclipse.as.ui"; //$NON-NLS-1$
/**
* The constructor.
@@ -52,7 +52,7 @@
super();
plugin = this;
try {
- resourceBundle = ResourceBundle.getBundle("org.jboss.ide.eclipse.as.ui.ServerUiPluginResources");
+ resourceBundle = ResourceBundle.getBundle("org.jboss.ide.eclipse.as.ui.ServerUiPluginResources"); //$NON-NLS-1$
} catch (MissingResourceException x) {
resourceBundle = null;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUISharedImages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUISharedImages.java 2008-06-04 18:40:13 UTC (rev 8553)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/JBossServerUISharedImages.java 2008-06-04 20:51:29 UTC (rev 8554)
@@ -55,12 +55,12 @@
private static JBossServerUISharedImages instance;
- private Hashtable images, descriptors;
+ private Hashtable<String, Object> images, descriptors;
private JBossServerUISharedImages () {
instance = this;
- images = new Hashtable();
- descriptors = new Hashtable();
+ images = new Hashtable<String, Object>();
+ descriptors = new Hashtable<String, Object>();
Bundle pluginBundle = JBossServerUIPlugin.getDefault().getBundle();
descriptors.put(IMG_JBOSS, createImageDescriptor(pluginBundle, "/icons/jboss.gif"));
@@ -76,10 +76,10 @@
descriptors.put(PUBLISH_IMAGE, createImageDescriptor(pluginBundle, "/icons/publish.gif"));
descriptors.put(UNPUBLISH_IMAGE, createImageDescriptor(pluginBundle, "/icons/unpublish.gif"));
- Iterator iter = descriptors.keySet().iterator();
+ Iterator<String> iter = descriptors.keySet().iterator();
while (iter.hasNext()) {
- String key = (String) iter.next();
+ String key = iter.next();
ImageDescriptor descriptor = descriptor(key);
images.put(key, descriptor.createImage());
}
@@ -121,7 +121,7 @@
}
protected void finalize() throws Throwable {
- Iterator iter = images.keySet().iterator();
+ Iterator<String> iter = images.keySet().iterator();
while (iter.hasNext())
{
Image image = (Image) images.get(iter.next());
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2008-06-04 18:40:13 UTC (rev 8553)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2008-06-04 20:51:29 UTC (rev 8554)
@@ -108,13 +108,20 @@
public static String ActionDelegateNew;
public static String ActionDelegateNewMBeanStubs;
public static String ActionDelegateNewServer;
+ public static String ActionDelegateMakeDeployable;
+ public static String ActionDelegateMakeUndeployable;
+ public static String ActionDelegateDeployableServersNotFoundTitle;
+ public static String ActionDelegateDeployableServersNotFoundDesc;
+ public static String ActionDelegateCannotPublish;
+ public static String ActionDelegatePublishFailed;
+ public static String ActionDelegateFileResourcesOnly;
+ public static String ActionDelegateSelectServer;
+
+ /* Console */
+ public static String ConsoleResourceNotFound;
+ public static String ConsoleCouldNotLocateInWorkspace;
+
- /* Launch Group */
- public static String LaunchGroupStartArgs;
- public static String LaunchGroupStopArgs;
- public static String LaunchGroupTwiddleArgs;
- public static String LaunchGroupConfigChanged;
-
/* Twiddle Dialog */
public static String TwiddleDialog;
public static String TwiddleDialogExecute;
@@ -208,8 +215,27 @@
/* Editor Strings */
-
+ public static String EditorSetDeployLabel;
+ public static String EditorSetTempDeployLabel;
+ public static String EditorDeployDNE;
+ public static String EditorTempDeployDNE;
+ public static String EditorStartupPollerLabel;
+ public static String EditorShutdownPollerLabel;
+ public static String EditorChangeStartPollerCommandName;
+ public static String EditorChangeStopPollerCommandName;
+ public static String EditorServerPorts;
+ public static String EditorServerPortsDescription;
+ public static String EditorJNDIPort;
+ public static String EditorWebPort;
+ public static String EditorAutomaticallyDetectPort;
+ public static String EditorChangeJNDICommandName;
+ public static String EditorChangeWebCommandName;
+ public static String EditorChangeUsernameCommandName;
+ public static String EditorChangePasswordCommandName;
+ // misc
+ public static String ServerSaveFailed;
+
static {
NLS.initializeMessages(JBossServerUIPlugin.PLUGIN_ID + ".Messages",
Messages.class);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2008-06-04 18:40:13 UTC (rev 8553)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2008-06-04 20:51:29 UTC (rev 8554)
@@ -76,14 +76,19 @@
ActionDelegateNew=New
ActionDelegateNewMBeanStubs=New MBean Stubs
ActionDelegateNewServer=New Server
+ActionDelegateMakeDeployable=Make Deployable
+ActionDelegateMakeUndeployable=Make Undeployable
+ActionDelegateDeployableServersNotFoundTitle=No deployable servers found
+ActionDelegateDeployableServersNotFoundDesc=There are no servers that support deploying single files.
+ActionDelegateCannotPublish=Cannot Publish To Server
+ActionDelegatePublishFailed=Publishing files to server failed
+ActionDelegateFileResourcesOnly=One or more selected objects are not Files.
+ActionDelegateSelectServer=Select a server to publish to
+# Console
+ConsoleResourceNotFound=Resource not found
+ConsoleCouldNotLocateInWorkspace=Could not locate {0} in workspace.
-#Launch Config Tab Group
-LaunchGroupStartArgs=Start Args
-LaunchGroupTwiddleArgs=Twiddle Args
-LaunchGroupStopArgs=Stop Args
-LaunchGroupConfigChanged=You may not change the configuration.
-
#Twiddle Dialog
TwiddleDialog=Twiddle Dialog
TwiddleDialogExecute=Execute Twiddle
@@ -186,4 +191,23 @@
FilesetsNewBrowse=Browse...
FilesetsNewIncludes=Includes:
FilesetsNewExcludes=Excludes:
-FilesetsNewPreview=Preview
\ No newline at end of file
+FilesetsNewPreview=Preview
+
+
+#Editor
+EditorSetDeployLabel=Set Deploy Directory
+EditorSetTempDeployLabel=Set Temporary Deploy Directory
+EditorDeployDNE=The deploy directory "{0}" does not exist.
+EditorTempDeployDNE=The temporary deploy directory "{0}" does not exist.
+EditorStartupPollerLabel=Startup Poller
+EditorShutdownPollerLabel=Shutdown Poller
+EditorChangeStartPollerCommandName=Change Startup Poller
+EditorChangeStopPollerCommandName=Change Shutdown Poller
+EditorJNDIPort=JNDI Port:
+EditorWebPort=Web Port:
+EditorAutomaticallyDetectPort=Automatically detect
+EditorChangeJNDICommandName=Change JNDI Port Details
+EditorChangeWebCommandName=Change Web Port Details
+
+# misc
+ServerSaveFailed=Server save failed
\ No newline at end of file
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/DeployAction.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/DeployAction.java 2008-06-04 18:40:13 UTC (rev 8553)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/actions/DeployAction.java 2008-06-04 20:51:29 UTC (rev 8554)
@@ -27,7 +27,6 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
@@ -49,7 +48,6 @@
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.IObjectActionDelegate;
@@ -57,12 +55,12 @@
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerWorkingCopy;
-import org.eclipse.wst.server.core.internal.PublishServerJob;
import org.eclipse.wst.server.ui.internal.ImageResource;
import org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory;
import org.jboss.ide.eclipse.as.core.modules.SingleDeployableFactory.UndeployFromServerJob;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
+import org.jboss.ide.eclipse.as.ui.Messages;
/**
*
@@ -98,8 +96,8 @@
protected String getText(boolean type) {
if( type )
- return "Unmake Deployable";
- return "Make Deployable";
+ return Messages.ActionDelegateMakeUndeployable;
+ return Messages.ActionDelegateMakeDeployable;
}
// True if we want to unpublish, false if we wantt to publish
@@ -157,7 +155,9 @@
protected void tryToPublish() {
IServer[] deployableServersAsIServers = ServerConverter.getDeployableServersAsIServers();
if(deployableServersAsIServers.length==0) {
- MessageDialog.openInformation(shell, "No deployable servers found", "There are no servers that support deploying single files.");
+ MessageDialog.openInformation(shell,
+ Messages.ActionDelegateDeployableServersNotFoundTitle,
+ Messages.ActionDelegateDeployableServersNotFoundDesc);
}
IServer server = getServer(shell,deployableServersAsIServers);
if(server==null) { // User pressed cancel.
@@ -171,13 +171,13 @@
IStructuredSelection sel2 = (IStructuredSelection)selection;
Object[] objs = sel2.toArray();
if( server == null ) {
- errorStatus = new Status(IStatus.ERROR, JBossServerUIPlugin.PLUGIN_ID, "No deployable servers located");
- errorTitle = "Cannot Publish To Server";
- errorMessage = "No deployable servers located";
+ errorStatus = new Status(IStatus.ERROR, JBossServerUIPlugin.PLUGIN_ID, Messages.ActionDelegateDeployableServersNotFoundTitle);
+ errorTitle = Messages.ActionDelegateCannotPublish;
+ errorMessage = Messages.ActionDelegateDeployableServersNotFoundDesc;
} else if( objs == null || !allFiles(objs) ) {
- errorStatus = new Status(IStatus.ERROR, JBossServerUIPlugin.PLUGIN_ID, "One or more selected objects are not Files");
- errorTitle = "Cannot Publish To Server";
- errorMessage = "Only File resources may be published.\nOne or more selected objects are not Files.";
+ errorStatus = new Status(IStatus.ERROR, JBossServerUIPlugin.PLUGIN_ID, Messages.ActionDelegateFileResourcesOnly);
+ errorTitle = Messages.ActionDelegateCannotPublish;
+ errorMessage = Messages.ActionDelegateFileResourcesOnly;
} else {
IModule[] modules = new IModule[objs.length];
for( int i = 0; i < objs.length; i++ ) {
@@ -189,9 +189,9 @@
IServer saved = copy.save(false, new NullProgressMonitor());
saved.publish(IServer.PUBLISH_INCREMENTAL, new NullProgressMonitor());
} catch( CoreException ce ) {
- errorStatus = new Status(IStatus.ERROR, JBossServerUIPlugin.PLUGIN_ID, "Publishing files to server failed", ce);
- errorTitle = "Cannot Publish to Server";
- errorMessage = "Publishing files to server failed";
+ errorStatus = new Status(IStatus.ERROR, JBossServerUIPlugin.PLUGIN_ID, Messages.ActionDelegatePublishFailed, ce);
+ errorTitle = Messages.ActionDelegateCannotPublish;
+ errorMessage = Messages.ActionDelegatePublishFailed;
}
}
}
@@ -235,7 +235,7 @@
public String getText(Object element) {
if( element instanceof IServer )
return ((IServer)element).getName();
- return "unknown object type";
+ return ""; //$NON-NLS-1$
}
}
@@ -245,7 +245,7 @@
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
- newShell.setText("Select a server to publish to");
+ newShell.setText(Messages.ActionDelegateSelectServer);
}
public IServer getSelectedServer() {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/console/ELExceptionsMatcher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/console/ELExceptionsMatcher.java 2008-06-04 18:40:13 UTC (rev 8553)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/console/ELExceptionsMatcher.java 2008-06-04 20:51:29 UTC (rev 8554)
@@ -41,15 +41,14 @@
import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.console.FileLink;
-import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.IHyperlink;
import org.eclipse.ui.console.IPatternMatchListenerDelegate;
import org.eclipse.ui.console.PatternMatchEvent;
import org.eclipse.ui.console.TextConsole;
-import org.eclipse.ui.internal.WorkbenchPlugin;
import org.jboss.ide.eclipse.as.ui.Messages;
/**
@@ -64,7 +63,7 @@
private TextConsole console;
- static final Pattern resourceLocationPattern = Pattern.compile("Exception: (.*) @(\\d+),(\\d+)");
+ static final Pattern resourceLocationPattern = Pattern.compile("Exception: (.*) @(\\d+),(\\d+)"); //$NON-NLS-1$
public void connect(TextConsole console) {
this.console = console;
@@ -165,13 +164,16 @@
}
// Nothing found, lets inform the user about that.
- MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Resource not found", "Could not locate '" + resource + "' in workspace." );
+ MessageDialog.openInformation(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ Messages.ConsoleResourceNotFound,
+ NLS.bind(Messages.ConsoleCouldNotLocateInWorkspace, resource));
}
private FileLink findFileInWorkspace() {
final String simpleName = resource.substring(resource
- .lastIndexOf("/") + 1);
+ .lastIndexOf("/") + 1); //$NON-NLS-1$
IPath path = new Path(resource);
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot()
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java 2008-06-04 18:40:13 UTC (rev 8553)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java 2008-06-04 20:51:29 UTC (rev 8554)
@@ -27,6 +27,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -196,13 +197,15 @@
String error = "";
List<Status> status = new ArrayList<Status>();
if(!new Path(deployText.getText()).toFile().exists()) {
- String msg = "The deploy directory \"" + deployText.getText() + "\" does not exist.";
+ String msg = NLS.bind(Messages.EditorDeployDNE, deployText.getText());
+// "The deploy directory \"" + deployText.getText() + "\" does not exist.";
status.add(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, msg));
error = msg + "\n";
}
if(!new Path(tempDeployText.getText()).toFile().exists()) {
- String msg = "The temporary deploy directory \"" + tempDeployText.getText() + "\" does not exist.";
+ String msg = NLS.bind(Messages.EditorTempDeployDNE, tempDeployText.getText());
+ //"The temporary deploy directory \"" + tempDeployText.getText() + "\" does not exist.";
status.add(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, msg));
error = error + msg + "\n";
}
@@ -219,7 +222,7 @@
private Text text;
private ModifyListener listener;
public SetDeployDirCommand() {
- super(DeploySection.this.server, "Set Deploy Directory");
+ super(DeploySection.this.server, Messages.EditorSetDeployLabel);
this.text = deployText;
this.newDir = deployText.getText();
this.listener = deployListener;
@@ -242,7 +245,7 @@
private Text text;
private ModifyListener listener;
public SetTempDeployDirCommand() {
- super(DeploySection.this.server, "Set Temporary Deploy Directory");
+ super(DeploySection.this.server, Messages.EditorSetTempDeployLabel);
text = tempDeployText;
newDir = tempDeployText.getText();
listener = tempDeployListener;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/PollerSection.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/PollerSection.java 2008-06-04 18:40:13 UTC (rev 8553)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/PollerSection.java 2008-06-04 20:51:29 UTC (rev 8554)
@@ -21,6 +21,7 @@
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
import org.jboss.ide.eclipse.as.core.server.internal.ServerStatePollerType;
+import org.jboss.ide.eclipse.as.ui.Messages;
/**
*
@@ -68,8 +69,8 @@
stop = new Label(pollers, SWT.NONE);
stopPollerCombo = new Combo(pollers, SWT.READ_ONLY);
- start.setText("Startup Poller");
- stop.setText("Shutdown Poller");
+ start.setText(Messages.EditorStartupPollerLabel);
+ stop.setText(Messages.EditorShutdownPollerLabel);
// set items
startPollerCombo.setItems(startupTypesStrings);
@@ -118,7 +119,7 @@
public class SetStartupPollerCommand extends SetPollerCommand {
public SetStartupPollerCommand(IServerWorkingCopy server) {
- super(server, "Change Start Poller", IJBossServerConstants.STARTUP_POLLER_KEY,
+ super(server, Messages.EditorChangeStartPollerCommandName, IJBossServerConstants.STARTUP_POLLER_KEY,
IJBossServerConstants.DEFAULT_STARTUP_POLLER,
startupTypes, startPollerCombo, startPollerListener);
}
@@ -126,7 +127,7 @@
public class SetStopPollerCommand extends SetPollerCommand {
public SetStopPollerCommand(IServerWorkingCopy server) {
- super(server, "Change Stop Poller", IJBossServerConstants.SHUTDOWN_POLLER_KEY,
+ super(server, Messages.EditorChangeStartPollerCommandName, IJBossServerConstants.SHUTDOWN_POLLER_KEY,
IJBossServerConstants.DEFAULT_SHUTDOWN_POLLER,
shutdownTypes, stopPollerCombo, stopPollerListener);
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/PortSection.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/PortSection.java 2008-06-04 18:40:13 UTC (rev 8553)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/PortSection.java 2008-06-04 20:51:29 UTC (rev 8554)
@@ -29,6 +29,7 @@
import org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathQuery;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
+import org.jboss.ide.eclipse.as.ui.Messages;
/**
*
@@ -158,8 +159,8 @@
data.top = new FormAttachment(0,5);
jndiDetectCombo.setLayoutData(data);
- jndiLabel.setText("JNDI Port: ");
- jndiDetect.setText("Automatically detect");
+ jndiLabel.setText(Messages.EditorJNDIPort);
+ jndiDetect.setText(Messages.EditorAutomaticallyDetectPort);
jndiDetectCombo.setItems(getXPathStrings());
return child;
}
@@ -193,8 +194,8 @@
data.top = new FormAttachment(0,5);
webDetectCombo.setLayoutData(data);
- webLabel.setText("web Port: ");
- webDetect.setText("Automatically detect");
+ webLabel.setText(Messages.EditorWebPort);
+ webDetect.setText(Messages.EditorAutomaticallyDetectPort);
webDetectCombo.setItems(getXPathStrings());
return child;
}
@@ -236,7 +237,7 @@
public class ChangeJNDICommand extends SetPortCommand {
public ChangeJNDICommand(IServerWorkingCopy server) {
- super(server, "Change JNDI Details",
+ super(server, Messages.EditorChangeJNDICommandName,
IJBossServerConstants.JNDI_PORT, IJBossServerConstants.JNDI_PORT_DETECT,
IJBossServerConstants.JNDI_PORT_DETECT_XPATH, IJBossServerConstants.JNDI_PORT_DEFAULT_XPATH,
jndiText, jndiDetect, jndiDetectCombo, jndiListener);
@@ -245,7 +246,7 @@
public class ChangeWebCommand extends SetPortCommand {
public ChangeWebCommand(IServerWorkingCopy server) {
- super(server, "Change Web Port Details",
+ super(server, Messages.EditorChangeWebCommandName,
IJBossServerConstants.WEB_PORT, IJBossServerConstants.WEB_PORT_DETECT,
IJBossServerConstants.WEB_PORT_DETECT_XPATH, IJBossServerConstants.WEB_PORT_DEFAULT_XPATH,
webText, webDetect, webDetectCombo, webListener);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerPasswordSection.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerPasswordSection.java 2008-06-04 18:40:13 UTC (rev 8553)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ServerPasswordSection.java 2008-06-04 20:51:29 UTC (rev 8554)
@@ -103,14 +103,14 @@
public class SetUserCommand extends SetVarCommand {
public SetUserCommand(IServerWorkingCopy server) {
- super(server, "Change Username", nameText, nameText.getText(),
+ super(server, Messages.EditorChangeUsernameCommandName, nameText, nameText.getText(),
JBossServer.SERVER_USERNAME, nameModifyListener);
}
}
public class SetPassCommand extends SetVarCommand {
public SetPassCommand(IServerWorkingCopy server) {
- super(server, "Change Password", passText, passText.getText(),
+ super(server, Messages.EditorChangePasswordCommandName, passText, passText.getText(),
JBossServer.SERVER_PASSWORD, passModifyListener);
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/SecurityFailureHandler.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/SecurityFailureHandler.java 2008-06-04 18:40:13 UTC (rev 8553)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/SecurityFailureHandler.java 2008-06-04 20:51:29 UTC (rev 8554)
@@ -14,6 +14,8 @@
import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
+import org.jboss.ide.eclipse.as.ui.Messages;
import org.jboss.ide.eclipse.as.ui.dialogs.RequiredCredentialsDialog;
/**
@@ -25,7 +27,7 @@
public boolean accepts(IServerStatePoller poller, String action,
List requiredProperties) {
- if( poller.getPollerType().getId().equals("org.jboss.ide.eclipse.as.core.runtime.server.JMXPoller"))
+ if( poller.getPollerType().getId().equals(JMXPoller.POLLER_ID))
return true;
return false;
}
@@ -44,7 +46,7 @@
try {
copy.save(false, null);
} catch( CoreException ce ) {
- // TODO log
+ JBossServerUIPlugin.log(Messages.ServerSaveFailed, ce);
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/perspective/ASPerspective.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/perspective/ASPerspective.java 2008-06-04 18:40:13 UTC (rev 8553)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/perspective/ASPerspective.java 2008-06-04 20:51:29 UTC (rev 8554)
@@ -42,7 +42,7 @@
IFolderLayout folder= layout.createFolder("left", IPageLayout.LEFT, (float)0.25, editorArea); //$NON-NLS-1$
folder.addView(JavaUI.ID_PACKAGES);
- folder.addView("org.eclipse.ui.navigator.ProjectExplorer");
+ folder.addView("org.eclipse.ui.navigator.ProjectExplorer"); //$NON-NLS-1$
folder.addPlaceholder(IPageLayout.ID_RES_NAV);
@@ -51,16 +51,16 @@
outputfolder.addView(JavaUI.ID_JAVADOC_VIEW);
outputfolder.addView(JavaUI.ID_SOURCE_VIEW);
outputfolder.addView(IConsoleConstants.ID_CONSOLE_VIEW);
- outputfolder.addView("org.eclipse.ui.views.PropertySheet");
- outputfolder.addView("org.jboss.ide.eclipse.archives.ui.ProjectArchivesView");
+ outputfolder.addView("org.eclipse.ui.views.PropertySheet"); //$NON-NLS-1$
+ outputfolder.addView("org.jboss.ide.eclipse.archives.ui.ProjectArchivesView"); //$NON-NLS-1$
outputfolder.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
outputfolder.addPlaceholder(IPageLayout.ID_BOOKMARKS);
outputfolder.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.RIGHT, (float)0.75, editorArea);
- IFolderLayout serverFolder = layout.createFolder("leftBottom", IPageLayout.BOTTOM, (float)0.60, "left"); //$NON-NLS-1$
- serverFolder.addView("org.jboss.ide.eclipse.as.ui.views.JBossServerView");
+ IFolderLayout serverFolder = layout.createFolder("leftBottom", IPageLayout.BOTTOM, (float)0.60, "left"); //$NON-NLS-1$ //$NON-NLS-2$
+ serverFolder.addView("org.jboss.ide.eclipse.as.ui.views.JBossServerView"); //$NON-NLS-1$
layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
@@ -94,20 +94,20 @@
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard"); //$NON-NLS-1$
layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewAnnotationCreationWizard"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.jst.servlet.ui.project.facet.WebProjectWizard");
- layout.addNewWizardShortcut("org.jboss.tools.seam.ui.wizards.SeamProjectWizard");
- layout.addNewWizardShortcut("org.eclipse.jst.servlet.ui.internal.wizard.AddServletWizard");
- layout.addNewWizardShortcut("org.jboss.ide.eclipse.ejb3.wizards.ui.NewSessionBeanWizard");
- layout.addNewWizardShortcut("org.jboss.ide.eclipse.ejb3.wizards.ui.NewMessageDrivenBeanWizard");
- layout.addNewWizardShortcut("org.jboss.ide.eclipse.as.ui.MBeanComponents");
+ layout.addNewWizardShortcut("org.eclipse.jst.servlet.ui.project.facet.WebProjectWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.jboss.tools.seam.ui.wizards.SeamProjectWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jst.servlet.ui.internal.wizard.AddServletWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.jboss.ide.eclipse.ejb3.wizards.ui.NewSessionBeanWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.jboss.ide.eclipse.ejb3.wizards.ui.NewMessageDrivenBeanWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.jboss.ide.eclipse.as.ui.MBeanComponents"); //$NON-NLS-1$
// perspectives
- layout.addPerspectiveShortcut("org.eclipse.debug.ui.DebugPerspective");
- layout.addPerspectiveShortcut("org.jboss.ide.eclipse.jbosscache.perspective2");
- layout.addPerspectiveShortcut("org.drools.ide.DroolsPerspective");
- layout.addPerspectiveShortcut("org.hibernate.eclipse.console.HibernateConsolePerspective");
+ layout.addPerspectiveShortcut("org.eclipse.debug.ui.DebugPerspective"); //$NON-NLS-1$
+ layout.addPerspectiveShortcut("org.jboss.ide.eclipse.jbosscache.perspective2"); //$NON-NLS-1$
+ layout.addPerspectiveShortcut("org.drools.ide.DroolsPerspective"); //$NON-NLS-1$
+ layout.addPerspectiveShortcut("org.hibernate.eclipse.console.HibernateConsolePerspective"); //$NON-NLS-1$
// Other JBoss perspectives
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/PropertySheetFactory.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/PropertySheetFactory.java 2008-06-04 18:40:13 UTC (rev 8553)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/extensions/PropertySheetFactory.java 2008-06-04 20:51:29 UTC (rev 8554)
@@ -99,8 +99,6 @@
}
public void dispose() {
- // TODO Auto-generated method stub
-
}
public Control getControl() {
15 years, 10 months