mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 18:56:02 +02:00
Some cleanup
This commit is contained in:
parent
8d38ea9dbb
commit
4bd04cbdfc
8 changed files with 18 additions and 24 deletions
|
@ -1041,7 +1041,5 @@ public class LanguageSettingsListenersTests extends TestCase {
|
|||
assertEquals(cfgDescriptionId, event.getConfigurationDescriptionIds()[0]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.eclipse.core.runtime.Path;
|
|||
* Test cases testing LanguageSettingsProvider functionality
|
||||
*/
|
||||
public class LanguageSettingsManagerTests extends TestCase {
|
||||
// Should match id of extension point defined in plugin.xml
|
||||
// Those should match ids of plugin extensions defined in plugin.xml
|
||||
private static final String EXTENSION_BASE_PROVIDER_ID = "org.eclipse.cdt.core.tests.language.settings.base.provider";
|
||||
private static final String EXTENSION_EDITABLE_PROVIDER_ID = "org.eclipse.cdt.core.tests.custom.editable.language.settings.provider";
|
||||
private static final String EXTENSION_EDITABLE_PROVIDER_NAME = "Test Plugin Mock Editable Language Settings Provider";
|
||||
|
|
|
@ -13,14 +13,9 @@ package org.eclipse.cdt.core.language.settings.providers;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||
import org.eclipse.cdt.core.settings.model.util.LanguageSettingEntriesSerializer;
|
||||
import org.eclipse.cdt.internal.core.XmlUtil;
|
||||
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsStorage;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
@ -166,19 +161,15 @@ public class LanguageSettingsSerializable extends LanguageSettingsBaseProvider {
|
|||
public void setSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId, List<ICLanguageSettingEntry> entries) {
|
||||
String rcProjectPath = rc!=null ? rc.getProjectRelativePath().toString() : null;
|
||||
fStorage.setSettingEntries(rcProjectPath, languageId, entries);
|
||||
|
||||
// // TODO - not sure what is more efficient, to do that or not to do that?
|
||||
// if (fStorage.equals(lastPersistedState)) {
|
||||
// lastPersistedState = null;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* <br> Note that this list is <b>unmodifiable</b>. To modify the list copy it, change and use
|
||||
* <br>
|
||||
* Note that this list is <b>unmodifiable</b>. To modify the list copy it, change and use
|
||||
* {@link #setSettingEntries(ICConfigurationDescription, IResource, String, List)}.
|
||||
*
|
||||
* <br/> Note also that <b>you can compare these lists with simple equality operator ==</b>,
|
||||
* <br>
|
||||
* Note also that <b>you can compare these lists with simple equality operator ==</b>,
|
||||
* as lists themselves are backed by WeakHashSet<List<ICLanguageSettingEntry>> where
|
||||
* identical copies (deep comparison is used) are replaced with the same one instance.
|
||||
*/
|
||||
|
|
|
@ -11,12 +11,16 @@
|
|||
package org.eclipse.cdt.internal.core.language.settings.providers;
|
||||
|
||||
/**
|
||||
* Listens to changes in language settings.
|
||||
* An interface for listeners to changes in language settings.
|
||||
*
|
||||
* @see LanguageSettingsProvidersSerializer#registerLanguageSettingsChangeListener(ILanguageSettingsChangeListener)
|
||||
* @see LanguageSettingsProvidersSerializer#unregisterLanguageSettingsChangeListener(ILanguageSettingsChangeListener)
|
||||
*/
|
||||
public interface ILanguageSettingsChangeListener {
|
||||
/**
|
||||
* Indicates that language settings have been changed.
|
||||
* @param event
|
||||
*
|
||||
* @param event - details of the event.
|
||||
*/
|
||||
public void handleEvent(ILanguageSettingsChangeEvent event);
|
||||
}
|
|
@ -174,6 +174,10 @@ public class LanguageSettingsProvidersSerializer {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Language Settings Change Event implementation.
|
||||
*
|
||||
*/
|
||||
private static class LanguageSettingsChangeEvent implements ILanguageSettingsChangeEvent {
|
||||
private String projectName = null;
|
||||
private Map<String /*cfg*/, LanguageSettingsDelta> deltaMap = new HashMap<String, LanguageSettingsDelta>();
|
||||
|
|
|
@ -1023,7 +1023,7 @@ public class CConfigurationSpecSettings implements ICSettingsStorage{
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns delta and atomically updates last persisted state to the new state.
|
||||
* Returns delta and updates last persisted state to the new state.
|
||||
* That implies that the delta needs to be used to fire an event of it will
|
||||
* be lost.
|
||||
*/
|
||||
|
|
|
@ -20,10 +20,9 @@ import org.eclipse.core.resources.IWorkspaceRoot;
|
|||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
|
||||
/**
|
||||
* This class handles changes in language settings for the PDOM by reindexing the appropriate resources.
|
||||
* This class handles changes in language settings for the PDOM.
|
||||
*/
|
||||
public class LanguageSettingsChangeListener implements ILanguageSettingsChangeListener {
|
||||
|
||||
private PDOMManager fManager;
|
||||
|
||||
public LanguageSettingsChangeListener(PDOMManager manager) {
|
||||
|
@ -31,9 +30,8 @@ public class LanguageSettingsChangeListener implements ILanguageSettingsChangeLi
|
|||
}
|
||||
|
||||
public void handleEvent(ILanguageSettingsChangeEvent event) {
|
||||
String projectName = event.getProjectName();
|
||||
IWorkspaceRoot wspRoot = ResourcesPlugin.getWorkspace().getRoot();
|
||||
IProject project = wspRoot.getProject(projectName);
|
||||
IProject project = wspRoot.getProject(event.getProjectName());
|
||||
|
||||
if (project != null) {
|
||||
ICProjectDescription prjDescription = CCorePlugin.getDefault().getProjectDescription(project);
|
||||
|
|
|
@ -60,7 +60,6 @@ import org.eclipse.cdt.core.model.ITranslationUnit;
|
|||
import org.eclipse.cdt.core.model.LanguageManager;
|
||||
import org.eclipse.cdt.core.settings.model.CProjectDescriptionEvent;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionListener;
|
||||
import org.eclipse.cdt.core.settings.model.util.LanguageSettingEntriesSerializer;
|
||||
import org.eclipse.cdt.internal.core.CCoreInternals;
|
||||
import org.eclipse.cdt.internal.core.index.IIndexFragment;
|
||||
import org.eclipse.cdt.internal.core.index.IWritableIndex;
|
||||
|
|
Loading…
Add table
Reference in a new issue