airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject svn commit: r1513979 - in /airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya: registrybrowser/nodes/ParameterNode.java ui/actions/registry/browser/BrowserAction.java
Date Wed, 14 Aug 2013 18:01:49 GMT
Author: samindaw
Date: Wed Aug 14 18:01:48 2013
New Revision: 1513979

URL: http://svn.apache.org/r1513979
Log:
adding browser open to context menu

Added:
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/actions/registry/browser/BrowserAction.java
  (with props)
Modified:
    airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ParameterNode.java

Modified: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ParameterNode.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ParameterNode.java?rev=1513979&r1=1513978&r2=1513979&view=diff
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ParameterNode.java
(original)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registrybrowser/nodes/ParameterNode.java
Wed Aug 14 18:01:48 2013
@@ -23,6 +23,8 @@ package org.apache.airavata.xbaya.regist
 
 import java.awt.Toolkit;
 import java.awt.datatransfer.StringSelection;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.Arrays;
 import java.util.List;
 
@@ -30,8 +32,10 @@ import javax.swing.Icon;
 import javax.swing.JTree;
 import javax.swing.tree.TreeNode;
 
+import org.apache.airavata.common.utils.BrowserLauncher;
 import org.apache.airavata.xbaya.model.registrybrowser.NodeParameter;
 import org.apache.airavata.xbaya.ui.actions.AbstractBrowserActionItem;
+import org.apache.airavata.xbaya.ui.actions.registry.browser.BrowserAction;
 import org.apache.airavata.xbaya.ui.actions.registry.browser.CopyAction;
 import org.apache.airavata.xbaya.ui.actions.registry.browser.ViewAction;
 import org.apache.airavata.xbaya.ui.dialogs.TextWindow;
@@ -76,7 +80,14 @@ public class ParameterNode extends Abstr
 	
     @Override
     public List<String> getSupportedActions() {
-        return Arrays.asList(ViewAction.ID,CopyAction.ID);
+        List<String> list = Arrays.asList(ViewAction.ID,CopyAction.ID,BrowserAction.ID);
+        try {
+			new URI(getParameter().getValue().toString());
+			list.add(BrowserAction.ID);
+		} catch (URISyntaxException e) {
+			//the content is not a proper url
+		}
+		return list;
     }
 
     @Override
@@ -85,6 +96,8 @@ public class ParameterNode extends Abstr
     		return "View";
     	} else if (action.getID().equals(CopyAction.ID)) {
             return "Copy to clipboard";
+    	} else if (action.getID().equals(BrowserAction.ID)) {
+            return "Open in web browser...";
         }
     	return null;
     }
@@ -96,7 +109,9 @@ public class ParameterNode extends Abstr
 			textWindow.show();
 		} else if (action.equals(CopyAction.ID)) {
         	Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(value),
null);
-        }
+		} else if (action.equals(BrowserAction.ID)) {
+			BrowserLauncher.openURL(getParameter().getValue().toString());
+        } 
 		return super.triggerAction(tree, action);
 	}
 

Added: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/actions/registry/browser/BrowserAction.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/actions/registry/browser/BrowserAction.java?rev=1513979&view=auto
==============================================================================
--- airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/actions/registry/browser/BrowserAction.java
(added)
+++ airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/actions/registry/browser/BrowserAction.java
Wed Aug 14 18:01:48 2013
@@ -0,0 +1,39 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.xbaya.ui.actions.registry.browser;
+
+import org.apache.airavata.xbaya.ui.actions.AbstractBrowserActionItem;
+
+public class BrowserAction extends AbstractBrowserActionItem {
+    public static final String ID = "action.browser";
+
+    @Override
+    public String getID() {
+        return ID;
+    }
+
+    @Override
+    public String getDefaultCaption() {
+        return "Open in web browser...";
+    }
+
+}

Propchange: airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/actions/registry/browser/BrowserAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message