-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#1668] simplify work with launch attributes
* identify launch attribute * connect it with preference metadata (to supply defaults/label/description) * read attribute from configuration * write attribute to configuration working copy * demonstrate usage for ExternalTools
- Loading branch information
1 parent
d3dd4bf
commit 35d8960
Showing
18 changed files
with
514 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2000, 2013 IBM Corporation and others. | ||
* Copyright (c) 2000, 2025 IBM Corporation and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
|
@@ -11,9 +11,14 @@ | |
* Contributors: | ||
* IBM Corporation - initial API and implementation | ||
* [email protected] - bug 165371 | ||
* Alexander Fedorov (ArSysOp) - https://github.com/eclipse-platform/eclipse.platform/issues/1668 | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.core.externaltools.internal; | ||
|
||
import org.eclipse.debug.core.LauchAttributeIdentityRecord; | ||
import org.eclipse.debug.core.LaunchAttributeIdentity; | ||
|
||
/** | ||
* Defines the constants available for client use. | ||
* <p> | ||
|
@@ -221,4 +226,13 @@ public interface IExternalToolConstants { | |
* <code>true</code>. | ||
*/ | ||
String ATTR_INCLUDE_REFERENCED_PROJECTS = UI_PLUGIN_ID + ".ATTR_INCLUDE_REFERENCED_PROJECTS"; //$NON-NLS-1$ | ||
|
||
interface LaunchAttributes { | ||
|
||
LaunchAttributeIdentity location = new LauchAttributeIdentityRecord(ATTR_LOCATION); | ||
LaunchAttributeIdentity workingDirectory = new LauchAttributeIdentityRecord(ATTR_WORKING_DIRECTORY); | ||
LaunchAttributeIdentity arguments = new LauchAttributeIdentityRecord(ATTR_TOOL_ARGUMENTS); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...rg/eclipse/core/externaltools/internal/launchConfigurations/LaunchAttributeArguments.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 ArSysOp. | ||
* | ||
* 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: | ||
* Alexander Fedorov (ArSysOp) - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.core.externaltools.internal.launchConfigurations; | ||
|
||
import org.eclipse.core.externaltools.internal.IExternalToolConstants; | ||
import org.eclipse.core.runtime.preferences.PreferenceMetadata; | ||
import org.eclipse.debug.core.LaunchAttributeDefined; | ||
import org.eclipse.debug.core.LaunchAttributeIdentity; | ||
|
||
public final class LaunchAttributeArguments implements LaunchAttributeDefined<String> { | ||
|
||
@Override | ||
public LaunchAttributeIdentity identity() { | ||
return IExternalToolConstants.LaunchAttributes.arguments; | ||
} | ||
|
||
@Override | ||
public PreferenceMetadata<String> metadata() { | ||
return new PreferenceMetadata<>(String.class, // | ||
identity().id(), | ||
null, // unspecified by default | ||
ExternalToolsProgramMessages.LaunchAttributeArguments_name); | ||
} | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
...org/eclipse/core/externaltools/internal/launchConfigurations/LaunchAttributeLocation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 ArSysOp. | ||
* | ||
* 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: | ||
* Alexander Fedorov (ArSysOp) - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.core.externaltools.internal.launchConfigurations; | ||
|
||
import org.eclipse.core.externaltools.internal.IExternalToolConstants; | ||
import org.eclipse.core.runtime.preferences.PreferenceMetadata; | ||
import org.eclipse.debug.core.LaunchAttributeDefined; | ||
import org.eclipse.debug.core.LaunchAttributeIdentity; | ||
|
||
public final class LaunchAttributeLocation implements LaunchAttributeDefined<String> { | ||
|
||
@Override | ||
public LaunchAttributeIdentity identity() { | ||
return IExternalToolConstants.LaunchAttributes.location; | ||
} | ||
|
||
@Override | ||
public PreferenceMetadata<String> metadata() { | ||
return new PreferenceMetadata<>(String.class, // | ||
identity().id(), | ||
null, // unspecified by default | ||
ExternalToolsProgramMessages.LaunchAttributeLocation_name); | ||
} | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
...pse/core/externaltools/internal/launchConfigurations/LaunchAttributeWorkingDirectory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 ArSysOp. | ||
* | ||
* 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: | ||
* Alexander Fedorov (ArSysOp) - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.core.externaltools.internal.launchConfigurations; | ||
|
||
import org.eclipse.core.externaltools.internal.IExternalToolConstants; | ||
import org.eclipse.core.runtime.preferences.PreferenceMetadata; | ||
import org.eclipse.debug.core.LaunchAttributeDefined; | ||
import org.eclipse.debug.core.LaunchAttributeIdentity; | ||
|
||
public final class LaunchAttributeWorkingDirectory implements LaunchAttributeDefined<String> { | ||
|
||
@Override | ||
public LaunchAttributeIdentity identity() { | ||
return IExternalToolConstants.LaunchAttributes.workingDirectory; | ||
} | ||
|
||
@Override | ||
public PreferenceMetadata<String> metadata() { | ||
return new PreferenceMetadata<>(String.class, // | ||
identity().id(), | ||
null, // unspecified by default | ||
ExternalToolsProgramMessages.LaunchAttributeWorkingDirectory_name); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
debug/org.eclipse.debug.core/core/org/eclipse/debug/core/LauchAttributeIdentityRecord.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024, 2025 ArSysOp. | ||
* | ||
* 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: | ||
* Alexander Fedorov (ArSysOp) - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.debug.core; | ||
|
||
/** | ||
* Default implementation for {@link LaunchAttributeIdentity} | ||
* | ||
* @since 3.23 | ||
*/ | ||
public record LauchAttributeIdentityRecord(String id) implements LaunchAttributeIdentity { | ||
|
||
/** | ||
* Convenience way to compose full qualified name for launch attribute | ||
* | ||
* @param qualifier usually corresponds to Bundle-Symbolic-Name | ||
* @param key short key to name this very attribute in the scope of | ||
* qualifier | ||
*/ | ||
public LauchAttributeIdentityRecord(String qualifier, String key) { | ||
this(qualifier + "." + key); //$NON-NLS-1$ | ||
} | ||
|
||
} |
Oops, something went wrong.