Revision: 20330
http://jedit.svn.sourceforge.net/jedit/?rev=20330&view=rev
Author: ezust
Date: 2011-11-13 07:18:06 +0000 (Sun, 13 Nov 2011)
Log Message:
-----------
Got rid of the "use jEdit BG color" button.
Use jEdit BG color always if the "use textarea colors" appearance option is checked.
Modified Paths:
--------------
plugins/Console/trunk/console/Console.java
plugins/Console/trunk/console/options/GeneralOptionPane.java
Modified: plugins/Console/trunk/console/Console.java
===================================================================
--- plugins/Console/trunk/console/Console.java 2011-11-13 06:58:19 UTC (rev 20329)
+++ plugins/Console/trunk/console/Console.java 2011-11-13 07:18:06 UTC (rev 20330)
@@ -124,15 +124,15 @@
propertiesChanged();
String defShell = jEdit.getProperty("console.shell.default", "System");
if (defShell.equals(jEdit.getProperty("options.last-selected"))) {
- defShell = jEdit.getProperty("console.shell", "System");
+ defShell = jEdit.getProperty("console.shell", "System");
}
-
+
Shell s = Shell.getShell(defShell);
if (s == null) s = Shell.getShell("System");
setShell(s);
load();
-
-
+
+
} //}}}
// {{{ methods
@@ -150,13 +150,13 @@
addProjectListener();
errorSource = new DefaultErrorSource("error parsing");
} //}}}
-
+
void addProjectListener()
{
if (listener != null) return;
listener = new ProjectTreeListener(this);
}
-
+
//{{{ unload() method
public void unload()
{
@@ -251,7 +251,7 @@
}
});
}
-
+
//{{{ getConsolePane() method
public ConsolePane getConsolePane()
{
@@ -276,7 +276,7 @@
//{{{ getOutput() methods
/**
- * Returns the Output corresponding to a particular Shell, without changing
+ * Returns the Output corresponding to a particular Shell, without changing
* the selected Shell.
*/
public Output getOutput(String shellName) {
@@ -320,7 +320,7 @@
else if (msg instanceof DockableWindowUpdate) {
DockableWindowUpdate dwu = (DockableWindowUpdate) msg;
if (dwu.getWhat() != null && dwu.getWhat().equals(DockableWindowUpdate.ACTIVATED))
- if (dwu.getDockable().equals("console"))
+ if (dwu.getDockable().equals("console"))
scrollToBottom();
}
else if(msg instanceof PluginUpdate)
@@ -340,7 +340,7 @@
unload();
}
//}}}
-
+
//{{{ getErrorSource() method
/**
* Returns this console's error source instance. Plugin shells can
@@ -386,7 +386,7 @@
// {{{ getId() method
/** @return a unique identifier starting at 0, representing which instance of Console this is,
- or -1 if that value can not be determined.
+ or -1 if that value can not be determined.
*/
public int getId() {
int retval = 0;
@@ -401,7 +401,7 @@
}
return -1;
} // }}}
-
+
//{{{ print() method
/**
* @deprecated Do not use the console as an <code>Output</code>
@@ -441,7 +441,7 @@
//{{{ getShellState() method
/**
* @returns the Output of a Shell, assuming the Shell was already created....
- *
+ *
* @since Console 4.0.2.
*/
public ShellState getShellState(Shell shell)
@@ -595,7 +595,7 @@
animationLabel.setBorder(new EmptyBorder(2,3,2,3));
initAnimation();
-
+
animationLabel.setIcon(animation);
animationLabel.setVisible(false);
animation.stop();
@@ -663,25 +663,25 @@
scroller.setPreferredSize(new Dimension(400,100));
add(BorderLayout.CENTER,scroller);
} //}}}
-
+
//{{{ initAnimation() method
private void initAnimation()
{
// TODO: First frame of animation icon should be visible at gui init
-
+
Toolkit toolkit = getToolkit();
Image processImg = toolkit.getImage(Console.class.getResource("/console/process-working.png"));
Image standbyImg = null;
-
+
int iconSize = 22;
-
+
ArrayList<Image> frames = new ArrayList<Image>();
-
+
// Wait for the image to load by setting up an icon and discarding it again
new ImageIcon(processImg).getImage();
int procImgWidth = processImg.getWidth(null);
int procImgHeight = processImg.getHeight(null);
-
+
int currentX = 0, currentY = 0;
int frameNo = 0;
while(currentY < procImgHeight)
@@ -698,13 +698,13 @@
currentX + iconSize - 1,
currentY + iconSize - 1,
null);
-
+
// First frame is the standby icon
if(frameNo == 0)
standbyImg = bufImg;
else
frames.add(bufImg);
-
+
frameNo++;
currentX += iconSize;
if(currentX + iconSize > procImgWidth)
@@ -713,7 +713,7 @@
currentY += iconSize;
}
}
-
+
animation = new AnimatedIcon(
standbyImg,
frames.toArray(new Image[0]),
@@ -735,11 +735,16 @@
//{{{ propertiesChanged() method
private void propertiesChanged()
{
- text.setBackground(jEdit.getColorProperty("console.bgColor"));
- text.setForeground(jEdit.getColorProperty("console.plainColor"));
+ if (!jEdit.getBooleanProperty("textColors")) {
+ text.setBackground(jEdit.getColorProperty("console.bgColor"));
+ text.setForeground(jEdit.getColorProperty("console.plainColor"));
+ }
+ else {
+ text.setBackground(jEdit.getColorProperty("view.bgColor", Color.WHITE));
+ text.setForeground(jEdit.getColorProperty("view.fgColor", Color.BLACK));
+ }
text.setCaretColor(jEdit.getColorProperty("console.caretColor"));
text.setFont(jEdit.getFontProperty("console.font"));
-
infoColor = jEdit.getColorProperty("console.infoColor");
warningColor = jEdit.getColorProperty("console.warningColor");
errorColor = jEdit.getColorProperty("console.errorColor");
@@ -754,7 +759,7 @@
if (!jEdit.getBooleanProperty("console.changedir.nodeselect")) return;
String path = msg.getPath();
File f = new File(path);
- if (!f.isDirectory())
+ if (!f.isDirectory())
{
path = f.getParent();
f = new File(path);
@@ -768,9 +773,9 @@
String cmd = "cd \"" + path + "\"";
sysShell.execute(this, cmd, output);
output.print(getPlainColor(), "\n");
- sysShell.printPrompt(this, output);
+ sysShell.printPrompt(this, output);
} //}}}
-
+
//{{{ handlePluginUpdate() method
public void handlePluginUpdate(PluginUpdate pmsg)
{
@@ -888,7 +893,7 @@
/**
* Each Shell of a Console has its own ShellState
- * A ShellState is a writable Output.
+ * A ShellState is a writable Output.
* It holds the document which is the "scrollback buffer".
*/
public class ShellState implements Output
@@ -909,7 +914,7 @@
commandRunning = false;
scrollback = new DefaultStyledDocument();
((DefaultStyledDocument)scrollback).setDocumentFilter(new LengthFilter());
-
+
// ick! talk about tightly coupling two classes.
shell.openConsole(Console.this);
}
@@ -1024,14 +1029,14 @@
{
super();
}
-
+
//{{{ insertString() method
public void insertString(DocumentFilter.FilterBypass fb, int offset,
String str, AttributeSet attr) throws BadLocationException
{
replace(fb, offset, 0, str, attr);
} //}}}
-
+
//{{{ replace() method
public void replace(DocumentFilter.FilterBypass fb, int offset,
int length, String str, AttributeSet attrs)
@@ -1044,7 +1049,7 @@
if(newLength > limit)
fb.remove(0, newLength - limit - 1);
} //}}}
-
+
// Not so large default limit to avoid performance down
// with large output.
// This will be sufficient to first use.
Modified: plugins/Console/trunk/console/options/GeneralOptionPane.java
===================================================================
--- plugins/Console/trunk/console/options/GeneralOptionPane.java 2011-11-13 06:58:19 UTC (rev 20329)
+++ plugins/Console/trunk/console/options/GeneralOptionPane.java 2011-11-13 07:18:06 UTC (rev 20330)
@@ -26,6 +26,7 @@
//{{{ Imports
import java.awt.Color;
import java.awt.event.ActionEvent;
+
import java.awt.event.ActionListener;
import java.util.Arrays;
@@ -47,7 +48,7 @@
import console.gui.Label;
//}}}
-public class GeneralOptionPane extends AbstractOptionPane implements ActionListener
+public class GeneralOptionPane extends AbstractOptionPane
{
// {{{ data members
@@ -56,7 +57,6 @@
private JComboBox encoding;
private JComboBox defaultShell;
private JButton bgColor;
- private JButton usejEditBgColor;
private JButton plainColor;
private JButton caretColor;
private JButton infoColor;
@@ -65,8 +65,8 @@
private JCheckBox showWelcomeMessage;
private JTextField limit ;
private JTextField limitHistory ;
-
-
+
+
// }}}
//{{{ GeneralOptionPane constructor
@@ -78,13 +78,13 @@
//{{{ _init() method
protected void _init()
{
-
+
StringList sl = new StringList(Shell.getShellNames());
int idx = sl.indexOf("System");
if (idx != 0) {
String other = sl.get(0);
sl.set(idx, other);
- sl.set(0, "System");
+ sl.set(0, "System");
}
sl.add(jEdit.getProperty("options.last-selected"));
defaultShell = new JComboBox(sl.toArray());
@@ -96,8 +96,8 @@
showWelcomeMessage = new JCheckBox();
showWelcomeMessage.setText(jEdit.getProperty("options.console.general.welcome"));
showWelcomeMessage.setSelected(jEdit.getBooleanProperty("console.shell.info.toggle"));
- addComponent(showWelcomeMessage);
-
+ addComponent(showWelcomeMessage);
+
font = new FontSelector(jEdit.getFontProperty("console.font"));
addComponent(jEdit.getProperty("options.console.general.font"), font);
@@ -110,20 +110,18 @@
addComponent(jEdit.getProperty("options.console.general.encoding"),
encoding);
-
+
Label limitLabel = new Label("options.console.general.charlimit");
limit = new JTextField(jEdit.getProperty("console.outputLimit"));
addComponent(limitLabel, limit);
-
+
Label limitHistoryLabel = new Label("options.console.general.historylimit");
limitHistory = new JTextField(jEdit.getProperty("console.historyLimit",
String.valueOf(HistoryModel.getDefaultMax())));
addComponent(limitHistoryLabel, limitHistory);
-
- usejEditBgColor = new JButton("reset");
- usejEditBgColor.addActionListener(this);
- addComponent(jEdit.getProperty("options.console.general.usejEditBgColor"), usejEditBgColor);
+
+
addComponent(jEdit.getProperty("options.console.general.bgColor"),
bgColor = createColorButton("console.bgColor"));
addComponent(jEdit.getProperty("options.console.general.plainColor"),
@@ -142,7 +140,7 @@
protected void _save()
{
jEdit.setBooleanProperty("console.shell.info.toggle", showWelcomeMessage.isSelected());
-
+
jEdit.setFontProperty("console.font",font.getFont());
String limitstr = limit.getText();
@@ -150,7 +148,7 @@
jEdit.setProperty("console.outputLimit", limitstr);
else
jEdit.unsetProperty("console.outputLimit");
-
+
String limithist = limitHistory.getText();
if(limithist != null && limithist.length() > 0
&& !String.valueOf(HistoryModel.getDefaultMax()).equals(limithist))
@@ -158,12 +156,12 @@
else
jEdit.unsetProperty("console.historyLimit");
- jEdit.setProperty("console.encoding",
+ jEdit.setProperty("console.encoding",
(String)encoding.getSelectedItem());
- jEdit.setProperty("console.shell.default",
+ jEdit.setProperty("console.shell.default",
(String)defaultShell.getSelectedItem());
-
+
jEdit.setColorProperty("console.bgColor",
bgColor.getBackground());
jEdit.setColorProperty("console.plainColor",
@@ -176,8 +174,8 @@
warningColor.getBackground());
jEdit.setColorProperty("console.errorColor",
errorColor.getBackground());
-
-
+
+
}
//}}}
@@ -203,12 +201,4 @@
return b;
} //}}}
- public void actionPerformed(ActionEvent e)
- {
- if (e.getSource() != usejEditBgColor) return;
- Color c = jEdit.getColorProperty("view.bgColor");
- jEdit.setColorProperty("console.bgColor", c);
- bgColor.setBackground(c);
- }
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|