Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » showPerspective send a "invalid access thread"
showPerspective send a "invalid access thread" [message #329391] Sun, 22 June 2008 18:40 Go to next message
No real name is currently offline No real nameFriend
Messages: 64
Registered: July 2009
Member
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 08:21 Go to previous messageGo to next message
Rahul Kamdar is currently offline Rahul KamdarFriend
Messages: 63
Registered: July 2009
Member
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 13:19 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 64
Registered: July 2009
Member
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 08:13 Go to previous message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
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: Sat Nov 09 04:25:21 GMT 2024

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

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

Back to the top