Skip to content

Commit

Permalink
Use fixed AbstractHandlerWithState.
Browse files Browse the repository at this point in the history
  • Loading branch information
basilevs committed Mar 30, 2024
1 parent 6f38ff2 commit 6db6067
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 21 deletions.
6 changes: 3 additions & 3 deletions eclipse/feature/launches/Jstackfilter in Eclipse.launch
Expand Up @@ -5,14 +5,14 @@
<booleanAttribute key="automaticAdd" value="true"/>
<booleanAttribute key="automaticValidate" value="true"/>
<stringAttribute key="bootstrap" value=""/>
<stringAttribute key="checked" value="org.basilevs.jstackfilter.eclipse.ui"/>
<stringAttribute key="checked" value="[NONE]"/>
<booleanAttribute key="clearConfig" value="true"/>
<booleanAttribute key="clearws" value="false"/>
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/Jstackfilter in Eclipse"/>
<booleanAttribute key="default" value="true"/>
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/../runtime-New_configuration"/>
<stringAttribute key="location" value="${workspace_loc}/../runtime-Jstackfilter"/>
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
Expand All @@ -25,7 +25,7 @@
<stringAttribute key="product" value="org.eclipse.platform.ide"/>
<booleanAttribute key="show_selected_only" value="false"/>
<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/>
<booleanAttribute key="tracing" value="true"/>
<booleanAttribute key="tracing" value="false"/>
<mapAttribute key="tracingOptions">
<mapEntry key="org.basilevs.jstackfilter.eclipse.ui/targetState" value="true"/>
<mapEntry key="org.eclipse.core.contenttype/debug" value="false"/>
Expand Down
2 changes: 1 addition & 1 deletion eclipse/plugin/plugin.xml
Expand Up @@ -31,7 +31,7 @@
id="org.basilevs.jstackfilter.eclipse.ui.showIdle"
name="Show Idle Threads">
<state
class="org.eclipse.jface.commands.ToggleState"
class="org.eclipse.ui.handlers.RegistryRadioState"
id="org.eclipse.ui.commands.toggleState">
</state>
</command>
Expand Down
Expand Up @@ -3,22 +3,13 @@
import java.util.Collections;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.AbstractHandlerWithState;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.State;
import org.eclipse.ui.handlers.HandlerUtil;

public class ShowIdleThreadsHandler extends AbstractHandler {

@Override
public void setEnabled(Object evaluationContext) {
super.setEnabled(evaluationContext);
var event = new ExecutionEvent(null, Collections.emptyMap(), null, evaluationContext);
try {
PartManager.updateCommandFromPart(HandlerUtil.getActivePartChecked(event));
} catch (ExecutionException e) {
throw new IllegalStateException(e);
}
}
public class ShowIdleThreadsHandler extends AbstractHandlerWithState {

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Expand All @@ -31,5 +22,9 @@ public static ExecutionEvent adapt(Object evaluationContext) {
return new ExecutionEvent(null, Collections.emptyMap(), null, evaluationContext);
}

@Override
public void handleStateChange(State state, Object oldValue) {
}


}
8 changes: 4 additions & 4 deletions eclipse/target-definition/target-definition.target
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="default">
<target includeMode="feature" name="default">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://download.eclipse.org/releases/2022-12/202212071000"/>
<unit id="org.eclipse.pde.source.feature.group" version="3.14.1400.v20221123-1800"/>
<unit id="org.eclipse.platform.sdk" version="4.26.0.I20221123-1800"/>
<repository location="https://download.eclipse.org/releases/2024-03/"/>
<unit id="org.eclipse.pde.feature.group" version="0.0.0"/>
<unit id="org.eclipse.platform.feature.group" version="0.0.0"/>
</location>
</locations>
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
Expand Down
18 changes: 18 additions & 0 deletions test/org.basilevs.awtRunsForever/Application.launch
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/org.basilevs.awtRunsForever/src/org/basilevs/awtRunsForever/Application.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.basilevs.awtRunsForever.Application"/>
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="org.basilevs.awtRunsForever"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.basilevs.awtRunsForever"/>
</launchConfiguration>
2 changes: 1 addition & 1 deletion ui/Jstackfilter UI.launch
Expand Up @@ -2,7 +2,7 @@
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/org.basilevs.jstackfilter.ui/src/org/basilevs/jstackfilter/ui/Application.java"/>
<listEntry value="/org.basilevs.jstackfilter.ui/src/main/java/org/basilevs/jstackfilter/ui/Application.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
Expand Down

0 comments on commit 6db6067

Please sign in to comment.