mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Cosmetics.
This commit is contained in:
parent
06e1b830a8
commit
eb081d7f1f
3 changed files with 411 additions and 415 deletions
|
@ -9,7 +9,6 @@
|
|||
* Markus Schorn - initial API and implementation
|
||||
* Andrew Ferguson (Symbian)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.core.index;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ILinkage;
|
||||
|
@ -26,5 +25,5 @@ public interface IIndexLinkage extends ILinkage {
|
|||
* Empty IIndexLinkage array constant
|
||||
* @since 4.0.1
|
||||
*/
|
||||
IIndexLinkage[] EMPTY_INDEX_LINKAGE_ARRAY= new IIndexLinkage[0];
|
||||
IIndexLinkage[] EMPTY_INDEX_LINKAGE_ARRAY= {};
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* IBM Corporation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui.wizards;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
@ -64,13 +65,13 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
|||
private static final String CLASS_NAME = "class"; //$NON-NLS-1$
|
||||
public static final String DESC = "EntryDescriptor"; //$NON-NLS-1$
|
||||
|
||||
// widgets
|
||||
// Widgets
|
||||
private Tree tree;
|
||||
private Composite right;
|
||||
private Button show_sup;
|
||||
private Label right_label;
|
||||
private Button showSup;
|
||||
private Label rightLabel;
|
||||
|
||||
public CWizardHandler h_selected = null;
|
||||
public CWizardHandler h_selected;
|
||||
private Label categorySelectedLabel;
|
||||
|
||||
/**
|
||||
|
@ -83,15 +84,12 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
|||
setPageComplete(false);
|
||||
}
|
||||
|
||||
/** (non-Javadoc)
|
||||
* Method declared on IDialogPage.
|
||||
*/
|
||||
@Override
|
||||
public void createControl(Composite parent) {
|
||||
super.createControl(parent);
|
||||
|
||||
createDynamicGroup((Composite)getControl());
|
||||
switchTo(updateData(tree, right, show_sup, CDTMainWizardPage.this, getWizard()),
|
||||
switchTo(updateData(tree, right, showSup, CDTMainWizardPage.this, getWizard()),
|
||||
getDescriptor(tree));
|
||||
|
||||
setPageComplete(validatePage());
|
||||
|
@ -109,9 +107,9 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
|||
l1.setFont(parent.getFont());
|
||||
l1.setLayoutData(new GridData(GridData.BEGINNING));
|
||||
|
||||
right_label = new Label(c, SWT.NONE);
|
||||
right_label.setFont(parent.getFont());
|
||||
right_label.setLayoutData(new GridData(GridData.BEGINNING));
|
||||
rightLabel = new Label(c, SWT.NONE);
|
||||
rightLabel.setFont(parent.getFont());
|
||||
rightLabel.setLayoutData(new GridData(GridData.BEGINNING));
|
||||
|
||||
tree = new Tree(c, SWT.SINGLE | SWT.BORDER);
|
||||
tree.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
|
@ -123,8 +121,7 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
|||
switchTo((CWizardHandler)tis[0].getData(), (EntryDescriptor)tis[0].getData(DESC));
|
||||
setPageComplete(validatePage());
|
||||
}});
|
||||
tree.getAccessible().addAccessibleListener(
|
||||
new AccessibleAdapter() {
|
||||
tree.getAccessible().addAccessibleListener(new AccessibleAdapter() {
|
||||
@Override
|
||||
public void getName(AccessibleEvent e) {
|
||||
for (int i = 0; i < tree.getItemCount(); i++) {
|
||||
|
@ -132,29 +129,27 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
|||
return;
|
||||
}
|
||||
e.result = Messages.CMainWizardPage_0;
|
||||
}
|
||||
}
|
||||
);
|
||||
}});
|
||||
right = new Composite(c, SWT.NONE);
|
||||
right.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
right.setLayout(new PageLayout());
|
||||
|
||||
show_sup = new Button(c, SWT.CHECK);
|
||||
show_sup.setText(Messages.CMainWizardPage_1);
|
||||
showSup = new Button(c, SWT.CHECK);
|
||||
showSup.setText(Messages.CMainWizardPage_1);
|
||||
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||
gd.horizontalSpan = 2;
|
||||
show_sup.setLayoutData(gd);
|
||||
show_sup.addSelectionListener(new SelectionAdapter() {
|
||||
showSup.setLayoutData(gd);
|
||||
showSup.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
if (h_selected != null)
|
||||
h_selected.setSupportedOnly(show_sup.getSelection());
|
||||
switchTo(updateData(tree, right, show_sup, CDTMainWizardPage.this, getWizard()),
|
||||
h_selected.setSupportedOnly(showSup.getSelection());
|
||||
switchTo(updateData(tree, right, showSup, CDTMainWizardPage.this, getWizard()),
|
||||
getDescriptor(tree));
|
||||
}});
|
||||
|
||||
// restore settings from preferences
|
||||
show_sup.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOSUPP));
|
||||
showSup.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOSUPP));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -199,7 +194,7 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
|||
}
|
||||
}
|
||||
|
||||
if (bad) { // skip this check if project already created
|
||||
if (bad) { // Skip this check if project already created
|
||||
try {
|
||||
IFileStore fs;
|
||||
URI p = getProjectLocation();
|
||||
|
@ -228,8 +223,8 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
|||
}
|
||||
|
||||
if (!useDefaults()) {
|
||||
IStatus locationStatus = ResourcesPlugin.getWorkspace().validateProjectLocationURI(handle,
|
||||
getLocationURI());
|
||||
IStatus locationStatus =
|
||||
ResourcesPlugin.getWorkspace().validateProjectLocationURI(handle, getLocationURI());
|
||||
if (!locationStatus.isOK()) {
|
||||
setErrorMessage(locationStatus.getMessage());
|
||||
return false;
|
||||
|
@ -266,8 +261,9 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
|||
* @param wizard
|
||||
* @return : selected Wizard Handler.
|
||||
*/
|
||||
public static CWizardHandler updateData(Tree tree, Composite right, Button show_sup, IWizardItemsListListener ls, IWizard wizard) {
|
||||
// remember selected item
|
||||
public static CWizardHandler updateData(Tree tree, Composite right, Button show_sup,
|
||||
IWizardItemsListListener ls, IWizard wizard) {
|
||||
// Remember selected item
|
||||
TreeItem[] selection = tree.getSelection();
|
||||
TreeItem selectedItem = selection.length > 0 ? selection[0] : null;
|
||||
String savedLabel = selectedItem != null ? selectedItem.getText() : null;
|
||||
|
@ -292,7 +288,8 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
|||
System.out.println(Messages.CMainWizardPage_5 + e.getLocalizedMessage());
|
||||
return null;
|
||||
}
|
||||
if (w == null) return null;
|
||||
if (w == null)
|
||||
return null;
|
||||
w.setDependentControl(right, ls);
|
||||
for (EntryDescriptor ed : w.createItems(show_sup.getSelection(), wizard))
|
||||
items.add(ed);
|
||||
|
@ -301,11 +298,9 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
|||
}
|
||||
// If there is a EntryDescriptor which is default for category, make sure it
|
||||
// is in the front of the list.
|
||||
for (int i = 0; i < items.size(); ++i)
|
||||
{
|
||||
for (int i = 0; i < items.size(); ++i) {
|
||||
EntryDescriptor ed = items.get(i);
|
||||
if (ed.isDefaultForCategory())
|
||||
{
|
||||
if (ed.isDefaultForCategory()) {
|
||||
items.remove(i);
|
||||
items.add(0, ed);
|
||||
break;
|
||||
|
@ -319,15 +314,17 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
|||
|
||||
if (tree.getItemCount() > 0) {
|
||||
TreeItem target = null;
|
||||
// try to search item which was selected before
|
||||
// Try to search item which was selected before
|
||||
if (savedLabel != null) {
|
||||
target = findItem(tree, savedLabel, savedParentLabel);
|
||||
}
|
||||
if (target == null) {
|
||||
// Default selection associated with "org.eclipse.cdt.build.core.buildArtefactType.exe" project type
|
||||
target = findItem(tree, Messages.CDTMainWizardPage_DefaultProjectType, Messages.CDTMainWizardPage_DefaultProjectCategory);
|
||||
target = findItem(tree, Messages.CDTMainWizardPage_DefaultProjectType,
|
||||
Messages.CDTMainWizardPage_DefaultProjectCategory);
|
||||
if (target == null) {
|
||||
CUIPlugin.log(new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, "Default project not found in New C/C++ Project Wizard")); //$NON-NLS-1$
|
||||
CUIPlugin.log(new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID,
|
||||
"Default project not found in New C/C++ Project Wizard")); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
if (target == null) {
|
||||
|
@ -451,24 +448,23 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
|||
if (ed.isCategory()) {
|
||||
if (categorySelectedLabel == null) {
|
||||
categorySelectedLabel = new Label(right, SWT.WRAP);
|
||||
categorySelectedLabel.setText(
|
||||
Messages.CDTMainWizardPage_1);
|
||||
categorySelectedLabel.setText(Messages.CDTMainWizardPage_1);
|
||||
right.layout();
|
||||
}
|
||||
categorySelectedLabel.setVisible(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
right_label.setText(h_selected.getHeader());
|
||||
rightLabel.setText(h_selected.getHeader());
|
||||
if (categorySelectedLabel != null)
|
||||
categorySelectedLabel.setVisible(false);
|
||||
h_selected.handleSelection();
|
||||
h_selected.setSupportedOnly(show_sup.getSelection());
|
||||
h_selected.setSupportedOnly(showSup.getSelection());
|
||||
}
|
||||
|
||||
|
||||
public static EntryDescriptor getDescriptor(Tree _tree) {
|
||||
TreeItem[] sel = _tree.getSelection();
|
||||
public static EntryDescriptor getDescriptor(Tree tree) {
|
||||
TreeItem[] sel = tree.getSelection();
|
||||
if (sel == null || sel.length == 0)
|
||||
return null;
|
||||
return (EntryDescriptor)sel[0].getData(DESC);
|
||||
|
@ -481,7 +477,9 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isCurrent() { return isCurrentPage(); }
|
||||
public boolean isCurrent() {
|
||||
return isCurrentPage();
|
||||
}
|
||||
|
||||
private static Image calcImage(EntryDescriptor ed) {
|
||||
if (ed.getImage() != null) return ed.getImage();
|
||||
|
@ -495,4 +493,3 @@ import org.eclipse.cdt.internal.ui.newui.Messages;
|
|||
return items;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue