repo-reorg-2020: moved sts4-relevant spring-ide bundles from https://github.com/spring-projects/spring-ide/releases/tag/REPO-REORG-2020 into sts4 repo
@@ -39,16 +39,6 @@
|
||||
<category name="Extensions / Spring IDE" />
|
||||
</feature>
|
||||
|
||||
<feature
|
||||
id="org.springframework.ide.eclipse.boot.dash.feature.source" version="0.0.0">
|
||||
<category name="Resources / Spring IDE" />
|
||||
</feature>
|
||||
|
||||
<feature
|
||||
id="org.springframework.ide.eclipse.xml.namespaces.feature.source" version="0.0.0">
|
||||
<category name="Resources / Spring IDE" />
|
||||
</feature>
|
||||
|
||||
<!-- Language Server -->
|
||||
<category-def name="Spring Tool Suite 4 Language Server Integrations for Eclipse" label="Spring Tool Suite 4 Language Server Integrations for Eclipse"/>
|
||||
|
||||
|
||||
@@ -39,16 +39,6 @@
|
||||
<category name="Extensions / Spring IDE" />
|
||||
</feature>
|
||||
|
||||
<feature
|
||||
id="org.springframework.ide.eclipse.boot.dash.feature.source" version="0.0.0">
|
||||
<category name="Resources / Spring IDE" />
|
||||
</feature>
|
||||
|
||||
<feature
|
||||
id="org.springframework.ide.eclipse.xml.namespaces.feature.source" version="0.0.0">
|
||||
<category name="Resources / Spring IDE" />
|
||||
</feature>
|
||||
|
||||
<!-- Language Server -->
|
||||
<category-def name="Spring Tool Suite 4 Language Server Integrations for Eclipse" label="Spring Tool Suite 4 Language Server Integrations for Eclipse"/>
|
||||
|
||||
|
||||
@@ -39,16 +39,6 @@
|
||||
<category name="Extensions / Spring IDE" />
|
||||
</feature>
|
||||
|
||||
<feature
|
||||
id="org.springframework.ide.eclipse.boot.dash.feature.source" version="0.0.0">
|
||||
<category name="Resources / Spring IDE" />
|
||||
</feature>
|
||||
|
||||
<feature
|
||||
id="org.springframework.ide.eclipse.xml.namespaces.feature.source" version="0.0.0">
|
||||
<category name="Resources / Spring IDE" />
|
||||
</feature>
|
||||
|
||||
<!-- Language Server -->
|
||||
<category-def name="Spring Tool Suite 4 Language Server Integrations for Eclipse" label="Spring Tool Suite 4 Language Server Integrations for Eclipse"/>
|
||||
|
||||
|
||||
@@ -43,6 +43,34 @@
|
||||
|
||||
<module>org.springframework.boot.ide.branding</module>
|
||||
<module>org.springframework.boot.ide.branding.feature</module>
|
||||
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.boot</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.buildship30</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.imports</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.beans.ui.live</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.boot.dash</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.boot.launch</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.boot.refactoring</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.boot.restart</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.boot.templates</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.boot.test</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.boot.validation</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.boot.wizard</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.boot.dash.azure</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.boot.dash.cf</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.boot.dash.docker</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.boot.dash.feature</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.boot.dash.test</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.boot.launch.test</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.boot.refactoring.test</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.docker.client</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.editor.support</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.maven.pom</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.maven.pom.tests</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.xml.namespaces</module>
|
||||
<module>../eclipse-extensions/org.springframework.ide.eclipse.xml.namespaces.feature</module>
|
||||
<module>../eclipse-extensions/org.springsource.ide.eclipse.commons.cloudfoundry.client.v2</module>
|
||||
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
@@ -69,17 +97,12 @@
|
||||
<dist.pathpostfix>nightly</dist.pathpostfix>
|
||||
<dist.path>${dist.type}/${dist.key}/${dist.project}/${dist.pathpostfix}</dist.path>
|
||||
|
||||
<eclipsecommons-p2-repo>https://dist.springsource.com/snapshot/TOOLS/eclipse-integration-commons/nightly</eclipsecommons-p2-repo>
|
||||
<springide-p2-repo>https://dist.springframework.org/snapshot/IDE/nightly</springide-p2-repo>
|
||||
<!-- <eclipsecommons-p2-repo>https://dist.springsource.com/milestone/TOOLS/eclipse-integration-commons/3.9.7.RC1/</eclipsecommons-p2-repo>
|
||||
<springide-p2-repo>https://dist.springframework.org/milestone/IDE/3.9.7.RC1</springide-p2-repo> -->
|
||||
<!-- <eclipsecommons-p2-repo>https://dist.springsource.com/release/TOOLS/eclipse-integration-commons/3.9.14.RELEASE/</eclipsecommons-p2-repo>
|
||||
<springide-p2-repo>https://dist.springframework.org/release/IDE/3.9.14.RELEASE</springide-p2-repo> -->
|
||||
|
||||
<sts4-language-servers-p2-repo>https://dist.springsource.com/${dist.type}/TOOLS/sts4-language-server-integrations/${sts4-language-servers-version}</sts4-language-servers-p2-repo>
|
||||
|
||||
<tycho-version>1.7.0</tycho-version>
|
||||
<encoding>UTF-8</encoding>
|
||||
|
||||
<misc.p2.repo.version>3.9.4.202003091750</misc.p2.repo.version>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
@@ -458,14 +481,14 @@
|
||||
<url>${sts4-language-servers-p2-repo}</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>springide</id>
|
||||
<id>yedit</id>
|
||||
<layout>p2</layout>
|
||||
<url>${springide-p2-repo}</url>
|
||||
<url>https://dist.springsource.com/release/TOOLS/third-party/yedit</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>eclipse-integration-commons</id>
|
||||
<id>p2-thirdparty-bundles</id>
|
||||
<layout>p2</layout>
|
||||
<url>${eclipsecommons-p2-repo}</url>
|
||||
<url>https://dist.springsource.com/release/TOOLS/third-party/misc-p2-repo/${misc.p2.repo.version}</url>
|
||||
</repository>
|
||||
<!-- <repository>
|
||||
<id>egit-github</id>
|
||||
@@ -639,9 +662,9 @@
|
||||
<resolver>p2</resolver>
|
||||
<pomDependencies>consider</pomDependencies>
|
||||
<ignoreTychoRepositories>true</ignoreTychoRepositories>
|
||||
<dependency-resolution>
|
||||
<!-- <dependency-resolution>
|
||||
<optionalDependencies>ignore</optionalDependencies>
|
||||
</dependency-resolution>
|
||||
</dependency-resolution> -->
|
||||
<environments>
|
||||
<environment>
|
||||
<os>macosx</os>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot.ide</groupId>
|
||||
<artifactId>org.springframework.boot.ide</artifactId>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.springframework.ide.eclipse.beans.ui.live</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,7 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
@@ -0,0 +1,27 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Live Beans Tree
|
||||
Bundle-SymbolicName: org.springframework.ide.eclipse.beans.ui.live;singleton:=true
|
||||
Bundle-Version: 4.8.1.qualifier
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Export-Package: org.springframework.ide.eclipse.beans.ui.live,
|
||||
org.springframework.ide.eclipse.beans.ui.live.actions,
|
||||
org.springframework.ide.eclipse.beans.ui.live.model,
|
||||
org.springframework.ide.eclipse.beans.ui.live.tree,
|
||||
org.springframework.ide.eclipse.beans.ui.live.utils
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
org.eclipse.ui.views,
|
||||
org.json,
|
||||
org.eclipse.core.resources,
|
||||
org.apache.commons.lang,
|
||||
org.eclipse.jface,
|
||||
org.eclipse.ui.workbench,
|
||||
org.eclipse.jdt.core,
|
||||
org.springsource.ide.eclipse.commons.ui,
|
||||
org.eclipse.jdt.ui,
|
||||
com.google.guava,
|
||||
org.springsource.ide.eclipse.commons.livexp,
|
||||
org.springsource.ide.eclipse.commons.frameworks.core
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-Vendor: Spring IDE Developers
|
||||
Bundle-Activator: org.springframework.ide.eclipse.beans.ui.live.LiveBeansUiPlugin
|
||||
@@ -0,0 +1,5 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
icons/
|
||||
|
After Width: | Height: | Size: 310 B |
|
After Width: | Height: | Size: 555 B |
|
After Width: | Height: | Size: 217 B |
|
After Width: | Height: | Size: 583 B |
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot.ide</groupId>
|
||||
<artifactId>org.springframework.boot.ide</artifactId>
|
||||
<version>4.8.1-SNAPSHOT</version>
|
||||
<relativePath>../../eclipse-distribution/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.springframework.ide.eclipse</groupId>
|
||||
<artifactId>org.springframework.ide.eclipse.beans.ui.live</artifactId>
|
||||
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>target-platform-configuration</artifactId>
|
||||
<version>${tycho-version}</version>
|
||||
<configuration>
|
||||
<resolver>p2</resolver>
|
||||
<pomDependencies>ignore</pomDependencies>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>tycho-compiler-plugin</artifactId>
|
||||
<version>${tycho-version}</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>tycho-source-plugin</artifactId>
|
||||
<version>${tycho-version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>plugin-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>plugin-source</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>tycho-p2-plugin</artifactId>
|
||||
<version>${tycho-version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>second-generate-p2-metadata</id>
|
||||
<goals>
|
||||
<goal>p2-metadata</goal>
|
||||
</goals>
|
||||
<phase>verify</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,66 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live;
|
||||
|
||||
import org.eclipse.jface.resource.ImageRegistry;
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
/**
|
||||
* Live Beans plugin
|
||||
*
|
||||
* @author Alex Boyko
|
||||
*
|
||||
*/
|
||||
public class LiveBeansUiPlugin extends AbstractUIPlugin {
|
||||
|
||||
// The plug-in ID
|
||||
public static final String PLUGIN_ID = "org.springframework.ide.eclipse.beans.ui.live"; //$NON-NLS-1$
|
||||
|
||||
private static final String ICON_PATH_PREFIX = "icons/";
|
||||
private static final String NAME_PREFIX = PLUGIN_ID + '.';
|
||||
private static final int NAME_PREFIX_LENGTH = NAME_PREFIX.length();
|
||||
|
||||
public static final String IMG_OBJS_BEAN = NAME_PREFIX + "bean_obj.gif";
|
||||
public static final String IMG_OBJS_BEAN_REF = NAME_PREFIX + "beanref_obj.gif";
|
||||
public static final String IMG_OBJS_CONFIG = NAME_PREFIX + "config_obj.gif";
|
||||
public static final String IMG_OBJS_COLLECTION = NAME_PREFIX + "collection_obj.gif";
|
||||
|
||||
private static LiveBeansUiPlugin plugin;
|
||||
|
||||
|
||||
@Override
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
plugin = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
plugin = null;
|
||||
super.stop(context);
|
||||
}
|
||||
|
||||
public static LiveBeansUiPlugin getDefault() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initializeImageRegistry(ImageRegistry reg) {
|
||||
super.initializeImageRegistry(reg);
|
||||
reg.put(IMG_OBJS_BEAN, imageDescriptorFromPlugin(PLUGIN_ID, ICON_PATH_PREFIX + IMG_OBJS_BEAN.substring(NAME_PREFIX_LENGTH)));
|
||||
reg.put(IMG_OBJS_BEAN_REF, imageDescriptorFromPlugin(PLUGIN_ID, ICON_PATH_PREFIX + IMG_OBJS_BEAN_REF.substring(NAME_PREFIX_LENGTH)));
|
||||
reg.put(IMG_OBJS_CONFIG, imageDescriptorFromPlugin(PLUGIN_ID, ICON_PATH_PREFIX + IMG_OBJS_CONFIG.substring(NAME_PREFIX_LENGTH)));
|
||||
reg.put(IMG_OBJS_COLLECTION, imageDescriptorFromPlugin(PLUGIN_ID, ICON_PATH_PREFIX + IMG_OBJS_COLLECTION.substring(NAME_PREFIX_LENGTH)));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2013, 2019 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.actions;
|
||||
|
||||
import org.eclipse.ui.actions.BaseSelectionListenerAction;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.TypeLookup;
|
||||
|
||||
/**
|
||||
* @author Leo Dos Santos
|
||||
* @author Alex Boyko
|
||||
*/
|
||||
public abstract class AbstractOpenResourceAction extends BaseSelectionListenerAction {
|
||||
|
||||
protected AbstractOpenResourceAction(String text) {
|
||||
super(text);
|
||||
}
|
||||
|
||||
protected boolean hasTypeInProject(TypeLookup workspaceContext, String className) {
|
||||
return workspaceContext.findType(className) != null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2019 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.actions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBean;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.utils.LiveBeanUtil;
|
||||
|
||||
/**
|
||||
* @author Leo Dos Santos
|
||||
* @author Alex Boyko
|
||||
*/
|
||||
public class OpenBeanClassAction extends AbstractOpenResourceAction {
|
||||
|
||||
public OpenBeanClassAction() {
|
||||
super("Open Bean Class");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
IStructuredSelection selection = getStructuredSelection();
|
||||
List<?> elements = selection.toList();
|
||||
for (Object obj : elements) {
|
||||
if (obj instanceof LiveBean) {
|
||||
LiveBean bean = (LiveBean) obj;
|
||||
LiveBeanUtil.navigateToType(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean updateSelection(IStructuredSelection selection) {
|
||||
if (!selection.isEmpty()) {
|
||||
List<?> elements = selection.toList();
|
||||
for (Object obj : elements) {
|
||||
if (obj instanceof LiveBean) {
|
||||
LiveBean bean = (LiveBean) obj;
|
||||
String beanClass = bean.getBeanType();
|
||||
if (beanClass != null && beanClass.trim().length() > 0) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return hasTypeInProject(bean.getTypeLookup(), bean.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2019 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.actions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBean;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.utils.LiveBeanUtil;
|
||||
|
||||
/**
|
||||
* @author Leo Dos Santos
|
||||
* @author Alex Boyko
|
||||
*/
|
||||
public class OpenBeanDefinitionAction extends AbstractOpenResourceAction {
|
||||
|
||||
public OpenBeanDefinitionAction() {
|
||||
super("Open Bean Definition File");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
IStructuredSelection selection = getStructuredSelection();
|
||||
List<?> elements = selection.toList();
|
||||
for (Object obj : elements) {
|
||||
if (obj instanceof LiveBean) {
|
||||
LiveBean bean = (LiveBean) obj;
|
||||
LiveBeanUtil.navigateToResource(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean updateSelection(IStructuredSelection selection) {
|
||||
if (!selection.isEmpty()) {
|
||||
List<?> elements = selection.toList();
|
||||
for (Object obj : elements) {
|
||||
if (obj instanceof LiveBean) {
|
||||
LiveBean bean = (LiveBean) obj;
|
||||
String resource = bean.getResource();
|
||||
if (resource != null && resource.trim().length() > 0 && !resource.equalsIgnoreCase("null")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2017 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.model;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.ui.views.properties.IPropertySource;
|
||||
|
||||
/**
|
||||
* @author Leo Dos Santos
|
||||
* @author Alex Boyko
|
||||
*/
|
||||
public abstract class AbstractLiveBeansModelElement implements IAdaptable, DisplayName {
|
||||
|
||||
protected final Map<String, String> attributes;
|
||||
|
||||
public AbstractLiveBeansModelElement() {
|
||||
this.attributes = new HashMap<String, String>();
|
||||
}
|
||||
|
||||
public void addAttribute(String key, String value) {
|
||||
attributes.put(key, value);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public Object getAdapter(Class adapter) {
|
||||
if (adapter == IPropertySource.class) {
|
||||
return new LiveBeanPropertySource(this);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Map<String, String> getAttributes() {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.model;
|
||||
|
||||
/**
|
||||
* Mark UI elements which are able to provide their label
|
||||
*
|
||||
* @author Alex Boyko
|
||||
*
|
||||
*/
|
||||
public interface DisplayName {
|
||||
|
||||
String getDisplayName();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2019 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.model;
|
||||
|
||||
public interface JsonParser<T> {
|
||||
|
||||
T parse(String jsonInput) throws Exception;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2017 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.model;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* @author Leo Dos Santos
|
||||
* @author Alex Boyko
|
||||
*/
|
||||
public class LiveBean extends AbstractLiveBeansModelElement {
|
||||
|
||||
public static final String ATTR_BEAN = "bean";
|
||||
|
||||
public static final String ATTR_SCOPE = "scope";
|
||||
|
||||
public static final String ATTR_TYPE = "type";
|
||||
|
||||
public static final String ATTR_RESOURCE = "resource";
|
||||
|
||||
public static final String ATTR_DEPENDENCIES = "dependencies";
|
||||
|
||||
public static final String ATTR_APPLICATION = "application name";
|
||||
|
||||
private final TypeLookup typeLookup;
|
||||
|
||||
private final String beanId;
|
||||
|
||||
private String displayName;
|
||||
|
||||
private final Set<LiveBean> dependencies;
|
||||
|
||||
private final Set<LiveBean> injectedInto;
|
||||
|
||||
private final boolean innerBean;
|
||||
|
||||
public LiveBean(TypeLookup session, String id) {
|
||||
this(session, id, false);
|
||||
}
|
||||
|
||||
public LiveBean(TypeLookup typeLookup, String id, boolean innerBean) {
|
||||
this.typeLookup = typeLookup;
|
||||
this.beanId = id;
|
||||
this.innerBean = innerBean;
|
||||
dependencies = new LinkedHashSet<LiveBean>();
|
||||
injectedInto = new LinkedHashSet<LiveBean>();
|
||||
attributes.put(ATTR_BEAN, id);
|
||||
}
|
||||
|
||||
public void addDependency(LiveBean dependency) {
|
||||
dependencies.add(dependency);
|
||||
dependency.injectInto(this);
|
||||
}
|
||||
|
||||
public String getApplicationName() {
|
||||
return attributes.get(ATTR_APPLICATION);
|
||||
}
|
||||
|
||||
public String getBeanType() {
|
||||
return attributes.get(ATTR_TYPE);
|
||||
}
|
||||
|
||||
public Set<LiveBean> getDependencies() {
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
// compute the display name the first time it's needed
|
||||
if (displayName == null) {
|
||||
// truncate Class names and name with multiple segments
|
||||
if ((getBeanType() != null && beanId.contains(getBeanType())) || StringUtils.countMatches(beanId, ".") > 1) {
|
||||
int index = beanId.lastIndexOf('.');
|
||||
if (index >= 0) {
|
||||
displayName = beanId.substring(index + 1, beanId.length());
|
||||
}
|
||||
}
|
||||
if (displayName == null) {
|
||||
displayName = beanId;
|
||||
}
|
||||
}
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return beanId;
|
||||
}
|
||||
|
||||
public Set<LiveBean> getInjectedInto() {
|
||||
return injectedInto;
|
||||
}
|
||||
|
||||
public String getResource() {
|
||||
return attributes.get(ATTR_RESOURCE);
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return attributes.get(ATTR_SCOPE);
|
||||
}
|
||||
|
||||
private void injectInto(LiveBean bean) {
|
||||
injectedInto.add(bean);
|
||||
}
|
||||
|
||||
public boolean isInnerBean() {
|
||||
return innerBean;
|
||||
}
|
||||
|
||||
public TypeLookup getTypeLookup() {
|
||||
return typeLookup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof LiveBean) {
|
||||
LiveBean other = (LiveBean) obj;
|
||||
return this.attributes.equals(other.attributes);
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return beanId == null ? super.hashCode() : beanId.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LiveBean("+getId()+")";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2017 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.ui.views.properties.IPropertyDescriptor;
|
||||
import org.eclipse.ui.views.properties.IPropertySource;
|
||||
import org.eclipse.ui.views.properties.PropertyDescriptor;
|
||||
|
||||
/**
|
||||
* @author Leo Dos Santos
|
||||
* @author Alex Boyko
|
||||
*/
|
||||
public class LiveBeanPropertySource implements IPropertySource {
|
||||
|
||||
private final AbstractLiveBeansModelElement model;
|
||||
|
||||
private IPropertyDescriptor[] descriptors;
|
||||
|
||||
public LiveBeanPropertySource(AbstractLiveBeansModelElement model) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
public Object getEditableValue() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public IPropertyDescriptor[] getPropertyDescriptors() {
|
||||
if (descriptors == null) {
|
||||
List<IPropertyDescriptor> descrList = new ArrayList<IPropertyDescriptor>();
|
||||
Map<String, String> attributes = model.getAttributes();
|
||||
Set<String> keys = attributes.keySet();
|
||||
for (String key : keys) {
|
||||
PropertyDescriptor desc = new PropertyDescriptor(key, key);
|
||||
descrList.add(desc);
|
||||
}
|
||||
descriptors = descrList.toArray(new IPropertyDescriptor[descrList.size()]);
|
||||
}
|
||||
return descriptors;
|
||||
}
|
||||
|
||||
public Object getPropertyValue(Object id) {
|
||||
return model.getAttributes().get(id);
|
||||
}
|
||||
|
||||
public boolean isPropertySet(Object id) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
public void resetPropertyValue(Object id) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void setPropertyValue(Object id, Object value) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2019 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.model;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* A wrapper around a {@link LiveBean} used by the
|
||||
* {@link LiveBeansTreeContentProvider} for displaying bean relationships
|
||||
* without nesting.
|
||||
*
|
||||
* @author Leo Dos Santos
|
||||
* @author Alex Boyko
|
||||
*/
|
||||
public class LiveBeanRelation extends AbstractLiveBeansModelElement {
|
||||
|
||||
private final LiveBean bean;
|
||||
|
||||
private final boolean isDependency;
|
||||
|
||||
public LiveBeanRelation(LiveBean bean) {
|
||||
this(bean, false);
|
||||
}
|
||||
|
||||
public LiveBeanRelation(LiveBean bean, boolean isDependency) {
|
||||
this.bean = bean;
|
||||
this.isDependency = isDependency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAttribute(String key, String value) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getAttributes() {
|
||||
return bean.getAttributes();
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return bean.getDisplayName();
|
||||
}
|
||||
|
||||
public boolean isDependency() {
|
||||
return isDependency;
|
||||
}
|
||||
|
||||
public boolean isInnerBean() {
|
||||
return bean.isInnerBean();
|
||||
}
|
||||
|
||||
public LiveBean getBean() {
|
||||
return this.bean;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017, 2019 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.model;
|
||||
|
||||
/**
|
||||
* Wrapper to mark bean type in the UI
|
||||
*
|
||||
* @author Alex Boyko
|
||||
*
|
||||
*/
|
||||
public class LiveBeanType implements DisplayName {
|
||||
|
||||
private LiveBean bean;
|
||||
|
||||
public LiveBeanType(LiveBean bean) {
|
||||
this.bean = bean;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
String type = bean.getBeanType();
|
||||
int idx = type.indexOf("$$");
|
||||
if (idx >= 0) {
|
||||
return type.substring(0, idx);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LiveBeanType("+bean+")";
|
||||
}
|
||||
|
||||
public LiveBean getBean() {
|
||||
return bean;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2017 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.model;
|
||||
|
||||
/**
|
||||
* @author Leo Dos Santos
|
||||
* @author Alex Boyko
|
||||
*/
|
||||
public class LiveBeansContext extends LiveBeansGroup<LiveBean> {
|
||||
|
||||
public static final String ATTR_CONTEXT_ID = "contextId";
|
||||
|
||||
public static final String ATTR_CONTEXT = "context";
|
||||
|
||||
public static final String ATTR_PARENT = "parent";
|
||||
|
||||
public static final String ATTR_BEANS = "beans";
|
||||
|
||||
private LiveBeansContext parent;
|
||||
|
||||
public LiveBeansContext(String label) {
|
||||
super(label);
|
||||
attributes.put(ATTR_CONTEXT, label);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return getLabel();
|
||||
}
|
||||
|
||||
public LiveBeansContext getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(LiveBeansContext parent) {
|
||||
this.parent = parent;
|
||||
attributes.put(ATTR_PARENT, parent.getLabel());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2017 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author Leo Dos Santos
|
||||
* @author Alex Boyko
|
||||
*/
|
||||
public class LiveBeansGroup<T extends AbstractLiveBeansModelElement> extends AbstractLiveBeansModelElement {
|
||||
|
||||
private final String label;
|
||||
|
||||
private final List<T> elements;
|
||||
|
||||
public LiveBeansGroup(String label) {
|
||||
this(label, new ArrayList<T>());
|
||||
}
|
||||
|
||||
public LiveBeansGroup(String label, List<T> elements) {
|
||||
this.label = label;
|
||||
this.elements = elements;
|
||||
}
|
||||
|
||||
public void addElement(T bean) {
|
||||
elements.add(bean);
|
||||
}
|
||||
|
||||
public List<T> getElements() {
|
||||
return elements;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return getLabel();
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof LiveBeansGroup) {
|
||||
LiveBeansGroup<?> other = (LiveBeansGroup<?>) obj;
|
||||
return Objects.equals(label, other.label)
|
||||
&& Objects.equals(attributes, other.attributes)
|
||||
&& Objects.equals(elements, other.elements);
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2019 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.model;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
* Parsing of Boot 1.x live beans. Differences between Boot 1.x and other Boot versions should be handled by protected API that can be overridden
|
||||
* by more recent Boot version subclasses.
|
||||
* @author Leo Dos Santos
|
||||
* @author Alex Boyko
|
||||
*/
|
||||
public class LiveBeansJsonParser {
|
||||
|
||||
private final TypeLookup typeLookup;
|
||||
|
||||
private final String jsonInput;
|
||||
|
||||
private Map<String, LiveBean> beansMap;
|
||||
|
||||
private Map<String, LiveBeansContext> contextMap;
|
||||
|
||||
private Map<String, LiveBeansResource> resourceMap;
|
||||
|
||||
public LiveBeansJsonParser(TypeLookup typeLookup, String jsonInput) {
|
||||
this.jsonInput = jsonInput;
|
||||
this.typeLookup = typeLookup;
|
||||
}
|
||||
|
||||
private void groupByResource() {
|
||||
for (LiveBean bean : beansMap.values()) {
|
||||
String resource = bean.getResource();
|
||||
if (resourceMap.containsKey(resource)) {
|
||||
LiveBeansResource group = resourceMap.get(resource);
|
||||
group.addElement(bean);
|
||||
}
|
||||
else {
|
||||
LiveBeansResource group = new LiveBeansResource(resource, bean.getTypeLookup());
|
||||
group.addElement(bean);
|
||||
resourceMap.put(resource, group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected JSONArray extractContextsJson(String json) throws JSONException {
|
||||
// JSON structure is an array of context descriptions, each containing
|
||||
// an array of beans
|
||||
return new JSONArray(json);
|
||||
}
|
||||
|
||||
public LiveBeansModel parse() throws JSONException {
|
||||
beansMap = new LinkedHashMap<String, LiveBean>();
|
||||
contextMap = new LinkedHashMap<String, LiveBeansContext>();
|
||||
resourceMap = new LinkedHashMap<String, LiveBeansResource>();
|
||||
|
||||
JSONArray contextsArray = extractContextsJson(jsonInput);
|
||||
|
||||
parseContexts(contextsArray);
|
||||
populateContextDependencies(contextsArray);
|
||||
groupByResource();
|
||||
|
||||
LiveBeansModel model = new LiveBeansModel(typeLookup);
|
||||
model.addBeans(beansMap.values());
|
||||
model.addContexts(contextMap.values());
|
||||
model.addResources(resourceMap.values());
|
||||
return model;
|
||||
}
|
||||
|
||||
private void parseBeans(LiveBeansContext context, JSONArray beansArray) throws JSONException {
|
||||
// construct LiveBeans
|
||||
for (int i = 0; i < beansArray.length(); i++) {
|
||||
JSONObject beanJson = beansArray.getJSONObject(i);
|
||||
if (beanJson != null && beanJson.has(LiveBean.ATTR_BEAN)) {
|
||||
LiveBean bean = parseBean(beanJson, context);
|
||||
bean.addAttribute(LiveBeansContext.ATTR_CONTEXT, context.getLabel());
|
||||
context.addElement(bean);
|
||||
beansMap.put(bean.getId(), bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected LiveBean parseBean(JSONObject beanJson, LiveBeansContext context) throws JSONException {
|
||||
LiveBean bean = new LiveBean(typeLookup, beanJson.getString(LiveBean.ATTR_BEAN));
|
||||
if (beanJson.has(LiveBean.ATTR_SCOPE)) {
|
||||
bean.addAttribute(LiveBean.ATTR_SCOPE, beanJson.getString(LiveBean.ATTR_SCOPE));
|
||||
}
|
||||
if (beanJson.has(LiveBean.ATTR_TYPE)) {
|
||||
bean.addAttribute(LiveBean.ATTR_TYPE, beanJson.getString(LiveBean.ATTR_TYPE));
|
||||
}
|
||||
if (beanJson.has(LiveBean.ATTR_RESOURCE)) {
|
||||
bean.addAttribute(LiveBean.ATTR_RESOURCE, beanJson.getString(LiveBean.ATTR_RESOURCE));
|
||||
}
|
||||
if (typeLookup != null && typeLookup.getApplicationName() != null) {
|
||||
bean.addAttribute(LiveBean.ATTR_APPLICATION, typeLookup.getApplicationName());
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
|
||||
/**
|
||||
* IMPORTANT: "beans" structure in the context JSON DIFFERS between Boot 1.x and later Boot versions. It is important
|
||||
* to ALWAYS extract beans from a context using this method (for example, when creating the live beans initially, or separately, when
|
||||
* populating the dependencies for those live beans), as this method may be overridden for other boot versions
|
||||
* @param contextJson
|
||||
* @return
|
||||
*/
|
||||
protected JSONArray extractBeans(JSONObject contextJson) {
|
||||
// Boot 1.x version
|
||||
return contextJson.optJSONArray(LiveBeansContext.ATTR_BEANS);
|
||||
}
|
||||
|
||||
protected String getContextId(JSONObject contextJson) throws JSONException {
|
||||
return contextJson.getString(LiveBeansContext.ATTR_CONTEXT);
|
||||
}
|
||||
|
||||
protected LiveBeansContext parseContext(JSONObject contextJson) throws JSONException {
|
||||
LiveBeansContext context = new LiveBeansContext(getContextId(contextJson));
|
||||
JSONArray beansArray = extractBeans(contextJson);
|
||||
if (beansArray != null) {
|
||||
parseBeans(context, beansArray);
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
private void parseContexts(JSONArray contextsArray) throws JSONException {
|
||||
// construct LiveBeansContexts
|
||||
for (int i = 0; i < contextsArray.length(); i++) {
|
||||
JSONObject contextJson = contextsArray.optJSONObject(i);
|
||||
if (contextJson != null) {
|
||||
LiveBeansContext context = parseContext(contextJson);
|
||||
contextMap.put(context.getLabel(), context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void populateBeanDependencies(JSONArray beansArray) throws JSONException {
|
||||
// populate LiveBean dependencies
|
||||
for (int i = 0; i < beansArray.length(); i++) {
|
||||
JSONObject beanJson = beansArray.optJSONObject(i);
|
||||
if (beanJson != null && beanJson.has(LiveBean.ATTR_BEAN)) {
|
||||
LiveBean bean = beansMap.get(beanJson.getString(LiveBean.ATTR_BEAN));
|
||||
JSONArray dependencies = beanJson.optJSONArray(LiveBean.ATTR_DEPENDENCIES);
|
||||
if (dependencies != null) {
|
||||
for (int j = 0; j < dependencies.length(); j++) {
|
||||
String dependency = dependencies.getString(j);
|
||||
LiveBean dependencyBean = beansMap.get(dependency);
|
||||
if (dependencyBean != null) {
|
||||
bean.addDependency(dependencyBean);
|
||||
}
|
||||
else {
|
||||
LiveBean dependentBean = new LiveBean(typeLookup, dependency, true);
|
||||
if (typeLookup != null && typeLookup.getApplicationName() != null) {
|
||||
dependentBean.addAttribute(LiveBean.ATTR_APPLICATION, typeLookup.getApplicationName());
|
||||
}
|
||||
bean.addDependency(dependentBean);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void populateContextDependencies(JSONArray contextsArray) throws JSONException {
|
||||
// populate LiveBeanContext dependencies
|
||||
for (int i = 0; i < contextsArray.length(); i++) {
|
||||
JSONObject contextJson = contextsArray.optJSONObject(i);
|
||||
if (contextJson != null) {
|
||||
LiveBeansContext context = contextMap.get(getContextId(contextJson));
|
||||
if (!contextJson.isNull(LiveBeansContext.ATTR_PARENT)) {
|
||||
String parent = contextJson.getString(LiveBeansContext.ATTR_PARENT);
|
||||
LiveBeansContext parentContext = contextMap.get(parent);
|
||||
if (parentContext != null) {
|
||||
context.setParent(parentContext);
|
||||
}
|
||||
}
|
||||
|
||||
// PT 164156323 - Extracting beans differs between Boot 1.x and Boot 2.x.
|
||||
// Dependencies was not being populated for Boot 2.x because of a bug
|
||||
// where, when populating the dependencies, beans were being extracted using Boot 1.x structure
|
||||
// even for Boot 2.x. The way to fix this is to delegate to the method below which is
|
||||
// overridden for Boot 2.x and handles the Boot 2.x case correctly
|
||||
JSONArray beansArray = extractBeans(contextJson); // correct way
|
||||
if (beansArray != null) {
|
||||
populateBeanDependencies(beansArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONTokener;
|
||||
|
||||
/**
|
||||
* Live Beans json parser suitable for Boot 2.x
|
||||
*
|
||||
* @author Alex Boyko
|
||||
*
|
||||
*/
|
||||
public class LiveBeansJsonParser2 extends LiveBeansJsonParser {
|
||||
|
||||
public LiveBeansJsonParser2(TypeLookup typeLookup, String jsonInput) {
|
||||
super(typeLookup, jsonInput);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JSONArray extractContextsJson(String json) throws JSONException {
|
||||
JSONObject contextsObj = new JSONObject(json);
|
||||
if (contextsObj.has("contexts")) {
|
||||
JSONObject contextsMap = contextsObj.getJSONObject("contexts");
|
||||
String[] contextIds = JSONObject.getNames(contextsMap);
|
||||
ArrayList<JSONObject> contextsList = new ArrayList<>(contextIds.length);
|
||||
for (Object contextId : contextIds) {
|
||||
if (contextId instanceof String) {
|
||||
JSONObject contextJson = contextsMap.getJSONObject((String) contextId);
|
||||
contextJson.put(LiveBeansContext.ATTR_CONTEXT_ID, contextId);
|
||||
contextsList.add(contextJson);
|
||||
}
|
||||
}
|
||||
return new JSONArray(contextsList);
|
||||
} else {
|
||||
Object obj = new JSONTokener(json).nextValue();
|
||||
if (obj instanceof JSONArray) {
|
||||
return (JSONArray) obj;
|
||||
} else {
|
||||
return new JSONArray(Arrays.asList(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getContextId(JSONObject contextJson) throws JSONException {
|
||||
return contextJson.getString(LiveBeansContext.ATTR_CONTEXT_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected JSONArray extractBeans(JSONObject contextJson) {
|
||||
JSONObject obj = contextJson.optJSONObject(LiveBeansContext.ATTR_BEANS);
|
||||
Iterable<String> iterable = () -> obj.keys();
|
||||
return new JSONArray(StreamSupport.stream(iterable.spliterator(), false)
|
||||
.map(k -> {
|
||||
try {
|
||||
JSONObject jsonBean = obj.getJSONObject(k);
|
||||
jsonBean.put(LiveBean.ATTR_BEAN, k);
|
||||
return jsonBean;
|
||||
} catch (JSONException e) {
|
||||
// Shouldn't happen since key exists
|
||||
return null;
|
||||
}})
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2017 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* A model of a running Spring application to be graphed in the Live Beans Graph
|
||||
*
|
||||
* @author Leo Dos Santos
|
||||
* @author Alex Boyko
|
||||
*/
|
||||
public class LiveBeansModel implements Comparable<LiveBeansModel> {
|
||||
|
||||
private final List<LiveBean> beans;
|
||||
|
||||
private final List<LiveBeansContext> contexts;
|
||||
|
||||
private final List<LiveBeansResource> resources;
|
||||
|
||||
private final TypeLookup typeLookup;
|
||||
|
||||
public LiveBeansModel(TypeLookup typeLookup) {
|
||||
this.beans = new ArrayList<LiveBean>();
|
||||
this.contexts = new ArrayList<LiveBeansContext>();
|
||||
this.resources = new ArrayList<LiveBeansResource>();
|
||||
this.typeLookup = typeLookup;
|
||||
}
|
||||
|
||||
public void addBeans(Collection<LiveBean> beansToAdd) {
|
||||
beans.addAll(beansToAdd);
|
||||
}
|
||||
|
||||
public void addContexts(Collection<? extends LiveBeansContext> contextsToAdd) {
|
||||
contexts.addAll(contextsToAdd);
|
||||
}
|
||||
|
||||
public void addResources(Collection<? extends LiveBeansResource> resourcesToAdd) {
|
||||
resources.addAll(resourcesToAdd);
|
||||
}
|
||||
|
||||
public int compareTo(LiveBeansModel o) {
|
||||
return getApplicationName().compareTo(o.getApplicationName());
|
||||
}
|
||||
|
||||
public String getApplicationName() {
|
||||
if (typeLookup != null) {
|
||||
return typeLookup.getApplicationName();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public List<LiveBean> getBeans() {
|
||||
return beans;
|
||||
}
|
||||
|
||||
public List<LiveBeansContext> getBeansByContext() {
|
||||
return contexts;
|
||||
}
|
||||
|
||||
public List<LiveBeansResource> getBeansByResource() {
|
||||
return resources;
|
||||
}
|
||||
|
||||
public TypeLookup getWorkspaceContext() {
|
||||
return typeLookup;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof LiveBeansModel) {
|
||||
LiveBeansModel other = (LiveBeansModel) obj;
|
||||
// Should be enough to compare contexts only since this is close to raw JSON data
|
||||
return contexts.equals(other.contexts) && Objects.equals(typeLookup, other.typeLookup);
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2017 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.model;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
/**
|
||||
* @author Leo Dos Santos
|
||||
* @author Alex Boyko
|
||||
*/
|
||||
public class LiveBeansModelCollection {
|
||||
|
||||
private static LiveBeansModelCollection instance;
|
||||
|
||||
public static LiveBeansModelCollection getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new LiveBeansModelCollection();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private final Set<LiveBeansModel> collection;
|
||||
|
||||
private LiveBeansModelCollection() {
|
||||
collection = new TreeSet<LiveBeansModel>();
|
||||
}
|
||||
|
||||
public void addModel(LiveBeansModel model) {
|
||||
if (collection.contains(model)) {
|
||||
collection.remove(model);
|
||||
}
|
||||
collection.add(model);
|
||||
}
|
||||
|
||||
public Set<LiveBeansModel> getCollection() {
|
||||
return collection;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2017 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.model;
|
||||
|
||||
/**
|
||||
* @author Leo Dos Santos
|
||||
* @author Alex Boyko
|
||||
*/
|
||||
public class LiveBeansResource extends LiveBeansGroup<LiveBean> {
|
||||
|
||||
private final TypeLookup lookupSession;
|
||||
|
||||
public LiveBeansResource(String label, TypeLookup lookupSession) {
|
||||
super(label);
|
||||
attributes.put(LiveBean.ATTR_RESOURCE, label);
|
||||
this.lookupSession = lookupSession;
|
||||
}
|
||||
|
||||
public TypeLookup getTypeLookup() {
|
||||
return this.lookupSession;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
// compute the display name the first time it's needed
|
||||
String label = getLabel();
|
||||
if (label.equalsIgnoreCase("null")) {
|
||||
return "Container Generated";
|
||||
} else {
|
||||
// Expecting the label to contain some form of
|
||||
// "[file/path/to/resource.ext]" so we're going to parse out the
|
||||
// last segment of the file path.
|
||||
int indexStart = label.indexOf("[");
|
||||
int indexEnd = label.lastIndexOf("]");
|
||||
if (indexStart > -1 && indexEnd > -1 && indexStart < indexEnd) {
|
||||
return label.substring(indexStart + 1, indexEnd);
|
||||
} else {
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
String label = getLabel();
|
||||
int indexStart = label.lastIndexOf("/");
|
||||
int indexEnd = label.lastIndexOf("]");
|
||||
if (indexStart > -1 && indexEnd > -1 && indexStart < indexEnd) {
|
||||
return label.substring(indexStart + 1, indexEnd);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getFileExtension() {
|
||||
String filename = getFileName();
|
||||
if (filename != null) {
|
||||
int idx = filename.lastIndexOf('.');
|
||||
if (idx >= 0 && idx < filename.length() - 1) {
|
||||
return filename.substring(idx + 1);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2019 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.model;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.jdt.core.IJavaProject;
|
||||
import org.eclipse.jdt.core.JavaCore;
|
||||
import org.springsource.ide.eclipse.commons.frameworks.core.util.JavaTypeUtil;
|
||||
import org.springsource.ide.eclipse.commons.livexp.util.Log;
|
||||
|
||||
/**
|
||||
* Helper class, represents parsed info from a Resource, and provide method(s)
|
||||
* to display it somehow.
|
||||
*/
|
||||
public class SpringResource {
|
||||
|
||||
public static final String BEAN_DEFINITION_IN = "BeanDefinition defined in";
|
||||
public static final String URL = "URL";
|
||||
private static final String CF_CLASSPATH_PREFIX = "/home/vcap/app/";
|
||||
private static final String CLASS = ".class";
|
||||
|
||||
private String path;
|
||||
private IProject project;
|
||||
|
||||
private static final Pattern BRACKETS = Pattern.compile("\\[[^\\]]*\\]");
|
||||
|
||||
private static final String ID_PATTERN = "\\p{javaJavaIdentifierStart}\\p{javaJavaIdentifierPart}*";
|
||||
private static final String REGEX_FQCN = ID_PATTERN + "(\\." + ID_PATTERN + ")*";
|
||||
|
||||
public SpringResource(String resourceDefinition, IProject project) {
|
||||
this.project = project;
|
||||
parse(resourceDefinition);
|
||||
}
|
||||
|
||||
private void parse(String resourceDefinition) {
|
||||
Matcher matcher = BRACKETS.matcher(resourceDefinition);
|
||||
if (matcher.find()) {
|
||||
String type = resourceDefinition.substring(0, matcher.start()).trim();
|
||||
path = resourceDefinition.substring(matcher.start() + 1, matcher.end() - 1);
|
||||
if (type.equals("file") && path.startsWith(CF_CLASSPATH_PREFIX)) {
|
||||
path = path.substring(CF_CLASSPATH_PREFIX.length());
|
||||
}
|
||||
} else if (Pattern.matches(REGEX_FQCN, resourceDefinition)) {
|
||||
// Resource is fully qualified Java type name
|
||||
path = resourceDefinition.replace('.', '/') + CLASS;
|
||||
} else {
|
||||
path = parseFromBeanDefIn(resourceDefinition);
|
||||
if (path == null) {
|
||||
path = resourceDefinition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String parseFromBeanDefIn(String resourceDefinition) {
|
||||
int beanDefInIndex = resourceDefinition.indexOf(BEAN_DEFINITION_IN);
|
||||
if (beanDefInIndex >= 0 && beanDefInIndex + BEAN_DEFINITION_IN.length() + 1 < resourceDefinition.length()) {
|
||||
String defInVal = resourceDefinition.substring(beanDefInIndex + BEAN_DEFINITION_IN.length() + 1);
|
||||
if (Pattern.matches(REGEX_FQCN, defInVal)) {
|
||||
return defInVal.replace('.', '/') + CLASS;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getResourcePath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
if (path != null && path.endsWith(".class")) {
|
||||
String clssName = path;
|
||||
|
||||
// Check if the class name is relative to either WEB-INF or
|
||||
// project path (e.g. the bean is defined in the project)
|
||||
int index = clssName.lastIndexOf("/WEB-INF/classes/");
|
||||
int length = "/WEB-INF/classes/".length();
|
||||
if (index >= 0) {
|
||||
clssName = clssName.substring(index + length);
|
||||
} else if (project != null) {
|
||||
try {
|
||||
String possibleType = typeFromProjectRelativePath(project, clssName);
|
||||
if (possibleType != null) {
|
||||
clssName = possibleType;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
clssName = clssName.substring(0, clssName.lastIndexOf(".class"));
|
||||
clssName = clssName.replaceAll("\\\\|\\/", "."); // Tolerate both '/' and '\'.
|
||||
clssName = clssName.replace('$', '.'); // Replace inner classes '$' with JDT's '.'
|
||||
|
||||
return clssName;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected String typeFromProjectRelativePath(IProject project, String fullPath) throws Exception {
|
||||
IJavaProject javaProject = getJavaProject(project);
|
||||
return javaProject != null ? JavaTypeUtil.getFQTypeName(javaProject, fullPath) : null;
|
||||
}
|
||||
|
||||
protected IJavaProject getJavaProject(IProject project) throws Exception {
|
||||
if (project != null && project.isAccessible() && project.hasNature(JavaCore.NATURE_ID)) {
|
||||
return JavaCore.create(project);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2017 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.model;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.jdt.core.IType;
|
||||
|
||||
/**
|
||||
* @author Leo Dos Santos
|
||||
* @author Alex Boyko
|
||||
*/
|
||||
public interface TypeLookup {
|
||||
|
||||
public String getApplicationName();
|
||||
|
||||
public IProject getProject();
|
||||
|
||||
IType findType(String fqName);
|
||||
|
||||
IProject[] relatedProjects();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2017 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.model;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.jdt.core.IType;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.utils.JdtUtils;
|
||||
|
||||
/**
|
||||
* Type Lookup implementation
|
||||
*
|
||||
* @author Alex Boyko
|
||||
*
|
||||
*/
|
||||
public class TypeLookupImpl implements TypeLookup {
|
||||
|
||||
private final String appName;
|
||||
|
||||
private final IProject project;
|
||||
|
||||
public TypeLookupImpl(String appName, IProject project) {
|
||||
this.appName = appName;
|
||||
this.project = project;
|
||||
}
|
||||
|
||||
public String getApplicationName() {
|
||||
return appName;
|
||||
}
|
||||
|
||||
public IProject getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
protected String cleanClassName(String className) {
|
||||
String cleanClassName = className;
|
||||
if (className != null) {
|
||||
int ix = className.indexOf('$');
|
||||
if (ix > 0) {
|
||||
cleanClassName = className.substring(0, ix);
|
||||
}
|
||||
else {
|
||||
ix = className.indexOf('#');
|
||||
if (ix > 0) {
|
||||
cleanClassName = className.substring(0, ix);
|
||||
}
|
||||
}
|
||||
}
|
||||
return cleanClassName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IType findType(String fqName) {
|
||||
IProject[] projects = relatedProjects();
|
||||
for (IProject project : projects) {
|
||||
IType type = JdtUtils.getJavaType(project, cleanClassName(fqName));
|
||||
if (type != null) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProject[] relatedProjects() {
|
||||
if (project!=null) {
|
||||
return new IProject[] { project };
|
||||
} else {
|
||||
return ResourcesPlugin.getWorkspace().getRoot().getProjects();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof TypeLookupImpl) {
|
||||
TypeLookupImpl other = (TypeLookupImpl) obj;
|
||||
return Objects.equals(appName, other.appName) && Objects.equals(project, other.project);
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2017 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.tree;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBean;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBeanRelation;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBeanType;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBeansContext;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBeansGroup;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBeansResource;
|
||||
|
||||
/**
|
||||
* A content provider for the Live Beans tree display
|
||||
*
|
||||
* @author Leo Dos Santos
|
||||
* @author Alex Boyko
|
||||
*/
|
||||
public abstract class AbstractLiveBeansTreeContentProvider implements ITreeContentProvider {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object[] getChildren(Object parentElement) {
|
||||
if (parentElement instanceof LiveBeansGroup) {
|
||||
LiveBeansGroup<?> group = (LiveBeansGroup<?>) parentElement;
|
||||
if (group instanceof LiveBeansContext || group instanceof LiveBeansResource) {
|
||||
List<LiveBean> sortedBeans = new ArrayList<>(((LiveBeansGroup<LiveBean>)group).getElements());
|
||||
sortedBeans.sort((a, b) -> a.getDisplayName().compareToIgnoreCase(b.getDisplayName()));
|
||||
return sortedBeans.toArray(new LiveBean[sortedBeans.size()]);
|
||||
} else {
|
||||
return group.getElements().toArray();
|
||||
}
|
||||
}
|
||||
else if (parentElement instanceof LiveBean) {
|
||||
LiveBean bean = (LiveBean) parentElement;
|
||||
return getBeanChildren(bean).toArray();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected List<Object> getBeanChildren(LiveBean bean) {
|
||||
List<Object> children = new ArrayList<>();
|
||||
|
||||
children.add(new LiveBeanType(bean));
|
||||
|
||||
children.add(new LiveBeansGroup<>("Dependencies", bean.getDependencies()
|
||||
.stream()
|
||||
.map(b -> new LiveBeanRelation(b, true))
|
||||
.collect(Collectors.toList())));
|
||||
|
||||
children.add(new LiveBeansGroup<>("Injected Into", bean.getInjectedInto()
|
||||
.stream()
|
||||
.map(b -> new LiveBeanRelation(b))
|
||||
.collect(Collectors.toList())));
|
||||
|
||||
return children;
|
||||
}
|
||||
|
||||
public Object getParent(Object element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean hasChildren(Object element) {
|
||||
if (element instanceof LiveBeansGroup<?>) {
|
||||
return !((LiveBeansGroup<?>)element).getElements().isEmpty();
|
||||
} else if (element instanceof LiveBean) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2019 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.tree;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBean;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBeansModel;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBeansResource;
|
||||
|
||||
/**
|
||||
* Beans grouped by contexts
|
||||
*
|
||||
* @author Alex Boyko
|
||||
*
|
||||
*/
|
||||
public final class ContextGroupedBeansContentProvider extends AbstractLiveBeansTreeContentProvider {
|
||||
|
||||
public static final ContextGroupedBeansContentProvider INSTANCE = new ContextGroupedBeansContentProvider();
|
||||
|
||||
private ContextGroupedBeansContentProvider() {}
|
||||
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement) {
|
||||
if (inputElement instanceof LiveBeansModel) {
|
||||
LiveBeansModel model = (LiveBeansModel) inputElement;
|
||||
return model.getBeansByContext().toArray();
|
||||
}
|
||||
return new Object[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<Object> getBeanChildren(LiveBean bean) {
|
||||
List<Object> children = super.getBeanChildren(bean);
|
||||
String resource = bean.getResource();
|
||||
if (resource != null && !resource.isEmpty()) {
|
||||
// Do not add the bean as a element to the resource, otherwise
|
||||
// it will appear as a child and the tree will have an infinite
|
||||
// deep livebean. However, we still need the type lookup in the bean
|
||||
// to resolve the types in the resource
|
||||
children.add(1, new LiveBeansResource(resource, bean.getTypeLookup()));
|
||||
}
|
||||
return children;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2017 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.tree;
|
||||
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.viewers.ViewerFilter;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBean;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBeanRelation;
|
||||
|
||||
/**
|
||||
* @author Leo Dos Santos
|
||||
* @author Alex Boyko
|
||||
*/
|
||||
public class InnerBeansViewerFilter extends ViewerFilter {
|
||||
|
||||
@Override
|
||||
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||
if (element instanceof LiveBean) {
|
||||
LiveBean bean = (LiveBean) element;
|
||||
return !bean.isInnerBean();
|
||||
}
|
||||
else if (element instanceof LiveBeanRelation) {
|
||||
LiveBeanRelation bean = (LiveBeanRelation) element;
|
||||
return !bean.isInnerBean();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2017 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.tree;
|
||||
|
||||
import org.eclipse.jdt.ui.ISharedImages;
|
||||
import org.eclipse.jdt.ui.JavaUI;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.LiveBeansUiPlugin;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.DisplayName;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBean;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBeanRelation;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBeanType;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBeansGroup;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBeansResource;
|
||||
import org.springsource.ide.eclipse.commons.livexp.ui.util.TreeElementWrappingContentProvider;
|
||||
|
||||
/**
|
||||
* A label provider for the Live Beans tree display
|
||||
*
|
||||
* @author Leo Dos Santos
|
||||
* @author Alex Boyko
|
||||
*/
|
||||
public class LiveBeansTreeLabelProvider extends LabelProvider {
|
||||
|
||||
public static final LiveBeansTreeLabelProvider INSTANCE = new LiveBeansTreeLabelProvider();
|
||||
|
||||
// public void decorate(Object element, IDecoration decoration) {
|
||||
// if (element instanceof LiveBean) {
|
||||
// LiveBean bean = (LiveBean) element;
|
||||
// String type = bean.getBeanType();
|
||||
// String scope = bean.getScope();
|
||||
// String text = "[type=\"" + type + "\"; scope=\"" + scope + "\"]";
|
||||
// decoration.addSuffix(text);
|
||||
// decoration.setForegroundColor(Display.getDefault().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND));
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public Image getImage(Object element) {
|
||||
if (element instanceof TreeElementWrappingContentProvider.TreeNode) {
|
||||
return getImage(((TreeElementWrappingContentProvider.TreeNode)element).getWrappedValue());
|
||||
} else if (element instanceof LiveBean) {
|
||||
return LiveBeansUiPlugin.getDefault().getImageRegistry().get(LiveBeansUiPlugin.IMG_OBJS_BEAN);
|
||||
} else if (element instanceof LiveBeansResource) {
|
||||
String fileExtension = ((LiveBeansResource)element).getFileExtension();
|
||||
if ("class".equalsIgnoreCase(fileExtension)) {
|
||||
return JavaUI.getSharedImages().getImage(ISharedImages.IMG_OBJS_CFILE);
|
||||
} else {
|
||||
return LiveBeansUiPlugin.getDefault().getImageRegistry().get(LiveBeansUiPlugin.IMG_OBJS_CONFIG);
|
||||
}
|
||||
} else if (element instanceof LiveBeansGroup<?>) {
|
||||
return LiveBeansUiPlugin.getDefault().getImageRegistry().get(LiveBeansUiPlugin.IMG_OBJS_COLLECTION);
|
||||
} else if (element instanceof LiveBeanType) {
|
||||
return JavaUI.getSharedImages().getImage(ISharedImages.IMG_OBJS_CLASS);
|
||||
} else if (element instanceof LiveBeanRelation) {
|
||||
// TODO: incoming/outgoing arrow images???
|
||||
return LiveBeansUiPlugin.getDefault().getImageRegistry().get(LiveBeansUiPlugin.IMG_OBJS_BEAN_REF);
|
||||
}
|
||||
return super.getImage(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
if (element instanceof TreeElementWrappingContentProvider.TreeNode) {
|
||||
return getText(((TreeElementWrappingContentProvider.TreeNode) element).getWrappedValue());
|
||||
} else if (element instanceof DisplayName) {
|
||||
return ((DisplayName) element).getDisplayName();
|
||||
}
|
||||
return super.getText(element);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2012, 2017 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.tree;
|
||||
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBeansModel;
|
||||
|
||||
/**
|
||||
* Content provider for beans grouped by resources
|
||||
*
|
||||
* @author Alex Boyko
|
||||
*
|
||||
*/
|
||||
public final class ResourceGroupedBeansContentProvider extends AbstractLiveBeansTreeContentProvider {
|
||||
|
||||
public static final ResourceGroupedBeansContentProvider INSTANCE = new ResourceGroupedBeansContentProvider();
|
||||
|
||||
private ResourceGroupedBeansContentProvider() {}
|
||||
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement) {
|
||||
if (inputElement instanceof LiveBeansModel) {
|
||||
LiveBeansModel model = (LiveBeansModel) inputElement;
|
||||
return model.getBeansByResource().toArray();
|
||||
}
|
||||
return new Object[0];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2017 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.utils;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.jdt.core.IJavaProject;
|
||||
import org.eclipse.jdt.core.IType;
|
||||
import org.eclipse.jdt.core.JavaCore;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.LiveBeansUiPlugin;
|
||||
|
||||
/**
|
||||
* JDT Utilities (subset taken from Spring-IDE core to minimize dependencies)
|
||||
*
|
||||
* @author Alex Boyko
|
||||
*
|
||||
*/
|
||||
public class JdtUtils {
|
||||
|
||||
/**
|
||||
* Returns the corresponding Java project or <code>null</code> a for given
|
||||
* project.
|
||||
*
|
||||
* @param project
|
||||
* the project the Java project is requested for
|
||||
* @return the requested Java project or <code>null</code> if the Java project
|
||||
* is not defined or the project is not accessible
|
||||
*/
|
||||
public static IJavaProject getJavaProject(IProject project) {
|
||||
if (project.isAccessible()) {
|
||||
try {
|
||||
if (project.hasNature(JavaCore.NATURE_ID)) {
|
||||
return (IJavaProject) project.getNature(JavaCore.NATURE_ID);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
LiveBeansUiPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, LiveBeansUiPlugin.PLUGIN_ID,
|
||||
"Error getting Java project for project '" + project.getName() + "'", e));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the corresponding Java type for given full-qualified class name.
|
||||
*
|
||||
* @param project
|
||||
* the JDT project the class belongs to
|
||||
* @param className
|
||||
* the full qualified class name of the requested Java type
|
||||
* @return the requested Java type or null if the class is not defined or the
|
||||
* project is not accessible
|
||||
*/
|
||||
public static IType getJavaType(IProject project, String className) {
|
||||
IJavaProject javaProject = JdtUtils.getJavaProject(project);
|
||||
if (className != null) {
|
||||
// For inner classes replace '$' by '.'
|
||||
int pos = className.lastIndexOf('$');
|
||||
if (pos > 0) {
|
||||
className = className.replace('$', '.');
|
||||
}
|
||||
try {
|
||||
IType type = null;
|
||||
// First look for the type in the Java project
|
||||
if (javaProject != null) {
|
||||
// TODO CD not sure why we need
|
||||
type = javaProject.findType(className, new NullProgressMonitor());
|
||||
// type = javaProject.findType(className);
|
||||
if (type != null) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
// Then look for the type in the referenced Java projects
|
||||
for (IProject refProject : project.getReferencedProjects()) {
|
||||
IJavaProject refJavaProject = JdtUtils.getJavaProject(refProject);
|
||||
if (refJavaProject != null) {
|
||||
type = refJavaProject.findType(className);
|
||||
if (type != null) {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fall back and try to locate the class using AJDT
|
||||
// TODO: uncomment this call
|
||||
// return getAjdtType(project, className);
|
||||
} catch (CoreException e) {
|
||||
LiveBeansUiPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, LiveBeansUiPlugin.PLUGIN_ID,
|
||||
"Error getting Java type '" + className + "'", e));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2019 Pivotal, Inc.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* https://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Pivotal, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.springframework.ide.eclipse.beans.ui.live.utils;
|
||||
|
||||
import org.eclipse.jdt.core.IType;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.AbstractLiveBeansModelElement;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBean;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBeanRelation;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.LiveBeansResource;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.SpringResource;
|
||||
import org.springframework.ide.eclipse.beans.ui.live.model.TypeLookup;
|
||||
import org.springsource.ide.eclipse.commons.ui.SpringUIUtils;
|
||||
|
||||
public class LiveBeanUtil {
|
||||
|
||||
/**
|
||||
* Navigates to the type IN the resource definition of the bean, as opposed to actual bean
|
||||
* type.
|
||||
* <p/>
|
||||
* This method specifically looks at the resource attribute in the live bean to obtain a type.
|
||||
* <p/>
|
||||
* This is in contrast to {@link #navigateToType(LiveBean)}, where navigation
|
||||
* occurs to the actual type of the bean.
|
||||
* <p/>
|
||||
* Type of the Bean and the type in the Resource Definition of the Bean may NOT
|
||||
* necessarily be the same.
|
||||
*
|
||||
* @param bean
|
||||
*/
|
||||
public static void navigateToResource(AbstractLiveBeansModelElement element) {
|
||||
LiveBean liveBean = null;
|
||||
|
||||
if (element instanceof LiveBean) {
|
||||
liveBean = (LiveBean) element;
|
||||
} else if (element instanceof LiveBeanRelation) {
|
||||
liveBean = ((LiveBeanRelation) element).getBean();
|
||||
}
|
||||
|
||||
// Parse the type from the resource in the live bean and then navigate to that type
|
||||
if (liveBean != null) {
|
||||
TypeLookup typeLookup = liveBean.getTypeLookup();
|
||||
String resource = liveBean.getResource();
|
||||
String parsedType = parseType(resource, typeLookup);
|
||||
openInEditor(typeLookup, parsedType);
|
||||
} else if (element instanceof LiveBeansResource) {
|
||||
LiveBeansResource resource = (LiveBeansResource) element;
|
||||
TypeLookup typeLookup = resource.getTypeLookup();
|
||||
String resourceVal = null;
|
||||
if (resource.getAttributes() != null) {
|
||||
resourceVal = resource.getAttributes().get(LiveBean.ATTR_RESOURCE);
|
||||
}
|
||||
if (resourceVal == null) {
|
||||
resourceVal = resource.getLabel();
|
||||
}
|
||||
if (typeLookup != null && resourceVal != null) {
|
||||
String parsedType = parseType(resourceVal, typeLookup);
|
||||
openInEditor(typeLookup, parsedType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Navigates to the bean TYPE in the live bean. It does NOT look at the resource
|
||||
* definition, UNLESS the type happens to be a proxy. In this case, it will
|
||||
* navigate to the resource definition.
|
||||
*
|
||||
* @param bean
|
||||
*/
|
||||
public static void navigateToType(LiveBean bean) {
|
||||
TypeLookup appName = bean.getTypeLookup();
|
||||
String beanClass = bean.getBeanType();
|
||||
if (appName != null) {
|
||||
// Remove $$EnhancerBySpringCGLIB$$
|
||||
beanClass = stripCGLib(beanClass);
|
||||
if (beanClass != null && beanClass.trim().length() > 0) {
|
||||
if (beanClass.startsWith("com.sun.proxy")) {
|
||||
// Special case for proxy beans, extract the type
|
||||
// from the resource field
|
||||
navigateToResource(bean);
|
||||
} else {
|
||||
openInEditor(appName, beanClass.replace('$', '.'));
|
||||
}
|
||||
} else {
|
||||
// No type field, so infer class from bean ID
|
||||
openInEditor(appName, bean.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String stripCGLib(String beanClass) {
|
||||
if (beanClass != null) {
|
||||
int chop = beanClass.indexOf("$$EnhancerBySpringCGLIB$$");
|
||||
if (chop >= 0) {
|
||||
beanClass = beanClass.substring(0, chop);
|
||||
}
|
||||
|
||||
chop = beanClass.indexOf("$$Lambda$");
|
||||
if (chop >= 0) {
|
||||
beanClass = beanClass.substring(0, chop);
|
||||
}
|
||||
}
|
||||
|
||||
return beanClass;
|
||||
}
|
||||
|
||||
private static String parseType(String resource, TypeLookup typeLookup) {
|
||||
if (resource != null && resource.trim().length() > 0 && !resource.equalsIgnoreCase("null")) {
|
||||
SpringResource springResource = new SpringResource(resource, typeLookup.getProject());
|
||||
return springResource.getClassName();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void openInEditor(TypeLookup workspaceContext, String className) {
|
||||
if (className != null) {
|
||||
IType type = workspaceContext.findType(className);
|
||||
if (type != null) {
|
||||
SpringUIUtils.openInEditor(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="lib/accessors-smart-1.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/activation-1.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/adal4j-1.6.4.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/adapter-rxjava-2.6.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/animal-sniffer-annotations-1.18.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/applicationinsights-core-2.5.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/asm-5.0.4.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-annotations-1.7.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-arm-client-runtime-1.6.5.jar" sourcepath="lib-src/azure-arm-client-runtime-1.6.5-sources.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-auth-helper-0.2.0.jar" sourcepath="lib-src/azure-auth-helper-0.2.0-sources.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-client-authentication-1.6.15.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-client-runtime-1.7.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-keyvault-1.0.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-keyvault-core-0.8.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-keyvault-webkey-1.0.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-maven-plugin-common-0.1.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-appplatform-1.0.0-beta-2.jar" sourcepath="lib-src/azure-mgmt-appplatform-1.0.0-beta-2-sources.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-appservice-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-batch-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-batchai-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-cdn-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-compute-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-containerinstance-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-containerregistry-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-containerservice-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-cosmosdb-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-dns-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-eventhub-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-graph-rbac-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-keyvault-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-locks-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-monitor-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-msi-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-network-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-redis-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-resources-1.30.0.jar" sourcepath="lib-src/azure-mgmt-resources-1.30.0-sources.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-search-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-servicebus-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-sql-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-storage-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-mgmt-trafficmanager-1.30.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/azure-storage-6.1.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/btf-1.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/checker-qual-2.8.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/client-runtime-1.7.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-codec-1.11.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-collections4-4.4.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-io-2.6.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-lang3-3.9.jar" sourcepath="lib-src/commons-lang3-3.9-sources.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-logging-1.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/converter-jackson-2.5.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/error_prone_annotations-2.3.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/failureaccess-1.0.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/FastInfoset-1.2.16.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/hamcrest-core-1.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/httpclient-4.5.9.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/httpcore-4.4.11.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/istack-commons-runtime-3.0.8.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/j2objc-annotations-1.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jackson-annotations-2.9.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jackson-core-2.9.4.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jackson-coreutils-1.9.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jackson-databind-2.9.6.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jackson-datatype-joda-2.10.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jakarta.activation-api-1.2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jakarta.xml.bind-api-2.3.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jansi-1.17.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/javax.mail-1.6.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/javax.servlet-api-3.1.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jaxb-api-2.3.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jaxb-runtime-2.3.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jcip-annotations-1.0-1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jetty-http-9.4.20.v20190813.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jetty-io-9.4.20.v20190813.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jetty-security-9.4.20.v20190813.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jetty-server-9.4.20.v20190813.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jetty-servlet-9.4.20.v20190813.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jetty-util-9.4.20.v20190813.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jjwt-0.9.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/joda-time-2.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jopt-simple-5.0.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/json-schema-core-1.2.10.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/json-schema-validator-2.2.10.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/json-smart-2.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jsr305-3.0.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/junit-4.12.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lang-tag-1.4.4.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/libphonenumber-8.0.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/logging-interceptor-3.12.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/mailapi-1.4.3.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/msg-simple-1.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/nimbus-jose-jwt-8.4.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/nimbus-jose-jwt-8.6.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/oauth2-oidc-sdk-6.5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/okhttp-3.12.6.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/okhttp-urlconnection-3.12.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/okio-1.15.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/org.jacoco.agent-0.8.4-runtime.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/retrofit-2.5.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/rhino-1.7.7.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/rxjava-1.3.8.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/slf4j-api-1.7.21.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/stax-ex-1.8.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/txw2-2.3.2.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/uri-template-0.9.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.springframework.ide.eclipse.boot.dash.azure</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,8 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
@@ -0,0 +1,59 @@
|
||||
eclipse.preferences.version=1
|
||||
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
|
||||
sp_cleanup.add_default_serial_version_id=true
|
||||
sp_cleanup.add_generated_serial_version_id=false
|
||||
sp_cleanup.add_missing_annotations=true
|
||||
sp_cleanup.add_missing_deprecated_annotations=true
|
||||
sp_cleanup.add_missing_methods=false
|
||||
sp_cleanup.add_missing_nls_tags=false
|
||||
sp_cleanup.add_missing_override_annotations=true
|
||||
sp_cleanup.add_missing_override_annotations_interface_methods=true
|
||||
sp_cleanup.add_serial_version_id=false
|
||||
sp_cleanup.always_use_blocks=true
|
||||
sp_cleanup.always_use_parentheses_in_expressions=false
|
||||
sp_cleanup.always_use_this_for_non_static_field_access=false
|
||||
sp_cleanup.always_use_this_for_non_static_method_access=false
|
||||
sp_cleanup.convert_functional_interfaces=false
|
||||
sp_cleanup.convert_to_enhanced_for_loop=false
|
||||
sp_cleanup.correct_indentation=false
|
||||
sp_cleanup.format_source_code=false
|
||||
sp_cleanup.format_source_code_changes_only=false
|
||||
sp_cleanup.insert_inferred_type_arguments=false
|
||||
sp_cleanup.make_local_variable_final=true
|
||||
sp_cleanup.make_parameters_final=false
|
||||
sp_cleanup.make_private_fields_final=true
|
||||
sp_cleanup.make_type_abstract_if_missing_method=false
|
||||
sp_cleanup.make_variable_declarations_final=false
|
||||
sp_cleanup.never_use_blocks=false
|
||||
sp_cleanup.never_use_parentheses_in_expressions=true
|
||||
sp_cleanup.on_save_use_additional_actions=true
|
||||
sp_cleanup.organize_imports=false
|
||||
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
|
||||
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
|
||||
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
|
||||
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
|
||||
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
|
||||
sp_cleanup.remove_private_constructors=true
|
||||
sp_cleanup.remove_redundant_type_arguments=false
|
||||
sp_cleanup.remove_trailing_whitespaces=true
|
||||
sp_cleanup.remove_trailing_whitespaces_all=true
|
||||
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
|
||||
sp_cleanup.remove_unnecessary_casts=false
|
||||
sp_cleanup.remove_unnecessary_nls_tags=false
|
||||
sp_cleanup.remove_unused_imports=false
|
||||
sp_cleanup.remove_unused_local_variables=false
|
||||
sp_cleanup.remove_unused_private_fields=true
|
||||
sp_cleanup.remove_unused_private_members=false
|
||||
sp_cleanup.remove_unused_private_methods=true
|
||||
sp_cleanup.remove_unused_private_types=true
|
||||
sp_cleanup.sort_members=false
|
||||
sp_cleanup.sort_members_all=false
|
||||
sp_cleanup.use_anonymous_class_creation=false
|
||||
sp_cleanup.use_blocks=false
|
||||
sp_cleanup.use_blocks_only_for_return_and_throw=false
|
||||
sp_cleanup.use_lambda=true
|
||||
sp_cleanup.use_parentheses_in_expressions=false
|
||||
sp_cleanup.use_this_for_non_static_field_access=false
|
||||
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
|
||||
sp_cleanup.use_this_for_non_static_method_access=false
|
||||
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
|
||||
@@ -0,0 +1,2 @@
|
||||
boot.validation.initialized=true
|
||||
eclipse.preferences.version=1
|
||||
@@ -0,0 +1,132 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-SymbolicName: org.springframework.ide.eclipse.boot.dash.azure;singleton:=true
|
||||
Bundle-Version: 4.8.1.qualifier
|
||||
Bundle-Vendor: Pivotal Inc
|
||||
Bundle-Name: Spring Boot Dash CF Support
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.ui.ide,
|
||||
org.eclipse.core.runtime,
|
||||
org.springframework.ide.eclipse.boot.launch,
|
||||
org.springframework.ide.eclipse.boot,
|
||||
org.springframework.ide.eclipse.boot.dash,
|
||||
org.springsource.ide.eclipse.commons.livexp,
|
||||
org.springsource.ide.eclipse.commons.frameworks.core,
|
||||
org.eclipse.debug.core,
|
||||
org.eclipse.jdt.core,
|
||||
com.google.guava,
|
||||
com.google.gson,
|
||||
org.springframework.ide.eclipse.beans.ui.live
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-Activator: org.springframework.ide.eclipse.boot.dash.azure.BootDashAzurePlugin
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: org.springframework.ide.eclipse.boot.dash.azure
|
||||
Automatic-Module-Name: org.springframework.ide.eclipse.boot.dash.azure
|
||||
Bundle-ClassPath: lib/accessors-smart-1.2.jar,
|
||||
lib/activation-1.1.jar,
|
||||
lib/adal4j-1.6.4.jar,
|
||||
lib/adapter-rxjava-2.6.2.jar,
|
||||
lib/animal-sniffer-annotations-1.18.jar,
|
||||
lib/applicationinsights-core-2.5.1.jar,
|
||||
lib/asm-5.0.4.jar,
|
||||
lib/azure-1.30.0.jar,
|
||||
lib/azure-annotations-1.7.0.jar,
|
||||
lib/azure-arm-client-runtime-1.6.5.jar,
|
||||
lib/azure-auth-helper-0.2.0.jar,
|
||||
lib/azure-client-authentication-1.6.15.jar,
|
||||
lib/azure-client-runtime-1.7.0.jar,
|
||||
lib/azure-keyvault-1.0.0.jar,
|
||||
lib/azure-keyvault-core-0.8.0.jar,
|
||||
lib/azure-keyvault-webkey-1.0.0.jar,
|
||||
lib/azure-maven-plugin-common-0.1.0.jar,
|
||||
lib/azure-mgmt-appplatform-1.0.0-beta-2.jar,
|
||||
lib/azure-mgmt-appservice-1.30.0.jar,
|
||||
lib/azure-mgmt-batch-1.30.0.jar,
|
||||
lib/azure-mgmt-batchai-1.30.0.jar,
|
||||
lib/azure-mgmt-cdn-1.30.0.jar,
|
||||
lib/azure-mgmt-compute-1.30.0.jar,
|
||||
lib/azure-mgmt-containerinstance-1.30.0.jar,
|
||||
lib/azure-mgmt-containerregistry-1.30.0.jar,
|
||||
lib/azure-mgmt-containerservice-1.30.0.jar,
|
||||
lib/azure-mgmt-cosmosdb-1.30.0.jar,
|
||||
lib/azure-mgmt-dns-1.30.0.jar,
|
||||
lib/azure-mgmt-eventhub-1.30.0.jar,
|
||||
lib/azure-mgmt-graph-rbac-1.30.0.jar,
|
||||
lib/azure-mgmt-keyvault-1.30.0.jar,
|
||||
lib/azure-mgmt-locks-1.30.0.jar,
|
||||
lib/azure-mgmt-monitor-1.30.0.jar,
|
||||
lib/azure-mgmt-msi-1.30.0.jar,
|
||||
lib/azure-mgmt-network-1.30.0.jar,
|
||||
lib/azure-mgmt-redis-1.30.0.jar,
|
||||
lib/azure-mgmt-resources-1.30.0.jar,
|
||||
lib/azure-mgmt-search-1.30.0.jar,
|
||||
lib/azure-mgmt-servicebus-1.30.0.jar,
|
||||
lib/azure-mgmt-sql-1.30.0.jar,
|
||||
lib/azure-mgmt-storage-1.30.0.jar,
|
||||
lib/azure-mgmt-trafficmanager-1.30.0.jar,
|
||||
lib/azure-storage-6.1.0.jar,
|
||||
lib/btf-1.2.jar,
|
||||
lib/checker-qual-2.8.1.jar,
|
||||
lib/client-runtime-1.7.0.jar,
|
||||
lib/commons-codec-1.11.jar,
|
||||
lib/commons-collections4-4.4.jar,
|
||||
lib/commons-io-2.6.jar,
|
||||
lib/commons-lang3-3.9.jar,
|
||||
lib/commons-logging-1.2.jar,
|
||||
lib/converter-jackson-2.5.0.jar,
|
||||
lib/error_prone_annotations-2.3.2.jar,
|
||||
lib/failureaccess-1.0.1.jar,
|
||||
lib/FastInfoset-1.2.16.jar,
|
||||
lib/hamcrest-core-1.3.jar,
|
||||
lib/httpclient-4.5.9.jar,
|
||||
lib/httpcore-4.4.11.jar,
|
||||
lib/istack-commons-runtime-3.0.8.jar,
|
||||
lib/j2objc-annotations-1.3.jar,
|
||||
lib/jackson-annotations-2.9.0.jar,
|
||||
lib/jackson-core-2.9.4.jar,
|
||||
lib/jackson-coreutils-1.9.jar,
|
||||
lib/jackson-databind-2.9.6.jar,
|
||||
lib/jackson-datatype-joda-2.10.0.jar,
|
||||
lib/jakarta.activation-api-1.2.1.jar,
|
||||
lib/jakarta.xml.bind-api-2.3.2.jar,
|
||||
lib/jansi-1.17.1.jar,
|
||||
lib/javax.mail-1.6.1.jar,
|
||||
lib/javax.servlet-api-3.1.0.jar,
|
||||
lib/jaxb-api-2.3.0.jar,
|
||||
lib/jaxb-runtime-2.3.2.jar,
|
||||
lib/jcip-annotations-1.0-1.jar,
|
||||
lib/jetty-http-9.4.20.v20190813.jar,
|
||||
lib/jetty-io-9.4.20.v20190813.jar,
|
||||
lib/jetty-security-9.4.20.v20190813.jar,
|
||||
lib/jetty-server-9.4.20.v20190813.jar,
|
||||
lib/jetty-servlet-9.4.20.v20190813.jar,
|
||||
lib/jetty-util-9.4.20.v20190813.jar,
|
||||
lib/jjwt-0.9.1.jar,
|
||||
lib/joda-time-2.1.jar,
|
||||
lib/jopt-simple-5.0.3.jar,
|
||||
lib/json-schema-core-1.2.10.jar,
|
||||
lib/json-schema-validator-2.2.10.jar,
|
||||
lib/json-smart-2.3.jar,
|
||||
lib/jsr305-3.0.1.jar,
|
||||
lib/junit-4.12.jar,
|
||||
lib/lang-tag-1.4.4.jar,
|
||||
lib/libphonenumber-8.0.0.jar,
|
||||
lib/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar,
|
||||
lib/logging-interceptor-3.12.2.jar,
|
||||
lib/mailapi-1.4.3.jar,
|
||||
lib/msg-simple-1.1.jar,
|
||||
lib/nimbus-jose-jwt-8.4.jar,
|
||||
lib/nimbus-jose-jwt-8.6.jar,
|
||||
lib/oauth2-oidc-sdk-6.5.jar,
|
||||
lib/okhttp-3.12.6.jar,
|
||||
lib/okhttp-urlconnection-3.12.2.jar,
|
||||
lib/okio-1.15.0.jar,
|
||||
lib/org.jacoco.agent-0.8.4-runtime.jar,
|
||||
lib/retrofit-2.5.0.jar,
|
||||
lib/rhino-1.7.7.1.jar,
|
||||
lib/rxjava-1.3.8.jar,
|
||||
lib/slf4j-api-1.7.21.jar,
|
||||
lib/stax-ex-1.8.1.jar,
|
||||
lib/txw2-2.3.2.jar,
|
||||
lib/uri-template-0.9.jar,
|
||||
.
|
||||
@@ -0,0 +1,3 @@
|
||||
- Add connect/disconnect action (probably this should be done by refactoring the existing action for CF to make it
|
||||
'generic'.
|
||||
- Persist connected state and try to reconnect automatically
|
||||
@@ -0,0 +1,113 @@
|
||||
output.. = bin/
|
||||
source.. = src/
|
||||
bin.includes = META-INF/,\
|
||||
plugin.xml,\
|
||||
icons/,\
|
||||
.,\
|
||||
lib/accessors-smart-1.2.jar,\
|
||||
lib/activation-1.1.jar,\
|
||||
lib/adal4j-1.6.4.jar,\
|
||||
lib/adapter-rxjava-2.6.2.jar,\
|
||||
lib/animal-sniffer-annotations-1.18.jar,\
|
||||
lib/applicationinsights-core-2.5.1.jar,\
|
||||
lib/asm-5.0.4.jar,\
|
||||
lib/azure-1.30.0.jar,\
|
||||
lib/azure-annotations-1.7.0.jar,\
|
||||
lib/azure-arm-client-runtime-1.6.5.jar,\
|
||||
lib/azure-auth-helper-0.2.0.jar,\
|
||||
lib/azure-client-authentication-1.6.15.jar,\
|
||||
lib/azure-client-runtime-1.7.0.jar,\
|
||||
lib/azure-keyvault-1.0.0.jar,\
|
||||
lib/azure-keyvault-core-0.8.0.jar,\
|
||||
lib/azure-keyvault-webkey-1.0.0.jar,\
|
||||
lib/azure-maven-plugin-common-0.1.0.jar,\
|
||||
lib/azure-mgmt-appplatform-1.0.0-beta-2.jar,\
|
||||
lib/azure-mgmt-appservice-1.30.0.jar,\
|
||||
lib/azure-mgmt-batch-1.30.0.jar,\
|
||||
lib/azure-mgmt-batchai-1.30.0.jar,\
|
||||
lib/azure-mgmt-cdn-1.30.0.jar,\
|
||||
lib/azure-mgmt-compute-1.30.0.jar,\
|
||||
lib/azure-mgmt-containerinstance-1.30.0.jar,\
|
||||
lib/azure-mgmt-containerregistry-1.30.0.jar,\
|
||||
lib/azure-mgmt-containerservice-1.30.0.jar,\
|
||||
lib/azure-mgmt-cosmosdb-1.30.0.jar,\
|
||||
lib/azure-mgmt-dns-1.30.0.jar,\
|
||||
lib/azure-mgmt-eventhub-1.30.0.jar,\
|
||||
lib/azure-mgmt-graph-rbac-1.30.0.jar,\
|
||||
lib/azure-mgmt-keyvault-1.30.0.jar,\
|
||||
lib/azure-mgmt-locks-1.30.0.jar,\
|
||||
lib/azure-mgmt-monitor-1.30.0.jar,\
|
||||
lib/azure-mgmt-msi-1.30.0.jar,\
|
||||
lib/azure-mgmt-network-1.30.0.jar,\
|
||||
lib/azure-mgmt-redis-1.30.0.jar,\
|
||||
lib/azure-mgmt-resources-1.30.0.jar,\
|
||||
lib/azure-mgmt-search-1.30.0.jar,\
|
||||
lib/azure-mgmt-servicebus-1.30.0.jar,\
|
||||
lib/azure-mgmt-sql-1.30.0.jar,\
|
||||
lib/azure-mgmt-storage-1.30.0.jar,\
|
||||
lib/azure-mgmt-trafficmanager-1.30.0.jar,\
|
||||
lib/azure-storage-6.1.0.jar,\
|
||||
lib/btf-1.2.jar,\
|
||||
lib/checker-qual-2.8.1.jar,\
|
||||
lib/client-runtime-1.7.0.jar,\
|
||||
lib/commons-codec-1.11.jar,\
|
||||
lib/commons-collections4-4.4.jar,\
|
||||
lib/commons-io-2.6.jar,\
|
||||
lib/commons-lang3-3.9.jar,\
|
||||
lib/commons-logging-1.2.jar,\
|
||||
lib/converter-jackson-2.5.0.jar,\
|
||||
lib/error_prone_annotations-2.3.2.jar,\
|
||||
lib/failureaccess-1.0.1.jar,\
|
||||
lib/FastInfoset-1.2.16.jar,\
|
||||
lib/hamcrest-core-1.3.jar,\
|
||||
lib/httpclient-4.5.9.jar,\
|
||||
lib/httpcore-4.4.11.jar,\
|
||||
lib/istack-commons-runtime-3.0.8.jar,\
|
||||
lib/j2objc-annotations-1.3.jar,\
|
||||
lib/jackson-annotations-2.9.0.jar,\
|
||||
lib/jackson-core-2.9.4.jar,\
|
||||
lib/jackson-coreutils-1.9.jar,\
|
||||
lib/jackson-databind-2.9.6.jar,\
|
||||
lib/jackson-datatype-joda-2.10.0.jar,\
|
||||
lib/jakarta.activation-api-1.2.1.jar,\
|
||||
lib/jakarta.xml.bind-api-2.3.2.jar,\
|
||||
lib/jansi-1.17.1.jar,\
|
||||
lib/javax.mail-1.6.1.jar,\
|
||||
lib/javax.servlet-api-3.1.0.jar,\
|
||||
lib/jaxb-api-2.3.0.jar,\
|
||||
lib/jaxb-runtime-2.3.2.jar,\
|
||||
lib/jcip-annotations-1.0-1.jar,\
|
||||
lib/jetty-http-9.4.20.v20190813.jar,\
|
||||
lib/jetty-io-9.4.20.v20190813.jar,\
|
||||
lib/jetty-security-9.4.20.v20190813.jar,\
|
||||
lib/jetty-server-9.4.20.v20190813.jar,\
|
||||
lib/jetty-servlet-9.4.20.v20190813.jar,\
|
||||
lib/jetty-util-9.4.20.v20190813.jar,\
|
||||
lib/jjwt-0.9.1.jar,\
|
||||
lib/joda-time-2.1.jar,\
|
||||
lib/jopt-simple-5.0.3.jar,\
|
||||
lib/json-schema-core-1.2.10.jar,\
|
||||
lib/json-schema-validator-2.2.10.jar,\
|
||||
lib/json-smart-2.3.jar,\
|
||||
lib/jsr305-3.0.1.jar,\
|
||||
lib/junit-4.12.jar,\
|
||||
lib/lang-tag-1.4.4.jar,\
|
||||
lib/libphonenumber-8.0.0.jar,\
|
||||
lib/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar,\
|
||||
lib/logging-interceptor-3.12.2.jar,\
|
||||
lib/mailapi-1.4.3.jar,\
|
||||
lib/msg-simple-1.1.jar,\
|
||||
lib/nimbus-jose-jwt-8.4.jar,\
|
||||
lib/nimbus-jose-jwt-8.6.jar,\
|
||||
lib/oauth2-oidc-sdk-6.5.jar,\
|
||||
lib/okhttp-3.12.6.jar,\
|
||||
lib/okhttp-urlconnection-3.12.2.jar,\
|
||||
lib/okio-1.15.0.jar,\
|
||||
lib/org.jacoco.agent-0.8.4-runtime.jar,\
|
||||
lib/retrofit-2.5.0.jar,\
|
||||
lib/rhino-1.7.7.1.jar,\
|
||||
lib/rxjava-1.3.8.jar,\
|
||||
lib/slf4j-api-1.7.21.jar,\
|
||||
lib/stax-ex-1.8.1.jar,\
|
||||
lib/txw2-2.3.2.jar,\
|
||||
lib/uri-template-0.9.jar
|
||||
@@ -0,0 +1,27 @@
|
||||
Creating new 'Run Target Type' of boot dashboard.
|
||||
---------------------------------------------------
|
||||
|
||||
These are the very roughly sketched steps taken to create the 'Azure Spring Cloud' target.
|
||||
|
||||
- Create a eclipse plugin to host your code
|
||||
- make it depend on `org.springframework.ide.eclipse.boot.dash`
|
||||
- Setup a class to define your 'injections' via the boot dash's SimpleDIContainer
|
||||
- see org.springframework.ide.eclipse.boot.dash.azure.BootDashInjections
|
||||
- wire it into BootDash via eclipse extension point org.springframework.ide.eclipse.boot.dash.injections
|
||||
- Create a class for your new RunTargetType (AzureRunTargetType).
|
||||
- make it extend AbstractRunTargetType
|
||||
- implement all abstract methods with simple stubs (e.g. many can throw 'not implemented yet' exceptsion)
|
||||
- Create a injection of this class in your 'BootDashInjections' class.
|
||||
|
||||
At this point you can run your creation in a Eclipse runtime workbench. When you access the pulldown menu
|
||||
under the '+' icon in the dash your target should show (might not do anything yet when selected if you have
|
||||
not implemented it yet.)
|
||||
|
||||
Implement a dialog UI that prompts the user for all the necessary infos to create a target
|
||||
-------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
- authenticate with the platform
|
||||
- choose a target (i.e. in cf api url, user org, space), for Azure... credentials (oauth token), subscription, resource group, service
|
||||
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="Capa_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 512 512"
|
||||
style="enable-background:new 0 0 512 512;"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="azure-inactive.svg"
|
||||
inkscape:version="0.92.3 (2405546, 2018-03-11)"
|
||||
inkscape:export-filename="/home/kdvolder/git/spring-ide/plugins/org.springframework.ide.eclipse.boot.dash.azure/icons/azure-inactive.png"
|
||||
inkscape:export-xdpi="3"
|
||||
inkscape:export-ydpi="3"><metadata
|
||||
id="metadata41"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs39" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="852"
|
||||
inkscape:window-height="706"
|
||||
id="namedview37"
|
||||
showgrid="false"
|
||||
inkscape:zoom="0.4609375"
|
||||
inkscape:cx="-200.67797"
|
||||
inkscape:cy="256"
|
||||
inkscape:window-x="899"
|
||||
inkscape:window-y="283"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="Capa_1" />
|
||||
<path
|
||||
style="fill:#b3b3b3"
|
||||
d="M150.962,379.495H0l136.118-232.954l151.777-76.943L150.962,379.495z"
|
||||
id="path2" />
|
||||
<path
|
||||
style="fill:#999999"
|
||||
d="M512,442.402H126.163v-30.034h214.419l-109.079-139.6L309.235,95.39L512,442.402z"
|
||||
id="path4" />
|
||||
<g
|
||||
id="g6">
|
||||
</g>
|
||||
<g
|
||||
id="g8">
|
||||
</g>
|
||||
<g
|
||||
id="g10">
|
||||
</g>
|
||||
<g
|
||||
id="g12">
|
||||
</g>
|
||||
<g
|
||||
id="g14">
|
||||
</g>
|
||||
<g
|
||||
id="g16">
|
||||
</g>
|
||||
<g
|
||||
id="g18">
|
||||
</g>
|
||||
<g
|
||||
id="g20">
|
||||
</g>
|
||||
<g
|
||||
id="g22">
|
||||
</g>
|
||||
<g
|
||||
id="g24">
|
||||
</g>
|
||||
<g
|
||||
id="g26">
|
||||
</g>
|
||||
<g
|
||||
id="g28">
|
||||
</g>
|
||||
<g
|
||||
id="g30">
|
||||
</g>
|
||||
<g
|
||||
id="g32">
|
||||
</g>
|
||||
<g
|
||||
id="g34">
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
|
||||
<path style="fill:#009AD2;" d="M150.962,379.495H0l136.118-232.954l151.777-76.943L150.962,379.495z"/>
|
||||
<path style="fill:#007CAA;" d="M512,442.402H126.163v-30.034h214.419l-109.079-139.6L309.235,95.39L512,442.402z"/>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 709 B |
|
After Width: | Height: | Size: 495 B |
|
After Width: | Height: | Size: 877 B |
|
After Width: | Height: | Size: 475 B |
|
After Width: | Height: | Size: 824 B |
|
After Width: | Height: | Size: 697 B |