use of com.intellij.openapi.roots.OrderRootType in project intellij-community by JetBrains.
the class SdkEditor method reset.
@Override
public void reset() {
if (mySdk == null) {
setHomePathValue("");
for (SdkPathEditor pathEditor : myPathEditors.values()) {
pathEditor.reset(null);
}
} else {
final SdkModificator sdkModificator = mySdk.getSdkModificator();
for (OrderRootType type : myPathEditors.keySet()) {
myPathEditors.get(type).reset(sdkModificator);
}
sdkModificator.commitChanges();
setHomePathValue(mySdk.getHomePath().replace('/', File.separatorChar));
}
myVersionString = null;
myHomeFieldLabel.setText(getHomeFieldLabelValue());
updateAdditionalDataComponent();
for (final AdditionalDataConfigurable configurable : getAdditionalDataConfigurable()) {
configurable.reset();
}
myHomeComponent.setEnabled(mySdk != null);
for (int i = 0; i < myTabbedPane.getTabCount(); i++) {
myTabbedPane.setEnabledAt(i, mySdk != null);
}
}
use of com.intellij.openapi.roots.OrderRootType in project intellij-community by JetBrains.
the class SdkEditor method createMainPanel.
private void createMainPanel() {
myMainPanel = new JPanel(new GridBagLayout());
myTabbedPane = new TabbedPaneWrapper(myDisposable);
for (OrderRootType type : OrderRootType.getAllTypes()) {
if (mySdk == null || showTabForType(type)) {
final SdkPathEditor pathEditor = OrderRootTypeUIFactory.FACTORY.getByKey(type).createPathEditor(mySdk);
if (pathEditor != null) {
pathEditor.setAddBaseDir(mySdk.getHomeDirectory());
myTabbedPane.addTab(pathEditor.getDisplayName(), pathEditor.createComponent());
myPathEditors.put(type, pathEditor);
}
}
}
myTabbedPane.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent e) {
myHistory.pushQueryPlace();
}
});
myHomeComponent = createHomeComponent();
myHomeComponent.getTextField().setEditable(false);
myHomeFieldLabel = new JLabel(getHomeFieldLabelValue());
final int leftInset = 10;
final int rightInset = 10;
myMainPanel.add(myHomeFieldLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, JBUI.insets(2, leftInset, 2, 2), 0, 0));
myMainPanel.add(myHomeComponent, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, JBUI.insets(2, 2, 2, rightInset), 0, 0));
myAdditionalDataPanel = new JPanel(new BorderLayout());
myMainPanel.add(myAdditionalDataPanel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, JBUI.insets(2, leftInset, 0, rightInset), 0, 0));
myMainPanel.add(myTabbedPane.getComponent(), new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, JBUI.insetsTop(2), 0, 0));
}
use of com.intellij.openapi.roots.OrderRootType in project intellij-community by JetBrains.
the class JarDirectories method writeExternal.
@Override
public void writeExternal(Element element) {
final List<OrderRootType> rootTypes = LibraryImpl.sortRootTypes(getRootTypes());
for (OrderRootType rootType : rootTypes) {
final List<String> urls = new ArrayList<>(getDirectories(rootType));
Collections.sort(urls, String.CASE_INSENSITIVE_ORDER);
for (String url : urls) {
final Element jarDirElement = new Element(JAR_DIRECTORY_ELEMENT);
jarDirElement.setAttribute(URL_ATTR, url);
jarDirElement.setAttribute(RECURSIVE_ATTR, Boolean.toString(isRecursive(rootType, url)));
if (!rootType.equals(DEFAULT_JAR_DIRECTORY_TYPE)) {
jarDirElement.setAttribute(ROOT_TYPE_ATTR, rootType.name());
}
element.addContent(jarDirElement);
}
}
}
use of com.intellij.openapi.roots.OrderRootType in project intellij-community by JetBrains.
the class ProjectRootContainerImpl method readExternal.
@Override
public void readExternal(Element element) {
for (PersistentOrderRootType type : OrderRootType.getAllPersistentTypes()) {
read(element, type);
}
ApplicationManager.getApplication().runReadAction(() -> {
myFiles = new HashMap<>();
for (OrderRootType rootType : myRoots.keySet()) {
CompositeProjectRoot root = myRoots.get(rootType);
if (myNoCopyJars) {
setNoCopyJars(root);
}
myFiles.put(rootType, root.getVirtualFiles());
}
});
for (OrderRootType type : OrderRootType.getAllTypes()) {
final VirtualFile[] newRoots = getRootFiles(type);
final VirtualFile[] oldRoots = VirtualFile.EMPTY_ARRAY;
if (!Comparing.equal(oldRoots, newRoots)) {
fireRootsChanged();
break;
}
}
}
use of com.intellij.openapi.roots.OrderRootType in project intellij-community by JetBrains.
the class LibraryImpl method copyRootsFrom.
private void copyRootsFrom(LibraryImpl fromModel) {
Map<OrderRootType, VirtualFilePointerContainer> clonedRoots = ContainerUtil.newHashMap();
for (Map.Entry<OrderRootType, VirtualFilePointerContainer> entry : fromModel.myRoots.entrySet()) {
OrderRootType rootType = entry.getKey();
VirtualFilePointerContainer container = entry.getValue();
VirtualFilePointerContainer clone = container.clone(myPointersDisposable);
clonedRoots.put(rootType, clone);
}
myRoots.clear();
myRoots.putAll(clonedRoots);
VirtualFilePointerContainer excludedRoots = fromModel.myExcludedRoots;
myExcludedRoots = excludedRoots != null ? excludedRoots.clone(myPointersDisposable) : null;
}
Aggregations