1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
/*******************************************************************************
* Copyright (c) 2000, 2003 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.debug.internal.ui.views.console;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
/**
* A partition in a console document that contains input from the keyboard.
*/
public class InputPartition extends StreamPartition {
/**
* Once an input partition has been written to standard-in, it cannot
* be modified.
*/
private boolean fReadOnly = false;
/**
* Partition type
*/
public static final String INPUT_PARTITION_TYPE = DebugUIPlugin.getUniqueIdentifier() + ".INPUT_PARTITION_TYPE"; //$NON-NLS-1$
public InputPartition(String streamIdentifier, int offset, int length) {
super(streamIdentifier, offset, length, INPUT_PARTITION_TYPE);
}
/**
* @see org.eclipse.debug.internal.ui.views.console.StreamPartition#createNewPartition(String, int, int)
*/
public StreamPartition createNewPartition(String streamIdentifier, int offset, int length) {
return new InputPartition(streamIdentifier, offset, length);
}
/**
* Sets whether this partition is read-only.
*
* @param readOnly whether this partition is read-only
*/
public void setReadOnly(boolean readOnly) {
fReadOnly = readOnly;
}
/**
* Returns whether this partition is read-only.
*
* @return whether this partition is read-only
*/
public boolean isReadOnly() {
return fReadOnly;
}
/**
* Returns whether this partition is allowed to be combined with the
* given partition. Once read-only, this partition cannot be combined.
*
* @param partition
* @return boolean
*/
public boolean canBeCombinedWith(StreamPartition partition) {
return (!isReadOnly() && super.canBeCombinedWith(partition));
}
}
|