Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 564868 - Support Maven Artifacts in PDE-Target Platform #21

Merged
merged 8 commits into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions m2e-dev.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="m2e development target">
<locations>
<location path="${eclipse_home}" type="Profile"/>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="slicer" includeSource="true" type="InstallableUnit">
<repository location="https://bndtools.jfrog.io/bndtools/update-latest"/>
<unit id="bndtools.main.feature.feature.group" version="0.0.0"/>
</location>
</locations>
</target>
1 change: 1 addition & 0 deletions org.eclipse.m2e.pde.feature/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin.includes = feature.xml
49 changes: 49 additions & 0 deletions org.eclipse.m2e.pde.feature/feature.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.eclipse.m2e.pde.feature"
label="m2e PDE Integration"
version="1.17.0.qualifier">

<description url="http://www.example.com/description">
[Enter Feature Description here.]
</description>

<copyright url="http://www.example.com/copyright">
[Enter Copyright Description here.]
</copyright>

<license url="http://www.example.com/license">
[Enter License Description here.]
</license>

<requires>
<import plugin="org.eclipse.core.runtime" version="3.19.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.pde.ui" version="3.12.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.equinox.frameworkadmin" version="2.1.400" match="greaterOrEqual"/>
<import plugin="org.eclipse.m2e.maven.runtime"/>
<import plugin="org.eclipse.m2e.core"/>
<import plugin="org.eclipse.jface"/>
</requires>

<plugin
id="biz.aQute.bndlib"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

<plugin
id="org.eclipse.m2e.pde"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

<plugin
id="org.eclipse.m2e.pde.ui"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

</feature>
23 changes: 23 additions & 0 deletions org.eclipse.m2e.pde.feature/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2020 Red Hat, Inc.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/

SPDX-License-Identifier: EPL-2.0
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.eclipse.m2e</groupId>
<artifactId>m2e-core</artifactId>
<version>1.16.0-SNAPSHOT</version>
</parent>

<artifactId>org.eclipse.m2e.pde.feature</artifactId>
<packaging>eclipse-feature</packaging>
<version>1.17.0-SNAPSHOT</version>
</project>
18 changes: 18 additions & 0 deletions org.eclipse.m2e.pde.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: PDE Integration UI
Bundle-SymbolicName: org.eclipse.m2e.pde.ui;singleton:=true
Bundle-Version: 1.17.0.qualifier
Automatic-Module-Name: org.eclipse.m2e.pde.ui
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.19.0",
org.eclipse.jface,
org.eclipse.pde.ui;bundle-version="3.12.0",
org.eclipse.equinox.frameworkadmin;bundle-version="2.1.400",
biz.aQute.bndlib;bundle-version="5.1.2",
org.eclipse.m2e.maven.runtime,
org.eclipse.m2e.core,
org.eclipse.m2e.pde,
org.eclipse.pde;bundle-version="3.13.1200"
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.eclipse.m2e.pde.ui.Activator
6 changes: 6 additions & 0 deletions org.eclipse.m2e.pde.ui/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
icons/
Binary file added org.eclipse.m2e.pde.ui/icons/error_st_obj.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added org.eclipse.m2e.pde.ui/icons/jar_obj.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added org.eclipse.m2e.pde.ui/icons/m2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions org.eclipse.m2e.pde.ui/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>

<extension
point="org.eclipse.pde.ui.targetLocationProvisioners">
<locationProvider
class="org.eclipse.m2e.pde.ui.editor.MavenTargetLocationWizard"
icon="icons/m2.gif"
id="org.eclipse.m2e.pde.ui.editor.MavenTargetLocationWizard"
name="Maven">
<description>
Add a maven artifact (and dependencies) to your target platform
</description>
</locationProvider>

</extension>
<extension
point="org.eclipse.core.runtime.adapters">
<factory
adaptableType="org.eclipse.m2e.pde.MavenTargetLocation"
class="org.eclipse.m2e.pde.ui.adapter.MavenTargetAdapterFactory">
<adapter
type="org.eclipse.jface.viewers.ILabelProvider">
</adapter>
<adapter
type="org.eclipse.jface.viewers.ITreeContentProvider">
</adapter>
<adapter
type="org.eclipse.pde.ui.target.ITargetLocationEditor">
</adapter>
<adapter
type="org.eclipse.pde.ui.target.ITargetLocationUpdater">
</adapter>
</factory>
</extension>
<extension
point="org.eclipse.core.runtime.adapters">
<factory
adaptableType="org.eclipse.m2e.pde.MavenTargetBundle"
class="org.eclipse.m2e.pde.ui.adapter.MavenTargetBundleAdapterFactory">
<adapter
type="org.eclipse.jface.viewers.ILabelProvider">
</adapter>
</factory>
</extension>
<extension
point="org.eclipse.core.runtime.adapters">
<factory
adaptableType="org.eclipse.aether.graph.DependencyNode"
class="org.eclipse.m2e.pde.ui.adapter.DependencyNodeAdapterFactory">
<adapter
type="org.eclipse.jface.viewers.ITreeContentProvider">
</adapter>
<adapter
type="org.eclipse.jface.viewers.ILabelProvider">
</adapter>
</factory>
</extension>
</plugin>
17 changes: 17 additions & 0 deletions org.eclipse.m2e.pde.ui/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.eclipse.m2e</groupId>
<artifactId>m2e-core</artifactId>
<version>1.16.0-SNAPSHOT</version>
</parent>

<artifactId>org.eclipse.m2e.pde.ui</artifactId>
<version>1.17.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<name>Maven PDE UI Integration</name>
</project>
37 changes: 37 additions & 0 deletions org.eclipse.m2e.pde.ui/src/org/eclipse/m2e/pde/ui/Activator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*******************************************************************************
* Copyright (c) 2020 Christoph Läubrich
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Christoph Läubrich - initial API and implementation
*******************************************************************************/
package org.eclipse.m2e.pde.ui;

import org.eclipse.m2e.pde.ui.adapter.DependencyNodeAdapterFactory;
import org.eclipse.m2e.pde.ui.adapter.MavenTargetAdapterFactory;
import org.eclipse.m2e.pde.ui.adapter.MavenTargetBundleAdapterFactory;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class Activator implements BundleActivator {

@Override
public void start(BundleContext context) throws Exception {

}

@Override
public void stop(BundleContext context) throws Exception {
DependencyNodeAdapterFactory.LABEL_PROVIDER.dispose();
DependencyNodeAdapterFactory.TREE_CONTENT_PROVIDER.dispose();
MavenTargetAdapterFactory.LABEL_PROVIDER.dispose();
MavenTargetAdapterFactory.TREE_CONTENT_PROVIDER.dispose();
MavenTargetBundleAdapterFactory.LABEL_PROVIDER.dispose();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*******************************************************************************
* Copyright (c) 2018, 2020 Christoph Läubrich
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Christoph Läubrich - initial API and implementation
*******************************************************************************/
package org.eclipse.m2e.pde.ui;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.m2e.pde.MavenTargetLocation;
import org.eclipse.pde.core.target.ITargetDefinition;
import org.eclipse.pde.core.target.ITargetLocation;
import org.eclipse.pde.ui.target.ITargetLocationUpdater;

public class MavenTargetLocationUpdater implements ITargetLocationUpdater {

@Override
public boolean canUpdate(ITargetDefinition target, ITargetLocation targetLocation) {
return targetLocation instanceof MavenTargetLocation;
}

@Override
public IStatus update(ITargetDefinition target, ITargetLocation targetLocation, IProgressMonitor monitor) {
MavenTargetLocation location = (MavenTargetLocation) targetLocation;
location.refresh();
return Status.OK_STATUS;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*******************************************************************************
* Copyright (c) 2018, 2020 Christoph Läubrich
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Christoph Läubrich - initial API and implementation
*******************************************************************************/
package org.eclipse.m2e.pde.ui.adapter;

import org.eclipse.aether.graph.DependencyNode;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.m2e.pde.ui.provider.DependencyNodeLabelProvider;
import org.eclipse.m2e.pde.ui.provider.MavenTargetTreeContentProvider;

public class DependencyNodeAdapterFactory implements IAdapterFactory {

public static final ITreeContentProvider TREE_CONTENT_PROVIDER = new MavenTargetTreeContentProvider();
public static final ILabelProvider LABEL_PROVIDER = new DependencyNodeLabelProvider();

@Override
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (adaptableObject instanceof DependencyNode) {
if (adapterType == ITreeContentProvider.class) {
return adapterType.cast(TREE_CONTENT_PROVIDER);
} else if (adapterType == ILabelProvider.class) {
return adapterType.cast(LABEL_PROVIDER);
}
}
return null;
}

@Override
public Class<?>[] getAdapterList() {
return new Class<?>[] { ITreeContentProvider.class, ILabelProvider.class };
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*******************************************************************************
* Copyright (c) 2018, 2020 Christoph Läubrich
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Christoph Läubrich - initial API and implementation
*******************************************************************************/
package org.eclipse.m2e.pde.ui.adapter;

import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.m2e.pde.MavenTargetLocation;
import org.eclipse.m2e.pde.ui.MavenTargetLocationUpdater;
import org.eclipse.m2e.pde.ui.editor.MavenTargetLocationEditor;
import org.eclipse.m2e.pde.ui.provider.MavenTargetLocationLabelProvider;
import org.eclipse.m2e.pde.ui.provider.MavenTargetTreeContentProvider;
import org.eclipse.pde.ui.target.ITargetLocationEditor;
import org.eclipse.pde.ui.target.ITargetLocationUpdater;

public class MavenTargetAdapterFactory implements IAdapterFactory {

public static final ILabelProvider LABEL_PROVIDER = new MavenTargetLocationLabelProvider();
public static final ITreeContentProvider TREE_CONTENT_PROVIDER = new MavenTargetTreeContentProvider();
private static final MavenTargetLocationEditor LOCATION_EDITOR = new MavenTargetLocationEditor();
private static final MavenTargetLocationUpdater LOCATION_UPDATER = new MavenTargetLocationUpdater();

@Override
public Class<?>[] getAdapterList() {
return new Class[] { ILabelProvider.class, ITreeContentProvider.class, ITargetLocationEditor.class,
ITargetLocationUpdater.class };
}

@Override
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (adaptableObject instanceof MavenTargetLocation) {
if (adapterType == ILabelProvider.class) {
return adapterType.cast(LABEL_PROVIDER);
} else if (adapterType == ITreeContentProvider.class) {
return adapterType.cast(TREE_CONTENT_PROVIDER);
} else if (adapterType == ITargetLocationEditor.class) {
return adapterType.cast(LOCATION_EDITOR);
} else if (adapterType == ITargetLocationUpdater.class) {
return adapterType.cast(LOCATION_UPDATER);
}
}
return null;
}

}
Loading