forked from eclipse-cdt/cdt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[eclipse-cdt#484] Add extension point for custom icons of C/C++ sourc…
…e files fixes eclipse-cdt#484
- Loading branch information
1 parent
d6c4e73
commit ab1b558
Showing
5 changed files
with
227 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<!-- Schema file written by PDE --> | ||
<schema targetNamespace="org.eclipse.cdt.ui" xmlns="http://www.w3.org/2001/XMLSchema"> | ||
<annotation> | ||
<appInfo> | ||
<meta.schema plugin="org.eclipse.cdt.ui" id="CFileImageProvider" name="Image Provider for C/C++ Source Files"/> | ||
</appInfo> | ||
<documentation> | ||
This extension point can be used to provide custom icons for C/C++ source files. | ||
</documentation> | ||
</annotation> | ||
|
||
<element name="extension"> | ||
<annotation> | ||
<appInfo> | ||
<meta.element /> | ||
</appInfo> | ||
</annotation> | ||
<complexType> | ||
<sequence> | ||
<element ref="imageDescriptor"/> | ||
</sequence> | ||
<attribute name="point" type="string" use="required"> | ||
<annotation> | ||
<documentation> | ||
|
||
</documentation> | ||
</annotation> | ||
</attribute> | ||
<attribute name="id" type="string"> | ||
<annotation> | ||
<documentation> | ||
|
||
</documentation> | ||
</annotation> | ||
</attribute> | ||
<attribute name="name" type="string"> | ||
<annotation> | ||
<documentation> | ||
|
||
</documentation> | ||
<appInfo> | ||
<meta.attribute translatable="true"/> | ||
</appInfo> | ||
</annotation> | ||
</attribute> | ||
</complexType> | ||
</element> | ||
|
||
<element name="imageDescriptor"> | ||
<complexType> | ||
<attribute name="class" type="string" use="required"> | ||
<annotation> | ||
<documentation> | ||
Class which implements ICFileImageDescriptor interface. | ||
</documentation> | ||
<appInfo> | ||
<meta.attribute kind="java" basedOn=":org.eclipse.cdt.ui.ICFileImageDescriptor"/> | ||
</appInfo> | ||
</annotation> | ||
</attribute> | ||
</complexType> | ||
</element> | ||
|
||
<annotation> | ||
<appInfo> | ||
<meta.section type="since"/> | ||
</appInfo> | ||
<documentation> | ||
[Enter the first release in which this extension point appears.] | ||
</documentation> | ||
</annotation> | ||
|
||
<annotation> | ||
<appInfo> | ||
<meta.section type="examples"/> | ||
</appInfo> | ||
<documentation> | ||
[Enter extension point usage example here.] | ||
</documentation> | ||
</annotation> | ||
|
||
<annotation> | ||
<appInfo> | ||
<meta.section type="apiinfo"/> | ||
</appInfo> | ||
<documentation> | ||
[Enter API information here.] | ||
</documentation> | ||
</annotation> | ||
|
||
<annotation> | ||
<appInfo> | ||
<meta.section type="implementation"/> | ||
</appInfo> | ||
<documentation> | ||
[Enter information about supplied implementation of this extension point.] | ||
</documentation> | ||
</annotation> | ||
|
||
|
||
</schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...lipse.cdt.ui/src/org/eclipse/cdt/internal/ui/viewsupport/DefaultCFileImageDescriptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.eclipse.cdt.internal.ui.viewsupport; | ||
|
||
import org.eclipse.cdt.ui.CDTSharedImages; | ||
import org.eclipse.cdt.ui.CUIPlugin; | ||
import org.eclipse.cdt.ui.ICFileImageDescriptor; | ||
import org.eclipse.cdt.ui.SharedImagesFactory; | ||
import org.eclipse.core.resources.IProject; | ||
import org.eclipse.jface.resource.ImageDescriptor; | ||
|
||
public class DefaultCFileImageDescriptor implements ICFileImageDescriptor { | ||
private SharedImagesFactory imagesFactory = new SharedImagesFactory(CUIPlugin.getDefault()); | ||
|
||
@Override | ||
public ImageDescriptor getCImageDescriptor() { | ||
return imagesFactory.getImageDescriptor(CDTSharedImages.IMG_OBJS_TUNIT); | ||
} | ||
|
||
@Override | ||
public ImageDescriptor getCXXImageDescriptor() { | ||
return imagesFactory.getImageDescriptor(CDTSharedImages.IMG_OBJS_TUNIT); | ||
} | ||
|
||
@Override | ||
public ImageDescriptor getHeaderImageDescriptor() { | ||
return imagesFactory.getImageDescriptor(CDTSharedImages.IMG_OBJS_TUNIT_HEADER); | ||
} | ||
|
||
@Override | ||
public boolean isEnabled(IProject project) { | ||
return true; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/ICFileImageDescriptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.eclipse.cdt.ui; | ||
|
||
import org.eclipse.core.resources.IProject; | ||
import org.eclipse.jface.resource.ImageDescriptor; | ||
|
||
/** | ||
* C Image Descriptor Provider | ||
* @since 8.1 | ||
*/ | ||
public interface ICFileImageDescriptor { | ||
|
||
/** | ||
* @return ImageDescriptor for a C source file | ||
*/ | ||
public ImageDescriptor getCImageDescriptor(); | ||
|
||
/** | ||
* @return ImageDescriptor for a C++ source file | ||
*/ | ||
public ImageDescriptor getCXXImageDescriptor(); | ||
|
||
/** | ||
* @return ImageDescriptor for a C/C++ header file | ||
*/ | ||
public ImageDescriptor getHeaderImageDescriptor(); | ||
|
||
/** | ||
* Checks whether the descriptor can be used for the given project. | ||
* @param project | ||
* @return true if the descriptor can be used for the given project. | ||
*/ | ||
public boolean isEnabled(IProject project); | ||
|
||
} |