mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-14 19:55:45 +02:00
Trigger re-index when editing relevant properties, bug 144085.
This commit is contained in:
parent
7768ee8e9e
commit
0ca5db3105
4 changed files with 51 additions and 37 deletions
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.ui; singleton:=true
|
Bundle-SymbolicName: org.eclipse.cdt.ui; singleton:=true
|
||||||
Bundle-Version: 5.1.100.qualifier
|
Bundle-Version: 5.2.0.qualifier
|
||||||
Bundle-Activator: org.eclipse.cdt.ui.CUIPlugin
|
Bundle-Activator: org.eclipse.cdt.ui.CUIPlugin
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2008 Intel Corporation and others.
|
* Copyright (c) 2007, 2009 Intel Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -700,4 +700,14 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
|
||||||
public void setHelpContextId(String id) {
|
public void setHelpContextId(String id) {
|
||||||
helpId = PREFIX + id;
|
helpId = PREFIX + id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows subclasses to inform the container about changes relevant to the indexer.
|
||||||
|
* The tab will be asked before the apply is performed. As a consequence of returning
|
||||||
|
* <code>true</code> the user will be asked whether she wants to rebuild the index.
|
||||||
|
* @since 5.2
|
||||||
|
*/
|
||||||
|
protected boolean isIndexerAffected() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2008 Intel Corporation and others.
|
* Copyright (c) 2007, 2009 Intel Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -374,10 +374,10 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
ls = getLangSetting(cfg);
|
ls = getLangSetting(cfg);
|
||||||
if (ls != null) {
|
if (ls != null) {
|
||||||
Arrays.sort(ls, CDTListComparator.getInstance());
|
Arrays.sort(ls, CDTListComparator.getInstance());
|
||||||
for (int i=0; i<ls.length; i++) {
|
for (ICLanguageSetting element : ls) {
|
||||||
if ((ls[i].getSupportedEntryKinds() & getKind()) != 0) {
|
if ((element.getSupportedEntryKinds() & getKind()) != 0) {
|
||||||
TreeItem t = new TreeItem(langTree, SWT.NONE);
|
TreeItem t = new TreeItem(langTree, SWT.NONE);
|
||||||
String s = ls[i].getLanguageId();
|
String s = element.getLanguageId();
|
||||||
if (s != null && !s.equals(EMPTY_STR)) {
|
if (s != null && !s.equals(EMPTY_STR)) {
|
||||||
// Bug #178033: get language name via LangManager.
|
// Bug #178033: get language name via LangManager.
|
||||||
ILanguageDescriptor ld = LanguageManager.getInstance().getLanguageDescriptor(s);
|
ILanguageDescriptor ld = LanguageManager.getInstance().getLanguageDescriptor(s);
|
||||||
|
@ -387,12 +387,12 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
s = ld.getName();
|
s = ld.getName();
|
||||||
}
|
}
|
||||||
if (s == null || s.equals(EMPTY_STR))
|
if (s == null || s.equals(EMPTY_STR))
|
||||||
s = ls[i].getName();
|
s = element.getName();
|
||||||
t.setText(0, s);
|
t.setText(0, s);
|
||||||
t.setData(ls[i]);
|
t.setData(element);
|
||||||
if (firstItem == null) {
|
if (firstItem == null) {
|
||||||
firstItem = t;
|
firstItem = t;
|
||||||
lang = ls[i];
|
lang = element;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -574,8 +574,8 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
ICConfigurationDescription cfg = getResDesc().getConfiguration();
|
ICConfigurationDescription cfg = getResDesc().getConfiguration();
|
||||||
ICExternalSetting[] vals = cfg.getExternalSettings();
|
ICExternalSetting[] vals = cfg.getExternalSettings();
|
||||||
if (!(vals == null || vals.length == 0)) {
|
if (!(vals == null || vals.length == 0)) {
|
||||||
for (int i=0; i<vals.length; i++) {
|
for (ICExternalSetting val : vals) {
|
||||||
ICSettingEntry[] ents = vals[i].getEntries(getKind());
|
ICSettingEntry[] ents = val.getEntries(getKind());
|
||||||
if (ents == null || ents.length == 0) continue;
|
if (ents == null || ents.length == 0) continue;
|
||||||
for (int j=0; j<ents.length; j++) {
|
for (int j=0; j<ents.length; j++) {
|
||||||
if (ents[j].equalsByName(ent)) {
|
if (ents[j].equalsByName(ent)) {
|
||||||
|
@ -583,10 +583,10 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (int k=0; k<ents.length; k++)
|
for (int k=0; k<ents.length; k++)
|
||||||
if (k != j) arr[index++] = ents[k];
|
if (k != j) arr[index++] = ents[k];
|
||||||
cfg.removeExternalSetting(vals[i]);
|
cfg.removeExternalSetting(val);
|
||||||
cfg.createExternalSetting(vals[i].getCompatibleLanguageIds(),
|
cfg.createExternalSetting(val.getCompatibleLanguageIds(),
|
||||||
vals[i].getCompatibleContentTypeIds(),
|
val.getCompatibleContentTypeIds(),
|
||||||
vals[i].getCompatibleExtensions(),
|
val.getCompatibleExtensions(),
|
||||||
arr);
|
arr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -604,8 +604,8 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
ICConfigurationDescription[] cfgs = page.getCfgsEditable();
|
ICConfigurationDescription[] cfgs = page.getCfgsEditable();
|
||||||
ICResourceDescription cur_cfg = page.getResDesc();
|
ICResourceDescription cur_cfg = page.getResDesc();
|
||||||
String id = lang.getName(); // getLanguageId() sometimes returns null.
|
String id = lang.getName(); // getLanguageId() sometimes returns null.
|
||||||
for (int i = 0; i < cfgs.length; i++) {
|
for (ICConfigurationDescription cfg : cfgs) {
|
||||||
ICResourceDescription rcfg = page.getResDesc(cfgs[i]);
|
ICResourceDescription rcfg = page.getResDesc(cfg);
|
||||||
if (rcfg == null)
|
if (rcfg == null)
|
||||||
continue;
|
continue;
|
||||||
if (!toAllCfgs && !(cur_cfg.equals(rcfg)))
|
if (!toAllCfgs && !(cur_cfg.equals(rcfg)))
|
||||||
|
@ -654,8 +654,8 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
protected void performDefaults() {
|
protected void performDefaults() {
|
||||||
fHadSomeModification= true;
|
fHadSomeModification= true;
|
||||||
TreeItem[] tis = langTree.getItems();
|
TreeItem[] tis = langTree.getItems();
|
||||||
for (int i=0; i<tis.length; i++) {
|
for (TreeItem ti : tis) {
|
||||||
Object ob = tis[i].getData();
|
Object ob = ti.getData();
|
||||||
if (ob != null && ob instanceof ICLanguageSetting) {
|
if (ob != null && ob instanceof ICLanguageSetting) {
|
||||||
((ICLanguageSetting)ob).setSettingEntries(getKind(), (List<ICLanguageSettingEntry>)null);
|
((ICLanguageSetting)ob).setSettingEntries(getKind(), (List<ICLanguageSettingEntry>)null);
|
||||||
}
|
}
|
||||||
|
@ -740,10 +740,10 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
lsets = new ICLanguageSetting[fs.length];
|
lsets = new ICLanguageSetting[fs.length];
|
||||||
for (int i=0; i<fs.length; i++) {
|
for (int i=0; i<fs.length; i++) {
|
||||||
ArrayList<ICLanguageSetting> list = new ArrayList<ICLanguageSetting>(ls.length);
|
ArrayList<ICLanguageSetting> list = new ArrayList<ICLanguageSetting>(ls.length);
|
||||||
for (int j=0; j<ls.length; j++) {
|
for (ICLanguageSetting[] element : ls) {
|
||||||
int x = Arrays.binarySearch(ls[j], fs[i], comp);
|
int x = Arrays.binarySearch(element, fs[i], comp);
|
||||||
if (x >= 0)
|
if (x >= 0)
|
||||||
list.add(ls[j][x]);
|
list.add(element[x]);
|
||||||
}
|
}
|
||||||
if (list.size() == 1)
|
if (list.size() == 1)
|
||||||
lsets[i] = list.get(0);
|
lsets[i] = list.get(0);
|
||||||
|
@ -759,8 +759,8 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
if (getResDesc() == null) return true;
|
if (getResDesc() == null) return true;
|
||||||
ICLanguageSetting [] ls = getLangSetting(getResDesc());
|
ICLanguageSetting [] ls = getLangSetting(getResDesc());
|
||||||
if (ls == null) return false;
|
if (ls == null) return false;
|
||||||
for (int i=0; i<ls.length; i++) {
|
for (ICLanguageSetting element : ls) {
|
||||||
if ((ls[i].getSupportedEntryKinds() & getKind()) != 0)
|
if ((element.getSupportedEntryKinds() & getKind()) != 0)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -806,4 +806,19 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
|
||||||
protected final boolean hadSomeModification() {
|
protected final boolean hadSomeModification() {
|
||||||
return fHadSomeModification;
|
return fHadSomeModification;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected final boolean isIndexerAffected() {
|
||||||
|
switch(getKind()) {
|
||||||
|
case ICSettingEntry.INCLUDE_PATH:
|
||||||
|
case ICSettingEntry.MACRO:
|
||||||
|
case ICSettingEntry.INCLUDE_FILE:
|
||||||
|
case ICSettingEntry.MACRO_FILE:
|
||||||
|
if (hadSomeModification()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,6 @@ import org.eclipse.cdt.core.settings.model.ICFolderDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICMultiItemsHolder;
|
import org.eclipse.cdt.core.settings.model.ICMultiItemsHolder;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
|
||||||
import org.eclipse.cdt.core.settings.model.MultiItemsHolder;
|
import org.eclipse.cdt.core.settings.model.MultiItemsHolder;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.cdt.ui.PreferenceConstants;
|
import org.eclipse.cdt.ui.PreferenceConstants;
|
||||||
|
@ -677,19 +676,9 @@ implements
|
||||||
InternalTab tab = it.next();
|
InternalTab tab = it.next();
|
||||||
if (tab != null) {
|
if (tab != null) {
|
||||||
ICPropertyTab tabtab = tab.tab;
|
ICPropertyTab tabtab = tab.tab;
|
||||||
if (tabtab instanceof AbstractLangsListTab) {
|
if (tabtab instanceof AbstractCPropertyTab && ((AbstractCPropertyTab)tabtab).isIndexerAffected()) {
|
||||||
final AbstractLangsListTab langListTab = (AbstractLangsListTab) tabtab;
|
|
||||||
switch(langListTab.getKind()) {
|
|
||||||
case ICSettingEntry.INCLUDE_PATH:
|
|
||||||
case ICSettingEntry.MACRO:
|
|
||||||
case ICSettingEntry.INCLUDE_FILE:
|
|
||||||
case ICSettingEntry.MACRO_FILE:
|
|
||||||
if (langListTab.hadSomeModification()) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue