01: /*******************************************************************************
02: * Copyright (c) 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.internal.corext.refactoring.reorg;
11:
12: /**
13: * Creates a new monitoring create target queries.
14: *
15: * @since 3.3
16: */
17: public final class MonitoringCreateTargetQueries implements
18: 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,
33: CreateTargetExecutionLog log) {
34: fDelegate = delegate;
35: fLog = log;
36: }
37:
38: /**
39: * {@inheritDoc}
40: */
41: public ICreateTargetQuery createNewPackageQuery() {
42: return new ICreateTargetQuery() {
43:
44: public Object getCreatedTarget(Object selection) {
45: final Object target = fDelegate.createNewPackageQuery()
46: .getCreatedTarget(selection);
47: fLog.markAsCreated(selection, target);
48: return target;
49: }
50:
51: public String getNewButtonLabel() {
52: return fDelegate.createNewPackageQuery()
53: .getNewButtonLabel();
54: }
55: };
56: }
57:
58: /**
59: * Returns the create target execution log.
60: *
61: * @return the create target execution log
62: */
63: public CreateTargetExecutionLog getCreateTargetExecutionLog() {
64: return fLog;
65: }
66:
67: /**
68: * Returns the delegate queries.
69: *
70: * @return the delegate queries
71: */
72: public ICreateTargetQueries getDelegate() {
73: return fDelegate;
74: }
75: }
|