mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +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
|
2004-04-23 Hoda Amer
|
||||||
Fix for bug#Bug 59618 : [Refactoring] Be able to append refactor action group after my own group
|
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
|
2004-04-23 Alain Magloire
|
||||||
Possible NPE.
|
Possible NPE.
|
||||||
* src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java
|
* src/org/eclipse/cdt/internal/ui/editor/CDocumentProvider.java
|
||||||
|
|
|
@ -127,14 +127,8 @@ public class TypeInfoLabelProvider extends LabelProvider {
|
||||||
public static Image getFileIcon(IPath path)
|
public static Image getFileIcon(IPath path)
|
||||||
{
|
{
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
String ext= path.getFileExtension();
|
if (CoreModel.isValidHeaderUnitName(path.lastSegment())) {
|
||||||
if (ext != null) {
|
return HEADER_ICON;
|
||||||
String[] exts = CoreModel.getDefault().getHeaderExtensions();
|
|
||||||
for (int i = 0; i < exts.length; i++) {
|
|
||||||
if (exts[i].equalsIgnoreCase(ext)) {
|
|
||||||
return HEADER_ICON;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SOURCE_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.IMethodDeclaration;
|
||||||
import org.eclipse.cdt.core.model.ISourceRoot;
|
import org.eclipse.cdt.core.model.ISourceRoot;
|
||||||
import org.eclipse.cdt.core.model.ITemplate;
|
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.core.parser.ast.ASTAccessVisibility;
|
||||||
import org.eclipse.cdt.internal.ui.util.ImageDescriptorRegistry;
|
import org.eclipse.cdt.internal.ui.util.ImageDescriptorRegistry;
|
||||||
import org.eclipse.cdt.ui.CElementImageDescriptor;
|
import org.eclipse.cdt.ui.CElementImageDescriptor;
|
||||||
|
@ -106,8 +107,7 @@ public class CElementImageProvider {
|
||||||
} else if (element instanceof IFile) {
|
} else if (element instanceof IFile) {
|
||||||
// Check for Non Translation Unit.
|
// Check for Non Translation Unit.
|
||||||
IFile file = (IFile)element;
|
IFile file = (IFile)element;
|
||||||
CoreModel model = CoreModel.getDefault();
|
if (CoreModel.isTranslationUnit(file)) {
|
||||||
if (model.isTranslationUnit(file)) {
|
|
||||||
descriptor = CPluginImages.DESC_OBJS_TUNIT_RESOURCE;
|
descriptor = CPluginImages.DESC_OBJS_TUNIT_RESOURCE;
|
||||||
Point size= useSmallSize(flags) ? SMALL_SIZE : BIG_SIZE;
|
Point size= useSmallSize(flags) ? SMALL_SIZE : BIG_SIZE;
|
||||||
descriptor = new CElementImageDescriptor(descriptor, 0, size);
|
descriptor = new CElementImageDescriptor(descriptor, 0, size);
|
||||||
|
@ -280,23 +280,17 @@ public class CElementImageProvider {
|
||||||
case ICElement.C_ARCHIVE:
|
case ICElement.C_ARCHIVE:
|
||||||
return CPluginImages.DESC_OBJS_ARCHIVE;
|
return CPluginImages.DESC_OBJS_ARCHIVE;
|
||||||
|
|
||||||
case ICElement.C_UNIT:
|
case ICElement.C_UNIT: {
|
||||||
String ext = celement.getPath().getFileExtension();
|
ITranslationUnit unit = (ITranslationUnit)celement;
|
||||||
if (ext != null) {
|
if (unit.isHeaderUnit()) {
|
||||||
String[] exts = CoreModel.getDefault().getHeaderExtensions();
|
return CPluginImages.DESC_OBJS_TUNIT_HEADER;
|
||||||
for (int i = 0; i < exts.length; i++) {
|
} else if (unit.isSourceUnit()) {
|
||||||
if (exts[i].equalsIgnoreCase(ext)) {
|
if (unit.isASMLanguage()) {
|
||||||
return CPluginImages.DESC_OBJS_TUNIT_HEADER;
|
return CPluginImages.DESC_OBJS_TUNIT_ASM;
|
||||||
}
|
|
||||||
}
|
|
||||||
exts = CoreModel.getDefault().getAssemblyExtensions();
|
|
||||||
for (int i = 0; i < exts.length; i++) {
|
|
||||||
if (exts[i].equalsIgnoreCase(ext)) {
|
|
||||||
return CPluginImages.DESC_OBJS_TUNIT_ASM;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return CPluginImages.DESC_OBJS_TUNIT;
|
return CPluginImages.DESC_OBJS_TUNIT;
|
||||||
|
}
|
||||||
|
|
||||||
case ICElement.C_CCONTAINER:
|
case ICElement.C_CCONTAINER:
|
||||||
if (celement instanceof ISourceRoot) {
|
if (celement instanceof ISourceRoot) {
|
||||||
|
|
|
@ -83,9 +83,10 @@ public class FileSearchAction extends Action {
|
||||||
TextSearchScope scope= TextSearchScope.newWorkspaceScope();
|
TextSearchScope scope= TextSearchScope.newWorkspaceScope();
|
||||||
// Add the extensions from the C editor definition for now
|
// 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>
|
// FIXME: For C/C++ not all files rely on extension to be C++ for <cstring>
|
||||||
String[] cexts = CoreModel.getDefault().getTranslationUnitExtensions();
|
String[] patterns = CoreModel.getDefault().getTranslationUnitExtensions();
|
||||||
for (int i = 0; i < cexts.length; i++) {
|
for (int i = 0; i < patterns.length; i++) {
|
||||||
scope.addExtension("*." + cexts[i]); //$NON-NLS-1$
|
//scope.addExtension("*." + cexts[i]); //$NON-NLS-1$
|
||||||
|
scope.addExtension(patterns[i]);
|
||||||
}
|
}
|
||||||
// scope.addExtension("*.c");
|
// scope.addExtension("*.c");
|
||||||
// scope.addExtension("*.h");
|
// scope.addExtension("*.h");
|
||||||
|
|
Loading…
Add table
Reference in a new issue