com.intellij.openapi.actionSystem.DataKeys



Project JetBrains/intellij-community in file ...i.roots.ui.configuration.ContentEntriesEditor.java (2007-11-12)
@@ -5,6 +5,7 @@ import com.intellij.ide.util.JavaUtil;
 import com.intellij.ide.util.projectWizard.ToolbarPanel;
 import com.intellij.openapi.Disposable;
 import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.actionSystem.DataKeys;
 import com.intellij.openapi.actionSystem.DefaultActionGroup;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.fileChooser.FileChooser;
@@ -438,7 +439,7 @@ public class ContentEntriesEditor extends ModuleElementsEditor {
           validateContentEntriesCandidates(files);
         }
       };
-      myDescriptor.setContextModule(getModule());
+      myDescriptor.putUserData(DataKeys.MODULE_CONTEXT, getModule());
       myDescriptor.setTitle(ProjectBundle.message("module.paths.add.content.title"));
       myDescriptor.setDescription(ProjectBundle.message("module.paths.add.content.prompt"));
     }
Project JetBrains/intellij-community in file ...om.intellij.ide.navigationToolbar.NavBarModel.java (2007-08-18)
@@ -9,6 +9,7 @@ import com.intellij.ide.IdeBundle;
 import com.intellij.lang.StdLanguages;
 import com.intellij.openapi.actionSystem.DataConstants;
 import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.actionSystem.DataKeys;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModuleManager;
 import com.intellij.openapi.module.ModuleUtil;
@@ -89,7 +90,7 @@ public class NavBarModel {
       return updateModel(psiElement);
     }
     else {
-      final Module module = (Module)dataContext.getData(DataConstants.MODULE_CONTEXT);
+      final Module module = DataKeys.MODULE_CONTEXT.getData(dataContext);
       if (module != null) {
         if (size() == 1 && getElement(0) == module) { //no need to update
           return false;
Project JetBrains/intellij-community in file ...5/ui.impl.com.intellij.ide.macro.MacroManager.java (2007-08-18)
@@ -6,6 +6,7 @@ import com.intellij.ide.IdeEventQueue;
 import com.intellij.ide.impl.DataManagerImpl;
 import com.intellij.openapi.actionSystem.DataConstants;
 import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.actionSystem.DataKeys;
 import com.intellij.openapi.components.ServiceManager;
 import com.intellij.openapi.fileEditor.FileEditor;
 import com.intellij.openapi.fileEditor.FileEditorManager;
@@ -90,7 +91,7 @@ public final class MacroManager {
 
   private static DataContext getCorrectContext(DataContext dataContext) {
     if (dataContext.getData(DataConstants.FILE_EDITOR) != null) return dataContext;
-    Project project = (Project)dataContext.getData(DataConstants.PROJECT);
+    Project project = DataKeys.PROJECT.getData(dataContext);
     if (project == null) return dataContext;
     FileEditorManager editorManager = FileEditorManager.getInstance(project);
     VirtualFile[] files = editorManager.getSelectedFiles();
Project JetBrains/intellij-community in file ...pl.com.intellij.openapi.wm.impl.WindowWatcher.java (2007-08-18)
@@ -2,6 +2,7 @@ package com.intellij.openapi.wm.impl;
 
 import com.intellij.ide.DataManager;
 import com.intellij.openapi.actionSystem.DataConstants;
+import com.intellij.openapi.actionSystem.DataKeys;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
@@ -68,7 +69,7 @@ public final class WindowWatcher implements PropertyChangeListener{
         myWindow2Info.put(window,new WindowInfo(window, true));
       }
       myFocusedWindow=window;
-      final Project project = (Project)DataManager.getInstance().getDataContext(myFocusedWindow).getData(DataConstants.PROJECT);
+      final Project project = DataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(myFocusedWindow));
       for (Iterator i = myFocusedWindows.iterator(); i.hasNext();) {
         final Window w = (Window)i.next();
         if (project==DataManager.getInstance().getDataContext(w).getData(DataConstants.PROJECT)) {
Project JetBrains/intellij-community in file ...ion.junit2.configuration.CommonJavaParameters.java (2007-11-12)
@@ -2,6 +2,7 @@ package com.intellij.execution.junit2.configuration;
 
 import com.intellij.execution.ExecutionBundle;
 import com.intellij.execution.RunJavaConfiguration;
+import com.intellij.openapi.actionSystem.DataKeys;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.fileChooser.FileChooser;
 import com.intellij.openapi.fileChooser.FileChooserDescriptor;
@@ -43,9 +44,9 @@ public class CommonJavaParameters extends JPanel {
       public void actionPerformed(ActionEvent e) {
         FileChooserDescriptor fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
         fileChooserDescriptor.setTitle(ExecutionBundle.message("select.working.directory.message"));
-        fileChooserDescriptor.setContextModule(myModule);
+        fileChooserDescriptor.putUserData(DataKeys.MODULE_CONTEXT, myModule);
         VirtualFile[] files = FileChooser.chooseFiles(myWorkingDirectory, fileChooserDescriptor);
-        if (files != null && files.length != 0) {
+        if (files.length != 0) {
           setText(RunJavaConfiguration.WORKING_DIRECTORY_PROPERTY, files[0].getPresentableUrl());
         }
       }