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

This commit is contained in:
Eugene Kudelevsky
2010-11-10 15:45:24 +03:00
12 changed files with 58 additions and 33 deletions
@@ -48,7 +48,7 @@ public class ProgramRunnerUtil {
}
public static void executeConfiguration(@NotNull final Project project, @NotNull final RunnerAndConfigurationSettings configuration,
@NotNull final Executor executor) {
@NotNull final Executor executor, final boolean showSettings) {
ProgramRunner runner = getRunner(executor.getId(), configuration);
if (runner == null) {
LOG.error("Runner MUST not be null! Cannot find runner for " + executor.getId() + " and " + configuration.getConfiguration().getFactory().getName());
@@ -58,7 +58,7 @@ public class ProgramRunnerUtil {
return;
}
if (!RunManagerImpl.canRunConfiguration(configuration, executor) || RunManagerImpl.isEditBeforeRun(configuration)) {
if (!RunManagerImpl.canRunConfiguration(configuration, executor) || (showSettings && RunManagerImpl.isEditBeforeRun(configuration))) {
final boolean result = RunDialog.editConfiguration(project, configuration, "Edit configuration", executor.getActionName(), executor.getIcon());
if (!result) {
return;
@@ -84,6 +84,11 @@ public class ProgramRunnerUtil {
}
}
public static void executeConfiguration(@NotNull final Project project, @NotNull final RunnerAndConfigurationSettings configuration,
@NotNull final Executor executor) {
executeConfiguration(project, configuration, executor, true);
}
public static Icon getConfigurationIcon(final Project project, final RunnerAndConfigurationSettings settings, final boolean invalid) {
final RunManager runManager = RunManager.getInstance(project);
return getConfigurationIcon(settings, invalid, runManager.isTemporary(settings.getConfiguration()));
@@ -220,7 +220,7 @@ public class ChooseRunConfigurationAction extends AnAction {
PropertiesComponent.getInstance().setValue("run.configuration.edit.ad", Boolean.toString(true));
if (RunDialog.editConfiguration(project, configuration, "Edit configuration settings", executor.getActionName(), executor.getIcon())) {
RunManagerEx.getInstanceEx(project).setSelectedConfiguration(configuration);
ProgramRunnerUtil.executeConfiguration(project, configuration, executor);
ProgramRunnerUtil.executeConfiguration(project, configuration, executor, false);
}
}
@@ -300,7 +300,9 @@ public class MemberChooser<T extends ClassMember> extends DialogWrapper implemen
final TreeSpeedSearch treeSpeedSearch = new TreeSpeedSearch(myTree, new Convertor<TreePath, String>() {
@Nullable
public String convert(TreePath path) {
final MemberChooserObject delegate = ((ElementNode)path.getLastPathComponent()).getDelegate();
final ElementNode lastPathComponent = (ElementNode)path.getLastPathComponent();
if (lastPathComponent == null) return null;
final MemberChooserObject delegate = lastPathComponent.getDelegate();
return delegate.getText();
}
});
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2010 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.
@@ -55,6 +55,15 @@ public abstract class NamedItemsListEditor<T> extends MasterDetailsComponent {
Cloner<T> cloner,
Equality<T> comparer,
List<T> items) {
this(namer, factory, cloner, comparer, items, true);
}
protected NamedItemsListEditor(Namer<T> namer,
Factory<T> factory,
Cloner<T> cloner,
Equality<T> comparer,
List<T> items,
boolean initInConstructor) {
myNamer = namer;
myFactory = factory;
myCloner = cloner;
@@ -62,9 +71,10 @@ public abstract class NamedItemsListEditor<T> extends MasterDetailsComponent {
myOriginalItems = items;
myResultItems = items;
reset();
initTree();
if (initInConstructor) {
reset();
initTree();
}
}
public void reset() {
@@ -1207,6 +1207,8 @@ public final class ActionManagerImpl extends ActionManagerEx implements Applicat
return;
}
if (IdeFocusManager.getInstance(null).isFocusBeingTransferred()) return;
final int lastEventCount = myLastTimePerformed;
myLastTimePerformed = ActivityTracker.getInstance().getCount();
@@ -1230,18 +1232,14 @@ public final class ActionManagerImpl extends ActionManagerEx implements Applicat
private void notifyListeners(final List<TimerListener> timerListeners, final Set<TimerListener> notified) {
final TimerListener[] listeners = timerListeners.toArray(new TimerListener[timerListeners.size()]);
IdeFocusManager.getInstance(null).doWhenFocusSettlesDown(new Runnable() {
public void run() {
for (TimerListener listener : listeners) {
if (timerListeners.contains(listener)) {
if (!notified.contains(listener)) {
notified.add(listener);
runListenerAction(listener);
}
}
for (TimerListener listener : listeners) {
if (timerListeners.contains(listener)) {
if (!notified.contains(listener)) {
notified.add(listener);
runListenerAction(listener);
}
}
});
}
}
private void runListenerAction(final TimerListener listener) {
@@ -56,7 +56,7 @@ class CompositeDiffTool implements DiffTool {
private static void checkDiffData(@NotNull DiffRequest data) {
DiffContent[] contents = data.getContents();
for (DiffContent content : contents) {
LOG.assertTrue(content != null);
LOG.assertTrue(content != null, "Null content in diff request");
}
}
}
@@ -65,6 +65,7 @@
<action id="EditorDeleteLine">
<keyboard-shortcut first-keystroke="control D" />
</action>
<action id="EditorDuplicate"/>
<action id="EditorDuplicateLines">
<keyboard-shortcut first-keystroke="control alt DOWN" />
</action>
@@ -88,7 +88,7 @@ public class RelaxSymbolIndex extends ScalarIndexExtension<String> {
attributeHandler = new NanoXmlUtil.IXMLBuilderAdapter() {
@Override
public void addAttribute(String key, String nsPrefix, String nsURI, String value, String type) throws Exception {
if ("name".equals(key) && (nsURI == null || nsURI.length() == 0)) {
if ("name".equals(key) && (nsURI == null || nsURI.length() == 0) && value != null) {
map.put(value, null);
}
}
@@ -112,7 +112,10 @@ public class RelaxSymbolIndex extends ScalarIndexExtension<String> {
grammar.acceptChildren(new CommonElement.Visitor() {
@Override
public void visitDefine(Define define) {
map.put(define.getName(), null);
final String name = define.getName();
if (name != null) {
map.put(name, null);
}
}
});
}
@@ -29,7 +29,6 @@ import com.intellij.lang.properties.PropertiesReferenceManager;
import com.intellij.lang.properties.psi.PropertiesFile;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.compiler.CompileContext;
import com.intellij.openapi.compiler.CompileStatusNotification;
@@ -87,7 +86,7 @@ public final class PreviewFormAction extends AnAction{
public void actionPerformed(final AnActionEvent e) {
final GuiEditor editor = FormEditingUtil.getActiveEditor(e.getDataContext());
if (editor != null) {
showPreviewFrame(editor.getModule(), editor.getFile(), e.getDataContext(), editor.getStringDescriptorLocale());
showPreviewFrame(editor.getModule(), editor.getFile(), editor.getStringDescriptorLocale());
}
}
@@ -107,7 +106,7 @@ public final class PreviewFormAction extends AnAction{
}
private static void showPreviewFrame(@NotNull final Module module, @NotNull final VirtualFile formFile,
final DataContext dataContext, @Nullable final Locale stringDescriptorLocale) {
@Nullable final Locale stringDescriptorLocale) {
final String tempPath;
try {
final File tempDirectory = FileUtil.createTempDirectory("FormPreview", "");
@@ -222,21 +221,24 @@ public final class PreviewFormAction extends AnAction{
for(String bundleName: bundleSet) {
for(PropertiesFile propFile: manager.findPropertiesFiles(module, bundleName)) {
virtualFiles.add(propFile.getVirtualFile());
modules.add(ModuleUtil.findModuleForFile(propFile.getVirtualFile(), module.getProject()));
final Module moduleForFile = ModuleUtil.findModuleForFile(propFile.getVirtualFile(), module.getProject());
if (moduleForFile != null) {
modules.add(moduleForFile);
}
}
}
FileSetCompileScope scope = new FileSetCompileScope(virtualFiles, modules.toArray(new Module[]{}));
FileSetCompileScope scope = new FileSetCompileScope(virtualFiles, modules.toArray(new Module[modules.size()]));
CompilerManager.getInstance(module.getProject()).make(scope, new CompileStatusNotification() {
public void finished(boolean aborted, int errors, int warnings, final CompileContext compileContext) {
if (!aborted && errors == 0) {
runPreviewProcess(tempPath, sources, module, formFile, dataContext, stringDescriptorLocale);
runPreviewProcess(tempPath, sources, module, formFile, stringDescriptorLocale);
}
}
});
}
else {
runPreviewProcess(tempPath, sources, module, formFile, dataContext, stringDescriptorLocale);
runPreviewProcess(tempPath, sources, module, formFile, stringDescriptorLocale);
}
}
@@ -259,7 +261,7 @@ public final class PreviewFormAction extends AnAction{
}
private static void runPreviewProcess(final String tempPath, final PathsList sources, final Module module, final VirtualFile formFile,
final DataContext dataContext, @Nullable final Locale stringDescriptorLocale) {
@Nullable final Locale stringDescriptorLocale) {
// 3. Now we are ready to launch Java process
final JavaParameters parameters = new JavaParameters();
parameters.getClassPath().add(tempPath);
@@ -216,8 +216,7 @@ public final class ComponentTree extends Tree implements DataProvider {
final ArrayList<RadComponent> result = new ArrayList<RadComponent>(paths.length);
for (TreePath path : paths) {
final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
LOG.assertTrue(node != null);
if (node.getUserObject() instanceof ComponentPtrDescriptor) {
if (node != null && node.getUserObject() instanceof ComponentPtrDescriptor) {
final ComponentPtrDescriptor descriptor = (ComponentPtrDescriptor)node.getUserObject();
final ComponentPtr ptr = descriptor.getElement();
if (ptr != null && ptr.isValid()) {
@@ -42,7 +42,12 @@ final class ComponentTreeStructure extends AbstractTreeStructure{
private final GuiEditor myEditor;
public ComponentTreeStructure(@NotNull final GuiEditor editor){
myRootElement=new Object();
myRootElement=new Object() {
@Override
public String toString() {
return "root of component tree structure " + ComponentTreeStructure.this.toString();
}
};
myEditor=editor;
}
@@ -181,7 +181,7 @@ public class XsltSymbolIndex extends FileBasedIndexExtension<String, XsltSymbolI
@Override
public void addAttribute(String key, String nsPrefix, String nsURI, String value, String type) throws Exception {
if (key.equals("name") && (nsURI == null || nsURI.length() == 0)) {
if (key.equals("name") && (nsURI == null || nsURI.length() == 0) && value != null) {
if (myMap.put(value, myKind) != null) {
myMap.put(value, Kind.ANYTHING);
}