import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.UIBundle;
+import com.intellij.util.Consumer;
import com.intellij.util.ui.update.LazyUiDisposable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
fileChooserDescriptor.setDescription(myDescription);
}
VirtualFile initialFile = getInitialFile();
- VirtualFile[] files = doChoose(fileChooserDescriptor, initialFile);
- if (files != null && files.length != 0) {
- onFileChoosen(files[0]);
- }
+
+ FileChooser.chooseFilesWithSlideEffect(fileChooserDescriptor, myProject, initialFile, new Consumer<VirtualFile[]>() {
+ @Override
+ public void consume(VirtualFile[] virtualFiles) {
+ if (virtualFiles != null && virtualFiles.length > 0) {
+ onFileChoosen(virtualFiles[0]);
+ }
+ }
+ });
}
@Nullable
myAccessor.setText(myTextComponent.getChildComponent(), chosenFile.getPresentableUrl());
}
- private VirtualFile[] doChoose(FileChooserDescriptor fileChooserDescriptor, VirtualFile initialFile) {
- if (myProject == null) {
- return FileChooser.chooseFiles(myTextComponent, fileChooserDescriptor, initialFile);
- }
- else {
- return FileChooser.chooseFiles(myProject, fileChooserDescriptor, initialFile);
- }
- }
}
public final void requestFocus() {
import javax.swing.*;
import javax.swing.border.Border;
-import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
import java.awt.*;
*/
public class TreeComboBox extends JComboBox {
final static int INDENT = UIManager.getInt("Tree.leftChildIndent");
+ private TreeModel myTreeModel;
public TreeComboBox(@NotNull final TreeModel model) {
- setModel(new TreeModelWrapper(model));
+ myTreeModel = model;
+ setModel(new TreeModelWrapper(myTreeModel));
setRenderer(new TreeListCellRenderer(this, model));
- setSelectedIndex(0);
if (SystemInfo.isMac) setMaximumRowCount(25);
}
+ public TreeModel getTreeModel() {
+ return myTreeModel;
+ }
+
private static class TreeListCellRenderer extends JLabel implements ListCellRenderer {
private static final Border SELECTION_PAINTER = (Border)UIManager.get("MenuItem.selectedBackgroundPainter");
import com.intellij.openapi.components.impl.stores.IProjectStore;
import com.intellij.openapi.project.Project;
+import com.intellij.util.messages.Topic;
import org.jetbrains.annotations.NotNull;
public interface ProjectEx extends Project {
+ interface ProjectSaved {
+ Topic<ProjectSaved> TOPIC = Topic.create("SaveProjectTopic", ProjectSaved.class, Topic.BroadcastDirection.NONE);
+ void saved(@NotNull final Project project);
+ }
@NotNull
IProjectStore getStateStore();
import org.picocontainer.defaults.ConstructorInjectionComponentAdapter;
import java.io.IOException;
-import java.text.MessageFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
LOG.info("Error saving project", e);
} finally {
mySavingInProgress.set(false);
+ ApplicationManager.getApplication().getMessageBus().syncPublisher(ProjectSaved.TOPIC).saved(this);
}
}
}
if (mySheetCallback != null) {
final Window activeWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
- if (activeWindow != null && activeWindow instanceof Frame) {
- final String frameTitle = ((Frame)activeWindow).getTitle();
+ if (activeWindow != null) {
+ String activeWindowTitle = null;
+ if (activeWindow instanceof Frame) {
+ activeWindowTitle = ((Frame)activeWindow).getTitle();
+ } else if (activeWindow instanceof JDialog) {
+ activeWindowTitle = ((JDialog)activeWindow).getTitle();
+ }
+ if (activeWindowTitle == null || activeWindowTitle.length() == 0) return;
final ID sharedApplication = invoke("NSApplication", "sharedApplication");
final ID windows = invoke(sharedApplication, "windows");
final ID windowTitle = invoke(window, "title");
final String titleString = Foundation.toStringViaUTF8(windowTitle);
- if (titleString.equals(frameTitle)) focusedWindow = window;
+ if (titleString.equals(activeWindowTitle)) {
+ focusedWindow = window;
+ break;
+ }
}
if (focusedWindow != null) {
text="Add Test Notification"/>
<action id="TestMessageBoxAction" internal="true" class="com.intellij.diagnostic.TestMessageBoxAction" text="Show Test Dialog"/>
<separator/>
+ <action id="FocusDebugger" internal="true" class="com.intellij.internal.focus.FocusDebuggerAction" text="Start Focus Debugger"/>
+ <action id="UiInspector" internal="true" class="com.intellij.internal.inspector.UiInspectorAction" text="UI Inspector"/>
+ <separator/>
<reference ref="MaintenanceGroup"/>
-
+
<add-to-group group-id="ToolsMenu" anchor="last"/>
</group>
<separator/>
<action id="GenerateVisitorByHierarchy" internal="true" class="com.intellij.internal.GenerateVisitorByHierarchyAction" text="Generate Hierarchy Visitor"/>
<separator/>
- <action id="FocusDebugger" internal="true" class="com.intellij.internal.focus.FocusDebuggerAction" text="Start Focus Debugger"/>
- <action id="UiInspector" internal="true" class="com.intellij.internal.inspector.UiInspectorAction" text="UI Inspector"/>
- <separator/>
<action id="DumpLookupElementWeights" internal="true" class="com.intellij.internal.DumpLookupElementWeights" text="Dump lookup element weights"/>
<action id="CheckVfsSanity" internal="true" class="com.intellij.openapi.vfs.newvfs.persistent.CheckSanityAction" text="Check VFS sanity"/>