mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
Fix warnings.
This commit is contained in:
parent
20c0777806
commit
a4274e1467
99 changed files with 1081 additions and 1286 deletions
|
@ -50,13 +50,13 @@ public interface ITranslationUnit extends ICElement, IParent, IOpenable, ISource
|
|||
/**
|
||||
* Style constant for {@link #getAST(IIndex, int)}.
|
||||
* Meaning: Skip headers even if they are not found in the index.
|
||||
* Makes practically only sense in combination with {@link AST_SKIP_INDEXED_HEADERS}.
|
||||
* Makes practically only sense in combination with {@link #AST_SKIP_INDEXED_HEADERS}.
|
||||
*/
|
||||
public static final int AST_SKIP_NONINDEXED_HEADERS = 4;
|
||||
|
||||
/**
|
||||
* Style constant for {@link #getAST(IIndex, int)}.
|
||||
* A combination of {@link AST_SKIP_INDEXED_HEADERS} and {@link AST_SKIP_NONINDEXED_HEADERS}.
|
||||
* A combination of {@link #AST_SKIP_INDEXED_HEADERS} and {@link #AST_SKIP_NONINDEXED_HEADERS}.
|
||||
* Meaning: Don't parse header files at all, be they indexed or not.
|
||||
* Macro definitions and bindings are taken from the index if available.
|
||||
*/
|
||||
|
@ -376,22 +376,17 @@ public interface ITranslationUnit extends ICElement, IParent, IOpenable, ISource
|
|||
boolean isSourceUnit();
|
||||
|
||||
/**
|
||||
* True if the code is C
|
||||
* @return
|
||||
* Returns <code>true</code> if the code is C
|
||||
*/
|
||||
boolean isCLanguage();
|
||||
|
||||
/**
|
||||
* True if the code is C++
|
||||
*
|
||||
* @return
|
||||
* Returns <code>true</code> if the code is C++
|
||||
*/
|
||||
boolean isCXXLanguage();
|
||||
|
||||
/**
|
||||
* True if assembly
|
||||
*
|
||||
* @return
|
||||
* Returns <code>true</code> if the code is assembly
|
||||
*/
|
||||
boolean isASMLanguage();
|
||||
|
||||
|
@ -426,12 +421,10 @@ public interface ITranslationUnit extends ICElement, IParent, IOpenable, ISource
|
|||
* be removed from the interface.
|
||||
*/
|
||||
@Deprecated
|
||||
Map parse();
|
||||
Map<?,?> parse();
|
||||
|
||||
/**
|
||||
* Return the language for this translation unit.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ILanguage getLanguage() throws CoreException;
|
||||
|
||||
|
@ -497,12 +490,6 @@ public interface ITranslationUnit extends ICElement, IParent, IOpenable, ISource
|
|||
|
||||
/**
|
||||
* Return the completion node using the given index and parsing style at the given offset.
|
||||
*
|
||||
* @param index
|
||||
* @param style
|
||||
* @param offset
|
||||
* @return
|
||||
* @throws CoreException
|
||||
*/
|
||||
public IASTCompletionNode getCompletionNode(IIndex index, int style, int offset) throws CoreException;
|
||||
}
|
||||
|
|
|
@ -12,16 +12,13 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
|||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||
import org.eclipse.cdt.internal.ui.util.SelectionUtil;
|
||||
import org.eclipse.cdt.internal.ui.viewsupport.ListContentProvider;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.dialogs.IDialogSettings;
|
||||
import org.eclipse.jface.viewers.DoubleClickEvent;
|
||||
import org.eclipse.jface.viewers.IDoubleClickListener;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
|
@ -31,6 +28,11 @@ import org.eclipse.swt.SWT;
|
|||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||
import org.eclipse.cdt.internal.ui.viewsupport.ListContentProvider;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class CPathContainerSelectionPage extends WizardPage {
|
||||
|
@ -128,7 +130,11 @@ public class CPathContainerSelectionPage extends WizardPage {
|
|||
public IContainerDescriptor getSelected() {
|
||||
if (fListViewer != null) {
|
||||
ISelection selection= fListViewer.getSelection();
|
||||
return (IContainerDescriptor) SelectionUtil.getSingleElement(selection);
|
||||
if (selection instanceof IStructuredSelection) {
|
||||
IStructuredSelection ss = (IStructuredSelection) selection;
|
||||
if (ss.size() == 1)
|
||||
return (IContainerDescriptor) ss.getFirstElement();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -14,18 +14,9 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.IContainerEntry;
|
||||
import org.eclipse.cdt.core.model.IPathEntry;
|
||||
import org.eclipse.cdt.core.model.IProjectEntry;
|
||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||
import org.eclipse.cdt.internal.ui.util.SelectionUtil;
|
||||
import org.eclipse.cdt.internal.ui.viewsupport.ListContentProvider;
|
||||
import org.eclipse.cdt.ui.wizards.IPathEntryContainerPage;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
|
@ -39,6 +30,17 @@ import org.eclipse.swt.widgets.Composite;
|
|||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.ui.model.WorkbenchLabelProvider;
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.IContainerEntry;
|
||||
import org.eclipse.cdt.core.model.IPathEntry;
|
||||
import org.eclipse.cdt.core.model.IProjectEntry;
|
||||
import org.eclipse.cdt.ui.wizards.IPathEntryContainerPage;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||
import org.eclipse.cdt.internal.ui.viewsupport.ListContentProvider;
|
||||
|
||||
public class ProjectContainerPage extends WizardPage implements IPathEntryContainerPage {
|
||||
|
||||
private int[] fFilterType;
|
||||
|
@ -69,9 +71,12 @@ public class ProjectContainerPage extends WizardPage implements IPathEntryContai
|
|||
IProjectEntry getProjectEntry() {
|
||||
if (viewer != null) {
|
||||
ISelection selection = viewer.getSelection();
|
||||
ICProject project = (ICProject)SelectionUtil.getSingleElement(selection);
|
||||
if (project != null) {
|
||||
return CoreModel.newProjectEntry(project.getPath());
|
||||
if (selection instanceof IStructuredSelection) {
|
||||
IStructuredSelection ss = (IStructuredSelection) selection;
|
||||
if (ss.size() == 1) {
|
||||
ICProject project = (ICProject) ss.getFirstElement();
|
||||
return CoreModel.newProjectEntry(project.getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -124,8 +129,8 @@ public class ProjectContainerPage extends WizardPage implements IPathEntryContai
|
|||
}
|
||||
|
||||
private void initializeView() {
|
||||
List list = new ArrayList();
|
||||
List current;
|
||||
List<ICProject> list = new ArrayList<ICProject>();
|
||||
List<IPathEntry> current;
|
||||
try {
|
||||
current = Arrays.asList(fCProject.getRawPathEntries());
|
||||
ICProject[] cProjects = CoreModel.getDefault().getCModel().getCProjects();
|
||||
|
@ -133,9 +138,9 @@ public class ProjectContainerPage extends WizardPage implements IPathEntryContai
|
|||
boolean added = false;
|
||||
if (!cProjects[i].equals(fCProject) && !current.contains(CoreModel.newProjectEntry(cProjects[i].getPath()))) {
|
||||
IPathEntry[] projEntries = cProjects[i].getRawPathEntries();
|
||||
for (int j = 0; j < projEntries.length; j++) {
|
||||
for (int k = 0; k < fFilterType.length; k++) {
|
||||
if (projEntries[j].getEntryKind() == fFilterType[k] && projEntries[j].isExported()) {
|
||||
for (IPathEntry projEntrie : projEntries) {
|
||||
for (int element : fFilterType) {
|
||||
if (projEntrie.getEntryKind() == element && projEntrie.isExported()) {
|
||||
list.add(cProjects[i]);
|
||||
added = true;
|
||||
break;
|
||||
|
|
|
@ -65,7 +65,7 @@ public class CustomFiltersDialog extends SelectionDialog {
|
|||
Button fEnableUserDefinedPatterns;
|
||||
Text fUserDefinedPatterns;
|
||||
|
||||
Stack<Object> fFilterDescriptorChangeHistory;
|
||||
Stack<FilterDescriptor> fFilterDescriptorChangeHistory;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -91,7 +91,7 @@ public class CustomFiltersDialog extends SelectionDialog {
|
|||
fEnabledFilterIds= enabledFilterIds;
|
||||
|
||||
fBuiltInFilters= FilterDescriptor.getFilterDescriptors(fViewId);
|
||||
fFilterDescriptorChangeHistory= new Stack<Object>();
|
||||
fFilterDescriptorChangeHistory= new Stack<FilterDescriptor>();
|
||||
setShellStyle(getShellStyle() | SWT.RESIZE);
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ public class CustomFiltersDialog extends SelectionDialog {
|
|||
if (fFilterDescriptorChangeHistory.contains(element)) {
|
||||
fFilterDescriptorChangeHistory.remove(element);
|
||||
}
|
||||
fFilterDescriptorChangeHistory.push(element);
|
||||
fFilterDescriptorChangeHistory.push((FilterDescriptor)element);
|
||||
}
|
||||
}});
|
||||
|
||||
|
@ -237,8 +237,8 @@ public class CustomFiltersDialog extends SelectionDialog {
|
|||
public void widgetSelected(SelectionEvent e) {
|
||||
fCheckBoxList.setAllChecked(true);
|
||||
fFilterDescriptorChangeHistory.clear();
|
||||
for (int i= 0; i < fBuiltInFilters.length; i++) {
|
||||
fFilterDescriptorChangeHistory.push(fBuiltInFilters[i]);
|
||||
for (FilterDescriptor builtInFilter : fBuiltInFilters) {
|
||||
fFilterDescriptorChangeHistory.push(builtInFilter);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -253,8 +253,8 @@ public class CustomFiltersDialog extends SelectionDialog {
|
|||
public void widgetSelected(SelectionEvent e) {
|
||||
fCheckBoxList.setAllChecked(false);
|
||||
fFilterDescriptorChangeHistory.clear();
|
||||
for (int i= 0; i < fBuiltInFilters.length; i++)
|
||||
fFilterDescriptorChangeHistory.push(fBuiltInFilters[i]);
|
||||
for (FilterDescriptor builtInFilter : fBuiltInFilters)
|
||||
fFilterDescriptorChangeHistory.push(builtInFilter);
|
||||
}
|
||||
};
|
||||
deselectButton.addSelectionListener(listener);
|
||||
|
@ -324,8 +324,8 @@ public class CustomFiltersDialog extends SelectionDialog {
|
|||
public String[] getEnabledFilterIds() {
|
||||
Object[] result= getResult();
|
||||
Set<String> enabledIds= new HashSet<String>(result.length);
|
||||
for (int i= 0; i < result.length; i++)
|
||||
enabledIds.add(((FilterDescriptor)result[i]).getId());
|
||||
for (Object element : result)
|
||||
enabledIds.add(((FilterDescriptor)element).getId());
|
||||
return enabledIds.toArray(new String[enabledIds.size()]);
|
||||
}
|
||||
|
||||
|
@ -340,7 +340,7 @@ public class CustomFiltersDialog extends SelectionDialog {
|
|||
* @return a stack with the filter descriptor check history
|
||||
* @since 3.0
|
||||
*/
|
||||
public Stack<Object> getFilterDescriptorChangeHistory() {
|
||||
public Stack<FilterDescriptor> getFilterDescriptorChangeHistory() {
|
||||
return fFilterDescriptorChangeHistory;
|
||||
}
|
||||
|
||||
|
@ -348,10 +348,10 @@ public class CustomFiltersDialog extends SelectionDialog {
|
|||
FilterDescriptor[] filterDescs= fBuiltInFilters;
|
||||
List<FilterDescriptor> result= new ArrayList<FilterDescriptor>(filterDescs.length);
|
||||
List<String> enabledFilterIds= Arrays.asList(fEnabledFilterIds);
|
||||
for (int i= 0; i < filterDescs.length; i++) {
|
||||
String id= filterDescs[i].getId();
|
||||
for (FilterDescriptor filterDesc : filterDescs) {
|
||||
String id= filterDesc.getId();
|
||||
if (enabledFilterIds.contains(id))
|
||||
result.add(filterDescs[i]);
|
||||
result.add(filterDesc);
|
||||
}
|
||||
return result.toArray(new FilterDescriptor[result.size()]);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public class CHelpDisplayContext implements IContext {
|
|||
|
||||
public CHelpDisplayContext(IContext context, final ITextEditor editor , String selected) throws CoreException {
|
||||
|
||||
List helpResources= new ArrayList();
|
||||
List<IHelpResource> helpResources= new ArrayList<IHelpResource>();
|
||||
|
||||
ICHelpInvocationContext invocationContext = new ICHelpInvocationContext() {
|
||||
|
||||
|
@ -102,7 +102,7 @@ public class CHelpDisplayContext implements IContext {
|
|||
}
|
||||
}
|
||||
|
||||
fHelpResources= (IHelpResource[]) helpResources.toArray(new IHelpResource[helpResources.size()]);
|
||||
fHelpResources= helpResources.toArray(new IHelpResource[helpResources.size()]);
|
||||
if (fText == null || fText.length() == 0) {
|
||||
if (context != null) {
|
||||
fText= context.getText();
|
||||
|
|
|
@ -14,7 +14,6 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||
import org.eclipse.core.resources.IMarker;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
@ -25,6 +24,8 @@ import org.eclipse.ui.IObjectActionDelegate;
|
|||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.actions.ActionDelegate;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||
|
||||
/**
|
||||
* @author Bogdan Gheorghe
|
||||
*/
|
||||
|
@ -43,9 +44,9 @@ public class DeleteIProblemMarkerAction extends ActionDelegate implements IObjec
|
|||
return;
|
||||
}
|
||||
try {
|
||||
List list = selection.toList();
|
||||
List listMarkers = new ArrayList();
|
||||
Iterator iterator = list.iterator();
|
||||
List<?> list = selection.toList();
|
||||
List<IMarker> listMarkers = new ArrayList<IMarker>();
|
||||
Iterator<?> iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
IMarker marker = (IMarker)iterator.next();
|
||||
if (marker.isSubtypeOf(ICModelMarker.INDEXER_MARKER)) {
|
||||
|
|
|
@ -42,9 +42,9 @@ public class DeleteTaskAction extends ActionDelegate implements IObjectActionDel
|
|||
return;
|
||||
}
|
||||
try {
|
||||
List list = selection.toList();
|
||||
List listMarkers = new ArrayList();
|
||||
Iterator iterator = list.iterator();
|
||||
List<?> list = selection.toList();
|
||||
List<IMarker> listMarkers = new ArrayList<IMarker>();
|
||||
Iterator<?> iterator = list.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
IMarker marker = (IMarker)iterator.next();
|
||||
if (marker.isSubtypeOf(ICModelMarker.C_MODEL_PROBLEM_MARKER)
|
||||
|
|
|
@ -157,35 +157,35 @@ public class EditorUtility {
|
|||
}
|
||||
|
||||
private static IEditorPart openInEditor(IFile file, boolean activate) throws PartInitException {
|
||||
if (!file.getProject().isAccessible()){
|
||||
if (file == null)
|
||||
return null;
|
||||
if (!file.getProject().isAccessible()) {
|
||||
closedProject(file.getProject());
|
||||
return null;
|
||||
}
|
||||
|
||||
if (file != null) {
|
||||
try {
|
||||
if (!isLinked(file)) {
|
||||
File tempFile = file.getRawLocation().toFile();
|
||||
if (!isLinked(file)) {
|
||||
File tempFile = file.getRawLocation().toFile();
|
||||
|
||||
if (tempFile != null){
|
||||
String canonicalPath = null;
|
||||
try {
|
||||
canonicalPath = tempFile.getCanonicalPath();
|
||||
} catch (IOException e1) {}
|
||||
if (tempFile != null){
|
||||
String canonicalPath = null;
|
||||
try {
|
||||
canonicalPath = tempFile.getCanonicalPath();
|
||||
} catch (IOException e1) {}
|
||||
|
||||
if (canonicalPath != null){
|
||||
IPath path = new Path(canonicalPath);
|
||||
file = CUIPlugin.getWorkspace().getRoot().getFileForLocation(path);
|
||||
}
|
||||
if (canonicalPath != null){
|
||||
IPath path = new Path(canonicalPath);
|
||||
file = CUIPlugin.getWorkspace().getRoot().getFileForLocation(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IEditorInput input = getEditorInput(file);
|
||||
if (input != null) {
|
||||
return openInEditor(input, getEditorID(input, file), activate);
|
||||
}
|
||||
} catch (CModelException e) {}
|
||||
}
|
||||
IEditorInput input = getEditorInput(file);
|
||||
if (input != null) {
|
||||
return openInEditor(input, getEditorID(input, file), activate);
|
||||
}
|
||||
} catch (CModelException e) {}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -199,8 +199,8 @@ public class EditorUtility {
|
|||
path = path.removeLastSegments(1);
|
||||
IContainer[] containers = ResourcesPlugin.getWorkspace().getRoot().findContainersForLocation(path);
|
||||
|
||||
for(int i=0; i<containers.length; i++) {
|
||||
if (containers[i] instanceof IFolder && ((IFolder)containers[i]).isLinked()) {
|
||||
for (IContainer container : containers) {
|
||||
if (container instanceof IFolder && ((IFolder)container).isLinked()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -438,8 +438,7 @@ public class EditorUtility {
|
|||
IFile secondBestMatch= null;
|
||||
IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
|
||||
IFile[] files= root.findFilesForLocation(location);
|
||||
for (int i= 0; i < files.length; i++) {
|
||||
IFile file= files[i];
|
||||
for (IFile file : files) {
|
||||
if (file.isAccessible()) {
|
||||
if (project != null && file.getProject().equals(project)) {
|
||||
bestMatch= file;
|
||||
|
@ -490,8 +489,7 @@ public class EditorUtility {
|
|||
IFile secondBestMatch= null;
|
||||
IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
|
||||
IFile[] files= root.findFilesForLocationURI(locationURI);
|
||||
for (int i= 0; i < files.length; i++) {
|
||||
IFile file= files[i];
|
||||
for (IFile file : files) {
|
||||
if (file.isAccessible()) {
|
||||
if (project != null && file.getProject().equals(project)) {
|
||||
bestMatch= file;
|
||||
|
|
|
@ -67,6 +67,7 @@ public class ExternalEditorInput implements ITranslationUnitEditorInput, IPersis
|
|||
/*
|
||||
* @see IAdaptable#getAdapter(Class)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object getAdapter(Class adapter) {
|
||||
if (ILocationProvider.class.equals(adapter)) {
|
||||
return this;
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.eclipse.core.runtime.Assert;
|
|||
*/
|
||||
public class ImageDescriptorRegistry {
|
||||
|
||||
private HashMap fRegistry= new HashMap(10);
|
||||
private HashMap<ImageDescriptor, Image> fRegistry= new HashMap<ImageDescriptor, Image>(10);
|
||||
private Display fDisplay;
|
||||
|
||||
/**
|
||||
|
@ -59,7 +59,7 @@ public class ImageDescriptorRegistry {
|
|||
if (descriptor == null)
|
||||
descriptor= ImageDescriptor.getMissingImageDescriptor();
|
||||
|
||||
Image result= (Image)fRegistry.get(descriptor);
|
||||
Image result= fRegistry.get(descriptor);
|
||||
if (result != null)
|
||||
return result;
|
||||
|
||||
|
@ -74,8 +74,8 @@ public class ImageDescriptorRegistry {
|
|||
* Disposes all images managed by this registry.
|
||||
*/
|
||||
public void dispose() {
|
||||
for (Iterator iter= fRegistry.values().iterator(); iter.hasNext(); ) {
|
||||
Image image= (Image)iter.next();
|
||||
for (Iterator<Image> iter= fRegistry.values().iterator(); iter.hasNext(); ) {
|
||||
Image image= iter.next();
|
||||
image.dispose();
|
||||
}
|
||||
fRegistry.clear();
|
||||
|
|
|
@ -48,7 +48,8 @@ public class PendingUpdateAdapter implements IWorkbenchAdapter, IAdaptable {
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
|
||||
*/
|
||||
public Object getAdapter(Class adapter) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object getAdapter(Class adapter) {
|
||||
if (adapter == IWorkbenchAdapter.class)
|
||||
return this;
|
||||
return null;
|
||||
|
|
|
@ -45,9 +45,9 @@ public class ProblemMarkerManager implements IResourceChangeListener, IAnnotatio
|
|||
*/
|
||||
private static class ProjectErrorVisitor implements IResourceDeltaVisitor {
|
||||
|
||||
private HashSet fChangedElements;
|
||||
private HashSet<IResource> fChangedElements;
|
||||
|
||||
public ProjectErrorVisitor(HashSet changedElements) {
|
||||
public ProjectErrorVisitor(HashSet<IResource> changedElements) {
|
||||
fChangedElements = changedElements;
|
||||
}
|
||||
|
||||
|
@ -78,13 +78,13 @@ public class ProblemMarkerManager implements IResourceChangeListener, IAnnotatio
|
|||
private boolean isErrorDelta(IResourceDelta delta) {
|
||||
if ( (delta.getFlags() & IResourceDelta.MARKERS) != 0) {
|
||||
IMarkerDelta[] markerDeltas = delta.getMarkerDeltas();
|
||||
for (int i = 0; i < markerDeltas.length; i++) {
|
||||
if (markerDeltas[i].isSubtypeOf(IMarker.PROBLEM)) {
|
||||
int kind = markerDeltas[i].getKind();
|
||||
for (IMarkerDelta markerDelta : markerDeltas) {
|
||||
if (markerDelta.isSubtypeOf(IMarker.PROBLEM)) {
|
||||
int kind = markerDelta.getKind();
|
||||
if (kind == IResourceDelta.ADDED || kind == IResourceDelta.REMOVED)
|
||||
return true;
|
||||
int severity = markerDeltas[i].getAttribute(IMarker.SEVERITY, -1);
|
||||
int newSeverity = markerDeltas[i].getMarker().getAttribute(IMarker.SEVERITY, -1);
|
||||
int severity = markerDelta.getAttribute(IMarker.SEVERITY, -1);
|
||||
int newSeverity = markerDelta.getMarker().getAttribute(IMarker.SEVERITY, -1);
|
||||
if (newSeverity != severity)
|
||||
return true;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public class ProblemMarkerManager implements IResourceChangeListener, IAnnotatio
|
|||
* @see IResourceChangeListener#resourceChanged
|
||||
*/
|
||||
public void resourceChanged(IResourceChangeEvent event) {
|
||||
HashSet changedElements = new HashSet();
|
||||
HashSet<IResource> changedElements = new HashSet<IResource>();
|
||||
|
||||
try {
|
||||
IResourceDelta delta = event.getDelta();
|
||||
|
@ -115,7 +115,7 @@ public class ProblemMarkerManager implements IResourceChangeListener, IAnnotatio
|
|||
}
|
||||
|
||||
if (!changedElements.isEmpty()) {
|
||||
IResource[] changes = (IResource[])changedElements.toArray(new IResource[changedElements.size()]);
|
||||
IResource[] changes = changedElements.toArray(new IResource[changedElements.size()]);
|
||||
fireChanges(changes, true);
|
||||
}
|
||||
|
||||
|
@ -178,8 +178,8 @@ public class ProblemMarkerManager implements IResourceChangeListener, IAnnotatio
|
|||
|
||||
public void run() {
|
||||
Object[] listeners = fListeners.getListeners();
|
||||
for (int i = 0; i < listeners.length; i++) {
|
||||
IProblemChangedListener curr = (IProblemChangedListener)listeners[i];
|
||||
for (Object listener : listeners) {
|
||||
IProblemChangedListener curr = (IProblemChangedListener)listener;
|
||||
curr.problemsChanged(changes, markerChanged);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public class ProblemTableViewer extends TableViewer {
|
|||
|
||||
Object[] changed= event.getElements();
|
||||
if (changed != null && !fResourceToItemsMapper.isEmpty()) {
|
||||
ArrayList others= new ArrayList(changed.length);
|
||||
ArrayList<Object> others= new ArrayList<Object>(changed.length);
|
||||
for (int i= 0; i < changed.length; i++) {
|
||||
Object curr= changed[i];
|
||||
if (curr instanceof IResource) {
|
||||
|
|
|
@ -109,7 +109,7 @@ public class ProblemTreeViewer extends TreeViewer {
|
|||
}
|
||||
Object[] changed= event.getElements();
|
||||
if (changed != null && !fResourceToItemsMapper.isEmpty()) {
|
||||
ArrayList others= new ArrayList(changed.length);
|
||||
ArrayList<Object> others= new ArrayList<Object>(changed.length);
|
||||
for (int i= 0; i < changed.length; i++) {
|
||||
Object curr= changed[i];
|
||||
if (curr instanceof IResource) {
|
||||
|
|
|
@ -49,9 +49,9 @@ public class RemoteTreeContentManager {
|
|||
* Queue of parents to fetch children for, and
|
||||
* associated element collectors and deferred adapters.
|
||||
*/
|
||||
private List fElementQueue = new ArrayList();
|
||||
private List fCollectors = new ArrayList();
|
||||
private List fAdapaters = new ArrayList();
|
||||
private List<Object> fElementQueue = new ArrayList<Object>();
|
||||
private List<IElementCollector> fCollectors = new ArrayList<IElementCollector>();
|
||||
private List<IDeferredWorkbenchAdapter> fAdapaters = new ArrayList<IDeferredWorkbenchAdapter>();
|
||||
|
||||
/**
|
||||
* Fetching children is done in a single background job.
|
||||
|
@ -79,8 +79,8 @@ public class RemoteTreeContentManager {
|
|||
return Status.CANCEL_STATUS;
|
||||
}
|
||||
element = fElementQueue.remove(0);
|
||||
collector = (IElementCollector) fCollectors.remove(0);
|
||||
adapter = (IDeferredWorkbenchAdapter) fAdapaters.remove(0);
|
||||
collector = fCollectors.remove(0);
|
||||
adapter = fAdapaters.remove(0);
|
||||
}
|
||||
adapter.fetchDeferredChildren(element, collector, monitor);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class RemoteTreeViewer extends ProblemTreeViewer {
|
|||
class ExpansionJob extends UIJob {
|
||||
|
||||
private Object element;
|
||||
private List parents = new ArrayList(); // top down
|
||||
private List<Object> parents = new ArrayList<Object>(); // top down
|
||||
|
||||
/**
|
||||
* Constucts a job to expand the given element.
|
||||
|
@ -62,7 +62,7 @@ public class RemoteTreeViewer extends ProblemTreeViewer {
|
|||
}
|
||||
synchronized (RemoteTreeViewer.this) {
|
||||
boolean allParentsExpanded = true;
|
||||
Iterator iterator = parents.iterator();
|
||||
Iterator<Object> iterator = parents.iterator();
|
||||
while (iterator.hasNext() && !monitor.isCanceled()) {
|
||||
Object parent = iterator.next();
|
||||
Widget item = findItem(parent);
|
||||
|
@ -109,7 +109,7 @@ public class RemoteTreeViewer extends ProblemTreeViewer {
|
|||
|
||||
private IStructuredSelection selection;
|
||||
private Object first;
|
||||
private List parents = new ArrayList(); // top down
|
||||
private List<Object> parents = new ArrayList<Object>(); // top down
|
||||
|
||||
/**
|
||||
* Constucts a job to select the given element.
|
||||
|
@ -131,7 +131,7 @@ public class RemoteTreeViewer extends ProblemTreeViewer {
|
|||
}
|
||||
synchronized (RemoteTreeViewer.this) {
|
||||
boolean allParentsExpanded = true;
|
||||
Iterator iterator = parents.iterator();
|
||||
Iterator<Object> iterator = parents.iterator();
|
||||
while (iterator.hasNext() && !monitor.isCanceled()) {
|
||||
Object parent = iterator.next();
|
||||
Widget item = findItem(parent);
|
||||
|
@ -327,7 +327,7 @@ public class RemoteTreeViewer extends ProblemTreeViewer {
|
|||
}
|
||||
}
|
||||
|
||||
private void addAllParents(List list, Object element) {
|
||||
private void addAllParents(List<Object> list, Object element) {
|
||||
if (element instanceof IAdaptable) {
|
||||
IAdaptable adaptable = (IAdaptable) element;
|
||||
IWorkbenchAdapter adapter = (IWorkbenchAdapter) adaptable.getAdapter(IWorkbenchAdapter.class);
|
||||
|
|
|
@ -15,17 +15,16 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Item;
|
||||
|
||||
import org.eclipse.jface.viewers.ContentViewer;
|
||||
import org.eclipse.jface.viewers.ILabelProvider;
|
||||
import org.eclipse.jface.viewers.IViewerLabelProvider;
|
||||
import org.eclipse.jface.viewers.ViewerLabel;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Item;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
|
||||
/**
|
||||
* Helper class for updating error markers and other decorators that work on resources.
|
||||
|
@ -38,14 +37,14 @@ public class ResourceToItemsMapper {
|
|||
private static final int NUMBER_LIST_REUSE= 10;
|
||||
|
||||
// map from resource to item
|
||||
private HashMap fResourceToItem;
|
||||
private Stack fReuseLists;
|
||||
private HashMap<IResource, Object> fResourceToItem;
|
||||
private Stack<List<Item>> fReuseLists;
|
||||
|
||||
private ContentViewer fContentViewer;
|
||||
|
||||
public ResourceToItemsMapper(ContentViewer viewer) {
|
||||
fResourceToItem= new HashMap();
|
||||
fReuseLists= new Stack();
|
||||
fResourceToItem= new HashMap<IResource, Object>();
|
||||
fReuseLists= new Stack<List<Item>>();
|
||||
|
||||
fContentViewer= viewer;
|
||||
}
|
||||
|
@ -60,9 +59,10 @@ public class ResourceToItemsMapper {
|
|||
} else if (obj instanceof Item) {
|
||||
updateItem((Item) obj);
|
||||
} else { // List of Items
|
||||
List list= (List) obj;
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Item> list= (List<Item>) obj;
|
||||
for (int k= 0; k < list.size(); k++) {
|
||||
updateItem((Item) list.get(k));
|
||||
updateItem(list.get(k));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -114,13 +114,14 @@ public class ResourceToItemsMapper {
|
|||
fResourceToItem.put(resource, item);
|
||||
} else if (existingMapping instanceof Item) {
|
||||
if (existingMapping != item) {
|
||||
List list= getNewList();
|
||||
list.add(existingMapping);
|
||||
List<Item> list= getNewList();
|
||||
list.add((Item) existingMapping);
|
||||
list.add(item);
|
||||
fResourceToItem.put(resource, list);
|
||||
}
|
||||
} else { // List
|
||||
List list= (List) existingMapping;
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Item> list= (List<Item>) existingMapping;
|
||||
if (!list.contains(item)) {
|
||||
list.add(item);
|
||||
}
|
||||
|
@ -140,7 +141,8 @@ public class ResourceToItemsMapper {
|
|||
} else if (existingMapping instanceof Item) {
|
||||
fResourceToItem.remove(resource);
|
||||
} else { // List
|
||||
List list= (List) existingMapping;
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Item> list= (List) existingMapping;
|
||||
list.remove(item);
|
||||
if (list.isEmpty()) {
|
||||
fResourceToItem.remove(list);
|
||||
|
@ -150,14 +152,14 @@ public class ResourceToItemsMapper {
|
|||
}
|
||||
}
|
||||
|
||||
private List getNewList() {
|
||||
private List<Item> getNewList() {
|
||||
if (!fReuseLists.isEmpty()) {
|
||||
return (List) fReuseLists.pop();
|
||||
return fReuseLists.pop();
|
||||
}
|
||||
return new ArrayList(2);
|
||||
return new ArrayList<Item>(2);
|
||||
}
|
||||
|
||||
private void releaseList(List list) {
|
||||
private void releaseList(List<Item> list) {
|
||||
if (fReuseLists.size() < NUMBER_LIST_REUSE) {
|
||||
fReuseLists.push(list);
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ public class Resources {
|
|||
* @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[], java.lang.Object)
|
||||
*/
|
||||
public static IStatus makeCommittable(IResource[] resources, Object context) {
|
||||
List readOnlyFiles= new ArrayList();
|
||||
List<IResource> readOnlyFiles= new ArrayList<IResource>();
|
||||
for (int i= 0; i < resources.length; i++) {
|
||||
IResource resource= resources[i];
|
||||
if (resource.getType() == IResource.FILE) {
|
||||
|
@ -110,16 +110,16 @@ public class Resources {
|
|||
if (readOnlyFiles.size() == 0)
|
||||
return new Status(IStatus.OK, CUIPlugin.getPluginId(), IStatus.OK, "", null); //$NON-NLS-1$
|
||||
|
||||
Map oldTimeStamps= createModificationStampMap(readOnlyFiles);
|
||||
Map<IFile, Long> oldTimeStamps= createModificationStampMap(readOnlyFiles);
|
||||
IStatus status= ResourcesPlugin.getWorkspace().validateEdit(
|
||||
(IFile[]) readOnlyFiles.toArray(new IFile[readOnlyFiles.size()]), context);
|
||||
readOnlyFiles.toArray(new IFile[readOnlyFiles.size()]), context);
|
||||
if (!status.isOK())
|
||||
return status;
|
||||
|
||||
IStatus modified= null;
|
||||
Map newTimeStamps= createModificationStampMap(readOnlyFiles);
|
||||
for (Iterator iter= oldTimeStamps.keySet().iterator(); iter.hasNext();) {
|
||||
IFile file= (IFile) iter.next();
|
||||
Map<IFile, Long> newTimeStamps= createModificationStampMap(readOnlyFiles);
|
||||
for (Iterator<IFile> iter= oldTimeStamps.keySet().iterator(); iter.hasNext();) {
|
||||
IFile file= iter.next();
|
||||
if (!oldTimeStamps.get(file).equals(newTimeStamps.get(file)))
|
||||
modified= addModified(modified, file);
|
||||
}
|
||||
|
@ -128,9 +128,9 @@ public class Resources {
|
|||
return new Status(IStatus.OK, CUIPlugin.getPluginId(), IStatus.OK, "", null); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
private static Map createModificationStampMap(List files){
|
||||
Map map= new HashMap();
|
||||
for (Iterator iter= files.iterator(); iter.hasNext(); ) {
|
||||
private static Map<IFile, Long> createModificationStampMap(List<IResource> files){
|
||||
Map<IFile, Long> map= new HashMap<IFile, Long>();
|
||||
for (Iterator<IResource> iter= files.iterator(); iter.hasNext(); ) {
|
||||
IFile file= (IFile)iter.next();
|
||||
map.put(file, new Long(file.getModificationStamp()));
|
||||
}
|
||||
|
@ -181,12 +181,12 @@ public class Resources {
|
|||
}
|
||||
|
||||
public static String[] getLocationOSStrings(IResource[] resources) {
|
||||
List result= new ArrayList(resources.length);
|
||||
List<String> result= new ArrayList<String>(resources.length);
|
||||
for (int i= 0; i < resources.length; i++) {
|
||||
IPath location= resources[i].getLocation();
|
||||
if (location != null)
|
||||
result.add(location.toOSString());
|
||||
}
|
||||
return (String[]) result.toArray(new String[result.size()]);
|
||||
return result.toArray(new String[result.size()]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,124 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000 2005 IBM Corporation 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* QNX Software System
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.util;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
||||
/**
|
||||
* Provides utilities for checking the validity of selections.
|
||||
* <p>
|
||||
* This class provides static methods only; it is not intended to be instantiated
|
||||
* or subclassed.
|
||||
* </p>
|
||||
*/
|
||||
|
||||
public class SelectionUtil {
|
||||
|
||||
/**
|
||||
* Returns the first element of the given selection.
|
||||
* Returns null if the selection is empty or if
|
||||
* the given selection is not of type <code>IStructuredSelection</code>.
|
||||
*
|
||||
* @param selection the selection
|
||||
* @return the selected elements
|
||||
*
|
||||
*/
|
||||
public static Object getFirstElement (ISelection selection) {
|
||||
if (!(selection instanceof IStructuredSelection)) {
|
||||
return null;
|
||||
}
|
||||
return ((IStructuredSelection)selection).getFirstElement ();
|
||||
}
|
||||
|
||||
public static Object getSingleElement (ISelection s) {
|
||||
if (!(s instanceof IStructuredSelection))
|
||||
return null;
|
||||
IStructuredSelection selection= (IStructuredSelection)s;
|
||||
if (selection.size () != 1)
|
||||
return null;
|
||||
return selection.getFirstElement ();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the elements of the given selection.
|
||||
* Returns an empty array if the selection is empty or if
|
||||
* the given selection is not of type <code>IStructuredSelection</code>.
|
||||
*
|
||||
* @param selection the selection
|
||||
* @return the selected elements
|
||||
*
|
||||
*/
|
||||
|
||||
public static Object[] toArray(ISelection selection) {
|
||||
if (!(selection instanceof IStructuredSelection)) {
|
||||
return new Object[0];
|
||||
}
|
||||
return ((IStructuredSelection)selection).toArray();
|
||||
}
|
||||
|
||||
public static List toList(ISelection selection) {
|
||||
if (selection instanceof IStructuredSelection) {
|
||||
return ((IStructuredSelection)selection).toList();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the types of the resources in the given selection are among
|
||||
* the specified resource types.
|
||||
*
|
||||
* @param selection the selection
|
||||
* @param resourceMask resource mask formed by bitwise OR of resource type
|
||||
* constants (defined on <code>IResource</code>)
|
||||
* @return <code>true</code> if all selected elements are resources of the right
|
||||
* type, and <code>false</code> if at least one element is either a resource
|
||||
* of some other type or a non-resource
|
||||
* @see IResource#getType
|
||||
*/
|
||||
public static boolean allResourcesAreOfType(IStructuredSelection selection, int resourceMask) {
|
||||
Iterator resources = selection.iterator();
|
||||
while (resources.hasNext()) {
|
||||
Object next = resources.next();
|
||||
if (!(next instanceof IResource))
|
||||
return false;
|
||||
if (!resourceIsType((IResource)next, resourceMask))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the type of the given resource is among the specified
|
||||
* resource types.
|
||||
*
|
||||
* @param resource the resource
|
||||
* @param resourceMask resource mask formed by bitwise OR of resource type
|
||||
* constants (defined on <code>IResource</code>)
|
||||
* @return <code>true</code> if the resources has a matching type, and
|
||||
* <code>false</code> otherwise
|
||||
* @see IResource#getType
|
||||
*/
|
||||
public static boolean resourceIsType(IResource resource, int resourceMask) {
|
||||
return ((resource != null) && ((resource.getType() & resourceMask) != 0));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* Private constructor to block instantiation.
|
||||
*/
|
||||
private SelectionUtil(){
|
||||
}
|
||||
}
|
|
@ -249,7 +249,7 @@ public class StringMatcher {
|
|||
}
|
||||
}
|
||||
|
||||
Vector temp= new Vector();
|
||||
Vector<String> temp= new Vector<String>();
|
||||
|
||||
int pos= 0;
|
||||
StringBuffer buf= new StringBuffer();
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.eclipse.jface.viewers.ColumnWeightData;
|
|||
*/
|
||||
public class TableLayoutComposite extends Composite {
|
||||
|
||||
private List columns= new ArrayList();
|
||||
private List<ColumnLayoutData> columns= new ArrayList<ColumnLayoutData>();
|
||||
|
||||
/**
|
||||
* Creates a new <code>TableLayoutComposite</code>.
|
||||
|
@ -76,7 +76,7 @@ public class TableLayoutComposite extends Composite {
|
|||
int width= 0;
|
||||
int size= columns.size();
|
||||
for (int i= 0; i < size; ++i) {
|
||||
ColumnLayoutData layoutData= (ColumnLayoutData) columns.get(i);
|
||||
ColumnLayoutData layoutData= columns.get(i);
|
||||
if (layoutData instanceof ColumnPixelData) {
|
||||
ColumnPixelData col= (ColumnPixelData) layoutData;
|
||||
width += col.width;
|
||||
|
@ -109,7 +109,7 @@ public class TableLayoutComposite extends Composite {
|
|||
|
||||
// First calc space occupied by fixed columns
|
||||
for (int i= 0; i < size; i++) {
|
||||
ColumnLayoutData col= (ColumnLayoutData) columns.get(i);
|
||||
ColumnLayoutData col= columns.get(i);
|
||||
if (col instanceof ColumnPixelData) {
|
||||
int pixels= ((ColumnPixelData) col).width;
|
||||
widths[i]= pixels;
|
||||
|
@ -132,7 +132,7 @@ public class TableLayoutComposite extends Composite {
|
|||
int rest= width - fixedWidth;
|
||||
int totalDistributed= 0;
|
||||
for (int i= 0; i < size; ++i) {
|
||||
ColumnLayoutData col= (ColumnLayoutData) columns.get(i);
|
||||
ColumnLayoutData col= columns.get(i);
|
||||
if (col instanceof ColumnWeightData) {
|
||||
ColumnWeightData cw= (ColumnWeightData) col;
|
||||
// calculate weight as above
|
||||
|
@ -151,7 +151,7 @@ public class TableLayoutComposite extends Composite {
|
|||
for (int i= 0; diff > 0; ++i) {
|
||||
if (i == size)
|
||||
i= 0;
|
||||
ColumnLayoutData col= (ColumnLayoutData) columns.get(i);
|
||||
ColumnLayoutData col= columns.get(i);
|
||||
if (col instanceof ColumnWeightData) {
|
||||
++widths[i];
|
||||
--diff;
|
||||
|
|
|
@ -30,11 +30,11 @@ import org.eclipse.jface.viewers.StructuredSelection;
|
|||
*/
|
||||
public class AdaptingSelectionProvider implements ISelectionProvider, ISelectionChangedListener {
|
||||
|
||||
private Class fTargetType;
|
||||
private Class<?> fTargetType;
|
||||
private ListenerList fListenerList;
|
||||
private ISelectionProvider fProvider;
|
||||
|
||||
public AdaptingSelectionProvider(Class targetType, ISelectionProvider provider) {
|
||||
public AdaptingSelectionProvider(Class<?> targetType, ISelectionProvider provider) {
|
||||
fProvider= provider;
|
||||
fTargetType= targetType;
|
||||
fListenerList= new ListenerList();
|
||||
|
@ -44,8 +44,8 @@ public class AdaptingSelectionProvider implements ISelectionProvider, ISelection
|
|||
if (selection != null) {
|
||||
if (selection instanceof IStructuredSelection) {
|
||||
IStructuredSelection ss= (IStructuredSelection) selection;
|
||||
ArrayList adapted= new ArrayList();
|
||||
for (Iterator iter = ss.iterator(); iter.hasNext(); ) {
|
||||
ArrayList<Object> adapted= new ArrayList<Object>();
|
||||
for (Iterator<?> iter = ss.iterator(); iter.hasNext(); ) {
|
||||
Object elem= adaptElem(iter.next());
|
||||
if (elem != null) {
|
||||
adapted.add(elem);
|
||||
|
@ -92,8 +92,8 @@ public class AdaptingSelectionProvider implements ISelectionProvider, ISelection
|
|||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
SelectionChangedEvent event2= new SelectionChangedEvent(this, convertSelection(event.getSelection()));
|
||||
Object[] listeners= fListenerList.getListeners();
|
||||
for (int i = 0; i < listeners.length; i++) {
|
||||
ISelectionChangedListener l= (ISelectionChangedListener) listeners[i];
|
||||
for (Object listener : listeners) {
|
||||
ISelectionChangedListener l= (ISelectionChangedListener) listener;
|
||||
l.selectionChanged(event2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,16 +43,16 @@ public abstract class AsyncTreeContentProvider implements ITreeContentProvider {
|
|||
protected static final Object[] NO_CHILDREN = new Object[0];
|
||||
|
||||
private Object fInput;
|
||||
private HashMap fChildNodes= new HashMap();
|
||||
private HashSet fHighPriorityTasks= new HashSet();
|
||||
private HashSet fLowPriorityTasks= new HashSet();
|
||||
private HashMap fViewUpdates= new HashMap();
|
||||
private HashMap<Object, Object[]> fChildNodes= new HashMap<Object, Object[]>();
|
||||
private HashSet<Object> fHighPriorityTasks= new HashSet<Object>();
|
||||
private HashSet<Object> fLowPriorityTasks= new HashSet<Object>();
|
||||
private HashMap<Object, Object[]> fViewUpdates= new HashMap<Object, Object[]>();
|
||||
private int fViewUpdateDelta;
|
||||
private Job fJob;
|
||||
private Display fDisplay;
|
||||
private TreeViewer fTreeViewer= null;
|
||||
private Runnable fScheduledViewupdate= null;
|
||||
private HashSet fAutoexpand;
|
||||
private HashSet<Object> fAutoexpand;
|
||||
private Object fAutoSelect;
|
||||
|
||||
public AsyncTreeContentProvider(Display disp) {
|
||||
|
@ -133,7 +133,7 @@ public abstract class AsyncTreeContentProvider implements ITreeContentProvider {
|
|||
*/
|
||||
public void recompute() {
|
||||
if (getInput() != null) {
|
||||
fAutoexpand= new HashSet();
|
||||
fAutoexpand= new HashSet<Object>();
|
||||
fAutoexpand.addAll(Arrays.asList(fTreeViewer.getVisibleExpandedElements()));
|
||||
fAutoSelect= null;
|
||||
fAutoSelect= ((IStructuredSelection) fTreeViewer.getSelection()).getFirstElement();
|
||||
|
@ -244,7 +244,7 @@ public abstract class AsyncTreeContentProvider implements ITreeContentProvider {
|
|||
}
|
||||
runme= fScheduledViewupdate= new Runnable(){
|
||||
public void run() {
|
||||
HashMap updates= null;
|
||||
HashMap<Object, Object[]> updates= null;
|
||||
synchronized(fHighPriorityTasks) {
|
||||
if (fViewUpdates.isEmpty()) {
|
||||
fScheduledViewupdate= null;
|
||||
|
@ -254,19 +254,19 @@ public abstract class AsyncTreeContentProvider implements ITreeContentProvider {
|
|||
return;
|
||||
}
|
||||
updates= fViewUpdates;
|
||||
fViewUpdates= new HashMap();
|
||||
fViewUpdates= new HashMap<Object, Object[]>();
|
||||
}
|
||||
fChildNodes.putAll(updates);
|
||||
if (fTreeViewer instanceof ExtendedTreeViewer) {
|
||||
((ExtendedTreeViewer) fTreeViewer).refresh(updates.keySet().toArray());
|
||||
}
|
||||
else if (fTreeViewer != null) {
|
||||
for (Iterator iter = updates.keySet().iterator(); iter.hasNext();) {
|
||||
for (Iterator<Object> iter = updates.keySet().iterator(); iter.hasNext();) {
|
||||
fTreeViewer.refresh(iter.next());
|
||||
}
|
||||
}
|
||||
for (Iterator iter = updates.values().iterator(); iter.hasNext();) {
|
||||
checkForAutoExpand((Object[]) iter.next());
|
||||
for (Iterator<Object[]> iter = updates.values().iterator(); iter.hasNext();) {
|
||||
checkForAutoExpand(iter.next());
|
||||
}
|
||||
fViewUpdateDelta= Math.min(1000, fViewUpdateDelta*2);
|
||||
fDisplay.timerExec(fViewUpdateDelta, this);
|
||||
|
@ -336,7 +336,7 @@ public abstract class AsyncTreeContentProvider implements ITreeContentProvider {
|
|||
if (parentElement instanceof AsyncTreeWorkInProgressNode) {
|
||||
return NO_CHILDREN;
|
||||
}
|
||||
Object[] children= (Object[]) fChildNodes.get(parentElement);
|
||||
Object[] children= fChildNodes.get(parentElement);
|
||||
if (children == null) {
|
||||
children= syncronouslyComputeChildren(parentElement);
|
||||
if (children != null) {
|
||||
|
|
|
@ -49,9 +49,9 @@ import org.eclipse.cdt.internal.ui.editor.CContentOutlinePage;
|
|||
public class CDTContextActivator implements IWindowListener, IPartListener2 {
|
||||
private static CDTContextActivator sInstance= new CDTContextActivator();
|
||||
|
||||
private Map fActivationPerOutline = new HashMap();
|
||||
private Map fActivationPerNavigator= new HashMap();
|
||||
private Collection fWindows= new HashSet();
|
||||
private Map<ContentOutline, IContextActivation> fActivationPerOutline = new HashMap<ContentOutline, IContextActivation>();
|
||||
private Map<CommonNavigator, SelectionListener> fActivationPerNavigator= new HashMap<CommonNavigator, SelectionListener>();
|
||||
private Collection<IWorkbenchWindow> fWindows= new HashSet<IWorkbenchWindow>();
|
||||
|
||||
|
||||
private CDTContextActivator() {
|
||||
|
@ -86,12 +86,12 @@ public class CDTContextActivator implements IWindowListener, IPartListener2 {
|
|||
}
|
||||
|
||||
public void uninstall() {
|
||||
for (Iterator iterator = fWindows.iterator(); iterator.hasNext();) {
|
||||
IWorkbenchWindow window = (IWorkbenchWindow) iterator.next();
|
||||
for (Iterator<IWorkbenchWindow> iterator = fWindows.iterator(); iterator.hasNext();) {
|
||||
IWorkbenchWindow window = iterator.next();
|
||||
unregister(window);
|
||||
}
|
||||
for (Iterator iterator = fActivationPerNavigator.values().iterator(); iterator.hasNext();) {
|
||||
SelectionListener l= (SelectionListener) iterator.next();
|
||||
for (Iterator<SelectionListener> iterator = fActivationPerNavigator.values().iterator(); iterator.hasNext();) {
|
||||
SelectionListener l= iterator.next();
|
||||
l.uninstall();
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ public class CDTContextActivator implements IWindowListener, IPartListener2 {
|
|||
}
|
||||
}
|
||||
else {
|
||||
IContextActivation activation = (IContextActivation) fActivationPerOutline.remove(outline);
|
||||
IContextActivation activation = fActivationPerOutline.remove(outline);
|
||||
if (activation != null) {
|
||||
// other outline page brought to front
|
||||
IContextService ctxtService = (IContextService)outline.getViewSite().getService(IContextService.class);
|
||||
|
@ -194,7 +194,7 @@ public class CDTContextActivator implements IWindowListener, IPartListener2 {
|
|||
}
|
||||
|
||||
private void onCommonNavigatorActivated(CommonNavigator part) {
|
||||
SelectionListener l= (SelectionListener) fActivationPerNavigator.get(part);
|
||||
SelectionListener l= fActivationPerNavigator.get(part);
|
||||
if (l == null) {
|
||||
l= new SelectionListener(part.getSite());
|
||||
fActivationPerNavigator.put(part, l);
|
||||
|
|
|
@ -32,7 +32,7 @@ public class CUILabelProvider extends LabelProvider implements IColorProvider {
|
|||
protected CElementImageProvider fImageLabelProvider;
|
||||
protected StorageLabelProvider fStorageLabelProvider;
|
||||
|
||||
private ArrayList fLabelDecorators;
|
||||
private ArrayList<ILabelDecorator> fLabelDecorators;
|
||||
|
||||
private int fImageFlags;
|
||||
private int fTextFlags;
|
||||
|
@ -64,7 +64,7 @@ public class CUILabelProvider extends LabelProvider implements IColorProvider {
|
|||
*/
|
||||
public void addLabelDecorator(ILabelDecorator decorator) {
|
||||
if (fLabelDecorators == null) {
|
||||
fLabelDecorators= new ArrayList(2);
|
||||
fLabelDecorators= new ArrayList<ILabelDecorator>(2);
|
||||
}
|
||||
fLabelDecorators.add(decorator);
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ public class CUILabelProvider extends LabelProvider implements IColorProvider {
|
|||
protected Image decorateImage(Image image, Object element) {
|
||||
if (fLabelDecorators != null && image != null) {
|
||||
for (int i= 0; i < fLabelDecorators.size(); i++) {
|
||||
ILabelDecorator decorator= (ILabelDecorator) fLabelDecorators.get(i);
|
||||
ILabelDecorator decorator= fLabelDecorators.get(i);
|
||||
image= decorator.decorateImage(image, element);
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ public class CUILabelProvider extends LabelProvider implements IColorProvider {
|
|||
protected String decorateText(String text, Object element) {
|
||||
if (fLabelDecorators != null && text.length() > 0) {
|
||||
for (int i= 0; i < fLabelDecorators.size(); i++) {
|
||||
ILabelDecorator decorator= (ILabelDecorator) fLabelDecorators.get(i);
|
||||
ILabelDecorator decorator= fLabelDecorators.get(i);
|
||||
text= decorator.decorateText(text, element);
|
||||
}
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ public class CUILabelProvider extends LabelProvider implements IColorProvider {
|
|||
public void dispose() {
|
||||
if (fLabelDecorators != null) {
|
||||
for (int i= 0; i < fLabelDecorators.size(); i++) {
|
||||
ILabelDecorator decorator= (ILabelDecorator) fLabelDecorators.get(i);
|
||||
ILabelDecorator decorator= fLabelDecorators.get(i);
|
||||
decorator.dispose();
|
||||
}
|
||||
fLabelDecorators= null;
|
||||
|
@ -189,7 +189,7 @@ public class CUILabelProvider extends LabelProvider implements IColorProvider {
|
|||
public void addListener(ILabelProviderListener listener) {
|
||||
if (fLabelDecorators != null) {
|
||||
for (int i= 0; i < fLabelDecorators.size(); i++) {
|
||||
ILabelDecorator decorator= (ILabelDecorator) fLabelDecorators.get(i);
|
||||
ILabelDecorator decorator= fLabelDecorators.get(i);
|
||||
decorator.addListener(listener);
|
||||
}
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ public class CUILabelProvider extends LabelProvider implements IColorProvider {
|
|||
public void removeListener(ILabelProviderListener listener) {
|
||||
if (fLabelDecorators != null) {
|
||||
for (int i= 0; i < fLabelDecorators.size(); i++) {
|
||||
ILabelDecorator decorator= (ILabelDecorator) fLabelDecorators.get(i);
|
||||
ILabelDecorator decorator= fLabelDecorators.get(i);
|
||||
decorator.removeListener(listener);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,14 +10,12 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.viewsupport;
|
||||
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
|
||||
import org.eclipse.jface.viewers.DecoratingLabelProvider;
|
||||
import org.eclipse.jface.viewers.IColorProvider;
|
||||
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
public class DecoratingCLabelProvider extends DecoratingLabelProvider implements IColorProvider {
|
||||
public class DecoratingCLabelProvider extends DecoratingLabelProvider {
|
||||
|
||||
/**
|
||||
* Decorating label provider for Java. Combines a JavaUILabelProvider
|
||||
|
|
|
@ -19,7 +19,7 @@ import org.eclipse.jface.viewers.Viewer;
|
|||
* A specialized content provider to show a list of editor parts.
|
||||
*/
|
||||
public class ListContentProvider implements IStructuredContentProvider {
|
||||
List fContents;
|
||||
List<?> fContents;
|
||||
|
||||
public ListContentProvider() {
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class ListContentProvider implements IStructuredContentProvider {
|
|||
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||
if (newInput instanceof List)
|
||||
fContents= (List)newInput;
|
||||
fContents= (List<?>)newInput;
|
||||
else
|
||||
fContents= null;
|
||||
// we use a fixed set.
|
||||
|
|
|
@ -174,7 +174,7 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
|||
if (tu != null && tu.exists()) {
|
||||
return getErrorTicksFromMarkers(tu.getResource(), IResource.DEPTH_ONE, (ISourceReference)element);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (obj instanceof IResource) {
|
||||
return getErrorTicksFromMarkers((IResource) obj, IResource.DEPTH_INFINITE, null) | getTicks((IResource)obj);
|
||||
|
@ -347,8 +347,8 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
|||
if (fListeners != null && !fListeners.isEmpty()) {
|
||||
LabelProviderChangedEvent event= new ProblemsLabelChangedEvent(this, changedResources, isMarkerChange);
|
||||
Object[] listeners= fListeners.getListeners();
|
||||
for (int i= 0; i < listeners.length; i++) {
|
||||
((ILabelProviderListener) listeners[i]).labelProviderChanged(event);
|
||||
for (Object listener : listeners) {
|
||||
((ILabelProviderListener) listener).labelProviderChanged(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -379,9 +379,9 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
|||
if (prjd != null) {
|
||||
ICConfigurationDescription [] cf = prjd.getConfigurations();
|
||||
if (cf == null) return 0;
|
||||
for (int i=0; i<cf.length; i++) {
|
||||
if (cf[i].isActive()) {
|
||||
ICResourceDescription out = cf[i].getResourceDescription(path, true);
|
||||
for (ICConfigurationDescription element : cf) {
|
||||
if (element.isActive()) {
|
||||
ICResourceDescription out = element.getResourceDescription(path, true);
|
||||
if (out != null) result |= TICK_CONFIGURATION;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,9 +92,8 @@ public final class ProjectTemplateStore {
|
|||
public TemplatePersistenceData[] getTemplateData() {
|
||||
if (fProjectStore != null) {
|
||||
return fProjectStore.getTemplateData(true);
|
||||
} else {
|
||||
return fInstanceStore.getTemplateData(true);
|
||||
}
|
||||
return fInstanceStore.getTemplateData(true);
|
||||
}
|
||||
|
||||
public Template findTemplateById(String id) {
|
||||
|
@ -111,19 +110,18 @@ public final class ProjectTemplateStore {
|
|||
if (fProjectStore != null) {
|
||||
fProjectStore.load();
|
||||
|
||||
Set datas= new HashSet();
|
||||
Set<String> datas= new HashSet<String>();
|
||||
TemplatePersistenceData[] data= fProjectStore.getTemplateData(false);
|
||||
for (int i= 0; i < data.length; i++) {
|
||||
String id= data[i].getId();
|
||||
for (TemplatePersistenceData element : data) {
|
||||
String id= element.getId();
|
||||
if (id == null) {
|
||||
id= data[i].getTemplate().getName();
|
||||
id= element.getTemplate().getName();
|
||||
}
|
||||
datas.add(id);
|
||||
}
|
||||
|
||||
data= fInstanceStore.getTemplateData(false);
|
||||
for (int i= 0; i < data.length; i++) {
|
||||
TemplatePersistenceData orig= data[i];
|
||||
for (TemplatePersistenceData orig : data) {
|
||||
String origId= orig.getId();
|
||||
if (origId == null) {
|
||||
origId= orig.getTemplate().getName();
|
||||
|
@ -155,9 +153,8 @@ public final class ProjectTemplateStore {
|
|||
TemplatePersistenceData data= fProjectStore.getTemplateData(id);
|
||||
if (data == null) {
|
||||
return; // does not exist
|
||||
} else {
|
||||
data.setDeleted(!projectSpecific);
|
||||
}
|
||||
data.setDeleted(!projectSpecific);
|
||||
}
|
||||
|
||||
public void restoreDefaults() {
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.eclipse.swt.events.FocusListener;
|
|||
import org.eclipse.swt.widgets.Control;
|
||||
|
||||
public class SelectionProviderMediator implements ISelectionProvider {
|
||||
private Map fProviders= new HashMap();
|
||||
private Map<Control, ISelectionProvider> fProviders= new HashMap<Control, ISelectionProvider>();
|
||||
private ISelectionProvider fActiveProvider = null;
|
||||
private ISelectionChangedListener fSelectionChangedListener;
|
||||
private FocusListener fFocusListener;
|
||||
|
@ -93,7 +93,7 @@ public class SelectionProviderMediator implements ISelectionProvider {
|
|||
}
|
||||
|
||||
protected void onFocusGained(FocusEvent e) {
|
||||
ISelectionProvider provider= (ISelectionProvider) fProviders.get(e.widget);
|
||||
ISelectionProvider provider= fProviders.get(e.widget);
|
||||
if (provider != null) {
|
||||
fActiveProvider= provider;
|
||||
fireSelectionChanged();
|
||||
|
|
|
@ -12,10 +12,11 @@
|
|||
package org.eclipse.cdt.internal.ui.viewsupport;
|
||||
|
||||
|
||||
import org.eclipse.cdt.ui.*;
|
||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||
|
||||
import org.eclipse.cdt.ui.CElementLabelProvider;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
|
||||
/**
|
||||
* CElementLabelProvider that respects settings from the Appearance preference page.
|
||||
|
@ -24,7 +25,7 @@ import org.eclipse.jface.util.PropertyChangeEvent;
|
|||
* @deprecated Use {@link AppearanceAwareLabelProvider} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public class StandardCElementLabelProvider extends AppearanceAwareLabelProvider implements IPropertyChangeListener {
|
||||
public class StandardCElementLabelProvider extends AppearanceAwareLabelProvider {
|
||||
|
||||
/**
|
||||
* Constructor for StandardCElementLabelProvider.
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.eclipse.ui.PlatformUI;
|
|||
public class StorageLabelProvider extends LabelProvider {
|
||||
|
||||
private IEditorRegistry fEditorRegistry= PlatformUI.getWorkbench().getEditorRegistry();
|
||||
private Map fJarImageMap= new HashMap(10);
|
||||
private Map<String, Image> fJarImageMap= new HashMap<String, Image>(10);
|
||||
private Image fDefaultImage;
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -66,9 +66,9 @@ public class StorageLabelProvider extends LabelProvider {
|
|||
@Override
|
||||
public void dispose() {
|
||||
if (fJarImageMap != null) {
|
||||
Iterator each= fJarImageMap.values().iterator();
|
||||
Iterator<Image> each= fJarImageMap.values().iterator();
|
||||
while (each.hasNext()) {
|
||||
Image image= (Image)each.next();
|
||||
Image image= each.next();
|
||||
image.dispose();
|
||||
}
|
||||
fJarImageMap= null;
|
||||
|
@ -91,7 +91,7 @@ public class StorageLabelProvider extends LabelProvider {
|
|||
|
||||
// Try to find icon for full name
|
||||
String name= element.getName();
|
||||
Image image= (Image)fJarImageMap.get(name);
|
||||
Image image= fJarImageMap.get(name);
|
||||
if (image != null)
|
||||
return image;
|
||||
IFileEditorMapping[] mappings= fEditorRegistry.getFileEditorMappings();
|
||||
|
@ -110,7 +110,7 @@ public class StorageLabelProvider extends LabelProvider {
|
|||
key= path.getFileExtension();
|
||||
if (key == null)
|
||||
return getDefaultImage();
|
||||
image= (Image)fJarImageMap.get(key);
|
||||
image= fJarImageMap.get(key);
|
||||
if (image != null)
|
||||
return image;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.eclipse.swt.widgets.TreeItem;
|
|||
*/
|
||||
public class TreeNavigator {
|
||||
private Tree fTree;
|
||||
private Class fDataClass;
|
||||
private Class<?> fDataClass;
|
||||
|
||||
/**
|
||||
* Creates a tree navigator for the given tree. It allows for finding tree items.
|
||||
|
@ -28,7 +28,7 @@ public class TreeNavigator {
|
|||
* @param tree the tree to operate on
|
||||
* @param dataClass the required class for the data of the tree nodes, or <code>null</code>.
|
||||
*/
|
||||
public TreeNavigator(Tree tree, Class dataClass) {
|
||||
public TreeNavigator(Tree tree, Class<?> dataClass) {
|
||||
fTree= tree;
|
||||
fDataClass= dataClass;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class WorkingSetFilter {
|
|||
private static final Object ACCEPT = new Object();
|
||||
private static final Object REJECT = new Object();
|
||||
|
||||
private HashMap fResourceFilter= null;
|
||||
private HashMap<IPath, Object> fResourceFilter= null;
|
||||
|
||||
public synchronized boolean isPartOfWorkingSet(ICElement elem) {
|
||||
if (fResourceFilter == null) {
|
||||
|
@ -79,7 +79,7 @@ public class WorkingSetFilter {
|
|||
}
|
||||
else {
|
||||
IAdaptable[] input = workingSetFilter.getElements();
|
||||
fResourceFilter = new HashMap();
|
||||
fResourceFilter = new HashMap<IPath, Object>();
|
||||
for (int i = 0; i < input.length; i++) {
|
||||
IAdaptable adaptable = input[i];
|
||||
IResource res = (IResource) adaptable.getAdapter(IResource.class);
|
||||
|
|
|
@ -166,9 +166,9 @@ public abstract class WorkingSetFilterUI {
|
|||
fWorkingSetFilterGroup.setWorkingSet(fWorkingSet);
|
||||
}
|
||||
|
||||
public List getRecent() {
|
||||
public List<String> getRecent() {
|
||||
IWorkingSet[] workingSets= fWSManager.getRecentWorkingSets();
|
||||
ArrayList result= new ArrayList(workingSets.length);
|
||||
ArrayList<String> result= new ArrayList<String>(workingSets.length);
|
||||
for (int i = 0; i < workingSets.length; i++) {
|
||||
result.add(workingSets[i].getName());
|
||||
}
|
||||
|
|
|
@ -12,9 +12,6 @@ package org.eclipse.cdt.internal.ui.wizards;
|
|||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
|
||||
import org.eclipse.cdt.internal.ui.util.PixelConverter;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
|
@ -38,9 +35,14 @@ import org.eclipse.ui.IWorkbenchWindowActionDelegate;
|
|||
import org.eclipse.ui.IWorkbenchWizard;
|
||||
import org.eclipse.ui.actions.NewProjectAction;
|
||||
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
|
||||
import org.eclipse.cdt.internal.ui.util.PixelConverter;
|
||||
|
||||
public abstract class AbstractOpenWizardAction extends Action implements IWorkbenchWindowActionDelegate {
|
||||
|
||||
private Class[] fActivatedOnTypes;
|
||||
private Class<?>[] fActivatedOnTypes;
|
||||
private boolean fAcceptEmptySelection;
|
||||
|
||||
/**
|
||||
|
@ -59,7 +61,7 @@ public abstract class AbstractOpenWizardAction extends Action implements IWorkbe
|
|||
* are of the given types. <code>null</code> will allow all types.
|
||||
* @param acceptEmptySelection Specifies if the action allows an empty selection
|
||||
*/
|
||||
public AbstractOpenWizardAction(String label, Class[] activatedOnTypes, boolean acceptEmptySelection) {
|
||||
public AbstractOpenWizardAction(String label, Class<?>[] activatedOnTypes, boolean acceptEmptySelection) {
|
||||
super(label);
|
||||
fActivatedOnTypes= activatedOnTypes;
|
||||
fAcceptEmptySelection= acceptEmptySelection;
|
||||
|
@ -80,8 +82,8 @@ public abstract class AbstractOpenWizardAction extends Action implements IWorkbe
|
|||
|
||||
private boolean isOfAcceptedType(Object obj) {
|
||||
if (fActivatedOnTypes != null) {
|
||||
for (int i= 0; i < fActivatedOnTypes.length; i++) {
|
||||
if (fActivatedOnTypes[i].isInstance(obj)) {
|
||||
for (Class<?> activatedOnType : fActivatedOnTypes) {
|
||||
if (activatedOnType.isInstance(obj)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -92,7 +94,7 @@ public abstract class AbstractOpenWizardAction extends Action implements IWorkbe
|
|||
|
||||
|
||||
private boolean isEnabled(IStructuredSelection selection) {
|
||||
Iterator iter= selection.iterator();
|
||||
Iterator<?> iter= selection.iterator();
|
||||
while (iter.hasNext()) {
|
||||
Object obj= iter.next();
|
||||
if (!isOfAcceptedType(obj) || !shouldAcceptElement(obj)) {
|
||||
|
|
|
@ -13,13 +13,14 @@ package org.eclipse.cdt.internal.ui.wizards;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.IExtensionPoint;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
/**
|
||||
* Convenience class for drop-in C/C++ Wizard contributions.
|
||||
*/
|
||||
|
@ -94,7 +95,7 @@ public class CWizardRegistry {
|
|||
* @return an array of IConfigurationElement
|
||||
*/
|
||||
public static IConfigurationElement[] getProjectWizardElements() {
|
||||
List elemList = new ArrayList();
|
||||
List<IConfigurationElement> elemList = new ArrayList<IConfigurationElement>();
|
||||
IConfigurationElement[] elements = getAllWizardElements();
|
||||
for (int i = 0; i < elements.length; ++i) {
|
||||
IConfigurationElement element = elements[i];
|
||||
|
@ -102,7 +103,7 @@ public class CWizardRegistry {
|
|||
elemList.add(element);
|
||||
}
|
||||
}
|
||||
return (IConfigurationElement[]) elemList.toArray(new IConfigurationElement[elemList.size()]);
|
||||
return elemList.toArray(new IConfigurationElement[elemList.size()]);
|
||||
}
|
||||
|
||||
private static boolean isProjectWizard(IConfigurationElement element) {
|
||||
|
@ -113,10 +114,9 @@ public class CWizardRegistry {
|
|||
|
||||
IConfigurationElement[] classElements = element.getChildren(TAG_CLASS);
|
||||
if (classElements.length > 0) {
|
||||
for (int i = 0; i < classElements.length; i++) {
|
||||
IConfigurationElement[] paramElements = classElements[i].getChildren(TAG_PARAMETER);
|
||||
for (int k = 0; k < paramElements.length; k++) {
|
||||
IConfigurationElement curr = paramElements[k];
|
||||
for (IConfigurationElement classElement : classElements) {
|
||||
IConfigurationElement[] paramElements = classElement.getChildren(TAG_PARAMETER);
|
||||
for (IConfigurationElement curr : paramElements) {
|
||||
String name = curr.getAttribute(TAG_NAME);
|
||||
if (name != null && (name.equals(ATT_CPROJECT) || name.equals(ATT_CCPROJECT))) {
|
||||
String value = curr.getAttribute(TAG_VALUE);
|
||||
|
@ -162,7 +162,7 @@ public class CWizardRegistry {
|
|||
* @return an array of IConfigurationElement
|
||||
*/
|
||||
public static IConfigurationElement[] getTypeWizardElements() {
|
||||
List elemList = new ArrayList();
|
||||
List<IConfigurationElement> elemList = new ArrayList<IConfigurationElement>();
|
||||
IConfigurationElement[] elements = getAllWizardElements();
|
||||
for (int i = 0; i < elements.length; ++i) {
|
||||
IConfigurationElement element = elements[i];
|
||||
|
@ -170,16 +170,15 @@ public class CWizardRegistry {
|
|||
elemList.add(element);
|
||||
}
|
||||
}
|
||||
return (IConfigurationElement[]) elemList.toArray(new IConfigurationElement[elemList.size()]);
|
||||
return elemList.toArray(new IConfigurationElement[elemList.size()]);
|
||||
}
|
||||
|
||||
private static boolean isTypeWizard(IConfigurationElement element) {
|
||||
IConfigurationElement[] classElements = element.getChildren(TAG_CLASS);
|
||||
if (classElements.length > 0) {
|
||||
for (int i = 0; i < classElements.length; i++) {
|
||||
IConfigurationElement[] paramElements = classElements[i].getChildren(TAG_PARAMETER);
|
||||
for (int k = 0; k < paramElements.length; k++) {
|
||||
IConfigurationElement curr = paramElements[k];
|
||||
for (IConfigurationElement classElement : classElements) {
|
||||
IConfigurationElement[] paramElements = classElement.getChildren(TAG_PARAMETER);
|
||||
for (IConfigurationElement curr : paramElements) {
|
||||
String name = curr.getAttribute(TAG_NAME);
|
||||
if (name != null && name.equals(ATT_CTYPE)) {
|
||||
String value = curr.getAttribute(TAG_VALUE);
|
||||
|
@ -223,7 +222,7 @@ public class CWizardRegistry {
|
|||
* @return an array of IConfigurationElement
|
||||
*/
|
||||
public static IConfigurationElement[] getFileWizardElements() {
|
||||
List elemList = new ArrayList();
|
||||
List<IConfigurationElement> elemList = new ArrayList<IConfigurationElement>();
|
||||
IConfigurationElement[] elements = getAllWizardElements();
|
||||
for (int i = 0; i < elements.length; ++i) {
|
||||
IConfigurationElement element = elements[i];
|
||||
|
@ -231,16 +230,15 @@ public class CWizardRegistry {
|
|||
elemList.add(element);
|
||||
}
|
||||
}
|
||||
return (IConfigurationElement[]) elemList.toArray(new IConfigurationElement[elemList.size()]);
|
||||
return elemList.toArray(new IConfigurationElement[elemList.size()]);
|
||||
}
|
||||
|
||||
private static boolean isFileWizard(IConfigurationElement element) {
|
||||
IConfigurationElement[] classElements = element.getChildren(TAG_CLASS);
|
||||
if (classElements.length > 0) {
|
||||
for (int i = 0; i < classElements.length; i++) {
|
||||
IConfigurationElement[] paramElements = classElements[i].getChildren(TAG_PARAMETER);
|
||||
for (int k = 0; k < paramElements.length; k++) {
|
||||
IConfigurationElement curr = paramElements[k];
|
||||
for (IConfigurationElement classElement : classElements) {
|
||||
IConfigurationElement[] paramElements = classElement.getChildren(TAG_PARAMETER);
|
||||
for (IConfigurationElement curr : paramElements) {
|
||||
String name = curr.getAttribute(TAG_NAME);
|
||||
if (name != null && name.equals(ATT_CFILE)) {
|
||||
String value = curr.getAttribute(TAG_VALUE);
|
||||
|
@ -284,7 +282,7 @@ public class CWizardRegistry {
|
|||
* @return an array of IConfigurationElement
|
||||
*/
|
||||
public static IConfigurationElement[] getFolderWizardElements() {
|
||||
List elemList = new ArrayList();
|
||||
List<IConfigurationElement> elemList = new ArrayList<IConfigurationElement>();
|
||||
IConfigurationElement[] elements = getAllWizardElements();
|
||||
for (int i = 0; i < elements.length; ++i) {
|
||||
IConfigurationElement element = elements[i];
|
||||
|
@ -292,16 +290,15 @@ public class CWizardRegistry {
|
|||
elemList.add(element);
|
||||
}
|
||||
}
|
||||
return (IConfigurationElement[]) elemList.toArray(new IConfigurationElement[elemList.size()]);
|
||||
return elemList.toArray(new IConfigurationElement[elemList.size()]);
|
||||
}
|
||||
|
||||
private static boolean isFolderWizard(IConfigurationElement element) {
|
||||
IConfigurationElement[] classElements = element.getChildren(TAG_CLASS);
|
||||
if (classElements.length > 0) {
|
||||
for (int i = 0; i < classElements.length; i++) {
|
||||
IConfigurationElement[] paramElements = classElements[i].getChildren(TAG_PARAMETER);
|
||||
for (int k = 0; k < paramElements.length; k++) {
|
||||
IConfigurationElement curr = paramElements[k];
|
||||
for (IConfigurationElement classElement : classElements) {
|
||||
IConfigurationElement[] paramElements = classElement.getChildren(TAG_PARAMETER);
|
||||
for (IConfigurationElement curr : paramElements) {
|
||||
String name = curr.getAttribute(TAG_NAME);
|
||||
if (name != null && name.equals(ATT_CFOLDER)) {
|
||||
String value = curr.getAttribute(TAG_VALUE);
|
||||
|
@ -319,7 +316,7 @@ public class CWizardRegistry {
|
|||
}
|
||||
|
||||
private static String[] getWizardIDs(IConfigurationElement[] elements) {
|
||||
List idList = new ArrayList();
|
||||
List<String> idList = new ArrayList<String>();
|
||||
|
||||
// add C wizards first
|
||||
for (int i = 0; i < elements.length; ++i) {
|
||||
|
@ -342,12 +339,12 @@ public class CWizardRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
return (String[]) idList.toArray(new String[idList.size()]);
|
||||
return idList.toArray(new String[idList.size()]);
|
||||
}
|
||||
|
||||
private static IAction[] createActions(IConfigurationElement[] elements) {
|
||||
List idList = new ArrayList();
|
||||
List actionList = new ArrayList();
|
||||
List<String> idList = new ArrayList<String>();
|
||||
List<IAction> actionList = new ArrayList<IAction>();
|
||||
|
||||
// add C wizards first
|
||||
for (int i = 0; i < elements.length; ++i) {
|
||||
|
@ -357,9 +354,7 @@ public class CWizardRegistry {
|
|||
if (id != null && !idList.contains(id)) {
|
||||
idList.add(id);
|
||||
IAction action = new OpenNewWizardAction(element);
|
||||
if (action != null) {
|
||||
actionList.add(action);
|
||||
}
|
||||
actionList.add(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -371,14 +366,12 @@ public class CWizardRegistry {
|
|||
if (id != null && !idList.contains(id)) {
|
||||
idList.add(id);
|
||||
IAction action = new OpenNewWizardAction(element);
|
||||
if (action != null) {
|
||||
actionList.add(action);
|
||||
}
|
||||
actionList.add(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (IAction[]) actionList.toArray(new IAction[actionList.size()]);
|
||||
return actionList.toArray(new IAction[actionList.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -396,12 +389,11 @@ public class CWizardRegistry {
|
|||
* @return an array of IConfigurationElement
|
||||
*/
|
||||
public static IConfigurationElement[] getAllWizardElements() {
|
||||
List elemList = new ArrayList();
|
||||
List<IConfigurationElement> elemList = new ArrayList<IConfigurationElement>();
|
||||
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID, PL_NEW);
|
||||
if (extensionPoint != null) {
|
||||
IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
|
||||
for (int i = 0; i < elements.length; i++) {
|
||||
IConfigurationElement element= elements[i];
|
||||
for (IConfigurationElement element : elements) {
|
||||
if (element.getName().equals(TAG_WIZARD)) {
|
||||
String category = element.getAttribute(ATT_CATEGORY);
|
||||
if (category != null &&
|
||||
|
@ -412,7 +404,7 @@ public class CWizardRegistry {
|
|||
}
|
||||
}
|
||||
}
|
||||
return (IConfigurationElement[]) elemList.toArray(new IConfigurationElement[elemList.size()]);
|
||||
return elemList.toArray(new IConfigurationElement[elemList.size()]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,10 +30,10 @@ import org.eclipse.cdt.internal.ui.dialogs.TypedViewerFilter;
|
|||
|
||||
public class SourceFolderSelectionDialog extends ElementTreeSelectionDialog {
|
||||
|
||||
private static final Class[] VALIDATOR_CLASSES = new Class[] { ICContainer.class, ICProject.class };
|
||||
private static final Class<?>[] VALIDATOR_CLASSES = new Class<?>[] { ICContainer.class, ICProject.class };
|
||||
private static final TypedElementSelectionValidator fValidator = new TypedElementSelectionValidator(VALIDATOR_CLASSES, false);
|
||||
|
||||
private static final Class[] FILTER_CLASSES = new Class[] { ICModel.class, ICContainer.class, ICProject.class };
|
||||
private static final Class<?>[] FILTER_CLASSES = new Class<?>[] { ICModel.class, ICContainer.class, ICProject.class };
|
||||
private static final ViewerFilter fFilter = new TypedViewerFilter(FILTER_CLASSES);
|
||||
|
||||
private static final ViewerSorter fSorter = new CElementSorter();
|
||||
|
|
|
@ -13,9 +13,6 @@ package org.eclipse.cdt.internal.ui.wizards.classwizard;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IListAdapter;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.ListDialogField;
|
||||
import org.eclipse.jface.viewers.CellEditor;
|
||||
import org.eclipse.jface.viewers.ColumnLayoutData;
|
||||
import org.eclipse.jface.viewers.ColumnWeightData;
|
||||
|
@ -29,7 +26,12 @@ import org.eclipse.swt.widgets.Composite;
|
|||
import org.eclipse.swt.widgets.Item;
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
|
||||
public class BaseClassesListDialogField extends ListDialogField {
|
||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IListAdapter;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.ListDialogField;
|
||||
|
||||
public class BaseClassesListDialogField extends ListDialogField<IBaseClassInfo> {
|
||||
|
||||
// column properties
|
||||
private static final String CP_NAME = "name"; //$NON-NLS-1$
|
||||
|
@ -97,7 +99,7 @@ public class BaseClassesListDialogField extends ListDialogField {
|
|||
}
|
||||
}
|
||||
|
||||
public BaseClassesListDialogField(String title, IListAdapter listAdapter) {
|
||||
public BaseClassesListDialogField(String title, IListAdapter<IBaseClassInfo> listAdapter) {
|
||||
super(listAdapter,
|
||||
new String[] {
|
||||
/* 0 */ NewClassWizardMessages.getString("BaseClassesListDialogField.buttons.add"), //$NON-NLS-1$
|
||||
|
@ -174,7 +176,7 @@ public class BaseClassesListDialogField extends ListDialogField {
|
|||
}
|
||||
|
||||
public IBaseClassInfo[] getBaseClasses() {
|
||||
List baseClasses = getElements();
|
||||
return (IBaseClassInfo[]) baseClasses.toArray(new IBaseClassInfo[baseClasses.size()]);
|
||||
List<IBaseClassInfo> baseClasses = getElements();
|
||||
return baseClasses.toArray(new IBaseClassInfo[baseClasses.size()]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,10 +13,6 @@ package org.eclipse.cdt.internal.ui.wizards.classwizard;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.CheckedListDialogField;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IListAdapter;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.ListDialogField;
|
||||
import org.eclipse.jface.viewers.CellEditor;
|
||||
import org.eclipse.jface.viewers.ColumnLayoutData;
|
||||
import org.eclipse.jface.viewers.ColumnWeightData;
|
||||
|
@ -30,7 +26,13 @@ import org.eclipse.swt.widgets.Composite;
|
|||
import org.eclipse.swt.widgets.Item;
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
|
||||
public class MethodStubsListDialogField extends CheckedListDialogField {
|
||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.CheckedListDialogField;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IListAdapter;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.ListDialogField;
|
||||
|
||||
public class MethodStubsListDialogField extends CheckedListDialogField<IMethodStub> {
|
||||
|
||||
// column properties
|
||||
private static final String CP_NAME = "name"; //$NON-NLS-1$
|
||||
|
@ -116,7 +118,7 @@ public class MethodStubsListDialogField extends CheckedListDialogField {
|
|||
}
|
||||
}
|
||||
|
||||
public MethodStubsListDialogField(String title, IListAdapter listAdapter) {
|
||||
public MethodStubsListDialogField(String title, IListAdapter<IMethodStub> listAdapter) {
|
||||
super(listAdapter, null, new MethodStubsLabelProvider());
|
||||
setLabelText(title);
|
||||
|
||||
|
@ -189,12 +191,12 @@ public class MethodStubsListDialogField extends CheckedListDialogField {
|
|||
}
|
||||
|
||||
public IMethodStub[] getMethodStubs() {
|
||||
List allStubs = getElements();
|
||||
return (IMethodStub[]) allStubs.toArray(new IMethodStub[allStubs.size()]);
|
||||
List<IMethodStub> allStubs = getElements();
|
||||
return allStubs.toArray(new IMethodStub[allStubs.size()]);
|
||||
}
|
||||
|
||||
public IMethodStub[] getCheckedMethodStubs() {
|
||||
List checkedStubs = getCheckedElements();
|
||||
return (IMethodStub[]) checkedStubs.toArray(new IMethodStub[checkedStubs.size()]);
|
||||
List<IMethodStub> checkedStubs = getCheckedElements();
|
||||
return checkedStubs.toArray(new IMethodStub[checkedStubs.size()]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ public class NewBaseClassSelectionDialog extends TypeSelectionDialog {
|
|||
private static final String DIALOG_SETTINGS = NewBaseClassSelectionDialog.class.getName();
|
||||
private static final int[] VISIBLE_TYPES = { ICElement.C_CLASS, ICElement.C_STRUCT };
|
||||
private static final int ADD_ID = IDialogConstants.CLIENT_ID + 1;
|
||||
private List fTypeList;
|
||||
private List fTypeListeners;
|
||||
private List<ITypeInfo> fTypeList;
|
||||
private List<ITypeSelectionListener> fTypeListeners;
|
||||
|
||||
public interface ITypeSelectionListener {
|
||||
void typeAdded(ITypeInfo baseClass);
|
||||
|
@ -45,8 +45,8 @@ public class NewBaseClassSelectionDialog extends TypeSelectionDialog {
|
|||
setVisibleTypes(VISIBLE_TYPES);
|
||||
setFilter("*", true); //$NON-NLS-1$
|
||||
setStatusLineAboveButtons(true);
|
||||
fTypeList = new ArrayList();
|
||||
fTypeListeners = new ArrayList();
|
||||
fTypeList = new ArrayList<ITypeInfo>();
|
||||
fTypeListeners = new ArrayList<ITypeSelectionListener>();
|
||||
}
|
||||
|
||||
public void addListener(ITypeSelectionListener listener) {
|
||||
|
@ -60,15 +60,15 @@ public class NewBaseClassSelectionDialog extends TypeSelectionDialog {
|
|||
|
||||
private void notifyTypeAddedListeners(ITypeInfo type) {
|
||||
// first copy listeners in case one calls removeListener
|
||||
List list = new ArrayList(fTypeListeners);
|
||||
for (Iterator i = list.iterator(); i.hasNext(); ) {
|
||||
ITypeSelectionListener listener = (ITypeSelectionListener) i.next();
|
||||
List<ITypeSelectionListener> list = new ArrayList<ITypeSelectionListener>(fTypeListeners);
|
||||
for (Iterator<ITypeSelectionListener> i = list.iterator(); i.hasNext(); ) {
|
||||
ITypeSelectionListener listener = i.next();
|
||||
listener.typeAdded(type);
|
||||
}
|
||||
}
|
||||
|
||||
public ITypeInfo[] getAddedTypes() {
|
||||
return (ITypeInfo[])fTypeList.toArray(new ITypeInfo[fTypeList.size()]);
|
||||
return fTypeList.toArray(new ITypeInfo[fTypeList.size()]);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -158,32 +158,32 @@ public class NewClassCodeGenerator {
|
|||
if (fHeaderPath != null) {
|
||||
|
||||
// get method stubs
|
||||
List publicMethods = getStubs(ASTAccessVisibility.PUBLIC, false);
|
||||
List protectedMethods = getStubs(ASTAccessVisibility.PROTECTED, false);
|
||||
List privateMethods = getStubs(ASTAccessVisibility.PRIVATE, false);
|
||||
List<IMethodStub> publicMethods = getStubs(ASTAccessVisibility.PUBLIC, false);
|
||||
List<IMethodStub> protectedMethods = getStubs(ASTAccessVisibility.PROTECTED, false);
|
||||
List<IMethodStub> privateMethods = getStubs(ASTAccessVisibility.PRIVATE, false);
|
||||
|
||||
IFile headerFile = NewSourceFileGenerator.createHeaderFile(fHeaderPath, true, new SubProgressMonitor(monitor, 50));
|
||||
if (headerFile != null) {
|
||||
headerTU = (ITranslationUnit) CoreModel.getDefault().create(headerFile);
|
||||
|
||||
// create a working copy with a new owner
|
||||
headerWorkingCopy = headerTU.getWorkingCopy();
|
||||
// headerWorkingCopy = headerTU.getSharedWorkingCopy(null, CUIPlugin.getDefault().getBufferFactory());
|
||||
|
||||
String headerContent = constructHeaderFileContent(headerTU, publicMethods, protectedMethods, privateMethods, headerWorkingCopy.getBuffer().getContents(), new SubProgressMonitor(monitor, 100));
|
||||
headerContent= formatSource(headerContent, headerTU);
|
||||
headerWorkingCopy.getBuffer().setContents(headerContent);
|
||||
|
||||
if (monitor.isCanceled()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
|
||||
headerWorkingCopy.reconcile();
|
||||
headerWorkingCopy.commit(true, monitor);
|
||||
monitor.worked(50);
|
||||
|
||||
createdClass = headerWorkingCopy.getElement(fFullyQualifiedClassName);
|
||||
}
|
||||
|
||||
// create a working copy with a new owner
|
||||
headerWorkingCopy = headerTU.getWorkingCopy();
|
||||
// headerWorkingCopy = headerTU.getSharedWorkingCopy(null, CUIPlugin.getDefault().getBufferFactory());
|
||||
|
||||
String headerContent = constructHeaderFileContent(headerTU, publicMethods, protectedMethods, privateMethods, headerWorkingCopy.getBuffer().getContents(), new SubProgressMonitor(monitor, 100));
|
||||
headerContent= formatSource(headerContent, headerTU);
|
||||
headerWorkingCopy.getBuffer().setContents(headerContent);
|
||||
|
||||
if (monitor.isCanceled()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
|
||||
headerWorkingCopy.reconcile();
|
||||
headerWorkingCopy.commit(true, monitor);
|
||||
monitor.worked(50);
|
||||
|
||||
createdClass = headerWorkingCopy.getElement(fFullyQualifiedClassName);
|
||||
fCreatedClass = createdClass;
|
||||
fCreatedHeaderTU = headerTU;
|
||||
}
|
||||
|
@ -191,9 +191,9 @@ public class NewClassCodeGenerator {
|
|||
if (fSourcePath != null) {
|
||||
|
||||
// get method stubs
|
||||
List publicMethods = getStubs(ASTAccessVisibility.PUBLIC, true);
|
||||
List protectedMethods = getStubs(ASTAccessVisibility.PROTECTED, true);
|
||||
List privateMethods = getStubs(ASTAccessVisibility.PRIVATE, true);
|
||||
List<IMethodStub> publicMethods = getStubs(ASTAccessVisibility.PUBLIC, true);
|
||||
List<IMethodStub> protectedMethods = getStubs(ASTAccessVisibility.PROTECTED, true);
|
||||
List<IMethodStub> privateMethods = getStubs(ASTAccessVisibility.PRIVATE, true);
|
||||
|
||||
if (publicMethods.isEmpty() && protectedMethods.isEmpty() && privateMethods.isEmpty()) {
|
||||
//TODO need prefs option
|
||||
|
@ -203,23 +203,23 @@ public class NewClassCodeGenerator {
|
|||
IFile sourceFile = NewSourceFileGenerator.createSourceFile(fSourcePath, true, new SubProgressMonitor(monitor, 50));
|
||||
if (sourceFile != null) {
|
||||
sourceTU = (ITranslationUnit) CoreModel.getDefault().create(sourceFile);
|
||||
monitor.worked(50);
|
||||
|
||||
// create a working copy with a new owner
|
||||
sourceWorkingCopy = sourceTU.getWorkingCopy();
|
||||
|
||||
String sourceContent = constructSourceFileContent(sourceTU, headerTU, publicMethods, protectedMethods, privateMethods, sourceWorkingCopy.getBuffer().getContents(), new SubProgressMonitor(monitor, 100));
|
||||
sourceContent= formatSource(sourceContent, sourceTU);
|
||||
sourceWorkingCopy.getBuffer().setContents(sourceContent);
|
||||
|
||||
if (monitor.isCanceled()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
|
||||
sourceWorkingCopy.reconcile();
|
||||
sourceWorkingCopy.commit(true, monitor);
|
||||
monitor.worked(50);
|
||||
}
|
||||
monitor.worked(50);
|
||||
|
||||
// create a working copy with a new owner
|
||||
sourceWorkingCopy = sourceTU.getWorkingCopy();
|
||||
|
||||
String sourceContent = constructSourceFileContent(sourceTU, headerTU, publicMethods, protectedMethods, privateMethods, sourceWorkingCopy.getBuffer().getContents(), new SubProgressMonitor(monitor, 100));
|
||||
sourceContent= formatSource(sourceContent, sourceTU);
|
||||
sourceWorkingCopy.getBuffer().setContents(sourceContent);
|
||||
|
||||
if (monitor.isCanceled()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
|
||||
sourceWorkingCopy.reconcile();
|
||||
sourceWorkingCopy.commit(true, monitor);
|
||||
monitor.worked(50);
|
||||
|
||||
fCreatedSourceTU = sourceTU;
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ public class NewClassCodeGenerator {
|
|||
return content;
|
||||
}
|
||||
|
||||
public String constructHeaderFileContent(ITranslationUnit headerTU, List publicMethods, List protectedMethods, List privateMethods, String oldContents, IProgressMonitor monitor) throws CoreException {
|
||||
public String constructHeaderFileContent(ITranslationUnit headerTU, List<IMethodStub> publicMethods, List<IMethodStub> protectedMethods, List<IMethodStub> privateMethods, String oldContents, IProgressMonitor monitor) throws CoreException {
|
||||
monitor.beginTask(NewClassWizardMessages.getString("NewClassCodeGeneration.createType.task.header"), 100); //$NON-NLS-1$
|
||||
|
||||
String lineDelimiter= StubUtility.getLineDelimiterUsed(headerTU);
|
||||
|
@ -424,12 +424,11 @@ public class NewClassCodeGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
private void addMethodDeclarations(ITranslationUnit tu, List publicMethods, List protectedMethods, List privateMethods, StringBuffer text, String lineDelimiter) throws CoreException {
|
||||
private void addMethodDeclarations(ITranslationUnit tu, List<IMethodStub> publicMethods, List<IMethodStub> protectedMethods, List<IMethodStub> privateMethods, StringBuffer text, String lineDelimiter) throws CoreException {
|
||||
if (!publicMethods.isEmpty()) {
|
||||
text.append("public:"); //$NON-NLS-1$
|
||||
text.append(lineDelimiter);
|
||||
for (Iterator i = publicMethods.iterator(); i.hasNext();) {
|
||||
IMethodStub stub = (IMethodStub) i.next();
|
||||
for (IMethodStub stub : publicMethods) {
|
||||
String code = stub.createMethodDeclaration(tu, fClassName, fBaseClasses, lineDelimiter);
|
||||
text.append('\t');
|
||||
text.append(code);
|
||||
|
@ -440,8 +439,7 @@ public class NewClassCodeGenerator {
|
|||
if (!protectedMethods.isEmpty()) {
|
||||
text.append("protected:"); //$NON-NLS-1$
|
||||
text.append(lineDelimiter);
|
||||
for (Iterator i = protectedMethods.iterator(); i.hasNext();) {
|
||||
IMethodStub stub = (IMethodStub) i.next();
|
||||
for (IMethodStub stub : protectedMethods) {
|
||||
String code = stub.createMethodDeclaration(tu, fClassName, fBaseClasses, lineDelimiter);
|
||||
text.append('\t');
|
||||
text.append(code);
|
||||
|
@ -452,8 +450,7 @@ public class NewClassCodeGenerator {
|
|||
if (!privateMethods.isEmpty()) {
|
||||
text.append("private:"); //$NON-NLS-1$
|
||||
text.append(lineDelimiter);
|
||||
for (Iterator i = privateMethods.iterator(); i.hasNext();) {
|
||||
IMethodStub stub = (IMethodStub) i.next();
|
||||
for (IMethodStub stub : privateMethods) {
|
||||
String code = stub.createMethodDeclaration(tu, fClassName, fBaseClasses, lineDelimiter);
|
||||
text.append('\t');
|
||||
text.append(code);
|
||||
|
@ -462,8 +459,8 @@ public class NewClassCodeGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
private List getStubs(ASTAccessVisibility access, boolean skipInline) {
|
||||
List list = new ArrayList();
|
||||
private List<IMethodStub> getStubs(ASTAccessVisibility access, boolean skipInline) {
|
||||
List<IMethodStub> list = new ArrayList<IMethodStub>();
|
||||
if (fMethodStubs != null) {
|
||||
for (int i = 0; i < fMethodStubs.length; ++i) {
|
||||
IMethodStub stub = fMethodStubs[i];
|
||||
|
@ -508,23 +505,22 @@ public class NewClassCodeGenerator {
|
|||
IPath projectLocation = project.getLocation();
|
||||
IPath headerLocation = headerTU.getResource().getLocation();
|
||||
|
||||
List includePaths = getIncludePaths(headerTU);
|
||||
List baseClassPaths = getBaseClassPaths(verifyBaseClasses());
|
||||
List<IPath> includePaths = getIncludePaths(headerTU);
|
||||
List<IPath> baseClassPaths = getBaseClassPaths(verifyBaseClasses());
|
||||
|
||||
// add the missing include paths to the project
|
||||
if (createIncludePaths()) {
|
||||
List newIncludePaths = getMissingIncludePaths(projectLocation, includePaths, baseClassPaths);
|
||||
List<IPath> newIncludePaths = getMissingIncludePaths(projectLocation, includePaths, baseClassPaths);
|
||||
if (!newIncludePaths.isEmpty()) {
|
||||
addIncludePaths(cProject, newIncludePaths, monitor);
|
||||
}
|
||||
}
|
||||
|
||||
List systemIncludes = new ArrayList();
|
||||
List localIncludes = new ArrayList();
|
||||
List<IPath> systemIncludes = new ArrayList<IPath>();
|
||||
List<IPath> localIncludes = new ArrayList<IPath>();
|
||||
|
||||
// sort the include paths into system and local
|
||||
for (Iterator bcIter = baseClassPaths.iterator(); bcIter.hasNext(); ) {
|
||||
IPath baseClassLocation = (IPath) bcIter.next();
|
||||
for (IPath baseClassLocation : baseClassPaths) {
|
||||
boolean isSystemIncludePath = false;
|
||||
|
||||
IPath includePath = PathUtil.makeRelativePathToProjectIncludes(baseClassLocation, project);
|
||||
|
@ -547,9 +543,8 @@ public class NewClassCodeGenerator {
|
|||
}
|
||||
|
||||
// write the system include paths, e.g. #include <header.h>
|
||||
for (Iterator i = systemIncludes.iterator(); i.hasNext(); ) {
|
||||
IPath includePath = (IPath) i.next();
|
||||
if (!(headerTU.getElementName().equals(includePath.toString()))) {
|
||||
for (IPath includePath : systemIncludes) {
|
||||
if (!(headerTU.getElementName().equals(includePath.toString()))) {
|
||||
String include = getIncludeString(includePath.toString(), true);
|
||||
text.append(include);
|
||||
text.append(lineDelimiter);
|
||||
|
@ -557,9 +552,8 @@ public class NewClassCodeGenerator {
|
|||
}
|
||||
|
||||
// write the local include paths, e.g. #include "header.h"
|
||||
for (Iterator i = localIncludes.iterator(); i.hasNext(); ) {
|
||||
IPath includePath = (IPath) i.next();
|
||||
if (!(headerTU.getElementName().equals(includePath.toString()))) {
|
||||
for (IPath includePath : localIncludes) {
|
||||
if (!(headerTU.getElementName().equals(includePath.toString()))) {
|
||||
String include = getIncludeString(includePath.toString(), false);
|
||||
text.append(include);
|
||||
text.append(lineDelimiter);
|
||||
|
@ -587,14 +581,14 @@ public class NewClassCodeGenerator {
|
|||
return NewClassWizardPrefs.createIncludePaths();
|
||||
}
|
||||
|
||||
private void addIncludePaths(ICProject cProject, List newIncludePaths, IProgressMonitor monitor) throws CodeGeneratorException {
|
||||
private void addIncludePaths(ICProject cProject, List<IPath> newIncludePaths, IProgressMonitor monitor) throws CodeGeneratorException {
|
||||
monitor.beginTask(NewClassWizardMessages.getString("NewClassCodeGeneration.createType.task.header.addIncludePaths"), 100); //$NON-NLS-1$
|
||||
|
||||
//TODO prefs option whether to add to project or parent source folder?
|
||||
IPath addToResourcePath = cProject.getPath();
|
||||
try {
|
||||
List pathEntryList = new ArrayList();
|
||||
List checkEntryList = new ArrayList();
|
||||
List<IPathEntry> pathEntryList = new ArrayList<IPathEntry>();
|
||||
List<IPathEntry> checkEntryList = new ArrayList<IPathEntry>();
|
||||
|
||||
IPathEntry[] checkEntries = cProject.getResolvedPathEntries();
|
||||
IPathEntry[] pathEntries = cProject.getRawPathEntries();
|
||||
|
@ -603,14 +597,12 @@ public class NewClassCodeGenerator {
|
|||
pathEntryList.add(pathEntries[i]);
|
||||
}
|
||||
}
|
||||
for (int i=0; i < checkEntries.length; i++) {
|
||||
if (checkEntries[i] instanceof IIncludeEntry)
|
||||
checkEntryList.add(checkEntries[i]);
|
||||
for (IPathEntry checkEntrie : checkEntries) {
|
||||
if (checkEntrie instanceof IIncludeEntry)
|
||||
checkEntryList.add(checkEntrie);
|
||||
}
|
||||
|
||||
for (Iterator ipIter = newIncludePaths.iterator(); ipIter.hasNext(); ) {
|
||||
IPath folderToAdd = (IPath) ipIter.next();
|
||||
|
||||
for (IPath folderToAdd : newIncludePaths) {
|
||||
// do not add any #includes that are local to the project
|
||||
if (cProject.getPath().segment(0).equals(folderToAdd.segment(0)))
|
||||
continue;
|
||||
|
@ -624,7 +616,7 @@ public class NewClassCodeGenerator {
|
|||
pathEntryList.add(entry);
|
||||
}
|
||||
}
|
||||
pathEntries = (IPathEntry[]) pathEntryList.toArray(new IPathEntry[pathEntryList.size()]);
|
||||
pathEntries = pathEntryList.toArray(new IPathEntry[pathEntryList.size()]);
|
||||
cProject.setRawPathEntries(pathEntries, new SubProgressMonitor(monitor, 80));
|
||||
} catch (CModelException e) {
|
||||
throw new CodeGeneratorException(e);
|
||||
|
@ -632,12 +624,10 @@ public class NewClassCodeGenerator {
|
|||
monitor.done();
|
||||
}
|
||||
|
||||
private List getMissingIncludePaths(IPath projectLocation, List includePaths, List baseClassPaths) {
|
||||
private List<IPath> getMissingIncludePaths(IPath projectLocation, List<IPath> includePaths, List<IPath> baseClassPaths) {
|
||||
// check for missing include paths
|
||||
List newIncludePaths = new ArrayList();
|
||||
for (Iterator bcIter = baseClassPaths.iterator(); bcIter.hasNext(); ) {
|
||||
IPath baseClassLocation = (IPath) bcIter.next();
|
||||
|
||||
List<IPath> newIncludePaths = new ArrayList<IPath>();
|
||||
for (IPath baseClassLocation : baseClassPaths) {
|
||||
// skip any paths inside the same project
|
||||
//TODO possibly a preferences option?
|
||||
if (projectLocation.isPrefixOf(baseClassLocation)) {
|
||||
|
@ -650,9 +640,8 @@ public class NewClassCodeGenerator {
|
|||
folderToAdd = canonPath;
|
||||
|
||||
// see if folder or its parent hasn't already been added
|
||||
for (Iterator newIter = newIncludePaths.iterator(); newIter.hasNext(); ) {
|
||||
IPath newFolder = (IPath) newIter.next();
|
||||
if (newFolder.isPrefixOf(folderToAdd)) {
|
||||
for (IPath newFolder : newIncludePaths) {
|
||||
if (newFolder.isPrefixOf(folderToAdd)) {
|
||||
folderToAdd = null;
|
||||
break;
|
||||
}
|
||||
|
@ -661,17 +650,16 @@ public class NewClassCodeGenerator {
|
|||
if (folderToAdd != null) {
|
||||
// search include paths
|
||||
boolean foundPath = false;
|
||||
for (Iterator ipIter = includePaths.iterator(); ipIter.hasNext(); ) {
|
||||
IPath includePath = (IPath) ipIter.next();
|
||||
if (includePath.isPrefixOf(folderToAdd) || includePath.equals(folderToAdd)) {
|
||||
for (IPath includePath : includePaths) {
|
||||
if (includePath.isPrefixOf(folderToAdd) || includePath.equals(folderToAdd)) {
|
||||
foundPath = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!foundPath) {
|
||||
// remove any children of this folder
|
||||
for (Iterator newIter = newIncludePaths.iterator(); newIter.hasNext(); ) {
|
||||
IPath newFolder = (IPath) newIter.next();
|
||||
for (Iterator<IPath> newIter = newIncludePaths.iterator(); newIter.hasNext(); ) {
|
||||
IPath newFolder = newIter.next();
|
||||
if (folderToAdd.isPrefixOf(newFolder)) {
|
||||
newIter.remove();
|
||||
}
|
||||
|
@ -685,7 +673,7 @@ public class NewClassCodeGenerator {
|
|||
return newIncludePaths;
|
||||
}
|
||||
|
||||
private List getIncludePaths(ITranslationUnit headerTU) throws CodeGeneratorException {
|
||||
private List<IPath> getIncludePaths(ITranslationUnit headerTU) throws CodeGeneratorException {
|
||||
IProject project = headerTU.getCProject().getProject();
|
||||
// get the parent source folder
|
||||
ICContainer sourceFolder = CModelUtil.getSourceFolder(headerTU);
|
||||
|
@ -700,7 +688,7 @@ public class NewClassCodeGenerator {
|
|||
if (info != null) {
|
||||
String[] includePaths = info.getIncludePaths();
|
||||
if (includePaths != null) {
|
||||
List list = new ArrayList();
|
||||
List<IPath> list = new ArrayList<IPath>();
|
||||
for (int i = 0; i < includePaths.length; ++i) {
|
||||
//TODO do we need to canonicalize these paths first?
|
||||
IPath path = new Path(includePaths[i]);
|
||||
|
@ -715,8 +703,8 @@ public class NewClassCodeGenerator {
|
|||
return null;
|
||||
}
|
||||
|
||||
private List getBaseClassPaths(boolean verifyLocation) throws CodeGeneratorException {
|
||||
List list = new ArrayList();
|
||||
private List<IPath> getBaseClassPaths(boolean verifyLocation) throws CodeGeneratorException {
|
||||
List<IPath> list = new ArrayList<IPath>();
|
||||
for (int i = 0; i < fBaseClasses.length; ++i) {
|
||||
IBaseClassInfo baseClass = fBaseClasses[i];
|
||||
ITypeReference ref = baseClass.getType().getResolvedReference();
|
||||
|
@ -736,7 +724,7 @@ public class NewClassCodeGenerator {
|
|||
return list;
|
||||
}
|
||||
|
||||
public String constructSourceFileContent(ITranslationUnit sourceTU, ITranslationUnit headerTU, List publicMethods, List protectedMethods, List privateMethods, String oldContents, IProgressMonitor monitor) throws CoreException {
|
||||
public String constructSourceFileContent(ITranslationUnit sourceTU, ITranslationUnit headerTU, List<IMethodStub> publicMethods, List<IMethodStub> protectedMethods, List<IMethodStub> privateMethods, String oldContents, IProgressMonitor monitor) throws CoreException {
|
||||
monitor.beginTask(NewClassWizardMessages.getString("NewClassCodeGeneration.createType.task.source"), 150); //$NON-NLS-1$
|
||||
|
||||
String lineDelimiter= StubUtility.getLineDelimiterUsed(sourceTU);
|
||||
|
@ -893,10 +881,10 @@ public class NewClassCodeGenerator {
|
|||
return -1;
|
||||
}
|
||||
|
||||
private void addMethodBodies(ITranslationUnit tu, List publicMethods, List protectedMethods, List privateMethods, StringBuffer text, String lineDelimiter, IProgressMonitor monitor) throws CoreException {
|
||||
private void addMethodBodies(ITranslationUnit tu, List<IMethodStub> publicMethods, List<IMethodStub> protectedMethods, List<IMethodStub> privateMethods, StringBuffer text, String lineDelimiter, IProgressMonitor monitor) throws CoreException {
|
||||
if (!publicMethods.isEmpty()) {
|
||||
for (Iterator i = publicMethods.iterator(); i.hasNext();) {
|
||||
IMethodStub stub = (IMethodStub) i.next();
|
||||
for (Iterator<IMethodStub> i = publicMethods.iterator(); i.hasNext();) {
|
||||
IMethodStub stub = i.next();
|
||||
String code = stub.createMethodImplementation(tu, fClassName, fBaseClasses, lineDelimiter);
|
||||
text.append(code);
|
||||
text.append(lineDelimiter);
|
||||
|
@ -906,8 +894,8 @@ public class NewClassCodeGenerator {
|
|||
}
|
||||
|
||||
if (!protectedMethods.isEmpty()) {
|
||||
for (Iterator i = protectedMethods.iterator(); i.hasNext();) {
|
||||
IMethodStub stub = (IMethodStub) i.next();
|
||||
for (Iterator<IMethodStub> i = protectedMethods.iterator(); i.hasNext();) {
|
||||
IMethodStub stub = i.next();
|
||||
String code = stub.createMethodImplementation(tu, fClassName, fBaseClasses, lineDelimiter);
|
||||
text.append(code);
|
||||
text.append(lineDelimiter);
|
||||
|
@ -917,8 +905,8 @@ public class NewClassCodeGenerator {
|
|||
}
|
||||
|
||||
if (!privateMethods.isEmpty()) {
|
||||
for (Iterator i = privateMethods.iterator(); i.hasNext();) {
|
||||
IMethodStub stub = (IMethodStub) i.next();
|
||||
for (Iterator<IMethodStub> i = privateMethods.iterator(); i.hasNext();) {
|
||||
IMethodStub stub = i.next();
|
||||
String code = stub.createMethodImplementation(tu, fClassName, fBaseClasses, lineDelimiter);
|
||||
text.append(code);
|
||||
text.append(lineDelimiter);
|
||||
|
|
|
@ -321,14 +321,14 @@ public class NewClassWizardUtil {
|
|||
IScannerInfo info = provider.getScannerInformation(project);
|
||||
if (info != null) {
|
||||
String[] includePaths = info.getIncludePaths();
|
||||
List filteredTypes = new ArrayList();
|
||||
List<ITypeInfo> filteredTypes = new ArrayList<ITypeInfo>();
|
||||
for (int i = 0; i < elements.length; ++i) {
|
||||
ITypeInfo baseType = elements[i];
|
||||
if (isTypeReachable(baseType, cProject, includePaths)) {
|
||||
filteredTypes.add(baseType);
|
||||
}
|
||||
}
|
||||
return (ITypeInfo[]) filteredTypes.toArray(new ITypeInfo[filteredTypes.size()]);
|
||||
return filteredTypes.toArray(new ITypeInfo[filteredTypes.size()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ public class NewClassWizardUtil {
|
|||
* {@link #SEARCH_MATCH_FOUND_EXACT} or
|
||||
* {@link #SEARCH_MATCH_NOTFOUND}.
|
||||
*/
|
||||
public static int searchForCppType(IQualifiedTypeName typeName, ICProject project, Class queryType) {
|
||||
public static int searchForCppType(IQualifiedTypeName typeName, ICProject project, Class<?> queryType) {
|
||||
IIndex index= null;
|
||||
try {
|
||||
if (project != null) {
|
||||
|
@ -421,7 +421,7 @@ public class NewClassWizardUtil {
|
|||
|
||||
//get the fully qualified name of this binding
|
||||
String bindingFullName = CPPVisitor.renderQualifiedName(binding.getQualifiedName());
|
||||
Class currentNodeType = binding.getClass();
|
||||
Class<? extends ICPPBinding> currentNodeType = binding.getClass();
|
||||
// full binding
|
||||
if (queryType.isAssignableFrom(currentNodeType)) {
|
||||
if (bindingFullName.equals(fullyQualifiedTypeName)) {
|
||||
|
@ -443,10 +443,9 @@ public class NewClassWizardUtil {
|
|||
{
|
||||
if (bindingFullName.equals(fullyQualifiedTypeName)) {
|
||||
return SEARCH_MATCH_FOUND_EXACT_ANOTHER_TYPE;
|
||||
} else {
|
||||
// different type , same name , but different name space
|
||||
sameNameDifferentTypeExists = true;
|
||||
}
|
||||
// different type , same name , but different name space
|
||||
sameNameDifferentTypeExists = true;
|
||||
}
|
||||
}
|
||||
if(sameTypeNameExists){
|
||||
|
|
|
@ -12,25 +12,6 @@ package org.eclipse.cdt.internal.ui.wizards.classwizard;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.cdt.core.browser.PathUtil;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICContainer;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICElementVisitor;
|
||||
import org.eclipse.cdt.core.model.ICModel;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.internal.corext.util.CModelUtil;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.StatusUtil;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.TypedViewerFilter;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.StringDialogField;
|
||||
import org.eclipse.cdt.ui.CElementContentProvider;
|
||||
import org.eclipse.cdt.ui.CElementLabelProvider;
|
||||
import org.eclipse.cdt.ui.CElementSorter;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
|
@ -62,6 +43,28 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import org.eclipse.swt.widgets.Tree;
|
||||
import org.eclipse.ui.dialogs.SelectionStatusDialog;
|
||||
|
||||
import org.eclipse.cdt.core.browser.PathUtil;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICContainer;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICElementVisitor;
|
||||
import org.eclipse.cdt.core.model.ICModel;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.ui.CElementContentProvider;
|
||||
import org.eclipse.cdt.ui.CElementLabelProvider;
|
||||
import org.eclipse.cdt.ui.CElementSorter;
|
||||
|
||||
import org.eclipse.cdt.internal.corext.util.CModelUtil;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.StatusUtil;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.TypedViewerFilter;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.StringDialogField;
|
||||
|
||||
public class SourceFileSelectionDialog extends SelectionStatusDialog {
|
||||
|
||||
TreeViewer fViewer;
|
||||
|
@ -150,7 +153,7 @@ public class SourceFileSelectionDialog extends SelectionStatusDialog {
|
|||
}
|
||||
}
|
||||
|
||||
static final Class[] FILTER_TYPES = new Class[] {
|
||||
static final Class<?>[] FILTER_TYPES = new Class[] {
|
||||
ICModel.class,
|
||||
ICProject.class,
|
||||
ICContainer.class,
|
||||
|
@ -196,7 +199,7 @@ public class SourceFileSelectionDialog extends SelectionStatusDialog {
|
|||
fFileNameDialogField.setDialogFieldListener(fFieldsAdapter);
|
||||
fFileNameDialogField.setLabelText(NewClassWizardMessages.getString("SourceFileSelectionDialog.fileName.label")); //$NON-NLS-1$
|
||||
|
||||
setResult(new ArrayList(0));
|
||||
setResult(new ArrayList<Object>(0));
|
||||
setStatusLineAboveButtons(true);
|
||||
|
||||
int shellStyle = getShellStyle();
|
||||
|
|
|
@ -219,14 +219,14 @@ public abstract class AbstractFileCreationWizardPage extends NewElementWizardPag
|
|||
|
||||
protected void editTemplates() {
|
||||
String prefPageId= CodeTemplatePreferencePage.PREF_ID;
|
||||
Map data= null;
|
||||
Map<String, String> data= null;
|
||||
String templateName= null;
|
||||
Template template= getSelectedTemplate();
|
||||
if (template != null) {
|
||||
templateName= template.getName();
|
||||
}
|
||||
if (templateName != null) {
|
||||
data= new HashMap();
|
||||
data= new HashMap<String, String>();
|
||||
data.put(CodeTemplatePreferencePage.DATA_SELECT_TEMPLATE, templateName);
|
||||
}
|
||||
PreferenceDialog dialog= PreferencesUtil.createPreferenceDialogOn(getShell(), prefPageId, new String[] { prefPageId }, data);
|
||||
|
|
|
@ -117,14 +117,14 @@ public class WizardNewFileFromTemplateCreationPage extends WizardNewFileCreation
|
|||
|
||||
protected void editTemplates() {
|
||||
String prefPageId= CodeTemplatePreferencePage.PREF_ID;
|
||||
Map data= null;
|
||||
Map<String, String> data= null;
|
||||
String templateName= null;
|
||||
Template template= getSelectedTemplate();
|
||||
if (template != null) {
|
||||
templateName= template.getName();
|
||||
}
|
||||
if (templateName != null) {
|
||||
data= new HashMap();
|
||||
data= new HashMap<String, String>();
|
||||
data.put(CodeTemplatePreferencePage.DATA_SELECT_TEMPLATE, templateName);
|
||||
}
|
||||
PreferenceDialog dialog= PreferencesUtil.createPreferenceDialogOn(getShell(), prefPageId, new String[] { prefPageId }, data);
|
||||
|
@ -250,7 +250,7 @@ public class WizardNewFileFromTemplateCreationPage extends WizardNewFileCreation
|
|||
}
|
||||
}
|
||||
IContentType[] contentTypes= matcher.findContentTypesFor(fileName);
|
||||
List result= new ArrayList(contentTypes.length * 2);
|
||||
List<String> result= new ArrayList<String>(contentTypes.length * 2);
|
||||
for (int i = 0; i < contentTypes.length; i++) {
|
||||
IContentType contentType = contentTypes[i];
|
||||
String id= contentType.getId();
|
||||
|
@ -271,7 +271,7 @@ public class WizardNewFileFromTemplateCreationPage extends WizardNewFileCreation
|
|||
if (result.isEmpty()) {
|
||||
result.add(FileTemplateContextType.CONTENTTYPE_TEXT);
|
||||
}
|
||||
return (String[]) result.toArray(new String[result.size()]);
|
||||
return result.toArray(new String[result.size()]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -172,8 +172,7 @@ public class NewSourceFolderWizardPage extends NewElementWizardPage {
|
|||
try {
|
||||
// find the first C project
|
||||
IProject[] projects= fWorkspaceRoot.getProjects();
|
||||
for (int i= 0; i < projects.length; i++) {
|
||||
IProject proj= projects[i];
|
||||
for (IProject proj : projects) {
|
||||
if (proj.hasNature(CProjectNature.C_NATURE_ID) || proj.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||
projPath= proj.getFullPath().makeRelative().toString();
|
||||
break;
|
||||
|
@ -475,7 +474,7 @@ public class NewSourceFolderWizardPage extends NewElementWizardPage {
|
|||
// ------------- choose dialogs
|
||||
|
||||
private IFolder chooseFolder(String title, String message, IPath initialPath) {
|
||||
Class[] acceptedClasses= new Class[] { IFolder.class };
|
||||
Class<?>[] acceptedClasses= new Class<?>[] { IFolder.class };
|
||||
ISelectionStatusValidator validator= new TypedElementSelectionValidator(acceptedClasses, false);
|
||||
ViewerFilter filter= new TypedViewerFilter(acceptedClasses, null);
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ import org.eclipse.swt.widgets.Button;
|
|||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
@ -57,7 +56,7 @@ import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences;
|
|||
|
||||
import org.eclipse.cdt.internal.ui.viewsupport.ListContentProvider;
|
||||
|
||||
public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage implements Listener {
|
||||
public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage {
|
||||
|
||||
private IStructuredSelection fInitialSelection;
|
||||
private CheckboxTableViewer fProjectViewer;
|
||||
|
@ -199,9 +198,9 @@ public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage im
|
|||
ICProject[] projects;
|
||||
try {
|
||||
projects = CoreModel.getDefault().getCModel().getCProjects();
|
||||
for (int i = 0; i < projects.length; i++) {
|
||||
if (projects[i].getProject().isOpen()) {
|
||||
input.add(projects[i]);
|
||||
for (ICProject project : projects) {
|
||||
if (project.getProject().isOpen()) {
|
||||
input.add(project);
|
||||
}
|
||||
}
|
||||
} catch (CModelException e) {
|
||||
|
@ -212,15 +211,15 @@ public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage im
|
|||
|
||||
private void setupBasedOnInitialSelections() {
|
||||
HashSet<String> names= new HashSet<String>();
|
||||
Iterator it = fInitialSelection.iterator();
|
||||
Iterator<?> it = fInitialSelection.iterator();
|
||||
while (it.hasNext()) {
|
||||
IProject project = (IProject) it.next();
|
||||
names.add(project.getName());
|
||||
}
|
||||
|
||||
Collection prjs= (Collection) fProjectViewer.getInput();
|
||||
for (Iterator iterator = prjs.iterator(); iterator.hasNext();) {
|
||||
ICProject prj = (ICProject) iterator.next();
|
||||
Collection<?> prjs= (Collection<?>) fProjectViewer.getInput();
|
||||
for (Object element : prjs) {
|
||||
ICProject prj = (ICProject) element;
|
||||
if (names.contains(prj.getElementName())) {
|
||||
fProjectViewer.setChecked(prj, true);
|
||||
}
|
||||
|
@ -308,8 +307,7 @@ public class TeamProjectIndexExportWizardPage extends WizardDataTransferPage im
|
|||
IRunnableWithProgress op= new IRunnableWithProgress() {
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||
monitor.beginTask("", projects.length); //$NON-NLS-1$
|
||||
for (int i = 0; i < projects.length; i++) {
|
||||
ICProject project = projects[i];
|
||||
for (ICProject project : projects) {
|
||||
TeamPDOMExportOperation op= new TeamPDOMExportOperation(project);
|
||||
op.setTargetLocation(dest);
|
||||
try {
|
||||
|
|
|
@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.ui.workingsets;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
|
@ -180,33 +179,33 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
|
|||
*/
|
||||
public void finish() {
|
||||
String workingSetName= fWorkingSetName.getText();
|
||||
ArrayList elements= new ArrayList(10);
|
||||
ArrayList<Object> elements= new ArrayList<Object>(10);
|
||||
findCheckedElements(elements, fTree.getInput());
|
||||
if (fWorkingSet == null) {
|
||||
IWorkingSetManager workingSetManager= PlatformUI.getWorkbench().getWorkingSetManager();
|
||||
fWorkingSet= workingSetManager.createWorkingSet(workingSetName, (IAdaptable[])elements.toArray(new IAdaptable[elements.size()]));
|
||||
fWorkingSet= workingSetManager.createWorkingSet(workingSetName, elements.toArray(new IAdaptable[elements.size()]));
|
||||
} else {
|
||||
// Add inaccessible resources
|
||||
IAdaptable[] oldItems= fWorkingSet.getElements();
|
||||
HashSet closedWithChildren= new HashSet(elements.size());
|
||||
for (int i= 0; i < oldItems.length; i++) {
|
||||
HashSet<IProject> closedWithChildren= new HashSet<IProject>(elements.size());
|
||||
for (IAdaptable oldItem : oldItems) {
|
||||
IResource oldResource= null;
|
||||
if (oldItems[i] instanceof IResource) {
|
||||
oldResource= (IResource)oldItems[i];
|
||||
if (oldItem instanceof IResource) {
|
||||
oldResource= (IResource)oldItem;
|
||||
} else {
|
||||
oldResource= (IResource)oldItems[i].getAdapter(IResource.class);
|
||||
oldResource= (IResource)oldItem.getAdapter(IResource.class);
|
||||
}
|
||||
if (oldResource != null && oldResource.isAccessible() == false) {
|
||||
IProject project= oldResource.getProject();
|
||||
if (closedWithChildren.contains(project) || elements.contains(project)) {
|
||||
elements.add(oldItems[i]);
|
||||
elements.add(oldItem);
|
||||
elements.remove(project);
|
||||
closedWithChildren.add(project);
|
||||
}
|
||||
}
|
||||
}
|
||||
fWorkingSet.setName(workingSetName);
|
||||
fWorkingSet.setElements((IAdaptable[]) elements.toArray(new IAdaptable[elements.size()]));
|
||||
fWorkingSet.setElements(elements.toArray(new IAdaptable[elements.size()]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -333,9 +332,8 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
|
|||
}
|
||||
}
|
||||
fTree.setCheckedElements(elements);
|
||||
HashSet parents = new HashSet();
|
||||
for (int i= 0; i < elements.length; i++) {
|
||||
Object element= elements[i];
|
||||
HashSet<Object> parents = new HashSet<Object>();
|
||||
for (Object element : elements) {
|
||||
if (isExpandable(element))
|
||||
setSubtreeChecked(element, true, true);
|
||||
|
||||
|
@ -349,8 +347,8 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
|
|||
parents.add(parent);
|
||||
}
|
||||
|
||||
for (Iterator i = parents.iterator(); i.hasNext();)
|
||||
updateObjectState(i.next(), true);
|
||||
for (Object object : parents)
|
||||
updateObjectState(object, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -417,16 +415,15 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
|
|||
fFirstCheck= false;
|
||||
return;
|
||||
}
|
||||
else
|
||||
errorMessage = WorkingSetMessages.getString("CElementWorkingSetPage.warning.nameMustNotBeEmpty"); //$NON-NLS-1$
|
||||
errorMessage = WorkingSetMessages.getString("CElementWorkingSetPage.warning.nameMustNotBeEmpty"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
fFirstCheck= false;
|
||||
|
||||
if (errorMessage == null && (fWorkingSet == null || newText.equals(fWorkingSet.getName()) == false)) {
|
||||
IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets();
|
||||
for (int i = 0; i < workingSets.length; i++) {
|
||||
if (newText.equals(workingSets[i].getName())) {
|
||||
for (IWorkingSet workingSet : workingSets) {
|
||||
if (newText.equals(workingSet.getName())) {
|
||||
errorMessage = WorkingSetMessages.getString("CElementWorkingSetPage.warning.workingSetExists"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
@ -446,13 +443,13 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
|
|||
* @param checkedElements the output, list of checked elements
|
||||
* @param parent the parent to collect checked elements in
|
||||
*/
|
||||
private void findCheckedElements(List checkedElements, Object parent) {
|
||||
private void findCheckedElements(List<Object> checkedElements, Object parent) {
|
||||
Object[] children= fTreeContentProvider.getChildren(parent);
|
||||
for (int i= 0; i < children.length; i++) {
|
||||
if (fTree.getGrayed(children[i]))
|
||||
findCheckedElements(checkedElements, children[i]);
|
||||
else if (fTree.getChecked(children[i]))
|
||||
checkedElements.add(children[i]);
|
||||
for (Object element : children) {
|
||||
if (fTree.getGrayed(element))
|
||||
findCheckedElements(checkedElements, element);
|
||||
else if (fTree.getChecked(element))
|
||||
checkedElements.add(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.core.resources.IProject;
|
|||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.BaseCElementContentProvider;
|
||||
|
||||
|
@ -31,7 +32,7 @@ class CElementWorkingSetPageContentProvider extends BaseCElementContentProvider
|
|||
if (element instanceof IWorkspaceRoot) {
|
||||
IWorkspaceRoot root = (IWorkspaceRoot)element;
|
||||
IProject[] projects = root.getProjects();
|
||||
List list = new ArrayList(projects.length);
|
||||
List<ICProject> list = new ArrayList<ICProject>(projects.length);
|
||||
for (int i = 0; i < projects.length; i++) {
|
||||
if (CoreModel.hasCNature(projects[i])) {
|
||||
list.add(CoreModel.getDefault().create(projects[i]));
|
||||
|
|
|
@ -71,16 +71,16 @@ public class CElementWorkingSetUpdater implements IWorkingSetUpdater, IElementCh
|
|||
|
||||
public static final String ID= "org.eclipse.cdt.ui.CElementWorkingSetPage"; //$NON-NLS-1$
|
||||
|
||||
private List fWorkingSets;
|
||||
private List<IWorkingSet> fWorkingSets;
|
||||
|
||||
private static class WorkingSetDelta {
|
||||
private IWorkingSet fWorkingSet;
|
||||
private List fElements;
|
||||
private List<Object> fElements;
|
||||
private boolean fChanged;
|
||||
public WorkingSetDelta(IWorkingSet workingSet) {
|
||||
fWorkingSet= workingSet;
|
||||
synchronized (fWorkingSet) {
|
||||
fElements= new ArrayList(Arrays.asList(fWorkingSet.getElements()));
|
||||
fElements= new ArrayList<Object>(Arrays.asList(fWorkingSet.getElements()));
|
||||
}
|
||||
}
|
||||
public int indexOf(Object element) {
|
||||
|
@ -101,13 +101,13 @@ public class CElementWorkingSetUpdater implements IWorkingSetUpdater, IElementCh
|
|||
}
|
||||
public void process() {
|
||||
if (fChanged) {
|
||||
fWorkingSet.setElements((IAdaptable[])fElements.toArray(new IAdaptable[fElements.size()]));
|
||||
fWorkingSet.setElements(fElements.toArray(new IAdaptable[fElements.size()]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CElementWorkingSetUpdater() {
|
||||
fWorkingSets= new ArrayList();
|
||||
fWorkingSets= new ArrayList<IWorkingSet>();
|
||||
CoreModel.getDefault().addElementChangedListener(this);
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ public class CElementWorkingSetUpdater implements IWorkingSetUpdater, IElementCh
|
|||
public void elementChanged(ElementChangedEvent event) {
|
||||
IWorkingSet[] workingSets;
|
||||
synchronized(fWorkingSets) {
|
||||
workingSets= (IWorkingSet[])fWorkingSets.toArray(new IWorkingSet[fWorkingSets.size()]);
|
||||
workingSets= fWorkingSets.toArray(new IWorkingSet[fWorkingSets.size()]);
|
||||
}
|
||||
for (int w= 0; w < workingSets.length; w++) {
|
||||
WorkingSetDelta workingSetDelta= new WorkingSetDelta(workingSets[w]);
|
||||
|
@ -262,10 +262,10 @@ public class CElementWorkingSetUpdater implements IWorkingSetUpdater, IElementCh
|
|||
}
|
||||
|
||||
private static void checkElementExistence(IWorkingSet workingSet) {
|
||||
List elements= new ArrayList(Arrays.asList(workingSet.getElements()));
|
||||
List<IAdaptable> elements= new ArrayList<IAdaptable>(Arrays.asList(workingSet.getElements()));
|
||||
boolean changed= false;
|
||||
for (Iterator iter= elements.iterator(); iter.hasNext();) {
|
||||
IAdaptable element= (IAdaptable)iter.next();
|
||||
for (Iterator<IAdaptable> iter= elements.iterator(); iter.hasNext();) {
|
||||
IAdaptable element= iter.next();
|
||||
boolean remove= false;
|
||||
if (element instanceof ICElement) {
|
||||
ICElement cElement= (ICElement)element;
|
||||
|
@ -299,7 +299,7 @@ public class CElementWorkingSetUpdater implements IWorkingSetUpdater, IElementCh
|
|||
}
|
||||
}
|
||||
if (changed) {
|
||||
workingSet.setElements((IAdaptable[])elements.toArray(new IAdaptable[elements.size()]));
|
||||
workingSet.setElements(elements.toArray(new IAdaptable[elements.size()]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2006 IBM Corporation 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
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.workingsets;
|
||||
|
||||
import java.text.Collator;
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.eclipse.ui.IWorkingSet;
|
||||
|
||||
class WorkingSetComparator implements Comparator {
|
||||
|
||||
private Collator fCollator= Collator.getInstance();
|
||||
|
||||
/*
|
||||
* @see Comparator#compare(Object, Object)
|
||||
*/
|
||||
public int compare(Object o1, Object o2) {
|
||||
String name1= null;
|
||||
String name2= null;
|
||||
|
||||
if (o1 instanceof IWorkingSet)
|
||||
name1= ((IWorkingSet)o1).getName();
|
||||
|
||||
if (o2 instanceof IWorkingSet)
|
||||
name2= ((IWorkingSet)o2).getName();
|
||||
|
||||
return fCollator.compare(name1, name2);
|
||||
}
|
||||
}
|
|
@ -22,7 +22,6 @@ import org.eclipse.jface.text.ITextViewer;
|
|||
import org.eclipse.jface.text.Region;
|
||||
import org.eclipse.jface.text.information.IInformationProvider;
|
||||
import org.eclipse.jface.text.information.IInformationProviderExtension;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.StructuredViewer;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
|
@ -68,7 +67,7 @@ C model (<code>ICModel</code>)<br>
|
|||
|
||||
* </pre>
|
||||
*/
|
||||
public class CElementContentProvider extends BaseCElementContentProvider implements ITreeContentProvider, IElementChangedListener, IInformationProvider, IInformationProviderExtension{
|
||||
public class CElementContentProvider extends BaseCElementContentProvider implements IElementChangedListener, IInformationProvider, IInformationProviderExtension{
|
||||
|
||||
/** Editor. */
|
||||
protected ITextEditor fEditor;
|
||||
|
@ -224,8 +223,8 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
|
|||
return;
|
||||
|
||||
ICElementDelta[] affectedChildren= delta.getAffectedChildren();
|
||||
for (int i= 0; i < affectedChildren.length; i++) {
|
||||
processDelta(affectedChildren[i]);
|
||||
for (ICElementDelta element2 : affectedChildren) {
|
||||
processDelta(element2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -246,8 +245,8 @@ public class CElementContentProvider extends BaseCElementContentProvider impleme
|
|||
return true;
|
||||
}
|
||||
|
||||
for (int i= 0; i < deltas.length; i++) {
|
||||
if (processResourceDelta(deltas[i], parent))
|
||||
for (IResourceDelta delta : deltas) {
|
||||
if (processResourceDelta(delta, parent))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,12 +11,13 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.ui.model.IWorkbenchAdapter;
|
||||
import org.eclipse.ui.model.WorkbenchAdapter;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||
|
||||
/**
|
||||
*/
|
||||
public abstract class CElementGrouping extends WorkbenchAdapter implements IAdaptable {
|
||||
|
@ -66,6 +67,7 @@ public abstract class CElementGrouping extends WorkbenchAdapter implements IAdap
|
|||
/*
|
||||
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object getAdapter(Class clas) {
|
||||
if (clas == IWorkbenchAdapter.class)
|
||||
return this;
|
||||
|
|
|
@ -12,6 +12,22 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IStorage;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.viewers.ContentViewer;
|
||||
import org.eclipse.jface.viewers.IBaseLabelProvider;
|
||||
import org.eclipse.jface.viewers.ILabelProvider;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.viewers.ViewerSorter;
|
||||
import org.eclipse.ui.model.IWorkbenchAdapter;
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.IArchive;
|
||||
|
@ -36,21 +52,9 @@ import org.eclipse.cdt.core.model.ITranslationUnit;
|
|||
import org.eclipse.cdt.core.model.IUsing;
|
||||
import org.eclipse.cdt.core.model.IVariable;
|
||||
import org.eclipse.cdt.core.model.IVariableDeclaration;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.cview.IncludeRefContainer;
|
||||
import org.eclipse.cdt.internal.ui.cview.LibraryRefContainer;
|
||||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IStorage;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.viewers.ContentViewer;
|
||||
import org.eclipse.jface.viewers.IBaseLabelProvider;
|
||||
import org.eclipse.jface.viewers.ILabelProvider;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.viewers.ViewerSorter;
|
||||
import org.eclipse.ui.model.IWorkbenchAdapter;
|
||||
|
||||
/**
|
||||
* A sorter to sort the file and the folders in the C viewer in the following order:
|
||||
|
@ -244,10 +248,12 @@ public class CElementSorter extends ViewerSorter {
|
|||
|
||||
// cat1 == cat2
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
final Comparator<Object> comparator = getComparator();
|
||||
if (cat1 == PROJECTS) {
|
||||
IWorkbenchAdapter a1= (IWorkbenchAdapter)((IAdaptable)e1).getAdapter(IWorkbenchAdapter.class);
|
||||
IWorkbenchAdapter a2= (IWorkbenchAdapter)((IAdaptable)e2).getAdapter(IWorkbenchAdapter.class);
|
||||
return getComparator().compare(a1.getLabel(e1), a2.getLabel(e2));
|
||||
return comparator.compare(a1.getLabel(e1), a2.getLabel(e2));
|
||||
}
|
||||
|
||||
if (cat1 == SOURCEROOTS) {
|
||||
|
@ -310,7 +316,7 @@ public class CElementSorter extends ViewerSorter {
|
|||
} else {
|
||||
name2 = e2.toString();
|
||||
}
|
||||
int result = getComparator().compare(name1, name2);
|
||||
int result = comparator.compare(name1, name2);
|
||||
if (result == 0 && (e1destructor != e2destructor)) {
|
||||
result = e1destructor ? 1 : -1;
|
||||
}
|
||||
|
@ -326,14 +332,16 @@ public class CElementSorter extends ViewerSorter {
|
|||
}
|
||||
|
||||
private int compareWithLabelProvider(Viewer viewer, Object e1, Object e2) {
|
||||
if (viewer == null || !(viewer instanceof ContentViewer)) {
|
||||
if (viewer instanceof ContentViewer) {
|
||||
IBaseLabelProvider prov = ((ContentViewer) viewer).getLabelProvider();
|
||||
if (prov instanceof ILabelProvider) {
|
||||
ILabelProvider lprov= (ILabelProvider) prov;
|
||||
String name1 = lprov.getText(e1);
|
||||
String name2 = lprov.getText(e2);
|
||||
if (name1 != null && name2 != null) {
|
||||
return getComparator().compare(name1, name2);
|
||||
@SuppressWarnings("unchecked")
|
||||
final Comparator<Object> comparator = getComparator();
|
||||
return comparator.compare(name1, name2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -636,12 +636,11 @@ public class CUIPlugin extends AbstractUIPlugin {
|
|||
List<IEditorPart> result= new ArrayList<IEditorPart>(0);
|
||||
IWorkbench workbench= getDefault().getWorkbench();
|
||||
IWorkbenchWindow[] windows= workbench.getWorkbenchWindows();
|
||||
for (int i= 0; i < windows.length; i++) {
|
||||
IWorkbenchPage[] pages= windows[i].getPages();
|
||||
for (int x= 0; x < pages.length; x++) {
|
||||
IEditorPart[] editors= pages[x].getDirtyEditors();
|
||||
for (int z= 0; z < editors.length; z++) {
|
||||
IEditorPart ep= editors[z];
|
||||
for (IWorkbenchWindow window : windows) {
|
||||
IWorkbenchPage[] pages= window.getPages();
|
||||
for (IWorkbenchPage page : pages) {
|
||||
IEditorPart[] editors= page.getDirtyEditors();
|
||||
for (IEditorPart ep : editors) {
|
||||
IEditorInput input= ep.getEditorInput();
|
||||
if (!inputs.contains(input)) {
|
||||
inputs.add(input);
|
||||
|
@ -659,12 +658,12 @@ public class CUIPlugin extends AbstractUIPlugin {
|
|||
List<IEditorPart> result= new ArrayList<IEditorPart>(0);
|
||||
IWorkbench workbench= getDefault().getWorkbench();
|
||||
IWorkbenchWindow[] windows= workbench.getWorkbenchWindows();
|
||||
for (int windowIndex= 0; windowIndex < windows.length; windowIndex++) {
|
||||
IWorkbenchPage[] pages= windows[windowIndex].getPages();
|
||||
for (int pageIndex= 0; pageIndex < pages.length; pageIndex++) {
|
||||
IEditorReference[] references= pages[pageIndex].getEditorReferences();
|
||||
for (int refIndex= 0; refIndex < references.length; refIndex++) {
|
||||
IEditorPart editor= references[refIndex].getEditor(false);
|
||||
for (IWorkbenchWindow window : windows) {
|
||||
IWorkbenchPage[] pages= window.getPages();
|
||||
for (IWorkbenchPage page : pages) {
|
||||
IEditorReference[] references= page.getEditorReferences();
|
||||
for (IEditorReference reference : references) {
|
||||
IEditorPart editor= reference.getEditor(false);
|
||||
if (editor != null)
|
||||
result.add(editor);
|
||||
}
|
||||
|
@ -909,10 +908,9 @@ public class CUIPlugin extends AbstractUIPlugin {
|
|||
public Shell getShell() {
|
||||
if (getActiveWorkbenchShell() != null) {
|
||||
return getActiveWorkbenchShell();
|
||||
} else {
|
||||
IWorkbenchWindow[] windows = getDefault().getWorkbench().getWorkbenchWindows();
|
||||
return windows[0].getShell();
|
||||
}
|
||||
IWorkbenchWindow[] windows = getDefault().getWorkbench().getWorkbenchWindows();
|
||||
return windows[0].getShell();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -124,8 +124,8 @@ public class BuildActiveConfigMenuAction extends ChangeBuildConfigActionBase
|
|||
public void updateBuildConfigMenuToolTip(IAction action){
|
||||
String toolTipText = ActionMessages.getString("BuildActiveConfigMenuAction_defaultTooltip"); //$NON-NLS-1$
|
||||
if (fProjects.size() == 1) {
|
||||
Iterator projIter = fProjects.iterator();
|
||||
IProject prj = (IProject)projIter.next();
|
||||
Iterator<IProject> projIter = fProjects.iterator();
|
||||
IProject prj = projIter.next();
|
||||
if (prj != null){
|
||||
ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(prj, false);
|
||||
if (prjd != null) {
|
||||
|
|
|
@ -12,6 +12,7 @@ package org.eclipse.cdt.ui.actions;
|
|||
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.ui.actions.BuildAction;
|
||||
|
||||
|
@ -28,7 +29,7 @@ public class BuildConfigAction extends ChangeConfigAction {
|
|||
* @param configName Build configuration name
|
||||
* @param accel Number to be used as accelerator
|
||||
*/
|
||||
public BuildConfigAction(HashSet projects, String configName, String displayName, int accel, BuildAction buildAction) {
|
||||
public BuildConfigAction(HashSet<IProject> projects, String configName, String displayName, int accel, BuildAction buildAction) {
|
||||
super(projects, configName, displayName, accel);
|
||||
this.buildAction = buildAction;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class ChangeBuildConfigActionBase {
|
|||
/**
|
||||
* List of selected managed-built projects
|
||||
*/
|
||||
protected HashSet fProjects = new HashSet();
|
||||
protected HashSet<IProject> fProjects = new HashSet<IProject>();
|
||||
|
||||
/**
|
||||
* Fills the menu with build configurations which are common for all selected projects
|
||||
|
@ -60,22 +60,23 @@ public class ChangeBuildConfigActionBase {
|
|||
if (menu == null) return;
|
||||
|
||||
MenuItem[] items = menu.getItems();
|
||||
for (int i = 0; i < items.length; i++) items[i].dispose();
|
||||
for (MenuItem item2 : items)
|
||||
item2.dispose();
|
||||
|
||||
List configNames = new ArrayList();
|
||||
Iterator projIter = fProjects.iterator();
|
||||
List<String> configNames = new ArrayList<String>();
|
||||
Iterator<IProject> projIter = fProjects.iterator();
|
||||
String sCurrentConfig = null;
|
||||
boolean bCurrentConfig = true;
|
||||
while (projIter.hasNext()) {
|
||||
ICConfigurationDescription[] cfgDescs = getCfgs((IProject)projIter.next());
|
||||
ICConfigurationDescription[] cfgDescs = getCfgs(projIter.next());
|
||||
|
||||
String sActiveConfig = null;
|
||||
// Store names and detect active configuration
|
||||
for (int i=0; i<cfgDescs.length; i++) {
|
||||
String s = cfgDescs[i].getName();
|
||||
for (ICConfigurationDescription cfgDesc : cfgDescs) {
|
||||
String s = cfgDesc.getName();
|
||||
if (!configNames.contains(s))
|
||||
configNames.add(s);
|
||||
if (cfgDescs[i].isActive())
|
||||
if (cfgDesc.isActive())
|
||||
sActiveConfig = s;
|
||||
}
|
||||
|
||||
|
@ -90,17 +91,17 @@ public class ChangeBuildConfigActionBase {
|
|||
}
|
||||
}
|
||||
|
||||
Iterator confIter = configNames.iterator();
|
||||
Iterator<String> confIter = configNames.iterator();
|
||||
int accel = 0;
|
||||
while (confIter.hasNext()) {
|
||||
String sName = (String)confIter.next();
|
||||
String sName = confIter.next();
|
||||
String sDesc = null;
|
||||
projIter = fProjects.iterator();
|
||||
boolean commonName = true;
|
||||
boolean commonDesc = true;
|
||||
boolean firstProj = true;
|
||||
while (projIter.hasNext()) {
|
||||
ICConfigurationDescription[] cfgDescs = getCfgs((IProject)projIter.next());
|
||||
ICConfigurationDescription[] cfgDescs = getCfgs(projIter.next());
|
||||
int i = 0;
|
||||
for (; i < cfgDescs.length; i++) {
|
||||
if (cfgDescs[i].getName().equals(sName)) {
|
||||
|
@ -137,7 +138,7 @@ public class ChangeBuildConfigActionBase {
|
|||
}
|
||||
|
||||
IAction action = makeAction(sName ,builder, accel);
|
||||
if (bCurrentConfig && sCurrentConfig.equals(sName)) {
|
||||
if (bCurrentConfig && sCurrentConfig != null && sCurrentConfig.equals(sName)) {
|
||||
action.setChecked(true);
|
||||
}
|
||||
ActionContributionItem item = new ActionContributionItem(action);
|
||||
|
@ -179,7 +180,7 @@ public class ChangeBuildConfigActionBase {
|
|||
}
|
||||
}
|
||||
}
|
||||
Iterator iter = ((IStructuredSelection)selection).iterator();
|
||||
Iterator<?> iter = ((IStructuredSelection)selection).iterator();
|
||||
while (iter.hasNext()) {
|
||||
Object selItem = iter.next();
|
||||
IProject project = null;
|
||||
|
@ -230,22 +231,20 @@ public class ChangeBuildConfigActionBase {
|
|||
// back to a project.
|
||||
IWorkbenchWindow window = CUIPlugin.getActiveWorkbenchWindow();
|
||||
if (window != null) {
|
||||
if (window != null) {
|
||||
IWorkbenchPage page = window.getActivePage();
|
||||
if (page != null) {
|
||||
IWorkbenchPart part = page.getActivePart();
|
||||
if (part instanceof IEditorPart) {
|
||||
IEditorPart epart = (IEditorPart) part;
|
||||
IResource resource = (IResource) epart.getEditorInput().getAdapter(IResource.class);
|
||||
if (resource != null)
|
||||
{
|
||||
IProject project = resource.getProject();
|
||||
badObject = !(project != null && CoreModel.getDefault().isNewStyleProject(project));
|
||||
IWorkbenchPage page = window.getActivePage();
|
||||
if (page != null) {
|
||||
IWorkbenchPart part = page.getActivePart();
|
||||
if (part instanceof IEditorPart) {
|
||||
IEditorPart epart = (IEditorPart) part;
|
||||
IResource resource = (IResource) epart.getEditorInput().getAdapter(IResource.class);
|
||||
if (resource != null)
|
||||
{
|
||||
IProject project = resource.getProject();
|
||||
badObject = !(project != null && CoreModel.getDefault().isNewStyleProject(project));
|
||||
|
||||
if (!badObject) {
|
||||
fProjects.add(project);
|
||||
}
|
||||
}
|
||||
if (!badObject) {
|
||||
fProjects.add(project);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -257,16 +256,16 @@ public class ChangeBuildConfigActionBase {
|
|||
|
||||
boolean enable = false;
|
||||
if (!badObject && !fProjects.isEmpty()) {
|
||||
Iterator iter = fProjects.iterator();
|
||||
ICConfigurationDescription[] firstConfigs = getCfgs((IProject)iter.next());
|
||||
for (int i = 0; i < firstConfigs.length; i++) {
|
||||
Iterator<IProject> iter = fProjects.iterator();
|
||||
ICConfigurationDescription[] firstConfigs = getCfgs(iter.next());
|
||||
for (ICConfigurationDescription firstConfig : firstConfigs) {
|
||||
boolean common = true;
|
||||
Iterator iter2 = fProjects.iterator();
|
||||
Iterator<IProject> iter2 = fProjects.iterator();
|
||||
while (iter2.hasNext()) {
|
||||
ICConfigurationDescription[] currentConfigs = getCfgs((IProject)iter2.next());
|
||||
ICConfigurationDescription[] currentConfigs = getCfgs(iter2.next());
|
||||
int j = 0;
|
||||
for (; j < currentConfigs.length; j++) {
|
||||
if (firstConfigs[i].getName().equals(currentConfigs[j].getName()))
|
||||
if (firstConfig.getName().equals(currentConfigs[j].getName()))
|
||||
break;
|
||||
}
|
||||
if (j == currentConfigs.length) {
|
||||
|
|
|
@ -69,7 +69,7 @@ public class ChangeBuildConfigMenuAction extends ChangeBuildConfigActionBase imp
|
|||
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
|
||||
*/
|
||||
public void run(IAction action) {
|
||||
IProject[] obs = (IProject[])fProjects.toArray(new IProject[fProjects.size()]);
|
||||
IProject[] obs = fProjects.toArray(new IProject[fProjects.size()]);
|
||||
IConfigManager cm = ManageConfigSelector.getManager(obs);
|
||||
if (cm != null) {
|
||||
cm.manage(obs, true);
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.eclipse.cdt.ui.newui.CDTPropertyManager;
|
|||
public class ChangeConfigAction extends Action {
|
||||
|
||||
private String fConfigName = null;
|
||||
protected HashSet fProjects = null;
|
||||
protected HashSet<IProject> fProjects = null;
|
||||
|
||||
/**
|
||||
* Constructs the action.
|
||||
|
@ -36,7 +36,7 @@ public class ChangeConfigAction extends Action {
|
|||
* @param configName Build configuration name
|
||||
* @param accel Number to be used as accelerator
|
||||
*/
|
||||
public ChangeConfigAction(HashSet projects, String configName, String displayName, int accel) {
|
||||
public ChangeConfigAction(HashSet<IProject> projects, String configName, String displayName, int accel) {
|
||||
super("&" + accel + " " + displayName); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fProjects = projects;
|
||||
fConfigName = configName;
|
||||
|
@ -47,16 +47,16 @@ public class ChangeConfigAction extends Action {
|
|||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
Iterator iter = fProjects.iterator();
|
||||
Iterator<IProject> iter = fProjects.iterator();
|
||||
while (iter.hasNext()) {
|
||||
IProject prj = (IProject)iter.next();
|
||||
IProject prj = iter.next();
|
||||
ICProjectDescription prjd = CDTPropertyManager.getProjectDescription(prj);
|
||||
boolean changed = false;
|
||||
ICConfigurationDescription[] configs = prjd.getConfigurations();
|
||||
if (configs != null && configs.length > 0) {
|
||||
for (int i = 0; i < configs.length; i++) {
|
||||
if (configs[i].getName().equals(fConfigName)) {
|
||||
configs[i].setActive();
|
||||
for (ICConfigurationDescription config : configs) {
|
||||
if (config.getName().equals(fConfigName)) {
|
||||
config.setActive();
|
||||
CDTPropertyManager.performOk(null);
|
||||
AbstractPage.updateViews(prj);
|
||||
changed = true;
|
||||
|
|
|
@ -25,18 +25,7 @@ import java.util.StringTokenizer;
|
|||
import java.util.TreeSet;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.MenuItem;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICModel;
|
||||
import org.eclipse.cdt.internal.ui.filters.CustomFiltersDialog;
|
||||
import org.eclipse.cdt.internal.ui.filters.FilterDescriptor;
|
||||
import org.eclipse.cdt.internal.ui.filters.FilterMessages;
|
||||
import org.eclipse.cdt.internal.ui.filters.NamePatternFilter;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.ContributionItem;
|
||||
import org.eclipse.jface.action.GroupMarker;
|
||||
|
@ -46,18 +35,29 @@ import org.eclipse.jface.action.IMenuManager;
|
|||
import org.eclipse.jface.action.IToolBarManager;
|
||||
import org.eclipse.jface.action.Separator;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.jface.viewers.IContentProvider;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.StructuredViewer;
|
||||
import org.eclipse.jface.viewers.ViewerFilter;
|
||||
import org.eclipse.jface.window.Window;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.MenuItem;
|
||||
import org.eclipse.ui.IActionBars;
|
||||
import org.eclipse.ui.IMemento;
|
||||
import org.eclipse.ui.IViewPart;
|
||||
import org.eclipse.ui.actions.ActionGroup;
|
||||
|
||||
import org.eclipse.cdt.core.model.ICModel;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.filters.CustomFiltersDialog;
|
||||
import org.eclipse.cdt.internal.ui.filters.FilterDescriptor;
|
||||
import org.eclipse.cdt.internal.ui.filters.FilterMessages;
|
||||
import org.eclipse.cdt.internal.ui.filters.NamePatternFilter;
|
||||
|
||||
/**
|
||||
* Action group to add the filter action to a view part's tool bar
|
||||
* menu.
|
||||
|
@ -241,8 +241,7 @@ public class CustomFiltersActionGroup extends ActionGroup {
|
|||
public String[] removeFiltersFor(Object parent, Object element, IContentProvider contentProvider) {
|
||||
String[] enabledFilters= getEnabledFilterIds();
|
||||
Set<String> newFilters= new HashSet<String>();
|
||||
for (int i= 0; i < enabledFilters.length; i++) {
|
||||
String filterName= enabledFilters[i];
|
||||
for (String filterName : enabledFilters) {
|
||||
ViewerFilter filter= fInstalledBuiltInFilters.get(filterName);
|
||||
if (filter == null)
|
||||
newFilters.add(filterName);
|
||||
|
@ -292,11 +291,11 @@ public class CustomFiltersActionGroup extends ActionGroup {
|
|||
|
||||
private String[] getEnabledFilterIds() {
|
||||
Set<String> enabledFilterIds= new HashSet<String>(fEnabledFilterIds.size());
|
||||
Iterator iter= fEnabledFilterIds.entrySet().iterator();
|
||||
Iterator<Map.Entry<String,Boolean>> iter= fEnabledFilterIds.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Map.Entry entry= (Map.Entry)iter.next();
|
||||
String id= (String)entry.getKey();
|
||||
boolean isEnabled= ((Boolean)entry.getValue()).booleanValue();
|
||||
Map.Entry<String,Boolean> entry= iter.next();
|
||||
String id= entry.getKey();
|
||||
boolean isEnabled= (entry.getValue()).booleanValue();
|
||||
if (isEnabled)
|
||||
enabledFilterIds.add(id);
|
||||
}
|
||||
|
@ -310,8 +309,8 @@ public class CustomFiltersActionGroup extends ActionGroup {
|
|||
String id= iter.next();
|
||||
fEnabledFilterIds.put(id, Boolean.FALSE);
|
||||
}
|
||||
for (int i= 0; i < enabledIds.length; i++)
|
||||
fEnabledFilterIds.put(enabledIds[i], Boolean.TRUE);
|
||||
for (String enabledId : enabledIds)
|
||||
fEnabledFilterIds.put(enabledId, Boolean.TRUE);
|
||||
}
|
||||
|
||||
private void setUserDefinedPatterns(String[] patterns) {
|
||||
|
@ -325,12 +324,12 @@ public class CustomFiltersActionGroup extends ActionGroup {
|
|||
* @param changeHistory the change history
|
||||
* @since 3.0
|
||||
*/
|
||||
private void setRecentlyChangedFilters(Stack changeHistory) {
|
||||
private void setRecentlyChangedFilters(Stack<FilterDescriptor> changeHistory) {
|
||||
Stack<String> oldestFirstStack= new Stack<String>();
|
||||
|
||||
int length= Math.min(changeHistory.size(), MAX_FILTER_MENU_ENTRIES);
|
||||
for (int i= 0; i < length; i++)
|
||||
oldestFirstStack.push(((FilterDescriptor)changeHistory.pop()).getId());
|
||||
oldestFirstStack.push((changeHistory.pop()).getId());
|
||||
|
||||
length= Math.min(fLRUFilterIdsStack.size(), MAX_FILTER_MENU_ENTRIES - oldestFirstStack.size());
|
||||
int NEWEST= 0;
|
||||
|
@ -377,8 +376,8 @@ public class CustomFiltersActionGroup extends ActionGroup {
|
|||
if (fFilterIdsUsedInLastViewMenu == null)
|
||||
return;
|
||||
|
||||
for (int i= 0; i < fFilterIdsUsedInLastViewMenu.length; i++)
|
||||
mm.remove(fFilterIdsUsedInLastViewMenu[i]);
|
||||
for (String element : fFilterIdsUsedInLastViewMenu)
|
||||
mm.remove(element);
|
||||
}
|
||||
|
||||
void addLRUFilterActions(IMenuManager mm) {
|
||||
|
@ -420,13 +419,13 @@ public class CustomFiltersActionGroup extends ActionGroup {
|
|||
FilterDescriptor[] filterDescs= FilterDescriptor.getFilterDescriptors(fTargetId);
|
||||
fFilterDescriptorMap= new HashMap<String, FilterDescriptor>(filterDescs.length);
|
||||
fEnabledFilterIds= new HashMap<String, Boolean>(filterDescs.length);
|
||||
for (int i= 0; i < filterDescs.length; i++) {
|
||||
String id= filterDescs[i].getId();
|
||||
Boolean isEnabled= new Boolean(filterDescs[i].isEnabled());
|
||||
for (FilterDescriptor filterDesc : filterDescs) {
|
||||
String id= filterDesc.getId();
|
||||
Boolean isEnabled= new Boolean(filterDesc.isEnabled());
|
||||
//if (fEnabledFilterIds.containsKey(id))
|
||||
// CUIPlugin.log(new Status("WARNING: Duplicate id for extension-point \"org.eclipse.jdt.ui.CElementFilters\"")); //$NON-NLS-1$
|
||||
fEnabledFilterIds.put(id, isEnabled);
|
||||
fFilterDescriptorMap.put(id, filterDescs[i]);
|
||||
fFilterDescriptorMap.put(id, filterDesc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -454,11 +453,11 @@ public class CustomFiltersActionGroup extends ActionGroup {
|
|||
Set<String> installedFilters= fInstalledBuiltInFilters.keySet();
|
||||
Set<String> filtersToAdd= new HashSet<String>(fEnabledFilterIds.size());
|
||||
Set<String> filtersToRemove= new HashSet<String>(fEnabledFilterIds.size());
|
||||
Iterator iter= fEnabledFilterIds.entrySet().iterator();
|
||||
Iterator<Map.Entry<String,Boolean>> iter= fEnabledFilterIds.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Map.Entry entry= (Map.Entry)iter.next();
|
||||
String id= (String)entry.getKey();
|
||||
boolean isEnabled= ((Boolean)entry.getValue()).booleanValue();
|
||||
Map.Entry<String, Boolean> entry= iter.next();
|
||||
String id= entry.getKey();
|
||||
boolean isEnabled= (entry.getValue()).booleanValue();
|
||||
if (isEnabled && !installedFilters.contains(id))
|
||||
filtersToAdd.add(id);
|
||||
else if (!isEnabled && installedFilters.contains(id))
|
||||
|
@ -467,13 +466,13 @@ public class CustomFiltersActionGroup extends ActionGroup {
|
|||
|
||||
// Install the filters
|
||||
FilterDescriptor[] filterDescs= FilterDescriptor.getFilterDescriptors(fTargetId);
|
||||
for (int i= 0; i < filterDescs.length; i++) {
|
||||
String id= filterDescs[i].getId();
|
||||
for (FilterDescriptor filterDesc : filterDescs) {
|
||||
String id= filterDesc.getId();
|
||||
// just to double check - id should denote a custom filter anyway
|
||||
boolean isCustomFilter= filterDescs[i].isCustomFilter();
|
||||
boolean isCustomFilter= filterDesc.isCustomFilter();
|
||||
if (isCustomFilter) {
|
||||
if (filtersToAdd.contains(id)) {
|
||||
ViewerFilter filter= filterDescs[i].createViewerFilter();
|
||||
ViewerFilter filter= filterDesc.createViewerFilter();
|
||||
if (filter != null) {
|
||||
fViewer.addFilter(filter);
|
||||
fInstalledBuiltInFilters.put(id, filter);
|
||||
|
@ -492,12 +491,12 @@ public class CustomFiltersActionGroup extends ActionGroup {
|
|||
if (areUserDefinedPatternsEnabled())
|
||||
patterns.addAll(Arrays.asList(fUserDefinedPatterns));
|
||||
FilterDescriptor[] filterDescs= FilterDescriptor.getFilterDescriptors(fTargetId);
|
||||
for (int i= 0; i < filterDescs.length; i++) {
|
||||
String id= filterDescs[i].getId();
|
||||
boolean isPatternFilter= filterDescs[i].isPatternFilter();
|
||||
for (FilterDescriptor filterDesc : filterDescs) {
|
||||
String id= filterDesc.getId();
|
||||
boolean isPatternFilter= filterDesc.isPatternFilter();
|
||||
Object isEnabled= fEnabledFilterIds.get(id);
|
||||
if (isEnabled != null && isPatternFilter && ((Boolean)isEnabled).booleanValue())
|
||||
patterns.add(filterDescs[i].getPattern());
|
||||
patterns.add(filterDesc.getPattern());
|
||||
}
|
||||
return patterns.toArray(new String[patterns.size()]);
|
||||
}
|
||||
|
@ -548,9 +547,9 @@ public class CustomFiltersActionGroup extends ActionGroup {
|
|||
|
||||
Iterator<Entry<String, Boolean>> iter= fEnabledFilterIds.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Map.Entry entry= iter.next();
|
||||
String id= (String)entry.getKey();
|
||||
boolean isEnabled= ((Boolean)entry.getValue()).booleanValue();
|
||||
Map.Entry<String,Boolean> entry= iter.next();
|
||||
String id= entry.getKey();
|
||||
boolean isEnabled= (entry.getValue()).booleanValue();
|
||||
store.setValue(id, isEnabled);
|
||||
}
|
||||
|
||||
|
@ -585,11 +584,11 @@ public class CustomFiltersActionGroup extends ActionGroup {
|
|||
private void saveXmlDefinedFilters(IMemento memento) {
|
||||
if(fEnabledFilterIds != null && !fEnabledFilterIds.isEmpty()) {
|
||||
IMemento xmlDefinedFilters= memento.createChild(TAG_XML_DEFINED_FILTERS);
|
||||
Iterator iter= fEnabledFilterIds.entrySet().iterator();
|
||||
Iterator<Map.Entry<String,Boolean>> iter= fEnabledFilterIds.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Map.Entry entry= (Map.Entry)iter.next();
|
||||
String id= (String)entry.getKey();
|
||||
Boolean isEnabled= (Boolean)entry.getValue();
|
||||
Map.Entry<String,Boolean> entry= iter.next();
|
||||
String id= entry.getKey();
|
||||
Boolean isEnabled= entry.getValue();
|
||||
IMemento child= xmlDefinedFilters.createChild(TAG_CHILD);
|
||||
child.putString(TAG_FILTER_ID, id);
|
||||
child.putString(TAG_IS_ENABLED, isEnabled.toString());
|
||||
|
@ -618,9 +617,9 @@ public class CustomFiltersActionGroup extends ActionGroup {
|
|||
private void saveUserDefinedPatterns(IMemento memento) {
|
||||
if(fUserDefinedPatterns != null && fUserDefinedPatterns.length > 0) {
|
||||
IMemento userDefinedPatterns= memento.createChild(TAG_USER_DEFINED_PATTERNS);
|
||||
for (int i= 0; i < fUserDefinedPatterns.length; i++) {
|
||||
for (String userDefinedPattern : fUserDefinedPatterns) {
|
||||
IMemento child= userDefinedPatterns.createChild(TAG_CHILD);
|
||||
child.putString(TAG_PATTERN, fUserDefinedPatterns[i]);
|
||||
child.putString(TAG_PATTERN, userDefinedPattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -668,9 +667,9 @@ public class CustomFiltersActionGroup extends ActionGroup {
|
|||
IMemento xmlDefinedFilters= memento.getChild(TAG_XML_DEFINED_FILTERS);
|
||||
if(xmlDefinedFilters != null) {
|
||||
IMemento[] children= xmlDefinedFilters.getChildren(TAG_CHILD);
|
||||
for (int i= 0; i < children.length; i++) {
|
||||
String id= children[i].getString(TAG_FILTER_ID);
|
||||
Boolean isEnabled= new Boolean(children[i].getString(TAG_IS_ENABLED));
|
||||
for (IMemento element : children) {
|
||||
String id= element.getString(TAG_FILTER_ID);
|
||||
Boolean isEnabled= new Boolean(element.getString(TAG_IS_ENABLED));
|
||||
fEnabledFilterIds.put(id, isEnabled);
|
||||
}
|
||||
}
|
||||
|
@ -681,8 +680,8 @@ public class CustomFiltersActionGroup extends ActionGroup {
|
|||
fLRUFilterIdsStack.clear();
|
||||
if(lruFilters != null) {
|
||||
IMemento[] children= lruFilters.getChildren(TAG_CHILD);
|
||||
for (int i= 0; i < children.length; i++) {
|
||||
String id= children[i].getString(TAG_FILTER_ID);
|
||||
for (IMemento element : children) {
|
||||
String id= element.getString(TAG_FILTER_ID);
|
||||
if (fFilterDescriptorMap.containsKey(id) && !fLRUFilterIdsStack.contains(id))
|
||||
fLRUFilterIdsStack.push(id);
|
||||
}
|
||||
|
@ -695,11 +694,11 @@ public class CustomFiltersActionGroup extends ActionGroup {
|
|||
List<String> userDefinedPatterns= new ArrayList<String>(Arrays.asList(fUserDefinedPatterns));
|
||||
FilterDescriptor[] filters= FilterDescriptor.getFilterDescriptors(fTargetId);
|
||||
|
||||
for (int i= 0; i < filters.length; i++) {
|
||||
if (filters[i].isPatternFilter()) {
|
||||
String pattern= filters[i].getPattern();
|
||||
for (FilterDescriptor filter : filters) {
|
||||
if (filter.isPatternFilter()) {
|
||||
String pattern= filter.getPattern();
|
||||
if (userDefinedPatterns.contains(pattern)) {
|
||||
fEnabledFilterIds.put(filters[i].getId(), Boolean.TRUE);
|
||||
fEnabledFilterIds.put(filter.getId(), Boolean.TRUE);
|
||||
boolean hasMore= true;
|
||||
while (hasMore)
|
||||
hasMore= userDefinedPatterns.remove(pattern);
|
||||
|
|
|
@ -52,8 +52,8 @@ import org.eclipse.cdt.internal.ui.actions.ActionMessages;
|
|||
public class DeleteResConfigsAction
|
||||
implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
|
||||
|
||||
protected ArrayList objects = null;
|
||||
private ArrayList outData = null;
|
||||
protected ArrayList<IResource> objects = null;
|
||||
private ArrayList<ResCfgData> outData = null;
|
||||
|
||||
public void selectionChanged(IAction action, ISelection selection) {
|
||||
objects = null;
|
||||
|
@ -85,10 +85,10 @@ implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
|
|||
if (prjd == null) continue;
|
||||
ICConfigurationDescription[] cfgds = prjd.getConfigurations();
|
||||
if (cfgds == null || cfgds.length == 0) continue;
|
||||
for (int j=0; j<cfgds.length; j++) {
|
||||
ICResourceDescription rd = cfgds[j].getResourceDescription(path, true);
|
||||
for (ICConfigurationDescription cfgd : cfgds) {
|
||||
ICResourceDescription rd = cfgd.getResourceDescription(path, true);
|
||||
if (rd != null) {
|
||||
if (objects == null) objects = new ArrayList();
|
||||
if (objects == null) objects = new ArrayList<IResource>();
|
||||
objects.add(res);
|
||||
break; // stop configurations scanning
|
||||
}
|
||||
|
@ -119,9 +119,9 @@ implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
|
|||
if (dialog.open() == Window.OK) {
|
||||
Object[] selected = dialog.getResult();
|
||||
if (selected != null && selected.length > 0) {
|
||||
for (int i = 0; i < selected.length; i++) {
|
||||
((ResCfgData)selected[i]).delete();
|
||||
AbstractPage.updateViews(((ResCfgData)selected[i]).res);
|
||||
for (Object element : selected) {
|
||||
((ResCfgData)element).delete();
|
||||
AbstractPage.updateViews(((ResCfgData)element).res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -159,9 +159,9 @@ implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
|
|||
public Object[] getElements(Object inputElement) {
|
||||
if (outData != null) return outData.toArray();
|
||||
|
||||
outData = new ArrayList();
|
||||
List ls = (List)inputElement;
|
||||
Iterator it = ls.iterator();
|
||||
outData = new ArrayList<ResCfgData>();
|
||||
List<?> ls = (List<?>)inputElement;
|
||||
Iterator<?> it = ls.iterator();
|
||||
IProject proj = null;
|
||||
ICProjectDescription prjd = null;
|
||||
ICConfigurationDescription[] cfgds = null;
|
||||
|
@ -175,10 +175,12 @@ implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
|
|||
prjd = CoreModel.getDefault().getProjectDescription(proj);
|
||||
cfgds = prjd.getConfigurations();
|
||||
}
|
||||
for (int i=0; i< cfgds.length; i++) {
|
||||
ICResourceDescription rd = cfgds[i].getResourceDescription(path, true);
|
||||
if (rd != null)
|
||||
outData.add(new ResCfgData(res, prjd, cfgds[i], rd));
|
||||
if (cfgds != null) {
|
||||
for (ICConfigurationDescription cfgd : cfgds) {
|
||||
ICResourceDescription rd = cfgd.getResourceDescription(path, true);
|
||||
if (rd != null)
|
||||
outData.add(new ResCfgData(res, prjd, cfgd, rd));
|
||||
}
|
||||
}
|
||||
}
|
||||
return outData.toArray();
|
||||
|
|
|
@ -56,8 +56,8 @@ import org.eclipse.cdt.internal.ui.actions.ActionMessages;
|
|||
public class ExcludeFromBuildAction
|
||||
implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
|
||||
|
||||
protected ArrayList objects = null;
|
||||
protected ArrayList cfgNames = null;
|
||||
protected ArrayList<IResource> objects = null;
|
||||
protected ArrayList<String> cfgNames = null;
|
||||
|
||||
public void selectionChanged(IAction action, ISelection selection) {
|
||||
objects = null;
|
||||
|
@ -86,10 +86,10 @@ implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
|
|||
ICConfigurationDescription[] cfgds = getCfgsRead(res);
|
||||
if (cfgds == null || cfgds.length == 0) continue;
|
||||
|
||||
if (objects == null) objects = new ArrayList();
|
||||
if (objects == null) objects = new ArrayList<IResource>();
|
||||
objects.add(res);
|
||||
if (cfgNames == null) {
|
||||
cfgNames = new ArrayList(cfgds.length);
|
||||
cfgNames = new ArrayList<String>(cfgds.length);
|
||||
for (int j=0; j<cfgds.length; j++) {
|
||||
if (!canExclude(res, cfgds[j])) {
|
||||
cfgNames = null;
|
||||
|
@ -158,9 +158,9 @@ implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
|
|||
dialog.setTitle(ActionMessages.getString("ExcludeFromBuildAction.1")); //$NON-NLS-1$
|
||||
|
||||
boolean[] status = new boolean[cfgNames.size()];
|
||||
Iterator it = objects.iterator();
|
||||
Iterator<IResource> it = objects.iterator();
|
||||
while(it.hasNext()) {
|
||||
IResource res = (IResource)it.next();
|
||||
IResource res = it.next();
|
||||
ICConfigurationDescription[] cfgds = getCfgsRead(res);
|
||||
IPath p = res.getFullPath();
|
||||
for (int i=0; i<cfgds.length; i++) {
|
||||
|
@ -168,7 +168,7 @@ implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
|
|||
if (b) status[i] = true;
|
||||
}
|
||||
}
|
||||
ArrayList lst = new ArrayList();
|
||||
ArrayList<String> lst = new ArrayList<String>();
|
||||
for (int i=0; i<status.length; i++)
|
||||
if (status[i]) lst.add(cfgNames.get(i));
|
||||
if (lst.size() > 0)
|
||||
|
@ -176,9 +176,9 @@ implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
|
|||
|
||||
if (dialog.open() == Window.OK) {
|
||||
Object[] selected = dialog.getResult(); // may be empty
|
||||
Iterator it2 = objects.iterator();
|
||||
Iterator<IResource> it2 = objects.iterator();
|
||||
while(it2.hasNext()) {
|
||||
IResource res = (IResource)it2.next();
|
||||
IResource res = it2.next();
|
||||
IProject p = res.getProject();
|
||||
if (!p.isOpen()) continue;
|
||||
// get writable description
|
||||
|
|
|
@ -12,9 +12,27 @@ package org.eclipse.cdt.ui.actions;
|
|||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IStorage;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.jface.util.OpenStrategy;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.ui.IWorkbenchSite;
|
||||
import org.eclipse.ui.PartInitException;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.texteditor.IEditorStatusLine;
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ISourceReference;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
||||
import org.eclipse.cdt.internal.ui.ICStatusConstants;
|
||||
import org.eclipse.cdt.internal.ui.actions.ActionMessages;
|
||||
|
@ -23,24 +41,6 @@ import org.eclipse.cdt.internal.ui.actions.OpenActionUtil;
|
|||
import org.eclipse.cdt.internal.ui.actions.SelectionConverter;
|
||||
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||
import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IStorage;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
|
||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.text.ITextSelection;
|
||||
import org.eclipse.jface.util.OpenStrategy;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
||||
import org.eclipse.ui.IWorkbenchSite;
|
||||
import org.eclipse.ui.PartInitException;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.texteditor.IEditorStatusLine;
|
||||
|
||||
/**
|
||||
* This action opens a Java editor on a Java element or file.
|
||||
|
@ -102,7 +102,7 @@ public class OpenAction extends SelectionDispatchAction {
|
|||
private boolean checkEnabled(IStructuredSelection selection) {
|
||||
if (selection.isEmpty())
|
||||
return false;
|
||||
for (Iterator iter= selection.iterator(); iter.hasNext();) {
|
||||
for (Iterator<?> iter= selection.iterator(); iter.hasNext();) {
|
||||
Object element= iter.next();
|
||||
if (element instanceof ISourceReference)
|
||||
continue;
|
||||
|
@ -158,8 +158,7 @@ public class OpenAction extends SelectionDispatchAction {
|
|||
public void run(Object[] elements) {
|
||||
if (elements == null)
|
||||
return;
|
||||
for (int i= 0; i < elements.length; i++) {
|
||||
Object element= elements[i];
|
||||
for (Object element : elements) {
|
||||
try {
|
||||
element= getElementToOpen(element);
|
||||
boolean activateOnOpen= fEditor != null ? true : OpenStrategy.activateOnOpen();
|
||||
|
|
|
@ -280,7 +280,7 @@ public class OpenViewActionGroup extends ActionGroup {
|
|||
|
||||
private static ICElement getElement(ISelection sel) {
|
||||
if (!sel.isEmpty() && sel instanceof IStructuredSelection) {
|
||||
List list= ((IStructuredSelection)sel).toList();
|
||||
List<?> list= ((IStructuredSelection)sel).toList();
|
||||
if (list.size() == 1) {
|
||||
Object element= list.get(0);
|
||||
if (element instanceof ICElement) {
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.eclipse.swt.widgets.Composite;
|
|||
public abstract class AbstractBinaryParserPage extends AbstractCOptionPage {
|
||||
|
||||
protected ICOptionPage fCurrentBinaryParserPage;
|
||||
protected Map fParserPageMap = null;
|
||||
protected Map<String, BinaryParserPageConfiguration> fParserPageMap = null;
|
||||
|
||||
// Composite parent provided by the block.
|
||||
protected Composite fCompositeParent;
|
||||
|
@ -62,7 +62,7 @@ public abstract class AbstractBinaryParserPage extends AbstractCOptionPage {
|
|||
}
|
||||
|
||||
private void initializeParserPageMap() {
|
||||
fParserPageMap = new HashMap(5);
|
||||
fParserPageMap = new HashMap<String, BinaryParserPageConfiguration>(5);
|
||||
|
||||
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CUIPlugin.PLUGIN_ID, "BinaryParserPage"); //$NON-NLS-1$
|
||||
IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
|
||||
|
@ -128,7 +128,7 @@ public abstract class AbstractBinaryParserPage extends AbstractCOptionPage {
|
|||
}
|
||||
|
||||
protected ICOptionPage getBinaryParserPage(String parserID) {
|
||||
BinaryParserPageConfiguration configElement = (BinaryParserPageConfiguration) fParserPageMap.get(parserID);
|
||||
BinaryParserPageConfiguration configElement = fParserPageMap.get(parserID);
|
||||
if (configElement != null) {
|
||||
try {
|
||||
return configElement.getPage();
|
||||
|
|
|
@ -50,8 +50,8 @@ public abstract class AbstractErrorParserBlock extends AbstractCOptionPage {
|
|||
|
||||
private static String[] EMPTY = new String[0];
|
||||
private Preferences fPrefs;
|
||||
protected HashMap mapParsers = new HashMap();
|
||||
private CheckedListDialogField fErrorParserList;
|
||||
protected HashMap<String, String> mapParsers = new HashMap<String, String>();
|
||||
private CheckedListDialogField<String> fErrorParserList;
|
||||
protected boolean listDirty = false;
|
||||
|
||||
class FieldListenerAdapter implements IDialogFieldListener {
|
||||
|
@ -112,7 +112,7 @@ public abstract class AbstractErrorParserBlock extends AbstractCOptionPage {
|
|||
*/
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
String name = (String)mapParsers.get(element.toString());
|
||||
String name = mapParsers.get(element.toString());
|
||||
return name != null ? name : element.toString();
|
||||
}
|
||||
};
|
||||
|
@ -136,11 +136,11 @@ public abstract class AbstractErrorParserBlock extends AbstractCOptionPage {
|
|||
String[] empty = new String[0];
|
||||
if (parserIDs != null && parserIDs.length() > 0) {
|
||||
StringTokenizer tok = new StringTokenizer(parserIDs, ";"); //$NON-NLS-1$
|
||||
List list = new ArrayList(tok.countTokens());
|
||||
List<String> list = new ArrayList<String>(tok.countTokens());
|
||||
while (tok.hasMoreElements()) {
|
||||
list.add(tok.nextToken());
|
||||
}
|
||||
return (String[])list.toArray(empty);
|
||||
return list.toArray(empty);
|
||||
}
|
||||
return empty;
|
||||
}
|
||||
|
@ -233,15 +233,15 @@ public abstract class AbstractErrorParserBlock extends AbstractCOptionPage {
|
|||
}
|
||||
|
||||
protected void updateListControl(String[] parserIDs) {
|
||||
List checkedList = Arrays.asList(parserIDs);
|
||||
List<String> checkedList = Arrays.asList(parserIDs);
|
||||
fErrorParserList.setElements(checkedList);
|
||||
fErrorParserList.setCheckedElements(checkedList);
|
||||
if (checkedList.size() > 0) {
|
||||
fErrorParserList.getTableViewer().setSelection(new StructuredSelection(checkedList.get(0)), true);
|
||||
}
|
||||
Iterator items = mapParsers.keySet().iterator();
|
||||
Iterator<String> items = mapParsers.keySet().iterator();
|
||||
while (items.hasNext()) {
|
||||
String item = (String)items.next();
|
||||
String item = items.next();
|
||||
boolean found = false;
|
||||
for (int i = 0; i < parserIDs.length; i++) {
|
||||
if (item.equals(parserIDs[i])) {
|
||||
|
@ -275,7 +275,7 @@ public abstract class AbstractErrorParserBlock extends AbstractCOptionPage {
|
|||
CUIMessages.getString("AbstractErrorParserBlock.label.unselectAll") //$NON-NLS-1$
|
||||
};
|
||||
|
||||
fErrorParserList = new CheckedListDialogField(null, buttonLabels, getLabelProvider());
|
||||
fErrorParserList = new CheckedListDialogField<String>(null, buttonLabels, getLabelProvider());
|
||||
fErrorParserList.setDialogFieldListener(getFieldListenerAdapter());
|
||||
fErrorParserList.setLabelText(CUIMessages.getString("AbstractErrorParserBlock.label.errorParsers")); //$NON-NLS-1$
|
||||
fErrorParserList.setUpButtonIndex(0);
|
||||
|
@ -297,9 +297,9 @@ public abstract class AbstractErrorParserBlock extends AbstractCOptionPage {
|
|||
monitor = new NullProgressMonitor();
|
||||
}
|
||||
monitor.beginTask(CUIMessages.getString("AbstractErrorParserBlock.task.setErrorParser"), 1); //$NON-NLS-1$
|
||||
List elements = fErrorParserList.getElements();
|
||||
List<String> elements = fErrorParserList.getElements();
|
||||
int count = elements.size();
|
||||
List list = new ArrayList(count);
|
||||
List<Object> list = new ArrayList<Object>(count);
|
||||
for (int i = 0; i < count; i++) {
|
||||
Object obj = elements.get(i);
|
||||
if (fErrorParserList.isChecked(obj)) {
|
||||
|
@ -307,7 +307,7 @@ public abstract class AbstractErrorParserBlock extends AbstractCOptionPage {
|
|||
}
|
||||
}
|
||||
|
||||
String[] parserIDs = (String[])list.toArray(EMPTY);
|
||||
String[] parserIDs = list.toArray(EMPTY);
|
||||
|
||||
if (project == null) {
|
||||
// Save to preferences
|
||||
|
|
|
@ -12,7 +12,6 @@ package org.eclipse.cdt.ui.dialogs;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
|
@ -64,9 +63,9 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
|||
private static final String ATTR_VALUE = "value"; //$NON-NLS-1$
|
||||
private static final String ATTR_VALUE_PRIVATE = "private"; //$NON-NLS-1$
|
||||
|
||||
protected CheckedListDialogField binaryList;
|
||||
protected Map configMap;
|
||||
protected List initialSelected;
|
||||
protected CheckedListDialogField<BinaryParserConfiguration> binaryList;
|
||||
protected Map<String, BinaryParserConfiguration> configMap;
|
||||
protected List<BinaryParserConfiguration> initialSelected;
|
||||
|
||||
protected class BinaryParserConfiguration {
|
||||
|
||||
|
@ -112,21 +111,21 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
|||
/* 0 */CUIMessages.getString("BinaryParserBlock.button.up"), //$NON-NLS-1$
|
||||
/* 1 */CUIMessages.getString("BinaryParserBlock.button.down")}; //$NON-NLS-1$
|
||||
|
||||
IListAdapter listAdapter = new IListAdapter() {
|
||||
IListAdapter<BinaryParserConfiguration> listAdapter = new IListAdapter<BinaryParserConfiguration>() {
|
||||
|
||||
public void customButtonPressed(ListDialogField field, int index) {
|
||||
public void customButtonPressed(ListDialogField<BinaryParserConfiguration> field, int index) {
|
||||
}
|
||||
|
||||
public void selectionChanged(ListDialogField field) {
|
||||
public void selectionChanged(ListDialogField<BinaryParserConfiguration> field) {
|
||||
handleBinaryParserChanged();
|
||||
}
|
||||
|
||||
public void doubleClicked(ListDialogField field) {
|
||||
public void doubleClicked(ListDialogField<BinaryParserConfiguration> field) {
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
binaryList = new CheckedListDialogField(listAdapter, buttonLabels, new BinaryParserLabelProvider()) {
|
||||
binaryList = new CheckedListDialogField<BinaryParserConfiguration>(listAdapter, buttonLabels, new BinaryParserLabelProvider()) {
|
||||
|
||||
@Override
|
||||
protected int getListStyle() {
|
||||
|
@ -153,10 +152,10 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
|||
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, CCorePlugin.BINARY_PARSER_SIMPLE_ID);
|
||||
if (point != null) {
|
||||
IExtension[] exts = point.getExtensions();
|
||||
configMap = new HashMap(exts.length);
|
||||
for (int i = 0; i < exts.length; i++) {
|
||||
if (isExtensionVisible(exts[i])) {
|
||||
configMap.put(exts[i].getUniqueIdentifier(), new BinaryParserConfiguration(exts[i]));
|
||||
configMap = new HashMap<String, BinaryParserConfiguration>(exts.length);
|
||||
for (IExtension ext : exts) {
|
||||
if (isExtensionVisible(ext)) {
|
||||
configMap.put(ext.getUniqueIdentifier(), new BinaryParserConfiguration(ext));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -164,12 +163,12 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
|||
|
||||
private boolean isExtensionVisible(IExtension ext) {
|
||||
IConfigurationElement[] elements = ext.getConfigurationElements();
|
||||
for (int i = 0; i < elements.length; i++) {
|
||||
IConfigurationElement[] children = elements[i].getChildren(ATTR_FILTER);
|
||||
for (int j = 0; j < children.length; j++) {
|
||||
String name = children[j].getAttribute(ATTR_NAME);
|
||||
for (IConfigurationElement element : elements) {
|
||||
IConfigurationElement[] children = element.getChildren(ATTR_FILTER);
|
||||
for (IConfigurationElement element2 : children) {
|
||||
String name = element2.getAttribute(ATTR_NAME);
|
||||
if (name != null && name.equals(ATTR_NAME_VISIBILITY)) {
|
||||
String value = children[j].getAttribute(ATTR_VALUE);
|
||||
String value = element2.getAttribute(ATTR_VALUE);
|
||||
if (value != null && value.equals(ATTR_VALUE_PRIVATE)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -221,57 +220,55 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
|||
monitor = new NullProgressMonitor();
|
||||
}
|
||||
monitor.beginTask(CUIMessages.getString("BinaryParserBlock.settingBinaryParser"), 2); //$NON-NLS-1$
|
||||
List parsers = binaryList.getElements();
|
||||
final List selected = new ArrayList(); // must do this to get proper order.
|
||||
List<BinaryParserConfiguration> parsers = binaryList.getElements();
|
||||
final List<BinaryParserConfiguration> selected = new ArrayList<BinaryParserConfiguration>(); // must do this to get proper order.
|
||||
for (int i = 0; i < parsers.size(); i++) {
|
||||
if (binaryList.isChecked(parsers.get(i))) {
|
||||
selected.add(parsers.get(i));
|
||||
}
|
||||
}
|
||||
if (selected != null) {
|
||||
if (getContainer().getProject() != null) {
|
||||
ICDescriptorOperation op = new ICDescriptorOperation() {
|
||||
if (getContainer().getProject() != null) {
|
||||
ICDescriptorOperation op = new ICDescriptorOperation() {
|
||||
|
||||
public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
|
||||
if (initialSelected == null || !selected.equals(initialSelected)) {
|
||||
descriptor.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID);
|
||||
for (int i = 0; i < selected.size(); i++) {
|
||||
descriptor.create(CCorePlugin.BINARY_PARSER_UNIQ_ID,
|
||||
((BinaryParserConfiguration) selected.get(i)).getID());
|
||||
}
|
||||
}
|
||||
monitor.worked(1);
|
||||
// Give a chance to the contributions to save.
|
||||
// We have to do it last to make sure the parser id
|
||||
// is save
|
||||
// in .cdtproject
|
||||
public void execute(ICDescriptor descriptor, IProgressMonitor monitor) throws CoreException {
|
||||
if (initialSelected == null || !selected.equals(initialSelected)) {
|
||||
descriptor.remove(CCorePlugin.BINARY_PARSER_UNIQ_ID);
|
||||
for (int i = 0; i < selected.size(); i++) {
|
||||
ICOptionPage page = getBinaryParserPage(((BinaryParserConfiguration) selected.get(i)).getID());
|
||||
if (page != null && page.getControl() != null) {
|
||||
page.performApply(new SubProgressMonitor(monitor, 1));
|
||||
}
|
||||
descriptor.create(CCorePlugin.BINARY_PARSER_UNIQ_ID,
|
||||
selected.get(i).getID());
|
||||
}
|
||||
}
|
||||
};
|
||||
CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(getContainer().getProject(), op, monitor);
|
||||
} else {
|
||||
if (initialSelected == null || !selected.equals(initialSelected)) {
|
||||
Preferences store = getContainer().getPreferences();
|
||||
if (store != null) {
|
||||
store.setValue(CCorePlugin.PREF_BINARY_PARSER, arrayToString(selected.toArray()));
|
||||
monitor.worked(1);
|
||||
// Give a chance to the contributions to save.
|
||||
// We have to do it last to make sure the parser id
|
||||
// is save
|
||||
// in .cdtproject
|
||||
for (int i = 0; i < selected.size(); i++) {
|
||||
ICOptionPage page = getBinaryParserPage(selected.get(i).getID());
|
||||
if (page != null && page.getControl() != null) {
|
||||
page.performApply(new SubProgressMonitor(monitor, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
monitor.worked(1);
|
||||
// Give a chance to the contributions to save.
|
||||
for (int i = 0; i < selected.size(); i++) {
|
||||
ICOptionPage page = getBinaryParserPage(((BinaryParserConfiguration) selected.get(i)).getID());
|
||||
if (page != null && page.getControl() != null) {
|
||||
page.performApply(new SubProgressMonitor(monitor, 1));
|
||||
}
|
||||
};
|
||||
CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(getContainer().getProject(), op, monitor);
|
||||
} else {
|
||||
if (initialSelected == null || !selected.equals(initialSelected)) {
|
||||
Preferences store = getContainer().getPreferences();
|
||||
if (store != null) {
|
||||
store.setValue(CCorePlugin.PREF_BINARY_PARSER, arrayToString(selected.toArray()));
|
||||
}
|
||||
}
|
||||
monitor.worked(1);
|
||||
// Give a chance to the contributions to save.
|
||||
for (int i = 0; i < selected.size(); i++) {
|
||||
ICOptionPage page = getBinaryParserPage(selected.get(i).getID());
|
||||
if (page != null && page.getControl() != null) {
|
||||
page.performApply(new SubProgressMonitor(monitor, 1));
|
||||
}
|
||||
}
|
||||
initialSelected = selected;
|
||||
}
|
||||
initialSelected = selected;
|
||||
monitor.done();
|
||||
}
|
||||
|
||||
|
@ -279,23 +276,21 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
|||
public void setContainer(ICOptionContainer container) {
|
||||
super.setContainer(container);
|
||||
|
||||
List elements = new ArrayList();
|
||||
List<BinaryParserConfiguration> elements = new ArrayList<BinaryParserConfiguration>();
|
||||
|
||||
if (getContainer().getProject() != null) {
|
||||
try {
|
||||
ICExtensionReference[] ref = CCorePlugin.getDefault().getBinaryParserExtensions(getContainer().getProject());
|
||||
initialSelected = new ArrayList(ref.length);
|
||||
for (int i = 0; i < ref.length; i++) {
|
||||
if (configMap.get(ref[i].getID()) != null) {
|
||||
initialSelected.add(configMap.get(ref[i].getID()));
|
||||
elements.add(configMap.get(ref[i].getID()));
|
||||
initialSelected = new ArrayList<BinaryParserConfiguration>(ref.length);
|
||||
for (ICExtensionReference element : ref) {
|
||||
if (configMap.get(element.getID()) != null) {
|
||||
initialSelected.add(configMap.get(element.getID()));
|
||||
elements.add(configMap.get(element.getID()));
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
Iterator iter = configMap.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entry entry = (Entry) iter.next();
|
||||
for (Entry<String, BinaryParserConfiguration> entry: configMap.entrySet()) {
|
||||
if (!elements.contains(entry.getValue())) {
|
||||
elements.add(entry.getValue());
|
||||
}
|
||||
|
@ -313,17 +308,15 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
|||
|
||||
if (id != null && id.length() > 0) {
|
||||
String[] ids = parseStringToArray(id);
|
||||
initialSelected = new ArrayList(ids.length);
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
if (configMap.get(ids[i]) != null) {
|
||||
initialSelected.add(configMap.get(ids[i]));
|
||||
elements.add(configMap.get(ids[i]));
|
||||
initialSelected = new ArrayList<BinaryParserConfiguration>(ids.length);
|
||||
for (String id2 : ids) {
|
||||
if (configMap.get(id2) != null) {
|
||||
initialSelected.add(configMap.get(id2));
|
||||
elements.add(configMap.get(id2));
|
||||
}
|
||||
}
|
||||
}
|
||||
Iterator iter = configMap.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entry entry = (Entry) iter.next();
|
||||
for (Entry<String, BinaryParserConfiguration> entry: configMap.entrySet()) {
|
||||
if (!elements.contains(entry.getValue())) {
|
||||
elements.add(entry.getValue());
|
||||
}
|
||||
|
@ -338,8 +331,8 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
|||
}
|
||||
private String arrayToString(Object[] array) {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
buf.append(array[i].toString()).append(';');
|
||||
for (Object element : array) {
|
||||
buf.append(element.toString()).append(';');
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
@ -347,11 +340,11 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
|||
private String[] parseStringToArray(String syms) {
|
||||
if (syms != null && syms.length() > 0) {
|
||||
StringTokenizer tok = new StringTokenizer(syms, ";"); //$NON-NLS-1$
|
||||
ArrayList list = new ArrayList(tok.countTokens());
|
||||
ArrayList<String> list = new ArrayList<String>(tok.countTokens());
|
||||
while (tok.hasMoreElements()) {
|
||||
list.add(tok.nextToken());
|
||||
}
|
||||
return (String[]) list.toArray(new String[list.size()]);
|
||||
return list.toArray(new String[list.size()]);
|
||||
}
|
||||
return new String[0];
|
||||
}
|
||||
|
@ -361,9 +354,9 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
|||
String id = null;
|
||||
|
||||
// default current pages.
|
||||
List selected = binaryList.getCheckedElements();
|
||||
List<BinaryParserConfiguration> selected = binaryList.getCheckedElements();
|
||||
for (int i = 0; i < selected.size(); i++) {
|
||||
ICOptionPage page = getBinaryParserPage(((BinaryParserConfiguration) selected.get(i)).getID());
|
||||
ICOptionPage page = getBinaryParserPage(selected.get(i).getID());
|
||||
if (page != null) {
|
||||
page.performDefaults();
|
||||
}
|
||||
|
@ -380,9 +373,9 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
|||
selected.clear();
|
||||
if (id != null) {
|
||||
String[] ids = parseStringToArray(id);
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
if (configMap.get(ids[i]) != null) {
|
||||
selected.add(configMap.get(ids[i]));
|
||||
for (String id2 : ids) {
|
||||
if (configMap.get(id2) != null) {
|
||||
selected.add(configMap.get(id2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -396,9 +389,9 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
|||
|
||||
@Override
|
||||
protected String getCurrentBinaryParserID() {
|
||||
List list = binaryList.getSelectedElements();
|
||||
List<BinaryParserConfiguration> list = binaryList.getSelectedElements();
|
||||
if (list.size() > 0) {
|
||||
BinaryParserConfiguration selected = (BinaryParserConfiguration) list.get(0);
|
||||
BinaryParserConfiguration selected = list.get(0);
|
||||
//if (binaryList.isChecked(selected)) {
|
||||
// return selected.getID();
|
||||
//}
|
||||
|
@ -409,6 +402,6 @@ public class BinaryParserBlock extends AbstractBinaryParserPage {
|
|||
|
||||
@Override
|
||||
protected String[] getBinaryParserIDs() {
|
||||
return (String[]) configMap.keySet().toArray(new String[configMap.keySet().size()]);
|
||||
return configMap.keySet().toArray(new String[configMap.keySet().size()]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public class CHelpConfigurationPropertyPage extends PropertyPage implements
|
|||
}
|
||||
|
||||
private class CHelpSettingsDisplay {
|
||||
private CheckedListDialogField fCHelpBookList;
|
||||
private CheckedListDialogField<CHelpBookDescriptor> fCHelpBookList;
|
||||
private IProject fProject;
|
||||
private CHelpBookDescriptor fCHelpBookDescriptors[];
|
||||
|
||||
|
@ -90,7 +90,7 @@ public class CHelpConfigurationPropertyPage extends PropertyPage implements
|
|||
/* 1 */ CUIMessages.getString("CHelpConfigurationPropertyPage.buttonLabels.UncheckAll") //NewWizardMessages.getString("BuildPathsBlock.classpath.uncheckall.button") //$NON-NLS-1$
|
||||
};
|
||||
|
||||
fCHelpBookList= new CheckedListDialogField(null, buttonLabels, new CHelpBookListLabelProvider());
|
||||
fCHelpBookList= new CheckedListDialogField<CHelpBookDescriptor>(null, buttonLabels, new CHelpBookListLabelProvider());
|
||||
fCHelpBookList.setLabelText(CUIMessages.getString("CHelpConfigurationPropertyPage.HelpBooks")); //$NON-NLS-1$
|
||||
fCHelpBookList.setCheckAllButtonIndex(0);
|
||||
fCHelpBookList.setUncheckAllButtonIndex(1);
|
||||
|
@ -120,19 +120,19 @@ public class CHelpConfigurationPropertyPage extends PropertyPage implements
|
|||
}
|
||||
);
|
||||
|
||||
List allTopicsList= Arrays.asList(fCHelpBookDescriptors);
|
||||
List enabledTopicsList= getEnabledEntries(allTopicsList);
|
||||
List<CHelpBookDescriptor> allTopicsList= Arrays.asList(fCHelpBookDescriptors);
|
||||
List<CHelpBookDescriptor> enabledTopicsList= getEnabledEntries(allTopicsList);
|
||||
|
||||
fCHelpBookList.setElements(allTopicsList);
|
||||
fCHelpBookList.setCheckedElements(enabledTopicsList);
|
||||
}
|
||||
|
||||
private List getEnabledEntries(List list) {
|
||||
private List<CHelpBookDescriptor> getEnabledEntries(List<CHelpBookDescriptor> list) {
|
||||
int size = list.size();
|
||||
List desList= new ArrayList();
|
||||
List<CHelpBookDescriptor> desList= new ArrayList<CHelpBookDescriptor>();
|
||||
|
||||
for (int i= 0; i < size; i++) {
|
||||
CHelpBookDescriptor el = (CHelpBookDescriptor)list.get(i);
|
||||
CHelpBookDescriptor el = list.get(i);
|
||||
if(el.isEnabled())
|
||||
desList.add(el);
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ public class CHelpConfigurationPropertyPage extends PropertyPage implements
|
|||
}
|
||||
|
||||
public void performOk(){
|
||||
List list = fCHelpBookList.getElements();
|
||||
List<CHelpBookDescriptor> list = fCHelpBookList.getElements();
|
||||
final IProject project = fProject;
|
||||
|
||||
for(int i = 0; i < list.size(); i++){
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
package org.eclipse.cdt.ui.dialogs;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
|
@ -75,7 +75,7 @@ public class IndexerBlock extends AbstractCOptionPage {
|
|||
|
||||
private PreferenceScopeBlock fPrefScopeBlock;
|
||||
private Combo fIndexersComboBox;
|
||||
private HashMap fIndexerConfigMap;
|
||||
private HashMap<String, IndexerConfig> fIndexerConfigMap;
|
||||
private Composite fIndexerPageComposite;
|
||||
private AbstractIndexerPage fCurrentPage;
|
||||
private Properties fCurrentProperties;
|
||||
|
@ -289,11 +289,12 @@ public class IndexerBlock extends AbstractCOptionPage {
|
|||
private void initializeIndexerCombo() {
|
||||
String[] names= new String[fIndexerConfigMap.size()];
|
||||
int j= 0;
|
||||
for (Iterator i = fIndexerConfigMap.values().iterator(); i.hasNext();) {
|
||||
IndexerConfig config = (IndexerConfig) i.next();
|
||||
for (IndexerConfig config : fIndexerConfigMap.values()) {
|
||||
names[j++]= config.getName();
|
||||
}
|
||||
Arrays.sort(names, Collator.getInstance());
|
||||
@SuppressWarnings("unchecked")
|
||||
final Comparator<Object> collator = Collator.getInstance();
|
||||
Arrays.sort(names, collator);
|
||||
fIndexersComboBox.setItems(names);
|
||||
}
|
||||
|
||||
|
@ -308,7 +309,9 @@ public class IndexerBlock extends AbstractCOptionPage {
|
|||
ICConfigurationDescription config = configs[i];
|
||||
names[i]= config.getName();
|
||||
}
|
||||
Arrays.sort(names, Collator.getInstance());
|
||||
@SuppressWarnings("unchecked")
|
||||
final Comparator<Object> collator = Collator.getInstance();
|
||||
Arrays.sort(names, collator);
|
||||
fBuildConfigComboBox.setItems(names);
|
||||
selectBuildConfigInCombo(prefs.getDefaultSettingConfiguration().getName());
|
||||
}
|
||||
|
@ -411,12 +414,11 @@ public class IndexerBlock extends AbstractCOptionPage {
|
|||
* Adds all the contributed Indexer Pages to a map
|
||||
*/
|
||||
private void initializeIndexerConfigMap() {
|
||||
fIndexerConfigMap = new HashMap(5);
|
||||
fIndexerConfigMap = new HashMap<String, IndexerConfig>(5);
|
||||
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CUIPlugin.getPluginId(), "IndexerPage"); //$NON-NLS-1$
|
||||
IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
|
||||
for (int i = 0; i < infos.length; i++) {
|
||||
final IConfigurationElement info= infos[i];
|
||||
if (info.getName().equals(NODE_INDEXERUI)) {
|
||||
for (final IConfigurationElement info : infos) {
|
||||
if (info.getName().equals(NODE_INDEXERUI)) {
|
||||
final String id = info.getAttribute(ATTRIB_INDEXERID);
|
||||
if (id != null) {
|
||||
IndexerConfig config= new IndexerConfig(info);
|
||||
|
@ -429,7 +431,7 @@ public class IndexerBlock extends AbstractCOptionPage {
|
|||
}
|
||||
|
||||
private String getIndexerName(String indexerID) {
|
||||
IndexerConfig configElement= (IndexerConfig) fIndexerConfigMap.get(indexerID);
|
||||
IndexerConfig configElement= fIndexerConfigMap.get(indexerID);
|
||||
if (configElement != null) {
|
||||
return configElement.getName();
|
||||
}
|
||||
|
@ -437,10 +439,9 @@ public class IndexerBlock extends AbstractCOptionPage {
|
|||
}
|
||||
|
||||
private String getIndexerID(String indexerName) {
|
||||
for (Iterator i = fIndexerConfigMap.entrySet().iterator(); i.hasNext();) {
|
||||
Map.Entry entry = (Map.Entry) i.next();
|
||||
String id = (String) entry.getKey();
|
||||
IndexerConfig config = (IndexerConfig) entry.getValue();
|
||||
for (Map.Entry<String, IndexerConfig> entry : fIndexerConfigMap.entrySet()) {
|
||||
String id = entry.getKey();
|
||||
IndexerConfig config = entry.getValue();
|
||||
if (indexerName.equals(config.getName())) {
|
||||
return id;
|
||||
}
|
||||
|
@ -449,7 +450,7 @@ public class IndexerBlock extends AbstractCOptionPage {
|
|||
}
|
||||
|
||||
private AbstractIndexerPage getIndexerPage(String indexerID) {
|
||||
IndexerConfig configElement= (IndexerConfig) fIndexerConfigMap.get(indexerID);
|
||||
IndexerConfig configElement= fIndexerConfigMap.get(indexerID);
|
||||
if (configElement != null) {
|
||||
try {
|
||||
return configElement.getPage();
|
||||
|
|
|
@ -70,7 +70,7 @@ public class ReferenceBlock extends AbstractCOptionPage {
|
|||
public Object[] getChildren(Object element) {
|
||||
if (!(element instanceof IWorkspace))
|
||||
return new Object[0];
|
||||
ArrayList aList = new ArrayList(15);
|
||||
ArrayList<IProject> aList = new ArrayList<IProject>(15);
|
||||
final IProject[] projects = ((IWorkspace)element).getRoot().getProjects();
|
||||
for (int i = 0; i < projects.length; i++) {
|
||||
if (CoreModel.hasCNature(projects[i])) {
|
||||
|
|
|
@ -43,7 +43,7 @@ public abstract class TabFolderOptionBlock {
|
|||
private boolean bIsValid = true;
|
||||
|
||||
private Label messageLabel;
|
||||
private ArrayList pages = new ArrayList();
|
||||
private ArrayList<ICOptionPage> pages = new ArrayList<ICOptionPage>();
|
||||
protected ICOptionContainer fParent;
|
||||
private ICOptionPage fCurrentPage;
|
||||
|
||||
|
@ -75,7 +75,7 @@ public abstract class TabFolderOptionBlock {
|
|||
}
|
||||
}
|
||||
|
||||
protected List getOptionPages() {
|
||||
protected List<ICOptionPage> getOptionPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
|
@ -96,9 +96,9 @@ public abstract class TabFolderOptionBlock {
|
|||
createFolder(composite);
|
||||
|
||||
addTabs();
|
||||
setCurrentPage((ICOptionPage)pages.get(0));
|
||||
setCurrentPage(pages.get(0));
|
||||
initializingTabs = false;
|
||||
String desc = ((ICOptionPage)pages.get(0)).getDescription();
|
||||
String desc = pages.get(0).getDescription();
|
||||
if (messageLabel != null && desc != null) {
|
||||
messageLabel.setText(desc);
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ public abstract class TabFolderOptionBlock {
|
|||
}
|
||||
|
||||
protected ICOptionPage getStartPage() {
|
||||
return (ICOptionPage)pages.get(0);
|
||||
return pages.get(0);
|
||||
}
|
||||
|
||||
public int getPageIndex() {
|
||||
|
@ -153,9 +153,9 @@ public abstract class TabFolderOptionBlock {
|
|||
}
|
||||
monitor.beginTask("", pages.size()); //$NON-NLS-1$
|
||||
try {
|
||||
Iterator iter = pages.iterator();
|
||||
Iterator<ICOptionPage> iter = pages.iterator();
|
||||
while (iter.hasNext()) {
|
||||
ICOptionPage tab = (ICOptionPage)iter.next();
|
||||
ICOptionPage tab = iter.next();
|
||||
try {
|
||||
tab.performApply(new SubProgressMonitor(monitor, 1));
|
||||
} catch (CoreException e) {
|
||||
|
@ -184,9 +184,9 @@ public abstract class TabFolderOptionBlock {
|
|||
if (initializingTabs)
|
||||
return;
|
||||
boolean ok = true;
|
||||
Iterator iter = pages.iterator();
|
||||
Iterator<ICOptionPage> iter = pages.iterator();
|
||||
while (iter.hasNext()) {
|
||||
ICOptionPage tab = (ICOptionPage)iter.next();
|
||||
ICOptionPage tab = iter.next();
|
||||
ok = tab.isValid();
|
||||
if (!ok) {
|
||||
String errorMessage = tab.getErrorMessage();
|
||||
|
|
|
@ -262,8 +262,7 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
|
|||
protected boolean buttonIsEnabled(int i) {
|
||||
if (buttons == null || buttons.length <= i )
|
||||
return false;
|
||||
else
|
||||
return buttons[i].isEnabled();
|
||||
return buttons[i].isEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -362,13 +361,13 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
|
|||
protected void setupControl(Control c, int span, int mode) {
|
||||
// although we use GridLayout usually,
|
||||
// exceptions can occur: do nothing.
|
||||
if (span != 0) {
|
||||
GridData gd = new GridData(mode);
|
||||
gd.horizontalSpan = span;
|
||||
c.setLayoutData(gd);
|
||||
}
|
||||
Composite p = c.getParent();
|
||||
if (c != null) {
|
||||
if (span != 0) {
|
||||
GridData gd = new GridData(mode);
|
||||
gd.horizontalSpan = span;
|
||||
c.setLayoutData(gd);
|
||||
}
|
||||
Composite p = c.getParent();
|
||||
c.setFont(p.getFont());
|
||||
}
|
||||
}
|
||||
|
@ -603,7 +602,7 @@ public abstract class AbstractCPropertyTab implements ICPropertyTab {
|
|||
*/
|
||||
private static Method getGrayEnabled() {
|
||||
try {
|
||||
Class cl = Class.forName("org.eclipse.swt.widgets.Button"); //$NON-NLS-1$
|
||||
Class<?> cl = Class.forName("org.eclipse.swt.widgets.Button"); //$NON-NLS-1$
|
||||
return cl.getMethod("setGrayed", new Class[] { boolean.class }); //$NON-NLS-1$
|
||||
} catch (ClassNotFoundException e) {
|
||||
return null;
|
||||
|
|
|
@ -234,8 +234,8 @@ public abstract class AbstractExportTab extends AbstractCPropertyTab {
|
|||
if (ent[0] != null)
|
||||
if (dlg.check1) { // apply to all ?
|
||||
ICConfigurationDescription[] cfgs = page.getCfgsEditable();
|
||||
for (int k=0; k<cfgs.length; k++)
|
||||
cfgs[k].createExternalSetting(name2id(dlg.sel_langs, names_l),
|
||||
for (ICConfigurationDescription cfg2 : cfgs)
|
||||
cfg2.createExternalSetting(name2id(dlg.sel_langs, names_l),
|
||||
name2id(dlg.sel_types, names_t), null, ent);
|
||||
} else {
|
||||
cfg.createExternalSetting(name2id(dlg.sel_langs, names_l),
|
||||
|
@ -312,18 +312,18 @@ outer:
|
|||
}
|
||||
}
|
||||
|
||||
public static String[] name2id(String[] ein, Map names) {
|
||||
public static String[] name2id(String[] ein, Map<String, String> names) {
|
||||
if (ein != null)
|
||||
for (int k=0; k<ein.length; k++) ein[k] = (String)names.get(ein[k]);
|
||||
for (int k=0; k<ein.length; k++) ein[k] = names.get(ein[k]);
|
||||
return ein;
|
||||
}
|
||||
|
||||
public static String[] id2name(String[] ein, Map names) {
|
||||
public static String[] id2name(String[] ein, Map<String, String> names) {
|
||||
if (ein != null)
|
||||
for (int i=0; i<ein.length; i++) {
|
||||
Iterator it = names.keySet().iterator();
|
||||
Iterator<String> it = names.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
String s = (String) it.next();
|
||||
String s = it.next();
|
||||
if (ein[i].equals(names.get(s))) {
|
||||
ein[i] = s;
|
||||
break;
|
||||
|
@ -339,10 +339,10 @@ outer:
|
|||
ICConfigurationDescription c2 = dst.getConfiguration();
|
||||
c2.removeExternalSettings();
|
||||
ICExternalSetting[] v = c1.getExternalSettings();
|
||||
for (int i=0; i<v.length; i++)
|
||||
c2.createExternalSetting(v[i].getCompatibleLanguageIds(),
|
||||
v[i].getCompatibleContentTypeIds(),
|
||||
v[i].getCompatibleExtensions(), v[i].getEntries());
|
||||
for (ICExternalSetting element : v)
|
||||
c2.createExternalSetting(element.getCompatibleLanguageIds(),
|
||||
element.getCompatibleContentTypeIds(),
|
||||
element.getCompatibleExtensions(), element.getEntries());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -365,8 +365,7 @@ outer:
|
|||
return IMG_MK;
|
||||
if ((data.entry.getFlags() & ICSettingEntry.VALUE_WORKSPACE_PATH) != 0)
|
||||
return IMG_WS;
|
||||
else
|
||||
return IMG_FS;
|
||||
return IMG_FS;
|
||||
}
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
|
@ -393,8 +392,7 @@ outer:
|
|||
if (data.entry.isBuiltIn()) return null; // built in
|
||||
if (data.entry.isReadOnly()) // read only
|
||||
return JFaceResources.getFontRegistry().getItalic(JFaceResources.DIALOG_FONT);
|
||||
else // normal
|
||||
return JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT);
|
||||
return JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -422,8 +420,7 @@ outer:
|
|||
protected String getValue() {
|
||||
if (entry.getKind() == ICSettingEntry.MACRO)
|
||||
return entry.getValue();
|
||||
else
|
||||
return EMPTY_STR;
|
||||
return EMPTY_STR;
|
||||
}
|
||||
protected String getLangStr() {
|
||||
return getLabel(setting.getCompatibleLanguageIds(), names_l);
|
||||
|
@ -433,12 +430,12 @@ outer:
|
|||
}
|
||||
}
|
||||
|
||||
static protected String getLabel(String[] lst, Map names) {
|
||||
static protected String getLabel(String[] lst, Map<String, String> names) {
|
||||
if (lst == null || lst.length == 0) return ALL;
|
||||
if (lst.length > 1) return LIST;
|
||||
Iterator it = names.keySet().iterator();
|
||||
Iterator<String> it = names.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
String s = (String)it.next();
|
||||
String s = it.next();
|
||||
if (names.get(s).equals(lst[0]))
|
||||
return s;
|
||||
}
|
||||
|
@ -446,7 +443,8 @@ outer:
|
|||
}
|
||||
static protected String getList(String[] lst) {
|
||||
String s = EMPTY_STR;
|
||||
for (int i=0; i<lst.length; i++) s = s + lst[i] + '\n';
|
||||
for (String element : lst)
|
||||
s = s + element + '\n';
|
||||
return s;
|
||||
}
|
||||
static public Image getWspImage(boolean isWsp) {
|
||||
|
|
|
@ -61,7 +61,6 @@ import org.eclipse.swt.widgets.TabFolder;
|
|||
import org.eclipse.swt.widgets.TabItem;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.IWorkbenchPartReference;
|
||||
import org.eclipse.ui.IWorkbenchPropertyPage;
|
||||
import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
|
||||
import org.eclipse.ui.dialogs.PropertyPage;
|
||||
|
||||
|
@ -106,7 +105,6 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
|||
*/
|
||||
public abstract class AbstractPage extends PropertyPage
|
||||
implements
|
||||
IWorkbenchPropertyPage, // ext point
|
||||
IPreferencePageContainer, // dynamic pages
|
||||
ICPropertyProvider // utility methods for tabs
|
||||
{
|
||||
|
@ -408,14 +406,13 @@ implements
|
|||
}
|
||||
cfgChanged(MultiItemsHolder.createCDescription(multiCfgs));
|
||||
return;
|
||||
} else {
|
||||
String id1 = getResDesc() == null ? null : getResDesc().getId();
|
||||
cfgIndex = selectionIndex;
|
||||
ICConfigurationDescription newConfig = cfgDescs[selectionIndex];
|
||||
String id2 = newConfig.getId();
|
||||
if (id2 != null && !id2.equals(id1))
|
||||
cfgChanged(newConfig);
|
||||
}
|
||||
String id1 = getResDesc() == null ? null : getResDesc().getId();
|
||||
cfgIndex = selectionIndex;
|
||||
ICConfigurationDescription newConfig = cfgDescs[selectionIndex];
|
||||
String id2 = newConfig.getId();
|
||||
if (id2 != null && !id2.equals(id1))
|
||||
cfgChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -455,9 +452,8 @@ implements
|
|||
public boolean performOk() {
|
||||
File f = CUIPlugin.getDefault().getStateLocation().append("apply_mode").toFile(); //$NON-NLS-1$
|
||||
if (f.exists())
|
||||
return performSave(SAVE_MODE_APPLYOK);
|
||||
else
|
||||
return performSave(SAVE_MODE_OK);
|
||||
return performSave(SAVE_MODE_APPLYOK);
|
||||
return performSave(SAVE_MODE_OK);
|
||||
|
||||
}
|
||||
/**
|
||||
|
@ -506,20 +502,20 @@ implements
|
|||
case SAVE_MODE_APPLYOK:
|
||||
sendOK();
|
||||
ICConfigurationDescription[] olds = CDTPropertyManager.getProjectDescription(AbstractPage.this, getProject()).getConfigurations();
|
||||
for (int i=0; i<olds.length; i++) {
|
||||
resd = getResDesc(olds[i]);
|
||||
ICResourceDescription r = getResDesc(local_prjd.getConfigurationById(olds[i].getId()));
|
||||
for (int j=0; j<CDTPropertyManager.getPagesCount(); j++) {
|
||||
Object p = CDTPropertyManager.getPage(j);
|
||||
if (p != null && p instanceof AbstractPage) {
|
||||
AbstractPage ap = (AbstractPage)p;
|
||||
if (ap.displayedConfig) {
|
||||
ap.forEach(ICPropertyTab.UPDATE, resd);
|
||||
ap.forEach(ICPropertyTab.APPLY, r);
|
||||
for (ICConfigurationDescription old : olds) {
|
||||
resd = getResDesc(old);
|
||||
ICResourceDescription r = getResDesc(local_prjd.getConfigurationById(old.getId()));
|
||||
for (int j=0; j<CDTPropertyManager.getPagesCount(); j++) {
|
||||
Object p = CDTPropertyManager.getPage(j);
|
||||
if (p != null && p instanceof AbstractPage) {
|
||||
AbstractPage ap = (AbstractPage)p;
|
||||
if (ap.displayedConfig) {
|
||||
ap.forEach(ICPropertyTab.UPDATE, resd);
|
||||
ap.forEach(ICPropertyTab.APPLY, r);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SAVE_MODE_APPLY:
|
||||
forEach(ICPropertyTab.APPLY, local_cfgd);
|
||||
|
@ -827,9 +823,9 @@ implements
|
|||
*/
|
||||
protected void forEach(int m) { forEach(m, null); }
|
||||
protected void forEach(int m, Object pars) {
|
||||
Iterator it = itabs.iterator();
|
||||
Iterator<InternalTab> it = itabs.iterator();
|
||||
while(it.hasNext()) {
|
||||
InternalTab tab = (InternalTab)it.next();
|
||||
InternalTab tab = it.next();
|
||||
if (tab != null) tab.tab.handleTabEvent(m, pars);
|
||||
}
|
||||
}
|
||||
|
@ -862,11 +858,11 @@ implements
|
|||
|
||||
Arrays.sort(elements, CDTListComparator.getInstance());
|
||||
|
||||
for (int k = 0; k < elements.length; k++) {
|
||||
if (elements[k].getName().equals(ELEMENT_NAME)) {
|
||||
if (loadTab(elements[k], parent)) return;
|
||||
for (IConfigurationElement element2 : elements) {
|
||||
if (element2.getName().equals(ELEMENT_NAME)) {
|
||||
if (loadTab(element2, parent)) return;
|
||||
} else {
|
||||
System.out.println(UIMessages.getString("AbstractPage.13") + elements[k].getName()); //$NON-NLS-1$
|
||||
System.out.println(UIMessages.getString("AbstractPage.13") + element2.getName()); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -906,17 +902,16 @@ implements
|
|||
itabs.add(itab);
|
||||
currentTab = page;
|
||||
return true; // don't load other tabs
|
||||
} else { // tabbed page
|
||||
String _name = element.getAttribute(TEXT_NAME);
|
||||
String _tip = element.getAttribute(TIP_NAME);
|
||||
|
||||
Composite _comp = new Composite(folder, SWT.NONE);
|
||||
page.createControls(_comp, this);
|
||||
InternalTab itab = new InternalTab(_comp, _name, _img, page, _tip);
|
||||
itab.createOn(folder);
|
||||
itabs.add(itab);
|
||||
return false;
|
||||
}
|
||||
String _name = element.getAttribute(TEXT_NAME);
|
||||
String _tip = element.getAttribute(TIP_NAME);
|
||||
|
||||
Composite _comp = new Composite(folder, SWT.NONE);
|
||||
page.createControls(_comp, this);
|
||||
InternalTab itab = new InternalTab(_comp, _name, _img, page, _tip);
|
||||
itab.createOn(folder);
|
||||
itabs.add(itab);
|
||||
return false;
|
||||
}
|
||||
|
||||
private Image getIcon(IConfigurationElement config) {
|
||||
|
@ -973,10 +968,10 @@ implements
|
|||
for (int i=0; i<itabs.size(); i++) {
|
||||
InternalTab itab = itabs.get(i);
|
||||
TabItem ti = null;
|
||||
for (int j=0; j<ts.length; j++) {
|
||||
if (ts[j].isDisposed()) continue;
|
||||
if (ts[j].getData() == itab.tab) {
|
||||
ti = ts[j];
|
||||
for (TabItem element2 : ts) {
|
||||
if (element2.isDisposed()) continue;
|
||||
if (element2.getData() == itab.tab) {
|
||||
ti = element2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1056,8 +1051,7 @@ implements
|
|||
return false; // unknown element
|
||||
if (isForFile()) // only source files are applicable
|
||||
return true; //CoreModel.isValidSourceUnitName(getProject(), internalElement.getName());
|
||||
else
|
||||
return true; // Projects and folders are always applicable
|
||||
return true; // Projects and folders are always applicable
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1066,8 +1060,8 @@ implements
|
|||
public static void updateViews(IResource res) {
|
||||
if (res == null) return;
|
||||
IWorkbenchPartReference refs[] = CUIPlugin.getActiveWorkbenchWindow().getActivePage().getViewReferences();
|
||||
for (int k = 0; k < refs.length; k++) {
|
||||
IWorkbenchPart part = refs[k].getPart(false);
|
||||
for (IWorkbenchPartReference ref : refs) {
|
||||
IWorkbenchPart part = ref.getPart(false);
|
||||
if (part != null && part instanceof IPropertyChangeListener)
|
||||
((IPropertyChangeListener)part).propertyChange(new PropertyChangeEvent(res, PreferenceConstants.PREF_SHOW_CU_CHILDREN, null, null));
|
||||
}
|
||||
|
|
|
@ -216,10 +216,10 @@ public class BinaryParsTab extends AbstractCPropertyTab {
|
|||
clone.remove(ids[i]);
|
||||
}
|
||||
// add remaining parsers (unchecked)
|
||||
Iterator it = clone.keySet().iterator();
|
||||
Iterator<String> it = clone.keySet().iterator();
|
||||
// i = 0;
|
||||
while (it.hasNext()) {
|
||||
String s = (String)it.next();
|
||||
String s = it.next();
|
||||
data[i++] = clone.get(s);
|
||||
}
|
||||
tv.setInput(data);
|
||||
|
@ -238,9 +238,9 @@ public class BinaryParsTab extends AbstractCPropertyTab {
|
|||
if (point != null) {
|
||||
IExtension[] exts = point.getExtensions();
|
||||
configMap = new HashMap<String, BinaryParserConfiguration>(exts.length);
|
||||
for (int i = 0; i < exts.length; i++) {
|
||||
if (isExtensionVisible(exts[i])) {
|
||||
configMap.put(exts[i].getUniqueIdentifier(), new BinaryParserConfiguration(exts[i]));
|
||||
for (IExtension ext : exts) {
|
||||
if (isExtensionVisible(ext)) {
|
||||
configMap.put(ext.getUniqueIdentifier(), new BinaryParserConfiguration(ext));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -251,22 +251,22 @@ public class BinaryParsTab extends AbstractCPropertyTab {
|
|||
|
||||
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CUIPlugin.PLUGIN_ID, "BinaryParserPage"); //$NON-NLS-1$
|
||||
IConfigurationElement[] infos = extensionPoint.getConfigurationElements();
|
||||
for (int i = 0; i < infos.length; i++) {
|
||||
if (infos[i].getName().equals("parserPage")) { //$NON-NLS-1$
|
||||
String id = infos[i].getAttribute("parserID"); //$NON-NLS-1$
|
||||
fParserPageMap.put(id, new BinaryParserPageConfiguration(infos[i]));
|
||||
for (IConfigurationElement info : infos) {
|
||||
if (info.getName().equals("parserPage")) { //$NON-NLS-1$
|
||||
String id = info.getAttribute("parserID"); //$NON-NLS-1$
|
||||
fParserPageMap.put(id, new BinaryParserPageConfiguration(info));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isExtensionVisible(IExtension ext) {
|
||||
IConfigurationElement[] elements = ext.getConfigurationElements();
|
||||
for (int i = 0; i < elements.length; i++) {
|
||||
IConfigurationElement[] children = elements[i].getChildren(ATTR_FILTER);
|
||||
for (int j = 0; j < children.length; j++) {
|
||||
String name = children[j].getAttribute(ATTR_NAME);
|
||||
for (IConfigurationElement element : elements) {
|
||||
IConfigurationElement[] children = element.getChildren(ATTR_FILTER);
|
||||
for (IConfigurationElement element2 : children) {
|
||||
String name = element2.getAttribute(ATTR_NAME);
|
||||
if (name != null && name.equals(ATTR_NAME_VISIBILITY)) {
|
||||
String value = children[j].getAttribute(ATTR_VALUE);
|
||||
String value = element2.getAttribute(ATTR_VALUE);
|
||||
if (value != null && value.equals(ATTR_VALUE_PRIVATE)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -287,8 +287,8 @@ public class BinaryParsTab extends AbstractCPropertyTab {
|
|||
protected void handleBinaryParserChanged() {
|
||||
String[] enabled = getBinaryParserIDs();
|
||||
ICOptionPage dynamicPage;
|
||||
for (int i = 0; i < enabled.length; i++) { // create all enabled pages
|
||||
dynamicPage = getBinaryParserPage(enabled[i]);
|
||||
for (String element : enabled) { // create all enabled pages
|
||||
dynamicPage = getBinaryParserPage(element);
|
||||
|
||||
if (dynamicPage != null) {
|
||||
if (dynamicPage.getControl() == null) {
|
||||
|
@ -350,11 +350,11 @@ public class BinaryParsTab extends AbstractCPropertyTab {
|
|||
|
||||
private void informPages(boolean apply) {
|
||||
IProgressMonitor mon = new NullProgressMonitor();
|
||||
Iterator it = fParserPageMap.values().iterator();
|
||||
Iterator<BinaryParserPageConfiguration> it = fParserPageMap.values().iterator();
|
||||
|
||||
while (it.hasNext()) {
|
||||
try {
|
||||
ICOptionPage dynamicPage = ((BinaryParserPageConfiguration)it.next()).getPage();
|
||||
ICOptionPage dynamicPage = (it.next()).getPage();
|
||||
if (dynamicPage.isValid() && dynamicPage.getControl() != null) {
|
||||
if (apply)
|
||||
dynamicPage.performApply(mon);
|
||||
|
|
|
@ -91,10 +91,10 @@ public class CDTPrefUtil {
|
|||
}
|
||||
public static void savePreferredTCs() {
|
||||
if (preferredTCs == null) return;
|
||||
Iterator it = preferredTCs.iterator();
|
||||
Iterator<String> it = preferredTCs.iterator();
|
||||
StringBuffer b = new StringBuffer();
|
||||
while (it.hasNext()) {
|
||||
String s = (String)it.next();
|
||||
String s = it.next();
|
||||
if (s == null) continue;
|
||||
b.append(s);
|
||||
b.append(DELIMITER);
|
||||
|
@ -216,19 +216,16 @@ public class CDTPrefUtil {
|
|||
}
|
||||
return lst.toArray();
|
||||
}
|
||||
else // DMODE_ALL
|
||||
{
|
||||
TreeSet<Object> lst = new TreeSet<Object>(cmp); // set, to avoid doubles
|
||||
for (int i=0; i<input.length; i++) {
|
||||
if (input[i] == null ||
|
||||
input[i].length == 0)
|
||||
continue;
|
||||
for (int j=0; j<input[i].length; j++)
|
||||
lst.add(input[i][j]);
|
||||
}
|
||||
s1 = lst.toArray();
|
||||
Arrays.sort(s1, cmp);
|
||||
return s1;
|
||||
TreeSet<Object> lst = new TreeSet<Object>(cmp); // set, to avoid doubles
|
||||
for (Object[] element : input) {
|
||||
if (element == null ||
|
||||
element.length == 0)
|
||||
continue;
|
||||
for (Object element2 : element)
|
||||
lst.add(element2);
|
||||
}
|
||||
s1 = lst.toArray();
|
||||
Arrays.sort(s1, cmp);
|
||||
return s1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ public class CDTPropertyManager {
|
|||
if (pages.contains(w)) { // Widget ?
|
||||
pages.remove(w);
|
||||
} else { // Property Page ?
|
||||
Iterator it = pages.iterator();
|
||||
Iterator<Object> it = pages.iterator();
|
||||
while (it.hasNext()) {
|
||||
Object ob = it.next();
|
||||
if (ob != null && ob instanceof PropertyPage) {
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.eclipse.cdt.core.model.util.CDTListComparator;
|
|||
import org.eclipse.cdt.ui.newui.AbstractExportTab.ExtData;
|
||||
import org.eclipse.cdt.ui.wizards.EntryDescriptor;
|
||||
|
||||
public class CDTUIListComparator extends CDTListComparator implements Comparator<Object> {
|
||||
public class CDTUIListComparator extends CDTListComparator {
|
||||
private static Comparator<Object> comparator = null;
|
||||
|
||||
public static Comparator<Object> getInstance() {
|
||||
|
|
|
@ -88,8 +88,8 @@ public abstract class CLocationTab extends AbstractCPropertyTab {
|
|||
if (s.length == 0)
|
||||
return UIMessages.getString("CLocationTab.0"); //$NON-NLS-1$
|
||||
String x = UIMessages.getString("CLocationTab.1"); //$NON-NLS-1$
|
||||
for (int i=0; i< s.length; i++)
|
||||
x = x + s[i] + UIMessages.getString("CLocationTab.2"); //$NON-NLS-1$
|
||||
for (String element : s)
|
||||
x = x + element + UIMessages.getString("CLocationTab.2"); //$NON-NLS-1$
|
||||
x = x.substring(0, x.length() - 2) + UIMessages.getString("CLocationTab.3"); //$NON-NLS-1$
|
||||
return x;
|
||||
}
|
||||
|
@ -186,8 +186,8 @@ public abstract class CLocationTab extends AbstractCPropertyTab {
|
|||
case 0:
|
||||
String[] ss = getProjectDialog(shell);
|
||||
if (ss != null) {
|
||||
for (int i=0; i<ss.length; i++)
|
||||
src.add(new _Entry(newEntry(new Path(ss[i]), new IPath[0], true)));
|
||||
for (String element : ss)
|
||||
src.add(new _Entry(newEntry(new Path(element), new IPath[0], true)));
|
||||
saveData();
|
||||
}
|
||||
break;
|
||||
|
@ -227,9 +227,9 @@ public abstract class CLocationTab extends AbstractCPropertyTab {
|
|||
break;
|
||||
case 3:
|
||||
if (sel.length == 0) return;
|
||||
for (int i = 0; i < sel.length; i++) {
|
||||
if (sel[i].getData() instanceof _Entry) src.remove(sel[i].getData());
|
||||
}
|
||||
for (TreeItem element : sel) {
|
||||
if (element.getData() instanceof _Entry) src.remove(element.getData());
|
||||
}
|
||||
saveData();
|
||||
break;
|
||||
default:
|
||||
|
@ -239,9 +239,9 @@ public abstract class CLocationTab extends AbstractCPropertyTab {
|
|||
|
||||
private void saveData() {
|
||||
ICExclusionPatternPathEntry[] p = new ICExclusionPatternPathEntry[src.size()];
|
||||
Iterator it = src.iterator();
|
||||
Iterator<_Entry> it = src.iterator();
|
||||
int i=0;
|
||||
while(it.hasNext()) { p[i++] = ((_Entry)it.next()).ent; }
|
||||
while(it.hasNext()) { p[i++] = (it.next()).ent; }
|
||||
setEntries(cfgd, p);
|
||||
tree.setInput(cfgd);
|
||||
updateData(cfgd);
|
||||
|
@ -346,6 +346,7 @@ public abstract class CLocationTab extends AbstractCPropertyTab {
|
|||
p = _f.getFullPath();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object getAdapter(Class adapter) {
|
||||
return f.getAdapter(adapter);
|
||||
}
|
||||
|
|
|
@ -307,8 +307,8 @@ public class EnvironmentTab extends AbstractCPropertyTab {
|
|||
|
||||
data.clear();
|
||||
if (_vars != null) {
|
||||
for (int i=0; i<_vars.length; i++) {
|
||||
data.add(new TabData(_vars[i], false));
|
||||
for (IEnvironmentVariable _var : _vars) {
|
||||
data.add(new TabData(_var, false));
|
||||
}
|
||||
}
|
||||
tv.setInput(data);
|
||||
|
@ -324,12 +324,13 @@ public class EnvironmentTab extends AbstractCPropertyTab {
|
|||
|
||||
ce.setAppendEnvironment(ce.appendEnvironment(src), dst);
|
||||
IEnvironmentVariable[] v = ce.getVariables(dst);
|
||||
for (int i=0; i<v.length; i++) ce.removeVariable(v[i].getName(), dst);
|
||||
for (IEnvironmentVariable element : v)
|
||||
ce.removeVariable(element.getName(), dst);
|
||||
v = ce.getVariables(src);
|
||||
for (int i=0; i<v.length; i++) {
|
||||
if (ce.isUserVariable(src, v[i]))
|
||||
ce.addVariable(v[i].getName(), v[i].getValue(),
|
||||
v[i].getOperation(), v[i].getDelimiter(), dst);
|
||||
for (IEnvironmentVariable element : v) {
|
||||
if (ce.isUserVariable(src, element))
|
||||
ce.addVariable(element.getName(), element.getValue(),
|
||||
element.getOperation(), element.getDelimiter(), dst);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -437,11 +438,11 @@ public class EnvironmentTab extends AbstractCPropertyTab {
|
|||
if (cfgd == null)
|
||||
vars.createVariable(dlg.t1.trim(), dlg.t2.trim(),
|
||||
IEnvironmentVariable.ENVVAR_APPEND, SEMI);
|
||||
else
|
||||
for (int x=0; x<cfgs.length; x++) {
|
||||
else
|
||||
for (ICConfigurationDescription cfg : cfgs) {
|
||||
ce.addVariable(dlg.t1.trim(), dlg.t2.trim(),
|
||||
IEnvironmentVariable.ENVVAR_APPEND,
|
||||
SEMI, cfgs[x]);
|
||||
SEMI, cfg);
|
||||
}
|
||||
updateData();
|
||||
}
|
||||
|
@ -450,7 +451,7 @@ public class EnvironmentTab extends AbstractCPropertyTab {
|
|||
|
||||
private void handleEnvSelectButtonSelected() {
|
||||
// get Environment Variables from the OS
|
||||
Map v = EnvironmentReader.getEnvVars();
|
||||
Map<?,?> v = EnvironmentReader.getEnvVars();
|
||||
MyListSelectionDialog dialog = new MyListSelectionDialog(usercomp.getShell(), v, createSelectionDialogContentProvider());
|
||||
|
||||
dialog.setTitle(UIMessages.getString("EnvironmentTab.14")); //$NON-NLS-1$
|
||||
|
@ -462,8 +463,8 @@ public class EnvironmentTab extends AbstractCPropertyTab {
|
|||
else
|
||||
cfgs = new ICConfigurationDescription[] {cfgd};
|
||||
|
||||
for (int i = 0; i < selected.length; i++) {
|
||||
String name = (String)selected[i];
|
||||
for (Object element : selected) {
|
||||
String name = (String)element;
|
||||
String value = EMPTY_STR;
|
||||
int x = name.indexOf(LBR);
|
||||
if (x >= 0) {
|
||||
|
@ -472,13 +473,13 @@ public class EnvironmentTab extends AbstractCPropertyTab {
|
|||
}
|
||||
|
||||
if (cfgd == null)
|
||||
vars.createVariable(name, value);
|
||||
vars.createVariable(name, value);
|
||||
else
|
||||
for (int y=0; y<cfgs.length; y++) {
|
||||
for (ICConfigurationDescription cfg : cfgs) {
|
||||
ce.addVariable(
|
||||
name, value,
|
||||
IEnvironmentVariable.ENVVAR_APPEND,
|
||||
SEMI, cfgs[y]);
|
||||
SEMI, cfg);
|
||||
}
|
||||
}
|
||||
updateData();
|
||||
|
@ -491,12 +492,13 @@ public class EnvironmentTab extends AbstractCPropertyTab {
|
|||
public Object[] getElements(Object inputElement) {
|
||||
String[] els = null;
|
||||
if (inputElement instanceof Map) {
|
||||
Map m = (Map)inputElement;
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String,?> m = (Map)inputElement;
|
||||
els = new String[m.size()];
|
||||
int index = 0;
|
||||
for (Iterator iterator = m.keySet().iterator(); iterator.hasNext(); index++) {
|
||||
String k = (String)iterator.next();
|
||||
els[index] = TextProcessor.process(k + LBR + (String)m.get(k) + RBR);
|
||||
for (Iterator<String> iterator = m.keySet().iterator(); iterator.hasNext(); index++) {
|
||||
String k = iterator.next();
|
||||
els[index] = TextProcessor.process(k + LBR + m.get(k) + RBR);
|
||||
}
|
||||
}
|
||||
Arrays.sort(els, CDTListComparator.getInstance());
|
||||
|
|
|
@ -82,9 +82,9 @@ public class ErrorParsTab extends AbstractCPropertyTab {
|
|||
);
|
||||
if (point != null) {
|
||||
IExtension[] exts = point.getExtensions();
|
||||
for (int i = 0; i < exts.length; i++) {
|
||||
if (exts[i].getConfigurationElements().length > 0) {
|
||||
mapParsers.put(exts[i].getUniqueIdentifier(), exts[i].getLabel());
|
||||
for (IExtension ext : exts) {
|
||||
if (ext.getConfigurationElements().length > 0) {
|
||||
mapParsers.put(ext.getUniqueIdentifier(), ext.getLabel());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -160,19 +160,19 @@ public class ErrorParsTab extends AbstractCPropertyTab {
|
|||
ArrayList<TableData> checked = new ArrayList<TableData>(ss.length);
|
||||
HashMap<String, String> cloneMap = new HashMap<String, String>(mapParsers);
|
||||
// add checked elements
|
||||
for (int i=0; i<ss.length; i++) {
|
||||
String s = cloneMap.get(ss[i]);
|
||||
for (String element : ss) {
|
||||
String s = cloneMap.get(element);
|
||||
if (s != null) {
|
||||
TableData d = new TableData(ss[i],s);
|
||||
TableData d = new TableData(element,s);
|
||||
data.add(d);
|
||||
checked.add(d);
|
||||
cloneMap.remove(ss[i]);
|
||||
cloneMap.remove(element);
|
||||
}
|
||||
}
|
||||
// add remaining parsers (unchecked)
|
||||
Iterator it = cloneMap.keySet().iterator();
|
||||
Iterator<String> it = cloneMap.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
String s = (String)it.next();
|
||||
String s = it.next();
|
||||
data.add(new TableData(s, cloneMap.get(s)));
|
||||
}
|
||||
tv.setInput(data.toArray());
|
||||
|
|
|
@ -69,7 +69,7 @@ public class ExPatternDialog extends StatusDialog {
|
|||
|
||||
}
|
||||
|
||||
private ListDialogField fExclusionPatternList;
|
||||
private ListDialogField<String> fExclusionPatternList;
|
||||
private IProject fCurrProject;
|
||||
private IPath[] pattern;
|
||||
private IPath path;
|
||||
|
@ -100,7 +100,7 @@ public class ExPatternDialog extends StatusDialog {
|
|||
|
||||
ExclusionPatternAdapter adapter= new ExclusionPatternAdapter();
|
||||
|
||||
fExclusionPatternList= new ListDialogField(adapter, buttonLabels, new ExPatternLabelProvider());
|
||||
fExclusionPatternList= new ListDialogField<String>(adapter, buttonLabels, new ExPatternLabelProvider());
|
||||
fExclusionPatternList.setDialogFieldListener(adapter);
|
||||
fExclusionPatternList.setLabelText(label);
|
||||
fExclusionPatternList.setRemoveButtonIndex(IDX_REMOVE);
|
||||
|
@ -139,7 +139,7 @@ public class ExPatternDialog extends StatusDialog {
|
|||
return composite;
|
||||
}
|
||||
|
||||
protected void doCustomButtonPressed(ListDialogField field, int index) {
|
||||
protected void doCustomButtonPressed(ListDialogField<String> field, int index) {
|
||||
if (index == IDX_ADD) {
|
||||
addEntry();
|
||||
} else if (index == IDX_EDIT) {
|
||||
|
@ -149,27 +149,27 @@ public class ExPatternDialog extends StatusDialog {
|
|||
}
|
||||
}
|
||||
|
||||
protected void doDoubleClicked(ListDialogField field) {
|
||||
protected void doDoubleClicked(ListDialogField<String> field) {
|
||||
editEntry();
|
||||
}
|
||||
|
||||
protected void doSelectionChanged(ListDialogField field) {
|
||||
List selected= field.getSelectedElements();
|
||||
protected void doSelectionChanged(ListDialogField<String> field) {
|
||||
List<String> selected= field.getSelectedElements();
|
||||
fExclusionPatternList.enableButton(IDX_EDIT, canEdit(selected));
|
||||
}
|
||||
|
||||
private boolean canEdit(List selected) {
|
||||
private boolean canEdit(List<?> selected) {
|
||||
return selected.size() == 1;
|
||||
}
|
||||
|
||||
private void editEntry() {
|
||||
|
||||
List selElements= fExclusionPatternList.getSelectedElements();
|
||||
List<String> selElements= fExclusionPatternList.getSelectedElements();
|
||||
if (selElements.size() != 1) {
|
||||
return;
|
||||
}
|
||||
List existing= fExclusionPatternList.getElements();
|
||||
String entry= (String) selElements.get(0);
|
||||
List<String> existing= fExclusionPatternList.getElements();
|
||||
String entry= selElements.get(0);
|
||||
ExPatternEntryDialog dialog= new ExPatternEntryDialog(getShell(), entry, existing, fCurrProject, path);
|
||||
if (dialog.open() == Window.OK) {
|
||||
fExclusionPatternList.replaceElement(entry, dialog.getExclusionPattern());
|
||||
|
@ -177,7 +177,7 @@ public class ExPatternDialog extends StatusDialog {
|
|||
}
|
||||
|
||||
private void addEntry() {
|
||||
List existing= fExclusionPatternList.getElements();
|
||||
List<String> existing= fExclusionPatternList.getElements();
|
||||
ExPatternEntryDialog dialog= new ExPatternEntryDialog(getShell(), null, existing, fCurrProject, path);
|
||||
if (dialog.open() == Window.OK) {
|
||||
fExclusionPatternList.addElement(dialog.getExclusionPattern());
|
||||
|
@ -188,16 +188,16 @@ public class ExPatternDialog extends StatusDialog {
|
|||
|
||||
// -------- ExclusionPatternAdapter --------
|
||||
|
||||
private class ExclusionPatternAdapter implements IListAdapter, IDialogFieldListener {
|
||||
public void customButtonPressed(ListDialogField field, int index) {
|
||||
private class ExclusionPatternAdapter implements IListAdapter<String>, IDialogFieldListener {
|
||||
public void customButtonPressed(ListDialogField<String> field, int index) {
|
||||
doCustomButtonPressed(field, index);
|
||||
}
|
||||
|
||||
public void selectionChanged(ListDialogField field) {
|
||||
public void selectionChanged(ListDialogField<String> field) {
|
||||
doSelectionChanged(field);
|
||||
}
|
||||
|
||||
public void doubleClicked(ListDialogField field) {
|
||||
public void doubleClicked(ListDialogField<String> field) {
|
||||
doDoubleClicked(field);
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ public class ExPatternDialog extends StatusDialog {
|
|||
public IPath[] getExclusionPattern() {
|
||||
IPath[] res= new IPath[fExclusionPatternList.getSize()];
|
||||
for (int i= 0; i < res.length; i++) {
|
||||
String entry= (String) fExclusionPatternList.getElement(i);
|
||||
String entry= fExclusionPatternList.getElement(i);
|
||||
res[i]= new Path(entry);
|
||||
}
|
||||
return res;
|
||||
|
@ -232,7 +232,7 @@ public class ExPatternDialog extends StatusDialog {
|
|||
}
|
||||
|
||||
private void addMultipleEntries() {
|
||||
Class[] acceptedClasses= new Class[] { IFolder.class, IFile.class };
|
||||
Class<?>[] acceptedClasses= new Class<?>[] { IFolder.class, IFile.class };
|
||||
ISelectionStatusValidator validator= new TypedElementSelectionValidator(acceptedClasses, true);
|
||||
ViewerFilter filter= new TypedViewerFilter(acceptedClasses);
|
||||
|
||||
|
@ -254,8 +254,8 @@ public class ExPatternDialog extends StatusDialog {
|
|||
Object[] objects= dialog.getResult();
|
||||
int existingSegments= fCurrSourceFolder.getFullPath().segmentCount();
|
||||
|
||||
for (int i= 0; i < objects.length; i++) {
|
||||
IResource curr= (IResource) objects[i];
|
||||
for (Object object : objects) {
|
||||
IResource curr= (IResource) object;
|
||||
IPath path= curr.getFullPath().removeFirstSegments(existingSegments).makeRelative();
|
||||
String res;
|
||||
if (curr instanceof IContainer) {
|
||||
|
|
|
@ -55,9 +55,9 @@ public class ExPatternEntryDialog extends StatusDialog {
|
|||
|
||||
private IContainer fCurrSourceFolder;
|
||||
private String fExclusionPattern;
|
||||
private List fExistingPatterns;
|
||||
private List<String> fExistingPatterns;
|
||||
|
||||
public ExPatternEntryDialog(Shell parent, String patternToEdit, List existingPatterns, IProject proj, IPath path) {
|
||||
public ExPatternEntryDialog(Shell parent, String patternToEdit, List<String> existingPatterns, IProject proj, IPath path) {
|
||||
super(parent);
|
||||
fExistingPatterns = existingPatterns;
|
||||
if (patternToEdit == null) {
|
||||
|
@ -189,7 +189,7 @@ public class ExPatternEntryDialog extends StatusDialog {
|
|||
// ---------- util method ------------
|
||||
|
||||
private IPath chooseExclusionPattern() {
|
||||
Class[] acceptedClasses = new Class[] { IFolder.class, IFile.class};
|
||||
Class<?>[] acceptedClasses = new Class<?>[] { IFolder.class, IFile.class};
|
||||
ISelectionStatusValidator validator = new TypedElementSelectionValidator(acceptedClasses, false);
|
||||
ViewerFilter filter = new TypedViewerFilter(acceptedClasses);
|
||||
|
||||
|
|
|
@ -58,14 +58,14 @@ public class ExpDialog extends AbstractPropertyDialog {
|
|||
private int kind;
|
||||
private ICConfigurationDescription cfgd;
|
||||
private String[] names_l, names_t;
|
||||
private java.util.List existing;
|
||||
private java.util.List<String> existing;
|
||||
|
||||
public ExpDialog(Shell parent, boolean _newAction,
|
||||
String title, String _data1, String _data2,
|
||||
ICConfigurationDescription _cfgd,
|
||||
String[] _langs, String[] _types,
|
||||
int _kind, String[] _names_l, String[] _names_t,
|
||||
java.util.List _existing, boolean _isWsp) {
|
||||
java.util.List<String> _existing, boolean _isWsp) {
|
||||
super(parent, title);
|
||||
super.text1 = (_data1 == null) ? EMPTY_STR : _data1;
|
||||
super.text2 = (_data2 == null) ? EMPTY_STR : _data2;
|
||||
|
@ -304,8 +304,8 @@ public class ExpDialog extends AbstractPropertyDialog {
|
|||
for (int i=0; i<indices.length; i++) indices[i] = -1;
|
||||
|
||||
for (int i=0; i<items.length; i++) {
|
||||
for (int j=0; j<sel.length; j++) {
|
||||
if (items[i].equals(sel[j])) {
|
||||
for (String element : sel) {
|
||||
if (items[i].equals(element)) {
|
||||
indices[cnt++] = i;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ public void additionalTableSet() {
|
|||
flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
|
||||
}
|
||||
return new CIncludePathEntry(dlg.text1, flags);
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,8 +56,8 @@ public void additionalTableSet() {
|
|||
int flags = 0;
|
||||
if (dlg.check2) flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
|
||||
return new CIncludePathEntry(dlg.text1, flags);
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -48,8 +48,8 @@ public class MultiCfgContributedEnvironment implements IContributedEnvironment {
|
|||
if (s1 == null)
|
||||
s1 = AbstractPage.EMPTY_STR;
|
||||
return(s0.compareTo(s1));
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class MultiCfgContributedEnvironment implements IContributedEnvironment {
|
|||
if (any && (w != null))
|
||||
return w;
|
||||
// if (! any && ! v==w)
|
||||
if (! (any || v.equals(w)))
|
||||
if (! (any || (v==null && w==null) || (v != null && v.equals(w))))
|
||||
return null;
|
||||
}
|
||||
return v;
|
||||
|
@ -157,10 +157,9 @@ public class MultiCfgContributedEnvironment implements IContributedEnvironment {
|
|||
private ICConfigurationDescription[] getCfs(ICConfigurationDescription des) {
|
||||
if (isMulti && des instanceof ICMultiConfigDescription) {
|
||||
return (ICConfigurationDescription[])((ICMultiConfigDescription)des).getItems();
|
||||
} else {
|
||||
mono[0] = des;
|
||||
return mono;
|
||||
}
|
||||
mono[0] = des;
|
||||
return mono;
|
||||
}
|
||||
|
||||
private int getDispMode(ICConfigurationDescription des) {
|
||||
|
|
|
@ -190,10 +190,12 @@ public class MultiLineTextFieldEditor extends FieldEditor {
|
|||
|
||||
String txt = textField.getText();
|
||||
|
||||
if (txt == null)
|
||||
if (txt == null) {
|
||||
result = false;
|
||||
|
||||
result = (txt.trim().length() > 0) || emptyStringAllowed;
|
||||
}
|
||||
else {
|
||||
result = (txt.trim().length() > 0) || emptyStringAllowed;
|
||||
}
|
||||
|
||||
// call hook for subclasses
|
||||
result = result && doCheckState();
|
||||
|
@ -313,8 +315,7 @@ public class MultiLineTextFieldEditor extends FieldEditor {
|
|||
public String getStringValue() {
|
||||
if (textField != null)
|
||||
return textField.getText();
|
||||
else
|
||||
return getPreferenceStore().getString(getPreferenceName());
|
||||
return getPreferenceStore().getString(getPreferenceName());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -68,17 +68,17 @@ public class RefsTab extends AbstractCPropertyTab {
|
|||
sel.setExpanded(true);
|
||||
objs[0].setChecked(true);
|
||||
} else {
|
||||
for (int i=0; i<objs.length; i++)
|
||||
objs[i].setChecked(false);
|
||||
for (TreeItem obj : objs)
|
||||
obj.setChecked(false);
|
||||
}
|
||||
} else {
|
||||
TreeItem parent = sel.getParentItem();
|
||||
TreeItem[] objs = parent.getItems();
|
||||
if (sel.getChecked()) {
|
||||
if (parent.getChecked()) {
|
||||
for (int i=0; i<objs.length; i++) {
|
||||
for (TreeItem obj : objs) {
|
||||
// if (!sel.equals(objs[i]))
|
||||
objs[i].setChecked(false);
|
||||
obj.setChecked(false);
|
||||
}
|
||||
sel.setChecked(true);
|
||||
} else
|
||||
|
@ -139,9 +139,9 @@ public class RefsTab extends AbstractCPropertyTab {
|
|||
private void saveChecked() {
|
||||
TreeItem[] tr = tree.getItems();
|
||||
Map<String, String> refs = new HashMap<String, String>();
|
||||
for (int i=0; i<tr.length; i++) {
|
||||
if (tr[i].getChecked()) {
|
||||
TreeItem[] cfgs = tr[i].getItems();
|
||||
for (TreeItem element : tr) {
|
||||
if (element.getChecked()) {
|
||||
TreeItem[] cfgs = element.getItems();
|
||||
for (int j=0; j<cfgs.length; j++) {
|
||||
if (cfgs[j].getChecked()) {
|
||||
String cfgId = EMPTY_STR;
|
||||
|
@ -151,7 +151,7 @@ public class RefsTab extends AbstractCPropertyTab {
|
|||
cfgId = ((ICConfigurationDescription)ob).getId();
|
||||
}
|
||||
}
|
||||
refs.put(tr[i].getText(), cfgId);
|
||||
refs.put(element.getText(), cfgId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ public class RefsTab extends AbstractCPropertyTab {
|
|||
if (p == null) return;
|
||||
IProject[] ps = p.getWorkspace().getRoot().getProjects();
|
||||
|
||||
Map refs = getResDesc().getConfiguration().getReferenceInfo();
|
||||
Map<String,String> refs = getResDesc().getConfiguration().getReferenceInfo();
|
||||
|
||||
|
||||
TreeItem ti, ti1;
|
||||
|
@ -183,7 +183,7 @@ public class RefsTab extends AbstractCPropertyTab {
|
|||
ti.setText(name);
|
||||
ti.setData(ps[i]);
|
||||
if (refs.containsKey(name)) {
|
||||
ref = (String)refs.get(name);
|
||||
ref = refs.get(name);
|
||||
ti.setChecked(true);
|
||||
}
|
||||
ti1 = new TreeItem(ti, SWT.NONE);
|
||||
|
@ -191,11 +191,11 @@ public class RefsTab extends AbstractCPropertyTab {
|
|||
ti1.setData(new ActiveCfg(ps[i]));
|
||||
if (EMPTY_STR.equals(ref))
|
||||
ti1.setChecked(true);
|
||||
for (int j=0; j<cfgs.length; j++) {
|
||||
for (ICConfigurationDescription cfg : cfgs) {
|
||||
ti1 = new TreeItem(ti, SWT.NONE);
|
||||
ti1.setText(cfgs[j].getName());
|
||||
ti1.setData(cfgs[j]);
|
||||
if (cfgs[j].getId().equals(ref)) {
|
||||
ti1.setText(cfg.getName());
|
||||
ti1.setData(cfg);
|
||||
if (cfg.getId().equals(ref)) {
|
||||
ti1.setChecked(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -264,7 +264,8 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
*/
|
||||
private void expand(TreeItem ti0, String text, Object[] obs) {
|
||||
TreeItem ti = create(ti0, text, obs == null ? 0 : obs.length);
|
||||
if (!check(ti, obs)) return;
|
||||
if (obs == null || !check(ti, obs))
|
||||
return;
|
||||
for (int i=0; i<obs.length; i++) {
|
||||
String s = BL+i+BR;
|
||||
if (obs[i] instanceof String) create(ti, s, (String)obs[i]);
|
||||
|
@ -288,8 +289,8 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
|
||||
TreeItem[] tis = ti.getItems();
|
||||
if (tis == null) return;
|
||||
for (int i=0; i<tis.length; i++)
|
||||
expandAll(tis[i], b, level);
|
||||
for (TreeItem ti2 : tis)
|
||||
expandAll(ti2, b, level);
|
||||
}
|
||||
// used for languages kinds display
|
||||
private int[] flagsToArray(int flags){
|
||||
|
@ -338,7 +339,7 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
|
||||
private TreeItem update(TreeItem ti0, String text, CBuildData bd) {
|
||||
TreeItem ti = createObj(ti0, text, bd == null ? NULL : bd.getName(), bd);
|
||||
if (!check(ti, bd)) return ti;
|
||||
if (bd == null || !check(ti, bd)) return ti;
|
||||
// ALMOST THE SAME AS ICBuildSetting
|
||||
update(ti, "getBuilderCWD()", bd.getBuilderCWD()); //$NON-NLS-1$
|
||||
createObj(ti, "getBuildEnvironmentContributor()", EMPTY_STR, bd.getBuildEnvironmentContributor()); //$NON-NLS-1$
|
||||
|
@ -353,7 +354,7 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
|
||||
private TreeItem update(TreeItem ti0, String text, CConfigurationData cd) {
|
||||
TreeItem ti = createObj(ti0, text, cd == null ? NULL : cd.getName(), cd);
|
||||
if (!check(ti, cd)) return ti;
|
||||
if (cd == null || !check(ti, cd)) return ti;
|
||||
update(ti, "getBuildData()", cd.getBuildData()); //$NON-NLS-1$
|
||||
createObj(ti, "getBuildVariablesContributor()", EMPTY_STR, cd.getBuildVariablesContributor()); //$NON-NLS-1$
|
||||
create(ti, "getDescription()", cd.getDescription()); //$NON-NLS-1$
|
||||
|
@ -370,7 +371,7 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
|
||||
private TreeItem update(TreeItem ti0, String text, CLanguageData ls) {
|
||||
TreeItem ti = createObj(ti0, text, ls == null ? NULL : ls.getName(), ls);
|
||||
if (!check(ti, ls)) return ti;
|
||||
if (ls == null || !check(ti, ls)) return ti;
|
||||
create(ti, "getId()", ls.getId()); //$NON-NLS-1$
|
||||
create(ti, "getLanguageId()", ls.getLanguageId()); //$NON-NLS-1$
|
||||
create(ti, "getName()", ls.getName()); //$NON-NLS-1$
|
||||
|
@ -380,9 +381,9 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
int k = ls.getSupportedEntryKinds();
|
||||
TreeItem ti1 = create(ti, "getSupportedEntryKinds()", k); //$NON-NLS-1$
|
||||
int[] kind = flagsToArray(k);
|
||||
for (int j=0; j<kind.length; j++) {
|
||||
TreeItem ti2 = create(ti1, "Kind", kind[j]); //$NON-NLS-1$
|
||||
expand(ti2, "getEntries",ls.getEntries(kind[j])); //$NON-NLS-1$
|
||||
for (int element : kind) {
|
||||
TreeItem ti2 = create(ti1, "Kind", element); //$NON-NLS-1$
|
||||
expand(ti2, "getEntries",ls.getEntries(element)); //$NON-NLS-1$
|
||||
}
|
||||
create(ti,"isValid()",ls.isValid()); //$NON-NLS-1$
|
||||
return ti;
|
||||
|
@ -390,7 +391,7 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
|
||||
private TreeItem update(TreeItem ti0, String text, CResourceData bd) {
|
||||
TreeItem ti = createObj(ti0, text, bd == null ? NULL : bd.getName(), bd);
|
||||
if (!check(ti, bd)) return ti;
|
||||
if (bd == null || !check(ti, bd)) return ti;
|
||||
create(ti, "getId()", bd.getId()); //$NON-NLS-1$
|
||||
if (bd instanceof CFolderData)
|
||||
expand(ti, "getLanguageDatas()", ((CFolderData)bd).getLanguageDatas()); //$NON-NLS-1$
|
||||
|
@ -404,7 +405,7 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
|
||||
private TreeItem update(TreeItem ti0, String text, CTargetPlatformData bd) {
|
||||
TreeItem ti = createObj(ti0, text, bd == null ? NULL : bd.getName(), bd);
|
||||
if (!check(ti, bd)) return ti;
|
||||
if (bd == null || !check(ti, bd)) return ti;
|
||||
expand(ti, "getBinaryParserIds()", bd.getBinaryParserIds()); //$NON-NLS-1$
|
||||
create(ti, "getId()", bd.getId()); //$NON-NLS-1$
|
||||
create(ti, "getName()", bd.getName()); //$NON-NLS-1$
|
||||
|
@ -414,7 +415,7 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
}
|
||||
private TreeItem update(TreeItem ti0, String text, ICBuildSetting obj) {
|
||||
TreeItem ti = createObj(ti0, text, obj == null ? NULL : obj.getName(), obj);
|
||||
if (!check(ti, obj)) return ti;
|
||||
if (obj == null || !check(ti, obj)) return ti;
|
||||
// ALMOST THE SAME AS CBuildData
|
||||
update(ti, "getBuilderCWD()", obj.getBuilderCWD()); //$NON-NLS-1$
|
||||
createObj(ti, "getBuildEnvironmentContributor()", EMPTY_STR, obj.getBuildEnvironmentContributor()); //$NON-NLS-1$
|
||||
|
@ -432,7 +433,7 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
}
|
||||
private TreeItem update(TreeItem ti0, String text, ICConfigurationDescription cfg) {
|
||||
TreeItem ti = createObj(ti0, text, cfg == null ? NULL : cfg.getName(), cfg);
|
||||
if (!check(ti, cfg)) return ti;
|
||||
if (cfg == null || !check(ti, cfg)) return ti;
|
||||
if (getDepth(ti) > NESTING_CFG) return ti;
|
||||
|
||||
update(ti, "getBuildSetting()", cfg.getBuildSetting()); //$NON-NLS-1$
|
||||
|
@ -492,7 +493,7 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
}
|
||||
private TreeItem update(TreeItem ti0, String text, ICResourceDescription rcfg) {
|
||||
TreeItem ti = createObj(ti0, text, rcfg == null ? NULL : rcfg.getName(), rcfg);
|
||||
if (!check(ti, rcfg)) return ti;
|
||||
if (rcfg == null || !check(ti, rcfg)) return ti;
|
||||
update(ti, "getConfiguration()", rcfg.getConfiguration()); //$NON-NLS-1$
|
||||
create(ti, "getId()", rcfg.getId()); //$NON-NLS-1$
|
||||
create(ti, "getName()", rcfg.getName()); //$NON-NLS-1$
|
||||
|
@ -519,7 +520,7 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
}
|
||||
private TreeItem update(TreeItem ti0, String text, ICLanguageSetting ls) {
|
||||
TreeItem ti = createObj(ti0, text, ls == null ? NULL : ls.getName(), ls);
|
||||
if (!check(ti, ls)) return ti;
|
||||
if (ls == null || !check(ti, ls)) return ti;
|
||||
update(ti, "getConfiguration()", ls.getConfiguration()); //$NON-NLS-1$
|
||||
create(ti, "getId()", ls.getId()); //$NON-NLS-1$
|
||||
create(ti, "getLanguageId()", ls.getLanguageId()); //$NON-NLS-1$
|
||||
|
@ -531,10 +532,10 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
int k = ls.getSupportedEntryKinds();
|
||||
TreeItem ti1 = create(ti, "getSupportedEntryKinds()", k); //$NON-NLS-1$
|
||||
int[] kind = flagsToArray(k);
|
||||
for (int j=0; j<kind.length; j++) {
|
||||
TreeItem ti2 = create(ti1, "Kind", kind[j]); //$NON-NLS-1$
|
||||
expand(ti2, "getResolvedSettingEntries",ls.getResolvedSettingEntries(kind[j])); //$NON-NLS-1$
|
||||
expand(ti2, "getSettingEntries", ls.getSettingEntries(kind[j])); //$NON-NLS-1$
|
||||
for (int element : kind) {
|
||||
TreeItem ti2 = create(ti1, "Kind", element); //$NON-NLS-1$
|
||||
expand(ti2, "getResolvedSettingEntries",ls.getResolvedSettingEntries(element)); //$NON-NLS-1$
|
||||
expand(ti2, "getSettingEntries", ls.getSettingEntries(element)); //$NON-NLS-1$
|
||||
}
|
||||
create(ti,"isReadOnly()",ls.isReadOnly()); //$NON-NLS-1$
|
||||
create(ti,"isValid()",ls.isValid()); //$NON-NLS-1$
|
||||
|
@ -543,7 +544,7 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
|
||||
private TreeItem update(TreeItem ti0, String text, ICLanguageSettingEntry ent) {
|
||||
TreeItem ti = createObj(ti0, text, ent == null ? NULL : ent.getName(), ent);
|
||||
if (!check(ti, ent)) return ti;
|
||||
if (ent == null || !check(ti, ent)) return ti;
|
||||
create(ti, "getFlags()", ent.getFlags()); //$NON-NLS-1$
|
||||
create(ti, "getKind()", ent.getKind()); //$NON-NLS-1$
|
||||
create(ti, "getName()", ent.getName()); //$NON-NLS-1$
|
||||
|
@ -564,7 +565,7 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
|
||||
private TreeItem update(TreeItem ti0, String text, ICSettingObject obj) {
|
||||
TreeItem ti = createObj(ti0, text, obj == null ? NULL : obj.getName(), obj);
|
||||
if (!check(ti, obj)) return ti;
|
||||
if (obj == null || !check(ti, obj)) return ti;
|
||||
if (obj instanceof ICTargetPlatformSetting)
|
||||
expand(ti, "getBinaryParserIds()", ((ICTargetPlatformSetting)obj).getBinaryParserIds()); //$NON-NLS-1$
|
||||
update(ti, "getConfiguration()", obj.getConfiguration()); //$NON-NLS-1$
|
||||
|
@ -579,7 +580,7 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
|
||||
private TreeItem update(TreeItem ti0, String text, ICTargetPlatformSetting obj) {
|
||||
TreeItem ti = createObj(ti0, text, obj == null ? NULL : obj.getName(), obj);
|
||||
if (!check(ti, obj)) return ti;
|
||||
if (obj == null || !check(ti, obj)) return ti;
|
||||
update(ti, "getConfiguration()", obj.getConfiguration()); //$NON-NLS-1$
|
||||
create(ti, "getId()", obj.getId()); //$NON-NLS-1$
|
||||
create(ti, "getName()", obj.getName()); //$NON-NLS-1$
|
||||
|
@ -592,7 +593,7 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
|
||||
private TreeItem update(TreeItem ti0, String text, IPath p) {
|
||||
TreeItem ti = createObj(ti0, text, p == null ? NULL : p.toString(), p);
|
||||
if (!check(ti, p)) return ti;
|
||||
if (p == null || !check(ti, p)) return ti;
|
||||
create(ti, "getDevice()", p.getDevice()); //$NON-NLS-1$
|
||||
create(ti, "getFileExtension()", p.getFileExtension()); //$NON-NLS-1$
|
||||
create(ti, "hasTrailingSeparator()", p.hasTrailingSeparator()); //$NON-NLS-1$
|
||||
|
@ -609,7 +610,7 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
}
|
||||
private TreeItem update(TreeItem ti0, String text, IProject prj) {
|
||||
TreeItem ti = createObj(ti0, text, prj == null ? NULL : prj.getName(), prj);
|
||||
if (!check(ti, prj)) return ti;
|
||||
if (prj == null || !check(ti, prj)) return ti;
|
||||
create(ti, "exists()", prj.exists()); //$NON-NLS-1$
|
||||
try {
|
||||
create(ti, "getDefaultCharset()", prj.getDefaultCharset()); //$NON-NLS-1$
|
||||
|
@ -632,7 +633,7 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
|
||||
private TreeItem update(TreeItem ti0, String text, IProjectNatureDescriptor nd) {
|
||||
TreeItem ti = createObj(ti0, text, nd == null ? NULL : nd.getLabel(), nd);
|
||||
if (!check(ti, nd)) return ti;
|
||||
if (nd == null || !check(ti, nd)) return ti;
|
||||
create(ti, "getLabel()", nd.getLabel()); //$NON-NLS-1$
|
||||
create(ti, "getNatureId()", nd.getNatureId()); //$NON-NLS-1$
|
||||
expand(ti, "getNatureSetIds()", nd.getNatureSetIds()); //$NON-NLS-1$
|
||||
|
@ -643,7 +644,7 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
|
||||
private TreeItem update(TreeItem ti0, String text, IResource c) {
|
||||
TreeItem ti = createObj(ti0, text, c == null ? NULL : c.getName(), c);
|
||||
if (!check(ti, c)) return ti;
|
||||
if (c == null || !check(ti, c)) return ti;
|
||||
if (getDepth(ti) > NESTING_CFG) return ti;
|
||||
|
||||
if (c instanceof IContainer)
|
||||
|
@ -720,14 +721,14 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
return ti;
|
||||
}
|
||||
|
||||
private TreeItem update(TreeItem ti0, String text, Map m) {
|
||||
private TreeItem update(TreeItem ti0, String text, Map<String,String> m) {
|
||||
String s = (m == null) ? NULL : String.valueOf(m.size());
|
||||
TreeItem ti = createObj(ti0, text, s, m);
|
||||
if (!check(ti, m)) return ti;
|
||||
Iterator it = m.keySet().iterator();
|
||||
if (m == null || !check(ti, m)) return ti;
|
||||
Iterator<String> it = m.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
s = (String)it.next();
|
||||
create(ti, s + " =", (String)m.get(s)); //$NON-NLS-1$
|
||||
s = it.next();
|
||||
create(ti, s + " =", m.get(s)); //$NON-NLS-1$
|
||||
}
|
||||
return ti;
|
||||
}
|
||||
|
@ -744,7 +745,7 @@ public class StructureTreeTab extends AbstractCPropertyTab {
|
|||
|
||||
private TreeItem update(TreeItem ti0, String text, URI uri) {
|
||||
TreeItem ti = createObj(ti0, text, uri == null ? NULL : uri.toString(), uri);
|
||||
if (!check(ti, uri)) return ti;
|
||||
if (uri == null || !check(ti, uri)) return ti;
|
||||
create(ti, "getAuthority()", uri.getAuthority()); //$NON-NLS-1$
|
||||
create(ti, "getFragment()", uri.getFragment()); //$NON-NLS-1$
|
||||
create(ti, "getHost()", uri.getHost()); //$NON-NLS-1$
|
||||
|
|
|
@ -18,16 +18,16 @@ import org.eclipse.jface.viewers.ViewerFilter;
|
|||
*/
|
||||
public class TypedCDTViewerFilter extends ViewerFilter {
|
||||
|
||||
private Class[] types;
|
||||
private Class<?>[] types;
|
||||
|
||||
public TypedCDTViewerFilter(Class[] _types) { types= _types; }
|
||||
public TypedCDTViewerFilter(Class<?>[] _types) { types= _types; }
|
||||
/**
|
||||
* @see ViewerFilter#select
|
||||
*/
|
||||
@Override
|
||||
public boolean select(Viewer viewer, Object parent, Object element) {
|
||||
for (int i= 0; i < types.length; i++) {
|
||||
if (types[i].isInstance(element)) return true;
|
||||
for (Class<?> type : types) {
|
||||
if (type.isInstance(element)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -19,8 +19,9 @@ import org.eclipse.jface.text.BadLocationException;
|
|||
import org.eclipse.jface.text.IDocument;
|
||||
import org.eclipse.jface.text.ITypedRegion;
|
||||
import org.eclipse.jface.text.TextUtilities;
|
||||
import org.eclipse.jface.text.contentassist.ICompletionProposal;
|
||||
import org.eclipse.jface.text.contentassist.IContextInformation;
|
||||
|
||||
import org.eclipse.cdt.ui.text.ICCompletionProposal;
|
||||
import org.eclipse.cdt.ui.text.ICPartitions;
|
||||
import org.eclipse.cdt.ui.text.contentassist.ContentAssistInvocationContext;
|
||||
import org.eclipse.cdt.ui.text.contentassist.ICompletionProposalComputer;
|
||||
|
@ -58,7 +59,7 @@ public class GenericTagCompletionProposalComputer implements ICompletionProposal
|
|||
/*
|
||||
* @see org.eclipse.cdt.ui.text.contentassist.ICompletionProposalComputer#computeCompletionProposals(org.eclipse.cdt.ui.text.contentassist.ContentAssistInvocationContext, org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
public List computeCompletionProposals(ContentAssistInvocationContext context, IProgressMonitor monitor) {
|
||||
public List<ICompletionProposal> computeCompletionProposals(ContentAssistInvocationContext context, IProgressMonitor monitor) {
|
||||
IDocument doc= context.getDocument();
|
||||
int ivcOffset= context.getInvocationOffset();
|
||||
try {
|
||||
|
@ -68,13 +69,13 @@ public class GenericTagCompletionProposalComputer implements ICompletionProposal
|
|||
firstNonWS--;
|
||||
String prefix= doc.get(firstNonWS, ivcOffset-firstNonWS);
|
||||
if(prefix.length()>0 && isTagMarker(prefix.charAt(0))) {
|
||||
List<ICCompletionProposal> proposals= new ArrayList<ICCompletionProposal>();
|
||||
List<ICompletionProposal> proposals= new ArrayList<ICompletionProposal>();
|
||||
char tagMarker= prefix.charAt(0);
|
||||
for(int i=0; i<tags.length; i++) {
|
||||
String tag= tags[i].getTagName();
|
||||
for (GenericDocTag tag2 : tags) {
|
||||
String tag= tag2.getTagName();
|
||||
if(tag.toLowerCase().startsWith(prefix.substring(1).toLowerCase())) {
|
||||
CCompletionProposal proposal= new CCompletionProposal(tagMarker+tag, ivcOffset-prefix.length(), prefix.length(), null, tagMarker+tag, 1, context.getViewer());
|
||||
String description= tags[i].getTagDescription();
|
||||
String description= tag2.getTagDescription();
|
||||
if(description!=null && description.length()>0) {
|
||||
proposal.setAdditionalProposalInfo(description);
|
||||
}
|
||||
|
@ -86,14 +87,14 @@ public class GenericTagCompletionProposalComputer implements ICompletionProposal
|
|||
} catch(BadLocationException ble) {
|
||||
// offset is zero, ignore
|
||||
}
|
||||
return new ArrayList();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.cdt.ui.text.contentassist.ICompletionProposalComputer#computeContextInformation(org.eclipse.cdt.ui.text.contentassist.ContentAssistInvocationContext, org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
public List computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor monitor) {
|
||||
return Collections.EMPTY_LIST;
|
||||
public List<IContextInformation> computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor monitor) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -14,8 +14,6 @@ package org.eclipse.cdt.ui.wizards;
|
|||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.filesystem.EFS;
|
||||
import org.eclipse.core.filesystem.IFileInfo;
|
||||
|
@ -66,8 +64,6 @@ implements IExecutableExtension, IWizardWithMemory
|
|||
private URI lastProjectLocation = null;
|
||||
private CWizardHandler savedHandler = null;
|
||||
|
||||
protected List localPages = new ArrayList(); // replacing Wizard.pages since we have to delete them
|
||||
|
||||
public CDTCommonProjectWizard() {
|
||||
this(UIMessages.getString("NewModelProjectWizard.0"),UIMessages.getString("NewModelProjectWizard.1")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.eclipse.core.runtime.IExtension;
|
|||
import org.eclipse.core.runtime.IExtensionPoint;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.jface.dialogs.DialogPage;
|
||||
import org.eclipse.jface.dialogs.IMessageProvider;
|
||||
import org.eclipse.jface.wizard.IWizard;
|
||||
import org.eclipse.jface.wizard.IWizardPage;
|
||||
import org.eclipse.osgi.util.TextProcessor;
|
||||
|
@ -205,12 +205,11 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
|||
IFileInfo f = fs.fetchInfo();
|
||||
if (f.exists()) {
|
||||
if (f.isDirectory()) {
|
||||
setMessage(UIMessages.getString("CMainWizardPage.7"), DialogPage.WARNING); //$NON-NLS-1$
|
||||
setMessage(UIMessages.getString("CMainWizardPage.7"), IMessageProvider.WARNING); //$NON-NLS-1$
|
||||
return true;
|
||||
} else {
|
||||
setErrorMessage(UIMessages.getString("CMainWizardPage.6")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
setErrorMessage(UIMessages.getString("CMainWizardPage.6")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.log(e.getStatus());
|
||||
|
@ -271,11 +270,11 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
|||
List<EntryDescriptor> items = new ArrayList<EntryDescriptor>();
|
||||
for (int i = 0; i < extensions.length; ++i) {
|
||||
IConfigurationElement[] elements = extensions[i].getConfigurationElements();
|
||||
for (int k = 0; k < elements.length; k++) {
|
||||
if (elements[k].getName().equals(ELEMENT_NAME)) {
|
||||
for (IConfigurationElement element : elements) {
|
||||
if (element.getName().equals(ELEMENT_NAME)) {
|
||||
CNewWizard w = null;
|
||||
try {
|
||||
w = (CNewWizard) elements[k].createExecutableExtension(CLASS_NAME);
|
||||
w = (CNewWizard) element.createExecutableExtension(CLASS_NAME);
|
||||
} catch (CoreException e) {
|
||||
System.out.println(UIMessages.getString("CMainWizardPage.5") + e.getLocalizedMessage()); //$NON-NLS-1$
|
||||
return null;
|
||||
|
@ -298,9 +297,9 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
|||
// try to search item which was selected before
|
||||
if (savedStr != null) {
|
||||
TreeItem[] all = tree.getItems();
|
||||
for (int i=0; i<all.length; i++) {
|
||||
if (savedStr.equals(all[i].getText())) {
|
||||
target = all[i];
|
||||
for (TreeItem element : all) {
|
||||
if (savedStr.equals(element.getText())) {
|
||||
target = element;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -331,9 +330,9 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
|||
}
|
||||
while(true) {
|
||||
boolean found = false;
|
||||
Iterator it2 = items.iterator();
|
||||
Iterator<EntryDescriptor> it2 = items.iterator();
|
||||
while (it2.hasNext()) {
|
||||
EntryDescriptor wd1 = (EntryDescriptor)it2.next();
|
||||
EntryDescriptor wd1 = it2.next();
|
||||
if (wd1.getParentId() == null) continue;
|
||||
for (int i=0; i<placedEntryDescriptorsList.size(); i++) {
|
||||
EntryDescriptor wd2 = placedEntryDescriptorsList.get(i);
|
||||
|
@ -346,10 +345,12 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
|||
|
||||
wd1.setPath(wd2.getPath() + "/" + wd1.getId()); //$NON-NLS-1$
|
||||
wd1.setParent(wd2);
|
||||
if (wd1.getHandler() == null && !wd1.isCategory())
|
||||
wd1.setHandler((CWizardHandler)h.clone());
|
||||
if (h != null && !h.isApplicable(wd1))
|
||||
break;
|
||||
if (h != null) {
|
||||
if (wd1.getHandler() == null && !wd1.isCategory())
|
||||
wd1.setHandler((CWizardHandler)h.clone());
|
||||
if (!h.isApplicable(wd1))
|
||||
break;
|
||||
}
|
||||
|
||||
TreeItem p = placedTreeItemsList.get(i);
|
||||
TreeItem ti = new TreeItem(p, SWT.NONE);
|
||||
|
@ -393,8 +394,7 @@ import org.eclipse.cdt.internal.ui.CPluginImages;
|
|||
TreeItem[] sel = _tree.getSelection();
|
||||
if (sel == null || sel.length == 0)
|
||||
return null;
|
||||
else
|
||||
return (EntryDescriptor)sel[0].getData(DESC);
|
||||
return (EntryDescriptor)sel[0].getData(DESC);
|
||||
}
|
||||
|
||||
public void toolChainListChanged(int count) {
|
||||
|
|
|
@ -44,6 +44,5 @@ public interface IWizardItemsListListener {
|
|||
* @param items - list of EntryDescriptor objects
|
||||
* @return - list with filtered items
|
||||
*/
|
||||
List<EntryDescriptor> filterItems(List items);
|
||||
|
||||
List<EntryDescriptor> filterItems(List<? extends EntryDescriptor> items);
|
||||
}
|
||||
|
|
|
@ -13,8 +13,6 @@ package org.eclipse.cdt.ui.wizards;
|
|||
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
@ -75,8 +73,6 @@ public abstract class NewCProjectWizard extends BasicNewResourceWizard implement
|
|||
protected NewCProjectWizardPage fMainPage;
|
||||
protected IProject newProject;
|
||||
|
||||
List tabItemsList = new ArrayList();
|
||||
|
||||
public NewCProjectWizard() {
|
||||
this(CUIPlugin.getResourceString(WZ_TITLE), CUIPlugin.getResourceString(WZ_DESC),
|
||||
CUIPlugin.getResourceString(OP_ERROR));
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
package org.eclipse.cdt.ui.wizards;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.filesystem.EFS;
|
||||
|
@ -693,8 +692,7 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
|||
*
|
||||
* @return array of <code>IBaseClassInfo</code>
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected IBaseClassInfo[] getBaseClasses() {
|
||||
protected IBaseClassInfo[] getBaseClasses() {
|
||||
List<IBaseClassInfo> classesList = fBaseClassesDialogField.getElements();
|
||||
return classesList.toArray(new IBaseClassInfo[classesList.size()]);
|
||||
}
|
||||
|
@ -707,10 +705,10 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
|||
*/
|
||||
protected void addBaseClass(ITypeInfo newBaseClass, ASTAccessVisibility access, boolean isVirtual) {
|
||||
// check if already exists
|
||||
List baseClasses = fBaseClassesDialogField.getElements();
|
||||
List<IBaseClassInfo> baseClasses = fBaseClassesDialogField.getElements();
|
||||
if (baseClasses != null) {
|
||||
for (Iterator i = baseClasses.iterator(); i.hasNext(); ) {
|
||||
BaseClassInfo info = (BaseClassInfo) i.next();
|
||||
for (IBaseClassInfo baseClassInfo : baseClasses) {
|
||||
BaseClassInfo info = (BaseClassInfo) baseClassInfo;
|
||||
if (info.getType().equals(newBaseClass)) {
|
||||
// already added
|
||||
return;
|
||||
|
@ -1002,15 +1000,6 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
|||
IPath newFolderPath = updateSourceFolderFromPath(ns.getEnclosingProject().getProject().getFullPath());
|
||||
if (newFolderPath != null) {
|
||||
changedFields |= SOURCE_FOLDER_ID | HEADER_FILE_ID | SOURCE_FILE_ID;
|
||||
// adjust the relative paths
|
||||
if (oldFolderPath != null && oldFolderPath.matchingFirstSegments(newFolderPath) == 0) {
|
||||
if (headerPath != null) {
|
||||
headerPath = newFolderPath.append(headerPath.lastSegment());
|
||||
}
|
||||
if (sourcePath != null) {
|
||||
sourcePath = newFolderPath.append(sourcePath.lastSegment());
|
||||
}
|
||||
}
|
||||
setSourceFolderFullPath(newFolderPath, false);
|
||||
// adjust the relative paths
|
||||
setHeaderFileFullPath(headerPath, false);
|
||||
|
@ -1089,18 +1078,18 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
|||
/**
|
||||
* handles changes to the base classes field
|
||||
*/
|
||||
private final class BaseClassesFieldAdapter implements IListAdapter {
|
||||
public void customButtonPressed(ListDialogField field, int index) {
|
||||
private final class BaseClassesFieldAdapter implements IListAdapter<IBaseClassInfo> {
|
||||
public void customButtonPressed(ListDialogField<IBaseClassInfo> field, int index) {
|
||||
if (index == 0) {
|
||||
chooseBaseClasses();
|
||||
}
|
||||
handleFieldChanged(BASE_CLASSES_ID);
|
||||
}
|
||||
|
||||
public void selectionChanged(ListDialogField field) {
|
||||
public void selectionChanged(ListDialogField<IBaseClassInfo> field) {
|
||||
}
|
||||
|
||||
public void doubleClicked(ListDialogField field) {
|
||||
public void doubleClicked(ListDialogField<IBaseClassInfo> field) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1113,7 +1102,7 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
|||
return;
|
||||
}
|
||||
|
||||
List oldContents = fBaseClassesDialogField.getElements();
|
||||
List<IBaseClassInfo> oldContents = fBaseClassesDialogField.getElements();
|
||||
NewBaseClassSelectionDialog dialog = new NewBaseClassSelectionDialog(getShell());
|
||||
dialog.addListener(new ITypeSelectionListener() {
|
||||
public void typeAdded(ITypeInfo newBaseClass) {
|
||||
|
@ -1131,15 +1120,15 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
|
|||
/**
|
||||
* handles changes to the method stubs field
|
||||
*/
|
||||
private final class MethodStubsFieldAdapter implements IListAdapter {
|
||||
private final class MethodStubsFieldAdapter implements IListAdapter<IMethodStub> {
|
||||
|
||||
public void customButtonPressed(ListDialogField field, int index) {
|
||||
public void customButtonPressed(ListDialogField<IMethodStub> field, int index) {
|
||||
}
|
||||
|
||||
public void selectionChanged(ListDialogField field) {
|
||||
public void selectionChanged(ListDialogField<IMethodStub> field) {
|
||||
}
|
||||
|
||||
public void doubleClicked(ListDialogField field) {
|
||||
public void doubleClicked(ListDialogField<IMethodStub> field) {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -404,12 +404,12 @@ public abstract class ConvertProjectWizardPage
|
|||
|
||||
IWorkspace workspace = CUIPlugin.getWorkspace();
|
||||
IProject[] projects = workspace.getRoot().getProjects();
|
||||
Vector candidates = new Vector(projects.length);
|
||||
Vector<IProject> candidates = new Vector<IProject>(projects.length);
|
||||
IProject next = null;
|
||||
|
||||
// ensure we only present open, valid candidates to the user
|
||||
for (int i = 0; i < projects.length; i++) {
|
||||
next = projects[i];
|
||||
for (IProject project : projects) {
|
||||
next = project;
|
||||
|
||||
if ((next != null)
|
||||
&& next.isOpen()
|
||||
|
@ -448,7 +448,7 @@ public abstract class ConvertProjectWizardPage
|
|||
Object[] selection = getCheckedElements();
|
||||
int totalSelected = selection.length;
|
||||
|
||||
if ((selection != null) && (totalSelected > 0)) {
|
||||
if (totalSelected > 0) {
|
||||
if (monitor == null) {
|
||||
monitor = new NullProgressMonitor();
|
||||
}
|
||||
|
@ -462,14 +462,16 @@ public abstract class ConvertProjectWizardPage
|
|||
doRun(monitor, projectID);
|
||||
else {
|
||||
Object[] selection = getCheckedElements();
|
||||
int totalSelected = selection.length;
|
||||
|
||||
if ((selection != null) && (totalSelected > 0)) {
|
||||
if (monitor == null) {
|
||||
monitor = new NullProgressMonitor();
|
||||
}
|
||||
monitor.beginTask(CUIPlugin.getResourceString(KEY_TITLE), 1);
|
||||
convertProjects(selection, bsId, monitor);
|
||||
if (selection != null) {
|
||||
int totalSelected = selection.length;
|
||||
|
||||
if (totalSelected > 0) {
|
||||
if (monitor == null) {
|
||||
monitor = new NullProgressMonitor();
|
||||
}
|
||||
monitor.beginTask(CUIPlugin.getResourceString(KEY_TITLE), 1);
|
||||
convertProjects(selection, bsId, monitor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -488,8 +490,8 @@ public abstract class ConvertProjectWizardPage
|
|||
monitor.beginTask(CUIPlugin.getResourceString(KEY_CONVERTING),
|
||||
selected.length);
|
||||
try {
|
||||
for (int i = 0; i < selected.length; i++) {
|
||||
IProject project = (IProject)selected[i];
|
||||
for (Object element : selected) {
|
||||
IProject project = (IProject)element;
|
||||
convertProject(project, new SubProgressMonitor(monitor, 1), projectID);
|
||||
}
|
||||
} finally {
|
||||
|
@ -502,8 +504,8 @@ public abstract class ConvertProjectWizardPage
|
|||
monitor.beginTask(CUIPlugin.getResourceString(KEY_CONVERTING),
|
||||
selected.length);
|
||||
try {
|
||||
for (int i = 0; i < selected.length; i++) {
|
||||
IProject project = (IProject)selected[i];
|
||||
for (Object element : selected) {
|
||||
IProject project = (IProject)element;
|
||||
convertProject(project, bsId, new SubProgressMonitor(monitor, 1));
|
||||
}
|
||||
} finally {
|
||||
|
|
Loading…
Add table
Reference in a new issue