List of usage examples for com.intellij.openapi.actionSystem IdeActions ACTION_COMPILE
String ACTION_COMPILE
To view the source code for com.intellij.openapi.actionSystem IdeActions ACTION_COMPILE.
Click Source Link
From source file:com.google.idea.blaze.base.plugin.BlazeSpecificInitializer.java
License:Open Source License
private static void hideMakeActions() { // 'Build' > 'Make Project' action BlazeActionRemover.hideAction("CompileDirty"); // 'Build' > 'Make Modules' action BlazeActionRemover.hideAction(IdeActions.ACTION_MAKE_MODULE); // 'Build' > 'Rebuild' action BlazeActionRemover.hideAction(IdeActions.ACTION_COMPILE_PROJECT); // 'Build' > 'Compile Modules' action BlazeActionRemover.hideAction(IdeActions.ACTION_COMPILE); }
From source file:com.intellij.compiler.actions.CompileAction.java
License:Apache License
public void update(AnActionEvent event) { super.update(event); Presentation presentation = event.getPresentation(); if (!presentation.isEnabled()) { return;/*from www .j av a2 s . c o m*/ } DataContext dataContext = event.getDataContext(); presentation.setText(ActionsBundle.actionText(IdeActions.ACTION_COMPILE)); presentation.setVisible(true); Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null) { presentation.setEnabled(false); return; } final Module module = LangDataKeys.MODULE_CONTEXT.getData(dataContext); final VirtualFile[] files = getCompilableFiles(project, PlatformDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext)); if (module == null && files.length == 0) { presentation.setEnabled(false); presentation.setVisible(!ActionPlaces.isPopupPlace(event.getPlace())); return; } String elementDescription = null; if (module != null) { elementDescription = CompilerBundle.message("action.compile.description.module", module.getName()); } else { PsiPackage aPackage = null; if (files.length == 1) { final PsiDirectory directory = PsiManager.getInstance(project).findDirectory(files[0]); if (directory != null) { aPackage = PsiPackageManager.getInstance(project).findAnyPackage(directory); } } else { PsiElement element = LangDataKeys.PSI_ELEMENT.getData(dataContext); if (element instanceof PsiPackage) { aPackage = (PsiPackage) element; } } if (aPackage != null) { String name = aPackage.getQualifiedName(); if (name.length() == 0) { //noinspection HardCodedStringLiteral name = "<default>"; } elementDescription = "'" + name + "'"; } else if (files.length == 1) { final VirtualFile file = files[0]; FileType fileType = file.getFileType(); if (CompilerManager.getInstance(project).isCompilableFileType(fileType) || isCompilableResourceFile(project, file)) { elementDescription = "'" + file.getName() + "'"; } else { if (!ActionPlaces.MAIN_MENU.equals(event.getPlace())) { // the action should be invisible in popups for non-java files presentation.setEnabled(false); presentation.setVisible(false); return; } } } else { elementDescription = CompilerBundle.message("action.compile.description.selected.files"); } } if (elementDescription == null) { presentation.setEnabled(false); return; } presentation.setText(createPresentationText(elementDescription), true); presentation.setEnabled(true); }
From source file:com.intellij.compiler.actions.CompileAction.java
License:Apache License
private static String createPresentationText(String elementDescription) { StringBuilder buffer = new StringBuilder(40); buffer.append(ActionsBundle.actionText(IdeActions.ACTION_COMPILE)).append(" "); int length = elementDescription.length(); if (length > 23) { if (StringUtil.startsWithChar(elementDescription, '\'')) { buffer.append("'"); }/*from w w w .jav a 2s . c o m*/ buffer.append("..."); buffer.append(elementDescription.substring(length - 20, length)); } else { buffer.append(elementDescription); } return buffer.toString(); }