1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 09:16:02 +02:00

cleanup: removed some JavaDoc warnings plus other cosmetics

This commit is contained in:
Andrew Gvozdev 2010-03-16 16:55:34 +00:00
parent de881ce70d
commit c5bb4beda7

View file

@ -47,6 +47,8 @@ import org.eclipse.swt.widgets.TableItem;
import org.eclipse.ui.dialogs.PreferencesUtil; import org.eclipse.ui.dialogs.PreferencesUtil;
/** /**
* "Select Configurations" page of C/C++ New Project Wizard
*
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
* @noinstantiate This class is not intended to be instantiated by clients. * @noinstantiate This class is not intended to be instantiated by clients.
*/ */
@ -54,12 +56,12 @@ public class CDTConfigWizardPage extends WizardPage {
public static final String PAGE_ID = "org.eclipse.cdt.managedbuilder.ui.wizard.CConfigWizardPage"; //$NON-NLS-1$ public static final String PAGE_ID = "org.eclipse.cdt.managedbuilder.ui.wizard.CConfigWizardPage"; //$NON-NLS-1$
private static final Image IMG = ManagedBuilderUIImages.get(ManagedBuilderUIImages.IMG_BUILD_CONFIG); private static final Image IMG_CONFIG = ManagedBuilderUIImages.get(ManagedBuilderUIImages.IMG_BUILD_CONFIG);
private static final String TITLE = UIMessages.getString("CConfigWizardPage.0"); //$NON-NLS-1$ private static final String TITLE = UIMessages.getString("CConfigWizardPage.0"); //$NON-NLS-1$
private static final String MESSAGE = UIMessages.getString("CConfigWizardPage.1"); //$NON-NLS-1$ private static final String MESSAGE = UIMessages.getString("CConfigWizardPage.1"); //$NON-NLS-1$
private static final String COMMENT = UIMessages.getString("CConfigWizardPage.12"); //$NON-NLS-1$ private static final String COMMENT = UIMessages.getString("CConfigWizardPage.12"); //$NON-NLS-1$
private static final String EMPTY_STR = ""; //$NON-NLS-1$ private static final String EMPTY_STR = ""; //$NON-NLS-1$
private Table table; private Table table;
private CheckboxTableViewer tv; private CheckboxTableViewer tv;
private Label l_projtype; private Label l_projtype;
@ -74,23 +76,23 @@ public class CDTConfigWizardPage extends WizardPage {
public boolean pagesLoaded = false; public boolean pagesLoaded = false;
private IToolChain[] visitedTCs = null; private IToolChain[] visitedTCs = null;
IWizardPage[] customPages = null; IWizardPage[] customPages = null;
public CDTConfigWizardPage(MBSWizardHandler h) { public CDTConfigWizardPage(MBSWizardHandler h) {
super(UIMessages.getString("CDTConfigWizardPage.0")); //$NON-NLS-1$ super(UIMessages.getString("CDTConfigWizardPage.0")); //$NON-NLS-1$
setPageComplete(false); setPageComplete(false);
handler = h; handler = h;
setWizard(h.getWizard()); setWizard(h.getWizard());
} }
public CfgHolder[] getCfgItems(boolean getDefault) { public CfgHolder[] getCfgItems(boolean getDefault) {
CfgHolder[] its; CfgHolder[] its;
if (getDefault || table == null || !isVisited()) if (getDefault || table == null || !isVisited())
its = getDefaultCfgs(handler); its = getDefaultCfgs(handler);
else { else {
ArrayList<CfgHolder> out = new ArrayList<CfgHolder>(table.getItemCount()); ArrayList<CfgHolder> out = new ArrayList<CfgHolder>(table.getItemCount());
for (TableItem ti : table.getItems()) { for (TableItem ti : table.getItems()) {
if (ti.getChecked()) if (ti.getChecked())
out.add((CfgHolder)ti.getData()); out.add((CfgHolder)ti.getData());
} }
its = out.toArray(new CfgHolder[out.size()]); its = out.toArray(new CfgHolder[out.size()]);
} }
@ -99,14 +101,14 @@ public class CDTConfigWizardPage extends WizardPage {
public void createControl(Composite p) { public void createControl(Composite p) {
parent = new Composite(p, SWT.NONE); parent = new Composite(p, SWT.NONE);
parent.setFont(parent.getFont()); parent.setFont(parent.getFont());
parent.setLayout(new GridLayout()); parent.setLayout(new GridLayout());
parent.setLayoutData(new GridData(GridData.FILL_BOTH)); parent.setLayoutData(new GridData(GridData.FILL_BOTH));
Composite c1 = new Composite(parent, SWT.NONE); Composite c1 = new Composite(parent, SWT.NONE);
c1.setLayout(new GridLayout(2, false)); c1.setLayout(new GridLayout(2, false));
c1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); c1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
setupLabel(c1, UIMessages.getString("CConfigWizardPage.4"), GridData.BEGINNING); //$NON-NLS-1$ setupLabel(c1, UIMessages.getString("CConfigWizardPage.4"), GridData.BEGINNING); //$NON-NLS-1$
l_projtype = setupLabel(c1, EMPTY_STR, GridData.FILL_HORIZONTAL); l_projtype = setupLabel(c1, EMPTY_STR, GridData.FILL_HORIZONTAL);
setupLabel(c1, UIMessages.getString("CConfigWizardPage.5"), GridData.BEGINNING); //$NON-NLS-1$ setupLabel(c1, UIMessages.getString("CConfigWizardPage.5"), GridData.BEGINNING); //$NON-NLS-1$
@ -117,11 +119,11 @@ public class CDTConfigWizardPage extends WizardPage {
Composite c2 = new Composite(parent, SWT.NONE); Composite c2 = new Composite(parent, SWT.NONE);
c2.setLayout(new GridLayout(2, false)); c2.setLayout(new GridLayout(2, false));
c2.setLayoutData(new GridData(GridData.FILL_BOTH)); c2.setLayoutData(new GridData(GridData.FILL_BOTH));
table = new Table(c2, SWT.BORDER | SWT.CHECK | SWT.V_SCROLL); table = new Table(c2, SWT.BORDER | SWT.CHECK | SWT.V_SCROLL);
GridData gd = new GridData(GridData.FILL_BOTH); GridData gd = new GridData(GridData.FILL_BOTH);
table.setLayoutData(gd); table.setLayoutData(gd);
tv = new CheckboxTableViewer(table); tv = new CheckboxTableViewer(table);
tv.setContentProvider(new IStructuredContentProvider() { tv.setContentProvider(new IStructuredContentProvider() {
public Object[] getElements(Object inputElement) { public Object[] getElements(Object inputElement) {
@ -136,7 +138,7 @@ public class CDTConfigWizardPage extends WizardPage {
return element == null ? EMPTY_STR : ((CfgHolder)element).getName(); return element == null ? EMPTY_STR : ((CfgHolder)element).getName();
} }
@Override @Override
public Image getImage(Object element) { return IMG; } public Image getImage(Object element) { return IMG_CONFIG; }
}); });
tv.addCheckStateListener(new ICheckStateListener() { tv.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) { public void checkStateChanged(CheckStateChangedEvent event) {
@ -152,7 +154,7 @@ public class CDTConfigWizardPage extends WizardPage {
b1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); b1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
b1.addSelectionListener(new SelectionAdapter() { b1.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
tv.setAllChecked(true); tv.setAllChecked(true);
setPageComplete(isCustomPageComplete()); setPageComplete(isCustomPageComplete());
update(); update();
@ -171,7 +173,7 @@ public class CDTConfigWizardPage extends WizardPage {
// dummy placeholder // dummy placeholder
new Label(c, 0).setLayoutData(new GridData(GridData.FILL_BOTH)); new Label(c, 0).setLayoutData(new GridData(GridData.FILL_BOTH));
Button b3 = new Button(c, SWT.PUSH); Button b3 = new Button(c, SWT.PUSH);
b3.setText(UIMessages.getString("CConfigWizardPage.13")); //$NON-NLS-1$ b3.setText(UIMessages.getString("CConfigWizardPage.13")); //$NON-NLS-1$
b3.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); b3.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@ -180,39 +182,34 @@ public class CDTConfigWizardPage extends WizardPage {
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
advancedDialog(); advancedDialog();
}}); }});
Group gr = new Group(parent, SWT.NONE); Group gr = new Group(parent, SWT.NONE);
gd = new GridData(GridData.FILL_HORIZONTAL); gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2; gd.horizontalSpan = 2;
gr.setLayoutData(gd); gr.setLayoutData(gd);
gr.setLayout(new FillLayout()); gr.setLayout(new FillLayout());
Label lb = new Label(gr, SWT.NONE); Label lb = new Label(gr, SWT.NONE);
lb.setText(COMMENT); lb.setText(COMMENT);
setControl(parent); setControl(parent);
} }
/**
*
* @param handler
* @return
*/
static public CfgHolder[] getDefaultCfgs(MBSWizardHandler handler) { static public CfgHolder[] getDefaultCfgs(MBSWizardHandler handler) {
String id = handler.getPropertyId(); String id = handler.getPropertyId();
IProjectType pt = handler.getProjectType(); IProjectType pt = handler.getProjectType();
ArrayList<CfgHolder> out = new ArrayList<CfgHolder>(); ArrayList<CfgHolder> out = new ArrayList<CfgHolder>();
for (IToolChain tc : handler.getSelectedToolChains()){ for (IToolChain tc : handler.getSelectedToolChains()){
CfgHolder[] cfgs = null; CfgHolder[] cfgs = null;
if (id != null) if (id != null)
cfgs = CfgHolder.cfgs2items(ManagedBuildManager.getExtensionConfigurations(tc, MBSWizardHandler.ARTIFACT, id)); cfgs = CfgHolder.cfgs2items(ManagedBuildManager.getExtensionConfigurations(tc, MBSWizardHandler.ARTIFACT, id));
else if (pt != null) else if (pt != null)
cfgs = CfgHolder.cfgs2items(ManagedBuildManager.getExtensionConfigurations(tc, pt)); cfgs = CfgHolder.cfgs2items(ManagedBuildManager.getExtensionConfigurations(tc, pt));
else { // Create default configuration for StdProject else { // Create default configuration for StdProject
cfgs = new CfgHolder[1]; cfgs = new CfgHolder[1];
cfgs[0] = new CfgHolder(tc, null); cfgs[0] = new CfgHolder(tc, null);
} }
if (cfgs == null) return null; if (cfgs == null) return null;
for (int j=0; j<cfgs.length; j++) { for (int j=0; j<cfgs.length; j++) {
if (cfgs[j].isSystem() || (handler.supportedOnly() && !cfgs[j].isSupported())) continue; if (cfgs[j].isSystem() || (handler.supportedOnly() && !cfgs[j].isSupported())) continue;
out.add(cfgs[j]); out.add(cfgs[j]);
@ -220,68 +217,65 @@ public class CDTConfigWizardPage extends WizardPage {
} }
return out.toArray(new CfgHolder[out.size()]); return out.toArray(new CfgHolder[out.size()]);
} }
/** /**
* Checks whether we've already worked with * Checks whether we've already worked with
* given set of selected toolchains * given set of selected toolchains
* *
* @return true if toolchain(s) is the same as before * @return true if toolchain(s) is the same as before
*/ */
private boolean isVisited() { private boolean isVisited() {
if (table == null || handler == null) if (table == null || handler == null)
return false; return false;
return Arrays.equals( return Arrays.equals(
handler.getSelectedToolChains(), handler.getSelectedToolChains(),
visitedTCs); visitedTCs);
} }
/** /**
* Returns whether this page's controls currently all contain valid * Returns whether this page's controls currently all contain valid
* values. * values.
* *
* @return <code>true</code> if all controls are valid, and * @return <code>true</code> if all controls are valid, and
* <code>false</code> if at least one is invalid * <code>false</code> if at least one is invalid
*/ */
public boolean isCustomPageComplete() { public boolean isCustomPageComplete() {
if (!isVisited()) if (!isVisited())
return true; return true;
if (table.getItemCount() == 0) { if (table.getItemCount() == 0) {
errorMessage = UIMessages.getString("CConfigWizardPage.10"); //$NON-NLS-1$ errorMessage = UIMessages.getString("CConfigWizardPage.10"); //$NON-NLS-1$
message = errorMessage; message = errorMessage;
return false; return false;
} }
if (tv.getCheckedElements().length == 0) { if (tv.getCheckedElements().length == 0) {
errorMessage = UIMessages.getString("CConfigWizardPage.11"); //$NON-NLS-1$ errorMessage = UIMessages.getString("CConfigWizardPage.11"); //$NON-NLS-1$
message = errorMessage; message = errorMessage;
return false; return false;
} }
errorMessage = null; errorMessage = null;
message = MESSAGE; message = MESSAGE;
return true; return true;
} }
/** @Override
*
*/
@Override
public void setVisible(boolean visible) { public void setVisible(boolean visible) {
parent.setVisible(visible); parent.setVisible(visible);
isVisible = visible; isVisible = visible;
if (visible && handler != null && !isVisited()) { if (visible && handler != null && !isVisited()) {
tv.setInput(CfgHolder.unique(getDefaultCfgs(handler))); tv.setInput(CfgHolder.unique(getDefaultCfgs(handler)));
tv.setAllChecked(true); tv.setAllChecked(true);
String s = EMPTY_STR; String s = EMPTY_STR;
visitedTCs = handler.getSelectedToolChains(); visitedTCs = handler.getSelectedToolChains();
for (int i=0; i < visitedTCs.length; i++) { for (int i=0; i < visitedTCs.length; i++) {
s = s + ((visitedTCs[i] == null) ? s = s + ((visitedTCs[i] == null) ?
"" : //$NON-NLS-1$ "" : //$NON-NLS-1$
visitedTCs[i].getUniqueRealName()); visitedTCs[i].getUniqueRealName());
if (i < visitedTCs.length - 1) s = s + "\n"; //$NON-NLS-1$ if (i < visitedTCs.length - 1) s = s + "\n"; //$NON-NLS-1$
} }
l_chains.setText(s); l_chains.setText(s);
l_projtype.setText(handler.getName()); l_projtype.setText(handler.getName());
setPageComplete(isCustomPageComplete()); setPageComplete(isCustomPageComplete());
l_chains.getParent().pack(); l_chains.getParent().pack();
} }
@ -289,10 +283,9 @@ public class CDTConfigWizardPage extends WizardPage {
parent.getParent().layout(true, true); parent.getParent().layout(true, true);
update(); update();
} }
} }
//------------------------ private Label setupLabel(Composite c, String name, int mode) {
private Label setupLabel(Composite c, String name, int mode) {
Label l = new Label(c, SWT.WRAP); Label l = new Label(c, SWT.WRAP);
l.setText(name); l.setText(name);
GridData gd = new GridData(mode); GridData gd = new GridData(mode);
@ -319,7 +312,7 @@ public class CDTConfigWizardPage extends WizardPage {
getWizard().getContainer().updateMessage(); getWizard().getContainer().updateMessage();
getWizard().getContainer().updateTitleBar(); getWizard().getContainer().updateTitleBar();
} }
/** /**
* Edit properties * Edit properties
*/ */
@ -343,10 +336,10 @@ public class CDTConfigWizardPage extends WizardPage {
} }
} }
} }
@Override @Override
public IWizardPage getNextPage() { public IWizardPage getNextPage() {
pagesLoaded = true; pagesLoaded = true;
return MBSCustomPageManager.getNextPage(PAGE_ID); return MBSCustomPageManager.getNextPage(PAGE_ID);
} }
} }