mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
added implementation of JavaEE related stuff to community version of App Engine plugin
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<applicationService serviceInterface="com.intellij.appengine.sdk.AppEngineSdkManager"
|
||||
serviceImplementation="com.intellij.appengine.sdk.impl.AppEngineSdkManagerImpl"/>
|
||||
<applicationService serviceInterface="com.intellij.appengine.facet.AppEngineWebIntegration"
|
||||
serviceImplementation="com.intellij.appengine.facet.impl.AppEngineCommunityWebIntegration"/>
|
||||
|
||||
<frameworkSupport implementation="com.intellij.appengine.facet.AppEngineSupportProvider"/>
|
||||
<fileTemplateGroup implementation="com.intellij.appengine.facet.AppEngineTemplateGroupDescriptorFactory"/>
|
||||
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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.appengine.facet.impl;
|
||||
|
||||
import com.intellij.appengine.facet.AppEngineWebIntegration;
|
||||
import com.intellij.appengine.sdk.AppEngineSdk;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ModifiableRootModel;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.packaging.artifacts.ArtifactManager;
|
||||
import com.intellij.packaging.artifacts.ArtifactType;
|
||||
import com.intellij.packaging.elements.PackagingElement;
|
||||
import com.intellij.packaging.elements.PackagingElementFactory;
|
||||
import com.intellij.packaging.impl.artifacts.PlainArtifactType;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class AppEngineCommunityWebIntegration extends AppEngineWebIntegration {
|
||||
private static final Logger LOG = Logger.getInstance(AppEngineCommunityWebIntegration.class);
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public VirtualFile suggestParentDirectoryForAppEngineWebXml(@NotNull Module module, @NotNull ModifiableRootModel rootModel) {
|
||||
final VirtualFile root = ArrayUtil.getFirstElement(rootModel.getContentRoots());
|
||||
if (root != null) {
|
||||
try {
|
||||
return VfsUtil.createDirectoryIfMissing(root, "WEB-INF");
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.info(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ArtifactType getAppEngineTargetArtifactType() {
|
||||
return PlainArtifactType.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupJpaSupport(@NotNull Module module, @NotNull VirtualFile persistenceXml) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupRunConfiguration(@NotNull ModifiableRootModel rootModel,
|
||||
@NotNull AppEngineSdk sdk,
|
||||
@Nullable Artifact artifact,
|
||||
@NotNull Project project) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupDevServer(@NotNull AppEngineSdk sdk) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLibraryToArtifact(@NotNull Library library, @NotNull Artifact artifact, @NotNull Project project) {
|
||||
final ArtifactManager artifactManager = ArtifactManager.getInstance(project);
|
||||
for (PackagingElement<?> element : PackagingElementFactory.getInstance().createLibraryElements(library)) {
|
||||
final String dir = element.getFilesKind(artifactManager.getResolvingContext()).containsDirectoriesWithClasses() ? "classes" : "lib";
|
||||
artifactManager.addElementsToDirectory(artifact, "WEB-INF/" + dir, element);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends AppEngineSdk> getSdkForConfiguredDevServers() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user