Author: serkankaba
Date: Fri Apr 3 21:37:09 2009
New Revision: 142
Added:
branches/GTK/src/com/googlecode/jkota/Util.java
branches/GTK/src/com/googlecode/jkota/gtk/GtkUtil.java
Removed:
branches/GTK/lib/gtk.jar
branches/GTK/lib/
libgtkjni-4.0.10.so
Modified:
branches/GTK/.classpath
branches/GTK/src/com/googlecode/jkota/gtk/GtkKota.java
branches/GTK/src/com/googlecode/jkota/swing/SwingKota.java
branches/GTK/src/com/googlecode/jkota/swing/SwingUtil.java
Log:
* GTK için ayrı Util sınıfı oluşturuldu.
* Proje şimdilik harici java-gnome kütüphanesini kullanacak şekilde
düzenlendi.
Modified: branches/GTK/.classpath
==============================================================================
--- branches/GTK/.classpath (original)
+++ branches/GTK/.classpath Fri Apr 3 21:37:09 2009
@@ -7,10 +7,6 @@
<classpathentry kind="lib" path="lib/Tidy.jar"/>
<classpathentry kind="lib" path="lib/jcommon.jar"/>
<classpathentry kind="lib" path="lib/jfreechart.jar"/>
- <classpathentry kind="lib" path="lib/gtk.jar">
- <attributes>
- <attribute
name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY"
value="jkota/lib"/>
- </attributes>
- </classpathentry>
+ <classpathentry kind="lib" path="/java-gnome/tmp/gtk-4.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Added: branches/GTK/src/com/googlecode/jkota/Util.java
==============================================================================
--- (empty file)
+++ branches/GTK/src/com/googlecode/jkota/Util.java Fri Apr 3 21:37:09 2009
@@ -0,0 +1,13 @@
+package com.googlecode.jkota;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+public abstract class Util {
+ public static String errorMessage(Exception e) {
+ StringWriter out=new StringWriter();
+ e.printStackTrace(new PrintWriter(out));
+ out.flush();
+ return out.getBuffer().toString();
+ }
+}
Modified: branches/GTK/src/com/googlecode/jkota/gtk/GtkKota.java
==============================================================================
--- branches/GTK/src/com/googlecode/jkota/gtk/GtkKota.java (original)
+++ branches/GTK/src/com/googlecode/jkota/gtk/GtkKota.java Fri Apr 3
21:37:09 2009
@@ -1,5 +1,7 @@
package com.googlecode.jkota.gtk;
+import static com.googlecode.jkota.gtk.GtkUtil.error;
+
import java.net.URI;
import java.net.URISyntaxException;
@@ -66,7 +68,7 @@
@Override
public void showError(Exception e) {
- GtkUtil.error(null, e, "HATA");
+ error(null, e, "HATA");
}
@Override
@@ -88,24 +90,25 @@
preQuit();
Gtk.mainQuit();
}
- if(source==logfile)
+ if(source==logfile) {
try {
Gtk.showURI(new URI("file://"+LogManager.LOG_FILE));
} catch (URISyntaxException e) { }
- if(source==about) {
- AboutDialog about=new AboutDialog();
- about.setComments("İnternet kota kontrol Programı");
- about.setCopyright("© 2007 Serkan Kaba");
- about.setProgramName("JKota");
- about.setAuthors(new String[] {"Serkan Kaba
<
serka...@yahoo.com>"});
- about.showAll();
- about.run();
- }
- if(source==clipboard) {
- Clipboard clipboard=Clipboard.getDefault();
- clipboard.setText(quotaText);
- }
+ }
+ if(source==about) {
+ AboutDialog about=new AboutDialog();
+ about.setComments("İnternet kota kontrol Programı");
+ about.setCopyright("© 2007 Serkan Kaba");
+ about.setProgramName("JKota");
+ about.setAuthors(new String[] {"Serkan Kaba <
serka...@yahoo.com>"});
+ about.showAll();
+ about.run();
+ }
+ if(source==clipboard) {
+ Clipboard clipboard=Clipboard.getDefault();
+ clipboard.setText(quotaText);
+ }
+
}
}
-
}
Added: branches/GTK/src/com/googlecode/jkota/gtk/GtkUtil.java
==============================================================================
--- (empty file)
+++ branches/GTK/src/com/googlecode/jkota/gtk/GtkUtil.java Fri Apr 3
21:37:09 2009
@@ -0,0 +1,17 @@
+package com.googlecode.jkota.gtk;
+
+import static com.googlecode.jkota.Util.errorMessage;
+
+import org.gnome.gtk.ErrorMessageDialog;
+import org.gnome.gtk.Window;
+
+public abstract class GtkUtil {
+ public static void error(Window parent,String message,String title) {
+ ErrorMessageDialog dialog= new ErrorMessageDialog(parent,title,message);
+ dialog.run();
+ }
+
+ public static void error(Window parent,Exception e,String title) {
+ error(parent,errorMessage(e),title);
+ }
+}
Modified: branches/GTK/src/com/googlecode/jkota/swing/SwingKota.java
==============================================================================
--- branches/GTK/src/com/googlecode/jkota/swing/SwingKota.java (original)
+++ branches/GTK/src/com/googlecode/jkota/swing/SwingKota.java Fri Apr 3
21:37:09 2009
@@ -1,5 +1,7 @@
package com.googlecode.jkota.swing;
+import static com.googlecode.jkota.swing.SwingUtil.error;
+
import java.awt.AWTException;
import java.awt.Desktop;
import java.awt.MenuItem;
@@ -28,6 +30,7 @@
import com.googlecode.jkota.LogManager;
import com.googlecode.jkota.SettingsManager;
+
public class SwingKota extends BaseKota implements ActionListener,
ClipboardOwner,DownloadNotificationListener {
private MenuItem quit,settings,about,logfile,clipboard,statistics;
@@ -136,7 +139,7 @@
@Override
public void showError(Exception e) {
- SwingUtil.error(null, e,"HATA");
+ error(null, e,"HATA");
}
@Override
Modified: branches/GTK/src/com/googlecode/jkota/swing/SwingUtil.java
==============================================================================
--- branches/GTK/src/com/googlecode/jkota/swing/SwingUtil.java (original)
+++ branches/GTK/src/com/googlecode/jkota/swing/SwingUtil.java Fri Apr 3
21:37:09 2009
@@ -1,19 +1,16 @@
package com.googlecode.jkota.swing;
+import static com.googlecode.jkota.Util.errorMessage;
+
import java.awt.Component;
-import java.io.PrintWriter;
-import java.io.StringWriter;
import javax.swing.JOptionPane;
-public class SwingUtil {
+public abstract class SwingUtil {
public static void error(Component parent,String message,String title) {
JOptionPane.showMessageDialog(parent, message, title,
JOptionPane.ERROR_MESSAGE);
}
public static void error(Component parent,Exception e,String title) {
- StringWriter out=new StringWriter();
- e.printStackTrace(new PrintWriter(out));
- out.flush();
- error(parent,out.getBuffer().toString(),title);
+ error(parent,errorMessage(e),title);
}
}