1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 06:32:10 +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
*
* Contributors:
* Alena Laskavaia - initial API and implementation
* Alena Laskavaia - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.core;
/**
* 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 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
*
* Contributors:
* Alena Laskavaia - initial API and implementation
* Alena Laskavaia - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.ui.actions;
@ -27,15 +27,10 @@ import org.eclipse.ui.IWorkbenchPart;
public class ToggleNatureAction implements IObjectActionDelegate {
private ISelection selection;
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
@Override
public void run(IAction action) {
if (selection instanceof IStructuredSelection) {
for (Iterator it = ((IStructuredSelection) selection).iterator(); it.hasNext();) {
for (Iterator<?> it = ((IStructuredSelection) selection).iterator(); it.hasNext();) {
Object element = it.next();
IProject project = null;
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
public void selectionChanged(IAction action, ISelection selection) {
this.selection = selection;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.
* action.IAction, org.eclipse.ui.IWorkbenchPart)
*/
@Override
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
* to have codan nature added or removed
* @param project the project to have Codan nature added or removed
*/
public void toggleNature(IProject project, boolean add) {
try {
@ -102,7 +82,7 @@ public class ToggleNatureAction implements IObjectActionDelegate {
for (int i = 0; i < natures.length; ++i) {
if (CodanCorePlugin.NATURE_ID.equals(natures[i])) {
if (add == false) {
// Remove the nature
// Remove the nature.
String[] newNatures = new String[natures.length - 1];
System.arraycopy(natures, 0, newNatures, 0, i);
System.arraycopy(natures, i + 1, newNatures, i, natures.length - i - 1);
@ -110,13 +90,13 @@ public class ToggleNatureAction implements IObjectActionDelegate {
project.setDescription(description, null);
return;
}
// already there no need to add
// Already there, no need to add.
add = false;
break;
}
}
if (add) {
// Add the nature
// Add the nature.
String[] newNatures = new String[natures.length + 1];
System.arraycopy(natures, 0, newNatures, 0, natures.length);
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.
*/
public class CCProjectNature extends CProjectNature {
public static final String CC_NATURE_ID= CCorePlugin.PLUGIN_ID + ".ccnature"; //$NON-NLS-1$
public static void addCCNature(IProject project, IProgressMonitor mon) throws CoreException {
@ -48,5 +47,4 @@ public class CCProjectNature extends CProjectNature {
throw new CoreException(status);
}
}
}

View file

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