1. idea.properties enchanced. Allows to use ${idea.home} and any other defined properties. Path to idea.properties is configurable via $IDEA_PROPERTIES environment and -Didea.properties.file property. 2. Configurable editor gutter color.

This commit is contained in:
Maxim Shafirov
2005-02-19 00:37:07 +03:00
parent e11211e00d
commit 69ee62bf7f
10 changed files with 78 additions and 83 deletions
+3 -1
View File
@@ -28,10 +28,12 @@ SET MAIN_CLASS_NAME=com.intellij.idea.Main
:: ---------------------------------------------------------------------
SET IDEA_POPUP_WEIGHT=heavy
IF NOT "%IDEA_PROPERTIES%" == "" set IDEA_PROPERTIES_PROPERTY=-Didea.properties.file=%IDEA_PROPERTIES%
:: ---------------------------------------------------------------------
:: You may specify your own JVM arguments in IDEA_JVM_ARGS variable.
:: ---------------------------------------------------------------------
IF "%IDEA_JVM_ARGS%" == "" set IDEA_JVM_ARGS=-Xms32m -Xmx192m -Xbootclasspath/p:%IDEA_HOME%/lib/boot.jar -Dsun.java2d.noddraw=true -Didea.popup.weight=%IDEA_POPUP_WEIGHT% -Djavasvn.delta.disabled=true
IF "%IDEA_JVM_ARGS%" == "" set IDEA_JVM_ARGS=-Xms32m -Xmx192m -Xbootclasspath/p:%IDEA_HOME%/lib/boot.jar %IDEA_PROPERTIES_PROPERTY% -Dsun.java2d.noddraw=true -Didea.popup.weight=%IDEA_POPUP_WEIGHT% -Djavasvn.delta.disabled=true
SET JVM_ARGS= %IDEA_JVM_ARGS% -ea -Xrunyjpagent:port=10100
+5 -1
View File
@@ -15,6 +15,10 @@ IDEA_BIN_HOME=`dirname "$0"`
export JAVA_HOME
export IDEA_HOME
if [ -n $IDEA_PROPERTIES ]; then
IDEA_PROPERTIES_PROPERTY=-Didea.properties.file=$IDEA_PROPERTIES
fi
# ---------------------------------------------------------------------
# There are two possible values of IDEA_POPUP_WEIGHT property: "heavy" and "medium".
# If you have WM configured as "Focus follows mouse with Auto Raise" then you have to
@@ -25,7 +29,7 @@ IDEA_POPUP_WEIGHT=heavy
export IDEA_POPUP_WEIGHT
MAIN_CLASS_NAME="com.intellij.idea.Main"
JVM_ARGS="-ea -Xms32m -Xmx200m -Xbootclasspath/p:../lib/boot.jar -Dsun.java2d.noddraw=true -Didea.popup.weight=$IDEA_POPUP_WEIGHT -Djavasvn.delta.disabled=true"
JVM_ARGS="-ea -Xms32m -Xmx200m -Xbootclasspath/p:../lib/boot.jar $IDEA_PROPERTIES_PROPERTY -Dsun.java2d.noddraw=true -Didea.popup.weight=$IDEA_POPUP_WEIGHT -Djavasvn.delta.disabled=true"
while [ $# -gt 0 ]; do
args="$args $1"
+3 -1
View File
@@ -27,10 +27,12 @@ SET MAIN_CLASS_NAME=com.intellij.codeInspection.InspectionMain
:: ---------------------------------------------------------------------
SET IDEA_POPUP_WEIGHT=heavy
IF NOT "%IDEA_PROPERTIES%" == "" set IDEA_PROPERTIES_PROPERTY=-Didea.properties.file=%IDEA_PROPERTIES%
:: ---------------------------------------------------------------------
:: You may specify your own JVM arguments in IDEA_JVM_ARGS variable.
:: ---------------------------------------------------------------------
IF "%IDEA_JVM_ARGS%" == "" set IDEA_JVM_ARGS=-Xms16m -Xmx152m -Xbootclasspath/p:%IDEA_HOME%/lib/boot.jar -Dsun.java2d.noddraw=true -Didea.popup.weight=%IDEA_POPUP_WEIGHT%
IF "%IDEA_JVM_ARGS%" == "" set IDEA_JVM_ARGS=-Xms16m -Xmx152m -Xbootclasspath/p:%IDEA_HOME%/lib/boot.jar %IDEA_PROPERTIES_PROPERTY% -Dsun.java2d.noddraw=true -Didea.popup.weight=%IDEA_POPUP_WEIGHT%
SET JVM_ARGS= %IDEA_JVM_ARGS%
+5 -1
View File
@@ -15,6 +15,10 @@ IDEA_BIN_HOME=`dirname "$0"`
export JAVA_HOME
export IDEA_HOME
if [ -n $IDEA_PROPERTIES ]; then
IDEA_PROPERTIES_PROPERTY=-Didea.properties.file=$IDEA_PROPERTIES
fi
# ---------------------------------------------------------------------
# There are two possible values of IDEA_POPUP_WEIGHT property: "heavy" and "medium".
# If you have WM configured as "Focus follows mouse with Auto Raise" then you have to
@@ -25,7 +29,7 @@ IDEA_POPUP_WEIGHT=heavy
export IDEA_POPUP_WEIGHT
MAIN_CLASS_NAME="com.intellij.codeInspection.InspectionMain"
JVM_ARGS="-Xms16m -Xmx152m -Xbootclasspath/p:../lib/boot.jar -Dsun.java2d.noddraw=true -Didea.popup.weight=$IDEA_POPUP_WEIGHT"
JVM_ARGS="-Xms16m -Xmx152m -Xbootclasspath/p:../lib/boot.jar $IDEA_PROPERTIES_PROPERTY -Dsun.java2d.noddraw=true -Didea.popup.weight=$IDEA_POPUP_WEIGHT"
while [ $# -gt 0 ]; do
args="$args $1"
@@ -11,12 +11,10 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import java.util.PropertyResourceBundle;
import java.util.StringTokenizer;
import java.util.MissingResourceException;
import java.util.*;
public class PathManager {
private static final String PROPERTIES_FILE = "idea.properties.file";
private static final String PROPERTY_SYSTEM_PATH = "idea.system.path";
private static final String PROPERTY_CONFIG_PATH = "idea.config.path";
private static final String PROPERTY_PLUGINS_PATH = "idea.plugins.path";
@@ -84,10 +82,7 @@ public class PathManager {
ourSystemPath = getAbsolutePath(trimPathQuotes(System.getProperty(PROPERTY_SYSTEM_PATH)));
}
else {
if (PropertyLoader.getProperty(PROPERTY_SYSTEM_PATH) != null)
ourSystemPath = getAbsolutePath(trimPathQuotes(PropertyLoader.getProperty(PROPERTY_SYSTEM_PATH)));
else
ourSystemPath = getHomePath() + File.separator + "system";
ourSystemPath = getHomePath() + File.separator + "system";
}
try {
@@ -125,9 +120,6 @@ public class PathManager {
ourConfigPath = getAbsolutePath(trimPathQuotes(System.getProperty(PROPERTY_CONFIG_PATH)));
}
else {
if (PropertyLoader.getProperty(PROPERTY_CONFIG_PATH) != null)
ourConfigPath = getAbsolutePath(trimPathQuotes(PropertyLoader.getProperty(PROPERTY_CONFIG_PATH)));
else
ourConfigPath = getHomePath() + File.separator + "config";
}
return ourConfigPath;
@@ -170,9 +162,6 @@ public class PathManager {
if (System.getProperty(PROPERTY_PLUGINS_PATH) != null) {
ourPluginsPath = getAbsolutePath(trimPathQuotes(System.getProperty(PROPERTY_PLUGINS_PATH)));
} else {
if (PropertyLoader.getProperty(PROPERTY_PLUGINS_PATH) != null)
ourPluginsPath = getAbsolutePath(trimPathQuotes(PropertyLoader.getProperty(PROPERTY_PLUGINS_PATH)));
else
ourPluginsPath = getConfigPath() + File.separatorChar + "plugins";
}
}
@@ -253,70 +242,48 @@ public class PathManager {
return new File(getOptionsPath(),DEFAULT_OPTIONS_FILE_NAME+".xml");
}
private static class PropertyLoader {
private static final String IDEA_PROPERTIES = "idea.properties";
private static ResourceBundle ourBundle;
private static final String LOAD_THIS_PROPERTIES = "load.this.properties";
private PropertyLoader() {
public static void loadProperties() {
String propFilePath = System.getProperty(PROPERTIES_FILE);
if (propFilePath == null || !new File(propFilePath).exists()) {
propFilePath = getBinPath() + File.separator + "idea.properties";
}
static {
String loadThis = getProperty(LOAD_THIS_PROPERTIES);
if (loadThis != null) {
for (StringTokenizer stringTokenizer = new StringTokenizer(loadThis, ";"); stringTokenizer.hasMoreTokens();) {
String property = stringTokenizer.nextToken();
StringTokenizer tokenizer = new StringTokenizer(property, "=");
String propertyName = null;
String propertyValue = null;
if (tokenizer.hasMoreTokens()) {
propertyName = tokenizer.nextToken();
if (tokenizer.hasMoreTokens()) {
propertyValue = tokenizer.nextToken();
}
}
if (propertyName != null && propertyValue != null) {
System.setProperty(propertyName, propertyValue);
}
}
}
}
public static String getProperty (String key) {
if (ourBundle == null) {
init();
}
File propFile = new File(propFilePath);
if (propFile.exists()) {
try {
if (ourBundle == null)
return null;
else
return ourBundle.getString(key);
final FileInputStream fis = new FileInputStream(propFile);
final PropertyResourceBundle bundle = new PropertyResourceBundle(fis);
fis.close();
final Enumeration keys = bundle.getKeys();
while (keys.hasMoreElements()) {
String key = (String)keys.nextElement();
final String value = substitueVars(bundle.getString(key));
System.getProperties().setProperty(key, value);
}
}
catch (MissingResourceException e) {
// it's not a problem.
return null;
catch (IOException e) {
System.out.println("Problem reading from property file: " + propFilePath);
}
}
private static void init() {
File ideaPropertiesFile = new File(IDEA_PROPERTIES);
if (ideaPropertiesFile.exists()) {
try {
FileInputStream fis = new FileInputStream(IDEA_PROPERTIES);
ourBundle = new PropertyResourceBundle (fis);
fis.close();
}
catch (IOException e) {
e.printStackTrace();
}
}
final Properties props = System.getProperties();
final Set keys = props.keySet();
for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
String key = (String)iterator.next();
String value = props.getProperty(key);
System.out.println(key + "="+value);
}
}
private static String substitueVars(String s) {
s = StringUtil.replace(s, "${idea.home}", PathManager.getHomePath());
final Properties props = System.getProperties();
final Set keys = props.keySet();
for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
String key = (String)iterator.next();
String value = props.getProperty(key);
s = StringUtil.replace(s, "${" + key + "}", value);
}
return s;
}
}
@@ -27,4 +27,5 @@ public interface EditorColors {
ColorKey ADDED_LINES_COLOR = ColorKey.createColorKey("ADDED_LINES_COLOR");
ColorKey MODIFIED_LINES_COLOR = ColorKey.createColorKey("MODIFIED_LINES_COLOR");
ColorKey LEFT_GUTTER_BACKGROUND = ColorKey.createColorKey("LEFT_GUTTER_BACKGROUND");
}
@@ -72,6 +72,9 @@ public class PluginManager {
ourMainClass = mainClass;
ourMethodName = methodName;
PathManager.loadProperties();
final PluginManager pluginManager = new PluginManager();
pluginManager.bootstrap(classpathElements);
}
@@ -15,6 +15,7 @@ import com.intellij.ide.ui.LafManager;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.impl.ApplicationImpl;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.FoldRegion;
import com.intellij.openapi.editor.LogicalPosition;
import com.intellij.openapi.editor.TextAnnotationGutterProvider;
@@ -27,9 +28,7 @@ import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.editor.ex.EditorGutterComponentEx;
import com.intellij.openapi.editor.ex.FoldingModelEx;
import com.intellij.openapi.editor.markup.*;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.diagnostic.Logger;
import gnu.trove.TIntArrayList;
import gnu.trove.TIntObjectHashMap;
import gnu.trove.TIntProcedure;
@@ -86,12 +85,17 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse
protected void setUI(ComponentUI newUI) {
super.setUI(newUI);
myBackgroundColor = null;
reinitSettings();
}
public void updateUI() {
super.updateUI();
reinitSettings();
}
public void reinitSettings() {
myBackgroundColor = null;
repaint();
}
public void paint(Graphics g) {
@@ -200,12 +204,18 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse
public Color getBackground() {
if (myBackgroundColor == null) {
LafManager lafManager = LafManager.getInstance();
if (lafManager != null && lafManager.isUnderAquaLookAndFeel()) {
myBackgroundColor = new Color(0xF0F0F0);
final Color userDefinedColor = myEditor.getColorsScheme().getColor(EditorColors.LEFT_GUTTER_BACKGROUND);
if (userDefinedColor != null) {
myBackgroundColor = userDefinedColor;
}
else {
myBackgroundColor = super.getBackground();
LafManager lafManager = LafManager.getInstance();
if (lafManager != null && lafManager.isUnderAquaLookAndFeel()) {
myBackgroundColor = new Color(0xF0F0F0);
}
else {
myBackgroundColor = super.getBackground();
}
}
}
return myBackgroundColor;
@@ -326,7 +326,9 @@ public class EditorImpl implements EditorEx {
myHighlighter.setColorScheme(myScheme);
myGutterComponent.reinitSettings();
myGutterComponent.revalidate();
myEditorComponent.repaint();
updateCaretCursor();
@@ -35,9 +35,9 @@ import com.intellij.codeInsight.template.impl.TemplateColors;
import com.intellij.openapi.editor.HighlighterColors;
import com.intellij.openapi.editor.colors.EditorColors;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.fileTypes.SyntaxHighlighter;
import com.intellij.openapi.fileTypes.PlainSyntaxHighlighter;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.fileTypes.SyntaxHighlighter;
import com.intellij.openapi.options.colors.AttributesDescriptor;
import com.intellij.openapi.options.colors.ColorDescriptor;
import com.intellij.openapi.options.colors.ColorSettingsPage;
@@ -61,7 +61,7 @@ public class GeneralColorsPage implements ColorSettingsPage {
new ColorDescriptor("Background", EditorColors.BACKGROUND_COLOR, ColorDescriptor.Kind.BACKGROUND),
new ColorDescriptor("Background in readonly files", EditorColors.READONLY_BACKGROUND_COLOR, ColorDescriptor.Kind.BACKGROUND),
new ColorDescriptor("Readonly fragment background", EditorColors.READONLY_FRAGMENT_BACKGROUND_COLOR, ColorDescriptor.Kind.BACKGROUND),
new ColorDescriptor("Annotation editor gutter background", EditorColors.LEFT_GUTTER_BACKGROUND, ColorDescriptor.Kind.BACKGROUND),
new ColorDescriptor("Selection Background", EditorColors.SELECTION_BACKGROUND_COLOR, ColorDescriptor.Kind.BACKGROUND),
new ColorDescriptor("Selection Foreground", EditorColors.SELECTION_FOREGROUND_COLOR, ColorDescriptor.Kind.FOREGROUND),