15778 - svcs: "Launch" button is confusing
authorDan Labrecque <Dan.Labrecque@oracle.com>
Mon, 23 Aug 2010 15:44:34 -0400
changeset 558 547fc7c7e466
parent 557 9cf7e34379f3
child 559 6326b05f6858
15778 - svcs: "Launch" button is confusing
usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/swing/action/PropertiesManagedObjectAction.java
usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/swing/action/images/action-properties-16.png
usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/swing/action/images/action-properties-22.png
usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/swing/action/images/action-properties-24.png
usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/swing/action/images/action-properties-32.png
usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/swing/action/resources/Resources.properties
usr/src/java/vpanels/panels/svcs/org/opensolaris/os/vp/panels/svcs/client/swing/InstancesControl.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/swing/action/PropertiesManagedObjectAction.java	Mon Aug 23 15:44:34 2010 -0400
@@ -0,0 +1,76 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+package org.opensolaris.os.vp.panel.swing.action;
+
+import java.util.*;
+import javax.swing.*;
+import org.opensolaris.os.vp.panel.common.ClientContext;
+import org.opensolaris.os.vp.panel.common.action.*;
+import org.opensolaris.os.vp.panel.common.control.*;
+import org.opensolaris.os.vp.panel.common.model.ManagedObject;
+import org.opensolaris.os.vp.panel.swing.control.SwingControl;
+import org.opensolaris.os.vp.util.misc.*;
+
+@SuppressWarnings({"serial"})
+public abstract class PropertiesManagedObjectAction<C extends ManagedObject>
+    extends SwingManagedObjectAction<C, Navigable[], Object> {
+
+    //
+    // Static data
+    //
+
+    protected static final List<ImageIcon> ICONS = IconFinder.getIcons(
+	new String[] {
+	    "images/action-properties-16.png",
+	    "images/action-properties-22.png",
+	    "images/action-properties-24.png",
+	    "images/action-properties-32.png",
+	});
+
+    protected static final String TEXT =
+	Finder.getString("objects.action.properties");
+
+    //
+    // Constructors
+    //
+
+    public PropertiesManagedObjectAction(SwingControl control) {
+	super(TEXT, ICONS, control);
+    }
+
+    //
+    // StructuredAction methods
+    //
+
+    /**
+     * Enables this {@code Action} if the selection consists of a single
+     * element.
+     */
+    @Override
+    public void refresh() {
+	setEnabled(getPresetInput().size() == 1);
+    }
+}
Binary file usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/swing/action/images/action-properties-16.png has changed
Binary file usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/swing/action/images/action-properties-22.png has changed
Binary file usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/swing/action/images/action-properties-24.png has changed
Binary file usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/swing/action/images/action-properties-32.png has changed
--- a/usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/swing/action/resources/Resources.properties	Fri Aug 20 15:01:26 2010 -0700
+++ b/usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/swing/action/resources/Resources.properties	Mon Aug 23 15:44:34 2010 -0400
@@ -20,8 +20,7 @@
 #
 
 #
-# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
 #
 
 objects.action.add = Add
@@ -33,3 +32,4 @@
 objects.action.enable = Enable
 objects.action.move = Move
 objects.action.update = Reload
+objects.action.properties = Properties
--- a/usr/src/java/vpanels/panels/svcs/org/opensolaris/os/vp/panels/svcs/client/swing/InstancesControl.java	Fri Aug 20 15:01:26 2010 -0700
+++ b/usr/src/java/vpanels/panels/svcs/org/opensolaris/os/vp/panels/svcs/client/swing/InstancesControl.java	Mon Aug 23 15:44:34 2010 -0400
@@ -27,10 +27,10 @@
 
 import java.net.URL;
 import java.util.*;
-import org.opensolaris.os.vp.panel.common.action.StructuredAction;
+import org.opensolaris.os.vp.panel.common.action.*;
 import org.opensolaris.os.vp.panel.common.control.*;
 import org.opensolaris.os.vp.panel.common.smf.InstanceManagedObject;
-import org.opensolaris.os.vp.panel.swing.action.LaunchManagedObjectAction;
+import org.opensolaris.os.vp.panel.swing.action.PropertiesManagedObjectAction;
 import org.opensolaris.os.vp.panel.swing.control.*;
 import org.opensolaris.os.vp.panel.swing.smf.EnableServiceAction;
 import org.opensolaris.os.vp.util.misc.Finder;
@@ -49,7 +49,7 @@
      * Instance data
      */
     private StructuredAction<List<InstanceManagedObject>, ?, ?> editAction_ =
-	new LaunchManagedObjectAction<InstanceManagedObject>(this) {
+	new PropertiesManagedObjectAction<InstanceManagedObject>(this) {
 
 	@Override
 	public Navigable[] getRuntimeInput(
@@ -67,6 +67,30 @@
 		    obj.getSMFFmri().getInstance())
 	    };
 	}
+
+	@Override
+	public Object workBusy(List selection, Navigable[] path)
+	    throws ActionAbortedException, ActionFailedException,
+	    ActionUnauthorizedException {
+
+	    if (path == null) {
+		throw new ActionAbortedException();
+	    }
+
+	    try {
+		// Create a new ClientContext and navigate to path
+		getClientContext().login(null, true).getNavigator().
+		    goToAsyncAndWait(true, null, path);
+
+	    } catch (NavigationAbortedException e) {
+		throw new ActionAbortedException(e);
+
+	    } catch (NavigationException e) {
+		throw new ActionFailedException(e);
+	    }
+
+	    return null;
+	}
     };
 
     private EnableServiceAction enableAction_ =