KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > corext > refactoring > reorg > MonitoringCreateTargetQueries


1 /*******************************************************************************
2  * Copyright (c) 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.corext.refactoring.reorg;
12
13 /**
14  * Creates a new monitoring create target queries.
15  *
16  * @since 3.3
17  */

18 public final class MonitoringCreateTargetQueries implements ICreateTargetQueries {
19
20     private final ICreateTargetQueries fDelegate;
21
22     private final CreateTargetExecutionLog fLog;
23
24     /**
25      * Creates a new monitoring create target queries.
26      *
27      * @param delegate
28      * the delegate
29      * @param log
30      * the creation log
31      */

32     public MonitoringCreateTargetQueries(ICreateTargetQueries delegate, CreateTargetExecutionLog log) {
33         fDelegate= delegate;
34         fLog= log;
35     }
36
37     /**
38      * {@inheritDoc}
39      */

40     public ICreateTargetQuery createNewPackageQuery() {
41         return new ICreateTargetQuery() {
42
43             public Object JavaDoc getCreatedTarget(Object JavaDoc selection) {
44                 final Object JavaDoc target= fDelegate.createNewPackageQuery().getCreatedTarget(selection);
45                 fLog.markAsCreated(selection, target);
46                 return target;
47             }
48
49             public String JavaDoc getNewButtonLabel() {
50                 return fDelegate.createNewPackageQuery().getNewButtonLabel();
51             }
52         };
53     }
54
55     /**
56      * Returns the create target execution log.
57      *
58      * @return the create target execution log
59      */

60     public CreateTargetExecutionLog getCreateTargetExecutionLog() {
61         return fLog;
62     }
63
64     /**
65      * Returns the delegate queries.
66      *
67      * @return the delegate queries
68      */

69     public ICreateTargetQueries getDelegate() {
70         return fDelegate;
71     }
72 }
73
Popular Tags