1 /*******************************************************************************
2 * Copyright (C) 2010, Dariusz Luksza <dariusz@luksza.org>
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
9 * SPDX-License-Identifier: EPL-2.0
10 *******************************************************************************/
11 package org
.eclipse
.egit
.ui
.internal
.synchronize
.model
;
13 import java
.io
.IOException
;
15 import org
.eclipse
.core
.runtime
.IPath
;
16 import org
.eclipse
.core
.runtime
.PlatformObject
;
17 import org
.eclipse
.egit
.core
.synchronize
.dto
.GitSynchronizeData
;
18 import org
.eclipse
.jgit
.errors
.MissingObjectException
;
21 * Abstract representation of all object that are included in Git ChangeSet
24 public abstract class GitModelObject
extends PlatformObject
{
26 private final GitModelObject parent
;
29 * Creates root of Git ChangeSet model.
32 * synchronization data
33 * @return Git ChangeSet model root
35 * @throws MissingObjectException
37 public static GitModelObject
createRoot(GitSynchronizeData data
)
38 throws MissingObjectException
, IOException
{
39 return new GitModelRepository(data
);
45 public GitModelObject(GitModelObject parent
) {
52 public GitModelObject
getParent() {
57 * @return repository hash code
59 public abstract int repositoryHashCode();
62 * @return child's of particular model object
64 public abstract GitModelObject
[] getChildren();
67 * Returns name of model object, in case of:
69 * <li>root node it will return repository path
70 * <li>commit node it will return first 6 characters of commit's SHA-1
71 * connected with short commit message
72 * <li>tree node it will return folder name
73 * <li>blob node it will return file name
76 * @return name of model object
78 public abstract String
getName();
84 public abstract int getKind();
87 * @return location of resource associated with particular model object
89 public abstract IPath
getLocation();
92 * Answers if model object may have children.
94 * @return <code>true</code> if the model object may have children and
95 * <code>false</code> otherwise.
97 public abstract boolean isContainer();
100 * Disposed all nested resources
102 public abstract void dispose();