Author: scabanovich
Date: 2007-11-01 11:57:16 -0400 (Thu, 01 Nov 2007)
New Revision: 4633
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencePage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java
Log:
JBIDE-1186
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java 2007-11-01
15:39:31 UTC (rev 4632)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java 2007-11-01
15:57:16 UTC (rev 4633)
@@ -216,6 +216,8 @@
public static String SEAM_RUNTIME_LIST_FIELD_EDITOR_CANNOT_READ_JAR_FILE;
public static String SEAM_RUNTIME_LIST_FIELD_EDITOR_CREATE_A_SEAM_RUNTIME;
+
+ public static String SEAM_RUNTIME_LIST_FIELD_EDITOR_MODIFY_SEAM_RUNTIME;
public static String SEAM_RUNTIME_LIST_FIELD_EDITOR_EDITOR_SUPPORTS_ONLY_GRID_LAYOUT;
@@ -231,6 +233,8 @@
public static String SEAM_RUNTIME_LIST_FIELD_EDITOR_NEW_SEAM_RUNTIME;
+ public static String SEAM_RUNTIME_LIST_FIELD_EDITOR_EDIT_SEAM_RUNTIME;
+
public static String SEAM_RUNTIME_LIST_FIELD_EDITOR_PARENT_CONTROL_SHOULD_BE_COMPOSITE;
public static String SEAM_RUNTIME_LIST_FIELD_EDITOR_PATH;
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties 2007-11-01
15:39:31 UTC (rev 4632)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties 2007-11-01
15:57:16 UTC (rev 4633)
@@ -38,6 +38,7 @@
SEAM_ENTITY_WIZARD_PAGE1_ENTITY_MASTER_PAGE=Entity master page
SEAM_ENTITY_WIZARD_ENTITY_CREATING_OPERATION=Entity creating operation
SEAM_RUNTIME_LIST_FIELD_EDITOR_NEW_SEAM_RUNTIME=New Seam Runtime
+SEAM_RUNTIME_LIST_FIELD_EDITOR_EDIT_SEAM_RUNTIME=Edit Seam Runtime
SEAM_INSTALL_WIZARD_PAGE_DB_TABLES_ALREADY_EXISTS=DB Tables already exists in database:
SEAM_INSTALL_WIZARD_PAGE_RECREATE_DATABASE_TABLES_AND_DATA_ON_DEPLOY=Recreate database
tables and data on deploy:
SEAM_ACTION_WIZARD_PAGE1_SELECT_THE_NAME_OF_THE_SEAM_CONVERSATION=Select the name of the
new Seam Conversation. A new Java interface and SLSB
@@ -58,6 +59,7 @@
SEAM_PROJECT_WIZARD_PAGE1_FILE_EXTENSION_MUST_BE_MPE=File extension must be
"mpe"
SEAM_RUNTIME_LIST_FIELD_EDITOR_AN_INSTANCEOF_OF_LIST=an instance of
List<SeamRuntime>.
SEAM_RUNTIME_LIST_FIELD_EDITOR_CREATE_A_SEAM_RUNTIME=Create a Seam Runtime
+SEAM_RUNTIME_LIST_FIELD_EDITOR_MODIFY_SEAM_RUNTIME=Input new values
SEAM_BASE_WIZARD_OPERATION_IS_NOT_DEFINED_FOR_WIZARD=Operation is not defined for wizard
SEAM_INSTALL_WIZARD_PAGE_ENTITY_BEAN_PACKAGE_NAME=Entity Bean Package Name:
SEAM_PROJECT_WIZARD_PAGE1_FILE_NAME_MUST_BE_VALID=File name must be valid
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencePage.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencePage.java 2007-11-01
15:39:31 UTC (rev 4632)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencePage.java 2007-11-01
15:57:16 UTC (rev 4633)
@@ -40,6 +40,8 @@
public class SeamPreferencePage extends PreferencePage implements
IWorkbenchPreferencePage, PropertyChangeListener {
+ public static String SEAM_PREFERENCES_ID =
"org.jboss.tools.common.model.ui.seam";
+
/**
*
*/
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java 2007-11-01
15:39:31 UTC (rev 4632)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java 2007-11-01
15:57:16 UTC (rev 4633)
@@ -23,6 +23,8 @@
public static String SEAM_SETTINGS_PREFERENCE_PAGE_ADD;
+ public static String SEAM_SETTINGS_PREFERENCE_PAGE_INSTALLED_RUNTIMES;
+
public static String SEAM_SETTINGS_PREFERENCE_PAGE_RUNTIME;
public static String SEAM_SETTINGS_PREFERENCE_PAGE_SEAM_RUNTIME_IS_NOT_SELECTED;
@@ -38,7 +40,7 @@
public static String SEAM_VALIDATOR_CONFIGURATION_BLOCK_WARNING;
public static String SEAM_VALIDATOR_PREFERENCE_PAGE_SEAM_VALIDATOR;
-
+
//Validator Preference page
public static String SeamValidatorConfigurationBlock_common_description;
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties 2007-11-01
15:39:31 UTC (rev 4632)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties 2007-11-01
15:57:16 UTC (rev 4633)
@@ -68,3 +68,4 @@
SEAM_SETTINGS_PREFERENCE_PAGE_SEAM_RUNTIME_IS_NOT_SELECTED=Seam runtime is not selected
SEAM_SETTINGS_PREFERENCE_PAGE_ADD=Add
SEAM_PREFERENCE_PAGE_SEAM_RUNTIMES=Seam Runtimes
+SEAM_SETTINGS_PREFERENCE_PAGE_INSTALLED_RUNTIMES=Installed Runtimes
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2007-11-01
15:39:31 UTC (rev 4632)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2007-11-01
15:57:16 UTC (rev 4633)
@@ -25,13 +25,19 @@
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
+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.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.dialogs.PropertyPage;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.seam.core.ISeamProject;
@@ -46,6 +52,8 @@
import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditorFactory;
import org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor;
+import org.jboss.tools.seam.ui.widget.editor.LabelFieldEditor;
+import org.jboss.tools.seam.ui.widget.editor.ButtonFieldEditor.ButtonPressedAction;
import
org.jboss.tools.seam.ui.widget.editor.SeamRuntimeListFieldEditor.SeamRuntimeNewWizard;
/**
@@ -56,6 +64,9 @@
IFieldEditor seamEnablement;
IFieldEditor runtime;
+ IFieldEditor installedRuntimes;
+
+ ISeamProject seamProject;
public SeamSettingsPreferencePage() {
}
@@ -65,12 +76,14 @@
super.setElement(element);
project = (IProject) getElement().getAdapter(IProject.class);
}
+
+ boolean hasSeamSupport() {
+ return seamProject != null;
+ }
@Override
protected Control createContents(Composite parent) {
- ISeamProject seamProject = SeamCorePlugin
- .getSeamProject(project, false);
- boolean hasSeamSupport = seamProject != null;
+ seamProject = SeamCorePlugin.getSeamProject(project, false);
boolean cannotBeModified = false;
@@ -83,37 +96,46 @@
seamEnablement = IFieldEditorFactory.INSTANCE.createCheckboxEditor(
SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_SEAM_SUPPORT,
SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_SEAM_SUPPORT, false);
- seamEnablement.setValue(hasSeamSupport);
+ seamEnablement.setValue(hasSeamSupport());
SeamRuntime rs = SeamRuntimeManager.getInstance().getDefaultRuntime();
- Set<String> names = new TreeSet<String>();
- names.addAll(SeamRuntimeManager.getInstance().getRuntimeNames());
- if(hasSeamSupport) {
- String currentName = seamProject.getRuntimeName();
- if(currentName != null) names.add(currentName);
- }
- List<String> namesAsList = new ArrayList<String>();
- namesAsList.addAll(names);
+ List<String> namesAsList = getNameList();
runtime =
IFieldEditorFactory.INSTANCE.createComboWithButton(SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_RUNTIME,
SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_RUNTIME, namesAsList,
rs==null?"":rs.getName(),true,new NewSeamRuntimeAction(),(IValidator)null);
//$NON-NLS-1$
+ ButtonPressedAction action = new
ButtonPressedAction(SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_INSTALLED_RUNTIMES)
{
+ public void run() {
+ PreferenceDialog prefsdlg = PreferencesUtil.createPreferenceDialogOn(
+ PlatformUI.getWorkbench().getDisplay().getActiveShell(),
+ SeamPreferencePage.SEAM_PREFERENCES_ID,
+ new String[] {SeamPreferencePage.SEAM_PREFERENCES_ID}, null
+ );
+
+ prefsdlg.open();
+
+ String v = runtime.getValueAsString();
+ List<String> list = getNameList();
+ ((ITaggedFieldEditor) ((CompositeEditor) runtime)
+ .getEditors().get(1)).setTags(list.toArray(new String[0]));
+ if(v != null && list.contains(v)) {
+ runtime.setValue(v);
+ } else {
+ setCurrentValue();
+ }
+ }
+ };
+
+ installedRuntimes = new
ButtonFieldEditor(SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_INSTALLED_RUNTIMES,
action, null);
+
List<IFieldEditor> editorOrder = new ArrayList<IFieldEditor>();
editorOrder.add(seamEnablement);
editorOrder.add(runtime);
+// editorOrder.add(installedRuntimes);
- if (hasSeamSupport) {
- String currentName = seamProject.getRuntimeName();
- if (currentName != null) {
- runtime.setValue(currentName);
- } else {
- runtime.setValue("");
- }
- } else if(isEarPartInEarSeamProject(project)) {
- runtime.setValue("");
- }
+ setCurrentValue();
seamEnablement.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
@@ -125,7 +147,7 @@
}
}
});
-
+
runtime.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
validate();
@@ -147,9 +169,26 @@
for (IFieldEditor fieldEditor2 : editorOrder) {
fieldEditor2.doFillIntoGrid(composite);
}
+
+ LabelFieldEditor filler = new LabelFieldEditor("filler", "");
+ Object[] fs = filler.getEditorControls(composite);
+ if(fs != null && fs.length > 0 && fs[0] instanceof Label) {
+ Label l = (Label)fs[0];
+ GridData d = new GridData();
+ d.horizontalSpan = columnNumber - 1;
+ l.setLayoutData(d);
+ }
+
+ Object[] cs = installedRuntimes.getEditorControls(composite);
+ if(cs != null && cs.length > 0 && cs[0] instanceof Button) {
+ Button b = (Button)cs[0];
+ GridData d = new GridData();
+ d.horizontalAlignment = SWT.END;
+ b.setLayoutData(d);
+ }
runtime.setEditable(false);
- if (!hasSeamSupport) {
+ if (!hasSeamSupport()) {
updateRuntimeEnablement(false);
}
@@ -164,6 +203,31 @@
return composite;
}
+ private List<String> getNameList() {
+ Set<String> names = new TreeSet<String>();
+ names.addAll(SeamRuntimeManager.getInstance().getRuntimeNames());
+ if(hasSeamSupport()) {
+ String currentName = seamProject.getRuntimeName();
+ if(currentName != null) names.add(currentName);
+ }
+ List<String> namesAsList = new ArrayList<String>();
+ namesAsList.addAll(names);
+ return namesAsList;
+ }
+
+ private void setCurrentValue() {
+ if (hasSeamSupport()) {
+ String currentName = seamProject.getRuntimeName();
+ if (currentName != null) {
+ runtime.setValue(currentName);
+ } else {
+ runtime.setValue("");
+ }
+ } else if(isEarPartInEarSeamProject(project)) {
+ runtime.setValue("");
+ }
+ }
+
private boolean isEarPartInEarSeamProject(IProject p) {
IProject[] ps = ResourcesPlugin.getWorkspace().getRoot().getProjects();
for (int i = 0; i < ps.length; i++) {
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java 2007-11-01
15:39:31 UTC (rev 4632)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java 2007-11-01
15:57:16 UTC (rev 4633)
@@ -41,6 +41,7 @@
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;
@@ -153,6 +154,7 @@
createCommandBar(root);
bar.setEnabled(REMOVE, false);
+ bar.setEnabled(XChildrenEditor.EDIT, false);
TableColumn tc1 = new TableColumn(tableView.getTable(),SWT.CENTER);
tc1.setWidth(21);
@@ -498,8 +500,10 @@
SeamRuntime source = null;
public SeamRuntimeEditWizard(List<SeamRuntime> value, SeamRuntime source,
List<SeamRuntime> added, Map<SeamRuntime, SeamRuntime> changed) {
super();
- setWindowTitle(SeamUIMessages.SEAM_RUNTIME_LIST_FIELD_EDITOR_NEW_SEAM_RUNTIME);
+ setWindowTitle(SeamUIMessages.SEAM_RUNTIME_LIST_FIELD_EDITOR_EDIT_SEAM_RUNTIME);
page1 = new SeamRuntimeWizardPage(value);
+ page1.setMessage(SeamUIMessages.SEAM_RUNTIME_LIST_FIELD_EDITOR_MODIFY_SEAM_RUNTIME);
+ page1.setTitle(SeamUIMessages.SEAM_RUNTIME_LIST_FIELD_EDITOR_EDIT_SEAM_RUNTIME);
addPage(page1);
this.value = value;
this.added = added;
@@ -526,8 +530,13 @@
source.setVersion(rt.getVersion());
} else {
changed.put(rt, source);
- value.remove(source);
- value.add(rt);
+ int i = value.indexOf(source);
+ if(i >= 0) {
+ value.set(i, rt);
+ } else {
+ value.remove(source);
+ value.add(rt);
+ }
}
return true;
}
@@ -547,8 +556,10 @@
public void selectionChanged(SeamRuntime selection) {
if(selection == null) {
bar.setEnabled(REMOVE, false);
+ bar.setEnabled(XChildrenEditor.EDIT, false);
} else {
bar.setEnabled(REMOVE, true);
+ bar.setEnabled(XChildrenEditor.EDIT, true);
}
if(selection==null
|| selection == SeamRuntimeManager.getInstance().getDefaultRuntime()) {
@@ -623,12 +634,25 @@
Wizard wiz = new SeamRuntimeEditWizard((List<SeamRuntime>)getValue(),
(SeamRuntime)o, added, changed);
WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(),
wiz);
dialog.open();
+ tableView.refresh();
+ if(changed.containsValue(o)) {
+ SeamRuntime c = findChangedRuntime((SeamRuntime)o);
+ if(c != null) {
+ tableView.setSelection(new StructuredSelection(c));
+ }
+ }
}
}
- tableView.refresh();
}
}
+ private SeamRuntime findChangedRuntime(SeamRuntime source) {
+ for(SeamRuntime r: changed.keySet()) {
+ if(source == changed.get(r)) return r;
+ }
+ return null;
+ }
+
public void dispose() {
bar.dispose();
super.dispose();