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 /** 20 * An enumerated type of different insertion events, such as an insertion from a 21 * copy/paste operation or as the first half of a move operation. 22 */ 23 public enum InsertType { 24 /** The view is newly created (by for example a palette drag) */ 25 CREATE, 26 27 /** 28 * Same as {@link #CREATE} but when the views are constructed for previewing, for 29 * example as part of a palette drag. 30 */ 31 CREATE_PREVIEW, 32 33 /** The view is being inserted here because it was moved from somewhere else within 34 * the same layout */ 35 MOVE_WITHIN, 36 37 /** The view is being inserted here because it was moved from some other layout */ 38 MOVE_INTO, 39 40 /** 41 * The view is being inserted here as a result of a copy/paste from elsewhere 42 * (including drags, but not from the palette) 43 */ 44 PASTE; 45 46 /** 47 * Returns true if this insert type is for a newly created view (for example a by 48 * palette drag). Note that this includes both normal create events as well as well as 49 * views created as part of previewing operations. 50 * 51 * @return true if this {@link InsertType} is for a newly created view 52 */ 53 public boolean isCreate() { 54 return this == CREATE || this == CREATE_PREVIEW; 55 } 56 } 57