Skip to content

Commit 130f9e7

Browse files
author
camus546
committed
Updating eclipse plugin against latest DrJava CVS build
git-svn-id: file:///tmp/test-svn/trunk@3515 fe72c1cf-3628-48e9-8b72-1c46755d3cff
1 parent cee8d46 commit 130f9e7

File tree

9 files changed

+82
-53
lines changed

9 files changed

+82
-53
lines changed

eclipse/.classpath

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<classpath>
3-
<classpathentry kind="src" path="src/"/>
4-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5-
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.core.boot_2.1.0/boot.jar"/>
6-
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.core.resources_2.1.0/resources.jar"/>
7-
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.core.runtime_2.1.0/runtime.jar"/>
8-
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.debug.ui_2.1.0/dtui.jar"/>
9-
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jface_2.1.0/jface.jar"/>
10-
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.search_2.1.0/search.jar"/>
11-
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.swt.gtk_2.1.0/ws/gtk/swt.jar"/>
12-
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.ui_2.1.0/ui.jar"/>
13-
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.ui.views_2.1.0/views.jar"/>
14-
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.ui.workbench_2.1.0/workbench.jar"/>
15-
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jdt.ui_2.1.0/jdt.jar"/>
16-
<classpathentry kind="lib" path="/home/creis/Desktop/drjava-beta-20030306.jar"/>
17-
<classpathentry kind="output" path="bin"/>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
5+
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
6+
<classpathentry kind="lib" path="/home/camus/drjava/eclipse/drjava-15.jar"/>
7+
<classpathentry kind="output" path="bin"/>
188
</classpath>

eclipse/build-common.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@
302302
bootclasspath="${jsr14_classpath}:${jsr14_collect_classpath}:${sun.boot.class.path}"
303303
classpath="${classpath_text}"
304304
source="1.5"
305-
target="jsr14"
305+
target="jsr14"
306306
debug="on"
307307
fork="on"
308308
optimize="off">

eclipse/manifest

Lines changed: 0 additions & 3 deletions
This file was deleted.

eclipse/src/edu/rice/cs/drjava/plugins/eclipse/DrJavaPreferencePage.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@
4444
import org.eclipse.jface.preference.IntegerFieldEditor;
4545
import org.eclipse.jface.preference.StringFieldEditor;
4646
import org.eclipse.jface.preference.IPreferenceStore;
47-
import org.eclipse.jface.preference.PreferencePage;
47+
//import org.eclipse.jface.preference.PreferencePage;
4848
import org.eclipse.swt.SWT;
49-
import org.eclipse.swt.events.*;
50-
import org.eclipse.swt.layout.GridData;
51-
import org.eclipse.swt.layout.GridLayout;
52-
import org.eclipse.swt.widgets.*;
49+
//import org.eclipse.swt.events.*;
50+
//import org.eclipse.swt.layout.GridData;
51+
//import org.eclipse.swt.layout.GridLayout;
52+
//import org.eclipse.swt.widgets.*;
5353
import org.eclipse.ui.IWorkbench;
5454
import org.eclipse.ui.IWorkbenchPreferencePage;
55-
import org.eclipse.ui.help.WorkbenchHelp;
55+
//import org.eclipse.ui.help.WorkbenchHelp;
5656

5757
/**
5858
* A preference page that allows the user to customize settings for

eclipse/src/edu/rice/cs/drjava/plugins/eclipse/repl/EclipseInteractionsModel.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
import java.net.MalformedURLException;
5959
import java.net.URL;
6060

61+
import edu.rice.cs.util.text.ConsoleDocument;
62+
6163
/**
6264
* Interactions model which can notify GlobalModelListeners on events.
6365
* @version $Id$
@@ -583,4 +585,11 @@ public void setPrivateAccessible(boolean allow) {
583585
public void setOptionArgs(String optionArgString) {
584586
_interpreterControl.setOptionArgs(optionArgString);
585587
}
588+
589+
/** Gets the console tab document for this interactions model */
590+
public ConsoleDocument getConsoleDocument() {
591+
return null;
592+
}
593+
594+
586595
}

eclipse/src/edu/rice/cs/drjava/plugins/eclipse/views/InteractionsController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
import edu.rice.cs.drjava.model.repl.InteractionsListener;
6464
import edu.rice.cs.drjava.model.repl.InteractionsDocument;
6565
import edu.rice.cs.drjava.model.repl.InputListener;
66-
import edu.rice.cs.drjava.model.repl.ConsoleDocument;
66+
import edu.rice.cs.util.text.ConsoleDocument;
6767
import edu.rice.cs.util.text.SWTDocumentAdapter;
6868
import edu.rice.cs.util.text.SWTDocumentAdapter.SWTStyle;
6969
import edu.rice.cs.util.text.SwingDocument;

eclipse/src/edu/rice/cs/drjava/plugins/eclipse/views/InteractionsViewTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
//import edu.rice.cs.drjava.model.repl.InteractionsDocumentTest.TestBeep;
5353
//import edu.rice.cs.drjava.model.repl.InteractionsModelTest.TestInteractionsModel;
5454
import edu.rice.cs.util.text.SWTDocumentAdapter;
55-
import edu.rice.cs.util.text.DocumentAdapterException;
55+
import edu.rice.cs.util.text.EditDocumentException;
5656

5757
import junit.framework.*;
5858
import junit.extensions.*;
@@ -147,7 +147,7 @@ public void testInitialPosition() {
147147
* Tests that moving the caret left when it's already at the prompt will
148148
* cycle it to the end of the line.
149149
*/
150-
public void testCaretMovementCyclesWhenAtPrompt() throws DocumentAdapterException {
150+
public void testCaretMovementCyclesWhenAtPrompt() throws EditDocumentException {
151151
_doc.insertText(_doc.getLength(), "test text", InteractionsDocument.DEFAULT_STYLE);
152152
_controller.moveToPrompt();
153153

@@ -161,7 +161,7 @@ public void testCaretMovementCyclesWhenAtPrompt() throws DocumentAdapterExceptio
161161
* Tests that moving the caret right when it's already at the end will
162162
* cycle it to the prompt.
163163
*/
164-
public void testCaretMovementCyclesWhenAtEnd() throws DocumentAdapterException {
164+
public void testCaretMovementCyclesWhenAtEnd() throws EditDocumentException {
165165
_doc.insertText(_doc.getLength(), "test text", InteractionsDocument.DEFAULT_STYLE);
166166
_controller.moveToEnd();
167167

@@ -219,7 +219,7 @@ public void testHistoryRecallNextMovesToEnd() {
219219
_text.getCaretOffset());
220220
}
221221

222-
public void testCaretStaysAtEndDuringInteraction() throws DocumentAdapterException {
222+
public void testCaretStaysAtEndDuringInteraction() throws EditDocumentException {
223223
_doc.setInProgress(true);
224224
_doc.insertText(_doc.getLength(), "simulated output", InteractionsDocument.DEFAULT_STYLE);
225225
_doc.setInProgress(false);
@@ -232,7 +232,7 @@ public void testCaretStaysAtEndDuringInteraction() throws DocumentAdapterExcepti
232232
* Tests that the caret catches up to the prompt if it is before it and
233233
* output is displayed.
234234
*/
235-
public void testCaretMovesUpToPromptAfterInsert() throws DocumentAdapterException {
235+
public void testCaretMovesUpToPromptAfterInsert() throws EditDocumentException {
236236
_doc.insertText(_doc.getLength(), "typed text", InteractionsDocument.DEFAULT_STYLE);
237237
_text.setCaretOffset(1);
238238
_doc.insertBeforeLastPrompt("simulated output", InteractionsDocument.DEFAULT_STYLE);
@@ -252,7 +252,7 @@ public void testCaretMovesUpToPromptAfterInsert() throws DocumentAdapterExceptio
252252
* Tests that the caret is moved properly when the current interaction
253253
* is cleared.
254254
*/
255-
public void testClearCurrentInteraction() throws DocumentAdapterException {
255+
public void testClearCurrentInteraction() throws EditDocumentException {
256256
_doc.insertText(_doc.getLength(), "typed text", InteractionsDocument.DEFAULT_STYLE);
257257
_controller.moveToEnd();
258258

@@ -268,7 +268,7 @@ public void testClearCurrentInteraction() throws DocumentAdapterException {
268268
/**
269269
* Tests that the InteractionsPane cannot be edited before the prompt.
270270
*/
271-
public void testCannotEditBeforePrompt() throws DocumentAdapterException {
271+
public void testCannotEditBeforePrompt() throws EditDocumentException {
272272
int origLength = _doc.getLength();
273273
_doc.insertText(1, "typed text", InteractionsDocument.DEFAULT_STYLE);
274274
assertEquals("Document should not have changed.",
@@ -279,7 +279,7 @@ public void testCannotEditBeforePrompt() throws DocumentAdapterException {
279279
/**
280280
* Tests that the caret is put in the correct position after an insert.
281281
*/
282-
public void testCaretUpdatedOnInsert() throws DocumentAdapterException {
282+
public void testCaretUpdatedOnInsert() throws EditDocumentException {
283283
_doc.insertText(_doc.getLength(), "typed text",
284284
InteractionsDocument.DEFAULT_STYLE);
285285
int pos = _doc.getLength() - 5;

eclipse/src/edu/rice/cs/util/text/SWTDocumentAdapter.java

Lines changed: 48 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
import org.eclipse.swt.graphics.Color;
4848

4949
import org.eclipse.swt.events.*;
50+
import java.awt.print.Pageable;
51+
import java.awt.print.PrinterException;
5052

5153
/**
5254
* Provides a toolkit-independent way to interact with an
@@ -57,7 +59,7 @@
5759
*
5860
* @version $Id$
5961
*/
60-
public class SWTDocumentAdapter implements ConsoleInterface {
62+
public class SWTDocumentAdapter implements EditDocumentInterface {
6163

6264
// TO DO:
6365
// - Test multithreaded support
@@ -81,7 +83,7 @@ public class SWTDocumentAdapter implements ConsoleInterface {
8183
protected boolean _forceRemove;
8284

8385
/** Any exception that occurred in the most recent (asynchronous) edit. */
84-
protected DocumentAdapterException _editException;
86+
protected EditDocumentException _editException;
8587

8688
/**
8789
* Creates a new document adapter for an SWT StyledText.
@@ -166,10 +168,10 @@ public void setEditCondition(DocumentEditCondition condition) {
166168
* @param str String to be inserted
167169
* @param style Name of the style to use. Must have been
168170
* added using addStyle.
169-
* @throws DocumentAdapterException if the offset is illegal
171+
* @throws EditDocumentException if the offset is illegal
170172
*/
171173
public void insertText(int offs, String str, String style)
172-
throws DocumentAdapterException
174+
throws EditDocumentException
173175
{
174176
if (_condition.canInsertText(offs)) { //, str, style)) {
175177
forceInsertText(offs, str, style);
@@ -183,11 +185,11 @@ public void insertText(int offs, String str, String style)
183185
* @param str String to be inserted
184186
* @param style Name of the style to use. Must have been
185187
* added using addStyle.
186-
* @throws DocumentAdapterException if the offset is illegal
188+
* @throws EditDocumentException if the offset is illegal
187189
*/
188190
public synchronized void forceInsertText(final int offs, final String str,
189191
final String style)
190-
throws DocumentAdapterException
192+
throws EditDocumentException
191193
{
192194
SWTStyle s = null;
193195
if (style != null) {
@@ -215,7 +217,7 @@ public void run() {
215217
}
216218
}
217219
catch (IllegalArgumentException e) {
218-
_editException = new DocumentAdapterException(e);
220+
_editException = new EditDocumentException(e);
219221
}
220222
}
221223
});
@@ -229,9 +231,9 @@ public void run() {
229231
* Removes a portion of the document, if the edit condition allows it.
230232
* @param offs Offset to start deleting from
231233
* @param len Number of characters to remove
232-
* @throws DocumentAdapterException if the offset or length are illegal
234+
* @throws EditDocumentException if the offset or length are illegal
233235
*/
234-
public void removeText(int offs, int len) throws DocumentAdapterException {
236+
public void removeText(int offs, int len) throws EditDocumentException {
235237
if (_condition.canRemoveText(offs)) { //, len)) {
236238
forceRemoveText(offs, len);
237239
}
@@ -241,10 +243,10 @@ public void removeText(int offs, int len) throws DocumentAdapterException {
241243
* Removes a portion of the document, regardless of the edit condition.
242244
* @param offs Offset to start deleting from
243245
* @param len Number of characters to remove
244-
* @throws DocumentAdapterException if the offset or length are illegal
246+
* @throws EditDocumentException if the offset or length are illegal
245247
*/
246248
public synchronized void forceRemoveText(final int offs, final int len)
247-
throws DocumentAdapterException
249+
throws EditDocumentException
248250
{
249251
_editException = null;
250252
_forceRemove = true;
@@ -256,7 +258,7 @@ public void run() {
256258
_pane.replaceTextRange(offs, len, "");
257259
}
258260
catch (IllegalArgumentException e) {
259-
_editException = new DocumentAdapterException(e);
261+
_editException = new EditDocumentException(e);
260262
}
261263
}
262264
});
@@ -277,17 +279,29 @@ public int getLength() {
277279
* Returns a portion of the document.
278280
* @param offs First offset of the desired text
279281
* @param len Number of characters to return
280-
* @throws DocumentAdapterException if the offset or length are illegal
282+
* @throws EditDocumentException if the offset or length are illegal
281283
*/
282-
public String getDocText(int offs, int len) throws DocumentAdapterException {
284+
public String getDocText(int offs, int len) throws EditDocumentException {
283285
try {
284286
return _text.getTextRange(offs, len);
285287
}
286288
catch (IllegalArgumentException e) {
287-
throw new DocumentAdapterException(e);
289+
throw new EditDocumentException(e);
288290
}
289291
}
292+
/** Appends a string to this in the given named style, if the edit condition allows it.
293+
* @param str String to be inserted
294+
* @param style Name of the style to use. Must have been added using addStyle.
295+
* @throws EditDocumentException if the offset is illegal
296+
*/
297+
public void append(String str, String style) {
298+
299+
int offs = getLength();
300+
forceInsertText(offs, str, style);
301+
}
302+
290303

304+
291305
/**
292306
* Highlights the given range in the given color.
293307
* @param offset Offset of first character to highlight
@@ -368,4 +382,23 @@ public void acquireWriteLock() { }
368382
/** Swing-style writeUnlock(). */
369383
public void releaseWriteLock(){ }
370384

385+
/** Gets the String identifying the default style for this document if one exists; null otherwise. */
386+
public String getDefaultStyle() {
387+
return "NONE";
388+
}
389+
390+
391+
/** Returns the Pageable object for printing.
392+
* @return A Pageable representing this document.
393+
*/
394+
public Pageable getPageable() throws IllegalStateException {
395+
return null;
396+
}
397+
398+
399+
/** Prints the given console document */
400+
public void print() throws PrinterException {
401+
402+
}
403+
371404
}

eclipse/src/edu/rice/cs/util/text/SWTDocumentAdapterTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void tearDown() {
9393
/**
9494
* Tests basic interactions with a DocumentAdapter.
9595
*/
96-
public void testBasicDocOps() throws DocumentAdapterException {
96+
public void testBasicDocOps() throws EditDocumentException {
9797
_doc.insertText(0, "one", null);
9898
assertEquals("first doc contents", "one",
9999
_doc.getDocText(0, _doc.getLength()));
@@ -108,14 +108,14 @@ public void testBasicDocOps() throws DocumentAdapterException {
108108
}
109109

110110
/**
111-
* Tests that a DocumentAdapterException is thrown when it should be.
111+
* Tests that a EditDocumentException is thrown when it should be.
112112
*/
113113
public void testException() {
114114
try {
115115
_doc.insertText(5, "test", null);
116116
fail("should have thrown an exception");
117117
}
118-
catch (DocumentAdapterException e) {
118+
catch (EditDocumentException e) {
119119
// That's what we expect.
120120
}
121121
}
@@ -125,7 +125,7 @@ public void testException() {
125125
* determines whether certain edits are legal.
126126
*/
127127
public void testEditCondition()
128-
throws DocumentAdapterException
128+
throws EditDocumentException
129129
{
130130
DocumentEditCondition c = new DocumentEditCondition() {
131131
public boolean canInsertText(int offs, String str, String style) {

0 commit comments

Comments
 (0)