Bug 94604 - Need atomic TopComponent replacement
Need atomic TopComponent replacement
Status: VERIFIED FIXED
Product: platform
Classification: Unclassified
Component: Window System
6.x
All All
: P2 (vote)
: 6.x
Assigned To: David Simonek
issues@platform
plan60
: API, API_REVIEW_FAST
Depends on:
Blocks: 20147 94607
  Show dependency treegraph
 
Reported: 2007-02-06 11:22 UTC by Petr Nejedly
Modified: 2008-12-22 11:41 UTC (History)
5 users (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments
patch diff of winsys API (6.40 KB, patch)
2007-03-30 17:42 UTC, David Simonek
Details | Diff
patch diff of winsys implementation (core/windows) (12.83 KB, patch)
2007-03-30 17:43 UTC, David Simonek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Nejedly 2007-02-06 11:22:12 UTC
To implement support for debugger/temporary editor window (#35586), I need a
WinSys function that would allow me to swap to TopComponents without rearranging
tabs. The function should work as follows:
replaceTopComponent(TopComponent old, TopComponent nw) {
    assert old.isOpened();
    assert !nw.isOpened();

    old.close();
    nw.open();
    ensureThatNwIsAtTheSameLocation();
}
Comment 1 Petr Nejedly 2007-02-15 15:59:41 UTC
It might be more powerful to support openAt(index) and getIndex() instead. It
would allow implementing replacement and also some kind of
"open-next-to-current" behavior proposed by Jesse at issue 94607 
Comment 2 David Simonek 2007-03-13 14:44:15 UTC
Will try for M9.
Comment 3 Antonin Nebuzelsky 2007-03-29 14:53:13 UTC
Needed also for Save As.
Comment 4 David Simonek 2007-03-30 17:39:25 UTC
Sending to fast track API review. I will attach diff of carefully implemented
solution with tests, api changes, everything. New API is two added methods in
TopComponent: openAtPosition and getPosition.

Guys, please review and comment.
The biggest issue is probably that addition to TopComponent may be incompatible
for unlucky modules, so the question is if we should put these methods to
WindowManager instead of TopComponent.
Comment 5 David Simonek 2007-03-30 17:42:22 UTC
Created attachment 40210 [details]
patch diff of winsys API
Comment 6 David Simonek 2007-03-30 17:43:49 UTC
Created attachment 40212 [details]
patch diff of winsys implementation (core/windows)
Comment 7 Stanislav Aubrecht 2007-03-30 17:59:59 UTC
just a suggestion - i'd use getTabPosition() and openAtTabPosition() method
names instead
Comment 8 David Simonek 2007-03-30 18:31:25 UTC
I thought about that too, thanks, agreed.
Comment 9 David Simonek 2007-04-06 14:17:55 UTC
Thanks guys for review, I updated the names according to Standa's suggestion.

Implemented in main trunk:

Checking in openide/windows/src/org/openide/windows/WindowManager.java;
/cvs/openide/windows/src/org/openide/windows/WindowManager.java,v  <-- 
WindowManager.java
new revision: 1.16; previous revision: 1.15
done
Checking in openide/windows/src/org/openide/windows/TopComponent.java;
/cvs/openide/windows/src/org/openide/windows/TopComponent.java,v  <-- 
TopComponent.java
new revision: 1.21; previous revision: 1.20
done
Checking in openide/windows/src/org/openide/windows/DummyWindowManager.java;
/cvs/openide/windows/src/org/openide/windows/DummyWindowManager.java,v  <-- 
DummyWindowManager.java
new revision: 1.8; previous revision: 1.7
done
Checking in
core/windows/src/org/netbeans/core/windows/model/TopComponentSubModel.java;
/cvs/core/windows/src/org/netbeans/core/windows/model/TopComponentSubModel.java,v
 <--  TopComponentSubModel.java
new revision: 1.16; previous revision: 1.15
done
Checking in core/windows/src/org/netbeans/core/windows/model/Model.java;
/cvs/core/windows/src/org/netbeans/core/windows/model/Model.java,v  <--  Model.java
new revision: 1.19; previous revision: 1.18
done
Checking in core/windows/src/org/netbeans/core/windows/model/DefaultModel.java;
/cvs/core/windows/src/org/netbeans/core/windows/model/DefaultModel.java,v  <-- 
DefaultModel.java
new revision: 1.25; previous revision: 1.24
done
Checking in core/windows/src/org/netbeans/core/windows/model/DefaultModeModel.java;
/cvs/core/windows/src/org/netbeans/core/windows/model/DefaultModeModel.java,v 
<--  DefaultModeModel.java
new revision: 1.13; previous revision: 1.12
done
Checking in core/windows/src/org/netbeans/core/windows/model/ModeModel.java;
/cvs/core/windows/src/org/netbeans/core/windows/model/ModeModel.java,v  <-- 
ModeModel.java
new revision: 1.12; previous revision: 1.11
done
Checking in core/windows/src/org/netbeans/core/windows/Central.java;
/cvs/core/windows/src/org/netbeans/core/windows/Central.java,v  <--  Central.java
new revision: 1.54; previous revision: 1.53
done
Checking in core/windows/src/org/netbeans/core/windows/ModeImpl.java;
/cvs/core/windows/src/org/netbeans/core/windows/ModeImpl.java,v  <--  ModeImpl.java
new revision: 1.27; previous revision: 1.26
done
Checking in core/windows/src/org/netbeans/core/windows/WindowManagerImpl.java;
/cvs/core/windows/src/org/netbeans/core/windows/WindowManagerImpl.java,v  <-- 
WindowManagerImpl.java
new revision: 1.60; previous revision: 1.59
done
RCS file:
/cvs/core/windows/test/unit/src/org/netbeans/core/windows/OpenAtTabPositionTest.java,v
done
Checking in
core/windows/test/unit/src/org/netbeans/core/windows/OpenAtTabPositionTest.java;
/cvs/core/windows/test/unit/src/org/netbeans/core/windows/OpenAtTabPositionTest.java,v
 <--  OpenAtTabPositionTest.java
initial revision: 1.1
done
Checking in openide/windows/apichanges.xml;
/cvs/openide/windows/apichanges.xml,v  <--  apichanges.xml
new revision: 1.15; previous revision: 1.14
done
Checking in openide/windows/manifest.mf;
/cvs/openide/windows/manifest.mf,v  <--  manifest.mf
new revision: 1.15; previous revision: 1.14
done
Checking in core/windows/nbproject/project.xml;
/cvs/core/windows/nbproject/project.xml,v  <--  project.xml
new revision: 1.23; previous revision: 1.22
done
Comment 10 Jesse Glick 2007-04-06 17:05:47 UTC
Are there plans to use this for Alt-G, for example?
Comment 11 Petr Nejedly 2007-04-06 20:51:19 UTC
Certainly not this API directly, better doable through issue 94607 (which needs
to be updated to use this new API).
Comment 12 Petr Nejedly 2007-04-06 21:12:12 UTC
Works great for me, I started using the API from openide/text, #94607.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo