Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » showPerspective send a "invalid access thread"
showPerspective send a "invalid access thread" [message #329391] Sun, 22 June 2008 14:40 Go to next message
Eclipse UserFriend
hi,

in my code (in a LaunchConfigurationDelegate subclasses) I try to change
the perspective to get the debugperspective so I use this.

PlatformUI.getWorkbench().showPerspective(
IDebugUIConstants.ID_DEBUG_PERSPECTIVE,
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
);

but I have an invalid access thread And I have no idea why.

there the full code


try {
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
PlatformUI.getWorkbench().showPerspective(
IDebugUIConstants.ID_DEBUG_PERSPECTIVE,
PlatformUI.getWorkbench().getActiveWorkbenchWindow());
command = "cmd.exe /C \"set YINPUT=1
&& set YDEBUG=1 && "
+ command + "\"";
}

System.out.println(command);
Process process = Runtime.getRuntime().exec(command);
IProcess p = DebugPlugin.newProcess(launch, process, path
.removeLastSegments(1).toOSString());
launch.addProcess(p);
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
IDebugTarget target = new YaflDebugTarget(launch, p);
launch.addDebugTarget(target);
}
} catch (IOException e) {
e.printStackTrace();
}
Re: showPerspective send a "invalid access thread" [message #329399 is a reply to message #329391] Mon, 23 June 2008 04:21 Go to previous messageGo to next message
Eclipse UserFriend
Hi Julien,

The call that you are making is a UI call. And it should be invoked on the
UI thread I think. You could try doing
PlatformUI.getWorkbench().getDisplay().asyncExec/syncExec(Ru nnable) and
putting your code inside this runnable and then try invoking again.

Rahul


"julien" <elekis@gmail.com> wrote in message
news:g3m6b9$t3i$1@build.eclipse.org...
> hi,
>
> in my code (in a LaunchConfigurationDelegate subclasses) I try to change
> the perspective to get the debugperspective so I use this.
>
> PlatformUI.getWorkbench().showPerspective(
> IDebugUIConstants.ID_DEBUG_PERSPECTIVE,
> PlatformUI.getWorkbench().getActiveWorkbenchWindow()
> );
>
> but I have an invalid access thread And I have no idea why.
>
> there the full code
>
>
> try {
> if (mode.equals(ILaunchManager.DEBUG_MODE)) {
> PlatformUI.getWorkbench().showPerspective(
> IDebugUIConstants.ID_DEBUG_PERSPECTIVE,
> PlatformUI.getWorkbench().getActiveWorkbenchWindow());
> command = "cmd.exe /C \"set YINPUT=1
> && set YDEBUG=1 && "
> + command + "\"";
> }
>
> System.out.println(command);
> Process process = Runtime.getRuntime().exec(command);
> IProcess p = DebugPlugin.newProcess(launch, process, path
> .removeLastSegments(1).toOSString());
> launch.addProcess(p);
> if (mode.equals(ILaunchManager.DEBUG_MODE)) {
> IDebugTarget target = new YaflDebugTarget(launch, p);
> launch.addDebugTarget(target);
> }
> } catch (IOException e) {
> e.printStackTrace();
> }
Re: showPerspective send a "invalid access thread" [message #329409 is a reply to message #329399] Mon, 23 June 2008 09:19 Go to previous messageGo to next message
Eclipse UserFriend
Rahul Kamdar a écrit :
> Hi Julien,
>
> The call that you are making is a UI call. And it should be invoked on the
> UI thread I think. You could try doing
> PlatformUI.getWorkbench().getDisplay().asyncExec/syncExec(Ru nnable) and
> putting your code inside this runnable and then try invoking again.
>
> Rahul

yeah, thats work thanks a lot


A+++
>
>
> "julien" <elekis@gmail.com> wrote in message
> news:g3m6b9$t3i$1@build.eclipse.org...
>> hi,
>>
>> in my code (in a LaunchConfigurationDelegate subclasses) I try to change
>> the perspective to get the debugperspective so I use this.
>>
>> PlatformUI.getWorkbench().showPerspective(
>> IDebugUIConstants.ID_DEBUG_PERSPECTIVE,
>> PlatformUI.getWorkbench().getActiveWorkbenchWindow()
>> );
>>
>> but I have an invalid access thread And I have no idea why.
>>
>> there the full code
>>
>>
>> try {
>> if (mode.equals(ILaunchManager.DEBUG_MODE)) {
>> PlatformUI.getWorkbench().showPerspective(
>> IDebugUIConstants.ID_DEBUG_PERSPECTIVE,
>> PlatformUI.getWorkbench().getActiveWorkbenchWindow());
>> command = "cmd.exe /C \"set YINPUT=1
>> && set YDEBUG=1 && "
>> + command + "\"";
>> }
>>
>> System.out.println(command);
>> Process process = Runtime.getRuntime().exec(command);
>> IProcess p = DebugPlugin.newProcess(launch, process, path
>> .removeLastSegments(1).toOSString());
>> launch.addProcess(p);
>> if (mode.equals(ILaunchManager.DEBUG_MODE)) {
>> IDebugTarget target = new YaflDebugTarget(launch, p);
>> launch.addDebugTarget(target);
>> }
>> } catch (IOException e) {
>> e.printStackTrace();
>> }
>
>
Re: showPerspective send a "invalid access thread" [message #329431 is a reply to message #329409] Tue, 24 June 2008 04:13 Go to previous message
Eclipse UserFriend
julien,

Ideally you shouldn't be doing this at all. Switching to the debug
perspective is done by the workbench automatically. The behaviour is
controlled by the preference: Run/Debug->Perspective->Open the
associated perspective when lauching.

- Prakash

www.eclipse-tips.com



julien wrote:
> Rahul Kamdar a écrit :
>> Hi Julien,
>>
>> The call that you are making is a UI call. And it should be invoked on
>> the UI thread I think. You could try doing
>> PlatformUI.getWorkbench().getDisplay().asyncExec/syncExec(Ru nnable)
>> and putting your code inside this runnable and then try invoking again.
>>
>> Rahul
>
> yeah, thats work thanks a lot
>
>
> A+++
>>
>>
>> "julien" <elekis@gmail.com> wrote in message
>> news:g3m6b9$t3i$1@build.eclipse.org...
>>> hi,
>>>
>>> in my code (in a LaunchConfigurationDelegate subclasses) I try to
>>> change the perspective to get the debugperspective so I use this.
>>>
>>> PlatformUI.getWorkbench().showPerspective(
>>> IDebugUIConstants.ID_DEBUG_PERSPECTIVE,
>>> PlatformUI.getWorkbench().getActiveWorkbenchWindow()
>>> );
>>>
>>> but I have an invalid access thread And I have no idea why.
>>>
>>> there the full code
>>>
>>>
>>> try {
>>> if (mode.equals(ILaunchManager.DEBUG_MODE)) {
>>> PlatformUI.getWorkbench().showPerspective(
>>> IDebugUIConstants.ID_DEBUG_PERSPECTIVE,
>>> PlatformUI.getWorkbench().getActiveWorkbenchWindow());
>>> command = "cmd.exe /C \"set YINPUT=1
>>> && set YDEBUG=1 && "
>>> + command + "\"";
>>> }
>>>
>>> System.out.println(command);
>>> Process process = Runtime.getRuntime().exec(command);
>>> IProcess p = DebugPlugin.newProcess(launch, process, path
>>> .removeLastSegments(1).toOSString());
>>> launch.addProcess(p);
>>> if (mode.equals(ILaunchManager.DEBUG_MODE)) {
>>> IDebugTarget target = new YaflDebugTarget(launch, p);
>>> launch.addDebugTarget(target);
>>> }
>>> } catch (IOException e) {
>>> e.printStackTrace();
>>> }
>>
>>
Previous Topic:DnD for multiple TransferTypes
Next Topic:Setting content types on a per-project basis
Goto Forum:
  


Current Time: Wed Apr 30 12:19:05 EDT 2025

Powered by FUDForum. Page generated in 0.32953 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top