@@ -212,8 +212,6 @@ export abstract class CompositePart<T extends Composite> extends Part {
212212 // Remember
213213 this . lastActiveCompositeId = this . activeComposite . getId ( ) ;
214214
215- let createCompositePromise : TPromise < void > ;
216-
217215 // Composites created for the first time
218216 let compositeContainer = this . mapCompositeToCompositeContainer [ composite . getId ( ) ] ;
219217 if ( ! compositeContainer ) {
@@ -223,92 +221,83 @@ export abstract class CompositePart<T extends Composite> extends Part {
223221 addClasses ( compositeContainer , this . compositeCSSClass ) ;
224222 compositeContainer . id = composite . getId ( ) ;
225223
226- createCompositePromise = composite . create ( compositeContainer ) . then ( ( ) => {
227- composite . updateStyles ( ) ;
228- } ) ;
224+ composite . create ( compositeContainer ) ;
225+ composite . updateStyles ( ) ;
229226
230227 // Remember composite container
231228 this . mapCompositeToCompositeContainer [ composite . getId ( ) ] = compositeContainer ;
232229 }
233230
234- // Composite already exists but is hidden
235- else {
236- createCompositePromise = Promise . resolve ( null ) ;
237- }
238-
239231 // Report progress for slow loading composites (but only if we did not create the composites before already)
240232 const progressService = this . mapProgressServiceToComposite [ composite . getId ( ) ] ;
241233 if ( progressService && ! compositeContainer ) {
242- this . mapProgressServiceToComposite [ composite . getId ( ) ] . showWhile ( createCompositePromise , this . partService . isCreated ( ) ? 800 : 3200 /* less ugly initial startup */ ) ;
234+ this . mapProgressServiceToComposite [ composite . getId ( ) ] . showWhile ( Promise . resolve ( ) , this . partService . isCreated ( ) ? 800 : 3200 /* less ugly initial startup */ ) ;
243235 }
244236
245237 // Fill Content and Actions
246- return createCompositePromise . then ( ( ) => {
247-
248- // Make sure that the user meanwhile did not open another composite or closed the part containing the composite
249- if ( ! this . activeComposite || composite . getId ( ) !== this . activeComposite . getId ( ) ) {
250- return void 0 ;
251- }
238+ // Make sure that the user meanwhile did not open another composite or closed the part containing the composite
239+ if ( ! this . activeComposite || composite . getId ( ) !== this . activeComposite . getId ( ) ) {
240+ return void 0 ;
241+ }
252242
253- // Take Composite on-DOM and show
254- this . getContentArea ( ) . appendChild ( compositeContainer ) ;
255- show ( compositeContainer ) ;
243+ // Take Composite on-DOM and show
244+ this . getContentArea ( ) . appendChild ( compositeContainer ) ;
245+ show ( compositeContainer ) ;
256246
257- // Setup action runner
258- this . toolBar . actionRunner = composite . getActionRunner ( ) ;
247+ // Setup action runner
248+ this . toolBar . actionRunner = composite . getActionRunner ( ) ;
259249
260- // Update title with composite title if it differs from descriptor
261- const descriptor = this . registry . getComposite ( composite . getId ( ) ) ;
262- if ( descriptor && descriptor . name !== composite . getTitle ( ) ) {
263- this . updateTitle ( composite . getId ( ) , composite . getTitle ( ) ) ;
264- }
250+ // Update title with composite title if it differs from descriptor
251+ const descriptor = this . registry . getComposite ( composite . getId ( ) ) ;
252+ if ( descriptor && descriptor . name !== composite . getTitle ( ) ) {
253+ this . updateTitle ( composite . getId ( ) , composite . getTitle ( ) ) ;
254+ }
265255
266- // Handle Composite Actions
267- let actionsBinding = this . mapActionsBindingToComposite [ composite . getId ( ) ] ;
268- if ( ! actionsBinding ) {
269- actionsBinding = this . collectCompositeActions ( composite ) ;
270- this . mapActionsBindingToComposite [ composite . getId ( ) ] = actionsBinding ;
271- }
272- actionsBinding ( ) ;
256+ // Handle Composite Actions
257+ let actionsBinding = this . mapActionsBindingToComposite [ composite . getId ( ) ] ;
258+ if ( ! actionsBinding ) {
259+ actionsBinding = this . collectCompositeActions ( composite ) ;
260+ this . mapActionsBindingToComposite [ composite . getId ( ) ] = actionsBinding ;
261+ }
262+ actionsBinding ( ) ;
273263
274- if ( this . telemetryActionsListener ) {
275- this . telemetryActionsListener . dispose ( ) ;
276- this . telemetryActionsListener = null ;
277- }
264+ if ( this . telemetryActionsListener ) {
265+ this . telemetryActionsListener . dispose ( ) ;
266+ this . telemetryActionsListener = null ;
267+ }
278268
279- // Action Run Handling
280- this . telemetryActionsListener = this . toolBar . actionRunner . onDidRun ( e => {
269+ // Action Run Handling
270+ this . telemetryActionsListener = this . toolBar . actionRunner . onDidRun ( e => {
281271
282- // Check for Error
283- if ( e . error && ! errors . isPromiseCanceledError ( e . error ) ) {
284- this . notificationService . error ( e . error ) ;
285- }
272+ // Check for Error
273+ if ( e . error && ! errors . isPromiseCanceledError ( e . error ) ) {
274+ this . notificationService . error ( e . error ) ;
275+ }
286276
287- // Log in telemetry
288- if ( this . telemetryService ) {
289- /* __GDPR__
290- "workbenchActionExecuted" : {
291- "id" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
292- "from": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
293- }
294- */
295- this . telemetryService . publicLog ( 'workbenchActionExecuted' , { id : e . action . id , from : this . nameForTelemetry } ) ;
296- }
297- } ) ;
277+ // Log in telemetry
278+ if ( this . telemetryService ) {
279+ /* __GDPR__
280+ "workbenchActionExecuted" : {
281+ "id" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
282+ "from": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
283+ }
284+ */
285+ this . telemetryService . publicLog ( 'workbenchActionExecuted' , { id : e . action . id , from : this . nameForTelemetry } ) ;
286+ }
287+ } ) ;
298288
299- // Indicate to composite that it is now visible
300- return composite . setVisible ( true ) . then ( ( ) => {
289+ // Indicate to composite that it is now visible
290+ return composite . setVisible ( true ) . then ( ( ) => {
301291
302- // Make sure that the user meanwhile did not open another composite or closed the part containing the composite
303- if ( ! this . activeComposite || composite . getId ( ) !== this . activeComposite . getId ( ) ) {
304- return ;
305- }
292+ // Make sure that the user meanwhile did not open another composite or closed the part containing the composite
293+ if ( ! this . activeComposite || composite . getId ( ) !== this . activeComposite . getId ( ) ) {
294+ return ;
295+ }
306296
307- // Make sure the composite is layed out
308- if ( this . contentAreaSize ) {
309- composite . layout ( this . contentAreaSize ) ;
310- }
311- } ) ;
297+ // Make sure the composite is layed out
298+ if ( this . contentAreaSize ) {
299+ composite . layout ( this . contentAreaSize ) ;
300+ }
312301 } , error => this . onError ( error ) ) ;
313302 }
314303
0 commit comments