use of com.intellij.openapi.vcs.changes.IgnoredFileBean in project intellij-community by JetBrains.
the class IgnoredFilesTest method testPatternIsIgnored.
@Test
public void testPatternIsIgnored() throws Exception {
final String dirPath1 = myClientRoot.getPath() + "/a";
final File dir = new File(myClientRoot, "a");
dir.mkdir();
final File innerDir = new File(dir, "innerDir");
innerDir.mkdir();
final File file1 = new File(innerDir, "file1");
final File file2 = new File(innerDir, "file2");
file1.createNewFile();
file2.createNewFile();
final VirtualFile innerVf = myLocalFileSystem.refreshAndFindFileByIoFile(innerDir);
final VirtualFile vf1 = myLocalFileSystem.refreshAndFindFileByIoFile(file1);
final VirtualFile vf2 = myLocalFileSystem.refreshAndFindFileByIoFile(file2);
final IgnoredFileBean ignoredFileBean = IgnoredBeanFactory.withMask("file*");
myChangeListManager.addFilesToIgnore(ignoredFileBean);
dirty();
Assert.assertNotNull(innerVf);
Assert.assertFalse(myChangeListManager.isIgnoredFile(innerVf));
Assert.assertEquals(FileStatus.UNKNOWN, myChangeListManager.getStatus(innerVf));
Assert.assertTrue(myChangeListManager.isUnversioned(innerVf));
assertFoundAndIgnored(vf1);
assertFoundAndIgnored(vf2);
}
use of com.intellij.openapi.vcs.changes.IgnoredFileBean in project intellij-community by JetBrains.
the class IgnoredSettingsPanel method apply.
public void apply() {
IgnoredFileBean[] toIgnore = getItems();
myChangeListManager.setFilesToIgnore(toIgnore);
for (IgnoredFileBean bean : toIgnore) {
if (bean.getType() == IgnoreSettingsType.UNDER_DIR) {
myDirectoriesManuallyRemovedFromIgnored.remove(bean.getPath());
}
}
myChangeListManager.getIgnoredFilesComponent().setDirectoriesManuallyRemovedFromIgnored(myDirectoriesManuallyRemovedFromIgnored);
}
use of com.intellij.openapi.vcs.changes.IgnoredFileBean in project intellij-community by JetBrains.
the class IgnoredSettingsPanel method setItems.
private void setItems(final IgnoredFileBean[] filesToIgnore) {
myModel = new DefaultListModel();
for (IgnoredFileBean bean : filesToIgnore) {
myModel.addElement(bean);
}
myList.setModel(myModel);
}
use of com.intellij.openapi.vcs.changes.IgnoredFileBean in project intellij-plugins by JetBrains.
the class Flexmojos3GenerateConfigTask method perform.
public void perform(final Project project, final MavenEmbeddersManager embeddersManager, final MavenConsole console, final MavenProgressIndicator indicator) throws MavenProcessCanceledException {
if (myModule.isDisposed())
return;
indicator.setText(FlexBundle.message("generating.flex.config.for", myMavenProject.getDisplayName()));
final MavenProjectsTree.EmbedderTask task = new MavenProjectsTree.EmbedderTask() {
public void run(MavenEmbedderWrapper embedder) throws MavenProcessCanceledException {
List<VirtualFile> temporaryFiles = null;
final IgnoredFileBean[] filesToIgnoreOriginal = ChangeListManager.getInstance(project).getFilesToIgnore();
try {
MavenWorkspaceMap workspaceMap = new MavenWorkspaceMap();
temporaryFiles = mavenIdToOutputFileMapping(workspaceMap, project, myTree.getProjects());
embedder.customizeForStrictResolve(workspaceMap, console, indicator);
final String generateConfigGoal = FlexmojosImporter.FLEXMOJOS_GROUP_ID + ":" + FlexmojosImporter.FLEXMOJOS_ARTIFACT_ID + ":generate-config-" + myMavenProject.getPackaging();
final MavenExplicitProfiles profilesIds = myMavenProject.getActivatedProfilesIds();
MavenServerExecutionResult result = embedder.execute(myMavenProject.getFile(), profilesIds.getEnabledProfiles(), profilesIds.getDisabledProfiles(), Collections.singletonList(generateConfigGoal));
if (result.projectData == null) {
myFlexConfigInformer.showFlexConfigWarningIfNeeded(project);
}
MavenUtil.invokeAndWaitWriteAction(project, () -> {
// need to refresh externally created file
final VirtualFile file = LocalFileSystem.getInstance().refreshAndFindFileByPath(myConfigFilePath);
if (file != null) {
file.refresh(false, false);
updateMainClass(myModule, file);
}
});
} catch (MavenProcessCanceledException e) {
throw e;
} catch (Exception e) {
myFlexConfigInformer.showFlexConfigWarningIfNeeded(project);
console.printException(e);
MavenLog.LOG.warn(e);
} finally {
ChangeListManager.getInstance(project).setFilesToIgnore(filesToIgnoreOriginal);
if (temporaryFiles != null && !temporaryFiles.isEmpty()) {
removeTemporaryFiles(project, temporaryFiles);
}
}
}
};
myTree.executeWithEmbedder(myMavenProject, embeddersManager, MavenEmbeddersManager.FOR_POST_PROCESSING, console, indicator, task);
}
use of com.intellij.openapi.vcs.changes.IgnoredFileBean in project intellij-community by JetBrains.
the class IgnoredFilesTest method testDirIsIgnored.
@Test
public void testDirIsIgnored() throws Exception {
//final String dirPath1 = myClientRoot.getPath() + "/a";
final File dir = new File(myClientRoot, "a");
dir.mkdir();
final File innerDir = new File(dir, "innerDir");
innerDir.mkdir();
final File file1 = new File(innerDir, "file1");
final File file2 = new File(innerDir, "file2");
file1.createNewFile();
file2.createNewFile();
final VirtualFile innerVf = myLocalFileSystem.refreshAndFindFileByIoFile(innerDir);
final VirtualFile vf1 = myLocalFileSystem.refreshAndFindFileByIoFile(file1);
final VirtualFile vf2 = myLocalFileSystem.refreshAndFindFileByIoFile(file2);
final IgnoredFileBean ignoredFileBean = IgnoredBeanFactory.ignoreUnderDirectory(FileUtil.toSystemIndependentName(dir.getPath()), myProject);
myChangeListManager.addFilesToIgnore(ignoredFileBean);
dirty();
assertFoundAndIgnored(innerVf);
assertFoundAndIgnored(vf1);
assertFoundAndIgnored(vf2);
}
Aggregations