diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java
index 365d9ffeaa0..f31154aca00 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 QNX Software Systems and others.
+ * Copyright (c) 2000, 2013 QNX Software Systems and others.
* 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
@@ -12,23 +12,25 @@
*******************************************************************************/
package org.eclipse.cdt.core.model;
-import java.net.URI;
-
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
+import java.net.URI;
+
/**
* Common protocol for all elements provided by the C model.
- *
+ *
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICElement extends IAdaptable {
+ public static final ICElement[] EMPTY_ARRAY = {};
+
/**
* IResource from 10-20
- */
+ */
/**
* Constant representing a C Root workspace (IWorkspaceRoot object).
@@ -37,19 +39,19 @@ public interface ICElement extends IAdaptable {
static final int C_MODEL = 10;
/**
- * Constant representing a C project(IProject object).
+ * Constant representing a C project (IProject object).
* A C element with this type can be safely cast to ICProject
.
*/
static final int C_PROJECT = 11;
/**
- * Constant representing a folder(ICContainer object).
+ * Constant representing a folder (ICContainer object).
* A C element with this type can be safely cast to ICContainer
.
*/
static final int C_CCONTAINER = 12;
static final int C_BINARY = 14;
-
+
static final int C_ARCHIVE = 18;
/**
* Virtual container serving as a place holder.
@@ -103,7 +105,7 @@ public interface ICElement extends IAdaptable {
* struct C;
*/
static final int C_UNION_DECLARATION = 68;
-
+
/**
* Constant representing a union structure.
*/
@@ -163,14 +165,14 @@ public interface ICElement extends IAdaptable {
* a Typedef.
*/
static final int C_TYPEDEF = 80;
-
+
/**
* Enumerator.
*/
static final int C_ENUMERATOR = 81;
/**
- * C++ template class declaration without a definiton.
+ * C++ template class declaration without a definition.
*/
static final int C_TEMPLATE_CLASS_DECLARATION = 82;
@@ -232,7 +234,7 @@ public interface ICElement extends IAdaptable {
/**
* Assembly label.
- *
+ *
* @since 5.0
*/
static final int ASM_LABEL= 94;
@@ -243,21 +245,21 @@ public interface ICElement extends IAdaptable {
*/
@Deprecated
static final int C_CLASS_CTOR = 0x100;
-
+
/**
* Modifier indicating a class destructor
* @deprecated use {@link IMethodDeclaration#isDestructor()}
*/
@Deprecated
static final int C_CLASS_DTOR = 0x200;
-
+
/**
* Modifier indicating a static storage attribute
* @deprecated use {@link IDeclaration#isStatic()}
*/
@Deprecated
static final int C_STORAGE_STATIC = 0x400;
-
+
/**
* Modifier indicating an extern storage attribute
* @deprecated not used anymore
@@ -351,19 +353,19 @@ public interface ICElement extends IAdaptable {
ICElement getParent();
/**
- * Returns the path to the innermost resource enclosing this element.
- * If this element is not included in an external archive,
- * the path returned is the full, absolute path to the underlying resource,
- * relative to the workbench.
- * If this element is included in an external archive,
+ * Returns the path to the innermost resource enclosing this element.
+ * If this element is not included in an external archive,
+ * the path returned is the full, absolute path to the underlying resource,
+ * relative to the workbench.
+ * If this element is included in an external archive,
* the path returned is the absolute path to the archive in the file system.
* This is a handle-only method.
*/
IPath getPath();
-
+
/**
* Returns an absolute URI corresponding to the innermost file enclosing this element.
- *
+ *
* @since 5.0
* @return the URI corresponding to the location
*/
@@ -389,7 +391,7 @@ public interface ICElement extends IAdaptable {
/**
* Returns whether this C element is read-only. An element is read-only
- * if its structure cannot be modified by the C model.
+ * if its structure cannot be modified by the C model.
*
* @return {@code true} if this element is read-only
*/
@@ -409,15 +411,15 @@ public interface ICElement extends IAdaptable {
* exception occurs while accessing its corresponding resource
*/
boolean isStructureKnown() throws CModelException;
-
+
/**
* Accept a visitor and walk the ICElement tree with it.
- *
+ *
* @param visitor
* @throws CModelException
*/
void accept(ICElementVisitor visitor) throws CoreException;
-
+
/**
* Returns a string representation of this element handle. The format of the
* string is not specified; however, the identifier is stable across
@@ -426,11 +428,10 @@ public interface ICElement extends IAdaptable {
*
* Some element types, like binaries, do not support handle identifiers and * return {@code null}. - *
- * + * * @return the string handle identifier, or {@code null} if the element type is not supported * @see CoreModel#create(java.lang.String) - * + * * @since 5.0 */ String getHandleIdentifier(); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java index 1e795615de8..12e108ec359 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/BaseCElementContentProvider.java @@ -657,7 +657,7 @@ public class BaseCElementContentProvider implements ITreeContentProvider { binaries = getBinaries(cproject); archives = getArchives(cproject); } catch (CModelException e) { - archives = binaries = new ICElement[0]; + archives = binaries = ICElement.EMPTY_ARRAY; } ISourceRoot[] roots = null; try { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/SelectionConverter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/SelectionConverter.java index 2e1d8990bbc..ad4ce4eba39 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/SelectionConverter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/SelectionConverter.java @@ -10,7 +10,6 @@ * Anton Leherbauer (Wind River Systems) * Markus Schorn (Wind River Systems) *******************************************************************************/ - package org.eclipse.cdt.internal.ui.actions; import java.util.ArrayList; @@ -42,9 +41,6 @@ import org.eclipse.cdt.internal.ui.editor.CEditor; import org.eclipse.cdt.internal.ui.util.ExceptionHandler; public class SelectionConverter { - - protected static final ICElement[] EMPTY_RESULT= new ICElement[0]; - /** * Converts the selection provided by the given part into a structured selection. * The following conversion rules are used: @@ -70,7 +66,7 @@ public class SelectionConverter { /** * Converts objects of a structured selection to c elements if possible. - * This is a convenience method, fully equivalent to + * This is a convenience method, fully equivalent to *convertSelectionToCElements(s, false)
.
* @param s The structured selection
* @return The converted selection
@@ -148,7 +144,7 @@ public class SelectionConverter {
/**
* Returns the selection adapted to IResource. Returns null if any of the
* entries are not adaptable.
- *
+ *
* @param selection
* the selection
* @param resourceMask
@@ -232,7 +228,7 @@ public class SelectionConverter {
/**
* Returns whether the type of the given resource is among the specified
* resource types.
- *
+ *
* @param resource
* the resource
* @param resourceMask
@@ -282,12 +278,12 @@ public class SelectionConverter {
}
}
}
- return EMPTY_RESULT;
+ return ICElement.EMPTY_ARRAY;
}
-
+
/**
* Converts the text selection provided by the given editor a Java element by
- * asking the user if code reolve returned more than one result. If the selection
+ * asking the user if code resolve returned more than one result. If the selection
* doesn't cover a Java element null
is returned.
*/
public static ICElement codeResolve(CEditor editor, Shell shell, String title, String message) throws CModelException {
@@ -300,7 +296,6 @@ public class SelectionConverter {
}
return candidate;
}
-
/**
* Converts the text selection provided by the given editor into an array of
@@ -325,11 +320,10 @@ public class SelectionConverter {
}
return null;
}
-
+
public static boolean canOperateOn(CEditor editor) {
if (editor == null)
return false;
return getInput(editor) != null;
-
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CallHierarchyUI.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CallHierarchyUI.java
index 7e3ca9fe5d6..e6b5f6272d7 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CallHierarchyUI.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CallHierarchyUI.java
@@ -70,10 +70,10 @@ public class CallHierarchyUI {
*/
private static Listnull
if none found
*/
@@ -417,16 +417,16 @@ public class CallHierarchyUI {
}
return null;
}
-
+
static public ICElement[] getHistoryEntries() {
return fHistoryEntries.toArray(new ICElement[fHistoryEntries.size()]);
}
-
+
static public void setHistoryEntries(ICElement[] remaining) {
fHistoryEntries.clear();
fHistoryEntries.addAll(Arrays.asList(remaining));
}
-
+
static public void updateHistory(ICElement input) {
if (input != null) {
fHistoryEntries.remove(input);
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/FindInWorkingSetAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/FindInWorkingSetAction.java
index b5d8c712016..dfb22b4639a 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/FindInWorkingSetAction.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/FindInWorkingSetAction.java
@@ -7,7 +7,7 @@
*
* Contributors:
* Markus Schorn - initial API and implementation
- *******************************************************************************/
+ *******************************************************************************/
package org.eclipse.cdt.internal.ui.search.actions;
import java.util.ArrayList;
@@ -29,24 +29,24 @@ import org.eclipse.cdt.internal.ui.search.CSearchUtil;
import org.eclipse.cdt.internal.ui.util.Messages;
public abstract class FindInWorkingSetAction extends FindAction {
-
+
private IWorkingSet[] fWorkingSets;
private String scopeDescription = ""; //$NON-NLS-1$
-
+
public FindInWorkingSetAction(CEditor editor, String label, String tooltip, IWorkingSet[] workingSets) {
super(editor);
- setText(label);
- setToolTipText(tooltip);
+ setText(label);
+ setToolTipText(tooltip);
fWorkingSets = workingSets;
}
-
+
public FindInWorkingSetAction(IWorkbenchSite site, String label, String tooltip, IWorkingSet[] workingSets){
super(site);
- setText(label);
- setToolTipText(tooltip);
+ setText(label);
+ setToolTipText(tooltip);
fWorkingSets= workingSets;
}
-
+
@Override
final public void run() {
IWorkingSet[] initial= fWorkingSets;
@@ -54,7 +54,7 @@ public abstract class FindInWorkingSetAction extends FindAction {
fWorkingSets= askForWorkingSets();
}
if (fWorkingSets != null) {
- scopeDescription = Messages.format(CSearchMessages.WorkingSetScope, CSearchUtil.toString(fWorkingSets));
+ scopeDescription = Messages.format(CSearchMessages.WorkingSetScope, CSearchUtil.toString(fWorkingSets));
super.run();
}
fWorkingSets= initial;
@@ -68,7 +68,7 @@ public abstract class FindInWorkingSetAction extends FindAction {
@Override
final protected ICElement[] getScope() {
if (fWorkingSets == null) {
- return new ICElement[0];
+ return ICElement.EMPTY_ARRAY;
}
List