[prev in list] [next in list] [prev in thread] [next in thread]
List: jedit-cvs
Subject: [ jEdit-commits ] SF.net SVN: jedit:[16131] plugins/orchestra/trunk
From: rfrancois () users ! sourceforge ! net
Date: 2009-08-31 11:57:29
Message-ID: E1Mi5Vp-0001ps-95 () bj8yhf1 ! ch3 ! sourceforge ! com
[Download RAW message or body]
Revision: 16131
http://jedit.svn.sourceforge.net/jedit/?rev=16131&view=rev
Author: rfrancois
Date: 2009-08-31 11:57:28 +0000 (Mon, 31 Aug 2009)
Log Message:
-----------
added some text to option pane
Modified Paths:
--------------
plugins/orchestra/trunk/com/addictedtor/orchestra/OrchestraOptionPane.java
plugins/orchestra/trunk/orchestra_starter.r
Modified: plugins/orchestra/trunk/com/addictedtor/orchestra/OrchestraOptionPane.java
===================================================================
--- plugins/orchestra/trunk/com/addictedtor/orchestra/OrchestraOptionPane.java 2009-08-31 \
10:58:23 UTC (rev 16130)
+++ plugins/orchestra/trunk/com/addictedtor/orchestra/OrchestraOptionPane.java 2009-08-31 \
11:57:28 UTC (rev 16131) @@ -9,6 +9,7 @@
import org.gjt.sp.jedit.jEdit;
import javax.swing.*;
+
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -23,152 +24,175 @@
@SuppressWarnings("serial")
public class OrchestraOptionPane extends AbstractOptionPane implements \
ActionListener {
- protected static final Log logger = \
LogFactory.getLog(OrchestraOptionPane.class); + protected static final Log logger = \
LogFactory.getLog(OrchestraOptionPane.class);
- public static final String OPTION_PREFIX = "options.orchestra.";
- private JTextField tfRHome = new JTextField();
- private JButton bSelectRHome = new JButton();
- private JCheckBox chbShortcutEnabler = new JCheckBox("Create shortcut?");
- private JTextField tfShortcut = new JTextField();
- private JButton bSelectShortcut = new JButton();
- // has the user clicked some checkbox at least once
- private boolean buttonToggled = false;
- // should orchestra r pack be installed regardless ?
- private JCheckBox chbForceRPackInstall = new JCheckBox("Force R package \
installation?"); + public static final String OPTION_PREFIX = "options.orchestra.";
+ private JTextField tfRHome = new JTextField();
+ private JButton bSelectRHome = new JButton();
+ private JCheckBox chbShortcutEnabler = new JCheckBox("Create shortcut?");
+ private JTextField tfShortcut = new JTextField();
+ private JButton bSelectShortcut = new JButton();
+ // has the user clicked some checkbox at least once
+ private boolean buttonToggled = false;
+ // should orchestra r pack be installed regardless ?
+ private JCheckBox chbForceRPackInstall = new JCheckBox("Force R package \
installation?");
- public OrchestraOptionPane() {
- super("orchestra-optionpane");
- }
+ public OrchestraOptionPane() {
+ super("orchestra-optionpane");
+ }
- public void _init() {
- if( !OrchestraPlugin.isConfigured() ){
- addComponent( new JLabel( "-- Please check the settings below, and click OK \
--" ) ) ;
- }
- addSeparator(OPTION_PREFIX + "rhome" + ".title");
- addPathPanel("rhome", tfRHome, bSelectRHome);
+ public void _init() {
+
+ String text = "This option pane configures R specific settings for using jedit as \
an R IDE.\n" + + "Please take time to review the options and click OK to create \
the orchestra startup script" ; + addComponent( getTextComponent( text ), \
GridBagConstraints.BOTH ); +
+ addSeparator(OPTION_PREFIX + "rhome" + ".title");
+ text = "We have made our best guess at where R is installed\n"+
+ "but if R is installed somewhere else, or you want to use another R, "+
+ "please update the information" ;
+ addComponent( getTextComponent( text ), GridBagConstraints.BOTH );
+ addPathPanel("rhome", tfRHome, bSelectRHome);
+
+ addSeparator(OPTION_PREFIX + "shortcut" + ".title");
+ text = "Click the checkbox if you want to install a desktop shortcut \
(recommended)" ; + addComponent( getTextComponent( text ), GridBagConstraints.BOTH \
); + addComponent("", chbShortcutEnabler);
+ addPathPanel("shortcut", tfShortcut, bSelectShortcut);
+
+ addSeparator(OPTION_PREFIX + "advanced.title");
+ chbForceRPackInstall.setSelected(true);
+ text = "Should we force installation of the R package 'orchestra' into " +
+ "an R library specific to jedit or try " +
+ "to use another installed version of the 'orchestra' R package" ;
+ addComponent( getTextComponent( text ), GridBagConstraints.BOTH );
+ addComponent("", chbForceRPackInstall);
+ WidgetFactory.registerEnabler(chbShortcutEnabler, tfShortcut);
+ WidgetFactory.registerEnabler(chbShortcutEnabler, bSelectShortcut);
- addSeparator(OPTION_PREFIX + "shortcut" + ".title");
- addComponent("", chbShortcutEnabler);
- addPathPanel("shortcut", tfShortcut, bSelectShortcut);
- addSeparator(OPTION_PREFIX + "advanced.title");
- chbForceRPackInstall.setSelected(true);
- addComponent("", chbForceRPackInstall);
- WidgetFactory.registerEnabler(chbShortcutEnabler, tfShortcut);
- WidgetFactory.registerEnabler(chbShortcutEnabler, bSelectShortcut);
+ guessDirs();
+ }
- guessDirs();
- }
+ private void addPathPanel(String name, JTextField tf, JButton b) {
+ tf.setText(jEdit.getProperty(OPTION_PREFIX + name + ".path"));
+ b.setText(jEdit.getProperty(OPTION_PREFIX + "choose-dir"));
+ b.setActionCommand("choose-" + name);
+ JPanel pathPanel = new JPanel(new BorderLayout(0, 0));
+ pathPanel.add(tf, BorderLayout.CENTER);
+ pathPanel.add(b, BorderLayout.EAST);
+ b.addActionListener(this);
+ addComponent("", pathPanel);
+ }
- private void addPathPanel(String name, JTextField tf, JButton b) {
- tf.setText(jEdit.getProperty(OPTION_PREFIX + name + ".path"));
- b.setText(jEdit.getProperty(OPTION_PREFIX + "choose-dir"));
- b.setActionCommand("choose-" + name);
- JPanel pathPanel = new JPanel(new BorderLayout(0, 0));
- pathPanel.add(tf, BorderLayout.CENTER);
- pathPanel.add(b, BorderLayout.EAST);
- b.addActionListener(this);
- addComponent("", pathPanel);
- }
+ private void guessDirs() {
+ if (tfRHome.getText().trim().equals("")) {
+ String rHome = DirectoryGuesser.guessRHome();
+ logger.info("Guessing R_HOME : " + rHome);
+ tfRHome.setText(rHome);
+ }
+ if (tfShortcut.getText().trim().equals("")) {
+ String desktop = DirectoryGuesser.guessDesktop();
+ logger.info("Guessing shortcut dir : " + desktop);
+ tfShortcut.setText(desktop);
+ }
+ }
- private void guessDirs() {
- if (tfRHome.getText().trim().equals("")) {
- String rHome = DirectoryGuesser.guessRHome();
- logger.info("Guessing R_HOME : " + rHome);
- tfRHome.setText(rHome);
- }
- if (tfShortcut.getText().trim().equals("")) {
- String desktop = DirectoryGuesser.guessDesktop();
- logger.info("Guessing shortcut dir : " + desktop);
- tfShortcut.setText(desktop);
- }
- }
+ private void selectDir(JTextField tf) {
+ JFileChooser fc = new JFileChooser();
+ fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ int res = fc.showOpenDialog(this);
+ if (res == JFileChooser.APPROVE_OPTION) {
+ String dir = fc.getSelectedFile().getAbsolutePath();
+ tf.setText(dir);
+ }
+ }
- private void selectDir(JTextField tf) {
- JFileChooser fc = new JFileChooser();
- fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- int res = fc.showOpenDialog(this);
- if (res == JFileChooser.APPROVE_OPTION) {
- String dir = fc.getSelectedFile().getAbsolutePath();
- tf.setText(dir);
- }
- }
+ public void actionPerformed(ActionEvent e) {
+ String ac = e.getActionCommand();
+ if (ac.startsWith("choose-shortcut")) {
+ selectDir(tfShortcut);
+ }
+ if (ac.startsWith("choose-rhome")) {
+ selectDir(tfRHome);
+ }
+ if (e.getSource() == chbShortcutEnabler || e.getSource() == chbShortcutEnabler) {
+ buttonToggled = true;
+ }
+ }
- public void actionPerformed(ActionEvent e) {
- String ac = e.getActionCommand();
- if (ac.startsWith("choose-shortcut")) {
- selectDir(tfShortcut);
- }
- if (ac.startsWith("choose-rhome")) {
- selectDir(tfRHome);
- }
- if (e.getSource() == chbShortcutEnabler || e.getSource() == \
chbShortcutEnabler) {
- buttonToggled = true;
- }
- }
+ public void _save() {
- public void _save() {
+ logger.info("Saving options.");
- logger.info("Saving options.");
-
- String rhome = tfRHome.getText();
- @SuppressWarnings("unused")
+ String rhome = tfRHome.getText();
+ @SuppressWarnings("unused")
String javahome = System.getProperty("java.home");
- String shortcut = tfShortcut.getText();
+ String shortcut = tfShortcut.getText();
- File rhomeFile = new File(rhome);
+ File rhomeFile = new File(rhome);
- String err = null;
- if (!rhomeFile.exists() || !rhomeFile.isDirectory()) {
- err = "R home directory does not exist or is not a proper directory!";
- }
+ String err = null;
+ if (!rhomeFile.exists() || !rhomeFile.isDirectory()) {
+ err = "R home directory does not exist or is not a proper directory!";
+ }
- if (!chbShortcutEnabler.isSelected())
- shortcut = null;
- else {
- File shortcutFile = new File(shortcut);
- if (!shortcutFile.exists() || !shortcutFile.isDirectory()) {
- err = "Directory for shortcut does not exist or is not a proper \
directory!";
- }
- }
+ if (!chbShortcutEnabler.isSelected())
+ shortcut = null;
+ else {
+ File shortcutFile = new File(shortcut);
+ if (!shortcutFile.exists() || !shortcutFile.isDirectory()) {
+ err = "Directory for shortcut does not exist or is not a proper directory!";
+ }
+ }
- if (err != null) {
- JOptionPane.showMessageDialog(this, err);
- } else {
- // only install when user has changed something
- if (propertiesChanged()) {
- Installer i = new Installer(
- jEdit.getJEditHome(),
- OrchestraPlugin.getPluginHomePath(),
- rhome,
- shortcut,
- chbForceRPackInstall.isSelected()
- );
- ProgressDialog<Void, String> pd = ProgressDialogInstaller.make(this, \
i);
- pd.setSize(600,500);
- pd.setVisible(true);
- }
- }
- logger.info("Saving options done.");
-
- }
+ if (err != null) {
+ JOptionPane.showMessageDialog(this, err);
+ } else {
+ // only install when user has changed something
+ if (propertiesChanged()) {
+ Installer i = new Installer(
+ jEdit.getJEditHome(),
+ OrchestraPlugin.getPluginHomePath(),
+ rhome,
+ shortcut,
+ chbForceRPackInstall.isSelected()
+ );
+ ProgressDialog<Void, String> pd = ProgressDialogInstaller.make(this, i);
+ pd.setSize(600,500);
+ pd.setVisible(true);
+ }
+ }
+ logger.info("Saving options done.");
- private boolean propertiesChanged() {
- logger.info("Current Properties:");
- logger.info("rhome:" + jEdit.getProperty(OPTION_PREFIX + "rhome.path"));
- logger.info("shortcut:" + jEdit.getProperty(OPTION_PREFIX + \
"shortcut.path"));
- logger.info("toggled:" + buttonToggled);
- return
- jEdit.getProperty(OPTION_PREFIX + "rhome.path") == null ||
- !jEdit.getProperty(OPTION_PREFIX + \
"rhome.path").equals(tfRHome.getText()) ||
- jEdit.getProperty(OPTION_PREFIX + "shortcut.path") == null ||
- !jEdit.getProperty(OPTION_PREFIX + \
"shortcut.path").equals(tfShortcut.getText()) ||
- buttonToggled
- ;
+ }
- }
+ private boolean propertiesChanged() {
+ logger.info("Current Properties:");
+ logger.info("rhome:" + jEdit.getProperty(OPTION_PREFIX + "rhome.path"));
+ logger.info("shortcut:" + jEdit.getProperty(OPTION_PREFIX + "shortcut.path"));
+ logger.info("toggled:" + buttonToggled);
+ return
+ jEdit.getProperty(OPTION_PREFIX + "rhome.path") == null ||
+ !jEdit.getProperty(OPTION_PREFIX + "rhome.path").equals(tfRHome.getText()) ||
+ jEdit.getProperty(OPTION_PREFIX + "shortcut.path") == null ||
+ !jEdit.getProperty(OPTION_PREFIX + "shortcut.path").equals(tfShortcut.getText()) \
|| + buttonToggled
+ ;
+ }
+ private JComponent getTextComponent( String text ){
+ JTextArea ta = new JTextArea( "\n" + text + "\n" ) ;
+ ta.setEditable( false) ;
+ ta.setLineWrap(true) ;
+ ta.setBackground( getBackground() ) ;
+ ta.setBorder( BorderFactory.createEmptyBorder() ) ;
+ JScrollPane scroller = new JScrollPane( ta ) ;
+ scroller.setBorder( BorderFactory.createEmptyBorder() ) ;
+ return scroller ;
+ }
+
}
Modified: plugins/orchestra/trunk/orchestra_starter.r
===================================================================
--- plugins/orchestra/trunk/orchestra_starter.r 2009-08-31 10:58:23 UTC (rev 16130)
+++ plugins/orchestra/trunk/orchestra_starter.r 2009-08-31 11:57:28 UTC (rev 16131)
@@ -30,7 +30,7 @@
thisfile <- sub( "--file=", "", grep( "^--file", args, value = TRUE )[1] )
propfile <- file.path( dirname( thisfile ), "orchestra_properties.txt" )
if( !file.exists( propfile ) ){
- stop( "the roperty file does not exist" )
+ stop( "the property file does not exist" )
}
rl <- readLines( propfile )
if( any( grepl( "@", rl ) ) ){
@@ -60,7 +60,7 @@
R_LIBS <- if( R_LIBS == "" ){
JEDIT_RLIBS
} else{
- paste( R_LIBS, JEDIT_RLIBS, sep = SEP )
+ paste( JEDIT_RLIBS, R_LIBS, sep = SEP )
}
Sys.setenv( R_LIBS = R_LIBS )
# }}}
This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
jEdit-CVS mailing list
jEdit-CVS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jedit-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic