mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
bug 322695: Can't access preferences of any unrelated CDT project having "bad" project in workspace
This commit is contained in:
parent
cb668b62b8
commit
cb1a62793d
3 changed files with 36 additions and 26 deletions
|
@ -216,10 +216,11 @@ public class Messages extends NLS {
|
||||||
public static String ProjectContentsArea_7;
|
public static String ProjectContentsArea_7;
|
||||||
public static String ProjectContentsArea_8;
|
public static String ProjectContentsArea_8;
|
||||||
public static String ProjectContentsArea_9;
|
public static String ProjectContentsArea_9;
|
||||||
public static String RefsTab_0;
|
public static String RefsTab_ExpandAll;
|
||||||
public static String RefsTab_2;
|
public static String RefsTab_CollapseAll;
|
||||||
public static String RefsTab_3;
|
public static String RefsTab_Active;
|
||||||
public static String RefsTab_4;
|
public static String RefsTab_ProjectsList;
|
||||||
|
public static String RefsTab_ConfigurationsAccessError;
|
||||||
public static String RenameConfiguration_error_caseName;
|
public static String RenameConfiguration_error_caseName;
|
||||||
public static String RenameConfiguration_error_duplicateName;
|
public static String RenameConfiguration_error_duplicateName;
|
||||||
public static String RenameConfiguration_error_invalidName;
|
public static String RenameConfiguration_error_invalidName;
|
||||||
|
|
|
@ -165,10 +165,11 @@ LibraryPathTab_1=Add...
|
||||||
LibraryPathTab_2=Edit...
|
LibraryPathTab_2=Edit...
|
||||||
LibraryTab_1=Add...
|
LibraryTab_1=Add...
|
||||||
LibraryTab_2=Edit...
|
LibraryTab_2=Edit...
|
||||||
RefsTab_0=Expand All
|
RefsTab_ExpandAll=Expand All
|
||||||
RefsTab_2=Collapse All
|
RefsTab_CollapseAll=Collapse All
|
||||||
RefsTab_3=Active
|
RefsTab_Active=Active
|
||||||
RefsTab_4=Projects list
|
RefsTab_ProjectsList=Projects list
|
||||||
|
RefsTab_ConfigurationsAccessError=Internal error trying access configurations of project
|
||||||
SymbolTab_0=Symbol
|
SymbolTab_0=Symbol
|
||||||
SymbolTab_1=Value
|
SymbolTab_1=Value
|
||||||
SymbolTab_2=Add symbol
|
SymbolTab_2=Add symbol
|
||||||
|
|
|
@ -39,6 +39,7 @@ import org.eclipse.swt.widgets.TreeItem;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||||
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.newui.Messages;
|
import org.eclipse.cdt.internal.ui.newui.Messages;
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ public class RefsTab extends AbstractCPropertyTab {
|
||||||
public Composite comp;
|
public Composite comp;
|
||||||
private Tree tree;
|
private Tree tree;
|
||||||
|
|
||||||
static private final String ACTIVE = "[" + Messages.RefsTab_3 + "]"; //$NON-NLS-1$ //$NON-NLS-2$
|
static private final String ACTIVE = "[" + Messages.RefsTab_Active + "]"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
private static final int EXPAND_ALL_BUTTON = 0;
|
private static final int EXPAND_ALL_BUTTON = 0;
|
||||||
private static final int COLLAPSE_ALL_BUTTON = 1;
|
private static final int COLLAPSE_ALL_BUTTON = 1;
|
||||||
|
@ -63,8 +64,8 @@ public class RefsTab extends AbstractCPropertyTab {
|
||||||
public void createControls(Composite parent) {
|
public void createControls(Composite parent) {
|
||||||
super.createControls(parent);
|
super.createControls(parent);
|
||||||
initButtons(new String[] {
|
initButtons(new String[] {
|
||||||
Messages.RefsTab_0,
|
Messages.RefsTab_ExpandAll,
|
||||||
Messages.RefsTab_2,
|
Messages.RefsTab_CollapseAll,
|
||||||
null,
|
null,
|
||||||
MOVEUP_STR,
|
MOVEUP_STR,
|
||||||
MOVEDOWN_STR}, 120);
|
MOVEDOWN_STR}, 120);
|
||||||
|
@ -73,10 +74,10 @@ public class RefsTab extends AbstractCPropertyTab {
|
||||||
tree = new Tree(usercomp, SWT.SINGLE | SWT.CHECK | SWT.BORDER);
|
tree = new Tree(usercomp, SWT.SINGLE | SWT.CHECK | SWT.BORDER);
|
||||||
tree.setLayoutData(new GridData(GridData.FILL_BOTH));
|
tree.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
tree.getAccessible().addAccessibleListener(
|
tree.getAccessible().addAccessibleListener(
|
||||||
new AccessibleAdapter() {
|
new AccessibleAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void getName(AccessibleEvent e) {
|
public void getName(AccessibleEvent e) {
|
||||||
e.result = Messages.RefsTab_4;
|
e.result = Messages.RefsTab_ProjectsList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -134,12 +135,12 @@ public class RefsTab extends AbstractCPropertyTab {
|
||||||
|
|
||||||
tree.addTreeListener(new TreeListener() {
|
tree.addTreeListener(new TreeListener() {
|
||||||
public void treeCollapsed(TreeEvent e) {
|
public void treeCollapsed(TreeEvent e) {
|
||||||
updateExpandButtons(e, false, true);
|
updateExpandButtons(e, false, true);
|
||||||
}
|
}
|
||||||
public void treeExpanded(TreeEvent e) {
|
public void treeExpanded(TreeEvent e) {
|
||||||
updateExpandButtons(e, true, false);
|
updateExpandButtons(e, true, false);
|
||||||
}});
|
}});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -148,7 +149,7 @@ public class RefsTab extends AbstractCPropertyTab {
|
||||||
{
|
{
|
||||||
case COLLAPSE_ALL_BUTTON:
|
case COLLAPSE_ALL_BUTTON:
|
||||||
case EXPAND_ALL_BUTTON:
|
case EXPAND_ALL_BUTTON:
|
||||||
for (TreeItem item : tree.getItems())
|
for (TreeItem item : tree.getItems())
|
||||||
item.setExpanded(n==EXPAND_ALL_BUTTON);
|
item.setExpanded(n==EXPAND_ALL_BUTTON);
|
||||||
updateButtons();
|
updateButtons();
|
||||||
break;
|
break;
|
||||||
|
@ -185,7 +186,7 @@ public class RefsTab extends AbstractCPropertyTab {
|
||||||
if (page.isMultiCfg()) {
|
if (page.isMultiCfg()) {
|
||||||
setAllVisible(false, null);
|
setAllVisible(false, null);
|
||||||
} else {
|
} else {
|
||||||
if (!usercomp.isVisible())
|
if (!usercomp.isVisible())
|
||||||
setAllVisible(true, null);
|
setAllVisible(true, null);
|
||||||
initData();
|
initData();
|
||||||
}
|
}
|
||||||
|
@ -218,7 +219,7 @@ public class RefsTab extends AbstractCPropertyTab {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialises the tree.
|
* Initialises the tree.
|
||||||
*
|
*
|
||||||
* TreeItems are either
|
* TreeItems are either
|
||||||
* TI: Text , Data
|
* TI: Text , Data
|
||||||
* {IProject.getName()} , {IProject}
|
* {IProject.getName()} , {IProject}
|
||||||
|
@ -253,8 +254,15 @@ public class RefsTab extends AbstractCPropertyTab {
|
||||||
for (String pname : projects) {
|
for (String pname : projects) {
|
||||||
// The referenced configuration ID
|
// The referenced configuration ID
|
||||||
String ref = refs.get(pname);
|
String ref = refs.get(pname);
|
||||||
IProject prj = p.getWorkspace().getRoot().getProject(pname);
|
IProject prj;
|
||||||
ICConfigurationDescription[] cfgs = page.getCfgsReadOnly(prj);
|
ICConfigurationDescription[] cfgs;
|
||||||
|
try {
|
||||||
|
prj = p.getWorkspace().getRoot().getProject(pname);
|
||||||
|
cfgs = page.getCfgsReadOnly(prj);
|
||||||
|
} catch (Exception e) {
|
||||||
|
CUIPlugin.log(Messages.RefsTab_ConfigurationsAccessError+pname, e);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (cfgs == null || cfgs.length == 0) {
|
if (cfgs == null || cfgs.length == 0) {
|
||||||
// If the project is referenced, then make sure the user knows about it!
|
// If the project is referenced, then make sure the user knows about it!
|
||||||
if (ref != null) {
|
if (ref != null) {
|
||||||
|
@ -338,7 +346,7 @@ public class RefsTab extends AbstractCPropertyTab {
|
||||||
getResDesc().getConfiguration().setReferenceInfo(new HashMap<String, String>());
|
getResDesc().getConfiguration().setReferenceInfo(new HashMap<String, String>());
|
||||||
initData();
|
initData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateButtons() {
|
protected void updateButtons() {
|
||||||
updateExpandButtons(null, false, false);
|
updateExpandButtons(null, false, false);
|
||||||
|
@ -359,11 +367,11 @@ public class RefsTab extends AbstractCPropertyTab {
|
||||||
continue;
|
continue;
|
||||||
if (item.getExpanded())
|
if (item.getExpanded())
|
||||||
cntE = true;
|
cntE = true;
|
||||||
else
|
else
|
||||||
cntC = true;
|
cntC = true;
|
||||||
}
|
}
|
||||||
buttonSetEnabled(EXPAND_ALL_BUTTON, cntC); // Expand All
|
buttonSetEnabled(EXPAND_ALL_BUTTON, cntC); // Expand All
|
||||||
buttonSetEnabled(COLLAPSE_ALL_BUTTON, cntE); // Collapse all
|
buttonSetEnabled(COLLAPSE_ALL_BUTTON, cntE); // Collapse all
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -375,7 +383,7 @@ public class RefsTab extends AbstractCPropertyTab {
|
||||||
// Is a project selected?
|
// Is a project selected?
|
||||||
if (ti.getParentItem() == null && ti.getChecked()) {
|
if (ti.getParentItem() == null && ti.getChecked()) {
|
||||||
int index = tree.indexOf(ti);
|
int index = tree.indexOf(ti);
|
||||||
buttonSetEnabled(MOVEUP_BUTTON, index > 0);
|
buttonSetEnabled(MOVEUP_BUTTON, index > 0);
|
||||||
buttonSetEnabled(MOVEDOWN_BUTTON, index < tree.getItemCount() - 1);
|
buttonSetEnabled(MOVEDOWN_BUTTON, index < tree.getItemCount() - 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue