Merge branch 'master' of git.labs.intellij.net:idea/community

This commit is contained in:
Bas Leijdekkers
2012-04-17 18:02:28 +02:00
32 changed files with 270 additions and 123 deletions
+1 -1
View File
@@ -145,7 +145,7 @@ if [ "$IS_EAP" = "true" ]; then
OS_NAME=`echo $OS_TYPE | "$TR" '[:upper:]' '[:lower:]'`
AGENT_LIB="yjpagent-$OS_NAME$BITS"
if [ -r "$IDE_BIN_HOME/lib$AGENT_LIB.so" ]; then
AGENT="-agentlib:$AGENT_LIB=disablej2ee,disablecounts,disablealloc,sessionname=@@system_selector@@"
AGENT="-agentlib:$AGENT_LIB=disablej2ee,disablealloc,sessionname=@@system_selector@@"
fi
fi
+1 -1
View File
@@ -206,7 +206,7 @@ libraryLicense(name: "Maven3", libraryNames: ["Maven3", "maven-dependency-tree-1
libraryLicense(name: "markdownj", attachedTo: "tasks-core", version: "", license: "BSD", url: "http://markdownj.org/", licenseUrl: "http://www.opensource.org/licenses/bsd-license.php")
libraryLicense(name: "mercurial_prompthooks", attachedTo: "hg4idea", version: "", license: "GPLv2 (used as hg extension called from hg executable)", url: "https://github.com/willemv/mercurial_prompthooks", licenseUrl: "https://github.com/willemv/mercurial_prompthooks/blob/master/LICENSE.txt")
libraryLicense(name: "Microba", libraryName: "microba", version: "0.4.2", license: "BSD", url: "http://microba.sourceforge.net/", licenseUrl: "http://microba.sourceforge.net/license.txt")
libraryLicense(name: "MigLayout", libraryName: "miglayout-swing.jar", version: "3.7.1", license: "BSD", url: "http://www.miglayout.com/", licenseUrl: "http://www.miglayout.com/mavensite/license.html")
libraryLicense(name: "MigLayout", libraryName: "miglayout-swing", version: "3.7.1", license: "BSD", url: "http://www.miglayout.com/", licenseUrl: "http://www.miglayout.com/mavensite/license.html")
libraryLicense(name: "NanoXML", version: "2.2.3", license: "zlib/libpng", url: "http://nanoxml.cyberelf.be/", licenseUrl: "http://devkix.com/nanoxml.php")
libraryLicense(name: "nekohtml", libraryName: "nekohtml", version: "1.9.14", license: "Apache 2.0", url: "http://nekohtml.sourceforge.net/", licenseUrl: "http://apache.org/licenses/LICENSE-2.0.txt")
libraryLicense(name: "Eclipse JDT Core", libraryName: "Eclipse", version: "3.3", license: "CPL 1.0", url: "http://www.eclipse.org/jdt/core/index.php")
+3 -3
View File
@@ -60,10 +60,10 @@ binding.setVariable("vmOptions", { "$common_vmoptions ${isEap() ? '-XX:+HeapDump
binding.setVariable("vmOptions32", { "$mem32 ${vmOptions()}".trim() })
binding.setVariable("vmOptions64", { "$mem64 ${vmOptions()}".trim() })
binding.setVariable("vmOptions32yjp", { String systemSelector ->
"${vmOptions32()} -agentlib:yjpagent=disablej2ee,disablecounts,disablealloc,sessionname=$systemSelector".trim()
"${vmOptions32()} -agentlib:yjpagent=disablej2ee,disablealloc,sessionname=$systemSelector".trim()
})
binding.setVariable("vmOptions64yjp", { String systemSelector ->
"${vmOptions64()} -agentlib:yjpagent64=disablej2ee,disablecounts,disablealloc,sessionname=$systemSelector".trim()
"${vmOptions64()} -agentlib:yjpagent64=disablej2ee,disablealloc,sessionname=$systemSelector".trim()
})
binding.setVariable("isDefined", {String key ->
@@ -252,7 +252,7 @@ binding.setVariable("layoutMacApp", { String path, String ch, Map args ->
String vmOptions = "${vmOptions()} -Xverify:none"
if (isEap() && !args.mac_no_yjp) {
vmOptions += " -agentlib:yjpagent=disablej2ee,disablecounts,disablealloc,sessionname=${args.system_selector}"
vmOptions += " -agentlib:yjpagent=disablej2ee,disablealloc,sessionname=${args.system_selector}"
}
String version = isEap() ? "EAP $args.buildNumber" : "${p("component.version.major")}.${p("component.version.minor")}"
@@ -71,11 +71,20 @@ public abstract class SelectImportedProjectsStep<T> extends ProjectImportWizardS
return panel;
}
protected boolean isElementEnabled(T element) {
return true;
}
public void updateStep() {
fileChooser.clear();
for (T element : getContext().getList()) {
fileChooser.addElement(element, getContext().isMarked(element));
boolean isEnabled = isElementEnabled(element);
fileChooser.addElement(element, isEnabled && getContext().isMarked(element));
if (!isEnabled) {
fileChooser.disableElement(element);
}
}
fileChooser.setBorder(IdeBorderFactory.createTitledBorder(
IdeBundle.message("project.import.select.title", getContext().getName()), false));
openModuleSettingsCheckBox.setSelected(getBuilder().isOpenProjectSettingsAfter());
@@ -47,7 +47,9 @@ public class DummyEntryPointsTool extends FilteringInspectionTool {
public void runInspection(@NotNull AnalysisScope scope, @NotNull final InspectionManager manager) {}
public void exportResults(@NotNull Element parentNode) {}
@Override
public void exportResults(@NotNull Element parentNode, RefEntity refEntity) {
}
@NotNull
public JobDescriptor[] getJobDescriptors(GlobalInspectionContext globalInspectionContext) {
@@ -631,45 +631,43 @@ public class UnusedDeclarationInspection extends FilteringInspectionTool {
return myComposer;
}
public void exportResults(@NotNull final Element parentNode) {
@Override
public void exportResults(@NotNull final Element parentNode, RefEntity refEntity) {
if (!(refEntity instanceof RefJavaElement)) return;
final WeakUnreferencedFilter filter = new WeakUnreferencedFilter(this);
getRefManager().iterate(new RefJavaVisitor() {
@Override public void visitElement(RefEntity refEntity) {
if (!(refEntity instanceof RefJavaElement)) return;
if (!getIgnoredRefElements().contains(refEntity) && filter.accepts((RefJavaElement)refEntity)) {
if (refEntity instanceof RefImplicitConstructor) refEntity = ((RefImplicitConstructor)refEntity).getOwnerClass();
Element element = refEntity.getRefManager().export(refEntity, parentNode, -1);
@NonNls Element problemClassElement = new Element(InspectionsBundle.message("inspection.export.results.problem.element.tag"));
if (!getIgnoredRefElements().contains(refEntity) && filter.accepts((RefJavaElement)refEntity)) {
if (refEntity instanceof RefImplicitConstructor) refEntity = ((RefImplicitConstructor)refEntity).getOwnerClass();
Element element = refEntity.getRefManager().export(refEntity, parentNode, -1);
@NonNls Element problemClassElement = new Element(InspectionsBundle.message("inspection.export.results.problem.element.tag"));
if (refEntity instanceof RefElement) {
final RefElement refElement = (RefElement)refEntity;
final HighlightSeverity severity = getCurrentSeverity(refElement);
final String attributeKey = getTextAttributeKey(refElement.getElement().getProject(), severity, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
problemClassElement.setAttribute("severity", severity.myName);
problemClassElement.setAttribute("attribute_key", attributeKey);
}
problemClassElement.addContent(InspectionsBundle.message("inspection.export.results.dead.code"));
element.addContent(problemClassElement);
@NonNls Element hintsElement = new Element("hints");
for (String hint : HINTS) {
@NonNls Element hintElement = new Element("hint");
hintElement.setAttribute("value", hint);
hintsElement.addContent(hintElement);
}
element.addContent(hintsElement);
Element descriptionElement = new Element(InspectionsBundle.message("inspection.export.results.description.tag"));
StringBuffer buf = new StringBuffer();
DeadHTMLComposer.appendProblemSynopsis((RefElement)refEntity, buf);
descriptionElement.addContent(buf.toString());
element.addContent(descriptionElement);
}
if (refEntity instanceof RefElement) {
final RefElement refElement = (RefElement)refEntity;
final HighlightSeverity severity = getCurrentSeverity(refElement);
final String attributeKey =
getTextAttributeKey(refElement.getElement().getProject(), severity, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
problemClassElement.setAttribute("severity", severity.myName);
problemClassElement.setAttribute("attribute_key", attributeKey);
}
});
problemClassElement.addContent(InspectionsBundle.message("inspection.export.results.dead.code"));
element.addContent(problemClassElement);
@NonNls Element hintsElement = new Element("hints");
for (String hint : HINTS) {
@NonNls Element hintElement = new Element("hint");
hintElement.setAttribute("value", hint);
hintsElement.addContent(hintElement);
}
element.addContent(hintsElement);
Element descriptionElement = new Element(InspectionsBundle.message("inspection.export.results.description.tag"));
StringBuffer buf = new StringBuffer();
DeadHTMLComposer.appendProblemSynopsis((RefElement)refEntity, buf);
descriptionElement.addContent(buf.toString());
element.addContent(descriptionElement);
}
}
public QuickFixAction[] getQuickFixes(final RefEntity[] refElements) {
@@ -75,7 +75,7 @@ public class RefJavaUtilImpl extends RefJavaUtil{
if (refConstructor == null) { // No explicit constructor referenced. Should use default one.
PsiType newType = newExpr.getType();
if (newType instanceof PsiClassType) {
processClassReference(PsiUtil.resolveClassInType(newType), refFrom, psiFrom);
processClassReference(PsiUtil.resolveClassInType(newType), refFrom, psiFrom, true);
}
}
}
@@ -124,22 +124,38 @@ public class RefJavaUtilImpl extends RefJavaUtil{
final PsiTypeElement operand = expression.getOperand();
final PsiType type = operand.getType();
if (type instanceof PsiClassType) {
processClassReference(((PsiClassType)type).resolve(), refFrom, psiFrom);
processClassReference(((PsiClassType)type).resolve(), refFrom, psiFrom, false);
}
}
private void processClassReference(final PsiClass psiClass, final RefJavaElementImpl refFrom, final PsiModifierListOwner psiFrom) {
private void processClassReference(final PsiClass psiClass,
final RefJavaElementImpl refFrom,
final PsiModifierListOwner psiFrom,
boolean defaultConstructorOnly) {
if (psiClass != null) {
RefClassImpl refClass = (RefClassImpl)refFrom.getRefManager().getReference(psiClass);
if (refClass != null) {
RefMethodImpl refDefaultConstructor = (RefMethodImpl)refClass.getDefaultConstructor();
boolean hasConstructorsMarked = false;
if (refDefaultConstructor != null && !(refDefaultConstructor instanceof RefImplicitConstructor)) {
refDefaultConstructor.addInReference(refFrom);
refFrom.addOutReference(refDefaultConstructor);
if (defaultConstructorOnly) {
RefMethodImpl refDefaultConstructor = (RefMethodImpl)refClass.getDefaultConstructor();
if (refDefaultConstructor != null && !(refDefaultConstructor instanceof RefImplicitConstructor)) {
refDefaultConstructor.addInReference(refFrom);
refFrom.addOutReference(refDefaultConstructor);
hasConstructorsMarked = true;
}
}
else {
for (RefMethod cons : refClass.getConstructors()) {
if (cons instanceof RefImplicitConstructor) continue;
((RefMethodImpl)cons).addInReference(refFrom);
refFrom.addOutReference(cons);
hasConstructorsMarked = true;
}
}
if (!hasConstructorsMarked) {
refFrom.addReference(refClass, psiClass, psiFrom, false, true, null);
}
}
@@ -385,4 +401,4 @@ public class RefJavaUtilImpl extends RefJavaUtil{
}
}
}
}
}
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems/>
@@ -0,0 +1,12 @@
import java.lang.Class;
import java.lang.String;
public class Test {
public static void main(String[] args) {
Test.class.getDeclaredConstructor(String.class).newInstance("Foo");
}
public Test(String param) {
System.out.println("This is used!");
}
}
@@ -184,4 +184,8 @@ public class UnusedDeclarationTest extends InspectionTestCase {
public void testAbstractClassWithSerializableSubclasses() throws Exception {
doTest();
}
public void testclassLiteralRef() throws Exception {
doTest();
}
}
@@ -20,6 +20,7 @@ import com.intellij.codeInspection.GlobalInspectionContext;
import com.intellij.codeInspection.InspectionEP;
import com.intellij.codeInspection.InspectionManager;
import com.intellij.codeInspection.reference.RefEntity;
import com.intellij.codeInspection.reference.RefVisitor;
import com.intellij.codeInspection.ui.InspectionNode;
import com.intellij.codeInspection.ui.InspectionTreeNode;
import org.jdom.Element;
@@ -111,7 +112,7 @@ public class CommonInspectionToolWrapper extends InspectionToolWrapper<Inspectio
}
@Override
public void exportResults(@NotNull Element parentNode) {
getTool().exportResults(parentNode);
public void exportResults(@NotNull Element parentNode, RefEntity refEntity) {
getTool().exportResults(parentNode, refEntity);
}
}
@@ -20,7 +20,6 @@ import com.intellij.codeInspection.*;
import com.intellij.codeInspection.reference.RefElement;
import com.intellij.codeInspection.reference.RefEntity;
import com.intellij.codeInspection.reference.RefModule;
import com.intellij.codeInspection.reference.RefVisitor;
import com.intellij.codeInspection.ui.ProblemDescriptionNode;
import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.openapi.components.PathMacroManager;
@@ -105,7 +104,7 @@ public abstract class DescriptorProviderInspection extends InspectionTool implem
final File file = new File(fileName);
final CharArrayWriter writer = new CharArrayWriter();
if (!file.exists()) {
writer.append("<").append(InspectionsBundle.message("inspection.problems")).append(" is_local_tool=\"")
writer.append("<").append(InspectionsBundle.message("inspection.problems")).append(" " + GlobalInspectionContextImpl.LOCAL_TOOL_ATTRIBUTE + "=\"")
.append(Boolean.toString(this instanceof LocalInspectionToolWrapper)).append("\">\n");
}
for (Object o : list) {
@@ -263,19 +262,16 @@ public abstract class DescriptorProviderInspection extends InspectionTool implem
return myComposer;
}
public void exportResults(@NotNull final Element parentNode) {
getRefManager().iterate(new RefVisitor() {
@Override public void visitElement(final RefEntity refEntity) {
synchronized (lock) {
if (getProblemElements().containsKey(refEntity)) {
CommonProblemDescriptor[] descriptions = getDescriptions(refEntity);
if (descriptions != null) {
exportResults(descriptions, refEntity, parentNode);
}
}
@Override
public void exportResults(final @NotNull Element parentNode, RefEntity refEntity) {
synchronized (lock) {
if (getProblemElements().containsKey(refEntity)) {
CommonProblemDescriptor[] descriptions = getDescriptions(refEntity);
if (descriptions != null) {
exportResults(descriptions, refEntity, parentNode);
}
}
});
}
}
private void exportResults(@NotNull final CommonProblemDescriptor[] descriptions, final RefEntity refEntity, final Element parentNode) {
@@ -105,6 +105,7 @@ public class GlobalInspectionContextImpl extends UserDataHolderBase implements G
private final Map<String, Tools> myTools = new THashMap<String, Tools>();
private AnalysisUIOptions myUIOptions;
@NonNls static final String LOCAL_TOOL_ATTRIBUTE = "is_local_tool";
public GlobalInspectionContextImpl(Project project, NotNullLazyValue<ContentManager> contentManager) {
myProject = project;
@@ -296,44 +297,63 @@ public class GlobalInspectionContextImpl extends UserDataHolderBase implements G
public void run() {
performInspectionsWithProgress(scope, manager);
@NonNls final String ext = ".xml";
final Map<Element, Tools> globalTools = new HashMap<Element, Tools>();
for (Map.Entry<String,Tools> stringSetEntry : myTools.entrySet()) {
final Element root = new Element(InspectionsBundle.message("inspection.problems"));
final Document doc = new Document(root);
final Tools sameTools = stringSetEntry.getValue();
boolean hasProblems = false;
boolean isLocalTool = false;
String toolName = stringSetEntry.getKey();
if (sameTools != null) {
for (ScopeToolState toolDescr : sameTools.getTools()) {
final InspectionTool tool = (InspectionTool)toolDescr.getTool();
if (tool instanceof LocalInspectionToolWrapper) {
hasProblems = new File(outputPath, toolName + ext).exists();
isLocalTool = true;
}
else {
tool.updateContent();
if (tool.hasReportedProblems()) {
hasProblems = true;
tool.exportResults(root);
final Element root = new Element(InspectionsBundle.message("inspection.problems"));
globalTools.put(root, sameTools);
LOG.assertTrue(!hasProblems, toolName);
break;
}
}
}
}
if (!hasProblems) continue;
@NonNls final String isLocalToolAttribute = "is_local_tool";
root.setAttribute(isLocalToolAttribute, String.valueOf(isLocalTool));
try {
new File(outputPath).mkdirs();
final File file = new File(outputPath, toolName + ext);
inspectionsResults.add(file);
if (isLocalTool) {
FileUtil.writeToFile(file, ("</" + InspectionsBundle.message("inspection.problems") + ">").getBytes("UTF-8"), true);
}
else {
PathMacroManager.getInstance(getProject()).collapsePaths(doc.getRootElement());
JDOMUtil.writeDocument(doc, file, "\n");
FileUtil.writeToFile(file, ("</" + InspectionsBundle.message("inspection.problems") + ">").getBytes("UTF-8"), true);
}
catch (IOException e) {
LOG.error(e);
}
}
getRefManager().iterate(new RefVisitor() {
@Override
public void visitElement(final RefEntity refEntity) {
for (Element element : globalTools.keySet()) {
final Tools tools = globalTools.get(element);
for (ScopeToolState state : tools.getTools()) {
((InspectionTool)state.getTool()).exportResults(element, refEntity);
}
}
}
});
for (Element element : globalTools.keySet()) {
final String toolName = globalTools.get(element).getShortName();
element.setAttribute(LOCAL_TOOL_ATTRIBUTE, Boolean.toString(false));
final Document doc = new Document(element);
PathMacroManager.getInstance(getProject()).collapsePaths(doc.getRootElement());
try {
new File(outputPath).mkdirs();
final File file = new File(outputPath, toolName + ext);
inspectionsResults.add(file);
JDOMUtil.writeDocument(doc, file, "\n");
}
catch (IOException e) {
LOG.error(e);
}
@@ -29,10 +29,7 @@ import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
import com.intellij.codeInsight.daemon.impl.SeverityRegistrar;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.codeInspection.*;
import com.intellij.codeInspection.reference.RefElement;
import com.intellij.codeInspection.reference.RefEntity;
import com.intellij.codeInspection.reference.RefManager;
import com.intellij.codeInspection.reference.RefModule;
import com.intellij.codeInspection.reference.*;
import com.intellij.codeInspection.ui.InspectionNode;
import com.intellij.codeInspection.ui.InspectionTreeNode;
import com.intellij.lang.annotation.HighlightSeverity;
@@ -69,7 +66,16 @@ public abstract class InspectionTool extends InspectionProfileEntry {
public abstract void runInspection(@NotNull AnalysisScope scope, @NotNull InspectionManager manager);
public abstract void exportResults(@NotNull Element parentNode);
public void exportResults(@NotNull final Element parentNode) {
getRefManager().iterate(new RefVisitor(){
@Override
public void visitElement(RefEntity elem) {
exportResults(parentNode, elem);
}
});
}
public abstract void exportResults(@NotNull Element parentNode, RefEntity refEntity);
public abstract boolean isGraphNeeded();
@Nullable
@@ -439,7 +439,17 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable,
if (!(settings.getConfiguration() instanceof UnknownRunConfiguration)) {
final List<BeforeRunTask> tasks = getBeforeRunTasks(settings.getConfiguration());
final Element methodsElement = new Element(METHOD);
Map<Key<BeforeRunTask>,BeforeRunTask> templateTasks = null;
if (!settings.isTemplate()) {
List<BeforeRunTask> beforeRunTasks = getBeforeRunTasks(getConfigurationTemplate(settings.getFactory()).getConfiguration());
templateTasks = new HashMap<Key<BeforeRunTask>, BeforeRunTask>();
for (BeforeRunTask task : beforeRunTasks) {
templateTasks.put(task.getProviderId(), task);
}
}
for (BeforeRunTask task : tasks) {
if (templateTasks != null && task.equals(templateTasks.get(task.getProviderId())))
continue; // not neccesary saving if the task is the same as template
final Element child = new Element(OPTION);
child.setAttribute(NAME_ATTR, task.getProviderId().toString());
task.writeExternal(child);
@@ -793,7 +803,11 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable,
@NotNull
@Override
public <T extends BeforeRunTask> List<T> getBeforeRunTasks(RunConfiguration settings, Key<T> taskProviderID) {
List<BeforeRunTask> tasks = getBeforeRunTasks(settings);
List<BeforeRunTask> tasks = myConfigurationToBeforeTasksMap.get(settings);
if (tasks == null) {
tasks = getBeforeRunTasks(settings);
myConfigurationToBeforeTasksMap.put(settings, tasks);
}
List<T> result = new ArrayList<T>();
for (BeforeRunTask task : tasks) {
if (task.getProviderId() == taskProviderID)
@@ -859,7 +873,20 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable,
}
public final void setBeforeRunTasks(final RunConfiguration runConfiguration, List<BeforeRunTask> tasks) {
myConfigurationToBeforeTasksMap.put(runConfiguration, tasks);
List<BeforeRunTask> templates = getBeforeRunTasks(runConfiguration);//here may be some disabled templates
Set<Key<BeforeRunTask>> idsToSet = new HashSet<Key<BeforeRunTask>>();
List<BeforeRunTask> result = new ArrayList<BeforeRunTask>(tasks);
for (BeforeRunTask task : tasks) {
idsToSet.add(task.getProviderId());
}
int i = 0;
for (BeforeRunTask template : templates) {
if (!idsToSet.contains(template.getProviderId())) {
result.add(i, template);
i++;
}
}
myConfigurationToBeforeTasksMap.put(runConfiguration, result);
fireBeforeRunTasksUpdated();
}
@@ -39,13 +39,13 @@ public class CloneElementAction extends CopyElementAction {
}
protected void updateForToolWindow(String id, DataContext dataContext,Presentation presentation) {
if (!ToolWindowId.COMMANDER.equals(id)) {
presentation.setVisible(false);
return;
}
// work only with single selection
PsiElement[] elements = LangDataKeys.PSI_ELEMENT_ARRAY.getData(dataContext);
presentation.setEnabled(elements != null && elements.length == 1 && CopyHandler.canClone(elements));
presentation.setVisible(true);
if (!ToolWindowId.COMMANDER.equals(id)) {
presentation.setVisible(false);
}
}
}
@@ -62,7 +62,7 @@ public class CopyHandler {
if (elements.length > 0) {
final CopyHandlerDelegate[] copyHandlers = Extensions.getExtensions(CopyHandlerDelegate.EP_NAME);
for (CopyHandlerDelegate delegate : copyHandlers) {
if (delegate.canCopy(elements)) {
if (delegate instanceof CopyHandlerDelegateBase ? ((CopyHandlerDelegateBase)delegate).canCopy(elements, true) : delegate.canCopy(elements)) {
if (delegate instanceof CopyHandlerDelegateBase && ((CopyHandlerDelegateBase)delegate).forbidToClone(elements, true)){
return false;
}
@@ -34,6 +34,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import org.jetbrains.annotations.NonNls;
import java.io.File;
import java.util.ArrayList;
public class Tool implements SchemeElement {
@@ -300,7 +301,15 @@ public class Tool implements SchemeElement {
commandLine.setWorkDirectory(MacroManager.getInstance().expandMacrosInString(workingDir, false, dataContext));
exePath = MacroManager.getInstance().expandMacrosInString(exePath, false, dataContext);
if (exePath == null) return null;
commandLine.setExePath(exePath);
File exeFile = new File(exePath);
if (exeFile.isDirectory() && exeFile.getName().endsWith(".app")) {
commandLine.setExePath("open");
commandLine.getParametersList().prependAll("-a", exePath);
}
else {
commandLine.setExePath(exePath);
}
}
catch (Macro.ExecutionCancelledException e) {
return null;
@@ -196,7 +196,7 @@ public class ToolEditorDialog extends DialogWrapper {
browseCommandButton.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor();
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileOrExecutableAppDescriptor();
VirtualFile file = FileChooser.chooseFile(descriptor, myProject, null);
if (file != null) {
myTfCommand.setText(file.getPresentableUrl());
@@ -463,4 +463,4 @@ public class ToolEditorDialog extends DialogWrapper {
if (s.length() == 0) return null;
return s.replace('/', File.separatorChar);
}
}
}
@@ -206,7 +206,7 @@ public class FileChooserDescriptor implements Cloneable {
@Nullable
public final VirtualFile getFileToSelect(VirtualFile file) {
if (file.isDirectory() && myChooseFolders) {
if (file.isDirectory() && (myChooseFolders || isFileSelectable(file))) {
return file;
}
boolean isJar = file.getFileType() == FileTypes.ARCHIVE;
@@ -16,6 +16,7 @@
package com.intellij.openapi.fileChooser;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.UIBundle;
@@ -39,6 +40,21 @@ public class FileChooserDescriptorFactory {
return new FileChooserDescriptor(true, false, false, false, false, false);
}
public static FileChooserDescriptor createSingleFileOrExecutableAppDescriptor() {
return new FileChooserDescriptor(true, false, false, false, false, false) {
@Override
public boolean isFileSelectable(VirtualFile file) {
if (super.isFileSelectable(file)) return true;
if (SystemInfo.isMac && file.isDirectory() && "app".equals(file.getExtension())) {
return true;
}
return false;
}
};
}
public static FileChooserDescriptor createSingleLocalFileDescriptor() {
return new FileChooserDescriptor(true, true, true, true, false, false);
}
@@ -263,7 +263,7 @@ public class AndroidAptCompiler implements SourceGeneratingCompiler {
final String[] libPackages = getLibPackages(module, packageName);
final Module circularDepLibWithSamePackage = AndroidCompileUtil.findCircularDependencyOnLibraryWithSamePackage(facet);
if (circularDepLibWithSamePackage != null) {
if (circularDepLibWithSamePackage != null && !facet.getConfiguration().LIBRARY_PROJECT) {
myContext.addMessage(CompilerMessageCategory.WARNING,
AndroidBundle.message("android.compilation.warning.circular.app.dependency",
packageName, module.getName(),
@@ -163,7 +163,7 @@ public class AndroidAutogenerator {
final String manifestFileOsPath = FileUtil.toSystemDependentName(manifestFile.getPath());
final Module circularDepLibWithSamePackage = AndroidCompileUtil.findCircularDependencyOnLibraryWithSamePackage(facet);
if (circularDepLibWithSamePackage != null) {
if (circularDepLibWithSamePackage != null && !facet.getConfiguration().LIBRARY_PROJECT) {
context.addMessage(CompilerMessageCategory.WARNING, AndroidBundle.message("android.compilation.warning.circular.app.dependency",
packageName, module.getName(),
circularDepLibWithSamePackage.getName()), null, -1, -1);
@@ -655,19 +655,20 @@ public class AndroidCompileUtil {
final GlobalSearchScope moduleScope = facet.getModule().getModuleScope();
initializeGenSourceRoot(module, AndroidRootUtil.getRenderscriptGenSourceRootPath(facet),
FileTypeIndex.getFiles(AndroidRenderscriptFileType.INSTANCE, moduleScope).size() > 0);
FileTypeIndex.getFiles(AndroidRenderscriptFileType.INSTANCE, moduleScope).size() > 0, true);
if (AndroidAptCompiler.isToCompileModule(module, facet.getConfiguration())) {
initializeGenSourceRoot(module, AndroidRootUtil.getAptGenSourceRootPath(facet), true);
initializeGenSourceRoot(module, AndroidRootUtil.getAptGenSourceRootPath(facet), true, true);
}
else {
// we need to include generated-sources/r to compilation, because it contains R.java generated by Maven,
// which should be used in Maven-based resource processing mode
initializeGenSourceRoot(module, AndroidRootUtil.getAptGenSourceRootPath(facet), true, false);
includeAaptGenSourceRootToCompilation(facet);
}
initializeGenSourceRoot(module, AndroidRootUtil.getAidlGenSourceRootPath(facet),
FileTypeIndex.getFiles(AndroidIdlFileType.ourFileType, moduleScope).size() > 0);
FileTypeIndex.getFiles(AndroidIdlFileType.ourFileType, moduleScope).size() > 0, true);
}
private static void includeAaptGenSourceRootToCompilation(AndroidFacet facet) {
@@ -686,7 +687,7 @@ public class AndroidCompileUtil {
}
}
private static void initializeGenSourceRoot(@NotNull Module module, @Nullable String sourceRootPath, boolean createIfNotExist) {
private static void initializeGenSourceRoot(@NotNull Module module, @Nullable String sourceRootPath, boolean createIfNotExist, boolean exclude) {
if (sourceRootPath == null) {
return;
}
@@ -701,7 +702,7 @@ public class AndroidCompileUtil {
if (sourceRoot == null) {
sourceRoot = LocalFileSystem.getInstance().findFileByPath(sourceRootPath);
}
if (sourceRoot != null) {
if (sourceRoot != null && exclude) {
excludeFromCompilation(module.getProject(), sourceRoot);
}
}
@@ -19,14 +19,16 @@ import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.CommandLineBuilder;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.configurations.JavaParameters;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.compiler.CompilerMessageCategory;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.util.Computable;
import com.intellij.util.containers.HashMap;
import org.jetbrains.android.util.AndroidUtils;
import org.jetbrains.android.util.ExecutionStatus;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.maven.execution.MavenExternalParameters;
import org.jetbrains.idea.maven.execution.MavenRunner;
import org.jetbrains.idea.maven.execution.MavenRunnerParameters;
import org.jetbrains.idea.maven.project.MavenProjectsManager;
@@ -42,24 +44,39 @@ public class AndroidMavenExecutor {
private static final Logger LOG = Logger.getInstance("#org.jetbrains.android.compiler.tools.AndroidMavenExecutor");
private static final String BUILD_ERROR_INDICATOR = "[error]";
private static final String FAILED_TO_RESOLVE_ARTIFACT_INDICATOR = "[info] failed to resolve artifact";
private AndroidMavenExecutor() {
}
public static Map<CompilerMessageCategory, List<String>> generateResources(Module module) {
public static Map<CompilerMessageCategory, List<String>> generateResources(final Module module) {
MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(module.getProject());
MavenRunnerParameters parameters =
final MavenRunnerParameters parameters =
new MavenRunnerParameters(true, projectsManager.findProject(module).getDirectory(),
Collections.singletonList("process-resources"),
projectsManager.getExplicitProfiles());
Map<CompilerMessageCategory, List<String>> result = new HashMap<CompilerMessageCategory, List<String>>();
final Map<CompilerMessageCategory, List<String>> result = new HashMap<CompilerMessageCategory, List<String>>();
result.put(CompilerMessageCategory.ERROR, new ArrayList<String>());
try {
JavaParameters javaParams = MavenExternalParameters.createJavaParameters(module.getProject(), parameters);
JavaParameters javaParams = ApplicationManager.getApplication().runReadAction(new Computable<JavaParameters>() {
@Nullable
@Override
public JavaParameters compute() {
try {
return MavenExternalParameters.createJavaParameters(module.getProject(), parameters);
}
catch (ExecutionException e) {
LOG.info(e);
result.get(CompilerMessageCategory.ERROR).add(e.getMessage());
return null;
}
}
});
if (javaParams == null) {
return result;
}
GeneralCommandLine commandLine = CommandLineBuilder.createFromJavaParameters(javaParams);
StringBuilder messageBuilder = new StringBuilder();
@@ -70,13 +87,7 @@ public class AndroidMavenExecutor {
String lcmessage = message.toLowerCase();
int buildErrorIndex = lcmessage.indexOf(BUILD_ERROR_INDICATOR);
if (buildErrorIndex >= 0) {
int failedToResolveIndex = lcmessage.indexOf(FAILED_TO_RESOLVE_ARTIFACT_INDICATOR);
/*if (failedToResolveIndex >= 0) {
result.get(CompilerMessageCategory.ERROR).add("Failed to copy Android resources from Maven artifacts");
}
else {*/
result.get(CompilerMessageCategory.ERROR).add(message.substring(buildErrorIndex));
//}
result.get(CompilerMessageCategory.ERROR).add(message.substring(buildErrorIndex));
}
}
}
+1 -1
View File
@@ -1012,7 +1012,7 @@
<projectStructureDetector implementation="org.jetbrains.plugins.groovy.griffon.GriffonProjectStructureDetector"/>
<programRunner implementation="org.jetbrains.plugins.groovy.griffon.GriffonDebuggerRunner"/>
<configurationType implementation="org.jetbrains.plugins.groovy.griffon.GriffonRunConfigurationType"/>
<toolWindow id="Griffon View" anchor="left" secondary="false" icon="/icons/griffon/griffon.png"
<toolWindow id="Griffon View" anchor="left" secondary="false" icon="/icons/griffon/griffonToolWindow.png"
factoryClass="org.jetbrains.plugins.groovy.griffon.GriffonToolWindowFactory"
conditionClass="org.jetbrains.plugins.groovy.griffon.GriffonToolWindowFactory"/>
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -143,7 +143,7 @@ public abstract class GroovyCompilerBase implements TranslatingCompiler {
if (profileGroovyc) {
parameters.getVMParametersList().defineProperty("java.library.path", PathManager.getBinPath());
parameters.getVMParametersList().defineProperty("profile.groovy.compiler", "true");
parameters.getVMParametersList().add("-agentlib:yjpagent=disablej2ee,disablecounts,disablealloc,sessionname=GroovyCompiler");
parameters.getVMParametersList().add("-agentlib:yjpagent=disablej2ee,disablealloc,sessionname=GroovyCompiler");
classPathBuilder.add(PathManager.findFileInLibDirectory("yjp-controller-api-redist.jar").getAbsolutePath());
}
@@ -55,7 +55,7 @@ import java.util.Map;
*/
public class GriffonFramework extends MvcFramework {
public static final Icon GRIFFON_ICON = IconLoader.getIcon("/icons/griffon/griffon.png");
public static final Icon GRIFFON_TOOLWINDOW_ICON = IconLoader.getIcon("/icons/griffon/griffonToolWindow.png");
@NonNls private static final String GRIFFON_COMMON_PLUGINS = "-griffonPlugins";
private static final String GLOBAL_PLUGINS_MODULE_NAME = "GriffonGlobalPlugins";
@@ -92,7 +92,7 @@ public class GriffonToolWindowFactory extends MvcToolWindowDescriptor {
@Override
public Icon getModuleNodeIcon() {
return GriffonFramework.GRIFFON_TOOLWINDOW_ICON;
return GriffonFramework.GRIFFON_ICON;
}
@@ -422,6 +422,7 @@ public class MvcModuleStructureSynchronizer extends AbstractProjectComponent {
if (shouldShow && toolWindow == null) {
toolWindow = toolWindowManager.registerToolWindow(id, true, ToolWindowAnchor.LEFT, myProject, true);
toolWindow.setIcon(IconLoader.getIcon(ep.icon));
descriptor.createToolWindowContent(myProject, toolWindow);
}
else if (!shouldShow && toolWindow != null) {
@@ -51,7 +51,6 @@ public abstract class MvcToolWindowDescriptor implements ToolWindowFactory, Cond
}
public void createToolWindowContent(Project project, ToolWindow toolWindow) {
toolWindow.setIcon(myFramework.getIcon());
toolWindow.setAvailable(true, null);
toolWindow.setToHideOnEmptyContent(true);
toolWindow.setTitle(myFramework.getDisplayName());
@@ -23,11 +23,13 @@ package org.jetbrains.idea.maven.wizards;
import com.intellij.ide.util.projectWizard.ModuleWizardStep;
import com.intellij.ide.util.projectWizard.ProjectWizardStepFactory;
import com.intellij.ide.util.projectWizard.WizardContext;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.projectImport.ProjectImportProvider;
import com.intellij.projectImport.SelectImportedProjectsStep;
import org.jetbrains.idea.maven.project.MavenProject;
import org.jetbrains.idea.maven.project.MavenProjectsManager;
import java.io.File;
@@ -36,7 +38,7 @@ public class MavenProjectImportProvider extends ProjectImportProvider {
super(builder);
}
public ModuleWizardStep[] createSteps(WizardContext wizardContext) {
public ModuleWizardStep[] createSteps(final WizardContext wizardContext) {
final ProjectWizardStepFactory stepFactory = ProjectWizardStepFactory.getInstance();
return new ModuleWizardStep[]{new MavenProjectImportStep(wizardContext), new SelectProfilesStep(wizardContext),
new SelectImportedProjectsStep<MavenProject>(wizardContext) {
@@ -50,9 +52,22 @@ public class MavenProjectImportProvider extends ProjectImportProvider {
stringBuilder.append(" [").append(relPath).append("]");
}
}
if (!isElementEnabled(project)) {
stringBuilder.append(" (project is ignored. See Settings -> Maven -> Ignored Files)");
}
return stringBuilder.toString();
}
@Override
protected boolean isElementEnabled(MavenProject mavenProject) {
Project project = wizardContext.getProject();
if (project == null) return true;
return !MavenProjectsManager.getInstance(project).isIgnored(mavenProject);
}
public void updateDataModel() {
super.updateDataModel();
getWizardContext().setProjectName(((MavenProjectBuilder)getBuilder()).getSuggestedProjectName());