1 /* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Eclipse Public License, Version 1.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.eclipse.org/org/documents/epl-v10.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.ide.common.api; 18 19 import com.google.common.annotations.Beta; 20 21 /** 22 * An enumerated type of different insertion events, such as an insertion from a 23 * copy/paste operation or as the first half of a move operation. 24 * <p> 25 * <b>NOTE: This is not a public or final API; if you rely on this be prepared 26 * to adjust your code for the next tools release.</b> 27 */ 28 @Beta 29 public enum InsertType { 30 /** The view is newly created (by for example a palette drag) */ 31 CREATE, 32 33 /** 34 * Same as {@link #CREATE} but when the views are constructed for previewing, for 35 * example as part of a palette drag. 36 */ 37 CREATE_PREVIEW, 38 39 /** The view is being inserted here because it was moved from somewhere else within 40 * the same layout */ 41 MOVE_WITHIN, 42 43 /** The view is being inserted here because it was moved from some other layout */ 44 MOVE_INTO, 45 46 /** 47 * The view is being inserted here as a result of a copy/paste from elsewhere 48 * (including drags, but not from the palette) 49 */ 50 PASTE; 51 52 /** 53 * Returns true if this insert type is for a newly created view (for example a by 54 * palette drag). Note that this includes both normal create events as well as well as 55 * views created as part of previewing operations. 56 * 57 * @return true if this {@link InsertType} is for a newly created view 58 */ isCreate()59 public boolean isCreate() { 60 return this == CREATE || this == CREATE_PREVIEW; 61 } 62 } 63