1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2013-11-25 20:12:01 -08:00
parent 1a4e509e0d
commit ecf7d25dd9
4 changed files with 21 additions and 49 deletions

View file

@ -6,17 +6,12 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Alena Laskavaia - initial API and implementation * Alena Laskavaia - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.codan.core; package org.eclipse.cdt.codan.core;
/** /**
* Constant definitions for plug-in preferences * Constant definitions for plug-in preferences
* <p>
* <strong>EXPERIMENTAL</strong>. This class or interface has been added as part
* of a work in progress. There is no guarantee that this API will work or that
* it will remain the same.
* </p>
*/ */
public class PreferenceConstants { public class PreferenceConstants {
public static final String P_RUN_ON_BUILD = "onBuild"; //$NON-NLS-1$ public static final String P_RUN_ON_BUILD = "onBuild"; //$NON-NLS-1$

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Alena Laskavaia - initial API and implementation * Alena Laskavaia - initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.codan.internal.ui.actions; package org.eclipse.cdt.codan.internal.ui.actions;
@ -27,15 +27,10 @@ import org.eclipse.ui.IWorkbenchPart;
public class ToggleNatureAction implements IObjectActionDelegate { public class ToggleNatureAction implements IObjectActionDelegate {
private ISelection selection; private ISelection selection;
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
@Override @Override
public void run(IAction action) { public void run(IAction action) {
if (selection instanceof IStructuredSelection) { if (selection instanceof IStructuredSelection) {
for (Iterator it = ((IStructuredSelection) selection).iterator(); it.hasNext();) { for (Iterator<?> it = ((IStructuredSelection) selection).iterator(); it.hasNext();) {
Object element = it.next(); Object element = it.next();
IProject project = null; IProject project = null;
if (element instanceof IProject) { if (element instanceof IProject) {
@ -50,25 +45,11 @@ public class ToggleNatureAction implements IObjectActionDelegate {
} }
} }
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action
* .IAction, org.eclipse.jface.viewers.ISelection)
*/
@Override @Override
public void selectionChanged(IAction action, ISelection selection) { public void selectionChanged(IAction action, ISelection selection) {
this.selection = selection; this.selection = selection;
} }
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.
* action.IAction, org.eclipse.ui.IWorkbenchPart)
*/
@Override @Override
public void setActivePart(IAction action, IWorkbenchPart targetPart) { public void setActivePart(IAction action, IWorkbenchPart targetPart) {
} }
@ -90,10 +71,9 @@ public class ToggleNatureAction implements IObjectActionDelegate {
} }
/** /**
* Toggles codan nature on a project * Toggles Codan nature on a project
* *
* @param project * @param project the project to have Codan nature added or removed
* to have codan nature added or removed
*/ */
public void toggleNature(IProject project, boolean add) { public void toggleNature(IProject project, boolean add) {
try { try {
@ -102,7 +82,7 @@ public class ToggleNatureAction implements IObjectActionDelegate {
for (int i = 0; i < natures.length; ++i) { for (int i = 0; i < natures.length; ++i) {
if (CodanCorePlugin.NATURE_ID.equals(natures[i])) { if (CodanCorePlugin.NATURE_ID.equals(natures[i])) {
if (add == false) { if (add == false) {
// Remove the nature // Remove the nature.
String[] newNatures = new String[natures.length - 1]; String[] newNatures = new String[natures.length - 1];
System.arraycopy(natures, 0, newNatures, 0, i); System.arraycopy(natures, 0, newNatures, 0, i);
System.arraycopy(natures, i + 1, newNatures, i, natures.length - i - 1); System.arraycopy(natures, i + 1, newNatures, i, natures.length - i - 1);
@ -110,13 +90,13 @@ public class ToggleNatureAction implements IObjectActionDelegate {
project.setDescription(description, null); project.setDescription(description, null);
return; return;
} }
// already there no need to add // Already there, no need to add.
add = false; add = false;
break; break;
} }
} }
if (add) { if (add) {
// Add the nature // Add the nature.
String[] newNatures = new String[natures.length + 1]; String[] newNatures = new String[natures.length + 1];
System.arraycopy(natures, 0, newNatures, 0, natures.length); System.arraycopy(natures, 0, newNatures, 0, natures.length);
newNatures[natures.length] = CodanCorePlugin.NATURE_ID; newNatures[natures.length] = CodanCorePlugin.NATURE_ID;

View file

@ -22,7 +22,6 @@ import org.eclipse.core.runtime.Status;
* @noinstantiate This class is not intended to be instantiated by clients. * @noinstantiate This class is not intended to be instantiated by clients.
*/ */
public class CCProjectNature extends CProjectNature { public class CCProjectNature extends CProjectNature {
public static final String CC_NATURE_ID= CCorePlugin.PLUGIN_ID + ".ccnature"; //$NON-NLS-1$ public static final String CC_NATURE_ID= CCorePlugin.PLUGIN_ID + ".ccnature"; //$NON-NLS-1$
public static void addCCNature(IProject project, IProgressMonitor mon) throws CoreException { public static void addCCNature(IProject project, IProgressMonitor mon) throws CoreException {
@ -48,5 +47,4 @@ public class CCProjectNature extends CProjectNature {
throw new CoreException(status); throw new CoreException(status);
} }
} }
} }

View file

@ -83,7 +83,6 @@ public class CHContentProvider extends AsyncTreeContentProvider {
} else if (node.isVariableOrEnumerator() || node.isMacro()) { } else if (node.isVariableOrEnumerator() || node.isMacro()) {
return NO_CHILDREN; return NO_CHILDREN;
} }
} }
// Allow for async computation // Allow for async computation
return null; return null;