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

Minor UI changes (resize etc)

This commit is contained in:
Oleg Krasilnikov 2007-03-06 14:21:28 +00:00
parent 95588188c0
commit 6fc614e9d8
6 changed files with 56 additions and 8 deletions

View file

@ -91,7 +91,7 @@ public class ChangeBuildConfigActionBase {
for (; i < cfgDescs.length; i++) {
if (cfgDescs[i].getName().equals(sName)) {
String sNewDesc = cfgDescs[i].getDescription();
if (sNewDesc.equals("")) { //$NON-NLS-1$
if (sNewDesc != null && sNewDesc.length() == 0) {
sNewDesc = null;
}
if (commonDesc) {

View file

@ -24,16 +24,20 @@ import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
@ -64,22 +68,58 @@ public abstract class AbstractLangsListTab extends AbstractCPropertyTab {
protected ICLanguageSetting lang;
protected List incs;
protected List exported;
protected SashForm sashForm;
private final static Image IMG_FS = CPluginImages.get(CPluginImages.IMG_FILESYSTEM);
private final static Image IMG_WS = CPluginImages.get(CPluginImages.IMG_WORKSPACE);
private final static Image IMG_MK = CPluginImages.get(CPluginImages.IMG_OBJS_MACRO);
private static final int[] DEFAULT_SASH_WEIGHTS = new int[] { 10, 30 };
public void createControls(Composite parent) {
super.createControls(parent);
usercomp.setLayout(new GridLayout(2, false));
addTree(usercomp).setLayoutData(new GridData(GridData.FILL_VERTICAL));
table = new Table(usercomp, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL | SWT.FULL_SELECTION);
usercomp.setLayout(new GridLayout(1, false));
// Create the sash form
sashForm = new SashForm(usercomp, SWT.NONE);
sashForm.setOrientation(SWT.HORIZONTAL);
sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.marginHeight = 5;
sashForm.setLayout(layout);
addTree(sashForm).setLayoutData(new GridData(GridData.FILL_VERTICAL));
table = new Table(sashForm, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL | SWT.FULL_SELECTION);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 255;
table.setLayoutData(gd);
table.setHeaderVisible(true);
table.setLinesVisible(true);
sashForm.setWeights(DEFAULT_SASH_WEIGHTS);
sashForm.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
if (event.detail == SWT.DRAG) return;
int shift = event.x - sashForm.getBounds().x;
GridData data = (GridData) langTree.getLayoutData();
if ((data.widthHint + shift) < 20) return;
Point computedSize = usercomp.getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
Point currentSize = usercomp.getShell().getSize();
boolean customSize = !computedSize.equals(currentSize);
data.widthHint = data.widthHint;
sashForm.layout(true);
computedSize = usercomp.getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
if (customSize)
computedSize.x = Math.max(computedSize.x, currentSize.x);
computedSize.y = Math.max(computedSize.y, currentSize.y);
if (computedSize.equals(currentSize)) {
return;
}
}
});
tv = new TableViewer(table);
tv.setContentProvider(new IStructuredContentProvider() {

View file

@ -404,6 +404,7 @@ implements
*/
public boolean performOk() {
if (doneOK || noContentOnPage || !displayedConfig) return true;
forEach(ICPropertyTab.OK, null);
doneOK = true; // further pages need not to do anything
try {
CoreModel.getDefault().setProjectDescription(getProject(), prjd);
@ -555,13 +556,17 @@ implements
* @param p - project to check
* @returns true if it's new-style project.
*/
public boolean isCDTProject(IProject p) {
public static boolean isCDTPrj(IProject p) {
ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(p, false);
if (prjd == null) return false;
ICConfigurationDescription[] cfgs = prjd.getConfigurations();
return (cfgs != null && cfgs.length > 0);
}
public boolean isCDTProject(IProject p) {
return isCDTPrj(p);
}
public ICResourceDescription getResDesc() {
if (resd == null) {
if (cfgDescs == null) {

View file

@ -13,7 +13,6 @@ package org.eclipse.cdt.ui.newui;
//import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;

View file

@ -24,6 +24,7 @@ import org.eclipse.cdt.core.settings.model.ICSettingEntry;
public class LibraryPathTab extends AbstractLangsListTab implements IPathEntryStoreListener {
IPathEntryStore fStore;
private static final int[] PRIVATE_SASH_WEIGHTS = new int[] { 0, 30 };
public void additionalTableSet() {
TableColumn c = new TableColumn(table, SWT.NONE);
@ -33,7 +34,8 @@ public class LibraryPathTab extends AbstractLangsListTab implements IPathEntrySt
public void createControls(Composite parent) {
super.createControls(parent);
((GridData)langTree.getLayoutData()).widthHint = 0;
// ((GridData)langTree.getLayoutData()).widthHint = 0;
sashForm.setWeights(PRIVATE_SASH_WEIGHTS);
langTree.setVisible(false);
}

View file

@ -24,6 +24,7 @@ import org.eclipse.cdt.core.settings.model.ICSettingEntry;
public class LibraryTab extends AbstractLangsListTab implements IPathEntryStoreListener {
IPathEntryStore fStore;
private static final int[] PRIVATE_SASH_WEIGHTS = new int[] { 0, 30 };
public void additionalTableSet() {
TableColumn c = new TableColumn(table, SWT.NONE);
@ -33,7 +34,8 @@ public class LibraryTab extends AbstractLangsListTab implements IPathEntryStoreL
public void createControls(Composite parent) {
super.createControls(parent);
((GridData)langTree.getLayoutData()).widthHint = 0;
// ((GridData)langTree.getLayoutData()).widthHint = 0;
sashForm.setWeights(PRIVATE_SASH_WEIGHTS);
langTree.setVisible(false);
}