本文整理汇总了Java中com.intellij.ide.projectView.PresentationData.clearText方法的典型用法代码示例。如果您正苦于以下问题:Java PresentationData.clearText方法的具体用法?Java PresentationData.clearText怎么用?Java PresentationData.clearText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ide.projectView.PresentationData
的用法示例。
在下文中一共展示了PresentationData.clearText方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decorate
import com.intellij.ide.projectView.PresentationData; //导入方法依赖的package包/类
@Override
public void decorate(ProjectViewNode node, PresentationData data) {
if (!(node instanceof ClassTreeNode)) {
return;
}
PsiClass psiClass = ((ClassTreeNode) node).getPsiClass();
if (psiClass == null) {
return;
}
PsiFile psiFile = psiClass.getContainingFile();
if (psiFile == null) {
return;
}
VirtualFile virtualFile = psiFile.getVirtualFile();
if (virtualFile == null) {
return;
}
Project project = node.getProject();
if (SyncStatusHelper.isUnsynced(project, virtualFile)) {
data.clearText();
data.addText(psiClass.getName(), SimpleTextAttributes.GRAY_ATTRIBUTES);
data.addText(" (unsynced)", SimpleTextAttributes.GRAY_ATTRIBUTES);
}
}
示例2: decorate
import com.intellij.ide.projectView.PresentationData; //导入方法依赖的package包/类
@Override
public void decorate(ProjectViewNode node, PresentationData data) {
if (!(node instanceof PsiFileNode)) {
return;
}
PsiFile psiFile = ((PsiFileNode) node).getValue();
if (!(psiFile instanceof OCFile)) {
return;
}
VirtualFile virtualFile = psiFile.getVirtualFile();
if (virtualFile == null) {
return;
}
Project project = node.getProject();
if (SyncStatusHelper.isUnsynced(project, virtualFile)) {
data.clearText();
data.addText(psiFile.getName(), SimpleTextAttributes.GRAY_ATTRIBUTES);
data.addText(" (unsynced)", SimpleTextAttributes.GRAY_ATTRIBUTES);
}
}
示例3: updatePresentation
import com.intellij.ide.projectView.PresentationData; //导入方法依赖的package包/类
protected static void updatePresentation(PresentationData data, String name, JBColor color, Icon icon, @Nullable String additionalInfo) {
data.clearText();
data.addText(name, new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, color));
if (additionalInfo != null) {
data.addText(" (" + additionalInfo + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
}
data.setIcon(icon);
}
示例4: updateImpl
import com.intellij.ide.projectView.PresentationData; //导入方法依赖的package包/类
@Override
protected void updateImpl(PresentationData data) {
String valueName = myValue.getName();
final CCProjectService service = CCProjectService.getInstance(myProject);
final Course course = service.getCourse();
if (course == null) return;
if (myProject.getBaseDir().equals(myValue.getVirtualFile())) {
data.clearText();
data.setIcon(EducationalIcons.Course);
data.addText(course.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
data.addText(" (" + valueName + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
return;
}
final Lesson lesson = course.getLesson(valueName);
if (lesson != null) {
data.clearText();
data.setIcon(EducationalIcons.Lesson);
data.addText(lesson.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
return;
}
else {
final PsiDirectory parentDir = myValue.getParentDirectory();
if (parentDir != null) {
final Lesson parentLesson = course.getLesson(parentDir.getName());
if (parentLesson != null) {
final Task task = parentLesson.getTask(valueName);
if (task != null) {
data.clearText();
data.setIcon(EducationalIcons.Task);
data.addText(task.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
return;
}
}
}
}
data.setPresentableText(valueName);
}
示例5: update
import com.intellij.ide.projectView.PresentationData; //导入方法依赖的package包/类
@Override
protected void update(PresentationData presentation) {
presentation.clearText();
presentation.addText(getValue().getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
presentation.setPresentableText(getValue().getName());
presentation.setIcon(getValue().getIcon(0));
}
示例6: updateImpl
import com.intellij.ide.projectView.PresentationData; //导入方法依赖的package包/类
@Override
protected void updateImpl(PresentationData data) {
super.updateImpl(data);
data.clearText();
data.addText(myName, SimpleTextAttributes.GRAY_ATTRIBUTES);
}
示例7: updateImpl
import com.intellij.ide.projectView.PresentationData; //导入方法依赖的package包/类
@Override
protected void updateImpl(PresentationData data) {
String valueName = myValue.getName();
StudyTaskManager studyTaskManager = StudyTaskManager.getInstance(myProject);
Course course = studyTaskManager.getCourse();
if (course == null || valueName == null) {
return;
}
if (valueName.equals(myProject.getName())) {
data.clearText();
data.setIcon(EducationalIcons.Course);
data.addText(course.getName(), new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, JBColor.BLACK));
}
else if (valueName.contains(EduNames.TASK)) {
TaskFile file = null;
for (PsiElement child : myValue.getChildren()) {
VirtualFile virtualFile = child instanceof PsiDirectory ? ((PsiDirectory)child).getVirtualFile() :
child.getContainingFile().getVirtualFile();
file = StudyUtils.getTaskFile(myProject, virtualFile);
if (file != null) {
break;
}
}
if (file != null) {
Task task = file.getTask();
setStudyAttributes(task, data, task.getName());
}
}
else if (valueName.contains(EduNames.LESSON)) {
int lessonIndex = Integer.parseInt(valueName.substring(EduNames.LESSON.length())) - 1;
Lesson lesson = course.getLessons().get(lessonIndex);
setStudyAttributes(lesson, data, lesson.getName());
data.setPresentableText(valueName);
}
else if (valueName.contains(EduNames.SANDBOX_DIR)) {
if (myValue.getParent() != null) {
final String parentName = myValue.getParent().getName();
if (parentName!= null && !parentName.contains(EduNames.SANDBOX_DIR)) {
data.setPresentableText(EduNames.SANDBOX_DIR);
data.setIcon(InteractiveLearningIcons.Sandbox);
}
}
}
data.setPresentableText(valueName);
}
示例8: updatePresentation
import com.intellij.ide.projectView.PresentationData; //导入方法依赖的package包/类
protected static void updatePresentation(PresentationData data, String additionalName, JBColor color, Icon icon) {
data.clearText();
data.addText(additionalName, new SimpleTextAttributes(Font.PLAIN, color));
data.setIcon(icon);
}
示例9: decorate
import com.intellij.ide.projectView.PresentationData; //导入方法依赖的package包/类
@Override
public void decorate(ProjectViewNode node, PresentationData data) {
if (!(node instanceof PsiDirectoryNode)) {
return;
}
final PsiDirectoryNode psiDirectoryNode = (PsiDirectoryNode)node;
PsiDirectory directory = psiDirectoryNode.getValue();
if (directory == null || !directory.isValid()) {
return;
}
final Project project = directory.getProject();
if (!ProjectFacetManager.getInstance(project).hasFacets(AndroidFacet.ID)) {
return;
}
// If the build dir is inside the module's content root, ProjectRootsUtil.isModuleContentRoot will return false. The reason is that when
// we set up the project during a sync, we don't create additional content roots if the build dir is inside the module.
final VirtualFile folder = directory.getVirtualFile();
if (!ProjectRootsUtil.isModuleContentRoot(folder, project)) {
return;
}
Object parentValue = psiDirectoryNode.getParent().getValue();
if (!(parentValue instanceof Module)) {
return;
}
Module module = ProjectRootManager.getInstance(project).getFileIndex().getModuleForFile(folder);
if (module == null) {
return;
}
AndroidProject androidProject = GradleUtil.getAndroidProject(module);
if (androidProject == null) {
return;
}
File buildFolderPath = androidProject.getBuildFolder();
File folderPath = VfsUtilCore.virtualToIoFile(folder);
if (FileUtil.filesEqual(buildFolderPath, folderPath)) {
data.clearText();
data.addText(folder.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
}