1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 22:22: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

@ -1,22 +1,17 @@
/*******************************************************************************
* Copyright (c) 2009, 2010 Alena Laskavaia
* Copyright (c) 2009, 2010 Alena Laskavaia
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* 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,17 +22,16 @@ 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 {
addNature(project, CC_NATURE_ID, mon);
}
public static void removeCCNature(IProject project, IProgressMonitor mon) throws CoreException {
removeNature(project, CC_NATURE_ID, mon);
}
/**
* Checks to ensure that a cnature already exists,
* if not throw a CoreException. Does NOT add a default builder
@ -41,12 +40,11 @@ public class CCProjectNature extends CProjectNature {
@Override
public void configure() throws CoreException {
if (!getProject().hasNature(CProjectNature.C_NATURE_ID)){
IStatus status = new Status(IStatus.ERROR,
CCorePlugin.PLUGIN_ID,
CCorePlugin.CDT_PROJECT_NATURE_ID_MISMATCH,
IStatus status = new Status(IStatus.ERROR,
CCorePlugin.PLUGIN_ID,
CCorePlugin.CDT_PROJECT_NATURE_ID_MISMATCH,
CCorePlugin.getResourceString("CCProjectNature.exception.noNature"), null); // $NON_NLS //$NON-NLS-1$
throw new CoreException(status);
}
}
}

View file

@ -8,7 +8,7 @@
* Contributors:
* Markus Schorn - initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/
*******************************************************************************/
package org.eclipse.cdt.internal.ui.callhierarchy;
import java.util.ArrayList;
@ -40,7 +40,7 @@ import org.eclipse.cdt.internal.ui.viewsupport.AsyncTreeContentProvider;
import org.eclipse.cdt.internal.ui.viewsupport.IndexUI;
import org.eclipse.cdt.internal.ui.viewsupport.WorkingSetFilterUI;
/**
/**
* This is the content provider for the call hierarchy.
*/
public class CHContentProvider extends AsyncTreeContentProvider {
@ -80,10 +80,9 @@ public class CHContentProvider extends AsyncTreeContentProvider {
if (node.isInitializer()) {
return NO_CHILDREN;
}
} else if (node.isVariableOrEnumerator() || node.isMacro()) {
} else if (node.isVariableOrEnumerator() || node.isMacro()) {
return NO_CHILDREN;
}
}
// Allow for async computation
return null;
@ -110,7 +109,7 @@ public class CHContentProvider extends AsyncTreeContentProvider {
}
return NO_CHILDREN;
}
private Object[] asyncComputeRoot(final ICElement input) throws CoreException, InterruptedException {
IIndex index= CCorePlugin.getIndexManager().getIndex(input.getCProject(), CallHierarchyUI.INDEX_SEARCH_OPTION);
index.acquireReadLock();
@ -203,7 +202,7 @@ public class CHContentProvider extends AsyncTreeContentProvider {
}
return nodes.toArray(new CHNode[nodes.size()]);
}
private CHNode createRefbyNode(CHNode parent, ICElement element, IIndexName[] refs) throws CoreException {
ITranslationUnit tu= CModelUtil.getTranslationUnit(element);
final IIndexFile file = refs[0].getFile();
@ -247,14 +246,14 @@ public class CHContentProvider extends AsyncTreeContentProvider {
final IIndexFile file = references[0].getFile();
final long timestamp= file.getTimestamp();
final int linkageID= file.getLinkageID();
CHNode node;
if (elements.length == 1) {
node= new CHNode(parent, tu, timestamp, elements[0], linkageID);
} else {
node= new CHMultiDefNode(parent, tu, timestamp, elements, linkageID);
}
boolean readAccess= false;
boolean writeAccess= false;
for (IIndexName reference : references) {