1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 22:22:11 +02:00

Fixes a few problems related to bug 260830.

This commit is contained in:
Markus Schorn 2009-02-04 11:45:22 +00:00
parent f06ecc89b6
commit f6b84f948e
7 changed files with 45 additions and 12 deletions

View file

@ -15,7 +15,6 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICModelStatus; import org.eclipse.cdt.core.model.ICModelStatus;
import org.eclipse.cdt.core.model.ICModelStatusConstants; import org.eclipse.cdt.core.model.ICModelStatusConstants;
import org.eclipse.core.resources.IResourceStatus;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
@ -26,7 +25,7 @@ import org.eclipse.core.runtime.Status;
* @see ICModelStatus * @see ICModelStatus
*/ */
public class CModelStatus extends Status implements ICModelStatus, ICModelStatusConstants, IResourceStatus { public class CModelStatus extends Status implements ICModelStatus, ICModelStatusConstants {
/** /**
* The elements related to the failure, or <code>null</code> if no * The elements related to the failure, or <code>null</code> if no

View file

@ -0,0 +1,19 @@
/*******************************************************************************
* Copyright (c) 2009 Wind River Systems, Inc. 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:
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.parser;
/**
* Abstract class for implementing {@link IPersistableProblem}.
* @since 5.1
*/
public abstract class AbstractPersistableProblem implements IPersistableProblem {
}

View file

@ -10,6 +10,10 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.parser; package org.eclipse.cdt.core.parser;
/**
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IPersistableProblem extends IProblem { public interface IPersistableProblem extends IProblem {
/** /**
* Returns the marker type associated to this problem, if it gets persisted into a marker. * Returns the marker type associated to this problem, if it gets persisted into a marker.

View file

@ -18,7 +18,6 @@ import java.util.ListIterator;
/** /**
* Useful utility methods for dealing with Collections. * Useful utility methods for dealing with Collections.
* *
* @noextend This interface is not intended to be extended by clients.
* @noinstantiate This class is not intended to be instantiated by clients. * @noinstantiate This class is not intended to be instantiated by clients.
*/ */
public final class CollectionUtils { public final class CollectionUtils {

View file

@ -16,12 +16,12 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.IRegion;
import org.eclipse.osgi.util.NLS; import org.eclipse.osgi.util.NLS;
import org.eclipse.cdt.core.parser.IPersistableProblem; import org.eclipse.cdt.core.parser.AbstractPersistableProblem;
/** /**
* Spelling problem to be accepted by problem requesters. * Spelling problem to be accepted by problem requesters.
*/ */
public class CoreSpellingProblem implements IPersistableProblem { public class CoreSpellingProblem extends AbstractPersistableProblem {
// spelling 'marker type' name. Only virtual as spelling problems are never persisted in markers. // spelling 'marker type' name. Only virtual as spelling problems are never persisted in markers.
// marker type is used in the quickFixProcessor extension point // marker type is used in the quickFixProcessor extension point
public static final String MARKER_TYPE= "org.eclipse.cdt.internal.spelling"; //$NON-NLS-1$ public static final String MARKER_TYPE= "org.eclipse.cdt.internal.spelling"; //$NON-NLS-1$

View file

@ -36,7 +36,6 @@ import org.eclipse.text.edits.TextEdit;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.browser.IQualifiedTypeName; import org.eclipse.cdt.core.browser.IQualifiedTypeName;
import org.eclipse.cdt.core.browser.ITypeReference; import org.eclipse.cdt.core.browser.ITypeReference;
import org.eclipse.cdt.core.browser.PathUtil;
import org.eclipse.cdt.core.browser.QualifiedTypeName; import org.eclipse.cdt.core.browser.QualifiedTypeName;
import org.eclipse.cdt.core.formatter.CodeFormatter; import org.eclipse.cdt.core.formatter.CodeFormatter;
import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CModelException;
@ -53,6 +52,7 @@ import org.eclipse.cdt.core.parser.IScannerInfoProvider;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.CodeGeneration; import org.eclipse.cdt.ui.CodeGeneration;
import org.eclipse.cdt.utils.PathUtil;
import org.eclipse.cdt.internal.corext.codemanipulation.StubUtility; import org.eclipse.cdt.internal.corext.codemanipulation.StubUtility;
import org.eclipse.cdt.internal.corext.util.CModelUtil; import org.eclipse.cdt.internal.corext.util.CModelUtil;
@ -607,7 +607,7 @@ public class NewClassCodeGenerator {
if (cProject.getPath().segment(0).equals(folderToAdd.segment(0))) if (cProject.getPath().segment(0).equals(folderToAdd.segment(0)))
continue; continue;
ICProject includeProject = PathUtil.getEnclosingProject(folderToAdd); ICProject includeProject = toCProject(PathUtil.getEnclosingProject(folderToAdd));
if (includeProject != null) { if (includeProject != null) {
// make sure that the include is made the same way that build properties for projects makes them, so .contains below is a valid check // make sure that the include is made the same way that build properties for projects makes them, so .contains below is a valid check
IIncludeEntry entry = CoreModel.newIncludeEntry(addToResourcePath, null, includeProject.getProject().getLocation(), true); IIncludeEntry entry = CoreModel.newIncludeEntry(addToResourcePath, null, includeProject.getProject().getLocation(), true);
@ -624,6 +624,12 @@ public class NewClassCodeGenerator {
monitor.done(); monitor.done();
} }
private ICProject toCProject(IProject enclosingProject) {
if (enclosingProject != null)
return CoreModel.getDefault().create(enclosingProject);
return null;
}
private List<IPath> getMissingIncludePaths(IPath projectLocation, List<IPath> includePaths, List<IPath> baseClassPaths) { private List<IPath> getMissingIncludePaths(IPath projectLocation, List<IPath> includePaths, List<IPath> baseClassPaths) {
// check for missing include paths // check for missing include paths
List<IPath> newIncludePaths = new ArrayList<IPath>(); List<IPath> newIncludePaths = new ArrayList<IPath>();

View file

@ -55,7 +55,6 @@ import org.eclipse.cdt.core.browser.AllTypesCache;
import org.eclipse.cdt.core.browser.IQualifiedTypeName; import org.eclipse.cdt.core.browser.IQualifiedTypeName;
import org.eclipse.cdt.core.browser.ITypeInfo; import org.eclipse.cdt.core.browser.ITypeInfo;
import org.eclipse.cdt.core.browser.ITypeSearchScope; import org.eclipse.cdt.core.browser.ITypeSearchScope;
import org.eclipse.cdt.core.browser.PathUtil;
import org.eclipse.cdt.core.browser.QualifiedTypeName; import org.eclipse.cdt.core.browser.QualifiedTypeName;
import org.eclipse.cdt.core.browser.TypeSearchScope; import org.eclipse.cdt.core.browser.TypeSearchScope;
import org.eclipse.cdt.core.browser.TypeUtil; import org.eclipse.cdt.core.browser.TypeUtil;
@ -71,6 +70,7 @@ import org.eclipse.cdt.core.parser.IScannerInfo;
import org.eclipse.cdt.core.parser.IScannerInfoProvider; import org.eclipse.cdt.core.parser.IScannerInfoProvider;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.utils.PathUtil;
import org.eclipse.cdt.internal.ui.dialogs.StatusInfo; import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
import org.eclipse.cdt.internal.ui.dialogs.StatusUtil; import org.eclipse.cdt.internal.ui.dialogs.StatusUtil;
@ -592,11 +592,17 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
protected ICProject getCurrentProject() { protected ICProject getCurrentProject() {
IPath folderPath = getSourceFolderFullPath(); IPath folderPath = getSourceFolderFullPath();
if (folderPath != null) { if (folderPath != null) {
return PathUtil.getEnclosingProject(folderPath); return toCProject(PathUtil.getEnclosingProject(folderPath));
} }
return null; return null;
} }
private ICProject toCProject(IProject enclosingProject) {
if (enclosingProject != null)
return CoreModel.getDefault().create(enclosingProject);
return null;
}
/** /**
* Returns the text entered into the namespace input field. * Returns the text entered into the namespace input field.
* *
@ -1033,9 +1039,9 @@ public class NewClassCreationWizardPage extends NewElementWizardPage {
if (folder != null) { if (folder != null) {
return folder.getPath(); return folder.getPath();
} }
ICProject proj = PathUtil.getEnclosingProject(filePath); IProject proj = PathUtil.getEnclosingProject(filePath);
if (proj != null) if (proj != null)
return proj.getProject().getFullPath(); return proj.getFullPath();
return null; return null;
} }