本文整理匯總了Java中com.intellij.openapi.actionSystem.Presentation.setEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java Presentation.setEnabled方法的具體用法?Java Presentation.setEnabled怎麽用?Java Presentation.setEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.actionSystem.Presentation
的用法示例。
在下文中一共展示了Presentation.setEnabled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: update
import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
@Override
public void update(AnActionEvent e) {
StudyUtils.updateAction(e);
final Project project = e.getProject();
if (project != null) {
Course course = StudyTaskManager.getInstance(project).getCourse();
Presentation presentation = e.getPresentation();
if (course != null && !EduNames.STUDY.equals(course.getCourseMode())) {
presentation.setEnabled(false);
presentation.setVisible(true);
return;
}
StudyEditor studyEditor = StudyUtils.getSelectedStudyEditor(project);
StudyState studyState = new StudyState(studyEditor);
if (!studyState.isValid()) {
presentation.setEnabledAndVisible(false);
return;
}
TaskFile taskFile = studyState.getTaskFile();
if (taskFile.getActivePlaceholders().isEmpty()) {
presentation.setEnabledAndVisible(false);
}
}
}
示例2: update
import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
public void update(AnActionEvent event){
Presentation presentation = event.getPresentation();
final EditorWindow editorWindow = event.getData(EditorWindow.DATA_KEY);
if (editorWindow != null && editorWindow.inSplitter()) {
presentation.setText(IdeBundle.message("action.close.all.editors.in.tab.group"));
}
else {
presentation.setText(IdeBundle.message("action.close.all.editors"));
}
Project project = event.getData(CommonDataKeys.PROJECT);
if (project == null) {
presentation.setEnabled(false);
return;
}
presentation.setEnabled(FileEditorManager.getInstance(project).getSelectedFiles().length > 0);
}
示例3: update
import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
@Override
public void update(AnActionEvent e) {
super.update(e);
final Presentation presentation = e.getPresentation();
if(presentation.isEnabled()) {
final IdeView view = e.getData(LangDataKeys.IDE_VIEW);
final Project project = e.getProject();
if (view != null && project != null) {
ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
PsiDirectory[] dirs = view.getDirectories();
for (PsiDirectory dir : dirs) {
if (projectFileIndex.isUnderSourceRootOfType(dir.getVirtualFile(), JavaModuleSourceRootTypes.SOURCES) &&
JavaDirectoryService.getInstance().getPackage(dir) != null && isValidForClass(project,dir)) {
return;
}
}
}
presentation.setEnabled(false);
presentation.setVisible(false);
}
}
示例4: update
import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
public void update(AnActionEvent e) {
DebuggerTreeNodeImpl[] selectedNodes = getSelectedNodes(e.getDataContext());
boolean visible = false;
boolean enabled = false;
String text = DebuggerBundle.message("action.resume.thread.text.resume");
if(selectedNodes != null && selectedNodes.length > 0){
visible = true;
enabled = true;
for (DebuggerTreeNodeImpl selectedNode : selectedNodes) {
final NodeDescriptorImpl threadDescriptor = selectedNode.getDescriptor();
if (!(threadDescriptor instanceof ThreadDescriptorImpl) || !((ThreadDescriptorImpl)threadDescriptor).isSuspended()) {
visible = false;
break;
}
}
}
final Presentation presentation = e.getPresentation();
presentation.setText(text);
presentation.setVisible(visible);
presentation.setEnabled(enabled);
}
示例5: update
import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
@Override
public void update(final AnActionEvent event) {
Presentation presentation = event.getPresentation();
boolean hidden = isHidden(event);
if (hidden) {
presentation.setEnabledAndVisible(false);
return;
}
boolean enabled = isEnabled(event);
if (myHideDisabledInPopup && ActionPlaces.isPopupPlace(event.getPlace())) {
presentation.setVisible(enabled);
}
else {
presentation.setVisible(true);
}
presentation.setEnabled(enabled);
}
示例6: update
import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
@Override
public void update(AnActionEvent e) {
final List<VirtualFile> modules = getModuleNames(e);
final Presentation presentation = e.getPresentation();
final boolean visible = !modules.isEmpty();
presentation.setVisible(visible);
presentation.setEnabled(visible);
String text;
if (modules.size() > 1) {
text = "Import " + modules.size() + " Modules";
}
else if (modules.size() == 1) {
text = "Import '" + modules.get(0).getNameWithoutExtension() + "' Module";
}
else {
text = getTemplatePresentation().getText();
}
presentation.setText(text);
}
示例7: update
import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
public void update(AnActionEvent var1) {
Presentation var2 = var1.getPresentation();
DataContext var3 = var1.getDataContext();
CopyProvider var4 = (CopyProvider) PlatformDataKeys.COPY_PROVIDER.getData(var3);
boolean var5 = var4 != null && var4.isCopyEnabled(var3) && var4.isCopyVisible(var3);
var2.setEnabled(var5);
var2.setVisible(var5);
}
示例8: update
import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
/**
* Disables this action if no editor is currently opened.
*
* @param event the performed action
*/
@Override
public final void update(final AnActionEvent event) {
final Presentation presentation = event.getPresentation();
final Editor editor = event.getData(CommonDataKeys.EDITOR);
presentation.setText(getName());
presentation.setEnabled(editor != null);
}
示例9: updateAction
import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
public static void updateAction(@NotNull final AnActionEvent e) {
final Presentation presentation = e.getPresentation();
presentation.setEnabled(false);
final Project project = e.getProject();
if (project != null) {
final StudyEditor studyEditor = getSelectedStudyEditor(project);
if (studyEditor != null) {
presentation.setEnabledAndVisible(true);
}
}
}
示例10: update
import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
@Override
public void update(AnActionEvent e) {
final Presentation presentation = e.getPresentation();
StudyUtils.updateAction(e);
if (presentation.isEnabled()) {
updateDescription(e);
presentation.setEnabled(!myCheckInProgress.get());
}
}
示例11: update
import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
@Override
public void update(AnActionEvent event) {
StudyUtils.updateAction(event);
final Project project = event.getProject();
if (project != null) {
StudyEditor studyEditor = StudyUtils.getSelectedStudyEditor(project);
StudyState studyState = new StudyState(studyEditor);
Presentation presentation = event.getPresentation();
if (!studyState.isValid()) {
presentation.setEnabled(false);
return;
}
Course course = StudyTaskManager.getInstance(project).getCourse();
if (course == null) {
return;
}
Task task = StudyUtils.getCurrentTask(project);
if (task == null) {
return;
}
presentation.setText(task instanceof PyCharmTask ? TEXT : RESET_TASK);
if (!EduNames.STUDY.equals(course.getCourseMode())) {
presentation.setVisible(true);
presentation.setEnabled(false);
}
}
}
示例12: update
import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
@Override
public void update(@NotNull AnActionEvent event) {
final Presentation presentation = event.getPresentation();
presentation.setEnabledAndVisible(false);
CCState state = getState(event);
if (state == null) {
return;
}
presentation.setVisible(true);
if (canAddPlaceholder(state)) {
presentation.setEnabled(true);
}
}
示例13: update
import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
@Override
public final void update(AnActionEvent e) {
this.dataContext = e.getDataContext();
final Presentation presentation = e.getPresentation();
final boolean enabled = isAvailable(dataContext);
presentation.setVisible(enabled);
presentation.setEnabled(enabled);
}
示例14: update
import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
public void update(AnActionEvent event){
Presentation presentation = event.getPresentation();
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
if (project == null || project.isDisposed()) {
presentation.setEnabled(false);
return;
}
presentation.setEnabled(IdeDocumentHistory.getInstance(project).isForwardAvailable());
}
示例15: update
import com.intellij.openapi.actionSystem.Presentation; //導入方法依賴的package包/類
public void update(AnActionEvent event){
Presentation presentation = event.getPresentation();
Project project = CommonDataKeys.PROJECT.getData(event.getDataContext());
if (project == null) {
presentation.setEnabled(false);
return;
}
ToolWindowManagerEx manager=(ToolWindowManagerEx)ToolWindowManager.getInstance(project);
String id = manager.getLastActiveToolWindowId();
presentation.setEnabled(id != null && manager.getToolWindow(id).isAvailable());
}