本文整理汇总了Java中com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable类的典型用法代码示例。如果您正苦于以下问题:Java ProjectStructureConfigurable类的具体用法?Java ProjectStructureConfigurable怎么用?Java ProjectStructureConfigurable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProjectStructureConfigurable类属于com.intellij.openapi.roots.ui.configuration包,在下文中一共展示了ProjectStructureConfigurable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: forLibrary
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable; //导入依赖的package包/类
@NotNull
@Override
public CellAppearanceEx forLibrary(Project project, @NotNull final Library library, final boolean hasInvalidRoots) {
final StructureConfigurableContext context = ProjectStructureConfigurable.getInstance(project).getContext();
final Icon icon = LibraryPresentationManager.getInstance().getCustomIcon(library, context);
final String name = library.getName();
if (name != null) {
return normalOrRedWaved(name, (icon != null ? icon : PlatformIcons.LIBRARY_ICON), hasInvalidRoots);
}
final String[] files = library.getUrls(OrderRootType.CLASSES);
if (files.length == 0) {
return SimpleTextCellAppearance.invalid(ProjectBundle.message("library.empty.library.item"), PlatformIcons.LIBRARY_ICON);
}
else if (files.length == 1) {
return forVirtualFilePointer(new LightFilePointer(files[0]));
}
final String url = StringUtil.trimEnd(files[0], JarFileSystem.JAR_SEPARATOR);
return SimpleTextCellAppearance.regular(PathUtil.getFileName(url), PlatformIcons.LIBRARY_ICON);
}
示例2: performFix
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable; //导入依赖的package包/类
@Override
public void performFix() {
final LibraryTable.ModifiableModel libraryTable = myContext.getModifiableLibraryTable(myLibrary.getTable());
if (libraryTable instanceof LibrariesModifiableModel) {
for (String invalidRoot : myInvalidUrls) {
final ExistingLibraryEditor libraryEditor = ((LibrariesModifiableModel)libraryTable).getLibraryEditor(myLibrary);
libraryEditor.removeRoot(invalidRoot, myType);
}
myContext.getDaemonAnalyzer().queueUpdate(LibraryProjectStructureElement.this);
final ProjectStructureConfigurable structureConfigurable = ProjectStructureConfigurable.getInstance(myContext.getProject());
navigate().doWhenDone(new Runnable() {
@Override
public void run() {
final NamedConfigurable configurable = structureConfigurable.getConfigurableFor(myLibrary).getSelectedConfigurable();
if (configurable instanceof LibraryConfigurable) {
((LibraryConfigurable)configurable).updateComponent();
}
}
});
}
}
示例3: selectLibrary
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable; //导入依赖的package包/类
@Override
public void selectLibrary(@NotNull Library library) {
final LibraryTable table = library.getTable();
if (table != null) {
ProjectStructureConfigurable.getInstance(getProject()).selectProjectOrGlobalLibrary(library, true);
}
else {
final Module module = ((LibraryImpl)library).getModule();
if (module != null) {
final ModuleRootModel rootModel = myParent.getModulesProvider().getRootModel(module);
final String libraryName = library.getName();
for (OrderEntry entry : rootModel.getOrderEntries()) {
if (entry instanceof ModuleLibraryOrderEntryImpl) {
final ModuleLibraryOrderEntryImpl libraryEntry = (ModuleLibraryOrderEntryImpl)entry;
if (libraryName != null && libraryName.equals(libraryEntry.getLibraryName())
|| libraryName == null && library.equals(libraryEntry.getLibrary())) {
ProjectStructureConfigurable.getInstance(getProject()).selectOrderEntry(module, libraryEntry);
return;
}
}
}
}
}
}
示例4: navigate
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable; //导入依赖的package包/类
@Override
public void navigate(boolean openLibraryEditor) {
final OrderEntry entry = getSelectedEntry();
final ProjectStructureConfigurable rootConfigurable = ProjectStructureConfigurable.getInstance(myState.getProject());
if (entry instanceof ModuleOrderEntry){
Module module = ((ModuleOrderEntry)entry).getModule();
if (module != null) {
rootConfigurable.select(module.getName(), null, true);
}
}
else if (entry instanceof LibraryOrderEntry){
if (!openLibraryEditor && !((LibraryOrderEntry)entry).getLibraryLevel().equals(LibraryTableImplUtil.MODULE_LEVEL)) {
rootConfigurable.select((LibraryOrderEntry)entry, true);
}
else {
doEdit();
}
}
else if (entry instanceof JdkOrderEntry) {
Sdk jdk = ((JdkOrderEntry)entry).getJdk();
if (jdk != null) {
rootConfigurable.select(jdk, true);
}
}
}
示例5: actionPerformed
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
FacetInfo parent = myEditor.getSelectedFacetInfo();
final FacetTypeId<?> underlyingFacetType = myType.getUnderlyingFacetType();
Facet facet;
if (parent == null && underlyingFacetType == null || parent != null && parent.getFacetType().getId() == underlyingFacetType) {
facet = myEditor.createFacet(parent, myType);
}
else {
LOG.assertTrue(parent != null);
final FacetInfo grandParent = myEditor.getParent(parent);
LOG.assertTrue(grandParent == null && underlyingFacetType == null ||
grandParent != null && grandParent.getFacetType().getId() == underlyingFacetType);
facet = myEditor.createFacet(grandParent, myType);
}
ProjectStructureConfigurable.getInstance(myProject).select(facet, true);
}
示例6: fillList
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable; //导入依赖的package包/类
public void fillList(final @Nullable SdkType type, final @Nullable Sdk[] globalSdks) {
myListModel.clear();
final Sdk[] jdks;
if (myProject == null || myProject.isDefault()) {
final Sdk[] allJdks = globalSdks != null ? globalSdks : ProjectJdkTable.getInstance().getAllJdks();
jdks = getCompatibleJdks(type, Arrays.asList(allJdks));
}
else {
final ProjectSdksModel projectJdksModel = ProjectStructureConfigurable.getInstance(myProject).getProjectJdksModel();
if (!projectJdksModel.isInitialized()){ //should be initialized
projectJdksModel.reset(myProject);
}
final Collection<Sdk> collection = projectJdksModel.getProjectSdks().values();
jdks = getCompatibleJdks(type, collection);
}
Arrays.sort(jdks, new Comparator<Sdk>() {
public int compare(final Sdk o1, final Sdk o2) {
return o1.getName().compareToIgnoreCase(o2.getName());
}
});
for (Sdk jdk : jdks) {
myListModel.addElement(jdk);
}
}
示例7: run
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable; //导入依赖的package包/类
@Override
public void run() {
final Set<String> sdkNames = getSdkNamesFromModules(myProblemModules);
if (sdkNames.size() == 1) {
final Sdk sdk = ProjectJdkTable.getInstance().findJdk(sdkNames.iterator().next());
if (sdk != null && sdk.getSdkType() instanceof AndroidSdkType) {
final ProjectStructureConfigurable config = ProjectStructureConfigurable.getInstance(myProject);
if (ShowSettingsUtil.getInstance().editConfigurable(myProject, config, new Runnable() {
@Override
public void run() {
config.select(sdk, true);
}
})) {
askAndRebuild(myProject);
}
return;
}
}
final String moduleToSelect = myProblemModules.size() > 0
? myProblemModules.iterator().next().getName()
: null;
if (ModulesConfigurator.showDialog(myProject, moduleToSelect, ClasspathEditor.NAME)) {
askAndRebuild(myProject);
}
}
示例8: actionPerformed
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
final ProjectStructureElement selectedElement = mySourceConfigurable.getSelectedElement();
if (!(selectedElement instanceof LibraryProjectStructureElement)) return;
final StructureConfigurableContext context = mySourceConfigurable.myContext;
final LibraryProjectStructureElement libraryElement = (LibraryProjectStructureElement)selectedElement;
final LibraryEx oldLibrary = (LibraryEx)context.getLibrary(libraryElement.getLibrary().getName(), mySourceConfigurable.getLevel());
LOG.assertTrue(oldLibrary != null);
final Library newLibrary = doCopy(oldLibrary);
if (newLibrary == null) return;
final Collection<ProjectStructureElementUsage> usages = context.getDaemonAnalyzer().getUsages(libraryElement);
for (ProjectStructureElementUsage usage : usages) {
usage.replaceElement(new LibraryProjectStructureElement(context, newLibrary));
}
if (!myCopy) {
mySourceConfigurable.removeLibrary(libraryElement);
}
ProjectStructureConfigurable.getInstance(myProject).selectProjectOrGlobalLibrary(newLibrary, true);
}
示例9: navigate
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable; //导入依赖的package包/类
@Override
public void navigate(boolean openLibraryEditor) {
final OrderEntry entry = getSelectedEntry();
final ProjectStructureConfigurable rootConfigurable = ProjectStructureConfigurable.getInstance(myState.getProject());
if (entry instanceof ModuleOrderEntry){
Module module = ((ModuleOrderEntry)entry).getModule();
if (module != null) {
rootConfigurable.select(module.getName(), null, true);
}
}
else if (entry instanceof LibraryOrderEntry){
if (!openLibraryEditor) {
rootConfigurable.select((LibraryOrderEntry)entry, true);
}
else {
myEditButton.actionPerformed(null);
}
}
else if (entry instanceof JdkOrderEntry) {
Sdk jdk = ((JdkOrderEntry)entry).getJdk();
if (jdk != null) {
rootConfigurable.select(jdk, true);
}
}
}
示例10: actionPerformed
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e) {
Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext());
if (project == null) {
project = ProjectManager.getInstance().getDefaultProject();
}
// TEMPORARY HACK! DO NOT MERGE INTO INTELLIJ. This just works around a lot
// of confusion caused by the fact that the structure dialog lets you edit
// project state which is ignored by gradle, so temporarily disable this
// dialog for Android-Gradle-based projects.
if (isGradleProject(project)) {
showDisabledProjectStructureDialogMessage();
}
ShowSettingsUtil.getInstance().editConfigurable(project, OptionsEditorDialog.DIMENSION_KEY, ProjectStructureConfigurable.getInstance(project));
}
示例11: reloadModel
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable; //导入依赖的package包/类
public void reloadModel(SdkComboBoxItem firstItem, @Nullable Project project) {
final DefaultComboBoxModel model = ((DefaultComboBoxModel)getModel());
if (project == null) {
model.addElement(firstItem);
return;
}
model.removeAllElements();
model.addElement(firstItem);
final ProjectSdksModel projectSdksModel = ProjectStructureConfigurable.getInstance(project).getProjectSdksModel();
List<Sdk> sdks = new ArrayList<Sdk>(projectSdksModel.getProjectSdks().values());
if (myFilter != null) {
sdks = ContainerUtil.filter(sdks, getSdkFilter(myFilter));
}
Collections.sort(sdks, new Comparator<Sdk>() {
@Override
public int compare(final Sdk o1, final Sdk o2) {
return o1.getName().compareToIgnoreCase(o2.getName());
}
});
for (Sdk sdk : sdks) {
model.addElement(new SdkComboBoxItem(sdk));
}
}
示例12: forLibrary
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable; //导入依赖的package包/类
@Nonnull
@Override
public CellAppearanceEx forLibrary(Project project, @Nonnull final Library library, final boolean hasInvalidRoots) {
final StructureConfigurableContext context = ProjectStructureConfigurable.getInstance(project).getContext();
final Icon icon = LibraryPresentationManager.getInstance().getCustomIcon(library, context);
final String name = library.getName();
if (name != null) {
return normalOrRedWaved(name, (icon != null ? icon : AllIcons.Nodes.PpLib), hasInvalidRoots);
}
final String[] files = library.getUrls(BinariesOrderRootType.getInstance());
if (files.length == 0) {
return SimpleTextCellAppearance.invalid(ProjectBundle.message("library.empty.library.item"), AllIcons.Nodes.PpLib);
}
else if (files.length == 1) {
return forVirtualFilePointer(new LightFilePointer(files[0]));
}
final String url = StringUtil.trimEnd(files[0], ArchiveFileSystem.ARCHIVE_SEPARATOR);
return SimpleTextCellAppearance.regular(PathUtil.getFileName(url), AllIcons.Nodes.PpLib);
}
示例13: selectOrderEntry
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable; //导入依赖的package包/类
public ActionCallback selectOrderEntry(@Nonnull final Module module, @Nullable final OrderEntry orderEntry) {
Place p = new Place();
p.putPath(ProjectStructureConfigurable.CATEGORY, this);
Runnable r = null;
final MasterDetailsComponent.MyNode node = findModuleNode(module);
if (node != null) {
p.putPath(TREE_OBJECT, module);
p.putPath(ModuleEditor.SELECTED_EDITOR_NAME, ClasspathEditor.NAME);
r = new Runnable() {
@Override
public void run() {
if (orderEntry != null) {
ModuleEditor moduleEditor = ((ModuleConfigurable)node.getConfigurable()).getModuleEditor();
ModuleConfigurationEditor editor = moduleEditor.getEditor(ClasspathEditor.NAME);
if (editor instanceof ClasspathEditor) {
((ClasspathEditor)editor).selectOrderEntry(orderEntry);
}
}
}
};
}
final ActionCallback result = ProjectStructureConfigurable.getInstance(myProject).navigateTo(p, true);
return r != null ? result.doWhenDone(r) : result;
}
示例14: selectLibrary
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable; //导入依赖的package包/类
@Override
public void selectLibrary(@Nonnull Library library) {
final LibraryTable table = library.getTable();
if (table != null) {
ProjectStructureConfigurable.getInstance(getProject()).selectProjectOrGlobalLibrary(library, true);
}
else {
final Module module = ((LibraryImpl)library).getModule();
if (module != null) {
final ModuleRootModel rootModel = myParent.getModulesProvider().getRootModel(module);
final String libraryName = library.getName();
for (OrderEntry entry : rootModel.getOrderEntries()) {
if (entry instanceof ModuleLibraryOrderEntryImpl) {
final ModuleLibraryOrderEntryImpl libraryEntry = (ModuleLibraryOrderEntryImpl)entry;
if (libraryName != null && libraryName.equals(libraryEntry.getLibraryName())
|| libraryName == null && library.equals(libraryEntry.getLibrary())) {
ProjectStructureConfigurable.getInstance(getProject()).selectOrderEntry(module, libraryEntry);
return;
}
}
}
}
}
}
示例15: navigate
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable; //导入依赖的package包/类
@Override
public void navigate(boolean openLibraryEditor) {
final OrderEntry entry = getSelectedEntry();
final ProjectStructureConfigurable rootConfigurable = ProjectStructureConfigurable.getInstance(myState.getProject());
if (entry instanceof ModuleOrderEntry) {
Module module = ((ModuleOrderEntry)entry).getModule();
if (module != null) {
rootConfigurable.select(module.getName(), null, true);
}
}
else if (entry instanceof LibraryOrderEntry) {
if (!openLibraryEditor) {
rootConfigurable.select((LibraryOrderEntry)entry, true);
}
else {
myEditButton.actionPerformed(null);
}
}
else if (entry instanceof ModuleExtensionWithSdkOrderEntry) {
Sdk jdk = ((ModuleExtensionWithSdkOrderEntry)entry).getSdk();
if (jdk != null) {
rootConfigurable.select(jdk, true);
}
}
}