Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2021 IBM Corporation and others.
* Copyright (c) 2000, 2021, 2026 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -312,13 +312,18 @@ public interface ICoreConstants {
String OSGI_INF_FOLDER_NAME = "OSGI-INF/"; //$NON-NLS-1$
String FEATURE_FOLDER_NAME = "features"; //$NON-NLS-1$

String P2_INF_FILENAME = "p2.inf"; //$NON-NLS-1$
String P2_INF_BUNDLE_DESCRIPTOR = "META-INF/p2.inf"; //$NON-NLS-1$

// Common paths
IPath MANIFEST_PATH = IPath.fromOSString(BUNDLE_FILENAME_DESCRIPTOR);
IPath PLUGIN_PATH = IPath.fromOSString(PLUGIN_FILENAME_DESCRIPTOR);
IPath FRAGMENT_PATH = IPath.fromOSString(FRAGMENT_FILENAME_DESCRIPTOR);
IPath FEATURE_PATH = IPath.fromOSString(FEATURE_FILENAME_DESCRIPTOR);
IPath BUILD_PROPERTIES_PATH = IPath.fromOSString(BUILD_FILENAME_DESCRIPTOR);
IPath OSGI_INF_PATH = IPath.fromOSString(OSGI_INF_FOLDER_NAME);
IPath P2_INF_BUNDLE_PATH = IPath.fromOSString(P2_INF_BUNDLE_DESCRIPTOR);
IPath P2_INF_FEATURE_PATH = IPath.fromOSString(P2_INF_FILENAME);

// Extension point identifiers
String EXTENSION_POINT_SOURCE = PDECore.PLUGIN_ID + ".source"; //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010, 2024 IBM Corporation and others.
* Copyright (c) 2010, 2024, 2026 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -260,6 +260,30 @@ public static IFolder getMetaInf(IProject project) {
return getBundleRelativeFolder(project, IPath.fromOSString(ICoreConstants.MANIFEST_FOLDER_NAME));
}

/**
* Returns the resource in the specified project corresponding to its
* <code>META-INF/p2.inf</code> file (for bundle/plugin projects).
*
* @param project project
* @return <code>META-INF/p2.inf</code> file that may or may not exist
*/
public static IFile getBundleP2Inf(IProject project) {
return getBundleRelativeFile(project, ICoreConstants.P2_INF_BUNDLE_PATH);
}

/**
* Returns the resource in the specified project corresponding to its
* <code>p2.inf</code> file (for feature projects). Feature projects have
* the p2.inf file in the project root, not in META-INF.
*
* @param project
* project
* @return <code>p2.inf</code> file that may or may not exist
*/
public static IFile getFeatureP2Inf(IProject project) {
return getBundleRelativeFile(project, ICoreConstants.P2_INF_FEATURE_PATH);
}

/**
* Returns a file relative to the bundle root of the specified project.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2021 IBM Corporation and others.
* Copyright (c) 2000, 2021, 2026 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -52,6 +52,8 @@
import org.eclipse.pde.internal.ui.editor.build.BuildSourcePage;
import org.eclipse.pde.internal.ui.editor.context.InputContext;
import org.eclipse.pde.internal.ui.editor.context.InputContextManager;
import org.eclipse.pde.internal.ui.editor.p2inf.P2InfInputContext;
import org.eclipse.pde.internal.ui.editor.p2inf.P2InfSourcePage;
import org.eclipse.swt.SWTError;
import org.eclipse.swt.dnd.RTFTransfer;
import org.eclipse.swt.dnd.TextTransfer;
Expand Down Expand Up @@ -172,8 +174,14 @@ protected void createResourceContexts(InputContextManager manager, IFileEditorIn
FileEditorInput in = new FileEditorInput(buildFile);
manager.putContext(in, new BuildInputContext(this, in, file == buildFile));
}
IFile p2InfFile = PDEProject.getFeatureP2Inf(project);
if (p2InfFile != null && p2InfFile.exists()) {
FileEditorInput in = new FileEditorInput(p2InfFile);
manager.putContext(in, new P2InfInputContext(this, in, false));
}
manager.monitorFile(featureFile);
manager.monitorFile(buildFile);
manager.monitorFile(p2InfFile);
}

@Override
Expand All @@ -200,6 +208,11 @@ public void monitoredFileAdded(IFile file) {
IEditorInput in = new FileEditorInput(file);
fInputContextManager.putContext(in, new BuildInputContext(this, in, false));
}
} else if (name.equalsIgnoreCase(ICoreConstants.P2_INF_FILENAME)) {
if (!fInputContextManager.hasContext(P2InfInputContext.CONTEXT_ID)) {
IEditorInput in = new FileEditorInput(file);
fInputContextManager.putContext(in, new P2InfInputContext(this, in, false));
}
}
}

Expand Down Expand Up @@ -254,6 +267,12 @@ protected void createSystemFileContexts(InputContextManager manager, FileStoreEd
IEditorInput in = new FileStoreEditorInput(store);
manager.putContext(in, new BuildInputContext(this, in, file == buildFile));
}
File p2InfFile = new File(file.getParentFile(), ICoreConstants.P2_INF_FILENAME);
if (p2InfFile.exists()) {
IFileStore store = EFS.getStore(p2InfFile.toURI());
IEditorInput in = new FileStoreEditorInput(store);
manager.putContext(in, new P2InfInputContext(this, in, false));
}
} catch (CoreException e) {
PDEPlugin.logException(e);
}
Expand Down Expand Up @@ -298,6 +317,7 @@ protected void addEditorPages() {
}
addSourcePage(FeatureInputContext.CONTEXT_ID);
addSourcePage(BuildInputContext.CONTEXT_ID);
addSourcePage(P2InfInputContext.CONTEXT_ID);
}

@Override
Expand All @@ -323,6 +343,9 @@ protected IEditorPart createSourcePage(PDEFormEditor editor, String title, Strin
if (contextId.equals(BuildInputContext.CONTEXT_ID)) {
return new BuildSourcePage(editor, title, name);
}
if (contextId.equals(P2InfInputContext.CONTEXT_ID)) {
return new P2InfSourcePage(editor, contextId, title);
}
return super.createSourcePage(editor, title, name, contextId);
}

Expand Down Expand Up @@ -426,9 +449,18 @@ protected boolean isPatchEditor() {
public void showEditorInput(IEditorInput editorInput) {
String name = editorInput.getName();
if (name.equals(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR)) {
setActivePage(0);
} else {
setActivePage(getPageCount() - 3);
setActivePage(FeatureFormPage.PAGE_ID);
} else if (name.equalsIgnoreCase(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)) {
IFormPage uiPage = findPage(BuildPage.PAGE_ID);
if (uiPage != null) {
setActivePage(uiPage.getId());
}

} else if (name.equalsIgnoreCase(ICoreConstants.P2_INF_FILENAME)) {
IFormPage page = findPage(P2InfInputContext.CONTEXT_ID);
if (page != null) {
setActivePage(page.getId());
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2015 IBM Corporation and others.
* Copyright (c) 2005, 2015, 2026 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -45,11 +45,18 @@ public boolean matches(IEditorReference editorRef, IEditorInput input) {
// build.properties matches with editors that have a feature.xml file
// as their input and that feature.xml is at the root
if (inputFile.getName().equals(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR)) {
if (currInputFile.getName().equals(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)) {
if (currInputFile.getName().equals(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)
|| currInputFile.getName().equals(ICoreConstants.P2_INF_FILENAME)) {
return inputFile.getProjectRelativePath().toString().equals(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR);
}
return inputFile.equals(currInputFile);
} else if (inputFile.getName().equals(ICoreConstants.BUILD_FILENAME_DESCRIPTOR)) {
if (currInputFile.getName().equals(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR))
return currInputFile.getProjectRelativePath().toString().equals(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR);
return inputFile.equals(currInputFile);
} else if (inputFile.getName().equals(ICoreConstants.P2_INF_FILENAME)) {
// p2.inf should match the feature editor when the current editor
// input is the feature.xml at the project root
if (currInputFile.getName().equals(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR)) {
return currInputFile.getProjectRelativePath().toString().equals(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR);
}
Expand All @@ -60,5 +67,4 @@ public boolean matches(IEditorReference editorRef, IEditorInput input) {
return false;
}
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*******************************************************************************
* Copyright (c) 2026 IBM Corporation and others.
*
* 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
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.pde.internal.ui.editor.p2inf;

import org.eclipse.osgi.util.NLS;

public class Messages extends NLS {
private static final String BUNDLE_NAME = Messages.class.getPackageName() + ".messages"; //$NON-NLS-1$
public static String P2InfHeader_provides;
public static String P2InfHeader_requires;
public static String P2InfHeader_metaRequirements;
public static String P2InfHeader_properties;
public static String P2InfHeader_update;
public static String P2InfHeader_instructions;
public static String P2InfHeader_units;

public static String P2InfHeader_filter;
public static String P2InfHeader_greedy;
public static String P2InfHeader_matchExp;
public static String P2InfHeader_multiple;
public static String P2InfHeader_name;
public static String P2InfHeader_namespace;
public static String P2InfHeader_optional;
public static String P2InfHeader_range;
public static String P2InfHeader_version;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}

private Messages() {
}
}
Loading
Loading