mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-30 21:55:31 +02:00
Adjusting the UI to changes of the core
Concerning customization of translation Unit pathc from Sam PR 52864
This commit is contained in:
parent
be4fd43913
commit
2be2d0afed
4 changed files with 26 additions and 27 deletions
|
@ -1,6 +1,16 @@
|
|||
2004-04-23 Hoda Amer
|
||||
Fix for bug#Bug 59618 : [Refactoring] Be able to append refactor action group after my own group
|
||||
|
||||
2004-04-23 Alain Magloire
|
||||
|
||||
Adjusting the UI to changes of the core
|
||||
Concerning customization of translation Unit
|
||||
pathc from Sam PR 52864
|
||||
|
||||
* browser/org/eclipse/cdt/ui/browser/typeinfo/TypeInfoLableProvider.java
|
||||
* src/org/eclipse/cdt/internal/ui/CElementImageProvider.java
|
||||
* src/org/eclipse/cdt/internal/ui/edito/FileSearchAction.java
|
||||
|
||||
2004-04-23 Alain Magloire
|
||||
Possible NPE.
|
||||
* src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java
|
||||
|
|
|
@ -127,14 +127,8 @@ public class TypeInfoLabelProvider extends LabelProvider {
|
|||
public static Image getFileIcon(IPath path)
|
||||
{
|
||||
if (path != null) {
|
||||
String ext= path.getFileExtension();
|
||||
if (ext != null) {
|
||||
String[] exts = CoreModel.getDefault().getHeaderExtensions();
|
||||
for (int i = 0; i < exts.length; i++) {
|
||||
if (exts[i].equalsIgnoreCase(ext)) {
|
||||
return HEADER_ICON;
|
||||
}
|
||||
}
|
||||
if (CoreModel.isValidHeaderUnitName(path.lastSegment())) {
|
||||
return HEADER_ICON;
|
||||
}
|
||||
}
|
||||
return SOURCE_ICON;
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.core.model.IIncludeReference;
|
|||
import org.eclipse.cdt.core.model.IMethodDeclaration;
|
||||
import org.eclipse.cdt.core.model.ISourceRoot;
|
||||
import org.eclipse.cdt.core.model.ITemplate;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||
import org.eclipse.cdt.internal.ui.util.ImageDescriptorRegistry;
|
||||
import org.eclipse.cdt.ui.CElementImageDescriptor;
|
||||
|
@ -106,8 +107,7 @@ public class CElementImageProvider {
|
|||
} else if (element instanceof IFile) {
|
||||
// Check for Non Translation Unit.
|
||||
IFile file = (IFile)element;
|
||||
CoreModel model = CoreModel.getDefault();
|
||||
if (model.isTranslationUnit(file)) {
|
||||
if (CoreModel.isTranslationUnit(file)) {
|
||||
descriptor = CPluginImages.DESC_OBJS_TUNIT_RESOURCE;
|
||||
Point size= useSmallSize(flags) ? SMALL_SIZE : BIG_SIZE;
|
||||
descriptor = new CElementImageDescriptor(descriptor, 0, size);
|
||||
|
@ -280,23 +280,17 @@ public class CElementImageProvider {
|
|||
case ICElement.C_ARCHIVE:
|
||||
return CPluginImages.DESC_OBJS_ARCHIVE;
|
||||
|
||||
case ICElement.C_UNIT:
|
||||
String ext = celement.getPath().getFileExtension();
|
||||
if (ext != null) {
|
||||
String[] exts = CoreModel.getDefault().getHeaderExtensions();
|
||||
for (int i = 0; i < exts.length; i++) {
|
||||
if (exts[i].equalsIgnoreCase(ext)) {
|
||||
return CPluginImages.DESC_OBJS_TUNIT_HEADER;
|
||||
}
|
||||
}
|
||||
exts = CoreModel.getDefault().getAssemblyExtensions();
|
||||
for (int i = 0; i < exts.length; i++) {
|
||||
if (exts[i].equalsIgnoreCase(ext)) {
|
||||
return CPluginImages.DESC_OBJS_TUNIT_ASM;
|
||||
}
|
||||
case ICElement.C_UNIT: {
|
||||
ITranslationUnit unit = (ITranslationUnit)celement;
|
||||
if (unit.isHeaderUnit()) {
|
||||
return CPluginImages.DESC_OBJS_TUNIT_HEADER;
|
||||
} else if (unit.isSourceUnit()) {
|
||||
if (unit.isASMLanguage()) {
|
||||
return CPluginImages.DESC_OBJS_TUNIT_ASM;
|
||||
}
|
||||
}
|
||||
return CPluginImages.DESC_OBJS_TUNIT;
|
||||
}
|
||||
|
||||
case ICElement.C_CCONTAINER:
|
||||
if (celement instanceof ISourceRoot) {
|
||||
|
|
|
@ -83,9 +83,10 @@ public class FileSearchAction extends Action {
|
|||
TextSearchScope scope= TextSearchScope.newWorkspaceScope();
|
||||
// Add the extensions from the C editor definition for now
|
||||
// FIXME: For C/C++ not all files rely on extension to be C++ for <cstring>
|
||||
String[] cexts = CoreModel.getDefault().getTranslationUnitExtensions();
|
||||
for (int i = 0; i < cexts.length; i++) {
|
||||
scope.addExtension("*." + cexts[i]); //$NON-NLS-1$
|
||||
String[] patterns = CoreModel.getDefault().getTranslationUnitExtensions();
|
||||
for (int i = 0; i < patterns.length; i++) {
|
||||
//scope.addExtension("*." + cexts[i]); //$NON-NLS-1$
|
||||
scope.addExtension(patterns[i]);
|
||||
}
|
||||
// scope.addExtension("*.c");
|
||||
// scope.addExtension("*.h");
|
||||
|
|
Loading…
Add table
Reference in a new issue