blob: c8b6a8ca783f91c94d453667d7b069a6db98d413 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
/*******************************************************************************
* Copyright (c) 2013, 2014 Ericsson, Tasktop Technologies and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*
* Tasktop Technologies - initial API and implementation
*******************************************************************************/
package org.eclipse.mylyn.internal.gerrit.ui.factories;
import org.eclipse.mylyn.internal.gerrit.core.client.compat.ChangeDetailX;
import org.eclipse.mylyn.internal.gerrit.ui.operations.SubmitDialog;
import org.eclipse.mylyn.reviews.core.model.IReviewItemSet;
import org.eclipse.mylyn.reviews.ui.spi.factories.IUiContext;
import com.google.gerrit.reviewdb.ApprovalCategory;
/**
* @author Steffen Pingel
* @author Miles Parker
*/
public class SubmitUiFactory extends AbstractPatchSetUiFactory {
public SubmitUiFactory(IUiContext context, IReviewItemSet set) {
super(Messages.SubmitUiFactory_Submit, context, set);
}
@Override
public void execute() {
new SubmitDialog(getShell(), getTask(), getPatchSetDetail().getPatchSet()).open(getEditor());
}
@Override
public boolean isExecutable() {
if (isAnonymous()) {
return false;
}
ChangeDetailX changeDetail = getChange().getChangeDetail();
if (changeDetail != null) {
if (changeDetail.getCurrentActions() != null) {
return changeDetail.getCurrentActions().contains(ApprovalCategory.SUBMIT);
}
// Gerrit 2.2 and later
return changeDetail.canSubmit();
}
return false;
}
}
|