diff --git a/.idea/ant.xml b/.idea/ant.xml
index 2581ca3fe84c..2debdc230402 100644
--- a/.idea/ant.xml
+++ b/.idea/ant.xml
@@ -2,6 +2,14 @@
+
+
+
+
+
+
+
+
diff --git a/build.txt b/build.txt
index bc0a1e4cdb1f..eb14fd6d4b05 100644
--- a/build.txt
+++ b/build.txt
@@ -1 +1 @@
-112.SNAPSHOT
+114.SNAPSHOT
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java
index 4294ffb81e7b..b259f4fe85a9 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerSessionTab.java
@@ -45,7 +45,6 @@ import com.intellij.execution.ui.ExecutionConsoleEx;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.execution.ui.actions.CloseAction;
import com.intellij.execution.ui.layout.PlaceInGrid;
-import com.intellij.ide.CommonActionsManager;
import com.intellij.ide.actions.ContextHelpAction;
import com.intellij.idea.ActionsBundle;
import com.intellij.openapi.Disposable;
@@ -76,7 +75,6 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.ui.DebuggerSessionTab");
private static final Icon WATCH_RETURN_VALUES_ICON = IconLoader.getIcon("/debugger/watchLastReturnValue.png");
- private static final Icon FILTER_STACK_FRAMES_ICON = IconLoader.getIcon("/debugger/class_filter.png");
private static final Icon AUTO_VARS_ICONS = IconLoader.getIcon("/debugger/autoVariablesMode.png");
private final VariablesPanel myVariablesPanel;
@@ -139,6 +137,8 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
stepping.add(actionManager.getAction(DebuggerActions.POP_FRAME));
stepping.addSeparator();
stepping.add(actionManager.getAction(DebuggerActions.RUN_TO_CURSOR));
+ stepping.addSeparator();
+ stepping.add(actionManager.getAction(DebuggerActions.EVALUATE_EXPRESSION));
myUi.getOptions().setTopToolbar(stepping, ActionPlaces.DEBUGGER_TOOLBAR);
@@ -153,11 +153,6 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
XDebuggerUIConstants.WATCHES_TAB_ICON, null);
watches.setCloseable(false);
watches.setAlertIcon(breakpointAlert);
- final DefaultActionGroup watchesGroup = new DefaultActionGroup();
- addAction(watchesGroup, DebuggerActions.NEW_WATCH);
- addAction(watchesGroup, XDebuggerActions.ADD_TO_WATCH);
- addAction(watchesGroup, DebuggerActions.REMOVE_WATCH);
- watches.setActions(watchesGroup, ActionPlaces.DEBUGGER_TOOLBAR, myWatchPanel.getTree());
myUi.addContent(watches, 0, PlaceInGrid.right, false);
// frames
@@ -166,14 +161,6 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
framesContent.setCloseable(false);
framesContent.setAlertIcon(breakpointAlert);
- final DefaultActionGroup framesGroup = new DefaultActionGroup();
-
- CommonActionsManager actionsManager = CommonActionsManager.getInstance();
- framesGroup.add(actionsManager.createPrevOccurenceAction(myFramesPanel.getOccurenceNavigator()));
- framesGroup.add(actionsManager.createNextOccurenceAction(myFramesPanel.getOccurenceNavigator()));
- framesGroup.add(new ShowLibraryFramesAction());
-
- framesContent.setActions(framesGroup, ActionPlaces.DEBUGGER_TOOLBAR, myFramesPanel.getFramesList());
myUi.addContent(framesContent, 0, PlaceInGrid.left, false);
// variables
@@ -183,11 +170,6 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
XDebuggerUIConstants.VARIABLES_TAB_ICON, null);
vars.setCloseable(false);
vars.setAlertIcon(breakpointAlert);
- final DefaultActionGroup varsGroup = new DefaultActionGroup();
- addAction(varsGroup, DebuggerActions.EVALUATE_EXPRESSION);
- varsGroup.add(new WatchLastMethodReturnValueAction());
- varsGroup.add(new AutoVarsSwitchAction());
- vars.setActions(varsGroup, ActionPlaces.DEBUGGER_TOOLBAR, myVariablesPanel.getTree());
myUi.addContent(vars, 0, PlaceInGrid.center, false);
// threads
@@ -316,14 +298,16 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
addAction(group, DebuggerActions.DUMP_THREADS);
group.addSeparator();
- final AnAction[] layout = myUi.getOptions().getLayoutActionsList();
- final AnAction layoutGroup = myUi.getOptions().getLayoutActions();
+ group.add(myUi.getOptions().getLayoutActions());
+
+ final AnAction[] commonSettings = myUi.getOptions().getSettingsActionsList();
+ final AnAction commonSettingsList = myUi.getOptions().getSettingsActions();
final DefaultActionGroup settings = new DefaultActionGroup("DebuggerSettings", true) {
@Override
public void update(AnActionEvent e) {
e.getPresentation().setText(ActionsBundle.message("group.XDebugger.settings.text"));
- e.getPresentation().setIcon(layoutGroup.getTemplatePresentation().getIcon());
+ e.getPresentation().setIcon(commonSettingsList.getTemplatePresentation().getIcon());
}
@Override
@@ -331,12 +315,15 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
return true;
}
};
- for (AnAction each : layout) {
+ for (AnAction each : commonSettings) {
settings.add(each);
}
- if (layout.length > 0) {
+ if (commonSettings.length > 0) {
settings.addSeparator();
}
+ settings.add(new WatchLastMethodReturnValueAction());
+ settings.add(new AutoVarsSwitchAction());
+ settings.addSeparator();
addActionToGroup(settings, XDebuggerActions.AUTO_TOOLTIP);
group.add(settings);
@@ -571,34 +558,6 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
}
}
- private class ShowLibraryFramesAction extends ToggleAction {
- private volatile boolean myShouldShow;
- private static final String ourTextWhenShowIsOn = "Hide Frames from Libraries";
- private static final String ourTextWhenShowIsOff = "Show All Frames";
-
- public ShowLibraryFramesAction() {
- super("", "", FILTER_STACK_FRAMES_ICON);
- myShouldShow = DebuggerSettings.getInstance().SHOW_LIBRARY_STACKFRAMES;
- }
-
- public void update(final AnActionEvent e) {
- super.update(e);
- final Presentation presentation = e.getPresentation();
- final boolean shouldShow = !(Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
- presentation.setText(shouldShow ? ourTextWhenShowIsOn : ourTextWhenShowIsOff);
- }
-
- public boolean isSelected(AnActionEvent e) {
- return !myShouldShow;
- }
-
- public void setSelected(AnActionEvent e, boolean enabled) {
- myShouldShow = !enabled;
- DebuggerSettings.getInstance().SHOW_LIBRARY_STACKFRAMES = myShouldShow;
- myFramesPanel.setShowLibraryFrames(myShouldShow);
- }
- }
-
private class WatchLastMethodReturnValueAction extends ToggleAction {
private volatile boolean myWatchesReturnValues;
private final String myTextEnable;
@@ -606,7 +565,7 @@ public class DebuggerSessionTab extends DebuggerSessionTabBase implements Dispos
private final String myMyTextDisable;
public WatchLastMethodReturnValueAction() {
- super("", DebuggerBundle.message("action.watch.method.return.value.description"), WATCH_RETURN_VALUES_ICON);
+ super("", DebuggerBundle.message("action.watch.method.return.value.description"), null);
myWatchesReturnValues = DebuggerSettings.getInstance().WATCH_RETURN_VALUES;
myTextEnable = DebuggerBundle.message("action.watches.method.return.value.enable");
myMyTextDisable = DebuggerBundle.message("action.watches.method.return.value.disable");
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/FramesPanel.java b/java/debugger/impl/src/com/intellij/debugger/ui/FramesPanel.java
index ba0dda3c046e..bcde86b2c743 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/FramesPanel.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/FramesPanel.java
@@ -41,22 +41,25 @@ import com.intellij.debugger.ui.impl.watch.MethodsTracker;
import com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl;
import com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl;
import com.intellij.debugger.ui.tree.render.DescriptorLabelListener;
+import com.intellij.ide.CommonActionsManager;
import com.intellij.ide.OccurenceNavigator;
import com.intellij.openapi.Disposable;
-import com.intellij.openapi.actionSystem.ActionManager;
-import com.intellij.openapi.actionSystem.ActionPopupMenu;
-import com.intellij.openapi.actionSystem.DefaultActionGroup;
+import com.intellij.openapi.actionSystem.*;
+import com.intellij.openapi.actionSystem.impl.ActionToolbarImpl;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ComboBoxWithWidePopup;
import com.intellij.openapi.util.Disposer;
+import com.intellij.openapi.util.IconLoader;
import com.intellij.ui.PopupHandler;
import com.intellij.ui.ScrollPaneFactory;
+import com.intellij.ui.components.panels.Wrapper;
import com.intellij.util.Alarm;
import com.sun.jdi.ObjectCollectedException;
import com.sun.jdi.VMDisconnectedException;
import javax.swing.*;
+import javax.swing.border.EmptyBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
@@ -71,6 +74,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
public class FramesPanel extends UpdatableDebuggerView {
+ private static final Icon FILTER_STACK_FRAMES_ICON = IconLoader.getIcon("/debugger/class_filter.png");
+
private final JComboBox myThreadsCombo;
private final FramesList myFramesList;
private final ThreadsListener myThreadsListener;
@@ -106,10 +111,31 @@ public class FramesPanel extends UpdatableDebuggerView {
registerThreadsPopupMenu(myFramesList);
setBorder(null);
- add(myThreadsCombo, BorderLayout.NORTH);
+
+ final ActionToolbar toolbar = createToolbar();
+ Wrapper threads = new Wrapper();
+ threads.add(toolbar.getComponent(), BorderLayout.EAST);
+ threads.add(myThreadsCombo, BorderLayout.CENTER);
+ add(threads, BorderLayout.NORTH);
add(ScrollPaneFactory.createScrollPane(myFramesList), BorderLayout.CENTER);
}
+ private ActionToolbar createToolbar() {
+ final DefaultActionGroup framesGroup = new DefaultActionGroup();
+ framesGroup.addSeparator();
+
+ CommonActionsManager actionsManager = CommonActionsManager.getInstance();
+ framesGroup.add(actionsManager.createPrevOccurenceAction(getOccurenceNavigator()));
+ framesGroup.add(actionsManager.createNextOccurenceAction(getOccurenceNavigator()));
+ framesGroup.add(new ShowLibraryFramesAction());
+
+ final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, framesGroup, true);
+ toolbar.setReservePlaceAutoPopupIcon(false);
+ ((ActionToolbarImpl)toolbar).setAddSeparatorFirst(true);
+ toolbar.getComponent().setBorder(new EmptyBorder(1, 0, 0, 0));
+ return toolbar;
+ }
+
public DebuggerStateManager getContextManager() {
return myStateManager;
}
@@ -630,4 +656,32 @@ public class FramesPanel extends UpdatableDebuggerView {
public FramesList getFramesList() {
return myFramesList;
}
+
+ private class ShowLibraryFramesAction extends ToggleAction {
+ private volatile boolean myShouldShow;
+ private static final String ourTextWhenShowIsOn = "Hide Frames from Libraries";
+ private static final String ourTextWhenShowIsOff = "Show All Frames";
+
+ public ShowLibraryFramesAction() {
+ super("", "", FILTER_STACK_FRAMES_ICON);
+ myShouldShow = DebuggerSettings.getInstance().SHOW_LIBRARY_STACKFRAMES;
+ }
+
+ public void update(final AnActionEvent e) {
+ super.update(e);
+ final Presentation presentation = e.getPresentation();
+ final boolean shouldShow = !(Boolean)presentation.getClientProperty(SELECTED_PROPERTY);
+ presentation.setText(shouldShow ? ourTextWhenShowIsOn : ourTextWhenShowIsOff);
+ }
+
+ public boolean isSelected(AnActionEvent e) {
+ return !myShouldShow;
+ }
+
+ public void setSelected(AnActionEvent e, boolean enabled) {
+ myShouldShow = !enabled;
+ DebuggerSettings.getInstance().SHOW_LIBRARY_STACKFRAMES = myShouldShow;
+ setShowLibraryFrames(myShouldShow);
+ }
+ }
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/MainWatchPanel.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/MainWatchPanel.java
index 08a719fdd627..314e360d2442 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/MainWatchPanel.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/MainWatchPanel.java
@@ -20,20 +20,20 @@
*/
package com.intellij.debugger.ui.impl;
+import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.actions.AddToWatchActionHandler;
import com.intellij.debugger.actions.DebuggerActions;
import com.intellij.debugger.engine.evaluation.CodeFragmentKind;
+import com.intellij.debugger.engine.evaluation.DefaultCodeFragmentFactory;
import com.intellij.debugger.engine.evaluation.TextWithImports;
import com.intellij.debugger.engine.evaluation.TextWithImportsImpl;
-import com.intellij.debugger.engine.evaluation.DefaultCodeFragmentFactory;
import com.intellij.debugger.impl.DebuggerContextImpl;
import com.intellij.debugger.impl.DebuggerStateManager;
import com.intellij.debugger.impl.PositionUtil;
import com.intellij.debugger.ui.DebuggerExpressionComboBox;
-import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
import com.intellij.debugger.ui.impl.watch.DebuggerTreeInplaceEditor;
+import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
import com.intellij.debugger.ui.impl.watch.WatchItemDescriptor;
-import com.intellij.debugger.DebuggerBundle;
import com.intellij.ide.DataManager;
import com.intellij.ide.dnd.DnDEvent;
import com.intellij.ide.dnd.DnDManager;
@@ -43,7 +43,10 @@ import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
+import com.intellij.ui.AnActionButton;
+import com.intellij.ui.AnActionButtonRunnable;
import com.intellij.ui.ListenerUtil;
+import com.intellij.ui.ToolbarDecorator;
import javax.swing.*;
import java.awt.*;
@@ -205,4 +208,35 @@ public class MainWatchPanel extends WatchPanel implements DataProvider {
};
editor.show();
}
+
+ @Override
+ protected JComponent createTreePanel(final WatchDebuggerTree tree) {
+ final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(tree);
+ decorator.setAddAction(new AnActionButtonRunnable() {
+ @Override
+ public void run(AnActionButton button) {
+ executeAction(DebuggerActions.NEW_WATCH, tree);
+ }
+ });
+ // TODO[den]: add "Add to watches action"
+ decorator.setRemoveAction(new AnActionButtonRunnable() {
+ @Override
+ public void run(AnActionButton button) {
+ executeAction(DebuggerActions.REMOVE_WATCH, tree);
+ }
+ });
+ final JPanel panel = decorator.createPanel();
+ panel.setBorder(null);
+ return panel;
+ }
+
+ private static void executeAction(final String watch, final WatchDebuggerTree tree) {
+ AnAction action = ActionManager.getInstance().getAction(watch);
+ Presentation presentation = action.getTemplatePresentation().clone();
+ DataContext context = DataManager.getInstance().getDataContext(tree);
+
+ AnActionEvent actionEvent =
+ new AnActionEvent(null, context, ActionPlaces.DEBUGGER_TOOLBAR, presentation, ActionManager.getInstance(), 0);
+ action.actionPerformed(actionEvent);
+ }
}
diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/WatchPanel.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/WatchPanel.java
index 3823e5d312fb..8d9cefcb25f7 100644
--- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/WatchPanel.java
+++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/WatchPanel.java
@@ -35,6 +35,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.ui.ScrollPaneFactory;
import org.jetbrains.annotations.NonNls;
+import javax.swing.*;
import java.awt.*;
import java.util.Enumeration;
@@ -43,11 +44,15 @@ public abstract class WatchPanel extends DebuggerTreePanel {
public WatchPanel(Project project, DebuggerStateManager stateManager) {
super(project, stateManager);
- add(ScrollPaneFactory.createScrollPane(getWatchTree()), BorderLayout.CENTER);
+ add(createTreePanel(getWatchTree()), BorderLayout.CENTER);
registerDisposable(DebuggerAction.installEditAction(getWatchTree(), DebuggerActions.EDIT_NODE_SOURCE));
overrideShortcut(getWatchTree(), DebuggerActions.COPY_VALUE, CommonShortcuts.getCopy());
}
+ protected JComponent createTreePanel(final WatchDebuggerTree tree) {
+ return ScrollPaneFactory.createScrollPane(tree);
+ }
+
protected DebuggerTree createTreeView() {
return new WatchDebuggerTree(getProject());
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsManagerImpl.java b/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsManagerImpl.java
index ab6284cc9eb3..b86759580bca 100644
--- a/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsManagerImpl.java
+++ b/java/java-impl/src/com/intellij/codeInsight/ExternalAnnotationsManagerImpl.java
@@ -65,7 +65,7 @@ import com.intellij.psi.xml.XmlDocument;
import com.intellij.psi.xml.XmlFile;
import com.intellij.psi.xml.XmlTag;
import com.intellij.util.*;
-import com.intellij.util.containers.ConcurrentWeakHashMap;
+import com.intellij.util.containers.ConcurrentWeakValueHashMap;
import com.intellij.util.messages.MessageBusConnection;
import com.intellij.util.ui.OptionsMessageDialog;
import org.jetbrains.annotations.NonNls;
@@ -78,18 +78,19 @@ import java.awt.event.ActionEvent;
import java.io.IOException;
import java.util.*;
import java.util.List;
+import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicReference;
public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
- public static final Icon ICON = IconLoader.getIcon("/modules/annotation.png");
+ @NotNull public static final Icon ICON = IconLoader.getIcon("/modules/annotation.png");
private static final Logger LOG = Logger.getInstance("#" + ExternalAnnotationsManagerImpl.class.getName());
- private final Map> myExternalAnnotations = new ConcurrentWeakHashMap>();
- private final AtomicReference myHasAnyAnnotationsRoots = new AtomicReference(ThreeState.UNSURE);
- private static final List NULL = new ArrayList();
+ @NotNull private final ConcurrentMap> myExternalAnnotations = new ConcurrentWeakValueHashMap>();
+ @NotNull private final AtomicReference myHasAnyAnnotationsRoots = new AtomicReference(ThreeState.UNSURE);
+ @NotNull private static final List NULL = new ArrayList();
private final PsiManager myPsiManager;
- public ExternalAnnotationsManagerImpl(final Project project, final PsiManager psiManager) {
+ public ExternalAnnotationsManagerImpl(@NotNull final Project project, final PsiManager psiManager) {
myPsiManager = psiManager;
final MessageBusConnection connection = project.getMessageBus().connect(project);
connection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() {
@@ -132,7 +133,7 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
}
@NotNull
- private Map collectExternalAnnotations(final PsiModifierListOwner listOwner) {
+ private Map collectExternalAnnotations(@NotNull final PsiModifierListOwner listOwner) {
if (hasAnyAnnotationsRoots() == ThreeState.NO) return Collections.emptyMap();
final Map result = new HashMap();
final List files = findExternalAnnotationsFile(listOwner);
@@ -179,6 +180,7 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
return result;
}
+ @Nullable
private static String getExternalName(PsiModifierListOwner listOwner, boolean showParamName) {
return PsiFormatUtil.getExternalName(listOwner, showParamName, Integer.MAX_VALUE);
}
@@ -222,9 +224,14 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
}
}
- private void setupRootAndAnnotateExternally(final OrderEntry entry, final Project project, final PsiModifierListOwner listOwner,
- final String annotationFQName,
- final PsiFile fromFile, final String packageName, final VirtualFile virtualFile, final PsiNameValuePair[] value) {
+ private void setupRootAndAnnotateExternally(@NotNull final OrderEntry entry,
+ @NotNull Project project,
+ @NotNull final PsiModifierListOwner listOwner,
+ @NotNull final String annotationFQName,
+ @NotNull final PsiFile fromFile,
+ @NotNull final String packageName,
+ @NotNull final VirtualFile virtualFile,
+ final PsiNameValuePair[] value) {
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
descriptor.setTitle(ProjectBundle.message("external.annotations.root.chooser.title", entry.getPresentableName()));
descriptor.setDescription(ProjectBundle.message("external.annotations.root.chooser.description"));
@@ -245,7 +252,10 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
if (annotationsXml != null) {
final List createdFiles = new ArrayList();
createdFiles.add(annotationsXml);
- myExternalAnnotations.put(getFQN(packageName, virtualFile), createdFiles);
+ String fqn = getFQN(packageName, virtualFile);
+ if (fqn != null) {
+ myExternalAnnotations.put(fqn, createdFiles);
+ }
}
annotateExternally(listOwner, annotationFQName, annotationsXml, fromFile, value);
}
@@ -253,20 +263,25 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
}.execute();
}
- private void chooseRootAndAnnotateExternally(final PsiModifierListOwner listOwner, final String annotationFQName, @NotNull final PsiFile fromFile,
- final Project project, final String packageName, final VirtualFile virtualFile,
- final VirtualFile[] virtualFiles, final PsiNameValuePair[] value) {
+ private void chooseRootAndAnnotateExternally(@NotNull final PsiModifierListOwner listOwner,
+ @NotNull final String annotationFQName,
+ @NotNull final PsiFile fromFile,
+ @NotNull final Project project,
+ @NotNull final String packageName,
+ final VirtualFile virtualFile,
+ @NotNull VirtualFile[] virtualFiles,
+ final PsiNameValuePair[] value) {
if (virtualFiles.length > 1) {
JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep("Annotation Roots", virtualFiles) {
@Override
- public PopupStep onChosen(final VirtualFile file, final boolean finalChoice) {
+ public PopupStep onChosen(@NotNull final VirtualFile file, final boolean finalChoice) {
annotateExternally(file, listOwner, project, packageName, virtualFile, annotationFQName, fromFile, value);
return FINAL_CHOICE;
}
@NotNull
@Override
- public String getTextFor(final VirtualFile value) {
+ public String getTextFor(@NotNull final VirtualFile value) {
return value.getPresentableUrl();
}
@@ -292,8 +307,8 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
return VfsUtil.toVirtualFileArray(result);
}
- private void annotateExternally(final VirtualFile file, final PsiModifierListOwner listOwner, final Project project,
- final String packageName,
+ private void annotateExternally(@NotNull final VirtualFile file, @NotNull final PsiModifierListOwner listOwner, final Project project,
+ @NotNull final String packageName,
final VirtualFile virtualFile,
final String annotationFQName,
@NotNull final PsiFile fromFile,
@@ -371,6 +386,7 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
return false;
}
+ @NotNull
public AnnotationPlace chooseAnnotationsPlace(@NotNull final PsiElement element) {
if (!element.isPhysical()) return AnnotationPlace.IN_CODE; //element just created
if (!element.getManager().isInProject(element)) return AnnotationPlace.EXTERNAL;
@@ -432,7 +448,7 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
return AnnotationPlace.IN_CODE;
}
- private void appendChosenAnnotationsRoot(final OrderEntry entry, final VirtualFile vFile) {
+ private void appendChosenAnnotationsRoot(@NotNull final OrderEntry entry, @NotNull final VirtualFile vFile) {
if (entry instanceof LibraryOrderEntry) {
Library library = ((LibraryOrderEntry)entry).getLibrary();
LOG.assertTrue(library != null);
@@ -459,7 +475,8 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
private static void annotateExternally(final PsiModifierListOwner listOwner,
final String annotationFQName,
@Nullable final XmlFile xmlFile,
- @NotNull PsiFile codeUsageFile, PsiNameValuePair[] values) {
+ @NotNull PsiFile codeUsageFile,
+ PsiNameValuePair[] values) {
if (xmlFile == null) return;
try {
final XmlDocument document = xmlFile.getDocument();
@@ -498,13 +515,14 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
}
@NonNls
- private static String createAnnotationTag(String annotationFQName, PsiNameValuePair[] values) {
+ private static String createAnnotationTag(String annotationFQName, @Nullable PsiNameValuePair[] values) {
@NonNls String text;
if (values != null) {
text = " \n";
text += StringUtil.join(values, new Function() {
+ @NotNull
@Override
- public String fun(PsiNameValuePair pair) {
+ public String fun(@NotNull PsiNameValuePair pair) {
if (pair.getName() != null) {
return "";
}
@@ -520,7 +538,7 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
}
@Nullable
- private XmlFile createAnnotationsXml(VirtualFile root, @NonNls @NotNull String packageName) {
+ private XmlFile createAnnotationsXml(@NotNull VirtualFile root, @NonNls @NotNull String packageName) {
final String[] dirs = packageName.split("[\\.]");
for (String dir : dirs) {
if (dir.isEmpty()) break;
@@ -564,6 +582,7 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
final String packageName = javaFile.getPackageName();
final VirtualFile virtualFile = containingFile.getVirtualFile();
String fqn = getFQN(packageName, virtualFile);
+ if (fqn == null) return null;
final List files = myExternalAnnotations.get(fqn);
if (files == NULL) return null;
if (files != null) {
@@ -611,7 +630,7 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
}
@Nullable
- private static String getNormalizedExternalName(PsiModifierListOwner owner) {
+ private static String getNormalizedExternalName(@NotNull PsiModifierListOwner owner) {
String externalName = getExternalName(owner, true);
if (externalName != null) {
if (owner instanceof PsiParameter && owner.getParent() instanceof PsiParameterList) {
@@ -657,10 +676,12 @@ public class ExternalAnnotationsManagerImpl extends ExternalAnnotationsManager {
return ADD_IN_CODE;
}
+ @NotNull
protected String getCancelActionName() {
return CommonBundle.getCancelButtonText();
}
+ @NotNull
@SuppressWarnings({"NonStaticInitializer"})
protected Action[] createActions() {
final Action okAction = getOKAction();
diff --git a/java/java-impl/src/com/intellij/refactoring/actions/RenameFileAction.java b/java/java-impl/src/com/intellij/refactoring/actions/RenameFileAction.java
index 1e0008cb867d..1a3244595e6d 100644
--- a/java/java-impl/src/com/intellij/refactoring/actions/RenameFileAction.java
+++ b/java/java-impl/src/com/intellij/refactoring/actions/RenameFileAction.java
@@ -27,7 +27,7 @@ import com.intellij.refactoring.rename.PsiElementRenameHandler;
* @author ven
*/
public class RenameFileAction extends AnAction implements DumbAware {
- public static final String RENAME_FILE = "Rename File";
+ public static final String RENAME_FILE = "Rename File...";
public void actionPerformed(final AnActionEvent e) {
final PsiFile file = e.getData(LangDataKeys.PSI_FILE);
@@ -47,7 +47,7 @@ public class RenameFileAction extends AnAction implements DumbAware {
presentation.setVisible(enabled);
if (enabled) {
presentation.setText(RENAME_FILE);
- presentation.setDescription(RENAME_FILE);
+ presentation.setDescription("Rename selected file");
}
}
}
diff --git a/jps/jps-builders/testSrc/org/jetbrains/ether/IncrementalTestCase.java b/jps/jps-builders/testSrc/org/jetbrains/ether/IncrementalTestCase.java
index 992c6883f1c7..a28814e37b73 100644
--- a/jps/jps-builders/testSrc/org/jetbrains/ether/IncrementalTestCase.java
+++ b/jps/jps-builders/testSrc/org/jetbrains/ether/IncrementalTestCase.java
@@ -15,7 +15,6 @@
*/
package org.jetbrains.ether;
-import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.SystemInfo;
@@ -31,7 +30,6 @@ import org.jetbrains.jps.Sdk;
import org.jetbrains.jps.api.CanceledStatus;
import org.jetbrains.jps.idea.IdeaProjectLoader;
import org.jetbrains.jps.incremental.*;
-import org.jetbrains.jps.incremental.java.JavaBuilder;
import org.jetbrains.jps.incremental.storage.BuildDataManager;
import org.jetbrains.jps.incremental.storage.ProjectTimestamps;
import org.jetbrains.jps.server.ClasspathBootstrap;
@@ -154,8 +152,12 @@ public abstract class IncrementalTestCase extends TestCase {
@Override
protected void tearDown() throws Exception {
- super.tearDown();
- delete(new File(workDir));
+ try {
+ super.tearDown();
+ }
+ finally {
+ delete(new File(workDir));
+ }
}
private String getProjectName() {
@@ -199,7 +201,7 @@ public abstract class IncrementalTestCase extends TestCase {
if (files != null) {
for (File f : files) {
- copy(f, new File(output.getPath() + File.separator + f.getName()));
+ copy(f, new File(output.getPath(), f.getName()));
}
}
}
@@ -208,16 +210,26 @@ public abstract class IncrementalTestCase extends TestCase {
}
}
else if (input.isFile()) {
- final FileReader in = new FileReader(input);
- final FileWriter out = new FileWriter(output);
+ FileReader in = null;
+ FileWriter out = null;
try {
+ in = new FileReader(input);
+ out = new FileWriter(output);
int c;
while ((c = in.read()) != -1) out.write(c);
}
finally {
- in.close();
- out.close();
+ try {
+ if (in != null) {
+ in.close();
+ }
+ }
+ finally {
+ if (out != null) {
+ out.close();
+ }
+ }
}
}
}
@@ -241,7 +253,7 @@ public abstract class IncrementalTestCase extends TestCase {
final String basename = pathSep == -1 ? postfix : postfix.substring(pathSep + 1);
final String path =
getWorkDir() + File.separator + (pathSep == -1 ? "src" : postfix.substring(0, pathSep).replace('-', File.separatorChar));
- final File output = new File(path + File.separator + basename);
+ final File output = new File(path, basename);
if (copy) {
copy(input, output);
@@ -275,7 +287,7 @@ public abstract class IncrementalTestCase extends TestCase {
final Sdk jdk = project.createSdk("JavaSDK", "IDEA jdk", System.getProperty("java.home"), null);
final List paths = new LinkedList();
-
+
paths.add(FileUtil.toSystemIndependentName(ClasspathBootstrap.getResourcePath(Object.class).getCanonicalPath()));
jdk.setClasspath(paths);
@@ -285,20 +297,32 @@ public abstract class IncrementalTestCase extends TestCase {
final ProjectDescriptor projectDescriptor =
new ProjectDescriptor(projectPath, project, new FSState(true), new ProjectTimestamps(projectName),
new BuildDataManager(projectName, true));
- final IncProjectBuilder builder = new IncProjectBuilder(projectDescriptor, BuilderRegistry.getInstance(), CanceledStatus.NULL);
+ try {
- builder.build(new AllProjectScope(project, true), false, true);
+ new IncProjectBuilder(
+ projectDescriptor, BuilderRegistry.getInstance(), CanceledStatus.NULL
+ ).build(
+ new AllProjectScope(project, true), false, true
+ );
- modify();
+ modify();
- if (SystemInfo.isUnix) {
- Thread.sleep(1000);
+ if (SystemInfo.isUnix) {
+ Thread.sleep(1000L);
+ }
+
+ new IncProjectBuilder(
+ projectDescriptor, BuilderRegistry.getInstance(), CanceledStatus.NULL
+ ).build(
+ new AllProjectScope(project, false), true, false
+ );
+
+ FileAssert.assertEquals(new File(getBaseDir() + ".log"), new File(getWorkDir() + ".log"));
+ }
+ finally {
+ projectDescriptor.release();
}
- builder.build(new AllProjectScope(project, false), true, false);
- projectDescriptor.release();
-
- FileAssert.assertEquals(new File(getBaseDir() + ".log"), new File(getWorkDir() + ".log"));
}
}
diff --git a/platform/core-impl/src/com/intellij/extapi/psi/StubBasedPsiElementBase.java b/platform/core-impl/src/com/intellij/extapi/psi/StubBasedPsiElementBase.java
index c38b1e3f54be..d854b6cbbd60 100644
--- a/platform/core-impl/src/com/intellij/extapi/psi/StubBasedPsiElementBase.java
+++ b/platform/core-impl/src/com/intellij/extapi/psi/StubBasedPsiElementBase.java
@@ -81,16 +81,14 @@ public class StubBasedPsiElementBase extends ASTDelegateP
final FileElement fileElement = file.loadTreeElement();
node = myNode;
if (node == null) {
- String message = new StringBuilder().
- append("Failed to bind stub to AST for element ").
- append(getClass()).
- append(" in ").
- append(file.getVirtualFile() == null ? "" : file.getVirtualFile().getPath()).
- append("\nFile stub tree:\n").
- append(stubTree != null ? StringUtil.trimLog(((PsiFileStubImpl)stubTree.getRoot()).printTree(), 1024) : " is null").
- append("\nLoaded file AST:\n").
- append(StringUtil.trimLog(DebugUtil.treeToString(fileElement, true), 1024)).
- toString();
+ String message = "Failed to bind stub to AST for element " +
+ getClass() +
+ " in " +
+ (file.getVirtualFile() == null ? "" : file.getVirtualFile().getPath()) +
+ "\nFile stub tree:\n" +
+ (stubTree != null ? StringUtil.trimLog(((PsiFileStubImpl)stubTree.getRoot()).printTree(), 1024) : " is null") +
+ "\nLoaded file AST:\n" +
+ StringUtil.trimLog(DebugUtil.treeToString(fileElement, true), 1024);
throw new IllegalArgumentException(message);
}
}
diff --git a/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/CoreJarHandler.java b/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/CoreJarHandler.java
index c2650490286c..4df4ce644252 100644
--- a/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/CoreJarHandler.java
+++ b/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/CoreJarHandler.java
@@ -25,30 +25,40 @@ import java.util.Map;
* @author yole
*/
public class CoreJarHandler extends JarHandlerBase {
- private final Map myFileMap = new HashMap();
+
private final CoreJarFileSystem myFileSystem;
+ private final VirtualFile myRoot;
public CoreJarHandler(CoreJarFileSystem fileSystem, String path) {
super(path);
myFileSystem = fileSystem;
+
+ Map entries = new HashMap();
+
+ for (EntryInfo info : getEntriesMap().values()) {
+ getOrCreateFile(info, entries);
+ }
+
+ myRoot = getOrCreateFile(getEntryInfo(""), entries);
+ }
+
+ private CoreJarVirtualFile getOrCreateFile(EntryInfo info, Map entries) {
+ CoreJarVirtualFile answer = entries.get(info);
+ if (answer == null) {
+ EntryInfo parentEntry = info.parent;
+ answer = new CoreJarVirtualFile(this, info, parentEntry != null ? getOrCreateFile(parentEntry, entries) : null);
+ entries.put(info, answer);
+ }
+
+ return answer;
}
@Nullable
public VirtualFile findFileByPath(String pathInJar) {
- if (getZip() == null) {
- return null;
- }
- VirtualFile file = myFileMap.get(pathInJar);
- if (file == null) {
- if (pathInJar.length() > 0) {
- EntryInfo entryInfo = getEntryInfo(pathInJar);
- if (entryInfo == null) {
- return null;
- }
- }
- file = new CoreJarVirtualFile(myFileSystem, this, pathInJar);
- myFileMap.put(pathInJar, file);
- }
- return file;
+ return myRoot != null ? myRoot.findFileByRelativePath(pathInJar) : null;
+ }
+
+ public CoreJarFileSystem getFileSystem() {
+ return myFileSystem;
}
}
diff --git a/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/CoreJarVirtualFile.java b/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/CoreJarVirtualFile.java
index c2969d9edc09..e5ea5d2d4e68 100644
--- a/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/CoreJarVirtualFile.java
+++ b/platform/core-impl/src/com/intellij/openapi/vfs/impl/jar/CoreJarVirtualFile.java
@@ -23,44 +23,40 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
-import java.util.List;
/**
* @author yole
*/
public class CoreJarVirtualFile extends VirtualFile {
- private final CoreJarFileSystem myFileSystem;
private final CoreJarHandler myHandler;
- private final String myPathInJar;
private final VirtualFile myParent;
- private VirtualFile[] myChildren;
+ private final ArrayList myChildren = new ArrayList();
+ private final JarHandlerBase.EntryInfo myEntry;
- public CoreJarVirtualFile(CoreJarFileSystem fileSystem, CoreJarHandler handler, String pathInJar) {
- myFileSystem = fileSystem;
+ public CoreJarVirtualFile(CoreJarHandler handler, JarHandlerBase.EntryInfo entry, CoreJarVirtualFile parent) {
myHandler = handler;
- myPathInJar = pathInJar;
- myParent = calcParent();
+ myParent = parent;
+ myEntry = entry;
+
+ parent.myChildren.add(this);
}
@NotNull
@Override
public String getName() {
- final int lastSlash = myPathInJar.lastIndexOf('/');
- if (lastSlash < 0) {
- return myPathInJar;
- }
- return myPathInJar.substring(lastSlash+1);
+ return myEntry.shortName;
}
@NotNull
@Override
public VirtualFileSystem getFileSystem() {
- return myFileSystem;
+ return myHandler.getFileSystem();
}
@Override
public String getPath() {
- return myHandler.myBasePath + "!/" + myPathInJar;
+ if (myParent == null) return myHandler.myBasePath + "!/";
+ return myParent.getPath() + "/" + myEntry.shortName;
}
@Override
@@ -70,7 +66,7 @@ public class CoreJarVirtualFile extends VirtualFile {
@Override
public boolean isDirectory() {
- return myHandler.isDirectory(this);
+ return myEntry.isDirectory;
}
@Override
@@ -83,35 +79,9 @@ public class CoreJarVirtualFile extends VirtualFile {
return myParent;
}
- private VirtualFile calcParent() {
- if (myPathInJar.length() == 0) {
- return null;
- }
- int lastSlash = myPathInJar.lastIndexOf('/');
- if (lastSlash < 0) {
- return myHandler.findFileByPath("");
- }
- return myHandler.findFileByPath(myPathInJar.substring(0, lastSlash));
- }
-
@Override
public VirtualFile[] getChildren() {
- VirtualFile[] answer = myChildren;
- if (answer == null) {
- answer = calcChildren();
- myChildren = answer;
- }
- return answer;
- }
-
- private VirtualFile[] calcChildren() {
- List result = new ArrayList();
- final String[] children = myHandler.list(this);
- for (String child : children) {
- final VirtualFile childFile = myPathInJar.isEmpty() ? myHandler.findFileByPath(child) : myHandler.findFileByPath(myPathInJar + "/" + child);
- result.add(childFile);
- }
- return result.toArray(new VirtualFile[result.size()]);
+ return myChildren.toArray(new VirtualFile[myChildren.size()]);
}
@NotNull
diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/tree/ChangeUtil.java b/platform/core-impl/src/com/intellij/psi/impl/source/tree/ChangeUtil.java
index 44d85d47fd22..b72ce1e1f1a8 100644
--- a/platform/core-impl/src/com/intellij/psi/impl/source/tree/ChangeUtil.java
+++ b/platform/core-impl/src/com/intellij/psi/impl/source/tree/ChangeUtil.java
@@ -39,11 +39,10 @@ import com.intellij.psi.impl.source.SourceTreeToPsiMap;
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil;
import com.intellij.util.CharTable;
import com.intellij.util.IncorrectOperationException;
-import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.HashMap;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.List;
import java.util.Map;
public class ChangeUtil {
@@ -119,7 +118,7 @@ public class ChangeUtil {
return element;
}
- public static TreeElement copyElement(TreeElement original, CharTable table) {
+ public static TreeElement copyElement(@NotNull TreeElement original, CharTable table) {
CompositeElement treeParent = original.getTreeParent();
return copyElement(original, treeParent == null ? null : treeParent.getPsi(), table);
}
diff --git a/platform/lang-api/src/com/intellij/execution/ui/layout/LayoutViewOptions.java b/platform/lang-api/src/com/intellij/execution/ui/layout/LayoutViewOptions.java
index 900d4b929a93..d0faa6782ec0 100644
--- a/platform/lang-api/src/com/intellij/execution/ui/layout/LayoutViewOptions.java
+++ b/platform/lang-api/src/com/intellij/execution/ui/layout/LayoutViewOptions.java
@@ -50,4 +50,6 @@ public interface LayoutViewOptions {
LayoutViewOptions setAdditionalFocusActions(ActionGroup group);
+ AnAction getSettingsActions();
+ AnAction[] getSettingsActionsList();
}
\ No newline at end of file
diff --git a/platform/lang-api/src/com/intellij/facet/FacetManager.java b/platform/lang-api/src/com/intellij/facet/FacetManager.java
index 18963cb539ce..01abe00e369c 100644
--- a/platform/lang-api/src/com/intellij/facet/FacetManager.java
+++ b/platform/lang-api/src/com/intellij/facet/FacetManager.java
@@ -32,7 +32,7 @@ public abstract class FacetManager implements FacetModel {
}
/**
- * Creates the interface for modifiyng set of facets in the module. Call {@link ModifiableFacetModel#commit()} when modification is finished
+ * Creates the interface for modifying set of facets in the module. Call {@link ModifiableFacetModel#commit()} when modification is finished
* @return the modifiable facet model
*/
@NotNull
@@ -40,7 +40,7 @@ public abstract class FacetManager implements FacetModel {
@NotNull
public abstract F createFacet(@NotNull FacetType type, @NotNull String name,
- @NotNull C cofiguration, @Nullable Facet underlying);
+ @NotNull C configuration, @Nullable Facet underlying);
@NotNull
diff --git a/platform/lang-api/src/com/intellij/openapi/project/ProjectUtil.java b/platform/lang-api/src/com/intellij/openapi/project/ProjectUtil.java
index 0a7c42517dd7..cd22a9b403f6 100644
--- a/platform/lang-api/src/com/intellij/openapi/project/ProjectUtil.java
+++ b/platform/lang-api/src/com/intellij/openapi/project/ProjectUtil.java
@@ -83,12 +83,12 @@ public class ProjectUtil {
final OrderEntry libraryEntry = LibraryUtil.findLibraryEntry(file, project);
if (libraryEntry != null) {
if (libraryEntry instanceof JdkOrderEntry) {
- url = new StringBuilder(url).append(" - [").append(((JdkOrderEntry)libraryEntry).getJdkName()).append("]").toString();
+ url = url + " - [" + ((JdkOrderEntry)libraryEntry).getJdkName() + "]";
} else {
- url = new StringBuilder(url).append(" - [").append(libraryEntry.getPresentableName()).append("]").toString();
+ url = url + " - [" + libraryEntry.getPresentableName() + "]";
}
} else {
- url = new StringBuilder(url).append(" - [").append(fileForJar.getName()).append("]").toString();
+ url = url + " - [" + fileForJar.getName() + "]";
}
}
}
@@ -96,8 +96,8 @@ public class ProjectUtil {
final Module module = ModuleUtil.findModuleForFile(file, project);
if (module == null) return url;
return !keepModuleAlwaysOnTheLeft && SystemInfo.isMac ?
- new StringBuffer().append(url).append(" - [").append(module.getName()).append("]").toString() :
- new StringBuffer().append("[").append(module.getName()).append("] - ").append(url).toString();
+ url + " - [" + module.getName() + "]" :
+ "[" + module.getName() + "] - " + url;
}
}
diff --git a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java
index e31d8a32d3cd..f256405b29e1 100644
--- a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java
+++ b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerContentUi.java
@@ -69,6 +69,7 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
QuickActionProvider, DockContainer.Dialog {
@NonNls public static final String LAYOUT = "Runner.Layout";
+ @NonNls public static final String SETTINGS = "XDebugger.Settings";
@NonNls public static final String VIEW_POPUP = "Runner.View.Popup";
@NonNls public static final String VIEW_TOOLBAR = "Runner.View.Toolbar";
@@ -690,6 +691,10 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
}
}
+ public ActionGroup getSettingsActions() {
+ return (ActionGroup)myActionManager.getAction(SETTINGS);
+ }
+
private static void moveFollowingTabs(int index, final JBRunnerTabs tabs) {
for (TabInfo info : tabs.getTabs()) {
final TabImpl tab = getTabFor(info);
diff --git a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerLayoutUiImpl.java b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerLayoutUiImpl.java
index 3560b1c25a17..584d919fb087 100644
--- a/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerLayoutUiImpl.java
+++ b/platform/lang-impl/src/com/intellij/execution/ui/layout/impl/RunnerLayoutUiImpl.java
@@ -293,6 +293,16 @@ public class RunnerLayoutUiImpl implements Disposable, RunnerLayoutUi, LayoutSta
return this;
}
+ @Override
+ public AnAction getSettingsActions() {
+ return myContentUI.getSettingsActions();
+ }
+
+ public AnAction[] getSettingsActionsList() {
+ final ActionGroup group = (ActionGroup)getSettingsActions();
+ return group.getChildren(null);
+ }
+
public Content[] getContents() {
Content[] contents = new Content[getContentManager().getContentCount()];
for (int i = 0; i < contents.length; i++) {
diff --git a/platform/lang-impl/src/com/intellij/extapi/psi/StubPath.java b/platform/lang-impl/src/com/intellij/extapi/psi/StubPath.java
index 3ba3c7b77b21..0ebd2584561d 100644
--- a/platform/lang-impl/src/com/intellij/extapi/psi/StubPath.java
+++ b/platform/lang-impl/src/com/intellij/extapi/psi/StubPath.java
@@ -67,12 +67,6 @@ public class StubPath {
}
public String toString() {
- return new StringBuilder().
- append(myParentPath != null ? myParentPath.toString() : "").
- append("::(").
- append(myType.toString()).
- append(":").
- append(myId).
- append(")").toString();
+ return (myParentPath != null ? myParentPath.toString() : "") + "::(" + myType.toString() + ":" + myId + ")";
}
}
diff --git a/platform/platform-api/src/com/intellij/openapi/util/DimensionService.java b/platform/platform-api/src/com/intellij/openapi/util/DimensionService.java
index 770d0256fe7e..2f19b937e14b 100644
--- a/platform/platform-api/src/com/intellij/openapi/util/DimensionService.java
+++ b/platform/platform-api/src/com/intellij/openapi/util/DimensionService.java
@@ -272,11 +272,6 @@ public class DimensionService implements PersistentStateComponent, Appl
final Point topLeft = frame.getLocation();
Point center = new Point(topLeft.x + frame.getWidth() / 2, topLeft.y + frame.getHeight() / 2);
final Rectangle frameScreen = ScreenUtil.getScreenRectangle(center);
- return new StringBuffer(key)
- .append('.').append(frameScreen.x)
- .append('.').append(frameScreen.y)
- .append('.').append(frameScreen.width)
- .append('.').append(frameScreen.height)
- .toString();
+ return key + '.' + frameScreen.x + '.' + frameScreen.y + '.' + frameScreen.width + '.' + frameScreen.height;
}
}
diff --git a/platform/platform-impl/src/com/intellij/internal/inspector/UiInspectorAction.java b/platform/platform-impl/src/com/intellij/internal/inspector/UiInspectorAction.java
index 75a098b5906b..7b74cbcfbbc3 100644
--- a/platform/platform-impl/src/com/intellij/internal/inspector/UiInspectorAction.java
+++ b/platform/platform-impl/src/com/intellij/internal/inspector/UiInspectorAction.java
@@ -481,7 +481,7 @@ public class UiInspectorAction extends ToggleAction implements DumbAware {
g2d.fillRect(insets.left, insets.top, bounds.width - insets.left - insets.right, bounds.height - insets.top - insets.bottom);
g2d.setColor(getForeground());
- final String sizeString = new StringBuilder().append(myWidth).append(" x ").append(myHeight).toString();
+ final String sizeString = String.valueOf(myWidth) + " x " + myHeight;
FontMetrics fm = g2d.getFontMetrics();
int sizeWidth = fm.stringWidth(sizeString);
@@ -595,46 +595,42 @@ public class UiInspectorAction extends ToggleAction implements DumbAware {
private static class PointRenderer extends JLabel implements Renderer {
public JComponent setValue(@NotNull final Point value) {
- setText(new StringBuilder().append(value.x).append(':').append(value.y).toString());
+ setText(String.valueOf(value.x) + ':' + value.y);
return this;
}
}
private static class DimensionRenderer extends JLabel implements Renderer {
public JComponent setValue(@NotNull final Dimension value) {
- setText(new StringBuilder().append(value.width).append(" x ").append(value.height).toString());
+ setText(String.valueOf(value.width) + " x " + value.height);
return this;
}
}
private static class InsetsRenderer extends JLabel implements Renderer {
public JComponent setValue(@NotNull final Insets value) {
- setText(new StringBuilder("top: ").append(value.top).append(" left:").append(value.left).append(" bottom:").append(value.bottom)
- .append(" right:").append(value.right).toString());
+ setText("top: " + value.top + " left:" + value.left + " bottom:" + value.bottom + " right:" + value.right);
return this;
}
}
private static class RectangleRenderer extends JLabel implements Renderer {
public JComponent setValue(@NotNull final Rectangle value) {
- setText(new StringBuilder().append(value.x).append(":").append(value.y).append(", ").append(value.width)
- .append(" x ").append(value.height).toString());
+ setText(String.valueOf(value.x) + ":" + value.y + ", " + value.width + " x " + value.height);
return this;
}
}
private static class ColorRenderer extends JLabel implements Renderer {
public JComponent setValue(@NotNull final Color value) {
- setText(new StringBuilder("r:").append(value.getRed()).append(", g:").append(value.getGreen()).append(", b:").append(value.getBlue())
- .toString());
+ setText("r:" + value.getRed() + ", g:" + value.getGreen() + ", b:" + value.getBlue());
return this;
}
}
private static class FontRenderer extends JLabel implements Renderer {
public JComponent setValue(@NotNull final Font value) {
- setText(new StringBuilder(value.getFontName()).append(" (").append(value.getFamily()).append("), ").append(value.getSize()).
- append("px").toString());
+ setText(value.getFontName() + " (" + value.getFamily() + "), " + value.getSize() + "px");
return this;
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionToolbarImpl.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionToolbarImpl.java
index bb1f727859fb..d3498b76d8fa 100644
--- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionToolbarImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionToolbarImpl.java
@@ -106,6 +106,7 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
private JComponent myTargetComponent;
private boolean myReservePlaceAutoPopupIcon = true;
+ private boolean myAddSeparatorFirst;
private WeakTimerListener myWeakTimerListener;
@SuppressWarnings({"FieldCanBeLocal"}) private ActionToolbarImpl.MyTimerListener myTimerListener;
@@ -215,6 +216,9 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
}
private void fillToolBar(final List actions, boolean layoutSecondaries) {
+ if (myAddSeparatorFirst) {
+ add(new MySeparator());
+ }
for (int i = 0; i < actions.size(); i++) {
final AnAction action = actions.get(i);
if (action instanceof Separator && isNavBar()) {
@@ -1196,4 +1200,9 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
updateActions(false, false, true);
}
+
+ public void setAddSeparatorFirst(boolean addSeparatorFirst) {
+ myAddSeparatorFirst = addSeparatorFirst;
+ updateActions(false, false, true);
+ }
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java
index 7a86a03e5c44..b6624845f61f 100644
--- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java
+++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/StorageUtil.java
@@ -184,13 +184,13 @@ public class StorageUtil {
final int ndx = fileText.indexOf('\n');
return Pair.create(fileText, ndx == -1
? SystemProperties.getLineSeparator()
- : (ndx - 1 >=0 ? (fileText.charAt(ndx - 1) == '\r' ? "\r\n" : "\n") : "\n"));
+ : ndx - 1 >=0 ? fileText.charAt(ndx - 1) == '\r' ? "\r\n" : "\n" : "\n");
}
public static boolean contentEquals(@NotNull final Document document, @NotNull final IFile file) {
try {
final Pair pair = loadFile(file);
- return pair.first == null ? false : pair.first.equals(printDocumentToString(document, pair.second));
+ return pair.first != null && pair.first.equals(printDocumentToString(document, pair.second));
}
catch (IOException e) {
LOG.debug(e);
@@ -201,7 +201,7 @@ public class StorageUtil {
public static boolean contentEquals(@NotNull final Element element, @NotNull final IFile file) {
try {
final Pair pair = loadFile(file);
- return pair.first == null ? false : pair.first.equals(printElement(element, pair.second));
+ return pair.first != null && pair.first.equals(printElement(element, pair.second));
}
catch (IOException e) {
LOG.debug(e);
@@ -264,7 +264,7 @@ public class StorageUtil {
@Nullable
public static Document loadDocument(final byte[] bytes) {
try {
- return (bytes == null || bytes.length == 0) ? null : JDOMUtil.loadDocument(new ByteArrayInputStream(bytes));
+ return bytes == null || bytes.length == 0 ? null : JDOMUtil.loadDocument(new ByteArrayInputStream(bytes));
}
catch (JDOMException e) {
return null;
@@ -313,7 +313,6 @@ public class StorageUtil {
}
public static void logStateDiffInfo(Set> changedFiles, Set componentNames) throws IOException {
-
if (!ApplicationManagerEx.getApplicationEx().isInternal() && !ourDumpChangedComponentStates) return;
try {
@@ -324,7 +323,7 @@ public class StorageUtil {
for (String componentName : componentNames) {
for (Pair pair : changedFiles) {
StateStorage storage = pair.second;
- if ((storage instanceof XmlElementStorage)) {
+ if (storage instanceof XmlElementStorage) {
Element state = ((XmlElementStorage)storage).getState(componentName);
if (state != null) {
File logFile = new File(logDirectory, "prev_" + componentName + ".xml");
@@ -332,13 +331,14 @@ public class StorageUtil {
}
}
}
-
}
for (Pair changedFile : changedFiles) {
- File logFile = new File(logDirectory, "new_" + changedFile.first.getName());
-
- FileUtil.copy(new File(changedFile.first.getPath()), logFile);
+ File in = new File(changedFile.first.getPath());
+ if (in.exists()) {
+ File logFile = new File(logDirectory, "new_" + changedFile.first.getName());
+ FileUtil.copy(in, logFile);
+ }
}
}
catch (Throwable e) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressWindow.java b/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressWindow.java
index ccbb4f8afcc4..0a6c80418c06 100644
--- a/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressWindow.java
+++ b/platform/platform-impl/src/com/intellij/openapi/progress/util/ProgressWindow.java
@@ -164,7 +164,6 @@ public class ProgressWindow extends BlockingProgressIndicator implements Disposa
final DialogWrapper popup = myDialog.myPopup;
if (popup != null) {
myFocusTrackback.registerFocusComponent(new FocusTrackback.ComponentQuery() {
- @SuppressWarnings({"ConstantConditions"})
public Component getComponent() {
return popup.getPreferredFocusedComponent();
}
@@ -250,7 +249,7 @@ public class ProgressWindow extends BlockingProgressIndicator implements Disposa
if (isDialogShowing()) {
if (myFocusTrackback != null) {
myFocusTrackback.setWillBeSheduledForRestore();
- }
+ }
}
UIUtil.invokeLaterIfNeeded(new Runnable() {
@@ -260,11 +259,12 @@ public class ProgressWindow extends BlockingProgressIndicator implements Disposa
if (myDialog != null) {
myDialog.hide();
}
-
+
if (myFocusTrackback != null) {
if (wasShowing) {
myFocusTrackback.restoreFocus();
- } else {
+ }
+ else {
myFocusTrackback.consume();
}
}
diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VirtualDirectoryImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VirtualDirectoryImpl.java
index 6ff87f199cb1..e28e5e496034 100644
--- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VirtualDirectoryImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VirtualDirectoryImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 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.
@@ -64,7 +64,7 @@ import java.util.*;
* @author max
*/
public class VirtualDirectoryImpl extends VirtualFileSystemEntry {
- private static final boolean ALT_SYMLINK_HANDLING = "true".equals(System.getProperty("idea.io.alt.symlink"));
+ private static final boolean ALT_SYMLINK_HANDLING = "true".equalsIgnoreCase(System.getProperty("idea.io.alt.symlink"));
private static final VirtualFileSystemEntry NULL_VIRTUAL_FILE = new VirtualFileImpl("*?;%NULL", null, -42) {
public String toString() {
diff --git a/platform/platform-resources/src/idea/LangActions.xml b/platform/platform-resources/src/idea/LangActions.xml
index 55c7d4b531c0..b3689548f07b 100644
--- a/platform/platform-resources/src/idea/LangActions.xml
+++ b/platform/platform-resources/src/idea/LangActions.xml
@@ -671,7 +671,7 @@
-
+
@@ -726,12 +726,15 @@
-
-
-
-
-
+
+
+
+
+
+
+