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