diff --git a/build/scripts/libLicenses.gant b/build/scripts/libLicenses.gant index 26780223c41e..1b57a0740e26 100644 --- a/build/scripts/libLicenses.gant +++ b/build/scripts/libLicenses.gant @@ -172,7 +172,7 @@ libraryLicense(name: "DTDParser", version: "1.13", license: "LGPL", url: "http:/ libraryLicense(name: "Ganymed", version: "bundled with SVNKit", libraryName: "svnkit.jar", license: "BSD", url: "http://www.ganymed.ethz.ch/ssh2/", licenseUrl: "http://www.ganymed.ethz.ch/ssh2/LICENSE.txt") libraryLicense(name: "sqljet", version: "bundled with SVNKit", libraryName: "sqljet.jar", license: "GPLv2", url: "http://sqljet.com", licenseUrl: "http://www.opensource.org/licenses/lgpl-2.1") libraryLicense(name: "svnkit-javahl", version: "bundled with SVNKit", libraryName: "svnkit-javahl.jar", license: "link (commercial license)", url: "http://www.svnkit.com/", licenseUrl: "http://svnkit.com/license.html") -libraryLicense(name: "Javahl", version: "1.7.2", libraryName: "Javahl.jar", license: "Apache", url: "http://subversion.apache.org", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0") +libraryLicense(name: "javahl", version: "1.7.2", libraryName: "javahl.jar", license: "Apache", url: "http://subversion.apache.org", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0") libraryLicense(name: "Apache Commons HTTPClient", libraryName: "httpclient-4.1.1.jar", version:"4.1.1", license: "Apache 2.0", url: "http://hc.apache.org/httpcomponents-client-ga/index.html", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0") libraryLicense(name: "Apache Commons HTTPCore", libraryName: "httpcore-4.1.jar", version: "4.1", license: "Apache 2.0", diff --git a/platform/lang-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeConfigurable.java b/platform/lang-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeConfigurable.java index b2f6632d9b93..5d5d0b33f93b 100644 --- a/platform/lang-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeConfigurable.java +++ b/platform/lang-impl/src/com/intellij/openapi/fileTypes/impl/FileTypeConfigurable.java @@ -33,9 +33,9 @@ import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.IconLoader; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.templateLanguages.TemplateDataLanguagePatterns; -import com.intellij.ui.ListScrollingUtil; -import com.intellij.ui.ListUtil; +import com.intellij.ui.*; import com.intellij.ui.components.JBList; +import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -494,43 +494,42 @@ public class FileTypeConfigurable extends BaseConfigurable implements Searchable public static class PatternsPanel extends JPanel { private JBList myPatternsList; - private JButton myAddButton; - private JButton myRemoveButton; + private JComponent myAddButton; private JPanel myWholePanel; - private JButton myEditButton; + private FileTypeConfigurable myController; public PatternsPanel() { super(new BorderLayout()); - add(myWholePanel, BorderLayout.CENTER); + myPatternsList = new JBList(new DefaultListModel()); + myPatternsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myPatternsList.setCellRenderer(new ExtensionRenderer()); - myPatternsList.setModel(new DefaultListModel()); - myPatternsList.addListSelectionListener(new ListSelectionListener() { - public void valueChanged(ListSelectionEvent e) { - myRemoveButton.setEnabled(myPatternsList.getSelectedIndex() != -1 && getListModel().size() > 0); - } - }); - myPatternsList.getEmptyText().setText(FileTypesBundle.message("filetype.settings.no.patterns")); + + myWholePanel = ToolbarDecorator.createDecorator(myPatternsList) + .setAddAction(new AnActionButtonRunnable() { + @Override + public void run(AnActionButton button) { + myController.addPattern(); + } + }).setEditAction(new AnActionButtonRunnable() { + @Override + public void run(AnActionButton button) { + myController.editPattern(); + } + }).setRemoveAction(new AnActionButtonRunnable() { + @Override + public void run(AnActionButton button) { + myController.removePattern(); + } + }).disableUpDownActions().createPanel(); + UIUtil.addBorder(myWholePanel, IdeBorderFactory.createTitledBorder(FileTypesBundle.message("filetype.registered.patterns.group"), false)); + myAddButton = ToolbarDecorator.findAddButton(myWholePanel).getContextComponent(); + + add(myWholePanel, BorderLayout.CENTER); } public void attachActions(final FileTypeConfigurable controller) { - myAddButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - controller.addPattern(); - } - }); - myEditButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - controller.editPattern(); - } - }); - - myRemoveButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - controller.removePattern(); - } - }); - + myController = controller; } public JComponent getComponent() { diff --git a/platform/lang-impl/src/com/intellij/openapi/fileTypes/impl/PatternsPanel.form b/platform/lang-impl/src/com/intellij/openapi/fileTypes/impl/PatternsPanel.form deleted file mode 100644 index 06813941d9c8..000000000000 --- a/platform/lang-impl/src/com/intellij/openapi/fileTypes/impl/PatternsPanel.form +++ /dev/null @@ -1,63 +0,0 @@ - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/platform/lang-impl/src/com/intellij/platform/PlatformProjectConfigurator.java b/platform/lang-impl/src/com/intellij/platform/PlatformProjectConfigurator.java index bd3e5a3ec7a7..81409abdf669 100644 --- a/platform/lang-impl/src/com/intellij/platform/PlatformProjectConfigurator.java +++ b/platform/lang-impl/src/com/intellij/platform/PlatformProjectConfigurator.java @@ -41,8 +41,11 @@ public class PlatformProjectConfigurator implements DirectoryProjectConfigurator String moduleName = baseDir.getName().replace(":", ""); // correct module name when opening root of drive as project (RUBY-5181) String imlName = baseDir.getPath() + "/.idea/" + moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION; final Module module = moduleManager.newModule(imlName, ModuleTypeManager.getInstance().getDefaultModuleType()); - ModifiableRootModel rootModel = ModuleRootManager.getInstance(module).getModifiableModel(); - rootModel.addContentEntry(baseDir); + ModuleRootManager rootManager = ModuleRootManager.getInstance(module); + ModifiableRootModel rootModel = rootManager.getModifiableModel(); + if (rootModel.getContentRoots().length == 0) { + rootModel.addContentEntry(baseDir); + } rootModel.inheritSdk(); rootModel.commit(); moduleRef.set(module); diff --git a/platform/platform-impl/src/com/intellij/ide/highlighter/custom/impl/CustomFileTypeEditor.java b/platform/platform-impl/src/com/intellij/ide/highlighter/custom/impl/CustomFileTypeEditor.java index 8133da041e5f..f82cdebc9c6c 100644 --- a/platform/platform-impl/src/com/intellij/ide/highlighter/custom/impl/CustomFileTypeEditor.java +++ b/platform/platform-impl/src/com/intellij/ide/highlighter/custom/impl/CustomFileTypeEditor.java @@ -31,8 +31,6 @@ import org.jetbrains.annotations.NotNull; import javax.swing.*; import javax.swing.event.DocumentEvent; import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -56,9 +54,8 @@ public class CustomFileTypeEditor extends SettingsEditor { private final JTextField myNumPostfixes = new JTextField(5); private final JBList[] myKeywordsLists = new JBList[]{new JBList(), new JBList(), new JBList(), new JBList()}; - private final DefaultListModel[] myKeywordModels = new DefaultListModel[]{new DefaultListModel(), new DefaultListModel(), new DefaultListModel(), new DefaultListModel()}; - private final JButton[] myAddKeywordButtons = new JButton[4]; - private final JButton[] myRemoveKeywordButtons = new JButton[4]; + private final DefaultListModel[] myKeywordModels = + new DefaultListModel[]{new DefaultListModel(), new DefaultListModel(), new DefaultListModel(), new DefaultListModel()}; public CustomFileTypeEditor() { myLineComment.getDocument().addDocumentListener(new DocumentAdapter() { @@ -113,7 +110,8 @@ public class CustomFileTypeEditor extends SettingsEditor { if (myFileTypeName.getText().trim().length() == 0) { throw new ConfigurationException(IdeBundle.message("error.name.cannot.be.empty"), CommonBundle.getErrorTitle()); - } else if (myFileTypeDescr.getText().trim().length() == 0) { + } + else if (myFileTypeDescr.getText().trim().length() == 0) { myFileTypeDescr.setText(myFileTypeName.getText()); } type.setName(myFileTypeName.getText()); @@ -223,43 +221,30 @@ public class CustomFileTypeEditor extends SettingsEditor { } private JPanel createKeywordsPanel(final int index) { - JPanel keywordsPanel = new JPanel(); - keywordsPanel.setLayout(new BorderLayout()); - - keywordsPanel.add(ScrollPaneFactory.createScrollPane(myKeywordsLists[index]), BorderLayout.CENTER); - - DialogButtonGroup buttonGroup = new DialogButtonGroup(); - buttonGroup.setBorder(BorderFactory.createEmptyBorder(0, 10, 5, 0)); - - myAddKeywordButtons[index] = new JButton(IdeBundle.message("button.add")); - myAddKeywordButtons[index].addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - ModifyKeywordDialog dialog = new ModifyKeywordDialog(myAddKeywordButtons[index], ""); - dialog.show(); - if (dialog.isOK()) { - String keywordName = dialog.getKeywordName(); - if (!myKeywordModels[index].contains(keywordName)) myKeywordModels[index].addElement(keywordName); + JPanel panel = ToolbarDecorator.createDecorator(myKeywordsLists[index]) + .setAddAction(new AnActionButtonRunnable() { + @Override + public void run(AnActionButton button) { + ModifyKeywordDialog dialog = new ModifyKeywordDialog(myKeywordsLists[index], ""); + dialog.show(); + if (dialog.isOK()) { + String keywordName = dialog.getKeywordName(); + if (!myKeywordModels[index].contains(keywordName)) myKeywordModels[index].addElement(keywordName); + } } - } - }); - buttonGroup.addButton(myAddKeywordButtons[index]); - - myRemoveKeywordButtons[index] = new JButton(IdeBundle.message("button.remove")); - myRemoveKeywordButtons[index].addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - ListUtil.removeSelectedItems(myKeywordsLists[index]); - } - }); - - buttonGroup.addButton(myRemoveKeywordButtons[index]); - - keywordsPanel.add(buttonGroup, BorderLayout.EAST); - return keywordsPanel; + }).setRemoveAction(new AnActionButtonRunnable() { + @Override + public void run(AnActionButton button) { + ListUtil.removeSelectedItems(myKeywordsLists[index]); + } + }).disableUpDownActions().createPanel(); + panel.setBorder(null); + return panel; } private void edit(int index) { if (myKeywordsLists[index].getSelectedIndex() == -1) return; - ModifyKeywordDialog dialog = new ModifyKeywordDialog(myKeywordsLists[index], (String) myKeywordsLists[index].getSelectedValue()); + ModifyKeywordDialog dialog = new ModifyKeywordDialog(myKeywordsLists[index], (String)myKeywordsLists[index].getSelectedValue()); dialog.show(); if (dialog.isOK()) { myKeywordModels[index].setElementAt(dialog.getKeywordName(), myKeywordsLists[index].getSelectedIndex()); @@ -285,30 +270,34 @@ public class CustomFileTypeEditor extends SettingsEditor { for (int i = 0; i < myKeywordModels[0].size(); i++) { if (ignoreCase) { - syntaxTable.addKeyword1(((String) myKeywordModels[0].getElementAt(i)).toLowerCase()); - } else { - syntaxTable.addKeyword1((String) myKeywordModels[0].getElementAt(i)); + syntaxTable.addKeyword1(((String)myKeywordModels[0].getElementAt(i)).toLowerCase()); + } + else { + syntaxTable.addKeyword1((String)myKeywordModels[0].getElementAt(i)); } } for (int i = 0; i < myKeywordModels[1].size(); i++) { if (ignoreCase) { - syntaxTable.addKeyword2(((String) myKeywordModels[1].getElementAt(i)).toLowerCase()); - } else { - syntaxTable.addKeyword2((String) myKeywordModels[1].getElementAt(i)); + syntaxTable.addKeyword2(((String)myKeywordModels[1].getElementAt(i)).toLowerCase()); + } + else { + syntaxTable.addKeyword2((String)myKeywordModels[1].getElementAt(i)); } } for (int i = 0; i < myKeywordModels[2].size(); i++) { if (ignoreCase) { - syntaxTable.addKeyword3(((String) myKeywordModels[2].getElementAt(i)).toLowerCase()); - } else { - syntaxTable.addKeyword3((String) myKeywordModels[2].getElementAt(i)); + syntaxTable.addKeyword3(((String)myKeywordModels[2].getElementAt(i)).toLowerCase()); + } + else { + syntaxTable.addKeyword3((String)myKeywordModels[2].getElementAt(i)); } } for (int i = 0; i < myKeywordModels[3].size(); i++) { if (ignoreCase) { - syntaxTable.addKeyword4(((String) myKeywordModels[3].getElementAt(i)).toLowerCase()); - } else { - syntaxTable.addKeyword4((String) myKeywordModels[3].getElementAt(i)); + syntaxTable.addKeyword4(((String)myKeywordModels[3].getElementAt(i)).toLowerCase()); + } + else { + syntaxTable.addKeyword4((String)myKeywordModels[3].getElementAt(i)); } } return syntaxTable; diff --git a/platform/platform-impl/src/com/intellij/ide/highlighter/custom/impl/ModifyKeywordDialog.java b/platform/platform-impl/src/com/intellij/ide/highlighter/custom/impl/ModifyKeywordDialog.java index 67ae5d6324f9..400c67a21ecb 100644 --- a/platform/platform-impl/src/com/intellij/ide/highlighter/custom/impl/ModifyKeywordDialog.java +++ b/platform/platform-impl/src/com/intellij/ide/highlighter/custom/impl/ModifyKeywordDialog.java @@ -33,7 +33,8 @@ public class ModifyKeywordDialog extends DialogWrapper { super(parent, false); if (initialValue == null || "".equals(initialValue)) { setTitle(IdeBundle.message("title.add.new.keyword")); - } else { + } + else { setTitle(IdeBundle.message("title.edit.keyword")); } init(); @@ -46,7 +47,8 @@ public class ModifyKeywordDialog extends DialogWrapper { gc.gridx = 0; gc.gridy = 0; gc.weightx = 0; - gc.insets = new Insets(5, 0, 5, 5); + gc.insets = new Insets(5, 0, 5, 10); + gc.anchor = GridBagConstraints.BASELINE; panel.add(new JLabel(IdeBundle.message("editbox.keyword")), gc); gc = new GridBagConstraints(); diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/impl/GlassPaneDialogWrapperPeer.java b/platform/platform-impl/src/com/intellij/openapi/ui/impl/GlassPaneDialogWrapperPeer.java index e63593116543..02ce583df6c1 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/impl/GlassPaneDialogWrapperPeer.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/impl/GlassPaneDialogWrapperPeer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 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. @@ -192,7 +192,7 @@ public class GlassPaneDialogWrapperPeer extends DialogWrapperPeer implements Foc } public Window getWindow() { - throw new UnsupportedOperationException("Not implemented in " + getClass().getCanonicalName()); + return null; } public JRootPane getRootPane() { diff --git a/platform/platform-impl/src/com/intellij/platform/NewDirectoryProjectDialog.java b/platform/platform-impl/src/com/intellij/platform/NewDirectoryProjectDialog.java index 4b411f82bc43..855c4a7a76e8 100644 --- a/platform/platform-impl/src/com/intellij/platform/NewDirectoryProjectDialog.java +++ b/platform/platform-impl/src/com/intellij/platform/NewDirectoryProjectDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 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. @@ -57,7 +57,7 @@ public class NewDirectoryProjectDialog extends DialogWrapper { new LocationNameFieldsBinding(project, myLocationField, myProjectNameTextField, getBaseDir()); - final DirectoryProjectGenerator[] generators = Extensions.getExtensions(DirectoryProjectGenerator.EP_NAME); + final DirectoryProjectGenerator[] generators = getGenerators(); if (generators.length == 0) { myProjectTypePanel.setVisible(false); } @@ -92,6 +92,10 @@ public class NewDirectoryProjectDialog extends DialogWrapper { }); } + protected DirectoryProjectGenerator[] getGenerators() { + return Extensions.getExtensions(DirectoryProjectGenerator.EP_NAME); + } + private void checkValid() { String projectName = myProjectNameTextField.getText(); if (projectName.trim().isEmpty()) { diff --git a/plugins/svn4idea/svn4idea.iml b/plugins/svn4idea/svn4idea.iml index 179551fc2174..e46d784fd861 100644 --- a/plugins/svn4idea/svn4idea.iml +++ b/plugins/svn4idea/svn4idea.iml @@ -37,7 +37,6 @@ - @@ -94,7 +93,7 @@ - +