當前位置: 首頁>>代碼示例>>Java>>正文


Java WorkingContextManager類代碼示例

本文整理匯總了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);
    }
  }
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:16,代碼來源:SaveContextAction.java

示例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");
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:ClearContextAction.java

示例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);
              }
            }
          });
        }
      }
    }
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:33,代碼來源:TaskCheckinHandlerFactory.java

示例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());
        }
      }
    };
  }
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:33,代碼來源:TaskManagerImpl.java

示例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);
              }
            }
          });
        }
      }
    }
  };
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:33,代碼來源:TaskCheckinHandlerFactory.java

示例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());
      }
    }
  };
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:35,代碼來源:TaskManagerImpl.java

示例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());
			}
		}
	};
}
 
開發者ID:consulo,項目名稱:consulo-tasks,代碼行數:37,代碼來源:TaskManagerImpl.java


注:本文中的com.intellij.tasks.context.WorkingContextManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。