Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Opening an editor
Opening an editor [message #326284] Thu, 13 March 2008 17:08 Go to next message
Peter is currently offline PeterFriend
Messages: 14
Registered: July 2009
Junior Member
I have a custom perspective, which has it's own editor// it's not a TextEditorPart //. The problem I am experiencing is when i open my perspective, my editor is not opened. My question is how can i make it open my editor every time my perspective is opened? If anyone can help or has an idea :)
Thanks,
Peter
Re: Opening an editor [message #326292 is a reply to message #326284] Thu, 13 March 2008 20:51 Go to previous messageGo to next message
Phill Perryman is currently offline Phill PerrymanFriend
Messages: 214
Registered: July 2009
Senior Member
This is a multipart message in MIME format.
--=_alternative 007288E08025740B_=
Content-Type: text/plain; charset="US-ASCII"

window.addPerspectiveListener(new IPerspectiveListener() {
public void perspectiveActivated(final IWorkbenchPage page,
final IPerspectiveDescriptor perspective) {
}
public void perspectiveChanged(final IWorkbenchPage page,
final IPerspectiveDescriptor perspective, final String
changeId) {
}
});
--=_alternative 007288E08025740B_=
Content-Type: text/html; charset="US-ASCII"


<br><font size=2 color=#0021bf face="Courier New">window</font><font size=2 face="Courier New">.addPerspectiveListener(</font><font size=2 color=#820040 face="Courier New"><b>new</b></font><font size=2 face="Courier New">
IPerspectiveListener() {</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>public</b></font><font size=2 face="Courier New">
</font><font size=2 color=#820040 face="Courier New"><b>void</b></font><font size=2 face="Courier New">
perspectiveActivated(</font><font size=2 color=#820040 face="Courier New"><b>final</b></font><font size=2 face="Courier New">
IWorkbenchPage page,</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>final</b></font><font size=2 face="Courier New">
IPerspectiveDescriptor perspective) {</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; }</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>public</b></font><font size=2 face="Courier New">
</font><font size=2 color=#820040 face="Courier New"><b>void</b></font><font size=2 face="Courier New">
perspectiveChanged(</font><font size=2 color=#820040 face="Courier New"><b>final</b></font><font size=2 face="Courier New">
IWorkbenchPage page,</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; </font><font size=2 color=#820040 face="Courier New"><b>final</b></font><font size=2 face="Courier New">
IPerspectiveDescriptor perspective, </font><font size=2 color=#820040 face="Courier New"><b>final</b></font><font size=2 face="Courier New">
String changeId) {</font>
<br><font size=2 face="Courier New">&nbsp; &nbsp; &nbsp; &nbsp; }</font>
<br><font size=2 face="Courier New">});</font>
--=_alternative 007288E08025740B_=--
Re: Opening an editor [message #326305 is a reply to message #326292] Fri, 14 March 2008 11:40 Go to previous messageGo to next message
Peter is currently offline PeterFriend
Messages: 14
Registered: July 2009
Junior Member
Where should I put this listener I mean should it be in the Activator class or another place, where?
Thanks,
Peter
Re: Opening an editor [message #326313 is a reply to message #326305] Fri, 14 March 2008 13:05 Go to previous messageGo to next message
Peter is currently offline PeterFriend
Messages: 14
Registered: July 2009
Junior Member
I worked. I have a new problem now. The IEditorInput , i need an instance of it. I am suppling a treeViewer with information from an external engine that my app connects to. The information for the tree is provided by the ContentProvider i wrote for it. Why does the editor need an editor provider. I can't set the editorInput as null as the framework throws IllegalArgumentException. How can i go around that problem?
Re: Opening an editor [message #326316 is a reply to message #326313] Fri, 14 March 2008 14:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Peter,

You can directly implement an instance of IEditorInput that your
specialized editor will know how to consume. Could just be a dummy one
if you don't need it, but that starts to beg the question of why it's an
editor and not a view...


peterM wrote:
> I worked. I have a new problem now. The IEditorInput , i need an instance of it. I am suppling a treeViewer with information from an external engine that my app connects to. The information for the tree is provided by the ContentProvider i wrote for it. Why does the editor need an editor provider. I can't set the editorInput as null as the framework throws IllegalArgumentException. How can i go around that problem?
>
Re: Opening an editor [message #326357 is a reply to message #326316] Mon, 17 March 2008 16:21 Go to previous message
Peter is currently offline PeterFriend
Messages: 14
Registered: July 2009
Junior Member
It has to be an editor because I am parsing a specialized type of file (text most likely, but not only that so i cannot just extend the TextEditor class). I can create a dummy input just to test the editor itself. However i have a new problem now. I've put the :
PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPage Listener(new IPageListener(){some code here}
Inside the Activator class ->start method. While in debug it tells me that first time i open the perspective the listener is added, and the pageActivated method is called, but the problem every subsequent attempt to open the perspective, respectively the editor doesn't result in the listen being invoked. Could it be because i have not registered the listener. (I don;t know how). Is it a good place to add the listener. Which is more appropriate?
Previous Topic:Deleting directory fails in the 3.4M5 test suite on Windows Vista ia32.
Next Topic:Project Explorer not sorted on a refresh
Goto Forum:
  


Current Time: Sat Nov 09 05:08:38 GMT 2024

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

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

Back to the top