Author: scabanovich
Date: 2007-10-16 11:17:41 -0400 (Tue, 16 Oct 2007)
New Revision: 4243
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/widget/editor/SeamRuntimeListFieldEditor.java
Log:
JBIDE-982
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-10-16
15:12:12 UTC (rev 4242)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java 2007-10-16
15:17:41 UTC (rev 4243)
@@ -203,6 +203,8 @@
public static String SEAM_RUNTIME_LIST_FIELD_EDITOR_ADD;
+ public static String SEAM_RUNTIME_LIST_FIELD_EDITOR_REMOVE;
+
public static String SEAM_RUNTIME_LIST_FIELD_EDITOR_ALREADY_EXISTS;
public static String SEAM_RUNTIME_LIST_FIELD_EDITOR_AN_INSTANCEOF_OF_LIST;
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-10-16
15:12:12 UTC (rev 4242)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties 2007-10-16
15:17:41 UTC (rev 4243)
@@ -16,6 +16,7 @@
SEAM_VIEW_LAYOUT_ACTION_GROUP_FLAT=Flat
SEAM_VIEW_LAYOUT_ACTION_GROUP_NODE=Node
SEAM_RUNTIME_LIST_FIELD_EDITOR_ADD=Add
+SEAM_RUNTIME_LIST_FIELD_EDITOR_REMOVE=Remove
SEAM_INSTALL_WIZARD_PAGE_WAR=war
SEAM_INSTALL_WIZARD_PAGE_EAR=ear
SEAM_INSTALL_WIZARD_PAGE_CONNECTION_PROFILE=Connection profile:
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-10-16
15:12:12 UTC (rev 4242)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencePage.java 2007-10-16
15:17:41 UTC (rev 4243)
@@ -98,6 +98,9 @@
for (SeamRuntime rt : seamRuntimes.getAddedSeamRuntimes()) {
SeamRuntimeManager.getInstance().addRuntime(rt);
}
+ for (SeamRuntime rt : seamRuntimes.getRemoved()) {
+ SeamRuntimeManager.getInstance().removeRuntime(rt);
+ }
if(initialDefault != null && seamRuntimes.getDefaultSeamRuntime() !=
initialDefault) {
initialDefault.setDefault(false);
}
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-10-16
15:12:12 UTC (rev 4242)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java 2007-10-16
15:17:41 UTC (rev 4243)
@@ -18,6 +18,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -30,11 +31,13 @@
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;
@@ -70,6 +73,7 @@
Composite root = null;
Button rmBtn = null;
Button addBtn = null;
+ Button removeBtn = null;
/**
* @param name
* @param label
@@ -158,7 +162,18 @@
addBtn.setLayoutData(gd);
addBtn.addSelectionListener(this);
-
+
+ removeBtn = new Button(buttons,SWT.PUSH);
+ removeBtn.setEnabled(false);
+ removeBtn.setText(SeamUIMessages.SEAM_RUNTIME_LIST_FIELD_EDITOR_REMOVE);
+ gd = new GridData(GridData.FILL_HORIZONTAL,GridData.CENTER,false,false);
+ gd.horizontalAlignment = GridData.FILL;
+ gd.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
+ gd.widthHint = 50;
+
+ removeBtn.setLayoutData(gd);
+ removeBtn.addSelectionListener(this);
+
/*rmBtn = new Button(buttons,SWT.PUSH);
rmBtn.setText("Remove");
gd = new GridData(GridData.FILL_HORIZONTAL,GridData.CENTER,false,false);
@@ -478,6 +493,11 @@
* @param firstElement
*/
public void selectionChanged(SeamRuntime selection) {
+ if(selection == null) {
+ removeBtn.setEnabled(false);
+ } else {
+ removeBtn.setEnabled(true);
+ }
if(selection==null
|| selection == SeamRuntimeManager.getInstance().getDefaultRuntime()) {
} else {
@@ -498,6 +518,22 @@
WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wiz);
dialog.open();
tableView.refresh();
+ } else if(e.widget == removeBtn) {
+ ISelection s = tableView.getSelection();
+ if(s == null || s.isEmpty() || !(s instanceof IStructuredSelection)) return;
+ IStructuredSelection ss = (IStructuredSelection)s;
+ Iterator<?> i = ss.iterator();
+ while(i.hasNext()) {
+ Object o = i.next();
+ if(o instanceof SeamRuntime) {
+ removed.add((SeamRuntime)o);
+ if(added.contains(o)) {
+ added.remove(o);
+ }
+ ((List)getValue()).remove(o);
+ }
+ }
+ tableView.refresh();
}
}
}