This commit is contained in:
Maxim Shafirov
2012-04-19 15:41:40 +04:00
parent 0d7cc22ae6
commit 859f1f3a3f
36 changed files with 10 additions and 244 deletions
@@ -1,82 +0,0 @@
/*
* 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.framework.addSupport;
import com.intellij.facet.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.roots.ModifiableModelsProvider;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ui.configuration.FacetsProvider;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
/**
* @author nik
*/
public abstract class FacetBasedFrameworkSupportInModuleProvider<F extends Facet> extends FrameworkSupportInModuleProvider {
private static final Logger LOG = Logger.getInstance("#com.intellij.framework.addSupport.FacetBasedFrameworkSupportInModuleProvider");
private final FacetType<F, ?> myFacetType;
protected FacetBasedFrameworkSupportInModuleProvider(FacetType<F, ?> facetType) {
myFacetType = facetType;
}
public boolean isEnabledForModuleType(@NotNull final ModuleType moduleType) {
return myFacetType.isSuitableModuleType(moduleType);
}
@Override
public boolean isSupportAlreadyAdded(@NotNull Module module, @NotNull FacetsProvider facetsProvider) {
return !FacetManager.getInstance(module).getFacetsByType(myFacetType.getId()).isEmpty();
}
protected class FacetBasedFrameworkSupportInModuleConfigurable extends FrameworkSupportInModuleConfigurable {
@Override
public JComponent createComponent() {
return null;
}
@Override
public void addSupport(@NotNull Module module,
@NotNull ModifiableRootModel rootModel,
@NotNull ModifiableModelsProvider modifiableModelsProvider) {
FacetManager facetManager = FacetManager.getInstance(module);
ModifiableFacetModel model = facetManager.createModifiableModel();
Facet underlyingFacet = null;
FacetTypeId<?> underlyingFacetType = myFacetType.getUnderlyingFacetType();
if (underlyingFacetType != null) {
underlyingFacet = model.getFacetByType(underlyingFacetType);
LOG.assertTrue(underlyingFacet != null, underlyingFacetType);
}
F facet = facetManager.createFacet(myFacetType, myFacetType.getDefaultFacetName(), underlyingFacet);
setupConfiguration(facet, rootModel);
model.addFacet(facet);
model.commit();
onFacetCreated(facet, rootModel);
}
protected void setupConfiguration(final F facet, final ModifiableRootModel rootModel) {
}
protected void onFacetCreated(final F facet, final ModifiableRootModel rootModel) {
}
}
}
@@ -393,10 +393,6 @@ public class ProjectNameWithTypeStep extends ProjectNameStep {
return !myWizardContext.isCreatingNewProject() || super.validate();
}
public void disposeUIResources() {
super.disposeUIResources();
}
private static class PermanentSingleSelectionModel extends DefaultListSelectionModel {
public PermanentSingleSelectionModel() {
super.setSelectionMode(SINGLE_SELECTION);
@@ -429,4 +425,4 @@ public class ProjectNameWithTypeStep extends ProjectNameStep {
myInternalPanel.add(component, new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(10, 0, 0, 0), 0, 0));
}
}
}
@@ -397,13 +397,7 @@ public class ConfigurationErrorsComponent extends JPanel implements Disposable,
myList = list;
myText = new JTextPane() {
@Override
public void setCursor(Cursor cursor) {
super.setCursor(cursor);
//onCursorChanged(cursor);
}
};
myText = new JTextPane();
myButtonsPanel = new JPanel(new BorderLayout());
myButtonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 3, 5, 3));