diff --git a/platform/lang-api/src/com/intellij/execution/filters/Filter.java b/platform/lang-api/src/com/intellij/execution/filters/Filter.java index 47508862fdbc..06dfbadc79fb 100644 --- a/platform/lang-api/src/com/intellij/execution/filters/Filter.java +++ b/platform/lang-api/src/com/intellij/execution/filters/Filter.java @@ -95,8 +95,7 @@ public interface Filter { * separator at the end. * * @param entireLength - * The length of the entire text including the line passed - * for filteration. + * The length of the entire text including the line passed for filtration. * * @return * null, if there was no match, otherwise, an instance of {@link Result} diff --git a/platform/lang-impl/src/com/intellij/execution/ui/CommonProgramParametersPanel.java b/platform/lang-impl/src/com/intellij/execution/ui/CommonProgramParametersPanel.java index 1f8350651577..0f31d6223027 100644 --- a/platform/lang-impl/src/com/intellij/execution/ui/CommonProgramParametersPanel.java +++ b/platform/lang-impl/src/com/intellij/execution/ui/CommonProgramParametersPanel.java @@ -33,10 +33,12 @@ import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.ui.MacroAwareTextBrowseFolderListener; import com.intellij.ui.PanelWithAnchor; import com.intellij.ui.RawCommandLineEditor; +import com.intellij.ui.TextAccessor; import com.intellij.ui.components.JBList; import com.intellij.util.ArrayUtil; import com.intellij.util.PathUtil; import com.intellij.util.SmartList; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jps.model.serialization.PathMacroUtil; @@ -48,17 +50,28 @@ import java.util.List; public class CommonProgramParametersPanel extends JPanel implements PanelWithAnchor { private LabeledComponent myProgramParametersComponent; - private LabeledComponent myWorkingDirectoryComponent; - private TextFieldWithBrowseButton myWorkingDirectoryField; + private LabeledComponent myWorkingDirectoryComponent; + protected TextFieldWithBrowseButton myWorkingDirectoryField; private EnvironmentVariablesComponent myEnvVariablesComponent; protected JComponent myAnchor; private Module myModuleContext = null; public CommonProgramParametersPanel() { + this(true); + } + + public CommonProgramParametersPanel(boolean init) { super(); + setLayout(new VerticalFlowLayout(VerticalFlowLayout.MIDDLE, 0, 5, true, false)); + if (init) { + init(); + } + } + + protected void init() { initComponents(); copyDialogCaption(myProgramParametersComponent); updateUI(); @@ -86,34 +99,7 @@ public class CommonProgramParametersPanel extends JPanel implements PanelWithAnc } }); - final JPanel panel = new JPanel(new BorderLayout()); - panel.add(myWorkingDirectoryField, BorderLayout.CENTER); - - final FixedSizeButton button = new FixedSizeButton(myWorkingDirectoryField); - button.setIcon(AllIcons.RunConfigurations.Variables); - button.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - final List macros = new SmartList(PathMacros.getInstance().getUserMacroNames()); - if (myModuleContext != null) { - macros.add(PathMacroUtil.MODULE_DIR_MACRO_NAME); - } - - final JList list = new JBList(ArrayUtil.toStringArray(macros)); - JBPopupFactory.getInstance().createListPopupBuilder(list).setItemChoosenCallback(new Runnable() { - @Override - public void run() { - final Object value = list.getSelectedValue(); - if (value instanceof String) { - setWorkingDirectory("$" + value + "$"); - } - } - }).setMovable(false).setResizable(false).createPopup().showUnderneathOf(button); - } - }); - panel.add(button, BorderLayout.EAST); - - myWorkingDirectoryComponent = LabeledComponent.create(panel, ExecutionBundle.message("run.configuration.working.directory.label")); + myWorkingDirectoryComponent = LabeledComponent.create(createComponentWithMacroBrowse(myWorkingDirectoryField), ExecutionBundle.message("run.configuration.working.directory.label")); myEnvVariablesComponent = new EnvironmentVariablesComponent(); myEnvVariablesComponent.setLabelLocation(BorderLayout.WEST); @@ -127,6 +113,36 @@ public class CommonProgramParametersPanel extends JPanel implements PanelWithAnc setAnchor(myEnvVariablesComponent.getLabel()); } + protected JComponent createComponentWithMacroBrowse(@NotNull final TextFieldWithBrowseButton textAccessor) { + final FixedSizeButton button = new FixedSizeButton(textAccessor); + button.setIcon(AllIcons.RunConfigurations.Variables); + button.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + List macros = new SmartList(PathMacros.getInstance().getUserMacroNames()); + if (myModuleContext != null) { + macros.add(PathMacroUtil.MODULE_DIR_MACRO_NAME); + } + + final JList list = new JBList(ArrayUtil.toStringArray(macros)); + JBPopupFactory.getInstance().createListPopupBuilder(list).setItemChoosenCallback(new Runnable() { + @Override + public void run() { + final Object value = list.getSelectedValue(); + if (value instanceof String) { + textAccessor.setText('$' + ((String)value) + '$'); + } + } + }).setMovable(false).setResizable(false).createPopup().showUnderneathOf(button); + } + }); + + JPanel panel = new JPanel(new BorderLayout()); + panel.add(textAccessor, BorderLayout.CENTER); + panel.add(button, BorderLayout.EAST); + return panel; + } + protected void addComponents() { add(myProgramParametersComponent); add(myWorkingDirectoryComponent); @@ -174,13 +190,18 @@ public class CommonProgramParametersPanel extends JPanel implements PanelWithAnc } public void applyTo(CommonProgramRunConfigurationParameters configuration) { - configuration.setProgramParameters(myProgramParametersComponent.getComponent().getText()); - configuration.setWorkingDirectory(myWorkingDirectoryField.getText()); + configuration.setProgramParameters(fromTextField(myProgramParametersComponent.getComponent(), configuration)); + configuration.setWorkingDirectory(fromTextField(myWorkingDirectoryField, configuration)); configuration.setEnvs(myEnvVariablesComponent.getEnvs()); configuration.setPassParentEnvs(myEnvVariablesComponent.isPassParentEnvs()); } + @Nullable + protected String fromTextField(@NotNull TextAccessor textAccessor, @NotNull CommonProgramRunConfigurationParameters configuration) { + return textAccessor.getText(); + } + public void reset(CommonProgramRunConfigurationParameters configuration) { setProgramParameters(configuration.getProgramParameters()); setWorkingDirectory(PathUtil.toSystemDependentName(configuration.getWorkingDirectory())); diff --git a/platform/platform-api/src/com/intellij/ui/RawCommandLineEditor.java b/platform/platform-api/src/com/intellij/ui/RawCommandLineEditor.java index a628185591e7..aa18a47c599e 100644 --- a/platform/platform-api/src/com/intellij/ui/RawCommandLineEditor.java +++ b/platform/platform-api/src/com/intellij/ui/RawCommandLineEditor.java @@ -31,7 +31,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.List; -public class RawCommandLineEditor extends JPanel { +public class RawCommandLineEditor extends JPanel implements TextAccessor { private static final Logger LOG = Logger.getInstance("#com.intellij.ui.RawCommandLineEditor"); private final TextFieldWithBrowseButton myTextField; @@ -44,6 +44,7 @@ public class RawCommandLineEditor extends JPanel { public RawCommandLineEditor(final Function> lineParser, final Function, String> lineJoiner) { super(new BorderLayout()); myTextField = new TextFieldWithBrowseButton(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { if (myDialogCaption == null) { Container parent = getParent(); @@ -73,10 +74,12 @@ public class RawCommandLineEditor extends JPanel { myDialogCaption = dialogCaption != null ? dialogCaption : ""; } + @Override public void setText(String text) { myTextField.setText(text); } + @Override public String getText() { return myTextField.getText(); } @@ -93,6 +96,7 @@ public class RawCommandLineEditor extends JPanel { label.setLabelFor(myTextField.getTextField()); } + @Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); myTextField.setEnabled(enabled); diff --git a/platform/platform-resources/src/idea/Keymap_Xcode.xml b/platform/platform-resources/src/idea/Keymap_Xcode.xml index 165fa74232ca..6f9e5245f9eb 100644 --- a/platform/platform-resources/src/idea/Keymap_Xcode.xml +++ b/platform/platform-resources/src/idea/Keymap_Xcode.xml @@ -16,12 +16,9 @@ - - - - + @@ -29,20 +26,32 @@ + + + + + + + - - + + + + + + + @@ -55,12 +64,18 @@ + + + + + + @@ -83,6 +98,9 @@ + + + @@ -112,6 +130,7 @@ + @@ -126,6 +145,10 @@ + + + + @@ -134,6 +157,7 @@ + @@ -157,12 +181,16 @@ + + + + - + @@ -170,55 +198,65 @@ - + + + + - + + + + + - + - - + + - + + + + - + - + @@ -235,10 +273,17 @@ + + + + + + + @@ -258,19 +303,26 @@ + + + + + + + - - + + @@ -279,6 +331,9 @@ + + + @@ -293,27 +348,47 @@ + - + + + + + + + + - + + + + + + + + + + + + + @@ -328,15 +403,19 @@ - + + + + + - + @@ -353,10 +432,13 @@ - + + + + + - @@ -372,12 +454,27 @@ + + + + + + + + + + + + + + + @@ -386,18 +483,6 @@ - - - - - - - - - - - - @@ -414,10 +499,18 @@ + + + + + + + + @@ -432,6 +525,10 @@ + + + + @@ -439,6 +536,10 @@ + + + + diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/XmlElementStorageTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/XmlElementStorageTest.java index ce48f4347494..eeffb44915db 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/XmlElementStorageTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/components/impl/XmlElementStorageTest.java @@ -28,6 +28,7 @@ import com.intellij.util.io.fs.IFile; import org.jdom.Document; import org.jdom.Element; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collection; import java.util.Collections; @@ -144,7 +145,7 @@ public class XmlElementStorageTest extends LightPlatformLangTestCase { } @Override - public String collapsePath(final String path) { + public String collapsePath(@Nullable String path) { throw new UnsupportedOperationException("Method collapsePath not implemented in " + getClass()); } diff --git a/platform/projectModel-impl/src/com/intellij/openapi/components/PathMacroSubstitutor.java b/platform/projectModel-impl/src/com/intellij/openapi/components/PathMacroSubstitutor.java index 4c2405c2a60d..c79802533a1d 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/components/PathMacroSubstitutor.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/components/PathMacroSubstitutor.java @@ -16,11 +16,14 @@ package com.intellij.openapi.components; import org.jdom.Element; +import org.jetbrains.annotations.Nullable; public interface PathMacroSubstitutor { String expandPath(String path); - String collapsePath(String path); + + String collapsePath(@Nullable String path); void expandPaths(Element element); + void collapsePaths(Element element); } diff --git a/platform/projectModel-impl/src/com/intellij/openapi/components/impl/BasePathMacroManager.java b/platform/projectModel-impl/src/com/intellij/openapi/components/impl/BasePathMacroManager.java index 177aecd7e117..9707364c988b 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/components/impl/BasePathMacroManager.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/components/impl/BasePathMacroManager.java @@ -112,7 +112,7 @@ public class BasePathMacroManager extends PathMacroManager { } @Override - public String collapsePath(final String path) { + public String collapsePath(@Nullable String path) { return getReplacePathMap().substitute(path, SystemInfo.isFileSystemCaseSensitive); } @@ -177,7 +177,7 @@ public class BasePathMacroManager extends PathMacroManager { } @Override - public String collapsePath(final String path) { + public String collapsePath(@Nullable String path) { return getReplacePathMap().substitute(path, SystemInfo.isFileSystemCaseSensitive); }