1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-25 01:45:33 +02:00

1. Bug #183340 : CDTPropertyManager is implemented.

2. Export Path and Symbols tab: can be enabled via Prefs
This commit is contained in:
Oleg Krasilnikov 2007-04-23 13:45:55 +00:00
parent 6340ae683d
commit b42099a8c7
12 changed files with 243 additions and 87 deletions

View file

@ -497,7 +497,7 @@
</enabledWhen>
</page>
<!--page
<page
class="org.eclipse.cdt.managedbuilder.ui.properties.Page_ExpPathAndSymb"
id="org.eclipse.cdt.ui.newui.Page_ExpPathAndSymb"
category="org.eclipse.cdt.ui.newui.Page_head_general"
@ -508,12 +508,15 @@
value="org.eclipse.cdt.managedbuilder.core.managedBuildNature">
</filter>
<enabledWhen>
<and>
<or>
<instanceof value="org.eclipse.core.resources.IProject"/>
<instanceof value="org.eclipse.cdt.core.model.ICProject"/>
</or>
</or>
<test property="org.eclipse.cdt.ui.pageEnabled" value="export" />
</and>
</enabledWhen>
</page-->
</page>
<page
class="org.eclipse.cdt.managedbuilder.ui.properties.Page_BuildSettings"
@ -560,7 +563,7 @@
<instanceof value="org.eclipse.core.resources.IFile"/>
<instanceof value="org.eclipse.cdt.core.model.ITranslationUnit"/>
</or>
<test property="org.eclipse.cdt.ui.toolEditEnabled" value="" />
<test property="org.eclipse.cdt.ui.pageEnabled" value="toolEdit" />
</and>
</enabledWhen>
</page>

View file

@ -31,6 +31,7 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
private Button show_mng;
private Button show_sav;
private Button show_tool;
private Button show_exp;
private Button b_0;
private Button b_1;
private Button b_2;
@ -60,6 +61,10 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
show_tool.setText(UIMessages.getString("PropertyPageDefsTab.4")); //$NON-NLS-1$
show_tool.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
show_exp = new Button(usercomp, SWT.CHECK);
show_exp.setText(UIMessages.getString("PropertyPageDefsTab.10")); //$NON-NLS-1$
show_exp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Group discGrp = new Group(usercomp, SWT.NONE);
discGrp.setText(UIMessages.getString("PropertyPageDefsTab.5")); //$NON-NLS-1$
discGrp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@ -83,6 +88,7 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
show_mng.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOMNG));
show_sav.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOSAVE));
show_tool.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_TOOLM));
show_exp.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_EXPORT));
switch (CDTPrefUtil.getInt(CDTPrefUtil.KEY_DISC_NAMES)) {
case CDTPrefUtil.DISC_NAMING_UNIQUE_OR_BOTH: b_0.setSelection(true); break;
@ -98,6 +104,7 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOMNG, !show_mng.getSelection());
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOSAVE, !show_sav.getSelection());
CDTPrefUtil.setBool(CDTPrefUtil.KEY_TOOLM, show_tool.getSelection());
CDTPrefUtil.setBool(CDTPrefUtil.KEY_EXPORT, show_exp.getSelection());
int x = 0;
if (b_1.getSelection()) x = 1;
else if (b_2.getSelection()) x = 2;
@ -111,6 +118,7 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
show_mng.setSelection(true);
show_mng.setSelection(true);
show_tool.setSelection(false);
show_exp.setSelection(false);
b_0.setSelection(true);
}

View file

@ -2054,7 +2054,7 @@
id="org.eclipse.cdt.Tester3"
class="org.eclipse.cdt.ui.newui.PropertyTester"
namespace="org.eclipse.cdt.ui"
properties="toolEditEnabled"
properties="pageEnabled"
type="java.lang.Object"/>
<propertyTester
id="org.eclipse.cdt.Tester1"

View file

@ -14,13 +14,12 @@ import java.util.HashSet;
import java.util.Iterator;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.action.Action;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.ui.newui.AbstractPage;
import org.eclipse.cdt.ui.newui.CDTPropertyManager;
/**
* Action which changes active build configuration of the current project to
@ -50,16 +49,14 @@ public class BuildConfigAction extends Action {
Iterator iter = fProjects.iterator();
while (iter.hasNext()) {
IProject prj = (IProject)iter.next();
ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(prj, true);
ICProjectDescription prjd = CDTPropertyManager.getProjectDescription(prj);
ICConfigurationDescription[] configs = prjd.getConfigurations();
if (configs != null && configs.length > 0) {
for (int i = 0; i < configs.length; i++) {
if (configs[i].getName().equals(fConfigName)) {
configs[i].setActive();
try {
CoreModel.getDefault().setProjectDescription(prj, prjd);
AbstractPage.updateViews(prj);
} catch (CoreException e) { }
CDTPropertyManager.performOk(null);
AbstractPage.updateViews(prj);
break;
}
}

View file

@ -70,7 +70,7 @@ public class ChangeBuildConfigMenuAction extends ChangeBuildConfigActionBase imp
public void run(IAction action) {
if (fProjects.size() == 1) {
IProject project = (IProject)fProjects.toArray(new IProject[1])[0];
ManageConfigDialog.manage(project);
ManageConfigDialog.manage(project, true);
} else {
MessageDialog.openInformation(CUIPlugin.getActiveWorkbenchShell(),
ActionMessages.getString("ChangeBuildConfigMenuAction.title"), //$NON-NLS-1$

View file

@ -10,11 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.ui.actions;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.ui.newui.ManageConfigDialog;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.IAction;
@ -27,6 +22,12 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.ui.newui.ManageConfigDialog;
/**
* Action which changes active build configuration of the current project to
* the given one.
@ -89,7 +90,7 @@ implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
public void run(IAction action) {
if (project != null)
ManageConfigDialog.manage(project);
ManageConfigDialog.manage(project, true);
}
public void dispose() { project = null; }

View file

@ -102,13 +102,10 @@ implements
IPreferencePageContainer, // dynamic pages
ICPropertyProvider // utility methods for tabs
{
private static ArrayList pages = new ArrayList(5);
private static ICResourceDescription resd = null;
private static ICConfigurationDescription[] cfgDescs = null;
private static ICConfigurationDescription[] multiCfgs = null; // selected multi cfg
private static ICProjectDescription prjd = null;
private static int cfgIndex = 0;
protected static boolean saveDone = false;
// tabs
private static final String EXTENSION_POINT_ID = "org.eclipse.cdt.ui.cPropertyTab"; //$NON-NLS-1$
public static final String ELEMENT_NAME = "tab"; //$NON-NLS-1$
@ -177,18 +174,14 @@ implements
}
}
/**
* Default constructor
*/
public AbstractPage() {
// reset static values before new session
if (pages.size() == 0) {
prjd = null; // force getting new descriptors
saveDone = false; // needs in performOK();
if (CDTPropertyManager.getPagesCount() == 0) {
cfgDescs = null;
cfgIndex = 0;
}
// register current page
if (!pages.contains(this)) pages.add(this);
}
protected Control createContents(Composite parent) {
@ -263,9 +256,7 @@ implements
manageButton.setLayoutData(gd);
manageButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
performOk();
if (ManageConfigDialog.manage(getProject())) {
prjd = null;
if (ManageConfigDialog.manage(getProject(), false)) {
cfgDescs = null;
populateConfigurations();
}
@ -432,19 +423,22 @@ implements
private boolean performSave(int mode) {
final int finalMode = mode;
if (noContentOnPage || !displayedConfig) return true;
if ((mode == SAVE_MODE_OK || mode == SAVE_MODE_APPLYOK) && saveDone) return true; // do not duplicate
if ((mode == SAVE_MODE_OK || mode == SAVE_MODE_APPLYOK) && CDTPropertyManager.isSaveDone()) return true; // do not duplicate
final boolean needs = (mode != SAVE_MODE_OK);
final ICProjectDescription local_prjd = needs ? CoreModel.getDefault().getProjectDescription(prjd.getProject()) : null;
final ICProjectDescription local_prjd = needs ? CoreModel.getDefault().getProjectDescription(getProject()) : null;
ICConfigurationDescription c = needs ? local_prjd.getConfigurationById(resd.getConfiguration().getId()) : null;
final ICResourceDescription local_cfgd = needs ? getResDesc(c) : null;
IRunnableWithProgress runnable = new IRunnableWithProgress() {
private void sendOK() {
for (int j=0; j<pages.size(); j++) {
AbstractPage ap = (AbstractPage)pages.get(j);
if (ap.displayedConfig) ap.forEach(ICPropertyTab.OK, null);
for (int j=0; j<CDTPropertyManager.getPagesCount(); j++) {
Object p = CDTPropertyManager.getPage(j);
if (p != null && p instanceof AbstractPage) {
AbstractPage ap = (AbstractPage)p;
if (ap.displayedConfig) ap.forEach(ICPropertyTab.OK, null);
}
}
}
@ -452,17 +446,19 @@ implements
// ask all tabs to store changes in cfg
switch (finalMode) {
case SAVE_MODE_APPLYOK:
saveDone = true;
sendOK();
ICConfigurationDescription[] olds = prjd.getConfigurations();
ICConfigurationDescription[] olds = CDTPropertyManager.getProjectDescription(AbstractPage.this, getProject()).getConfigurations();
for (int i=0; i<olds.length; i++) {
resd = getResDesc(olds[i]);
ICResourceDescription r = getResDesc(local_prjd.getConfigurationById(olds[i].getId()));
for (int j=0; j<pages.size(); j++) {
AbstractPage ap = (AbstractPage)pages.get(j);
if (ap.displayedConfig) {
ap.forEach(ICPropertyTab.UPDATE, resd);
ap.forEach(ICPropertyTab.APPLY, r);
for (int j=0; j<CDTPropertyManager.getPagesCount(); j++) {
Object p = CDTPropertyManager.getPage(j);
if (p != null && p instanceof AbstractPage) {
AbstractPage ap = (AbstractPage)p;
if (ap.displayedConfig) {
ap.forEach(ICPropertyTab.UPDATE, resd);
ap.forEach(ICPropertyTab.APPLY, r);
}
}
}
}
@ -471,14 +467,16 @@ implements
forEach(ICPropertyTab.APPLY, local_cfgd);
break;
case SAVE_MODE_OK:
saveDone = true;
sendOK();
break;
} // end switch
try {
CoreModel.getDefault().setProjectDescription(getProject(), needs ? local_prjd : prjd);
if (needs) //
CoreModel.getDefault().setProjectDescription(getProject(), local_prjd);
else
CDTPropertyManager.performOk(AbstractPage.this.getControl());
} catch (CoreException e) {
System.out.println(UIMessages.getString("AbstractPage.11") + e.getLocalizedMessage()); //$NON-NLS-1$
CUIPlugin.getDefault().logErrorMessage(UIMessages.getString("AbstractPage.11") + e.getLocalizedMessage()); //$NON-NLS-1$
}
updateViews(internalElement);
}
@ -500,14 +498,9 @@ implements
// Do nothing if widget not created yet.
if (configSelector == null) return;
if (prjd == null) {
prjd = CoreModel.getDefault().getProjectDescription(getProject());
cfgDescs = null;
cfgIndex = 0;
}
// Do not re-read if list already created by another page
if (cfgDescs == null) {
cfgDescs = prjd.getConfigurations();
cfgDescs = CDTPropertyManager.getProjectDescription(this, getProject()).getConfigurations();
if (cfgDescs == null || cfgDescs.length == 0) return;
Arrays.sort(cfgDescs, CDTListComparator.getInstance());
}
@ -559,7 +552,7 @@ implements
}
protected void handleResize(boolean visible) {
if (pages.size() > 1) return; // do not duplicate
if (CDTPropertyManager.getPagesCount() > 1) return; // do not duplicate
if (CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOSAVE)) return;
if (internalElement == null && !checkElement())
@ -680,8 +673,11 @@ implements
if (excludeFromBuildCheck != null)
excludeFromBuildCheck.setSelection(resd.isExcluded());
for (int i=0; i<pages.size(); i++) {
AbstractPage ap = (AbstractPage)pages.get(i);
for (int i=0; i<CDTPropertyManager.getPagesCount(); i++) {
Object p = CDTPropertyManager.getPage(i);
if (p == null || !(p instanceof AbstractPage))
continue;
AbstractPage ap = (AbstractPage)p;
if (ap.displayedConfig)
ap.forEach(ICPropertyTab.UPDATE,getResDesc());
}
@ -690,10 +686,8 @@ implements
public void dispose() {
if (displayedConfig) forEach(ICPropertyTab.DISPOSE);
handleResize(false); // save page size
if (pages.contains(this)) pages.remove(this);
// clear static variables
if (pages.size() == 0) {
prjd = null;
if (CDTPropertyManager.getPagesCount() == 0) {
resd = null;
cfgDescs = null;
multiCfgs = null;
@ -818,15 +812,21 @@ implements
}
public void informAll(int code, Object data) {
for (int i=0; i<pages.size(); i++) {
AbstractPage ap = (AbstractPage)pages.get(i);
for (int i=0; i<CDTPropertyManager.getPagesCount(); i++) {
Object p = CDTPropertyManager.getPage(i);
if (p == null || !(p instanceof AbstractPage))
continue;
AbstractPage ap = (AbstractPage)p;
ap.forEach(code, data);
}
}
public void informPages(int code, Object data) {
for (int i=0; i<pages.size(); i++) {
AbstractPage ap = (AbstractPage)pages.get(i);
for (int i=0; i<CDTPropertyManager.getPagesCount(); i++) {
Object p = CDTPropertyManager.getPage(i);
if (p == null || !(p instanceof AbstractPage))
continue;
AbstractPage ap = (AbstractPage)p;
ap.handleMessage(code, data);
}
}

View file

@ -22,11 +22,12 @@ public class CDTPrefUtil {
// boolean keys (KEY_NO-s are to be inverted !)
public static final String KEY_NOSUPP = "wizard.show.unsupported.disable"; //$NON-NLS-1$
public static final String KEY_OTHERS = "wizard.group.others.enable"; //$NON-NLS-1$
public static final String KEY_NOMNG = "properties.manage.config.disable"; //$NON-NLS-1$
public static final String KEY_MULTI = "properties.multi.config.enable"; //$NON-NLS-1$
public static final String KEY_DTREE = "properties.data.hierarchy.enable"; //$NON-NLS-1$
public static final String KEY_NOMNG = "properties.manage.config.disable"; //$NON-NLS-1$
public static final String KEY_MULTI = "properties.multi.config.enable"; //$NON-NLS-1$
public static final String KEY_DTREE = "properties.data.hierarchy.enable"; //$NON-NLS-1$
public static final String KEY_NOSAVE = "properties.save.position.disable"; //$NON-NLS-1$
public static final String KEY_TOOLM = "properties.toolchain.modification.enable"; //$NON-NLS-1$
public static final String KEY_TOOLM = "properties.toolchain.modification.enable"; //$NON-NLS-1$
public static final String KEY_EXPORT = "properties.export.page.enable"; //$NON-NLS-1$
// string keys
public static final String KEY_PREFTC = "wizard.preferred.toolchains"; //$NON-NLS-1$
// integer keys

View file

@ -0,0 +1,135 @@
/*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Intel Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.ui.newui;
import java.util.ArrayList;
import java.util.Iterator;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.ui.dialogs.PropertyPage;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.ui.CUIPlugin;
/**
* This class is intended to handle
*
* When new propertypage is created, it should request
* project description by method
* getProjectDescription()
* This method, in addition, registers page in list.
*
* While page is active, it can change this description
* but should not set it, to avoid inconsistency.
*
* When page's "performOK" called, it should call
* manager's method
* performOk()
*
* In addition, there are utility methods for pages:
* getPagesCount()
* getPage()
* isSaveDone()
*/
public class CDTPropertyManager {
private static ArrayList pages = new ArrayList();
private static ICProjectDescription prjd = null;
private static boolean saveDone = false;
private static IProject project = null;
private static DListener dListener = new DListener();
public static ICProjectDescription getProjectDescription(PropertyPage p, IProject prj) {
return get(p, prj);
}
public static ICProjectDescription getProjectDescription(Widget w, IProject prj) {
return get(w, prj);
}
public static ICProjectDescription getProjectDescription(IProject prj) {
return get(null, prj);
}
private static ICProjectDescription get(Object p, IProject prj) {
// New session - clean static variables
if (pages.size() == 0) {
project = null;
prjd = null;
saveDone = false;
}
// Register new client
if (p != null && !pages.contains(p)) {
pages.add(p);
if (p instanceof PropertyPage) {
if (((PropertyPage)p).getControl() != null)
((PropertyPage)p).getControl().addDisposeListener(dListener);
} else if (p instanceof Widget) {
((Widget)p).addDisposeListener(dListener);
}
}
// Check that we are working with the same project
if (project == null || !project.equals(prj)) {
project = prj;
prjd = null;
}
// obtain description if it's needed.
if (prjd == null) {
prjd = CoreModel.getDefault().getProjectDescription(prj);
}
return prjd;
}
/**
*
* @param p - widget which calls this functionality
*/
public static void performOk(Object p) {
if (saveDone) return;
saveDone = true;
try {
CoreModel.getDefault().setProjectDescription(project, prjd);
} catch (CoreException e) {
CUIPlugin.getDefault().logErrorMessage(UIMessages.getString("AbstractPage.11") + e.getLocalizedMessage()); //$NON-NLS-1$
}
}
// pages utilities
public static boolean isSaveDone() { return saveDone; }
public static int getPagesCount() { return pages.size(); }
public static Object getPage(int index) { return pages.get(index); }
// Removes disposed items from list
static class DListener implements DisposeListener {
public void widgetDisposed(DisposeEvent e) {
Widget w = e.widget;
if (pages.contains(w)) { // Widget ?
pages.remove(w);
} else { // Property Page ?
Iterator it = pages.iterator();
while (it.hasNext()) {
Object ob = it.next();
if (ob != null && ob instanceof PropertyPage) {
if (((PropertyPage)ob).getControl().equals(w)) {
pages.remove(ob);
break;
}
}
}
}
}
}
}

View file

@ -33,7 +33,6 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.ui.CUIPlugin;
@ -58,8 +57,8 @@ public class ManageConfigDialog extends Dialog {
private static final String RENAME_CONF_DLG = LABEL + ".rename.config.dialog"; //$NON-NLS-1$
// The list of configurations to delete
// private IManagedProject mp;
ICProjectDescription des;
private ICProjectDescription des;
private IProject prj;
private String title;
private String mbs_id;
protected Table table;
@ -68,29 +67,31 @@ public class ManageConfigDialog extends Dialog {
protected Button newBtn;
protected Button renBtn;
protected Button delBtn;
private static Composite comp;
public static boolean manage(IProject prj) {
ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(prj);
public static boolean manage(IProject _prj, boolean doOk) {
ManageConfigDialog d = new ManageConfigDialog(CUIPlugin.getActiveWorkbenchShell(),
prj.getName()+ " : " + MANAGE_TITLE, prjd); //$NON-NLS-1$
if (d.open() == OK) {
try {
CoreModel.getDefault().setProjectDescription(prj, prjd);
AbstractPage.updateViews(prj);
} catch (CoreException e) { return false; }
return true;
_prj.getName()+ " : " + MANAGE_TITLE, _prj); //$NON-NLS-1$
boolean result = false;
if (d.open() == OK) {
if (doOk) {
CDTPropertyManager.performOk(comp);
}
return false;
AbstractPage.updateViews(_prj);
result = true;
}
return result;
}
/**
* @param parentShell
*/
public ManageConfigDialog(Shell parentShell, String _title, ICProjectDescription prjd) {
ManageConfigDialog(Shell parentShell, String _title, IProject _prj) {
super(parentShell);
setShellStyle(getShellStyle() | SWT.RESIZE);
title = _title;
des = prjd;
prj = _prj;
}
protected void configureShell(Shell shell) {
@ -106,7 +107,6 @@ public class ManageConfigDialog extends Dialog {
composite.setFont(parent.getFont());
composite.setLayout(new GridLayout(4, true));
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Create the current config table
table = new Table(composite, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION);
@ -163,6 +163,9 @@ public class ManageConfigDialog extends Dialog {
handleRenamePressed();
}} );
des = CDTPropertyManager.getProjectDescription(composite, prj);
comp = composite;
updateData();
return composite;
}

View file

@ -338,6 +338,7 @@ ProjectConvert.noConverterErrordialog.message=There are no converters available
ProjectConvert.title=Project Converters for {0}
PropertyPageDefsTab.0=Show <Manage configurations> button
PropertyPageDefsTab.1=Display "Data hierarchy" tab
PropertyPageDefsTab.10=Display "Export Path & Symbols" tab
PropertyPageDefsTab.2=Enable multiple configurations setting
PropertyPageDefsTab.3=Save property dialog size and position
PropertyPageDefsTab.4=Display "Toolchain modification" tab

View file

@ -19,8 +19,10 @@ import org.eclipse.cdt.core.model.ITranslationUnit;
* Checks whether given object is a source file.
*/
public class PropertyTester extends org.eclipse.core.expressions.PropertyTester {
private static final String KEY_SRC = "isSource"; //$NON-NLS-1$
private static final String KEY_TOOL = "toolEditEnabled"; //$NON-NLS-1$
private static final String KEY_SRC = "isSource"; //$NON-NLS-1$
private static final String KEY_PAGE = "pageEnabled"; //$NON-NLS-1$
private static final String VAL_EXP = "export"; //$NON-NLS-1$
private static final String VAL_TOOL = "toolEdit"; //$NON-NLS-1$
public boolean test(Object receiver, String property, Object[] args,
Object expectedValue) {
@ -32,8 +34,13 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester
IFile file = (IFile)receiver;
return CoreModel.isValidSourceUnitName(file.getProject(), file.getName());
}
} else if (KEY_TOOL.equals(property)) {
return CDTPrefUtil.getBool(CDTPrefUtil.KEY_TOOLM);
} else if (KEY_PAGE.equals(property)
&& expectedValue instanceof String) {
String s = (String) expectedValue;
if (VAL_EXP.equalsIgnoreCase(s))
return CDTPrefUtil.getBool(CDTPrefUtil.KEY_EXPORT);
if (VAL_TOOL.equalsIgnoreCase(s))
return CDTPrefUtil.getBool(CDTPrefUtil.KEY_TOOLM);
}
return false;
}