label.setIconTextGap(7);
}
if (myDisplayHangWarning) {
- final JLabel warningLabel = new JLabel(DebuggerBundle.message("hotswap.dialog.hang.warning"));
+ final JLabel warningLabel = new JLabel("WARNING! " + DebuggerBundle.message("hotswap.dialog.hang.warning"));
warningLabel.setUI(new MultiLineLabelUI());
- final Icon warningIcon = UIUtil.getWarningIcon();
- if (warningIcon != null) {
- warningLabel.setIcon(warningIcon);
- warningLabel.setIconTextGap(7);
- }
panel.add(warningLabel, BorderLayout.SOUTH);
}
return panel;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.roots.*;
+import com.intellij.openapi.roots.OrderEntry;
+import com.intellij.openapi.roots.ProjectFileIndex;
+import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.roots.libraries.LibraryUtil;
import com.intellij.openapi.roots.ui.configuration.ModulesConfigurator;
+import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.WrappingVirtualFile;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Iterator;
-import java.util.List;
/**
* @author nik
*/
-public class ProjectSettingsSelectInTarget implements SelectInTarget, DumbAware {
+public class ProjectStructureSelectInTarget implements SelectInTarget, DumbAware {
public boolean canSelect(final SelectInContext context) {
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(context.getProject()).getFileIndex();
final VirtualFile file = context.getVirtualFile();
public void selectIn(final SelectInContext context, final boolean requestFocus) {
final Project project = context.getProject();
final VirtualFile file = context.getVirtualFile();
- final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
final Module module;
final Facet facet;
module = facet == null? null : facet.getModule();
}
else {
+ final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
module = fileIndex.getModuleForFile(file);
- facet = findFacet(project, file, fileIndex);
+ facet = fileIndex.isInSourceContent(file) ? null : findFacet(project, file);
}
if (module != null || facet != null) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
ModulesConfigurator.showFacetSettingsDialog(facet, null);
}
else {
- ModulesConfigurator.showDialog(project, module.getName(), null, false);
+ ProjectSettingsService.getInstance(project).openModuleSettings(module);
}
}
});
return;
}
- final LibraryOrderEntry libraryOrderEntry = findLibrary(file, fileIndex);
- if (libraryOrderEntry != null) {
+ final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(file, project);
+ if (orderEntry != null) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
- ModulesConfigurator.showLibrarySettings(project, libraryOrderEntry);
- }
- });
- return;
- }
-
- final Sdk jdk = findJdk(file, fileIndex);
- if (jdk != null) {
- ApplicationManager.getApplication().invokeLater(new Runnable() {
- public void run() {
- ModulesConfigurator.showSdkSettings(project, jdk);
+ ProjectSettingsService.getInstance(project).openLibraryOrSdkSettings(orderEntry);
}
});
}
}
@Nullable
- private static LibraryOrderEntry findLibrary(final VirtualFile file, final ProjectFileIndex fileIndex) {
- List<OrderEntry> entries = fileIndex.getOrderEntriesForFile(file);
- for (OrderEntry entry : entries) {
- if (entry instanceof LibraryOrderEntry) {
- return (LibraryOrderEntry)entry;
- }
- }
- return null;
- }
-
- @Nullable
- private static Sdk findJdk(final VirtualFile file, final ProjectFileIndex fileIndex) {
- List<OrderEntry> entries = fileIndex.getOrderEntriesForFile(file);
- for (OrderEntry entry : entries) {
- if (entry instanceof JdkOrderEntry) {
- return ((JdkOrderEntry)entry).getJdk();
- }
- }
- return null;
- }
-
- @Nullable
- private static Facet findFacet(final @NotNull Project project, final @NotNull VirtualFile file, final @NotNull ProjectFileIndex fileIndex) {
- if (!fileIndex.isInSourceContent(file)) {
- for (FacetTypeId id : FacetTypeRegistry.getInstance().getFacetTypeIds()) {
- if (hasFacetWithRoots(project, id)) {
- Facet facet = FacetFinder.getInstance(project).findFacet(file, id);
- if (facet != null) {
- return facet;
- }
+ private static Facet findFacet(final @NotNull Project project, final @NotNull VirtualFile file) {
+ for (FacetTypeId id : FacetTypeRegistry.getInstance().getFacetTypeIds()) {
+ if (hasFacetWithRoots(project, id)) {
+ Facet facet = FacetFinder.getInstance(project).findFacet(file, id);
+ if (facet != null) {
+ return facet;
}
}
}
package com.intellij.openapi.roots.ui.configuration;
import com.intellij.ide.projectView.impl.ModuleGroup;
-import com.intellij.ide.projectView.impl.nodes.NamedLibraryElement;
import com.intellij.ide.util.projectWizard.JdkChooserPanel;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.options.ShowSettingsUtil;
ShowSettingsUtil.getInstance().editConfigurable(myProject, ProjectStructureConfigurable.getInstance(myProject), new Runnable() {
@Override
public void run() {
- ModuleStructureConfigurable.getInstance(myProject).selectOrderEntry(module, orderEntry);
+ ProjectStructureConfigurable.getInstance(myProject).selectOrderEntry(module, orderEntry);
}
});
}
@Override
- public boolean canOpenProjectLibrarySettings(NamedLibraryElement value) {
+ public boolean canOpenLibraryOrSdkSettings(OrderEntry orderEntry) {
return true;
}
- public void openProjectLibrarySettings(final NamedLibraryElement element) {
+ public void openLibraryOrSdkSettings(@NotNull final OrderEntry orderEntry) {
final ProjectStructureConfigurable config = ProjectStructureConfigurable.getInstance(myProject);
ShowSettingsUtil.getInstance().editConfigurable(myProject, config, new Runnable() {
public void run() {
- final OrderEntry orderEntry = element.getOrderEntry();
if (orderEntry instanceof JdkOrderEntry) {
config.select(((JdkOrderEntry)orderEntry).getJdk(), true);
} else {
import com.intellij.openapi.project.ProjectBundle;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.ContentEntry;
-import com.intellij.openapi.roots.LibraryOrderEntry;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ModuleRootModel;
import com.intellij.openapi.roots.impl.ProjectRootManagerImpl;
return myModified || myFacetsConfigurator.isModified();
}
- public static boolean showSdkSettings(@NotNull Project project, final Sdk sdk) {
- final ProjectStructureConfigurable configurable = ProjectStructureConfigurable.getInstance(project);
- return ShowSettingsUtil.getInstance().editConfigurable(project, configurable, new Runnable() {
- public void run() {
- configurable.select(sdk, true);
- }
- });
- }
-
- public static boolean showLibrarySettings(@NotNull Project project, @NotNull final LibraryOrderEntry library) {
- final ProjectStructureConfigurable configurable = ProjectStructureConfigurable.getInstance(project);
- return ShowSettingsUtil.getInstance().editConfigurable(project, configurable, new Runnable() {
- public void run() {
- configurable.select(library, true);
- }
- });
- }
-
public static boolean showArtifactSettings(@NotNull Project project, @Nullable final Artifact artifact) {
final ProjectStructureConfigurable configurable = ProjectStructureConfigurable.getInstance(project);
return ShowSettingsUtil.getInstance().editConfigurable(project, configurable, new Runnable() {
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleConfigurationEditor;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.options.BaseConfigurable;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.LibraryOrderEntry;
+import com.intellij.openapi.roots.OrderEntry;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar;
import com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactsStructureConfigurable;
public ActionCallback select(@NotNull LibraryOrderEntry libraryOrderEntry, final boolean requestFocus) {
final Library lib = libraryOrderEntry.getLibrary();
if (lib == null || lib.getTable() == null) {
- Place place = createPlaceFor(myModulesConfig);
- place.putPath(BaseStructureConfigurable.TREE_OBJECT, libraryOrderEntry.getOwnerModule());
- return navigateTo(place, requestFocus);
+ return selectOrderEntry(libraryOrderEntry.getOwnerModule(), libraryOrderEntry);
}
Place place = createPlaceFor(getConfigurableFor(lib));
place.putPath(BaseStructureConfigurable.TREE_NAME, libraryOrderEntry.getLibraryName());
return navigateTo(place, requestFocus);
}
+ public ActionCallback selectOrderEntry(@NotNull final Module module, @Nullable final OrderEntry orderEntry) {
+ return select(module.getName(), null, true).doWhenDone(new Runnable() {
+ public void run() {
+ final MasterDetailsComponent.MyNode node = ModuleStructureConfigurable.getInstance(myProject).findModuleNode(module);
+ if (node != null) {
+ ModuleConfigurable moduleConfigurable = (ModuleConfigurable)node.getConfigurable();
+ ModuleEditor moduleEditor = moduleConfigurable.getModuleEditor();
+ moduleEditor.setSelectedTabName(ClasspathEditor.NAME);
+ if (orderEntry != null) {
+ ModuleConfigurationEditor editor = moduleEditor.getEditor(ClasspathEditor.NAME);
+ if (editor instanceof ClasspathEditor) {
+ ((ClasspathEditor)editor).selectOrderEntry(orderEntry);
+ }
+ }
+ }
+ }
+ });
+ }
+
public ActionCallback navigateTo(@Nullable final Place place, final boolean requestFocus) {
final Configurable toSelect = (Configurable)place.getPath(CATEGORY);
import com.intellij.openapi.roots.ui.configuration.FacetsProvider;
import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable;
-import com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable;
import com.intellij.packaging.artifacts.Artifact;
import com.intellij.packaging.artifacts.ArtifactModel;
import com.intellij.packaging.artifacts.ArtifactType;
final ModuleLibraryOrderEntryImpl libraryEntry = (ModuleLibraryOrderEntryImpl)entry;
if (libraryName != null && libraryName.equals(libraryEntry.getLibraryName())
|| libraryName == null && library.equals(libraryEntry.getLibrary())) {
- ModuleStructureConfigurable.getInstance(getProject()).selectOrderEntry(module, libraryEntry);
+ ProjectStructureConfigurable.getInstance(getProject()).selectOrderEntry(module, libraryEntry);
return;
}
}
import com.intellij.openapi.roots.ModuleRootListener;
import com.intellij.openapi.roots.ModuleSourceOrderEntry;
import com.intellij.openapi.roots.OrderEntry;
-import com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable;
+import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable;
import com.intellij.openapi.roots.ui.util.CellAppearance;
import com.intellij.openapi.roots.ui.util.OrderEntryCellAppearanceUtils;
import com.intellij.openapi.ui.MasterDetailsComponent;
import com.intellij.ui.SimpleColoredComponent;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.ui.components.JBScrollPane;
-import com.intellij.util.PathUtil;
import com.intellij.ui.treeStructure.Tree;
+import com.intellij.util.PathUtil;
import com.intellij.util.messages.MessageBusConnection;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.tree.TreeUtil;
if (module == null) {
return;
}
- ModuleStructureConfigurable c = ModuleStructureConfigurable.getInstance(module.getProject());
final ModuleDependenciesAnalyzer.OrderPathElement element = e.getData(ORDER_PATH_ELEMENT_KEY);
if (element != null && element instanceof ModuleDependenciesAnalyzer.OrderEntryPathElement) {
final ModuleDependenciesAnalyzer.OrderEntryPathElement o = (ModuleDependenciesAnalyzer.OrderEntryPathElement)element;
final OrderEntry entry = o.entry();
final Module m = entry.getOwnerModule();
- c.selectOrderEntry(m, entry);
+ ProjectStructureConfigurable.getInstance(module.getProject()).selectOrderEntry(m, entry);
}
}
}
import com.intellij.openapi.roots.LibraryOrderEntry;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.libraries.Library;
-import com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable;
+import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable;
import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext;
import javax.swing.*;
* @author nik
*/
public class AddExistingCustomLibraryAction extends CustomLibraryActionBase {
- private Library myLibrary;
+ private final Library myLibrary;
public AddExistingCustomLibraryAction(Library library,
Icon icon,
CustomLibraryCreator creator,
StructureConfigurableContext context,
- ModuleStructureConfigurable moduleStructureConfigurable,
+ ProjectStructureConfigurable projectStructureConfigurable,
Module module) {
- super(library.getName(), null, icon, context, moduleStructureConfigurable, creator, module);
+ super(library.getName(), null, icon, context, projectStructureConfigurable, creator, module);
myLibrary = library;
}
return;
}
final LibraryOrderEntry orderEntry = rootModel.addLibraryEntry(myLibrary);
- myModuleStructureConfigurable.selectOrderEntry(myModule, orderEntry);
+ myProjectStructureConfigurable.selectOrderEntry(myModule, orderEntry);
}
}
import com.intellij.openapi.roots.libraries.LibraryKind;
import com.intellij.openapi.roots.libraries.LibraryTable;
import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar;
+import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable;
import com.intellij.openapi.roots.ui.configuration.libraryEditor.CreateNewLibraryDialog;
import com.intellij.openapi.roots.ui.configuration.libraryEditor.NewLibraryEditor;
import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainer;
import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainerFactory;
import com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable;
import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext;
+import com.intellij.ui.treeStructure.Tree;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
public class CreateCustomLibraryAction extends CustomLibraryActionBase {
private CreateCustomLibraryAction(final String name, CustomLibraryCreator creator,
StructureConfigurableContext context,
- ModuleStructureConfigurable moduleStructureConfigurable, Module module) {
- super(name, null, creator.getIcon(), context, moduleStructureConfigurable, creator, module);
+ ProjectStructureConfigurable projectStructureConfigurable, Module module) {
+ super(name, null, creator.getIcon(), context, projectStructureConfigurable, creator, module);
}
@Override
public void actionPerformed(AnActionEvent e) {
- final NewLibraryConfiguration libraryConfiguration = myCreator.getDescription().createNewLibrary(myModuleStructureConfigurable.getTree(),
+ final Tree parentComponent = ModuleStructureConfigurable.getInstance(myContext.getProject()).getTree();
+ final NewLibraryConfiguration libraryConfiguration = myCreator.getDescription().createNewLibrary(parentComponent,
null);
if (libraryConfiguration == null) {
return;
LibraryTablesRegistrar registrar = LibraryTablesRegistrar.getInstance();
final Project project = myContext.getProject();
final List<LibraryTable> tables = Arrays.asList(registrar.getLibraryTable(project), registrar.getLibraryTable());
- final CreateNewLibraryDialog dialog = new CreateNewLibraryDialog(myModuleStructureConfigurable.getTree(), myContext, libraryEditor, tables, 0);
+ final CreateNewLibraryDialog dialog = new CreateNewLibraryDialog(parentComponent, myContext, libraryEditor, tables, 0);
dialog.show();
if (dialog.isOK()) {
final Library library = dialog.createLibrary();
return;
}
final LibraryOrderEntry orderEntry = rootModel.addLibraryEntry(library);
- myModuleStructureConfigurable.selectOrderEntry(myModule, orderEntry);
+ myProjectStructureConfigurable.selectOrderEntry(myModule, orderEntry);
}
}
final Module module = moduleStructureConfigurable.getSelectedModule();
if (module == null) return Collections.emptyList();
+ final ProjectStructureConfigurable projectStructureConfigurable = ProjectStructureConfigurable.getInstance(module.getProject());
final List<AnAction> actions = new ArrayList<AnAction>();
final LibrariesContainer container = LibrariesContainerFactory.createContainer(context);
for (CustomLibraryCreator creator : CustomLibraryCreator.EP_NAME.getExtensions()) {
final Predicate<Library> notAddedLibrariesCondition = LibraryEditingUtil.getNotAddedLibrariesCondition(context.getModulesConfigurator().getRootModel(module));
final Collection<Library> librariesToAdd = Collections2.filter(libraries, Predicates.and(suitablePredicate, notAddedLibrariesCondition));
if (librariesToAdd.isEmpty()) {
- actions.add(new CreateCustomLibraryAction(creator.getDisplayName(), creator, context, moduleStructureConfigurable, module));
+ actions.add(new CreateCustomLibraryAction(creator.getDisplayName(), creator, context, projectStructureConfigurable, module));
}
else {
final DefaultActionGroup group = new DefaultActionGroup(creator.getDisplayName(), true);
group.getTemplatePresentation().setIcon(creator.getIcon());
- group.add(new CreateCustomLibraryAction("New...", creator, context, moduleStructureConfigurable, module));
+ group.add(new CreateCustomLibraryAction("New...", creator, context, projectStructureConfigurable, module));
for (Library library : librariesToAdd) {
Icon icon = LibraryPresentationManager.getInstance().getNamedLibraryIcon(library, context);
- group.add(new AddExistingCustomLibraryAction(library, icon, creator, context, moduleStructureConfigurable, module));
+ group.add(new AddExistingCustomLibraryAction(library, icon, creator, context, projectStructureConfigurable, module));
}
actions.add(group);
}
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.OrderEntry;
import com.intellij.openapi.roots.libraries.Library;
+import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable;
import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainer;
import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainerFactory;
-import com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable;
import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext;
import com.intellij.openapi.ui.Messages;
import org.jetbrains.annotations.NotNull;
public abstract class CustomLibraryActionBase extends DumbAwareAction {
protected final CustomLibraryCreator myCreator;
protected final StructureConfigurableContext myContext;
- protected final ModuleStructureConfigurable myModuleStructureConfigurable;
- protected Module myModule;
+ protected final ProjectStructureConfigurable myProjectStructureConfigurable;
+ protected final Module myModule;
protected CustomLibraryActionBase(String text, String description, Icon icon, StructureConfigurableContext context,
- ModuleStructureConfigurable moduleStructureConfigurable, CustomLibraryCreator creator, Module module) {
+ ProjectStructureConfigurable projectStructureConfigurable, CustomLibraryCreator creator, Module module) {
super(text, description, icon);
myContext = context;
- myModuleStructureConfigurable = moduleStructureConfigurable;
+ myProjectStructureConfigurable = projectStructureConfigurable;
myCreator = creator;
myModule = module;
}
//do nothing
}
- ModuleEditor getModuleEditor() {
+ public ModuleEditor getModuleEditor() {
return myConfigurator.getModuleEditor(myModule);
}
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ServiceManager;
-import com.intellij.openapi.module.*;
+import com.intellij.openapi.module.ModifiableModuleModel;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleManager;
+import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.impl.ProjectRootManagerImpl;
import com.intellij.openapi.roots.impl.RootModelImpl;
import com.intellij.openapi.roots.libraries.Library;
-import com.intellij.openapi.roots.ui.configuration.ClasspathEditor;
import com.intellij.openapi.roots.ui.configuration.ModuleEditor;
import com.intellij.openapi.roots.ui.configuration.ModulesConfigurator;
-import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable;
import com.intellij.openapi.roots.ui.configuration.libraries.CreateCustomLibraryAction;
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement;
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement;
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureDaemonAnalyzer;
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureElement;
import com.intellij.openapi.ui.DialogWrapper;
-import com.intellij.openapi.ui.MasterDetailsComponent;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.NamedConfigurable;
import com.intellij.openapi.util.Comparing;
return myProject;
}
- public void selectOrderEntry(@NotNull final Module module, @Nullable final OrderEntry orderEntry) {
- ProjectStructureConfigurable.getInstance(myProject).select(module.getName(), null, true).doWhenDone(new Runnable() {
- public void run() {
- final MyNode node = findModuleNode(module);
- if (node != null) {
- ModuleConfigurable moduleConfigurable = (ModuleConfigurable)node.getConfigurable();
- ModuleEditor moduleEditor = moduleConfigurable.getModuleEditor();
- moduleEditor.setSelectedTabName(ClasspathEditor.NAME);
- if (orderEntry != null) {
- ModuleConfigurationEditor editor = moduleEditor.getEditor(ClasspathEditor.NAME);
- if (editor instanceof ClasspathEditor) {
- ((ClasspathEditor)editor).selectOrderEntry(orderEntry);
- }
- }
- }
- }
- });
- }
-
public Module[] getModules() {
if (myContext.myModulesConfigurator != null) {
final ModifiableModuleModel model = myContext.myModulesConfigurator.getModuleModel();
import com.intellij.openapi.roots.OrderEntry;
import com.intellij.openapi.roots.impl.OrderEntryUtil;
import com.intellij.openapi.roots.ui.configuration.ModulesConfigurator;
-import com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable;
+import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable;
import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext;
import org.jetbrains.annotations.NotNull;
else {
entry = null;
}
- ModuleStructureConfigurable.getInstance(myContext.getProject()).selectOrderEntry(myModule, entry);
+ ProjectStructureConfigurable.getInstance(myContext.getProject()).selectOrderEntry(myModule, entry);
}
@Override
import com.intellij.ide.BrowserUtil;
import com.intellij.ide.DataManager;
import com.intellij.ide.IdeEventQueue;
-import com.intellij.ide.projectView.impl.nodes.NamedLibraryElement;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.ide.util.gotoByName.ChooseByNameBase;
import com.intellij.lang.Language;
final VirtualFile virtualFile = containingFile.getVirtualFile();
final OrderEntry libraryEntry = LibraryUtil.findLibraryEntry(virtualFile, myProject);
if (libraryEntry != null) {
- ProjectSettingsService.getInstance(myProject).openProjectLibrarySettings(new NamedLibraryElement(libraryEntry.getOwnerModule(), libraryEntry));
+ ProjectSettingsService.getInstance(myProject).openLibraryOrSdkSettings(libraryEntry);
}
}
} else if (url.startsWith(PSI_ELEMENT_PROTOCOL)) {
import com.intellij.patterns.ElementPattern;
import com.intellij.util.containers.MultiMap;
import com.intellij.util.indexing.FileContent;
+import com.intellij.util.indexing.FileContentImpl;
import org.jetbrains.annotations.NotNull;
import java.io.File;
myProgressIndicator.setText2(file.getPresentableUrl());
try {
- FileContent fileContent = new FileContent(file, file.contentsToByteArray(false));
+ FileContent fileContent = new FileContentImpl(file, file.contentsToByteArray(false));
for (FrameworkDetectorData detector : myDetectorsByFileType.get(fileType)) {
if (detector.myFilePattern.accepts(fileContent)) {
detector.mySuitableFiles.add(file);
super(project, value, viewSettings);
}
- public NamedLibraryElementNode(final Project project, final Object value, final ViewSettings viewSettings) {
- this(project, (NamedLibraryElement)value, viewSettings);
- }
-
@NotNull
public Collection<AbstractTreeNode> getChildren() {
final List<AbstractTreeNode> children = new ArrayList<AbstractTreeNode>();
final JdkOrderEntry jdkOrderEntry = (JdkOrderEntry)orderEntry;
final Sdk projectJdk = jdkOrderEntry.getJdk();
if (projectJdk != null) { //jdk not specified
- presentation.setLocationString(FileUtil.toSystemDependentName(projectJdk.getHomePath()));
+ final String path = projectJdk.getHomePath();
+ if (path != null) {
+ presentation.setLocationString(FileUtil.toSystemDependentName(path));
+ }
}
+ presentation.setTooltip(IdeBundle.message("node.projectview.jdk"));
+ }
+ else {
+ presentation.setTooltip(StringUtil.capitalize(IdeBundle.message("node.projectview.library", ((LibraryOrderEntry)orderEntry).getLibraryLevel())));
}
- }
-
- protected String getToolTip() {
- OrderEntry orderEntry = getValue().getOrderEntry();
- return orderEntry instanceof JdkOrderEntry ? IdeBundle.message("node.projectview.jdk") : StringUtil.capitalize(IdeBundle.message("node.projectview.library", ((LibraryOrderEntry)orderEntry).getLibraryLevel()));
}
public void navigate(final boolean requestFocus) {
- ProjectSettingsService.getInstance(myProject).openProjectLibrarySettings(getValue());
+ ProjectSettingsService.getInstance(myProject).openLibraryOrSdkSettings(getValue().getOrderEntry());
}
public boolean canNavigate() {
- return ProjectSettingsService.getInstance(myProject).canOpenProjectLibrarySettings(getValue());
+ return ProjectSettingsService.getInstance(myProject).canOpenLibraryOrSdkSettings(getValue().getOrderEntry());
}
@Override
import com.intellij.openapi.module.ModuleUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectUtil;
+import com.intellij.openapi.roots.OrderEntry;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.roots.libraries.LibraryUtil;
import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Iconable;
service.openModuleSettings(module);
}
else if (ProjectRootsUtil.isLibraryRoot(file, project)) {
- service.openModuleLibrarySettings(module);
+ final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(file, module.getProject());
+ if (orderEntry != null) {
+ service.openLibraryOrSdkSettings(orderEntry);
+ }
}
else {
service.openContentEntriesSettings(module);
import com.intellij.ide.highlighter.ArchiveFileType;
import com.intellij.ide.projectView.PresentationData;
import com.intellij.ide.projectView.ViewSettings;
+import com.intellij.ide.projectView.impl.ProjectRootsUtil;
import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectUtil;
+import com.intellij.openapi.roots.OrderEntry;
+import com.intellij.openapi.roots.libraries.LibraryUtil;
+import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService;
import com.intellij.openapi.util.Iconable;
import com.intellij.openapi.vfs.JarFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.pom.NavigatableWithText;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import java.util.ArrayList;
import java.util.Collection;
-public class PsiFileNode extends BasePsiNode<PsiFile>{
+public class PsiFileNode extends BasePsiNode<PsiFile> implements NavigatableWithText {
public PsiFileNode(Project project, PsiFile value, ViewSettings viewSettings) {
super(project, value, viewSettings);
}
public Collection<AbstractTreeNode> getChildrenImpl() {
- if (isArchive()) {
- VirtualFile jarRoot = JarFileSystem.getInstance().getJarRootForLocalFile(getVirtualFile());
- if (jarRoot != null) {
- PsiDirectory psiDirectory = PsiManager.getInstance(getProject()).findDirectory(jarRoot);
- if (psiDirectory != null) {
- return ProjectViewDirectoryHelper.getInstance(getProject()).getDirectoryChildren(psiDirectory, getSettings(), true);
- }
+ VirtualFile jarRoot = getJarRoot();
+ if (jarRoot != null) {
+ PsiDirectory psiDirectory = PsiManager.getInstance(getProject()).findDirectory(jarRoot);
+ if (psiDirectory != null) {
+ return ProjectViewDirectoryHelper.getInstance(getProject()).getDirectoryChildren(psiDirectory, getSettings(), true);
}
}
return value != null ? value.getVirtualFile() : null;
}
+ @Override
+ public boolean canNavigate() {
+ return isNavigatableLibraryRoot() || super.canNavigate();
+ }
+
+ private boolean isNavigatableLibraryRoot() {
+ VirtualFile jarRoot = getJarRoot();
+ final Project project = getProject();
+ if (jarRoot != null && ProjectRootsUtil.isLibraryRoot(jarRoot, project)) {
+ final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(jarRoot, project);
+ return orderEntry != null && ProjectSettingsService.getInstance(project).canOpenLibraryOrSdkSettings(orderEntry);
+ }
+ return false;
+ }
+
+ @Nullable
+ private VirtualFile getJarRoot() {
+ final VirtualFile file = getVirtualFile();
+ if (file == null || !file.isValid() || !(file.getFileType() instanceof ArchiveFileType)) {
+ return null;
+ }
+ return JarFileSystem.getInstance().getJarRootForLocalFile(file);
+ }
+
+ @Override
+ public void navigate(boolean requestFocus) {
+ VirtualFile jarRoot = getJarRoot();
+ final Project project = getProject();
+ if (jarRoot != null && ProjectRootsUtil.isLibraryRoot(jarRoot, project)) {
+ final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(jarRoot, project);
+ if (orderEntry != null) {
+ ProjectSettingsService.getInstance(project).openLibraryOrSdkSettings(orderEntry);
+ return;
+ }
+ }
+ super.navigate(requestFocus);
+ }
+
+ @Override
+ public String getNavigateActionText(boolean focusEditor) {
+ if (isNavigatableLibraryRoot()) {
+ return "Open Library Settings";
+ }
+ return null;
+ }
+
public int getWeight() {
return 20;
}
*/
package com.intellij.openapi.roots.libraries;
-import com.intellij.ide.projectView.impl.nodes.NamedLibraryElement;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.roots.LibraryOrderEntry;
import com.intellij.openapi.roots.ModuleRootManager;
*/
public class LibraryNavigatable implements Navigatable {
private final Module module;
- private NamedLibraryElement element;
+ private OrderEntry element;
public LibraryNavigatable(@NotNull Library library, @NotNull Module module) {
this.module = module;
for (OrderEntry entry : ModuleRootManager.getInstance(module).getOrderEntries()) {
if (entry instanceof LibraryOrderEntry) {
if (((LibraryOrderEntry)entry).getLibrary() == library) {
- element = new NamedLibraryElement(module, entry);
+ element = entry;
}
}
}
@Override
public void navigate(boolean requestFocus) {
- ProjectSettingsService.getInstance(module.getProject()).openProjectLibrarySettings(element);
+ ProjectSettingsService.getInstance(module.getProject()).openLibraryOrSdkSettings(element);
}
@Override
package com.intellij.openapi.roots.ui.configuration;
import com.intellij.ide.projectView.impl.ModuleGroup;
-import com.intellij.ide.projectView.impl.nodes.NamedLibraryElement;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.roots.impl.libraries.LibraryEx;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.libraries.LibraryType;
-import com.intellij.openapi.roots.libraries.ui.LibraryRootsComponentDescriptor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
return false;
}
- public void openProjectLibrarySettings(final NamedLibraryElement value) {
- Configurable additionalSettingsConfigurable = getLibrarySettingsConfigurable(value);
+ public void openLibraryOrSdkSettings(final @NotNull OrderEntry orderEntry) {
+ Configurable additionalSettingsConfigurable = getLibrarySettingsConfigurable(orderEntry);
if (additionalSettingsConfigurable != null) {
- LibraryOrderEntry entry = (LibraryOrderEntry) value.getOrderEntry();
- ShowSettingsUtil.getInstance()
- .showSettingsDialog(entry.getOwnerModule().getProject(), additionalSettingsConfigurable.getDisplayName());
+ ShowSettingsUtil.getInstance().showSettingsDialog(orderEntry.getOwnerModule().getProject(),
+ additionalSettingsConfigurable.getDisplayName());
}
}
- public boolean canOpenProjectLibrarySettings(final NamedLibraryElement value) {
- return getLibrarySettingsConfigurable(value) != null;
+ public boolean canOpenLibraryOrSdkSettings(final OrderEntry orderEntry) {
+ return getLibrarySettingsConfigurable(orderEntry) != null;
}
@Nullable
- private static Configurable getLibrarySettingsConfigurable(NamedLibraryElement value) {
- OrderEntry orderEntry = value.getOrderEntry();
+ private static Configurable getLibrarySettingsConfigurable(OrderEntry orderEntry) {
if (!(orderEntry instanceof LibraryOrderEntry)) return null;
LibraryOrderEntry libOrderEntry = (LibraryOrderEntry)orderEntry;
Library lib = libOrderEntry.getLibrary();
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.util.indexing.FileBasedIndex;
import com.intellij.util.indexing.FileContent;
+import com.intellij.util.indexing.FileContentImpl;
import gnu.trove.TIntArrayList;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
}
try {
- final FileContent fc = new FileContent(vFile, vFile.contentsToByteArray());
+ final FileContent fc = new FileContentImpl(vFile, vFile.contentsToByteArray());
fc.putUserData(FileBasedIndex.PROJECT, project);
final StubElement element = StubUpdatingIndex.buildStubTree(fc);
if (element instanceof PsiFileStub) {
final BinaryFileStubBuilder builder = BinaryFileStubBuilders.INSTANCE.forFileType(fileType);
assert builder != null;
- data = builder.buildStubTree(inputData.getFile(), inputData.getContent(), inputData.getProject());
+ data = builder.buildStubTree(inputData.getFile(), inputData.getContent(), ((FileContentImpl)inputData).getProject());
}
else {
final LanguageFileType filetype = (LanguageFileType)fileType;
return;
}
- final FileContent newFc = new FileContent(vFile, contentText, vFile.getCharset());
+ final FileContentImpl newFc = new FileContentImpl(vFile, contentText, vFile.getCharset());
if (dominantContentFile != null) {
dominantContentFile.putUserData(PsiFileImpl.BUILDING_STUB, true);
public void indexFileContent(@Nullable Project project, com.intellij.ide.caches.FileContent content) {
myChangedFilesCollector.ensureAllInvalidateTasksCompleted();
final VirtualFile file = content.getVirtualFile();
- FileContent fc = null;
+ FileContentImpl fc = null;
PsiFile psiFile = null;
catch (IOException e) {
currentBytes = ArrayUtil.EMPTY_BYTE_ARRAY;
}
- fc = new FileContent(file, currentBytes);
+ fc = new FileContentImpl(file, currentBytes);
psiFile = content.getUserData(PSI_FILE);
if (psiFile != null) {
if (getInputFilter(indexId).acceptInput(file)) {
try {
if (fileContent == null) {
- fileContent = new FileContent(file);
+ fileContent = new FileContentImpl(file);
}
updateSingleIndex(indexId, file, fileContent);
}
oldStuff = false;
try {
if (fileContent == null) {
- fileContent = new FileContent(file);
+ fileContent = new FileContentImpl(file);
}
updateSingleIndex(indexId, file, fileContent);
}
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * 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.
package com.intellij.util.indexing;
-import com.intellij.lang.Language;
-import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
import com.intellij.openapi.fileTypes.FileType;
-import com.intellij.openapi.fileTypes.FileTypeManager;
-import com.intellij.openapi.fileTypes.LanguageFileType;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.project.ProjectManager;
-import com.intellij.openapi.util.Key;
-import com.intellij.openapi.util.UserDataHolderBase;
+import com.intellij.openapi.util.UserDataHolder;
import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.LanguageSubstitutors;
import com.intellij.psi.PsiFile;
-import com.intellij.psi.PsiFileFactory;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.TestOnly;
-
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
/**
* @author Eugene Zhuravlev
* Date: Mar 28, 2008
*/
-public final class FileContent extends UserDataHolderBase {
- private final VirtualFile myFile;
- private final String fileName;
- private final FileType myFileType;
- private final Charset myCharset;
- private byte[] myContent;
- private CharSequence myContentAsText;
-
- public Project getProject() {
- return getUserData(FileBasedIndex.PROJECT);
- }
-
- private final Key<PsiFile> CACHED_PSI = Key.create("cached psi from content");
-
- /**
- * @return psiFile associated with the content. If the file was not set on FileContentCreation, it will be created on the spot
- */
- public PsiFile getPsiFile() {
- PsiFile psi = getUserData(FileBasedIndex.PSI_FILE);
-
- if (psi == null) {
- psi = getUserData(CACHED_PSI);
- }
-
- if (psi == null) {
- Project project = getProject();
- if (project == null) {
- project = ProjectManager.getInstance().getDefaultProject();
- }
- final Language language = ((LanguageFileType)getFileTypeWithoutSubstitution()).getLanguage();
- final Language substitutedLanguage = LanguageSubstitutors.INSTANCE.substituteLanguage(language, getFile(), project);
- psi = PsiFileFactory.getInstance(project).createFileFromText(getFileName(), substitutedLanguage, getContentAsText(), false, false, true);
-
- psi.putUserData(FileBasedIndex.VIRTUAL_FILE, getFile());
- putUserData(CACHED_PSI, psi);
- }
- return psi;
- }
-
- public static class IllegalDataException extends RuntimeException {
- public IllegalDataException(final String message) {
- super(message);
- }
- }
-
- public FileContent(@NotNull final VirtualFile file, @NotNull final CharSequence contentAsText, final Charset charset) {
- this(file, contentAsText, null, charset);
- }
-
- public FileContent(@NotNull final VirtualFile file, @NotNull final byte[] content) {
- this(file, null, content, LoadTextUtil.detectCharsetAndSetBOM(file, content));
- }
-
- public FileContent(@NotNull final VirtualFile file) {
- this(file, null, null, null);
- }
-
- @TestOnly
- public FileContent(byte[] content) {
- this(null, null, content, null);
- }
-
- private FileContent(VirtualFile file, CharSequence contentAsText, byte[] content, Charset charset) {
- myFile = file;
- myContentAsText = contentAsText;
- myContent = content;
- myCharset = charset;
- myFileType = file == null ? null : FileTypeManager.getInstance().getFileTypeByFile(file);
- // remember name explicitly because the file could be renamed afterwards
- fileName = file == null ? null : file.getName();
- }
-
- private FileType substituteFileType(VirtualFile file, FileType fileType) {
- Project project = getProject();
- return SubstitutedFileType.substituteFileType(file, fileType, project);
- }
-
- public FileType getSubstitutedFileType() {
- return substituteFileType(myFile, myFileType);
- }
-
- public FileType getFileTypeWithoutSubstitution() {
- return myFileType;
- }
-
- public FileType getFileType() {
- return getSubstitutedFileType();
- }
-
- public VirtualFile getFile() {
- return myFile;
- }
+public interface FileContent extends UserDataHolder {
+ @NotNull
+ FileType getFileType();
- public String getFileName() {
- return fileName;
- }
+ VirtualFile getFile();
- public Charset getCharset() {
- return myCharset;
- }
+ String getFileName();
- public byte[] getContent() {
- if (myContent == null) {
- if (myContentAsText != null) {
- try {
- myContent = myCharset != null ? myContentAsText.toString().getBytes(myCharset.name()) : myContentAsText.toString().getBytes();
- }
- catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
- }
- }
- }
- return myContent;
- }
+ byte[] getContent();
- public CharSequence getContentAsText() {
- if (myFileType.isBinary()) {
- throw new IllegalDataException("Cannot obtain text for binary file type : " + myFileType.getDescription());
- }
- if (myContentAsText == null) {
- if (myContent != null) {
- myContentAsText = LoadTextUtil.getTextByBinaryPresentation(myContent, myCharset);
- }
- }
- return myContentAsText;
- }
+ CharSequence getContentAsText();
- @Override
- public String toString() {
- return fileName;
- }
+ @NotNull
+ PsiFile getPsiFile();
}
--- /dev/null
+/*
+ * 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.util.indexing;
+
+import com.intellij.lang.Language;
+import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
+import com.intellij.openapi.fileTypes.FileType;
+import com.intellij.openapi.fileTypes.FileTypeManager;
+import com.intellij.openapi.fileTypes.LanguageFileType;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.project.ProjectManager;
+import com.intellij.openapi.util.Key;
+import com.intellij.openapi.util.UserDataHolderBase;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.LanguageSubstitutors;
+import com.intellij.psi.PsiFile;
+import com.intellij.psi.PsiFileFactory;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.TestOnly;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
+
+/**
+ * @author nik
+ */
+public class FileContentImpl extends UserDataHolderBase implements FileContent {
+ private final VirtualFile myFile;
+ private final String fileName;
+ private final FileType myFileType;
+ private final Charset myCharset;
+ private byte[] myContent;
+ private CharSequence myContentAsText;
+
+ public Project getProject() {
+ return getUserData(FileBasedIndex.PROJECT);
+ }
+
+ private final Key<PsiFile> CACHED_PSI = Key.create("cached psi from content");
+
+ /**
+ * @return psiFile associated with the content. If the file was not set on FileContentCreation, it will be created on the spot
+ */
+ @NotNull
+ @Override
+ public PsiFile getPsiFile() {
+ PsiFile psi = getUserData(FileBasedIndex.PSI_FILE);
+
+ if (psi == null) {
+ psi = getUserData(CACHED_PSI);
+ }
+
+ if (psi == null) {
+ Project project = getProject();
+ if (project == null) {
+ project = ProjectManager.getInstance().getDefaultProject();
+ }
+ final Language language = ((LanguageFileType)getFileTypeWithoutSubstitution()).getLanguage();
+ final Language substitutedLanguage = LanguageSubstitutors.INSTANCE.substituteLanguage(language, getFile(), project);
+ psi = PsiFileFactory.getInstance(project).createFileFromText(getFileName(), substitutedLanguage, getContentAsText(), false, false, true);
+
+ psi.putUserData(FileBasedIndex.VIRTUAL_FILE, getFile());
+ putUserData(CACHED_PSI, psi);
+ }
+ return psi;
+ }
+
+ public static class IllegalDataException extends RuntimeException {
+ public IllegalDataException(final String message) {
+ super(message);
+ }
+ }
+
+ public FileContentImpl(@NotNull final VirtualFile file, @NotNull final CharSequence contentAsText, final Charset charset) {
+ this(file, contentAsText, null, charset);
+ }
+
+ public FileContentImpl(@NotNull final VirtualFile file, @NotNull final byte[] content) {
+ this(file, null, content, LoadTextUtil.detectCharsetAndSetBOM(file, content));
+ }
+
+ public FileContentImpl(@NotNull final VirtualFile file) {
+ this(file, null, null, null);
+ }
+
+ @TestOnly
+ public FileContentImpl(byte[] content) {
+ this(null, null, content, null);
+ }
+
+ private FileContentImpl(VirtualFile file, CharSequence contentAsText, byte[] content, Charset charset) {
+ myFile = file;
+ myContentAsText = contentAsText;
+ myContent = content;
+ myCharset = charset;
+ myFileType = file == null ? null : FileTypeManager.getInstance().getFileTypeByFile(file);
+ // remember name explicitly because the file could be renamed afterwards
+ fileName = file == null ? null : file.getName();
+ }
+
+ @NotNull
+ private FileType substituteFileType(VirtualFile file, FileType fileType) {
+ Project project = getProject();
+ return SubstitutedFileType.substituteFileType(file, fileType, project);
+ }
+
+ @NotNull
+ public FileType getSubstitutedFileType() {
+ return substituteFileType(myFile, myFileType);
+ }
+
+ public FileType getFileTypeWithoutSubstitution() {
+ return myFileType;
+ }
+
+ @NotNull
+ @Override
+ public FileType getFileType() {
+ return getSubstitutedFileType();
+ }
+
+ @Override
+ public VirtualFile getFile() {
+ return myFile;
+ }
+
+ @Override
+ public String getFileName() {
+ return fileName;
+ }
+
+ public Charset getCharset() {
+ return myCharset;
+ }
+
+ @Override
+ public byte[] getContent() {
+ if (myContent == null) {
+ if (myContentAsText != null) {
+ try {
+ myContent = myCharset != null ? myContentAsText.toString().getBytes(myCharset.name()) : myContentAsText.toString().getBytes();
+ }
+ catch (UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ return myContent;
+ }
+
+ @Override
+ public CharSequence getContentAsText() {
+ if (myFileType.isBinary()) {
+ throw new IllegalDataException("Cannot obtain text for binary file type : " + myFileType.getDescription());
+ }
+ if (myContentAsText == null) {
+ if (myContent != null) {
+ myContentAsText = LoadTextUtil.getTextByBinaryPresentation(myContent, myCharset);
+ }
+ }
+ return myContentAsText;
+ }
+
+ @Override
+ public String toString() {
+ return fileName;
+ }
+}
this.fileType = substitutionFileType;
}
-
+ @NotNull
public static FileType substituteFileType(VirtualFile file, @NotNull FileType fileType, Project project) {
if (project == null) {
return fileType;
private ClearFatalsAction myClearAction = new ClearFatalsAction();
private BlameAction myBlameAction = new BlameAction();
+ @Nullable
private AnalyzeAction myAnalyzeAction;
private boolean myMute;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
rebuildHeaders();
+ updateControls();
}
});
}
myDetailsTabForm.setCommentsAreaVisible(false);
}
else {
- myAnalyzeAction = new AnalyzeAction(ActionManager.getInstance().getAction("AnalyzeStacktraceOnError"));
+ final AnAction analyzePlatformAction = ActionManager.getInstance().getAction("AnalyzeStacktraceOnError");
+ if (analyzePlatformAction != null) {
+ myAnalyzeAction = new AnalyzeAction(analyzePlatformAction);
+ }
myDetailsTabForm = new DetailsTabForm(myAnalyzeAction);
myDetailsTabForm.setCommentsAreaVisible(true);
myDetailsTabForm.addCommentsListener(commentsListener);
final Throwable throwable = message.getThrowable();
ErrorReportSubmitter submitter = getSubmitter(throwable);
if (submitter == null) {
+ PluginId pluginId = findPluginId(throwable);
+ IdeaPluginDescriptor plugin = PluginManager.getPlugin(pluginId);
+ if (plugin == null) {
+ // unknown plugin
+ myForeignPluginWarningLabel.setVisible(false);
+ return;
+ }
myForeignPluginWarningLabel.setVisible(true);
- final IdeaPluginDescriptor plugin = PluginManager.getPlugin(findPluginId(throwable));
String vendor = plugin.getVendor();
String contactInfo = plugin.getVendorUrl();
if (StringUtil.isEmpty(contactInfo)) {
for (final ArrayList<AbstractMessage> abstractMessages : hash2Messages.values()) {
myMergedMessages.add(abstractMessages);
}
- updateControls();
}
private void markAllAsRead() {
import com.intellij.diagnostic.DiagnosticBundle;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.util.ui.UIUtil;
+import org.jetbrains.annotations.Nullable;
import javax.swing.*;
private JPanel myDetailsHolder;
private JButton myAnalyzeStacktraceButton;
- public DetailsTabForm(Action analyzeAction) {
+ public DetailsTabForm(@Nullable Action analyzeAction) {
myCommentsArea.setTitle(DiagnosticBundle.message("error.dialog.comment.prompt"));
myDetailsPane.setBackground(UIUtil.getTextFieldBackground());
myDetailsHolder.setBorder(IdeBorderFactory.createBorder());
action.CloseProject.description=Close current project
action.ShowSettings.text=Se_ttings
action.ShowSettings.description=Configure application settings
-action.ShowProjectStructureSettings.text=Pro_ject Structure
+action.ShowProjectStructureSettings.text=Pro_ject Structure...
action.ShowProjectStructureSettings.description=Configure project structure
-action.TemplateProjectProperties.text=Templ_ate Settings
+action.TemplateProjectProperties.text=Templ_ate Settings...
action.TemplateProjectProperties.description=Configure template settings for all new projects
-action.TemplateProjectStructure.text=Te_mplate Project Structure
+action.TemplateProjectStructure.text=Te_mplate Project Structure...
action.TemplateProjectStructure.description=Configure template structure for all new projects
action.SaveAll.text=_Save All
action.SaveAll.description=Save all files and settings
action.ViewToolButtons.description=Show/hide tool window buttons
action.ViewNavigationBar.text=Na_vigation Bar
action.ViewNavigationBar.description=Show/hide the navigation bar
-action.FileStructurePopup.text=_File Structure Popup
+action.FileStructurePopup.text=_File Structure
action.FileStructurePopup.description=Popup structure of the current file for quick navigation
action.ShowFilePath.text=File _Path
action.ShowFilePath.description=Popup path of the current file for opening in external file manager
action.SelectIn.text=Se_lect In...
action.SelectIn.description=Select the current class or method in any view
-action.QuickJavaDoc.text=Quick _Documentation Lookup
+action.QuickJavaDoc.text=Quick _Documentation
action.QuickJavaDoc.description=Show a popup window with documentation for the symbol at caret
-action.QuickImplementations.text=Quick Definition Loo_kup
+action.QuickImplementations.text=Quic_k Definition
action.QuickImplementations.description=Show a popup window with the symbol (and its implementations) content
action.ParameterInfo.text=_Parameter Info
action.ParameterInfo.description=Show parameters of the method call at caret
action.EditorContextInfo.description=Show the current method or class declaration when it is not visible
action.ShowErrorDescription.text=E_rror Description
action.ShowErrorDescription.description=Show description of error or warning at caret
-action.ProjectViewChangeView.text=Change View
+action.ProjectViewChangeView.text=Change View...
action.ProjectViewChangeView.description=Choose Project, Sourcepath or Classpath tree in the Project View window
action.EditSource.text=_Jump to Source
action.EditSource.description=Open editor for the selected item and give focus to it
action.GotoNextError.description=Navigate to the next highlighted error in the active editor
action.GotoPreviousError.text=_Previous Highlighted Error
action.GotoPreviousError.description=Navigate to the previous highlighted error in the active editor
+action.GotoRelated.text=_Related File...
+action.GotoRelated.description=Navigate to one of the related or linked files
action.MethodDown.text=N_ext Method
action.MethodDown.description=Navigate to the next method in the active editor
action.MethodUp.text=Prev_ious Method
action.ShelvedChanges.Restore.text=Restore Applied Shelved Change
action.Graph.Current.Node.Dependencies.Filter.text=Show selected nodes with dependencies
group.VcsToobarActions.text=VCS Actions
-action.StartupWizard.text=Configure Plugins
+action.StartupWizard.text=Configure Plugins...
action.StartupWizard.description=Run a wizard for selecting the set of enabled plugins
-action.PopupHector.text=Popup Per File Highlighting Settings
+action.PopupHector.text=Per File Highlighting Settings...
action.PopupHector.description=Show panel to configure highlighting mode for the current file
group.EditorTabPopupMenu.text=Editor Tab Popup Menu
group.MainMenu.text=Main menu
<p>Use <span class="shortcut">&shortcut:QuickImplementations;</span>
- (<span class="control">View | Quick Definition Lookup</span>),
+ (<span class="control">View | Quick Definition</span>),
to quickly review definition or content of the symbol at caret, without the need to open it
in a new editor tab.</p>
<p class="image"><img src="images/ctrl_shift_i.gif"></p>
</body>
-</html>
\ No newline at end of file
+</html>
<p>You can quickly navigate in the currently edited file with <span class="shortcut">&shortcut:FileStructurePopup;</span>
- (<span class="control">View | File Structure Popup</span>).</p>
+ (<span class="control">View | File Structure</span>).</p>
<p>It shows the list of members of the current class. Select an element you want to navigate to and press the
<span class="shortcut">Enter</span> key or the <span class="shortcut">&shortcut:EditSource;</span> key.</p>
<p>To easily locate an item in the list, just start typing its name.</p>
<p>You can quickly view the image referenced at caret by using the
- <span class="">Quick Definition Lookup</span>
+ <span class="">Quick Definition</span>
(<span class="shortcut">&shortcut:QuickImplementations;</span>). The underlying image will be opened in a popup instead of a separate editor tab.</p>
<p class="image"><img src="images/image_lookup.gif"></p>
<body>
<p>
To quickly see the documentation for the class or method used at the editor's caret, press <span class="shortcut">&shortcut:QuickJavaDoc;</span>
- (<span class="control">View | Quick Documentation Lookup</span>).</p>
+ (<span class="control">View | Quick Documentation</span>).</p>
<p class="image">
<img src="images/quick_javadoc.gif"></p>
</body>
<p>The shortcuts such as <span class="shortcut">&shortcut:QuickJavaDoc;</span>
- (<span class="control">View | Quick Documentation Lookup</span>),
+ (<span class="control">View | Quick Documentation</span>),
<span class="shortcut">&shortcut:ParameterInfo;</span> (<span class="control">View | Parameter Info</span>),
<span class="shortcut">&shortcut:GotoDeclaration;</span> (<span class="control">Go To | Declaration</span>)
and others can be used not only in the editor but in the code completion popup list as well.</p>
</group>
<!-- View -->
- <action id="ViewNavigationBar" class="com.intellij.ide.actions.ViewNavigationBarAction">
- <add-to-group group-id="ViewMenu" relative-to-action="ViewStatusBar" anchor="after"/>
- </action>
-
- <action id="ViewImportPopups" class="com.intellij.openapi.editor.actions.ToggleShowImportPopupsAction">
- <add-to-group group-id="ViewMenu" relative-to-action="EditorToggleShowLineNumbers" anchor="after"/>
- </action>
+ <group id="QuickActions">
+ <action id="QuickImplementations" class="com.intellij.codeInsight.hint.actions.ShowImplementationsAction"/>
+ <action id="QuickJavaDoc" class="com.intellij.codeInsight.documentation.actions.ShowQuickDocInfoAction"/>
- <action id="ShowUsagesSettings" class="com.intellij.find.actions.ShowUsagesAction$ShowSettings"/>
+ <add-to-group group-id="ViewMenu" anchor="first"/>
+ </group>
<group id="CodeEditorBaseGroup">
<group id="CodeEditorViewGroup">
<action id="SelectIn" class="com.intellij.ide.actions.SelectInAction"/>
<action id="FileStructurePopup" class="com.intellij.ide.actions.ViewStructureAction"/>
<action id="ShowFilePath" class="com.intellij.ide.actions.ShowFilePathAction"/>
- <action id="PopupHector" class="com.intellij.codeInsight.daemon.impl.PopupHectorAction"/>
- </group>
- <separator/>
-
- <group id="ProjectViewGroup">
- <action id="ProjectViewChangeView" class="com.intellij.ide.projectView.actions.ChangeProjectViewAction"/>
</group>
<separator/>
<add-to-group group-id="ViewMenu" relative-to-action="QuickActions" anchor="after"/>
</group>
+ <action id="ViewNavigationBar" class="com.intellij.ide.actions.ViewNavigationBarAction">
+ <add-to-group group-id="ViewMenu" relative-to-action="ViewStatusBar" anchor="after"/>
+ </action>
+
+ <action id="ViewImportPopups" class="com.intellij.openapi.editor.actions.ToggleShowImportPopupsAction">
+ <add-to-group group-id="ViewMenu" relative-to-action="EditorToggleShowLineNumbers" anchor="after"/>
+ </action>
+
+ <action id="ShowUsagesSettings" class="com.intellij.find.actions.ShowUsagesAction$ShowSettings"/>
+
+ <group id="ProjectViewGroup">
+ <action id="ProjectViewChangeView" class="com.intellij.ide.projectView.actions.ChangeProjectViewAction"/>
+ <action id="PopupHector" class="com.intellij.codeInsight.daemon.impl.PopupHectorAction"/>
+ <add-to-group group-id="ViewMenu" relative-to-action="QuickChangeScheme" anchor="after"/>
+ </group>
+
<group id="FoldingGroup" popup="true">
<action id="ExpandRegion" class="com.intellij.codeInsight.folding.impl.actions.ExpandRegionAction"/>
<action id="CollapseRegion" class="com.intellij.codeInsight.folding.impl.actions.CollapseRegionAction"/>
<add-to-group group-id="ViewMenu" relative-to-action="UIToggleActions" anchor="before"/>
</group>
- <group id="QuickActions">
- <action id="QuickImplementations" class="com.intellij.codeInsight.hint.actions.ShowImplementationsAction"/>
- <action id="QuickJavaDoc" class="com.intellij.codeInsight.documentation.actions.ShowQuickDocInfoAction"/>
-
- <add-to-group group-id="ViewMenu" anchor="first"/>
- </group>
-
<action id="RecentChanges" class="com.intellij.history.integration.ui.actions.RecentChangesAction">
<keyboard-shortcut first-keystroke="alt shift C" keymap="$default"/>
<add-to-group group-id="ViewRecentActions" anchor="last"/>
<action id="MethodHierarchy" class="com.intellij.ide.hierarchy.actions.BrowseMethodHierarchyAction"/>
<action id="CallHierarchy" class="com.intellij.ide.hierarchy.actions.BrowseCallHierarchyAction"/>
<separator/>
- <add-to-group group-id="ViewMenu" relative-to-action="UIToggleActions" anchor="before"/>
+ <add-to-group group-id="ViewMenu" relative-to-action="CodeEditorBaseGroup" anchor="after"/>
</group>
<!-- Go To -->
<action id="GotoTypeDeclaration" class="com.intellij.codeInsight.navigation.actions.GotoTypeDeclarationAction"/>
<action id="GotoSuperMethod" class="com.intellij.codeInsight.navigation.actions.GotoSuperAction"/>
<action id="GotoTest" class="com.intellij.testIntegration.GotoTestOrCodeAction"/>
- <action id="GotoRelated" class="com.intellij.ide.actions.GotoRelatedFileAction" text="_Related File"/>
+ <action id="GotoRelated" class="com.intellij.ide.actions.GotoRelatedFileAction"/>
<separator/>
<add-to-group group-id="GoToMenu" anchor="before" relative-to-action="GoToErrorGroup"/>
<action id="QuickChangeScheme" class="com.intellij.ide.actions.QuickChangeSchemesAction"/>
<group id="UIToggleActions">
<separator/>
- <action id="ViewToolBar" class="com.intellij.ide.actions.ViewToolbarAction"/>
- <action id="ViewStatusBar" class="com.intellij.ide.actions.ViewStatusBarAction"/>
- <action id="ViewToolButtons" class="com.intellij.ide.actions.ViewToolWindowButtonsAction"/>
<reference ref="EditorToggleShowWhitespaces"/>
<reference ref="EditorToggleShowLineNumbers"/>
<reference ref="EditorToggleShowIndentLines"/>
<reference ref="EditorToggleUseSoftWraps"/>
+ <separator/>
+ <action id="ViewToolBar" class="com.intellij.ide.actions.ViewToolbarAction"/>
+ <action id="ViewToolButtons" class="com.intellij.ide.actions.ViewToolWindowButtonsAction"/>
+ <action id="ViewStatusBar" class="com.intellij.ide.actions.ViewStatusBarAction"/>
</group>
</group>
myMainPanel = new JPanel(new BorderLayout());
final Configurable configurable = confs.keySet().iterator().next();
addComponent(confs.get(configurable), configurable, BorderLayout.CENTER);
- myMainPanel.add(Box.createHorizontalGlue());
+ myMainPanel.add(Box.createVerticalStrut(10), BorderLayout.SOUTH);
}
else {
myMainPanel = new JTabbedPane();
}
private void asyncRefreshFiles(final Set<VirtualFile> filesCreated) {
- ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
- public void run() {
- Set<VirtualFile> filesToRefresh = new HashSet<VirtualFile>();
- for (VirtualFile file : filesCreated) {
- if (belongsToThisRepository(file) && !myChangeListManager.isIgnoredFile(file)) {
- filesToRefresh.add(file);
- }
- }
- rescanFiles(filesToRefresh);
- myDirtyScopeManager.filesDirty(filesToRefresh, null); // make ChangeListManager capture new info
+ final Set<VirtualFile> filesToRefresh = new HashSet<VirtualFile>();
+ for (VirtualFile file : filesCreated) {
+ if (belongsToThisRepository(file) && !myChangeListManager.isIgnoredFile(file)) {
+ filesToRefresh.add(file);
}
- });
+ }
+
+ if (!filesToRefresh.isEmpty()) {
+ ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
+ public void run() {
+ rescanFiles(filesToRefresh);
+ myDirtyScopeManager.filesDirty(filesToRefresh, null); // make ChangeListManager capture new info
+ }
+ });
+ }
}
private boolean belongsToThisRepository(VirtualFile file) {
<depends>org.intellij.groovy</depends>
<extensions defaultExtensionNs="com.intellij">
+ <errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
<projectImportProvider implementation="org.jetbrains.plugins.gradle.importing.wizard.GradleProjectImportProvider"/>
<projectImportBuilder implementation="org.jetbrains.plugins.gradle.importing.wizard.GradleProjectImportBuilder"/>
<projectConfigurable instance="org.jetbrains.plugins.gradle.config.GradleConfigurable"/>
<library.presentationProvider implementation="org.jetbrains.plugins.gradle.config.GradleLibraryPresentationProvider" order="last"/>
+ <java.elementFinder implementation="org.jetbrains.plugins.gradle.config.GradleClassFinder"/>
<projectService serviceInterface="org.jetbrains.plugins.gradle.config.GradleSettings"
serviceImplementation="org.jetbrains.plugins.gradle.config.GradleSettings"/>
- <java.elementFinder implementation="org.jetbrains.plugins.gradle.config.GradleClassFinder"/>
+ <projectService serviceInterface="org.jetbrains.plugins.gradle.remote.GradleApiFacadeManager"
+ serviceImplementation="org.jetbrains.plugins.gradle.remote.GradleApiFacadeManager"/>
</extensions>
<extensions defaultExtensionNs="org.intellij.groovy">
--- /dev/null
+package org.jetbrains.plugins.gradle.importing.model;
+
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collection;
+
+/**
+ * Implementations of this interface are expected to be thread-safe.
+ *
+ * @author Denis Zhdanov
+ * @since 8/9/11 6:39 PM
+ */
+public interface GradleContentRoot {
+
+ @NotNull
+ String getRootPath();
+
+ /**
+ * @param type target dir type
+ * @return directories of the target type configured for the current content root
+ */
+ @NotNull
+ Collection<String> getPaths(@NotNull SourceType type);
+}
--- /dev/null
+package org.jetbrains.plugins.gradle.importing.model;
+
+import com.intellij.openapi.roots.DependencyScope;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Implementations of this interface are not obliged to be thread-safe.
+ *
+ * @author Denis Zhdanov
+ * @since 8/10/11 6:31 PM
+ */
+public interface GradleDependency {
+
+ boolean isExported();
+
+ @NotNull
+ DependencyScope getScope();
+
+ void invite(@NotNull GradleDependencyVisitor visitor);
+}
--- /dev/null
+package org.jetbrains.plugins.gradle.importing.model;
+
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Denis Zhdanov
+ * @since 8/10/11 6:31 PM
+ */
+public interface GradleDependencyVisitor {
+ void visit(@NotNull GradleModuleDependency dependency);
+ void visit(@NotNull GradleLibraryDependency dependency);
+}
--- /dev/null
+package org.jetbrains.plugins.gradle.importing.model;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Implementations of this interface are not obliged to be thread-safe.
+ *
+ * @author Denis Zhdanov
+ * @since 8/10/11 6:32 PM
+ */
+public interface GradleLibraryDependency extends GradleDependency {
+
+ @NotNull
+ String getName();
+
+ /**
+ * Allows to ask for the target path configured for the current library dependency.
+ *
+ * @param type target path type
+ * @return path to the target path configured for the current library dependency
+ */
+ @Nullable
+ String getPath(@NotNull LibraryPathType type);
+}
package org.jetbrains.plugins.gradle.importing.model;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collection;
+
/**
* Defines IntelliJ module view to the application configured via gradle.
* <p/>
* @since 8/8/11 12:10 PM
*/
public interface GradleModule {
+
+ @NotNull
+ String getName();
+
+ @NotNull
+ Collection<? extends GradleContentRoot> getContentRoots();
+
+ boolean isInheritProjectCompileOutputPath();
+
+ /**
+ * Allows to get file system path of the compile output of the source of the target type.
+ *
+ * @param type target source type
+ * @return file system path to use for compile output for the target source type;
+ * {@link GradleProject#getCompileOutputPath() project compile output path} should be used if current module
+ * doesn't provide specific compile output path
+ */
+ @Nullable
+ String getCompileOutputPath(@NotNull SourceType type);
+
+ @NotNull
+ Collection<GradleDependency> getDependencies();
}
--- /dev/null
+package org.jetbrains.plugins.gradle.importing.model;
+
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author Denis Zhdanov
+ * @since 8/10/11 6:32 PM
+ */
+public interface GradleModuleDependency extends GradleDependency {
+
+ @NotNull
+ GradleModule getModule();
+}
+++ /dev/null
-package org.jetbrains.plugins.gradle.importing.model;
-
-import java.io.Serializable;
-
-/**
- * @author Denis Zhdanov
- * @since 8/8/11 12:11 PM
- */
-public class GradleModuleImpl implements GradleModule, Serializable {
-
- // TODO den implement
-}
*/
public interface GradleProject {
+ @NotNull
+ String getName();
+
+ @NotNull
+ String getCompileOutputPath();
+
@NotNull
String getJdkName();
--- /dev/null
+package org.jetbrains.plugins.gradle.importing.model;
+
+/**
+ * @author Denis Zhdanov
+ * @since 8/10/11 6:37 PM
+ */
+public enum LibraryPathType {
+ BINARY, SOURCE, JAVADOC}
--- /dev/null
+package org.jetbrains.plugins.gradle.importing.model;
+
+/**
+ * Enumerates module source types.
+ *
+ * @author Denis Zhdanov
+ * @since 8/10/11 5:21 PM
+ */
+public enum SourceType {
+ SOURCE, TEST, EXCLUDED
+}
--- /dev/null
+package org.jetbrains.plugins.gradle.importing.model.impl;
+
+import com.intellij.openapi.roots.DependencyScope;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.gradle.importing.model.GradleDependency;
+
+import java.io.Serializable;
+
+/**
+ * @author Denis Zhdanov
+ * @since 8/10/11 6:41 PM
+ */
+public abstract class AbstractGradleDependency implements GradleDependency, Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private DependencyScope myScope = DependencyScope.COMPILE;
+ private boolean myExported;
+
+ @NotNull
+ @Override
+ public DependencyScope getScope() {
+ return myScope;
+ }
+
+ public void setScope(DependencyScope scope) {
+ myScope = scope;
+ }
+
+ @Override
+ public boolean isExported() {
+ return myExported;
+ }
+
+ public void setExported(boolean exported) {
+ myExported = exported;
+ }
+
+ @Override
+ public String toString() {
+ return "scope: " + getScope() + ", exported: " + isExported();
+ }
+}
--- /dev/null
+package org.jetbrains.plugins.gradle.importing.model.impl;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.gradle.importing.model.GradleContentRoot;
+import org.jetbrains.plugins.gradle.importing.model.SourceType;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.*;
+
+/**
+ * @author Denis Zhdanov
+ * @since 8/9/11 6:25 PM
+ */
+public class GradleContentRootImpl implements Serializable, GradleContentRoot {
+
+ private static final long serialVersionUID = 1L;
+
+ private final Map<SourceType, Collection<String>> myData = new EnumMap<SourceType, Collection<String>>(SourceType.class);
+ private final Map<SourceType, Collection<String>> myViews = new EnumMap<SourceType, Collection<String>>(SourceType.class);
+
+ private final String myRootPath;
+
+ /**
+ * Creates new <code>GradleContentRootImpl</code> object.
+ *
+ * @param rootPath path to the root directory
+ */
+ public GradleContentRootImpl(@NotNull String rootPath) {
+ myRootPath = new File(rootPath).getAbsolutePath();
+ for (SourceType type : SourceType.values()) {
+ Set<String> data = new HashSet<String>();
+ myData.put(type, data);
+ myViews.put(type, Collections.unmodifiableCollection(data));
+ }
+ }
+
+ @NotNull
+ @Override
+ public Collection<String> getPaths(@NotNull SourceType type) {
+ return myViews.get(type);
+ }
+
+ public void storePath(@NotNull SourceType type, @NotNull String path) {
+ myData.get(type).add(new File(path).getAbsolutePath());
+ }
+
+ @NotNull
+ @Override
+ public String getRootPath() {
+ return myRootPath;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder buffer = new StringBuilder();
+ for (Map.Entry<SourceType, Collection<String>> entry : myData.entrySet()) {
+ buffer.append(entry.getKey().toString().toLowerCase()).append(": ").append(entry.getValue()).append("; ");
+ }
+ buffer.setLength(buffer.length() - 2);
+ return buffer.toString();
+ }
+}
--- /dev/null
+package org.jetbrains.plugins.gradle.importing.model.impl;
+
+import com.intellij.util.containers.HashMap;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.plugins.gradle.importing.model.GradleDependencyVisitor;
+import org.jetbrains.plugins.gradle.importing.model.GradleLibraryDependency;
+import org.jetbrains.plugins.gradle.importing.model.LibraryPathType;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ * @author Denis Zhdanov
+ * @since 8/10/11 6:46 PM
+ */
+public class GradleLibraryDependencyImpl extends AbstractGradleDependency implements GradleLibraryDependency, Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private final Map<LibraryPathType, String> myPaths = new HashMap<LibraryPathType, String>();
+
+ private final String myName;
+
+ public GradleLibraryDependencyImpl(@NotNull String name) {
+ myName = name;
+ }
+
+ @NotNull
+ @Override
+ public String getName() {
+ return myName;
+ }
+
+ @Nullable
+ @Override
+ public String getPath(@NotNull LibraryPathType type) {
+ return myPaths.get(type);
+ }
+
+ public void addPath(@NotNull LibraryPathType type, @NotNull String path) {
+ myPaths.put(type, new File(path).getAbsolutePath());
+ }
+
+ @Override
+ public void invite(@NotNull GradleDependencyVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + ", library: " + getName();
+ }
+}
--- /dev/null
+package org.jetbrains.plugins.gradle.importing.model.impl;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.plugins.gradle.importing.model.GradleDependencyVisitor;
+import org.jetbrains.plugins.gradle.importing.model.GradleModule;
+import org.jetbrains.plugins.gradle.importing.model.GradleModuleDependency;
+
+import java.io.Serializable;
+
+/**
+ * @author Denis Zhdanov
+ * @since 8/10/11 6:40 PM
+ */
+public class GradleModuleDependencyImpl extends AbstractGradleDependency implements GradleModuleDependency, Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private final GradleModule myModule;
+
+ public GradleModuleDependencyImpl(@NotNull GradleModule module) {
+ myModule = module;
+ }
+
+ @NotNull
+ @Override
+ public GradleModule getModule() {
+ return myModule;
+ }
+
+ @Override
+ public void invite(@NotNull GradleDependencyVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + ", dependency module: " + getModule();
+ }
+}
--- /dev/null
+package org.jetbrains.plugins.gradle.importing.model.impl;
+
+import com.intellij.util.containers.HashMap;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.plugins.gradle.importing.model.GradleContentRoot;
+import org.jetbrains.plugins.gradle.importing.model.GradleDependency;
+import org.jetbrains.plugins.gradle.importing.model.GradleModule;
+import org.jetbrains.plugins.gradle.importing.model.SourceType;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.*;
+
+/**
+ * @author Denis Zhdanov
+ * @since 8/8/11 12:11 PM
+ */
+public class GradleModuleImpl implements GradleModule, Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private final List<GradleContentRoot> myContentRoots = new ArrayList<GradleContentRoot>();
+ private final Map<SourceType, String> myCompileOutputPaths = new HashMap<SourceType, String>();
+ private final Set<GradleDependency> myDependencies = new HashSet<GradleDependency>();
+ private final Collection<GradleDependency> myDependenciesView = Collections.unmodifiableCollection(myDependencies);
+
+ private boolean myInheritProjectCompileOutputPath = true;
+
+ private final String myName;
+
+ public GradleModuleImpl(@NotNull String name) {
+ myName = name;
+ }
+
+ @NotNull
+ @Override
+ public String getName() {
+ return myName;
+ }
+
+ @NotNull
+ @Override
+ public Collection<GradleContentRoot> getContentRoots() {
+ return myContentRoots;
+ }
+
+ public void addContentRoot(@NotNull GradleContentRoot contentRoot) {
+ myContentRoots.add(contentRoot);
+ }
+
+ @Override
+ public boolean isInheritProjectCompileOutputPath() {
+ return myInheritProjectCompileOutputPath;
+ }
+
+ public void setInheritProjectCompileOutputPath(boolean inheritProjectCompileOutputPath) {
+ myInheritProjectCompileOutputPath = inheritProjectCompileOutputPath;
+ }
+
+ @Nullable
+ @Override
+ public String getCompileOutputPath(@NotNull SourceType type) {
+ return myCompileOutputPaths.get(type);
+ }
+
+ public void setCompileOutputPath(@NotNull SourceType type, @Nullable String path) {
+ if (path == null) {
+ myCompileOutputPaths.remove(type);
+ return;
+ }
+ myCompileOutputPaths.put(type, new File(path).getAbsolutePath());
+ }
+
+ @NotNull
+ @Override
+ public Collection<GradleDependency> getDependencies() {
+ return myDependenciesView;
+ }
+
+ public void addDependency(@NotNull GradleDependency dependency) {
+ myDependencies.add(dependency);
+ }
+
+ @Override
+ public String toString() {
+ return String.format(
+ "module '%s'. Content roots: %s; inherit compile output path: %b",
+ getName(), getContentRoots(), isInheritProjectCompileOutputPath()
+ );
+ }
+}
-package org.jetbrains.plugins.gradle.importing.model;
+package org.jetbrains.plugins.gradle.importing.model.impl;
import com.intellij.pom.java.LanguageLevel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.plugins.gradle.importing.model.GradleModule;
+import org.jetbrains.plugins.gradle.importing.model.GradleProject;
+import java.io.File;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
public class GradleProjectImpl implements Serializable, GradleProject {
private static final long serialVersionUID = 1L;
+
private static final LanguageLevel DEFAULT_LANGUAGE_LEVEL = LanguageLevel.JDK_1_6;
private static final String DEFAULT_JDK = "1.6";
private final Set<GradleModuleImpl> myModules = new HashSet<GradleModuleImpl>();
+ private final String myCompileOutputPath;
+
+ private String myName = "unnamed";
private String myJdk = DEFAULT_JDK;
private LanguageLevel myLanguageLevel = DEFAULT_LANGUAGE_LEVEL;
-
+
+ public GradleProjectImpl(@NotNull String compileOutputPath) {
+ myCompileOutputPath = new File(compileOutputPath).getAbsolutePath();
+ }
+
+ @NotNull
+ @Override
+ public String getName() {
+ return myName;
+ }
+
+ public void setName(@NotNull String name) {
+ myName = name;
+ }
+
+ @NotNull
+ @Override
+ public String getCompileOutputPath() {
+ return myCompileOutputPath;
+ }
+
@NotNull
@Override
public String getJdkName() {
return myJdk;
}
- public void setJdk(@NotNull String jdk) {
- myJdk = jdk;
+ public void setJdk(@Nullable String jdk) {
+ if (jdk != null) {
+ myJdk = jdk;
+ }
}
@NotNull
public Set<? extends GradleModule> getModules() {
return myModules;
}
+
+ @Override
+ public String toString() {
+ return String.format("project '%s'. Jdk: '%s', language level: '%s', modules: %s",
+ getName(), getJdkName(), getLanguageLevel(), getModules());
+ }
}
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
import com.intellij.packaging.artifacts.ModifiableArtifactModel;
import com.intellij.projectImport.ProjectImportBuilder;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.gradle.importing.model.GradleProject;
import org.jetbrains.plugins.gradle.remote.GradleApiFacadeManager;
-import org.jetbrains.plugins.gradle.remote.api.GradleProjectResolver;
+import org.jetbrains.plugins.gradle.remote.GradleProjectResolver;
import org.jetbrains.plugins.gradle.util.GradleBundle;
import org.jetbrains.plugins.gradle.util.GradleIcons;
import org.jetbrains.plugins.gradle.util.GradleLog;
throw new ConfigurationException(GradleBundle.message("gradle.import.text.error.directory.instead.file"));
}
try {
- ProgressManager.getInstance().run(new Task.Modal(null, GradleBundle.message("gradle.import.progress.text"), true) {
+ // TODO den derive target project for 'import module from gradle'.
+ Project project = ProjectManager.getInstance().getDefaultProject();
+ ProgressManager.getInstance().run(new Task.Modal(project, GradleBundle.message("gradle.import.progress.text"), true) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
- GradleApiFacadeManager manager = ServiceManager.getService(GradleApiFacadeManager.class);
+ GradleApiFacadeManager manager = ServiceManager.getService(getProject(), GradleApiFacadeManager.class);
try {
GradleProjectResolver resolver = manager.getFacade().getResolver();
myGradleProject = resolver.resolveProjectInfo(myProjectFile.getAbsolutePath());
-package org.jetbrains.plugins.gradle.remote.api;
+package org.jetbrains.plugins.gradle.remote;
import org.jetbrains.annotations.NotNull;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.gradle.remote.api.GradleApiFacade;
-import org.jetbrains.plugins.gradle.remote.api.RemoteGradleProcessSettings;
import org.jetbrains.plugins.gradle.remote.impl.GradleApiFacadeImpl;
import org.jetbrains.plugins.gradle.util.GradleBundle;
import org.jetbrains.plugins.gradle.util.GradleLibraryManager;
params.setMainClass(MAIN_CLASS_NAME);
params.getVMParametersList().addParametersString("-Djava.awt.headless=true -Xmx512m");
- //params.getVMParametersList().addParametersString("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5009");
+ // TODO den comment
+ params.getVMParametersList().addParametersString("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5009");
return params;
}
-package org.jetbrains.plugins.gradle.remote.api;
+package org.jetbrains.plugins.gradle.remote;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.gradle.importing.model.GradleProject;
-package org.jetbrains.plugins.gradle.remote.api;
+package org.jetbrains.plugins.gradle.remote;
import org.jetbrains.annotations.NotNull;
-package org.jetbrains.plugins.gradle.remote.api;
+package org.jetbrains.plugins.gradle.remote;
import org.jetbrains.annotations.NotNull;
import com.intellij.execution.rmi.RemoteServer;
import com.intellij.util.containers.ConcurrentHashMap;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.gradle.remote.api.GradleApiFacade;
-import org.jetbrains.plugins.gradle.remote.api.GradleProjectResolver;
-import org.jetbrains.plugins.gradle.remote.api.RemoteGradleProcessSettings;
-import org.jetbrains.plugins.gradle.remote.api.RemoteGradleService;
+import org.jetbrains.plugins.gradle.remote.GradleApiFacade;
+import org.jetbrains.plugins.gradle.remote.GradleProjectResolver;
+import org.jetbrains.plugins.gradle.remote.RemoteGradleProcessSettings;
+import org.jetbrains.plugins.gradle.remote.RemoteGradleService;
import java.rmi.Remote;
import java.rmi.RemoteException;
package org.jetbrains.plugins.gradle.remote.impl;
import com.intellij.execution.rmi.RemoteObject;
+import com.intellij.openapi.roots.DependencyScope;
+import com.intellij.util.containers.HashMap;
import org.gradle.tooling.GradleConnector;
import org.gradle.tooling.ProjectConnection;
-import org.gradle.tooling.model.idea.OfflineIdeaProject;
+import org.gradle.tooling.model.DomainObjectSet;
+import org.gradle.tooling.model.idea.*;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.gradle.importing.model.GradleProject;
-import org.jetbrains.plugins.gradle.importing.model.GradleProjectImpl;
-import org.jetbrains.plugins.gradle.remote.api.GradleProjectResolver;
-import org.jetbrains.plugins.gradle.remote.api.RemoteGradleProcessSettings;
-import org.jetbrains.plugins.gradle.remote.api.RemoteGradleService;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.plugins.gradle.importing.model.*;
+import org.jetbrains.plugins.gradle.importing.model.impl.*;
+import org.jetbrains.plugins.gradle.remote.GradleProjectResolver;
+import org.jetbrains.plugins.gradle.remote.RemoteGradleProcessSettings;
+import org.jetbrains.plugins.gradle.remote.RemoteGradleService;
import org.jetbrains.plugins.gradle.util.GradleBundle;
import org.jetbrains.plugins.gradle.util.GradleLog;
import java.io.File;
import java.rmi.RemoteException;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
private GradleProject doResolve(@NotNull String projectPath) {
ProjectConnection connection = getConnection(projectPath);
OfflineIdeaProject project = connection.getModel(OfflineIdeaProject.class);
- GradleProjectImpl result = new GradleProjectImpl();
+ GradleProjectImpl result = populateProject(project, projectPath);
+ populateModules(project, result);
+ return result;
+ }
+
+ private static GradleProjectImpl populateProject(@NotNull IdeaProject project, @NotNull String projectPath) {
+ // TODO den retrieve the value from the gradle api as soon as it's ready
+ GradleProjectImpl result = new GradleProjectImpl(new File(projectPath).getParentFile().getAbsolutePath() + "/out");
+ result.setName(project.getName());
result.setJdk(project.getJdkName());
result.setLanguageLevel(project.getLanguageLevel().getLevel());
- // TODO den build modules here
return result;
}
+ private static void populateModules(@NotNull IdeaProject gradleProject, @NotNull GradleProjectImpl intellijProject)
+ throws IllegalStateException
+ {
+ DomainObjectSet<? extends IdeaModule> gradleModules = gradleProject.getModules();
+ if (gradleModules == null || gradleModules.isEmpty()) {
+ throw new IllegalStateException("No modules found for the target project: " + gradleProject);
+ }
+ Map<String, GradleModule> modules = new HashMap<String, GradleModule>();
+ for (IdeaModule gradleModule : gradleModules) {
+ if (gradleModule == null) {
+ continue;
+ }
+ GradleModuleImpl module = populateModule(gradleModule, intellijProject);
+ String moduleName = module.getName();
+ GradleModule previouslyParsedModule = modules.get(moduleName);
+ if (modules.containsKey(moduleName)) {
+ throw new IllegalStateException(
+ String.format("Modules with duplicate name (%s) detected: '%s' and '%s'", moduleName, module, previouslyParsedModule)
+ );
+ }
+ modules.put(moduleName, module);
+ intellijProject.addModule(module);
+ }
+ }
+
+ @NotNull
+ private static GradleModuleImpl populateModule(@NotNull IdeaModule gradleModule, @NotNull GradleProject intellijProject)
+ throws IllegalStateException
+ {
+ String name = gradleModule.getName();
+ if (name == null) {
+ throw new IllegalStateException("Module with undefined name detected: " + gradleModule);
+ }
+ GradleModuleImpl result = new GradleModuleImpl(name);
+ populateContentRoots(gradleModule, result);
+ populateCompileOutputSettings(gradleModule.getCompilerOutput(), result);
+ populateDependencies(gradleModule, result, intellijProject);
+ return result;
+ }
+
+ private static void populateContentRoots(@NotNull IdeaModule gradleModule, @NotNull GradleModuleImpl intellijModule) {
+ DomainObjectSet<? extends IdeaContentRoot> contentRoots = gradleModule.getContentRoots();
+ if (contentRoots == null) {
+ return;
+ }
+ for (IdeaContentRoot gradleContentRoot : contentRoots) {
+ if (gradleContentRoot == null) {
+ continue;
+ }
+ File rootDirectory = gradleContentRoot.getRootDirectory();
+ if (rootDirectory == null) {
+ continue;
+ }
+ GradleContentRootImpl intellijContentRoot = new GradleContentRootImpl(rootDirectory.getAbsolutePath());
+ populateContentRoot(intellijContentRoot, SourceType.SOURCE, gradleContentRoot.getSourceDirectories());
+ populateContentRoot(intellijContentRoot, SourceType.TEST, gradleContentRoot.getTestDirectories());
+ Set<File> excluded = gradleContentRoot.getExcludeDirectories();
+ if (excluded != null) {
+ for (File file : excluded) {
+ intellijContentRoot.storePath(SourceType.EXCLUDED, file.getAbsolutePath());
+ }
+ }
+ intellijModule.addContentRoot(intellijContentRoot);
+ }
+ }
+
+ private static void populateContentRoot(@NotNull GradleContentRootImpl contentRoot, SourceType type,
+ @Nullable Iterable<? extends IdeaSourceDirectory> dirs) {
+ if (dirs == null) {
+ return;
+ }
+ for (IdeaSourceDirectory dir : dirs) {
+ contentRoot.storePath(type, dir.getDirectory().getAbsolutePath());
+ }
+ }
+
+ private static void populateCompileOutputSettings(@Nullable IdeaCompilerOutput gradleSettings,
+ @NotNull GradleModuleImpl intellijModule) {
+ if (gradleSettings == null) {
+ return;
+ }
+ intellijModule.setInheritProjectCompileOutputPath(gradleSettings.getInheritOutputDirs());
+
+ File sourceCompileOutputPath = gradleSettings.getOutputDir();
+ if (sourceCompileOutputPath != null) {
+ intellijModule.setCompileOutputPath(SourceType.SOURCE, sourceCompileOutputPath.getAbsolutePath());
+ }
+
+ File testCompileOutputPath = gradleSettings.getTestOutputDir();
+ if (testCompileOutputPath != null) {
+ intellijModule.setCompileOutputPath(SourceType.TEST, testCompileOutputPath.getAbsolutePath());
+ }
+ }
+
+ private static void populateDependencies(@NotNull IdeaModule gradleModule, @NotNull GradleModuleImpl intellijModule,
+ @NotNull GradleProject intellijProject)
+ {
+ DomainObjectSet<? extends IdeaDependency> dependencies = gradleModule.getDependencies();
+ if (dependencies == null) {
+ return;
+ }
+ for (IdeaDependency dependency : dependencies) {
+ if (dependency == null) {
+ continue;
+ }
+ AbstractGradleDependency intellijDependency = null;
+ if (dependency instanceof IdeaModuleDependency) {
+ intellijDependency = buildDependency((IdeaModuleDependency)dependency, intellijProject);
+ }
+ else if (dependency instanceof IdeaSingleEntryLibraryDependency) {
+ intellijDependency = buildDependency((IdeaSingleEntryLibraryDependency)dependency);
+ }
+
+ if (intellijDependency == null) {
+ continue;
+ }
+
+ intellijDependency.setExported(dependency.getExported());
+ DependencyScope scope = parseScope(dependency.getScope());
+ if (scope != null) {
+ intellijDependency.setScope(scope);
+ }
+ intellijModule.addDependency(intellijDependency);
+ }
+ }
+
+ private static AbstractGradleDependency buildDependency(@NotNull IdeaModuleDependency dependency, @NotNull GradleProject intellijProject)
+ throws IllegalStateException
+ {
+ IdeaModule module = dependency.getDependencyModule();
+ if (module == null) {
+ throw new IllegalStateException(
+ String.format("Can't parse gradle module dependency '%s'. Reason: referenced module is null", dependency)
+ );
+ }
+
+ String moduleName = module.getName();
+ if (moduleName == null) {
+ throw new IllegalStateException(String.format(
+ "Can't parse gradle module dependency '%s'. Reason: referenced module name is undefined (module: '%s') ", dependency, module
+ ));
+ }
+
+ Set<String> registeredModuleNames = new HashSet<String>();
+ for (GradleModule gradleModule : intellijProject.getModules()) {
+ registeredModuleNames.add(gradleModule.getName());
+ if (gradleModule.getName().equals(moduleName)) {
+ return new GradleModuleDependencyImpl(gradleModule);
+ }
+ }
+ throw new IllegalStateException(String.format(
+ "Can't parse gradle module dependency '%s'. Reason: no module with such name (%s) is found. Registered modules: %s",
+ dependency, moduleName, registeredModuleNames
+ ));
+ }
+
+ private static AbstractGradleDependency buildDependency(@NotNull IdeaSingleEntryLibraryDependency dependency)
+ throws IllegalStateException
+ {
+ File binaryPath = dependency.getFile();
+ if (binaryPath == null) {
+ throw new IllegalStateException(String.format(
+ "Can't parse external library dependency '%s'. Reason: it doesn't specify path to the binaries", dependency
+ ));
+ }
+
+ // TODO den use library name from gradle api when it's ready
+ GradleLibraryDependencyImpl result = new GradleLibraryDependencyImpl(binaryPath.getName());
+ result.addPath(LibraryPathType.BINARY, binaryPath.getAbsolutePath());
+
+ File sourcePath = dependency.getSource();
+ if (sourcePath != null) {
+ result.addPath(LibraryPathType.SOURCE, sourcePath.getAbsolutePath());
+ }
+
+ File javadocPath = dependency.getJavadoc();
+ if (javadocPath != null) {
+ result.addPath(LibraryPathType.JAVADOC, javadocPath.getAbsolutePath());
+ }
+ return result;
+ }
+
+ @Nullable
+ private static DependencyScope parseScope(@Nullable IdeaDependencyScope scope) {
+ if (scope == null) {
+ return null;
+ }
+ String scopeAsString = scope.getScope();
+ if (scopeAsString == null) {
+ return null;
+ }
+ for (DependencyScope dependencyScope : DependencyScope.values()) {
+ if (scopeAsString.equalsIgnoreCase(dependencyScope.toString())) {
+ return dependencyScope;
+ }
+ }
+ return null;
+ }
+
/**
* Allows to retrieve gradle api connection to use for the given project.
*
package com.intellij.lang.properties.xml;
-import com.intellij.util.indexing.FileContent;
+import com.intellij.util.indexing.FileContentImpl;
import junit.framework.TestCase;
import java.util.Map;
public class XmlPropertiesIndexTest extends TestCase {
public void testIndex() throws Exception {
- Map<XmlPropertiesIndex.Key, String> map = new XmlPropertiesIndex().map(new FileContent(("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ Map<XmlPropertiesIndex.Key, String> map = new XmlPropertiesIndex().map(new FileContentImpl(("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<!DOCTYPE properties SYSTEM \"http://java.sun.com/dtd/properties.dtd\">\n" +
"<properties>\n" +
"<comment>Hi</comment>\n" +
}
public void testSystemId() throws Exception {
- Map<XmlPropertiesIndex.Key, String> map = new XmlPropertiesIndex().map(new FileContent(("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ Map<XmlPropertiesIndex.Key, String> map = new XmlPropertiesIndex().map(new FileContentImpl(("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<!DOCTYPE properties SYSTEM \"unknown\">\n" +
"<properties>\n" +
"<comment>Hi</comment>\n" +
hotswap.dialog.title.with.session=Reload Changed Classes for {0}
hotswap.dialog.title=Reload Changed Classes
hotswap.dialog.run.prompt=Some classes have been changed. Reload changed classes now?
-hotswap.dialog.hang.warning=JVM is currently suspended.\nClasses reloading with active third-party JVM agents may cause the JVM to hang.
+hotswap.dialog.hang.warning=JVM is currently suspended.\nReloading classes with active third-party JVM agents may cause the JVM to hang.
hotswap.dialog.hang.question=Would you like to reload changed classes anyway?
evaluate.statement.dialog.title=Code Fragment Evaluation
label.evaluation.dialog.statements=Statements to &evaluate:
<consoleFilterProvider implementation="com.intellij.execution.filters.DefaultConsoleFiltersProvider"/>
- <selectInTarget implementation="com.intellij.ide.impl.ProjectSettingsSelectInTarget"/>
+ <selectInTarget implementation="com.intellij.ide.impl.ProjectStructureSelectInTarget"/>
<OrderRootTypeUI key="JAVADOC"
implementationClass="com.intellij.openapi.roots.ui.configuration.libraryEditor.JavadocOrderRootTypeUIFactory"/>