Author: ghuck
Date: 2011-05-25 16:36:34 -0700 (Wed, 25 May 2011)
New Revision: 25541
Added:
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/IgraphPlugin.java
Removed:
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/IgraphPlugin.java
Modified:
csplugins/trunk/soc/ghuck/IgraphPlugin/build.xml
Log:
Modified: csplugins/trunk/soc/ghuck/IgraphPlugin/build.xml
===================================================================
--- csplugins/trunk/soc/ghuck/IgraphPlugin/build.xml 2011-05-25 23:21:34 UTC
(rev 25540)
+++ csplugins/trunk/soc/ghuck/IgraphPlugin/build.xml 2011-05-25 23:36:34 UTC
(rev 25541)
@@ -9,8 +9,8 @@
<!-- =================================================================== -->
<target name="init">
<property name="plugin_name" value="IgraphPlugin"/>
- <property name="plugin_class" value="cytoscape.plugins.IgraphPlugin"/>
- <property name="package_path" value="cytoscape/plugins"/>
+ <property name="plugin_class"
value="cytoscape.plugins.igraph.IgraphPlugin"/>
+ <property name="package_path" value="cytoscape/plugins/igraph"/>
<property name="project.jar" value="${plugin_name}.jar"/>
<property name="version" value="0.01"/>
<property name="year" value="2010"/>
Deleted:
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/IgraphPlugin.java
===================================================================
---
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/IgraphPlugin.java
2011-05-25 23:21:34 UTC (rev 25540)
+++
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/IgraphPlugin.java
2011-05-25 23:36:34 UTC (rev 25541)
@@ -1,116 +0,0 @@
-/**
-* Copyright (C) Gerardo Huck, 2010
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU Lesser General Public License as published
-* by the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
-
-package cytoscape.plugins;
-
-import cytoscape.plugin.CytoscapePlugin;
-import cytoscape.Cytoscape;
-import cytoscape.util.CytoscapeAction;
-
-import giny.view.NodeView;
-import giny.view.Label;
-
-import java.awt.event.ActionEvent;
-import java.io.*;
-import java.util.jar.*;
-import java.util.zip.*;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-
-
-/** ---------------------------LabelLayoutPlugin-----------------------------
- * Takes the current network and reorganizes it so that the new network is more
- * readable. This will be done through the repositioning of network labels,
- * and subtle repositioning of nodes.
- * @author Gerardo Huck
- *
- */
-public class IgraphPlugin extends CytoscapePlugin {
-
- /**
- * Constructor which adds this layout to Cytoscape Layouts. This in turn
- * adds it to the Cytoscape menus as well.
- */
- public IgraphPlugin() {
- MyPluginMenuAction menuAction = new MyPluginMenuAction(this);
-
Cytoscape.getDesktop().getCyMenus().addCytoscapeAction((CytoscapeAction)
menuAction);
-
- // Check whether the static library is already extracted in the plugins
folder, if not, extract it
- File dynamicLib = new File ("./plugins/libigraph.dylib");
- if (!dynamicLib.exists() || isOldVersion()){
- // Extract it
- extractLib();
- }
-
- }
-
- private boolean isOldVersion(){
- return true;
- }
-
- private void extractLib() {
- String message;
-
- try {
- String home = getClass().getProtectionDomain().
- getCodeSource().getLocation().toString().
- substring(6);
- JarFile jar = new JarFile("./plugins/igraphPlugin.jar");
- ZipEntry entry = jar.getEntry("libigraph.dylib");
- File efile = new File("./plugins/", entry.getName());
-
- InputStream in =
- new BufferedInputStream(jar.getInputStream(entry));
- OutputStream out =
- new BufferedOutputStream(new FileOutputStream(efile));
- byte[] buffer = new byte[2048];
- for (;;) {
- int nBytes = in.read(buffer);
- if (nBytes <= 0) break;
- out.write(buffer, 0, nBytes);
- }
- out.flush();
- out.close();
- in.close();
-
- message = "Igraph library extracted!";
-
- }
- catch (Exception e) {
- e.printStackTrace();
- message = "Igraph Plugin: Error While extracting libraty from jar
file:\n" + e.getMessage();
- }
-
- //Show message
- JOptionPane.showMessageDialog( Cytoscape.getDesktop(), message);
-
- return;
- }
-
- public class MyPluginMenuAction extends CytoscapeAction {
-
- public MyPluginMenuAction(IgraphPlugin myPlugin) {
- super("Hello World");
- setPreferredMenu("Plugins");
- }
-
- public void actionPerformed(ActionEvent e) {
- JOptionPane.showMessageDialog(Cytoscape.getDesktop(),"Hello World
is selected!");
- }
- }
-}
\ No newline at end of file
Added:
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/IgraphPlugin.java
===================================================================
---
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/IgraphPlugin.java
(rev 0)
+++
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/IgraphPlugin.java
2011-05-25 23:36:34 UTC (rev 25541)
@@ -0,0 +1,101 @@
+/**
+* Copyright (C) Gerardo Huck, 2011
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published
+* by the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+package cytoscape.plugins.igraph;
+
+import cytoscape.plugin.CytoscapePlugin;
+import cytoscape.Cytoscape;
+import cytoscape.util.CytoscapeAction;
+
+import giny.view.NodeView;
+import giny.view.Label;
+
+import java.awt.event.ActionEvent;
+import java.io.*;
+import java.util.jar.*;
+import java.util.zip.*;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+
+
+/** ---------------------------LabelLayoutPlugin-----------------------------
+ * Takes the current network and reorganizes it so that the new network is more
+ * readable. This will be done through the repositioning of network labels,
+ * and subtle repositioning of nodes.
+ * @author Gerardo Huck
+ *
+ */
+public class IgraphPlugin extends CytoscapePlugin {
+
+ /**
+ * Constructor which adds this layout to Cytoscape Layouts. This in turn
+ * adds it to the Cytoscape menus as well.
+ */
+ public IgraphPlugin() {
+
+ // Make sure Igraph library is extracted in the plugins folder
+ checkLib();
+
+ // Add layouts
+
+ }
+
+ private boolean isOldVersion(){
+ return false;
+ }
+
+ private void checkLib() {
+ File dynamicLib = new File ("./plugins/libigraph.dylib");
+ if (!dynamicLib.exists() || isOldVersion()){
+ String message;
+ try {
+ String home = getClass().getProtectionDomain().
+ getCodeSource().getLocation().toString().
+ substring(6);
+ JarFile jar = new JarFile("./plugins/igraphPlugin.jar");
+ ZipEntry entry = jar.getEntry("libigraph.dylib");
+ File efile = new File("./plugins/", entry.getName());
+
+ InputStream in =
+ new BufferedInputStream(jar.getInputStream(entry));
+ OutputStream out =
+ new BufferedOutputStream(new FileOutputStream(efile));
+ byte[] buffer = new byte[2048];
+ for (;;) {
+ int nBytes = in.read(buffer);
+ if (nBytes <= 0) break;
+ out.write(buffer, 0, nBytes);
+ }
+ out.flush();
+ out.close();
+ in.close();
+
+ message = "Igraph library extracted!";
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ message = "Igraph Plugin: Error While extracting library from
jar file:\n" + e.getMessage();
+ }
+
+ //Show message
+ JOptionPane.showMessageDialog( Cytoscape.getDesktop(), message);
+ }
+ return;
+ }
+
+}
\ No newline at end of file
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.