Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2004-09-10 08:57:26 -0400
committerJean Michel-Lemieux2004-09-10 08:57:26 -0400
commit9ceb3690bda8cd83c07cb4c2c6d7af9dc7118dba (patch)
tree765bce51bf9807286d8c861631516fdb7110890e
parentc2ee907190dca94384490fecdde41080c5e2e855 (diff)
downloadeclipse.platform.team-branch_20040831_fontColorDecorations.tar.gz
eclipse.platform.team-branch_20040831_fontColorDecorations.tar.xz
eclipse.platform.team-branch_20040831_fontColorDecorations.zip
Added theme listening and fixed up NLSbranch_20040831_fontColorDecorations
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java78
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java18
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties5
4 files changed, 74 insertions, 31 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java
index 86fd47e00..5d87cae3d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoration.java
@@ -137,8 +137,8 @@ public class CVSDecoration {
prefs.setValue(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION, store.getBoolean(ICVSUIConstants.PREF_SHOW_HASREMOTE_DECORATION));
prefs.setValue(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION, store.getBoolean(ICVSUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION));
prefs.setValue(ICVSUIConstants.PREF_CALCULATE_DIRTY, store.getBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY));
- prefs.setValue(ICVSUIConstants.PREF_DIRTY_FLAG, store.getBoolean(ICVSUIConstants.PREF_CALCULATE_DIRTY));
- prefs.setValue(ICVSUIConstants.PREF_ADDED_FLAG, store.getBoolean(ICVSUIConstants.PREF_ADDED_FLAG));
+ prefs.setValue(ICVSUIConstants.PREF_DIRTY_FLAG, store.getString(ICVSUIConstants.PREF_DIRTY_FLAG));
+ prefs.setValue(ICVSUIConstants.PREF_ADDED_FLAG, store.getString(ICVSUIConstants.PREF_ADDED_FLAG));
initialize(resourceName, prefs, store.getString(ICVSUIConstants.PREF_FILETEXT_DECORATION), store.getString(ICVSUIConstants.PREF_FOLDERTEXT_DECORATION), store.getString(ICVSUIConstants.PREF_PROJECTTEXT_DECORATION));
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java
index 2592b5c6f..2be569ac2 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecoratorPreferencesPage.java
@@ -22,6 +22,7 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
@@ -37,6 +38,7 @@ import org.eclipse.team.internal.ui.OverlayIcon;
import org.eclipse.ui.*;
import org.eclipse.ui.dialogs.ListSelectionDialog;
import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.ui.ide.IDE.SharedImages;
public class CVSDecoratorPreferencesPage extends PreferencePage implements IWorkbenchPreferencePage {
@@ -54,11 +56,27 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork
private Button showDirty;
- // Cache for folder images that have been overlayed with sample CVS icons
+ // Cache for folder images that have been overlayed with sample CVS icons
private Map fgImageCache;
+ // Tree that provides a preview of the decorations
private TreeViewer previewTree;
+ /**
+ * Update the preview tree when a theme changes.
+ */
+ private IPropertyChangeListener themeListener = new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ previewTree.refresh(true /* update labels */);
+ }
+ };
+
+ /**
+ * Label provider creates a dummy CVSDecoration using the preferences set
+ * in this page. The decoration properties are assigned to the different named
+ * resources in the preview tree so that most of the decoration options
+ * are shown
+ */
private class PreviewLabelProvider extends LabelProvider implements IFontProvider, IColorProvider {
public Color getBackground(Object element) {
@@ -91,29 +109,29 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork
public CVSDecoration getDecoration(Object element) {
CVSDecoration decoration = buildDecoration((String)element);
- if(element.equals("ignored.txt")) {
+ if(element.equals("ignored.txt")) { //$NON-NLS-1$
decoration.setResourceType(IResource.FILE);
decoration.setIgnored(true);
- } else if(element.equals("Project")) {
+ } else if(element.equals("Project")) { //$NON-NLS-1$
decoration.setResourceType(IResource.PROJECT);
decoration.setHasRemote(true);
- } else if(element.equals("Folder")) {
+ } else if(element.equals("Folder")) { //$NON-NLS-1$
decoration.setHasRemote(true);
decoration.setResourceType(IResource.FOLDER);
decoration.setDirty(true);
decoration.setHasRemote(true);
- } else if(element.equals("dirty.cpp")){
+ } else if(element.equals("dirty.cpp")){ //$NON-NLS-1$
decoration.setResourceType(IResource.FILE);
decoration.setDirty(true);
decoration.setHasRemote(true);
- } else if(element.equals("added.java")){
+ } else if(element.equals("added.java")){ //$NON-NLS-1$
decoration.setResourceType(IResource.FILE);
decoration.setAdded(true);
decoration.setHasRemote(false);
- } else if(element.equals("todo.txt")){
+ } else if(element.equals("todo.txt")){ //$NON-NLS-1$
decoration.setResourceType(IResource.FILE);
decoration.setNewResource(true);
- } else if(element.equals("bugs.txt")){
+ } else if(element.equals("bugs.txt")){ //$NON-NLS-1$
decoration.setResourceType(IResource.FILE);
decoration.setDirty(false);
decoration.setHasRemote(true);
@@ -124,10 +142,10 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork
public Image getImage(Object element) {
Image baseImage;
- if(element.equals("Project")) {
+ if(element.equals("Project")) { //$NON-NLS-1$
baseImage= PlatformUI.getWorkbench().
- getSharedImages().getImage(ISharedImages.IMG_OBJ_PROJECT);
- } else if(element.equals("Folder")) {
+ getSharedImages().getImage(SharedImages.IMG_OBJ_PROJECT);
+ } else if(element.equals("Folder")) { //$NON-NLS-1$
baseImage= PlatformUI.getWorkbench().
getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
} else {
@@ -152,19 +170,23 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork
return image;
}
};
+
+ /**
+ * Provides a fixed mock resource tree for showing the preview.
+ */
private IContentProvider previewContentProvider = new ITreeContentProvider() {
public Object[] getChildren(Object parentElement) {
if(parentElement == ResourcesPlugin.getWorkspace().getRoot()) {
return new String[] {
- "Project"};
- } else if(parentElement.equals("Project")) {
+ "Project"}; //$NON-NLS-1$
+ } else if(parentElement.equals("Project")) { //$NON-NLS-1$
return new String[] {
- "ignored.txt",
- "dirty.cpp",
- "added.java",
- "todo.txt",
- "bugs.txt",
- "Folder"
+ "ignored.txt", //$NON-NLS-1$
+ "dirty.cpp", //$NON-NLS-1$
+ "added.java", //$NON-NLS-1$
+ "todo.txt", //$NON-NLS-1$
+ "bugs.txt", //$NON-NLS-1$
+ "Folder" //$NON-NLS-1$
};
} else {
return new Object[0];
@@ -176,7 +198,7 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork
}
public boolean hasChildren(Object element) {
- if(element.equals("Project") || element == ResourcesPlugin.getWorkspace().getRoot())
+ if(element.equals("Project") || element == ResourcesPlugin.getWorkspace().getRoot()) //$NON-NLS-1$
return true;
else
return false;
@@ -272,9 +294,15 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork
previewTree.setInput(ResourcesPlugin.getWorkspace().getRoot());
previewTree.expandAll();
+ PlatformUI.getWorkbench().getThemeManager().addPropertyChangeListener(themeListener);
+
return tabFolder;
}
+ public void dispose() {
+ PlatformUI.getWorkbench().getThemeManager().removePropertyChangeListener(themeListener);
+ }
+
private Control createTextDecoratorPage(Composite parent) {
Composite top = new Composite(parent, SWT.NULL);
GridLayout layout = new GridLayout();
@@ -283,7 +311,7 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork
top.setLayoutData(data);
Group fileTextGroup = new Group(top, SWT.SHADOW_IN);
- fileTextGroup.setText("Text");
+ fileTextGroup.setText(Policy.bind("CVSDecoratorPreferencePage.1")); //$NON-NLS-1$
layout = new GridLayout();
layout.numColumns = 3;
fileTextGroup.setLayout(layout);
@@ -317,12 +345,12 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork
});
createLabel(fileTextGroup, "", 1); // spacer //$NON-NLS-1$
-// **********
- // PREVIEW
+ // **********
+ // ICONS
// **********
Group iconGroup = new Group(top, SWT.SHADOW_IN);
- iconGroup.setText("Icons");
+ iconGroup.setText(Policy.bind("Icon_Overlays_24")); //$NON-NLS-1$
layout = new GridLayout();
layout.numColumns = 3;
iconGroup.setLayout(layout);
@@ -336,7 +364,7 @@ public class CVSDecoratorPreferencesPage extends PreferencePage implements IWork
// **********
Group previewGroup = new Group(top, SWT.SHADOW_IN);
- previewGroup.setText("Preview");
+ previewGroup.setText(Policy.bind("Example__1")); //$NON-NLS-1$
layout = new GridLayout();
previewGroup.setLayout(layout);
data = new GridData(GridData.FILL, GridData.FILL, true, true);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java
index 782b734f5..aaa1f49f0 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLightweightDecorator.java
@@ -42,12 +42,26 @@ public class CVSLightweightDecorator extends LabelProvider implements ILightweig
private static String DECORATOR_FORMAT = "yyyy/MM/dd HH:mm:ss"; //$NON-NLS-1$
private static SimpleDateFormat decorateFormatter = new SimpleDateFormat(DECORATOR_FORMAT, Locale.getDefault());
+
+ private static String[] fonts = new String[] {
+ CVSDecoratorConfiguration.IGNORED_FONT,
+ CVSDecoratorConfiguration.OUTGOING_CHANGE_FONT};
+
+ private static String[] colors = new String[] {
+ CVSDecoratorConfiguration.OUTGOING_CHANGE_BACKGROUND_COLOR,
+ CVSDecoratorConfiguration.OUTGOING_CHANGE_FOREGROUND_COLOR,
+ CVSDecoratorConfiguration.IGNORED_BACKGROUND_COLOR,
+ CVSDecoratorConfiguration.IGNORED_FOREGROUND_COLOR};
public CVSLightweightDecorator() {
ResourceStateChangeListeners.getListener().addResourceStateChangeListener(this);
TeamUI.addPropertyChangeListener(this);
CVSUIPlugin.addPropertyChangeListener(this);
- ensureFontAndColorsCreated(new String[] {CVSDecoratorConfiguration.IGNORED_FONT}, new String[0]);
+
+ // This is an optimization to ensure that while decorating our fonts and colors are
+ // pre-created and decoration can occur without having to syncExec.
+ ensureFontAndColorsCreated(fonts, colors);
+
PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().addPropertyChangeListener(this);
CVSProviderPlugin.broadcastDecoratorEnablementChanged(true /* enabled */);
}
@@ -408,7 +422,7 @@ public class CVSLightweightDecorator extends LabelProvider implements ILightweig
*/
public void propertyChange(PropertyChangeEvent event) {
if (isEventOfInterest(event)) {
- ensureFontAndColorsCreated(new String[] {CVSDecoratorConfiguration.IGNORED_FONT}, new String[0]);
+ ensureFontAndColorsCreated(fonts, colors);
refresh();
}
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
index 4f7566d4b..fe4a7521b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
@@ -716,8 +716,9 @@ UpdateSyncAction.Update_all_resources,_overwriting_local_changes_with_remote_con
UpdateSyncAction.Overwrite_local_changes__5=Overwrite local changes?
UpdateSyncAction.You_have_local_changes_you_are_about_to_overwrite._Do_you_wish_to_continue__6=You have local changes you are about to overwrite. Do you wish to continue?
-Example__1=Example:
-Text_Labels_12=T&ext
+CVSDecoratorPreferencePage.1=T&ext
+Example__1=&Preview
+Text_Labels_12=&Formats
Select_the_format_for_file,_folders,_and_project_text_labels__13=Select the format for file, folders, and project text labels:
&File_Format__14=&File Format:
Add_&Variables_15=Add &Variables...

Back to the top