From ecf7d25dd9a3059809d7ecf19a0bcdb562604382 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Mon, 25 Nov 2013 20:12:01 -0800 Subject: [PATCH] Cosmetics. --- .../cdt/codan/core/PreferenceConstants.java | 9 ++--- .../ui/actions/ToggleNatureAction.java | 34 ++++--------------- .../org/eclipse/cdt/core/CCProjectNature.java | 12 +++---- .../ui/callhierarchy/CHContentProvider.java | 15 ++++---- 4 files changed, 21 insertions(+), 49 deletions(-) diff --git a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/PreferenceConstants.java b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/PreferenceConstants.java index c730e9e1380..6f887d3e020 100644 --- a/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/PreferenceConstants.java +++ b/codan/org.eclipse.cdt.codan.core/src/org/eclipse/cdt/codan/core/PreferenceConstants.java @@ -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 - *

- * EXPERIMENTAL. 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. - *

*/ public class PreferenceConstants { public static final String P_RUN_ON_BUILD = "onBuild"; //$NON-NLS-1$ diff --git a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/ToggleNatureAction.java b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/ToggleNatureAction.java index fbe2f12b6ba..9a29c25fa9a 100644 --- a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/ToggleNatureAction.java +++ b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/actions/ToggleNatureAction.java @@ -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; diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCProjectNature.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCProjectNature.java index 4d940197f49..1bbfb893259 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCProjectNature.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCProjectNature.java @@ -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); } } - } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java index 5d9d6b37cc2..ec5b4319a8a 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHContentProvider.java @@ -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) {