Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » EditorInput Constructor Being called twice
EditorInput Constructor Being called twice [message #292603] Fri, 07 October 2005 16:40 Go to next message
Eclipse UserFriend
Hello,

I create an instance of an EditorInput

IEditor input = new EditorInput();

and then call

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().openEditor(input,
editorID);

to open the editor.

the openEditor calls the constructor again. Does this mean their are
two instances of the editorInput?
Re: EditorInput Constructor Being called twice [message #292650 is a reply to message #292603] Mon, 10 October 2005 06:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: daniel.megert.eclipse.org

James Leotta wrote:

> Hello,
>
> I create an instance of an EditorInput
>
> IEditor input = new EditorInput();

This is code not possible since there's now such thing as EditorInput
class in Eclipse SDK. Is this your own implementation of IEditorInput or
did you mean FileEditorInput?

Dani

>
> and then call
>
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().openEditor(input,
> editorID);
>
> to open the editor.
>
> the openEditor calls the constructor again. Does this mean their are
> two instances of the editorInput?
Re: EditorInput Constructor Being called twice [message #292662 is a reply to message #292650] Mon, 10 October 2005 11:45 Go to previous messageGo to next message
Eclipse UserFriend
Its my own class here is the method I am calling

public void getEditor(Object obj){
String editorID = null;
IEditorPart editor = null;
IEditorInput input = null;
if (obj instanceof Agency){
input = new AgencyEditorInput((Agency) obj);
editorID = AgencyEditor.ID;
}
if (obj instanceof AMITables){
//input = new AgencyEditorInput((Agency) obj);
//editorID = AgencyEditor.ID;
}
if (obj instanceof Grant){
input = new GrantEditorInput((Grant) obj);
editorID = GrantEditor.ID;
}
if (obj instanceof Employee){
input = new StaffEditorInput((Employee) obj);
editorID = StaffEditor.ID;
}
if (obj instanceof County){

}
if (obj instanceof User){
input = new UserEditorInput((User) obj);
editorID = UserEditor.ID;
}
editor =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().findEditor(input);
if (editor != null){

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().activate(editor);
return;
}
try{

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().openEditor(input,
editorID);
}catch(Exception e){
System.out.println(e);
}
}

Daniel Megert wrote:
> James Leotta wrote:
>
>> Hello,
>>
>> I create an instance of an EditorInput
>>
>> IEditor input = new EditorInput();
>
>
> This is code not possible since there's now such thing as EditorInput
> class in Eclipse SDK. Is this your own implementation of IEditorInput or
> did you mean FileEditorInput?
>
> Dani
>
>>
>> and then call
>>
>> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().openEditor(input,
>> editorID);
>>
>> to open the editor.
>>
>> the openEditor calls the constructor again. Does this mean their are
>> two instances of the editorInput?
Re: EditorInput Constructor Being called twice [message #292663 is a reply to message #292662] Mon, 10 October 2005 11:58 Go to previous message
Eclipse UserFriend
Originally posted by: daniel.megert.eclipse.org

Put a breakpoint into the constructor and check who's calling it.

Dani

James Leotta wrote:

> Its my own class here is the method I am calling
>
> public void getEditor(Object obj){
> String editorID = null;
> IEditorPart editor = null;
> IEditorInput input = null;
> if (obj instanceof Agency){
> input = new AgencyEditorInput((Agency) obj);
> editorID = AgencyEditor.ID;
> }
> if (obj instanceof AMITables){
> //input = new AgencyEditorInput((Agency) obj);
> //editorID = AgencyEditor.ID;
> }
> if (obj instanceof Grant){
> input = new GrantEditorInput((Grant) obj);
> editorID = GrantEditor.ID;
> }
> if (obj instanceof Employee){
> input = new StaffEditorInput((Employee) obj);
> editorID = StaffEditor.ID;
> }
> if (obj instanceof County){
>
> }
> if (obj instanceof User){
> input = new UserEditorInput((User) obj);
> editorID = UserEditor.ID;
> }
> editor =
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().findEditor(input);
>
> if (editor != null){
>
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().activate(editor);
>
> return;
> }
> try{
>
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().openEditor(input,
> editorID);
> }catch(Exception e){
> System.out.println(e);
> }
> }
>
> Daniel Megert wrote:
>
>> James Leotta wrote:
>>
>>> Hello,
>>>
>>> I create an instance of an EditorInput
>>>
>>> IEditor input = new EditorInput();
>>
>>
>>
>> This is code not possible since there's now such thing as EditorInput
>> class in Eclipse SDK. Is this your own implementation of IEditorInput
>> or did you mean FileEditorInput?
>>
>> Dani
>>
>>>
>>> and then call
>>>
>>> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().openEditor(input,
>>> editorID);
>>>
>>> to open the editor.
>>>
>>> the openEditor calls the constructor again. Does this mean their
>>> are two instances of the editorInput?
>>
Previous Topic:Key Bindings
Next Topic:Infopop
Goto Forum:
  


Current Time: Fri Jul 18 01:26:52 EDT 2025

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

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

Back to the top