	public void editorOpened(IEditorPart editorPartOpened) {
		IWorkbenchPage page = editorPartOpened.getSite().getPage();
		List<IEditorReference> toClose = new ArrayList<IEditorReference>();
		int totalTaskEditors = 0;
		for (IEditorReference editorReference : page.getEditorReferences()) {
			if (editorReference.getId().equals(TaskEditor.ID_EDITOR)) {
				totalTaskEditors++;
			}
		}
		if (totalTaskEditors > MAX_EDITORS) {
			for (IEditorReference editorReference : page.getEditorReferences()) {
				try {
					if (editorReference.getId().equals(TaskEditor.ID_EDITOR)) {
						TaskEditorInput taskEditorInput = (TaskEditorInput) editorReference.getEditorInput();
						TaskEditor taskEditor = (TaskEditor) editorReference.getEditor(false);
						if (taskEditor == null) {
							toClose.add(editorReference);
						} else if (!taskEditor.equals(editorPartOpened) && !taskEditor.isDirty()
								&& taskEditorInput.getTask() != null
								&& taskEditorInput.getTask().getSynchronizationState().isSynchronized()) {
							toClose.add(editorReference);
						}
					}
					if ((totalTaskEditors - toClose.size()) < MAX_EDITORS) {
						break;
					}
				} catch (PartInitException e) {
				}
			}
		}
		if (toClose.size() > 0) {
			page.closeEditors(toClose.toArray(new IEditorReference[toClose.size()]), true);
		}
	}

	public void editorOpened(IEditorPart editorPartOpened) {
		IWorkbenchPage page = editorPartOpened.getSite().getPage();
		List<IEditorReference> toClose = new ArrayList<IEditorReference>();
		int totalTaskEditors = 0;
		for (IEditorReference editorReference : page.getEditorReferences()) {
			if (TaskEditor.ID_EDITOR.equals(editorReference.getId())) {
				totalTaskEditors++;
			}
		}
		if (totalTaskEditors > MAX_EDITORS) {
			for (IEditorReference editorReference : page.getEditorReferences()) {
				try {
					if (TaskEditor.ID_EDITOR.equals(editorReference.getId())) {
						TaskEditorInput taskEditorInput = (TaskEditorInput) editorReference.getEditorInput();
						TaskEditor taskEditor = (TaskEditor) editorReference.getEditor(false);
						if (taskEditor == null) {
							toClose.add(editorReference);
						} else if (!taskEditor.equals(editorPartOpened) && !taskEditor.isDirty()
								&& taskEditorInput.getTask() != null
								&& taskEditorInput.getTask().getSynchronizationState().isSynchronized()) {
							toClose.add(editorReference);
						}
					}
					if ((totalTaskEditors - toClose.size()) < MAX_EDITORS) {
						break;
					}
				} catch (PartInitException e) {
				}
			}
		}
		if (toClose.size() > 0) {
			page.closeEditors(toClose.toArray(new IEditorReference[toClose.size()]), true);
		}
	}
