mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Mark CHeckinProjectPanel#getCommitMessage() as @NotNull & check usages
This commit is contained in:
@@ -50,7 +50,7 @@ public abstract class DvcsCommitAdditionalComponent implements RefreshableOnComp
|
||||
|
||||
protected final JPanel myPanel;
|
||||
protected final JCheckBox myAmend;
|
||||
@Nullable private final String myPreviousMessage;
|
||||
@NotNull private final String myPreviousMessage;
|
||||
@Nullable private String myAmendedMessage;
|
||||
@NotNull protected final CheckinProjectPanel myCheckinPanel;
|
||||
@Nullable private Map<VirtualFile, String> myMessagesForRoots;
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vcs.changes.Change;
|
||||
import com.intellij.openapi.vcs.ui.Refreshable;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
@@ -91,6 +92,7 @@ public interface CheckinProjectPanel extends Refreshable, CommitMessageI {
|
||||
* @return the description text.
|
||||
* @since 5.1
|
||||
*/
|
||||
@NotNull
|
||||
String getCommitMessage();
|
||||
|
||||
String getCommitActionName();
|
||||
|
||||
@@ -1218,6 +1218,7 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj
|
||||
myCommitMessageArea.setText(currentDescription);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getCommitMessage() {
|
||||
return myCommitMessageArea.getComment();
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.intellij.openapi.vcs.*;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -152,6 +153,7 @@ public class CommitMessage extends AbstractDataProviderPanel implements Disposab
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getComment() {
|
||||
final String s = myEditorField.getDocument().getCharsSequence().toString();
|
||||
int end = s.length();
|
||||
@@ -164,8 +166,8 @@ public class CommitMessage extends AbstractDataProviderPanel implements Disposab
|
||||
public void requestFocusInMessage() {
|
||||
myEditorField.requestFocus();
|
||||
myEditorField.selectAll();
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public boolean isCheckSpelling() {
|
||||
return myCheckSpelling;
|
||||
|
||||
@@ -175,6 +175,7 @@ public class ShareDialog extends RepositoryBrowserDialog {
|
||||
return myCreateStandard.isSelected();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getCommitText() {
|
||||
return myCommitMessage.getComment();
|
||||
}
|
||||
|
||||
+18
-24
@@ -31,10 +31,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import javax.swing.*;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Dmitry Avdeev
|
||||
* Date: 12/29/11
|
||||
*/
|
||||
public class TaskCheckinHandlerFactory extends CheckinHandlerFactory {
|
||||
|
||||
@NotNull
|
||||
@@ -44,27 +40,25 @@ public class TaskCheckinHandlerFactory extends CheckinHandlerFactory {
|
||||
@Override
|
||||
public void checkinSuccessful() {
|
||||
final String message = panel.getCommitMessage();
|
||||
if (message != null) {
|
||||
final Project project = panel.getProject();
|
||||
final TaskManagerImpl manager = (TaskManagerImpl)TaskManager.getManager(project);
|
||||
if (manager.getState().saveContextOnCommit) {
|
||||
Task task = findTaskInRepositories(message, manager);
|
||||
if (task == null) {
|
||||
task = manager.createLocalTask(message);
|
||||
}
|
||||
final LocalTask localTask = manager.addTask(task);
|
||||
localTask.setUpdated(new Date());
|
||||
|
||||
//noinspection SSBasedInspection
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!project.isDisposed()) {
|
||||
WorkingContextManager.getInstance(project).saveContext(localTask);
|
||||
}
|
||||
}
|
||||
});
|
||||
final Project project = panel.getProject();
|
||||
final TaskManagerImpl manager = (TaskManagerImpl)TaskManager.getManager(project);
|
||||
if (manager.getState().saveContextOnCommit) {
|
||||
Task task = findTaskInRepositories(message, manager);
|
||||
if (task == null) {
|
||||
task = manager.createLocalTask(message);
|
||||
}
|
||||
final LocalTask localTask = manager.addTask(task);
|
||||
localTask.setUpdated(new Date());
|
||||
|
||||
//noinspection SSBasedInspection
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!project.isDisposed()) {
|
||||
WorkingContextManager.getInstance(project).saveContext(localTask);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user