1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 14:15:23 +02:00

Bug #220011 : Manged Project Properties: Path and symbols - UI inconsitencies

This commit is contained in:
Oleg Krasilnikov 2008-02-26 17:57:29 +00:00
parent 0da7636b1b
commit 41becf515a
8 changed files with 121 additions and 86 deletions

View file

@ -49,7 +49,7 @@ CDTExpPathSymbolsProperty.name=Export settings
CDTBuildProperty.name=Settings
CDTToolchainProperty.name=Tool chain editor
CDTVariablesProperty.name=Variables
Discovery.options=Discovery options
Discovery.options=Discovery Options
Environment=Environment
BuildCfgMenu.label=Build configurations
@ -64,26 +64,26 @@ WizardConvertMakeProject.name=Convert to a C/C++ Make Project
WizardConvertMakeProject.name1=Convert to a C/C++ Make Project1
WizardConvertMakeProject.description=Convert to a C/C++ Project which uses a simple makefile
Tool.settings=Tool settings
Build.steps=Build steps
Build.artifact=Build artifact
Builder.settings=Builder settings
Tool.settings=Tool Settings
Build.steps=Build Steps
Build.artifact=Build Artifact
Builder.settings=Builder Settings
WBB.settings=Behaviour
Includes=Includes
Symbols=Symbols
Libraries=Libraries
Library.paths=Library paths
Library.paths=Library Paths
References=References
Source.location=Source location
Output.location=Output location
Binary.parsers=Binary parsers
Error.parsers=Error parsers
Data.hierarchy=Data hierarchy
Preferred.toolchains=Preferred toolchains
Wizard.defaults=Wizard defaults
PropertyPage.defaults=Property page settings
Source.location=Source Location
Output.location=Output Location
Binary.parsers=Binary Parsers
Error.parsers=Error Parsers
Data.hierarchy=Data Hierarchy
Preferred.toolchains=Preferred Toolchains
Wizard.defaults=Wizard Defaults
PropertyPage.defaults=Property Page Settings
MBSPerProjectProfile.name=Managed Build System - per project scanner info profile
multicfg=Multiple configurations edit
multicfg=Multiple Configurations Edit
# menu labels
Configurations.menu=Build Configurations

View file

@ -28,6 +28,8 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.PaintEvent;
@ -45,6 +47,7 @@ import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.TreeItem;
@ -76,6 +79,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
protected boolean toAllCfgs = false;
protected boolean toAllLang = false;
protected Label lb1, lb2;
protected TableColumn columnToFit = null;
protected ICLanguageSetting lang;
protected LinkedList<ICLanguageSettingEntry> incs;
@ -116,7 +120,7 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 255;
table.setLayoutData(gd);
table.setHeaderVisible(true);
table.setHeaderVisible(isHeaderVisible());
table.setLinesVisible(true);
sashForm.setWeights(DEFAULT_SASH_WEIGHTS);
@ -163,6 +167,15 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
buttonPressed(1);
}
});
table.addControlListener(new ControlListener() {
public void controlMoved(ControlEvent e) {
setColumnToFit();
}
public void controlResized(ControlEvent e) {
setColumnToFit();
}});
setupLabel(usercomp, EMPTY_STR, 1, 0);
lb1 = new Label(usercomp, SWT.BORDER | SWT.CENTER);
@ -698,4 +711,13 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
return se;
}
protected boolean isHeaderVisible() {
return true;
}
protected void setColumnToFit() {
if (columnToFit != null)
columnToFit.setWidth(table.getBounds().width - 4);
}
}

View file

@ -183,7 +183,12 @@ public abstract class CLocationTab extends AbstractCPropertyTab {
break;
// create / link
case 1:
NewFolderDialog d = new NewFolderDialog(shell, page.getProject());
NewFolderDialog d = new NewFolderDialog(shell, page.getProject()) {
public void create() {
super.create();
handleAdvancedButtonSelect();
}
};
if (d.open() == Window.OK) {
IFolder f = (IFolder)d.getFirstResult();
src.add(new _Entry(newEntry(f, new IPath[0], !f.isLinked())));

View file

@ -12,8 +12,6 @@
package org.eclipse.cdt.ui.newui;
import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
@ -23,16 +21,8 @@ import org.eclipse.cdt.core.settings.model.ICSettingEntry;
public class IncludeTab extends AbstractLangsListTab {
public void additionalTableSet() {
TableColumn c = new TableColumn(table, SWT.NONE);
c.setWidth(210);
c.setText(UIMessages.getString("IncludeTab.0")); //$NON-NLS-1$
table.getAccessible().addAccessibleListener(
new AccessibleAdapter() {
public void getName(AccessibleEvent e) {
e.result = UIMessages.getString("IncludeTab.0"); //$NON-NLS-1$
}
}
);
columnToFit = new TableColumn(table, SWT.NONE);
columnToFit.setText(UIMessages.getString("IncludeTab.0")); //$NON-NLS-1$
showBIButton.setSelection(true);
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others.
* Copyright (c) 2007, 2008 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
@ -12,8 +12,6 @@
package org.eclipse.cdt.ui.newui;
import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.TableColumn;
@ -29,21 +27,11 @@ public class LibraryPathTab extends AbstractLangsListTab implements IPathEntrySt
private static final int[] PRIVATE_SASH_WEIGHTS = new int[] { 0, 30 };
public void additionalTableSet() {
TableColumn c = new TableColumn(table, SWT.NONE);
c.setWidth(300);
c.setText(UIMessages.getString("LibraryPathTab.0")); //$NON-NLS-1$
table.getAccessible().addAccessibleListener(
new AccessibleAdapter() {
public void getName(AccessibleEvent e) {
e.result = UIMessages.getString("LibraryPathTab.0"); //$NON-NLS-1$
}
}
);
columnToFit = new TableColumn(table, SWT.NONE);
}
public void createControls(Composite parent) {
super.createControls(parent);
// ((GridData)langTree.getLayoutData()).widthHint = 0;
sashForm.setWeights(PRIVATE_SASH_WEIGHTS);
langTree.setVisible(false);
}
@ -81,5 +69,11 @@ public class LibraryPathTab extends AbstractLangsListTab implements IPathEntrySt
return null;
}
public int getKind() { return ICSettingEntry.LIBRARY_PATH; }
public int getKind() {
return ICSettingEntry.LIBRARY_PATH;
}
protected boolean isHeaderVisible() {
return false;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 Intel Corporation and others.
* Copyright (c) 2007, 2008 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
@ -26,14 +26,11 @@ public class LibraryTab extends AbstractLangsListTab implements IPathEntryStoreL
private static final int[] PRIVATE_SASH_WEIGHTS = new int[] { 0, 30 };
public void additionalTableSet() {
TableColumn c = new TableColumn(table, SWT.NONE);
c.setWidth(300);
c.setText(UIMessages.getString("LibraryTab.0")); //$NON-NLS-1$
columnToFit = new TableColumn(table, SWT.NONE);
}
public void createControls(Composite parent) {
super.createControls(parent);
// ((GridData)langTree.getLayoutData()).widthHint = 0;
sashForm.setWeights(PRIVATE_SASH_WEIGHTS);
langTree.setVisible(false);
}
@ -71,8 +68,13 @@ public class LibraryTab extends AbstractLangsListTab implements IPathEntryStoreL
return null;
}
public int getKind() { return ICSettingEntry.LIBRARY_FILE; }
public int getKind() {
return ICSettingEntry.LIBRARY_FILE;
}
protected boolean isHeaderVisible() {
return false;
}
}

View file

@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2000, 2007 IBM Corporation and others.
# Copyright (c) 2000, 2008 IBM 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
@ -303,9 +303,9 @@ BuildToolSettingsPage.tool.commandLinePattern=Command\nline pattern:
BuildToolSettingsPage.tool.advancedSettings=Expert settings:
# ----------- File List Control -----------
FileListControl.add=Add
FileListControl.add=Add...
FileListControl.delete=Delete
FileListControl.edit=Edit
FileListControl.edit=Edit...
FileListControl.moveup=Move Up
FileListControl.movedown=Move Down
FileListControl.filedialog.title=Select File
@ -427,16 +427,16 @@ AbstractLangsListTab.4=Unexport
AbstractPrefPage.0=\ Preference settings will be applied to new projects \n only when there were no toolchains selected.
AbstractExportTab.0=[All]
AbstractExportTab.1=[List]
AbstractExportTab.2=Create
AbstractExportTab.3=Edit
AbstractExportTab.2=Create...
AbstractExportTab.3=Edit...
CLocationTab.0=Filter (empty)
CLocationTab.1=Filter (
CLocationTab.2=,
CLocationTab.3=)
CLocationTab.4=Add workspace folder
CLocationTab.5=Create / link folder
CLocationTab.6=Edit filter data
CLocationTab.7=Delete folder
CLocationTab.4=Add Folder...
CLocationTab.5=Link Folder...
CLocationTab.6=Edit Filter...
CLocationTab.7=Delete
CLocationSourceTab.0=Source folders on build path:
CLocationOutputTab.0=Output folders on build path:
EnvDialog.0=Name:
@ -475,15 +475,12 @@ IncludeDialog.2=Add to all configurations
IncludeDialog.3=Add to all languages
LanguagesTab.0=Content type
LanguagesTab.1=Language
LibraryPathTab.0=Library paths
LibraryPathTab.1=Add library path
LibraryPathTab.2=Change library path
LibraryTab.0=Libraries
LibraryTab.1=Add library
LibraryTab.2=Change library name
RefsTab.0=Expand all
RefsTab.1=Expand selected
RefsTab.2=Collapse all
LibraryPathTab.1=Add...
LibraryPathTab.2=Edit...
LibraryTab.1=Add...
LibraryTab.2=Edit...
RefsTab.0=Expand All
RefsTab.2=Collapse All
RefsTab.3=Active
RefsTab.4=Projects list
SymbolTab.0=Symbol

View file

@ -15,12 +15,13 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.TreeEvent;
import org.eclipse.swt.events.TreeListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@ -32,15 +33,14 @@ import org.eclipse.cdt.core.settings.model.ICResourceDescription;
public class RefsTab extends AbstractCPropertyTab {
TreeViewer tv;
public Composite comp;
Tree tree;
private Tree tree;
static private final String ACTIVE = "[" + UIMessages.getString("RefsTab.3") + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
public void createControls(Composite parent) {
super.createControls(parent);
initButtons(new String[] {UIMessages.getString("RefsTab.0"), UIMessages.getString("RefsTab.1"), UIMessages.getString("RefsTab.2")}, 120); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
initButtons(new String[] {UIMessages.getString("RefsTab.0"), UIMessages.getString("RefsTab.2")}, 120); //$NON-NLS-1$ //$NON-NLS-2$
usercomp.setLayout(new GridLayout(1, false));
tree = new Tree(usercomp, SWT.SINGLE | SWT.CHECK | SWT.BORDER);
@ -84,12 +84,26 @@ public class RefsTab extends AbstractCPropertyTab {
parent.setChecked(false);
}
}
saveChecked();
}
updateButtons();
}
});
tree.addTreeListener(new TreeListener() {
public void treeCollapsed(TreeEvent e) {
updateButtons(e, false, true);
}
public void treeExpanded(TreeEvent e) {
updateButtons(e, true, false);
}});
}
// Class which represents "Active" configuration
class ActiveCfg {
IProject project;
@ -102,20 +116,11 @@ public class RefsTab extends AbstractCPropertyTab {
}
public void buttonPressed(int n) {
TreeItem[] items = tree.getItems();
switch (n) {
case 0: // expand
case 1: // expand selected
case 2: // collapse
for (int i=0; i<items.length; i++)
items[i].setExpanded(n==0 || (n==1 && items[i].getChecked()));
break;
default:
break;
}
for (TreeItem item : tree.getItems())
item.setExpanded(n==0);
}
public void updateData(ICResourceDescription cfgd) {
protected void updateData(ICResourceDescription cfgd) {
if (page.isMultiCfg()) {
setAllVisible(false, null);
} else {
@ -149,7 +154,7 @@ public class RefsTab extends AbstractCPropertyTab {
getResDesc().getConfiguration().setReferenceInfo(refs);
}
public void initData() {
private void initData() {
tree.removeAll();
IProject p = page.getProject();
if (p == null) return;
@ -190,6 +195,7 @@ public class RefsTab extends AbstractCPropertyTab {
}
}
}
updateButtons();
}
protected void performApply(ICResourceDescription src, ICResourceDescription dst) {
@ -205,6 +211,25 @@ public class RefsTab extends AbstractCPropertyTab {
getResDesc().getConfiguration().setReferenceInfo(new HashMap<String, String>());
initData();
}
protected void updateButtons() {} // Do nothing. No buttons to update.
protected void updateButtons() {
updateButtons(null, false, false);
}
private void updateButtons(TreeEvent e, boolean stateE, boolean stateC) {
boolean cntE = stateE;
boolean cntC = stateC;
for (TreeItem item : tree.getItems()) {
if (e != null && e.widget.equals(item))
continue;
if (item.getExpanded())
cntE = true;
else
cntC = true;
}
buttonSetEnabled(0, cntC); // Expand All
buttonSetEnabled(1, cntE); // Collapse all
}
}