diff --git a/platform/lang-impl/src/com/intellij/openapi/file/exclude/ui/ExcludeFromProjectAction.java b/platform/lang-impl/src/com/intellij/openapi/file/exclude/ui/ExcludeFromProjectAction.java deleted file mode 100644 index c6e903c08cc9..000000000000 --- a/platform/lang-impl/src/com/intellij/openapi/file/exclude/ui/ExcludeFromProjectAction.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2000-2011 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.openapi.file.exclude.ui; - -import com.intellij.openapi.actionSystem.*; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.file.exclude.ProjectFileExclusionManagerImpl; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleUtil; -import com.intellij.openapi.module.ModuleUtilCore; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.roots.*; -import com.intellij.openapi.vfs.VfsUtil; -import com.intellij.openapi.vfs.VfsUtilCore; -import com.intellij.openapi.vfs.VirtualFile; - -/** - * @author Rustam Vishnyakov - */ -public class ExcludeFromProjectAction extends AnAction { - @Override - public void actionPerformed(AnActionEvent e) { - DataContext dataContext = e.getDataContext(); - final Project project = PlatformDataKeys.PROJECT.getData(dataContext); - if (project == null) return; - final VirtualFile file = PlatformDataKeys.VIRTUAL_FILE.getData(dataContext); - if (file == null) return; - if (file.isDirectory()) { - ApplicationManager.getApplication().runWriteAction(new Runnable() { - @Override - public void run() { - addExcludedFolder(project, file); - } - }); - } - else { - ProjectFileExclusionManagerImpl fileExManager = ProjectFileExclusionManagerImpl.getInstance(project); - if (fileExManager == null) return; - fileExManager.addExclusion(file); - } - } - - private static void addExcludedFolder(Project project, VirtualFile folder) { - Module module = ModuleUtilCore.findModuleForFile(folder, project); - if (module == null) return; - ModifiableRootModel model = ModuleRootManager.getInstance(module).getModifiableModel(); - for (ContentEntry entry : model.getContentEntries()) { - VirtualFile entryFile = entry.getFile(); - if (entryFile != null) { - if (VfsUtilCore.isAncestor(entryFile, folder, true)) { - entry.addExcludeFolder(folder); - model.commit(); - return; - } - } - } - model.dispose(); - } - - @Override - public void update(AnActionEvent e) { - DataContext dataContext = e.getDataContext(); - final VirtualFile file = PlatformDataKeys.VIRTUAL_FILE.getData(dataContext); - final Presentation presentation = e.getPresentation(); - if (file == null) { - presentation.setVisible(false); - return; - } - final Project project = PlatformDataKeys.PROJECT.getData(dataContext); - if (project != null) { - ProjectFileExclusionManagerImpl fileExManager = ProjectFileExclusionManagerImpl.getInstance(project); - if (fileExManager == null) { - presentation.setVisible(false); - return; - } - if (file.equals(project.getBaseDir()) || !file.isWritable()) { - presentation.setEnabled(false); - } - } - } -} diff --git a/platform/lang-impl/src/com/intellij/openapi/file/exclude/ui/ExcludedFilesConfigurable.java b/platform/lang-impl/src/com/intellij/openapi/file/exclude/ui/ExcludedFilesConfigurable.java deleted file mode 100644 index 827a97c37b17..000000000000 --- a/platform/lang-impl/src/com/intellij/openapi/file/exclude/ui/ExcludedFilesConfigurable.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 2000-2011 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.openapi.file.exclude.ui; - -import com.intellij.openapi.file.exclude.ProjectFileExclusionManagerImpl; -import com.intellij.openapi.options.ConfigurationException; -import com.intellij.openapi.options.SearchableConfigurable; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.vfs.VirtualFile; -import org.jetbrains.annotations.Nls; -import org.jetbrains.annotations.NotNull; - -import javax.swing.*; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * @author Rustam Vishnyakov - */ -public class ExcludedFilesConfigurable implements SearchableConfigurable { - - private final ExcludedFilesPanel myExcludedFilesPanel; - private final ProjectFileExclusionManagerImpl myExclusionManager; - - public ExcludedFilesConfigurable(Project project) { - myExclusionManager = ProjectFileExclusionManagerImpl.getInstance(project); - myExcludedFilesPanel = new ExcludedFilesPanel(myExclusionManager != null ? myExclusionManager.getSortedFiles() : null); - } - - @NotNull - @Override - public String getId() { - return getDisplayName(); - } - - @Override - public Runnable enableSearch(String option) { - return null; - } - - @Nls - @Override - public String getDisplayName() { - return "Excluded Files"; //TODO Move to resources - } - - @Override - public String getHelpTopic() { - return null; - } - - @Override - public JComponent createComponent() { - return myExcludedFilesPanel.getTopJPanel(); - } - - @Override - public boolean isModified() { - if (myExclusionManager == null) return false; - Collection currFiles = myExclusionManager.getExcludedFiles(); - Collection newFiles = myExcludedFilesPanel.getExcludedFiles(); - for (VirtualFile file : currFiles) { - if (!newFiles.contains(file)) { - return true; - } - } - return false; - } - - @Override - public void apply() throws ConfigurationException { - if (myExclusionManager == null) return; - final Collection currFiles = myExclusionManager.getExcludedFiles(); - final Collection newFiles = myExcludedFilesPanel.getExcludedFiles(); - final List putBackFiles = new ArrayList(); - for (VirtualFile file : currFiles) { - if (!newFiles.contains(file)) { - putBackFiles.add(file); - } - } - for (VirtualFile file : putBackFiles) { - myExclusionManager.removeExclusion(file); - } - } - - @Override - public void reset() { - myExcludedFilesPanel.resetFiles(myExclusionManager != null ? myExclusionManager.getSortedFiles() : null); - } - - @Override - public void disposeUIResources() { - // - } -} diff --git a/platform/lang-impl/src/com/intellij/openapi/file/exclude/ui/ExcludedFilesPanel.form b/platform/lang-impl/src/com/intellij/openapi/file/exclude/ui/ExcludedFilesPanel.form deleted file mode 100644 index ad2fb3e19d40..000000000000 --- a/platform/lang-impl/src/com/intellij/openapi/file/exclude/ui/ExcludedFilesPanel.form +++ /dev/null @@ -1,35 +0,0 @@ - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/platform/lang-impl/src/com/intellij/openapi/file/exclude/ui/ExcludedFilesPanel.java b/platform/lang-impl/src/com/intellij/openapi/file/exclude/ui/ExcludedFilesPanel.java deleted file mode 100644 index 5bb61f812bfd..000000000000 --- a/platform/lang-impl/src/com/intellij/openapi/file/exclude/ui/ExcludedFilesPanel.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2000-2011 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.openapi.file.exclude.ui; - -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.ui.table.JBTable; -import org.jetbrains.annotations.Nullable; - -import javax.swing.*; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; -import javax.swing.table.AbstractTableModel; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -/** - * @author Rustam Vishnyakov - */ -public class ExcludedFilesPanel { - private JPanel myTopPanel; - private JButton myPutBackButton; - private JBTable myFileTable; - - private final FileTableModel myFileTableModel; - - public ExcludedFilesPanel(Collection files) { - myFileTableModel = new FileTableModel(files); - myFileTable.setModel(myFileTableModel); - myFileTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - - myFileTableModel.addTableModelListener(new TableModelListener() { - @Override - public void tableChanged(TableModelEvent e) { - updateSelection(); - } - }); - - myPutBackButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - myFileTableModel.removeFile(myFileTable.getSelectedRow()); - } - }); - - updateSelection(); - } - - private void updateSelection() { - if (myFileTableModel.getRowCount() == 0) { - myPutBackButton.setEnabled(false); - } - else { - myPutBackButton.setEnabled(true); - myFileTable.setRowSelectionInterval(0, 0); - } - } - - public JPanel getTopJPanel() { - return myTopPanel; - } - - private static class FileTableModel extends AbstractTableModel { - private final List myExcludedFiles = new ArrayList(); - - public FileTableModel(@Nullable Collection files) { - if (files != null) { - myExcludedFiles.addAll(files); - } - } - - @Override - public int getRowCount() { - return myExcludedFiles.size(); - } - - @Override - public int getColumnCount() { - return 1; - } - - @Override - public Object getValueAt(int rowIndex, int columnIndex) { - VirtualFile file = myExcludedFiles.get(rowIndex); - return file.getPath(); - } - - public void removeFile(int index) { - if (index >= 0 && index < myExcludedFiles.size()) { - myExcludedFiles.remove(index); - } - fireTableDataChanged(); - } - - public Collection getExcludedFiles() { - return myExcludedFiles; - } - - public void resetFiles(@Nullable Collection files) { - myExcludedFiles.clear(); - if (files != null) { - myExcludedFiles.addAll(files); - } - fireTableDataChanged(); - } - } - - public Collection getExcludedFiles() { - return myFileTableModel.getExcludedFiles(); - } - - public void resetFiles(Collection files) { - myFileTableModel.resetFiles(files); - } -} diff --git a/platform/platform-resources/src/idea/LangActions.xml b/platform/platform-resources/src/idea/LangActions.xml index bf6900b18572..f71b473db68f 100644 --- a/platform/platform-resources/src/idea/LangActions.xml +++ b/platform/platform-resources/src/idea/LangActions.xml @@ -391,7 +391,6 @@ - diff --git a/resources/src/idea/RichPlatformPlugin.xml b/resources/src/idea/RichPlatformPlugin.xml index c3bea58101cd..d0d63b13f033 100644 --- a/resources/src/idea/RichPlatformPlugin.xml +++ b/resources/src/idea/RichPlatformPlugin.xml @@ -365,12 +365,6 @@ - -