View | Details | Raw Unified | Return to bug 337935 | Differences between
and this patch

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/ClassFileWorkingCopy.java (-14 / +11 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 81-101 Link Here
81
protected IBuffer openBuffer(IProgressMonitor pm, Object info) throws JavaModelException {
81
protected IBuffer openBuffer(IProgressMonitor pm, Object info) throws JavaModelException {
82
82
83
	// create buffer
83
	// create buffer
84
	IBuffer buffer = this.owner.createBuffer(this);
84
	IBuffer buffer = new Buffer(null /*no file = cannot save*/, this, false /*isReadOnly*/);
85
	if (buffer == null) return null;
86
85
87
	// set the buffer source
86
	// set the buffer source
88
	if (buffer.getCharacters() == null) {
87
	IBuffer classFileBuffer = this.classFile.getBuffer();
89
		IBuffer classFileBuffer = this.classFile.getBuffer();
88
	if (classFileBuffer != null) {
90
		if (classFileBuffer != null) {
89
		buffer.setContents(classFileBuffer.getCharacters());
91
			buffer.setContents(classFileBuffer.getCharacters());
90
	} else {
92
		} else {
91
		// Disassemble
93
			// Disassemble
92
		IClassFileReader reader = ToolFactory.createDefaultClassFileReader(this.classFile, IClassFileReader.ALL);
94
			IClassFileReader reader = ToolFactory.createDefaultClassFileReader(this.classFile, IClassFileReader.ALL);
93
		Disassembler disassembler = new Disassembler();
95
			Disassembler disassembler = new Disassembler();
94
		String contents = disassembler.disassemble(reader, Util.getLineSeparator("", getJavaProject()), ClassFileBytesDisassembler.WORKING_COPY); //$NON-NLS-1$
96
			String contents = disassembler.disassemble(reader, Util.getLineSeparator("", getJavaProject()), ClassFileBytesDisassembler.WORKING_COPY); //$NON-NLS-1$
95
		buffer.setContents(contents);
97
			buffer.setContents(contents);
98
		}
99
	}
96
	}
100
97
101
	// add buffer to buffer cache
98
	// add buffer to buffer cache

Return to bug 337935