本文整理匯總了Java中com.intellij.tasks.context.WorkingContextManager類的典型用法代碼示例。如果您正苦於以下問題:Java WorkingContextManager類的具體用法?Java WorkingContextManager怎麽用?Java WorkingContextManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
WorkingContextManager類屬於com.intellij.tasks.context包,在下文中一共展示了WorkingContextManager類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: saveContext
import com.intellij.tasks.context.WorkingContextManager; //導入依賴的package包/類
public static void saveContext(Project project) {
String initial = null;
Editor textEditor = FileEditorManager.getInstance(project).getSelectedTextEditor();
if (textEditor != null) {
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(textEditor.getDocument());
if (file != null) {
initial = file.getName();
}
}
String comment = Messages.showInputDialog(project, "Enter comment (optional):", "Save Context", null, initial, null);
if (comment != null) {
WorkingContextManager.getInstance(project).saveContext(null, StringUtil.isEmpty(comment) ? null : comment);
}
}
示例2: actionPerformed
import com.intellij.tasks.context.WorkingContextManager; //導入依賴的package包/類
public void actionPerformed(final AnActionEvent e) {
final Project project = getProject(e);
GlobalUndoableAction action = new GlobalUndoableAction() {
public void undo() throws UnexpectedUndoException {
}
public void redo() throws UnexpectedUndoException {
WorkingContextManager.getInstance(project).clearContext();
}
};
UndoableCommand.execute(project, action, "Clear context", "Context");
}
示例3: createHandler
import com.intellij.tasks.context.WorkingContextManager; //導入依賴的package包/類
@NotNull
@Override
public CheckinHandler createHandler(@NotNull final CheckinProjectPanel panel, @NotNull final CommitContext commitContext) {
return new CheckinHandler() {
@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);
}
}
});
}
}
}
};
}
示例4: TaskManagerImpl
import com.intellij.tasks.context.WorkingContextManager; //導入依賴的package包/類
public TaskManagerImpl(Project project, WorkingContextManager contextManager, ChangeListManager changeListManager) {
myProject = project;
myContextManager = contextManager;
myChangeListManager = changeListManager;
myChangeListListener = new ChangeListAdapter() {
@Override
public void changeListRemoved(ChangeList list) {
LocalTask task = getAssociatedTask((LocalChangeList)list);
if (task != null) {
for (ChangeListInfo info : task.getChangeLists()) {
if (Comparing.equal(info.id, ((LocalChangeList)list).getId())) {
info.id = "";
}
}
}
}
@Override
public void defaultListChanged(ChangeList oldDefaultList, ChangeList newDefaultList) {
final LocalTask associatedTask = getAssociatedTask((LocalChangeList)newDefaultList);
if (associatedTask != null && !getActiveTask().equals(associatedTask)) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
activateTask(associatedTask, true);
}
}, myProject.getDisposed());
}
}
};
}
示例5: createHandler
import com.intellij.tasks.context.WorkingContextManager; //導入依賴的package包/類
@NotNull
@Override
public CheckinHandler createHandler(final CheckinProjectPanel panel, final CommitContext commitContext) {
return new CheckinHandler() {
@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);
}
}
});
}
}
}
};
}
示例6: TaskManagerImpl
import com.intellij.tasks.context.WorkingContextManager; //導入依賴的package包/類
public TaskManagerImpl(Project project,
WorkingContextManager contextManager,
final ChangeListManager changeListManager) {
myProject = project;
myContextManager = contextManager;
myChangeListManager = changeListManager;
myChangeListListener = new ChangeListAdapter() {
@Override
public void changeListRemoved(ChangeList list) {
LocalTask task = getAssociatedTask((LocalChangeList)list);
if (task != null) {
for (ChangeListInfo info : task.getChangeLists()) {
if (Comparing.equal(info.id, ((LocalChangeList)list).getId())) {
info.id = "";
}
}
}
}
@Override
public void defaultListChanged(ChangeList oldDefaultList, ChangeList newDefaultList) {
final LocalTask associatedTask = getAssociatedTask((LocalChangeList)newDefaultList);
if (associatedTask != null && !getActiveTask().equals(associatedTask)) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
activateTask(associatedTask, true);
}
}, myProject.getDisposed());
}
}
};
}
示例7: TaskManagerImpl
import com.intellij.tasks.context.WorkingContextManager; //導入依賴的package包/類
public TaskManagerImpl(Project project, WorkingContextManager contextManager, ChangeListManager changeListManager)
{
myProject = project;
myContextManager = contextManager;
myChangeListManager = changeListManager;
myChangeListListener = new ChangeListAdapter()
{
@Override
public void changeListRemoved(ChangeList list)
{
LocalTask task = getAssociatedTask((LocalChangeList) list);
if(task != null)
{
for(ChangeListInfo info : task.getChangeLists())
{
if(Comparing.equal(info.id, ((LocalChangeList) list).getId()))
{
info.id = "";
}
}
}
}
@Override
public void defaultListChanged(ChangeList oldDefaultList, ChangeList newDefaultList)
{
final LocalTask associatedTask = getAssociatedTask((LocalChangeList) newDefaultList);
if(associatedTask != null && !getActiveTask().equals(associatedTask))
{
ApplicationManager.getApplication().invokeLater(() -> activateTask(associatedTask, true), myProject.getDisposed());
}
}
};
}