use of com.intellij.openapi.projectRoots.impl.PerlModuleExtension in project Perl5-IDEA by Camelcade.
the class PerlMarkSourceRootAction method modifyRoots.
@Override
protected void modifyRoots(@NotNull AnActionEvent e, @NotNull Module module, @NotNull VirtualFile[] files) {
PerlModuleExtension modifiableModel = (PerlModuleExtension) PerlModuleExtension.getInstance(module).getModifiableModel(true);
for (VirtualFile virtualFile : files) {
modifiableModel.setRoot(virtualFile, myType);
}
modifiableModel.commit();
}
use of com.intellij.openapi.projectRoots.impl.PerlModuleExtension in project Perl5-IDEA by Camelcade.
the class PerlUnmarkSourceRootAction method update.
@Override
public void update(AnActionEvent e) {
Presentation presentation = e.getPresentation();
RootsSelection selection = getSelection(e);
if (selection.myModule == null) {
presentation.setEnabledAndVisible(false);
return;
}
boolean enabled = isEnabled(selection, selection.myModule);
presentation.setEnabledAndVisible(enabled);
if (!enabled) {
return;
}
List<VirtualFile> virtualFiles = getFilesFromSelection(selection);
PerlModuleExtension perlModuleExtension = PerlModuleExtension.getInstance(selection.myModule);
if (perlModuleExtension == null || virtualFiles.isEmpty()) {
return;
}
if (virtualFiles.size() == 1) {
PerlSourceRootType type = perlModuleExtension.getRootType(virtualFiles.get(0));
if (type == null) {
return;
}
ModuleSourceRootEditHandler<?> handler = type.getEditHandler();
presentation.setText(handler.getUnmarkRootButtonText());
presentation.setIcon(new LayeredIcon(handler.getRootIcon(), AllIcons.RunConfigurations.InvalidConfigurationLayer));
} else {
presentation.setText(PerlBundle.message("perl.action.unmark.multi"));
presentation.setIcon(new LayeredIcon(PerlIcons.PERL_LANGUAGE_ICON, AllIcons.RunConfigurations.InvalidConfigurationLayer));
}
}
use of com.intellij.openapi.projectRoots.impl.PerlModuleExtension in project Perl5-IDEA by Camelcade.
the class PerlUnmarkSourceRootAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
RootsSelection selection = getSelection(e);
PerlModuleExtension perlModuleExtension = (PerlModuleExtension) PerlModuleExtension.getInstance(selection.myModule).getModifiableModel(true);
for (VirtualFile virtualFile : getFilesFromSelection(selection)) {
perlModuleExtension.removeRoot(virtualFile);
}
perlModuleExtension.commit();
}
use of com.intellij.openapi.projectRoots.impl.PerlModuleExtension in project Perl5-IDEA by Camelcade.
the class PerlToggleSourceRootAction method setSelected.
@Override
public void setSelected(AnActionEvent e, boolean state) {
PerlModuleExtension modifiableModel = myEditor.getModifiableModel();
for (VirtualFile virtualFile : myEditor.getSelectedFiles()) {
if (state) {
modifiableModel.setRoot(virtualFile, myHandler.getRootType());
} else {
modifiableModel.removeRoot(virtualFile);
}
}
myEditor.repaint();
}
Aggregations