NEW - bug 320141: provide option to turn off resource monitoring
https://bugs.eclipse.org/bugs/show_bug.cgi?id=320141
diff --git a/org.eclipse.mylyn.resources.ui/.classpath b/org.eclipse.mylyn.resources.ui/.classpath
index 58e7b31..a762e20 100644
--- a/org.eclipse.mylyn.resources.ui/.classpath
+++ b/org.eclipse.mylyn.resources.ui/.classpath
@@ -7,6 +7,7 @@
<accessrule kind="accessible" pattern="org/eclipse/core/internal/resources/**"/>
<accessrule kind="accessible" pattern="org/eclipse/ui/internal/**"/>
<accessrule kind="accessible" pattern="org/eclipse/ui/views/markers/internal/*"/>
+ <accessrule kind="accessible" pattern="org/eclipse/mylyn/**/provisional/**"/>
</accessrules>
</classpathentry>
<classpathentry kind="src" path="src"/>
diff --git a/org.eclipse.mylyn.resources.ui/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.mylyn.resources.ui/.settings/org.eclipse.jdt.core.prefs
index 1314ffa..312c15d 100644
--- a/org.eclipse.mylyn.resources.ui/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.mylyn.resources.ui/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Tue May 12 20:42:46 PDT 2009
+#Fri Jul 30 15:17:50 PDT 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
@@ -8,6 +8,8 @@
org.eclipse.jdt.core.codeComplete.localSuffixes=
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
diff --git a/org.eclipse.mylyn.resources.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.resources.ui/META-INF/MANIFEST.MF
index 9f25dab..ceff665 100644
--- a/org.eclipse.mylyn.resources.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.resources.ui/META-INF/MANIFEST.MF
@@ -13,6 +13,7 @@
org.eclipse.compare,
org.eclipse.core.expressions,
org.eclipse.mylyn.commons.core;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.mylyn.commons.ui;bundle-version="[3.0.0,4.0.0)",
org.eclipse.mylyn.context.core;bundle-version="[3.0.0,4.0.0)",
org.eclipse.mylyn.context.ui;bundle-version="[3.0.0,4.0.0)",
org.eclipse.mylyn.monitor.ui;bundle-version="[3.0.0,4.0.0)",
diff --git a/org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/ResourcesUiBridgePlugin.java b/org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/ResourcesUiBridgePlugin.java
index c5f3a4b..c09ba71 100644
--- a/org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/ResourcesUiBridgePlugin.java
+++ b/org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/ResourcesUiBridgePlugin.java
@@ -20,6 +20,8 @@
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.mylyn.context.core.AbstractContextStructureBridge;
import org.eclipse.mylyn.context.core.ContextCore;
import org.eclipse.mylyn.context.core.IInteractionContext;
@@ -62,6 +64,13 @@
private ResourceInterestUpdater interestUpdater;
+ private final IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ updateResourceMonitorEnablement();
+ }
+
+ };
+
public ResourcesUiBridgePlugin() {
super();
INSTANCE = this;
@@ -81,6 +90,9 @@
*/
protected void lazyStart() {
resourceChangeMonitor = new ResourceChangeMonitor();
+ updateResourceMonitorEnablement();
+ getPreferenceStore().addPropertyChangeListener(propertyChangeListener);
+
resourceInteractionMonitor = new ResourceInteractionMonitor();
interestEditorTracker = new EditorInteractionMonitor();
@@ -93,6 +105,7 @@
}
protected void lazyStop() {
+ getPreferenceStore().removePropertyChangeListener(propertyChangeListener);
if (resourceChangeMonitor != null) {
ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeMonitor);
}
@@ -171,4 +184,9 @@
return null;
}
+ private void updateResourceMonitorEnablement() {
+ resourceChangeMonitor.setEnabled(getPreferenceStore().getBoolean(
+ ResourcesUiPreferenceInitializer.PREF_RESOURCE_MONITOR_ENABLED));
+ }
+
}
diff --git a/org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/ResourcesUiPreferenceInitializer.java b/org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/ResourcesUiPreferenceInitializer.java
index 8f62819..511d62f 100644
--- a/org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/ResourcesUiPreferenceInitializer.java
+++ b/org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/ResourcesUiPreferenceInitializer.java
@@ -44,6 +44,8 @@
@Deprecated
private static final String PREF_RESOURCES_IGNORED = PREF_DEFAULT_SCOPE + ".ignored.pattern"; //$NON-NLS-1$
+ public static final String PREF_RESOURCE_MONITOR_ENABLED = PREF_DEFAULT_SCOPE + ".resource.monitor.enabled"; //$NON-NLS-1$
+
private static final String PREF_RESOURCES_IGNORED_ANT = PREF_DEFAULT_SCOPE + ".ignored.pattern.ant"; //$NON-NLS-1$
public static final String PREF_MODIFIED_DATE_EXCLUSIONS = PREF_DEFAULT_SCOPE + ".date.modified.exclusion"; //$NON-NLS-1$
@@ -65,11 +67,11 @@
defaultPatterns.addAll(ResourcePatternExclusionStrategy.convertToAntPattern(".*")); //$NON-NLS-1$
+ ResourcesUiBridgePlugin.getDefault().getPreferenceStore().setDefault(PREF_RESOURCE_MONITOR_ENABLED, true);
ResourcesUiBridgePlugin.getDefault()
.getPreferenceStore()
.setDefault(PREF_RESOURCES_IGNORED_ANT, createResourceExclusionMemento(defaultPatterns));
ResourcesUiBridgePlugin.getDefault().getPreferenceStore().setDefault(PREF_MODIFIED_DATE_EXCLUSIONS, true);
-
}
/**
diff --git a/org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/preferences/FocusedResourcesPreferencePage.java b/org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/preferences/FocusedResourcesPreferencePage.java
index 6dc1ed8..b808aef 100644
--- a/org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/preferences/FocusedResourcesPreferencePage.java
+++ b/org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/preferences/FocusedResourcesPreferencePage.java
@@ -16,11 +16,16 @@
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.window.Window;
+import org.eclipse.mylyn.internal.provisional.commons.ui.CommonUiUtil;
import org.eclipse.mylyn.internal.resources.ui.ResourcesUiBridgePlugin;
import org.eclipse.mylyn.internal.resources.ui.ResourcesUiPreferenceInitializer;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -52,27 +57,67 @@
private Button removeButton;
- private Button resourceModificationButton;
+ private Button resourceMonitoringButton;
+
+ private Group monitoringExclusionsGroup;
public void init(IWorkbench workbench) {
- // ignore
+ setDescription(Messages.FocusedResourcesPreferencePage_Configure_file_change_monitoring_Description);
+ }
+
+ @Override
+ protected IPreferenceStore doGetPreferenceStore() {
+ return ResourcesUiBridgePlugin.getDefault().getPreferenceStore();
}
@Override
protected Control createContents(Composite parent) {
- createExcludesTable(parent);
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayoutFactory.fillDefaults().applyTo(composite);
- return parent;
+ resourceMonitoringButton = new Button(composite, SWT.CHECK | SWT.WRAP);
+ resourceMonitoringButton.setText(Messages.FocusedResourcesPreferencePage__Enable_file_change_monitoring_Label);
+ boolean resourceModificationsEnabled = getPreferenceStore().getBoolean(
+ ResourcesUiPreferenceInitializer.PREF_RESOURCE_MONITOR_ENABLED);
+ resourceMonitoringButton.setSelection(resourceModificationsEnabled);
+ resourceMonitoringButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ resourceMonitoringButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateEnablement();
+ }
+ });
+
+ createExcludesTable(composite);
+
+ updateEnablement();
+
+ Dialog.applyDialogFont(composite);
+ return composite;
+ }
+
+ private void updateEnablement() {
+ boolean enabled = resourceMonitoringButton.getSelection();
+ if (enabled != monitoringExclusionsGroup.isEnabled()) {
+ CommonUiUtil.setEnabled(monitoringExclusionsGroup, enabled);
+ }
+ if (enabled) {
+ if (ignoreTable.getSelectionCount() > 0) {
+ removeButton.setEnabled(true);
+ } else {
+ removeButton.setEnabled(false);
+ }
+ }
}
private void createExcludesTable(Composite parent) {
- Group group = new Group(parent, SWT.SHADOW_ETCHED_IN);
- group.setText(Messages.FocusedResourcesPreferencePage_Resource_Monitoring_Exclusions);
+ monitoringExclusionsGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ monitoringExclusionsGroup.setText(Messages.FocusedResourcesPreferencePage_Resource_Monitoring_Exclusions);
GridLayout layout = new GridLayout(1, false);
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
- group.setLayout(layout);
+ monitoringExclusionsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
+ monitoringExclusionsGroup.setLayout(layout);
- Composite composite = new Composite(group, SWT.NULL);
+ Composite composite = new Composite(monitoringExclusionsGroup, SWT.NULL);
layout = new GridLayout();
layout.marginWidth = 0;
layout.marginHeight = 0;
@@ -93,7 +138,7 @@
ignoreTable.setLayoutData(data);
ignoreTable.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
- handleSelection();
+ updateEnablement();
}
});
@@ -122,18 +167,8 @@
});
fillTable(ResourcesUiPreferenceInitializer.getExcludedResourcePatterns(),
ResourcesUiPreferenceInitializer.getForcedExcludedResourcePatterns());
- Dialog.applyDialogFont(group);
setButtonLayoutData(addButton);
setButtonLayoutData(removeButton);
-
- resourceModificationButton = new Button(group, SWT.CHECK);
- resourceModificationButton.setText(Messages.FocusedResourcesPreferencePage_ExcludeNonModifiedFiles);
-
- boolean resourceModificationsEnabled = ResourcesUiBridgePlugin.getDefault().getPreferenceStore().getBoolean(
- ResourcesUiPreferenceInitializer.PREF_MODIFIED_DATE_EXCLUSIONS);
- resourceModificationButton.setSelection(resourceModificationsEnabled);
- resourceModificationButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
}
/**
@@ -143,10 +178,10 @@
*/
@Override
public boolean performOk() {
-
- ResourcesUiBridgePlugin.getDefault().getPreferenceStore().setValue(
- ResourcesUiPreferenceInitializer.PREF_MODIFIED_DATE_EXCLUSIONS,
- resourceModificationButton.getSelection());
+ ResourcesUiBridgePlugin.getDefault()
+ .getPreferenceStore()
+ .setValue(ResourcesUiPreferenceInitializer.PREF_RESOURCE_MONITOR_ENABLED,
+ resourceMonitoringButton.getSelection());
Set<String> patterns = new HashSet<String>();
TableItem[] items = ignoreTable.getItems();
@@ -165,8 +200,8 @@
boolean resourceModificationsEnabled = ResourcesUiBridgePlugin.getDefault()
.getPreferenceStore()
- .getDefaultBoolean(ResourcesUiPreferenceInitializer.PREF_MODIFIED_DATE_EXCLUSIONS);
- resourceModificationButton.setSelection(resourceModificationsEnabled);
+ .getDefaultBoolean(ResourcesUiPreferenceInitializer.PREF_RESOURCE_MONITOR_ENABLED);
+ resourceMonitoringButton.setSelection(resourceModificationsEnabled);
ignoreTable.removeAll();
ResourcesUiPreferenceInitializer.restoreDefaultExcludedResourcePatterns();
fillTable(ResourcesUiPreferenceInitializer.getExcludedResourcePatterns(),
@@ -209,12 +244,4 @@
ignoreTable.remove(selection);
}
- private void handleSelection() {
- if (ignoreTable.getSelectionCount() > 0) {
- removeButton.setEnabled(true);
- } else {
- removeButton.setEnabled(false);
- }
- }
-
}
diff --git a/org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/preferences/Messages.java b/org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/preferences/Messages.java
index 722547b..19d1f92 100644
--- a/org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/preferences/Messages.java
+++ b/org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/preferences/Messages.java
@@ -14,6 +14,7 @@
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
+
private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.resources.ui.preferences.messages"; //$NON-NLS-1$
static {
@@ -26,11 +27,21 @@
}
public static String FocusedResourcesPreferencePage_Add_;
+
public static String FocusedResourcesPreferencePage_Add__IGNORED_RESOURCE;
+
public static String FocusedResourcesPreferencePage__automatic_;
+
+ public static String FocusedResourcesPreferencePage__Enable_file_change_monitoring_Label;
+
+ public static String FocusedResourcesPreferencePage_Configure_file_change_monitoring_Description;
+
public static String FocusedResourcesPreferencePage_Enter_pattern_____any_string_;
- public static String FocusedResourcesPreferencePage_ExcludeNonModifiedFiles;
+
public static String FocusedResourcesPreferencePage_Matching_file_or_directory_names_will_not_be_added_automatically_to_the_context;
+
public static String FocusedResourcesPreferencePage_Remove;
+
public static String FocusedResourcesPreferencePage_Resource_Monitoring_Exclusions;
+
}
diff --git a/org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/preferences/messages.properties b/org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/preferences/messages.properties
index 3f9e448..972b63c 100644
--- a/org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/preferences/messages.properties
+++ b/org.eclipse.mylyn.resources.ui/src/org/eclipse/mylyn/internal/resources/ui/preferences/messages.properties
@@ -11,8 +11,9 @@
FocusedResourcesPreferencePage_Add_=Add...
FocusedResourcesPreferencePage_Add__IGNORED_RESOURCE=Add Ignored Resource
FocusedResourcesPreferencePage__automatic_=[automatic]
+FocusedResourcesPreferencePage__Enable_file_change_monitoring_Label=Enable file change monitoring (Recommended)
+FocusedResourcesPreferencePage_Configure_file_change_monitoring_Description=Configure file change monitoring to add newly created and modified files to the context.
FocusedResourcesPreferencePage_Enter_pattern_____any_string_=Enter pattern (Allowed wildcards are '*', '?' and '**'. Pattern segments are separated by '/'. '**' matches any number of segments.\nExamples are: '**/generated/**', '**/*.class'.)
-FocusedResourcesPreferencePage_ExcludeNonModifiedFiles=Exclude files not modified while the current task is active
FocusedResourcesPreferencePage_Matching_file_or_directory_names_will_not_be_added_automatically_to_the_context=Matching file or directory names will not be added automatically to the context.
FocusedResourcesPreferencePage_Remove=Remove
FocusedResourcesPreferencePage_Resource_Monitoring_Exclusions=Resource Monitoring Exclusions