issue_id
int64 2.04k
425k
| title
stringlengths 9
251
| body
stringlengths 4
32.8k
⌀ | status
stringclasses 6
values | after_fix_sha
stringlengths 7
7
| project_name
stringclasses 6
values | repo_url
stringclasses 6
values | repo_name
stringclasses 6
values | language
stringclasses 1
value | issue_url
null | before_fix_sha
null | pull_url
null | commit_datetime
timestamp[us, tz=UTC] | report_datetime
timestamp[us, tz=UTC] | updated_file
stringlengths 23
187
| chunk_content
stringlengths 1
22k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/AddImportOnSelectionAction.java
|
if (type == null) {
JavaPlugin.logErrorMessage("AddImportOnSelectionAction: Failed to resolve TypeRef: " + chosen.toString());
MessageDialog.openError(getShell(), JavaEditorMessages.getString("AddImportOnSelection.error.title"), JavaEditorMessages.getString("AddImportOnSelection.error.notresolved.message"));
return;
}
removeQualification(doc, nameStart, chosen);
CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings();
AddImportsOperation op= new AddImportsOperation(cu, new IJavaElement[] { type }, settings, false);
ProgressMonitorDialog dialog= new ProgressMonitorDialog(getShell());
try {
dialog.run(false, true, new WorkbenchRunnableAdapter(op));
} catch (InvocationTargetException e) {
JavaPlugin.log(e);
MessageDialog.openError(getShell(), JavaEditorMessages.getString("AddImportOnSelection.error.title"), e.getTargetException().getMessage());
} catch (InterruptedException e) {
}
return;
} catch (CoreException e) {
JavaPlugin.log(e);
ErrorDialog.openError(getShell(), JavaEditorMessages.getString("AddImportOnSelection.error.title"), null, e.getStatus());
} catch (BadLocationException e) {
JavaPlugin.log(e);
MessageDialog.openError(getShell(), JavaEditorMessages.getString("AddImportOnSelection.error.title"), e.getMessage());
}
}
}
}
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/AddImportOnSelectionAction.java
|
private int getNameStart(IDocument doc, int pos) throws BadLocationException {
while (pos > 0) {
char ch= doc.getChar(pos - 1);
if (!Character.isJavaIdentifierPart(ch) && ch != '.') {
return pos;
}
pos--;
}
return pos;
}
private int getNameEnd(IDocument doc, int pos) throws BadLocationException {
int len= doc.getLength();
while (pos < len) {
char ch= doc.getChar(pos);
if (!Character.isJavaIdentifierPart(ch)) {
return pos;
}
pos++;
}
return pos;
}
private void removeQualification(IDocument doc, int nameStart, TypeInfo typeInfo) throws BadLocationException {
String containerName= typeInfo.getTypeContainerName();
int containerLen= containerName.length();
if (containerLen > 0) {
for (int k= 0; k < containerLen; k++) {
if (doc.getChar(nameStart + k) != containerName.charAt(k)) {
return;
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/AddImportOnSelectionAction.java
|
}
}
doc.replace(nameStart, containerLen + 1, "");
}
}
/**
* Finds a type by the simple name.
*/
private static TypeInfo[] findAllTypes(String simpleTypeName, IJavaSearchScope searchScope, IProgressMonitor monitor) throws CoreException {
SearchEngine searchEngine= new SearchEngine();
ArrayList typeRefsFound= new ArrayList(10);
ITypeNameRequestor requestor= new TypeInfoRequestor(typeRefsFound);
searchEngine.searchAllTypeNames(
JavaPlugin.getWorkspace(),
null,
simpleTypeName.toCharArray(),
IJavaSearchConstants.EXACT_MATCH,
IJavaSearchConstants.CASE_SENSITIVE,
IJavaSearchConstants.TYPE,
searchScope,
requestor,
IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
monitor);
return (TypeInfo[]) typeRefsFound.toArray(new TypeInfo[typeRefsFound.size()]);
}
private Shell getShell() {
return fEditor.getSite().getShell();
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/AddImportOnSelectionAction.java
|
}
private TypeInfo selectResult(TypeInfo[] results, String containerName, Shell shell) {
int nResults= results.length;
if (nResults == 0) {
return null;
} else if (nResults == 1) {
return results[0];
}
if (containerName.length() != 0) {
for (int i= 0; i < nResults; i++) {
TypeInfo curr= (TypeInfo) results[i];
if (containerName.equals(curr.getTypeContainerName())) {
return curr;
}
}
}
ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), new TypeInfoLabelProvider(TypeInfoLabelProvider.SHOW_FULLYQUALIFIED));
dialog.setTitle(JavaEditorMessages.getString("AddImportOnSelection.dialog.title"));
dialog.setMessage(JavaEditorMessages.getString("AddImportOnSelection.dialog.message"));
dialog.setElements(results);
if (dialog.open() == dialog.OK) {
return (TypeInfo) dialog.getFirstResult();
}
return null;
}
}
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddGetterSetterAction.java
|
/*******************************************************************************
* Copyright (c) 2000, 2002 International Business Machines Corp. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Corporation - initial API and implementation
******************************************************************************/
package org.eclipse.jdt.ui.actions;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.jdt.core.ICompilationUnit;
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddGetterSetterAction.java
|
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.corext.codemanipulation.AddGetterSetterOperation;
import org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationSettings;
import org.eclipse.jdt.internal.corext.codemanipulation.IRequestQuery;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.actions.ActionMessages;
import org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.internal.ui.preferences.CodeGenerationPreferencePage;
import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings;
import org.eclipse.jdt.internal.ui.viewsupport.JavaElementLabels;
/**
* Create Getter and Setter for selected fields.
* Will open the parent compilation unit in the editor.
* The result is unsaved, so the user can decide if the
* changes are acceptable.
*
* <p>
* This class may be instantiated; it is not intended to be subclassed.
* </p>
*
* @since 2.0
*/
public class AddGetterSetterAction extends SelectionDispatchAction {
/**
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddGetterSetterAction.java
|
* Creates a new <code>AddGetterSetterAction</code>.
*
* @param site the site providing context information for this action
*/
public AddGetterSetterAction(IWorkbenchSite site) {
super(site);
setText(ActionMessages.getString("AddGetterSetterAction.label"));
setDescription(ActionMessages.getString("AddGetterSetterAction.description"));
setToolTipText(ActionMessages.getString("AddGetterSetterAction.tooltip"));
WorkbenchHelp.setHelp(this, IJavaHelpContextIds.GETTERSETTER_ACTION);
}
/* (non-Javadoc)
* Method declared on SelectionDispatchAction
*/
protected void selectionChanged(IStructuredSelection selection) {
setEnabled(getSelectedFields(selection) != null);
}
/* (non-Javadoc)
* Method declared on SelectionDispatchAction
*/
protected void run(IStructuredSelection selection) {
IField[] fields= getSelectedFields(selection);
if (fields == null) {
return;
}
try {
ICompilationUnit cu= fields[0].getCompilationUnit();
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddGetterSetterAction.java
|
IEditorPart editor= EditorUtility.openInEditor(cu);
ICompilationUnit workingCopyCU;
IField[] workingCopyFields;
if (cu.isWorkingCopy()) {
workingCopyCU= cu;
workingCopyFields= fields;
} else {
workingCopyCU= EditorUtility.getWorkingCopy(cu);
if (workingCopyCU == null) {
showError(ActionMessages.getString("AddGetterSetterAction.error.actionfailed"));
return;
}
workingCopyFields= new IField[fields.length];
for (int i= 0; i < fields.length; i++) {
IField field= fields[i];
IField workingCopyField= (IField) JavaModelUtil.findMemberInCompilationUnit(workingCopyCU, field);
if (workingCopyField == null) {
showError(ActionMessages.getFormattedString("AddGetterSetterAction.error.fieldNotExisting", field.getElementName()));
return;
}
workingCopyFields[i]= workingCopyField;
}
}
IRequestQuery skipSetterForFinalQuery= skipSetterForFinalQuery();
IRequestQuery skipReplaceQuery= skipReplaceQuery();
String[] prefixes= CodeGenerationPreferencePage.getGetterStetterPrefixes();
String[] suffixes= CodeGenerationPreferencePage.getGetterStetterSuffixes();
CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings();
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddGetterSetterAction.java
|
AddGetterSetterOperation op= new AddGetterSetterOperation(workingCopyFields, prefixes, suffixes, settings, skipSetterForFinalQuery, skipReplaceQuery);
ProgressMonitorDialog dialog= new ProgressMonitorDialog(getShell());
dialog.run(false, true, new WorkbenchRunnableAdapter(op));
IMethod[] createdMethods= op.getCreatedAccessors();
if (createdMethods.length > 0) {
EditorUtility.revealInEditor(editor, createdMethods[0]);
}
} catch (InvocationTargetException e) {
JavaPlugin.log(e);
showError(ActionMessages.getString("AddGetterSetterAction.error.actionfailed"));
} catch (CoreException e) {
JavaPlugin.log(e.getStatus());
showError(ActionMessages.getString("AddGetterSetterAction.error.actionfailed"));
return;
} catch (InterruptedException e) {
}
}
private IRequestQuery skipSetterForFinalQuery() {
return new IRequestQuery() {
public int doQuery(IMember field) {
int[] returnCodes= {IRequestQuery.YES, IRequestQuery.NO, IRequestQuery.YES_ALL, IRequestQuery.CANCEL};
String[] options= {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.CANCEL_LABEL};
String fieldName= JavaElementLabels.getElementLabel(field, 0);
String formattedMessage= ActionMessages.getFormattedString("AddGetterSetterAction.SkipSetterForFinalDialog.message", fieldName);
return showQueryDialog(formattedMessage, options, returnCodes);
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddGetterSetterAction.java
|
}
};
}
private IRequestQuery skipReplaceQuery() {
return new IRequestQuery() {
public int doQuery(IMember method) {
int[] returnCodes= {IRequestQuery.YES, IRequestQuery.NO, IRequestQuery.YES_ALL, IRequestQuery.CANCEL};
String skipLabel= ActionMessages.getString("AddGetterSetterAction.SkipExistingDialog.skip.label");
String replaceLabel= ActionMessages.getString("AddGetterSetterAction.SkipExistingDialog.replace.label");
String skipAllLabel= ActionMessages.getString("AddGetterSetterAction.SkipExistingDialog.skipAll.label");
String[] options= { skipLabel, replaceLabel, skipAllLabel, IDialogConstants.CANCEL_LABEL};
String methodName= JavaElementLabels.getElementLabel(method, JavaElementLabels.M_PARAMETER_TYPES);
String formattedMessage= ActionMessages.getFormattedString("AddGetterSetterAction.SkipExistingDialog.message", methodName);
return showQueryDialog(formattedMessage, options, returnCodes);
}
};
}
private int showQueryDialog(final String message, final String[] buttonLabels, int[] returnCodes) {
final Shell shell= getShell();
if (shell == null) {
JavaPlugin.logErrorMessage("AddGetterSetterAction.showQueryDialog: No active shell found");
return IRequestQuery.CANCEL;
}
final int[] result= { MessageDialog.CANCEL };
shell.getDisplay().syncExec(new Runnable() {
public void run() {
String title= ActionMessages.getString("AddGetterSetterAction.QueryDialog.title");
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddGetterSetterAction.java
|
MessageDialog dialog= new MessageDialog(shell, title, null, message, MessageDialog.QUESTION, buttonLabels, 0);
result[0]= dialog.open();
}
});
int returnVal= result[0];
return returnVal < 0 ? IRequestQuery.CANCEL : returnCodes[returnVal];
}
private void showError(String message) {
MessageDialog.openError(getShell(), getDialogTitle(), message);
}
/*
* Returns fields in the selection or <code>null</code> if the selection is
* empty or not valid.
*/
private IField[] getSelectedFields(IStructuredSelection selection) {
List elements= selection.toList();
int nElements= elements.size();
if (nElements > 0) {
IField[] res= new IField[nElements];
ICompilationUnit cu= null;
for (int i= 0; i < nElements; i++) {
Object curr= elements.get(i);
if (curr instanceof IField) {
IField fld= (IField)curr;
if (i == 0) {
cu= fld.getCompilationUnit();
if (cu == null) {
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddGetterSetterAction.java
|
return null;
}
} else if (!cu.equals(fld.getCompilationUnit())) {
return null;
}
try {
if (fld.getDeclaringType().isInterface()) {
return null;
}
} catch (JavaModelException e) {
JavaPlugin.log(e);
return null;
}
res[i]= fld;
} else {
return null;
}
}
return res;
}
return null;
}
private String getDialogTitle() {
return ActionMessages.getString("AddGetterSetterAction.error.title");
}
}
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddJavaDocStubAction.java
|
/*******************************************************************************
* Copyright (c) 2000, 2002 International Business Machines Corp. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Corporation - initial API and implementation
******************************************************************************/
package org.eclipse.jdt.ui.actions;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddJavaDocStubAction.java
|
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.internal.corext.codemanipulation.AddJavaDocStubOperation;
import org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationSettings;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.actions.ActionMessages;
import org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings;
/**
* Create Java Doc Stubs for selected members
* Always forces the he field to be in an open editor. The result is unsaved,
* so the user can decide if he wnats to accept the changes.
*
* <p>
* This class may be instantiated; it is not intended to be subclassed.
* </p>
*
* @since 2.0
*/
public class AddJavaDocStubAction extends SelectionDispatchAction {
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddJavaDocStubAction.java
|
/**
* Creates a new <code>AddJavaDocStubAction</code>.
*
* @param site the site providing context information for this action
*/
public AddJavaDocStubAction(IWorkbenchSite site) {
super(site);
setText(ActionMessages.getString("AddJavaDocStubAction.label"));
setDescription(ActionMessages.getString("AddJavaDocStubAction.description"));
setToolTipText(ActionMessages.getString("AddJavaDocStubAction.tooltip"));
}
/* (non-Javadoc)
* Method declared on SelectionDispatchAction
*/
protected void selectionChanged(IStructuredSelection selection) {
setEnabled(getSelectedMembers(selection) != null);
}
/* (non-Javadoc)
* Method declared on SelectionDispatchAction
*/
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddJavaDocStubAction.java
|
protected void run(IStructuredSelection selection) {
IMember[] members= getSelectedMembers(selection);
if (members == null || members.length == 0) {
return;
}
try {
ICompilationUnit cu= members[0].getCompilationUnit();
IEditorPart editor= EditorUtility.openInEditor(cu);
ICompilationUnit workingCopyCU;
IMember[] workingCopyMembers;
if (cu.isWorkingCopy()) {
workingCopyCU= cu;
workingCopyMembers= members;
} else {
workingCopyCU= EditorUtility.getWorkingCopy(cu);
if (workingCopyCU == null) {
showError(ActionMessages.getString("AddJavaDocStubsAction.error.noWorkingCopy"));
return;
}
workingCopyMembers= new IMember[members.length];
for (int i= 0; i < members.length; i++) {
IMember member= members[i];
IMember workingCopyMember= (IMember) JavaModelUtil.findMemberInCompilationUnit(workingCopyCU, member);
if (workingCopyMember == null) {
showError(ActionMessages.getFormattedString("AddJavaDocStubsAction.error.memberNotExisting", member.getElementName()));
return;
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddJavaDocStubAction.java
|
}
workingCopyMembers[i]= workingCopyMember;
}
}
CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings();
AddJavaDocStubOperation op= new AddJavaDocStubOperation(workingCopyMembers, settings);
ProgressMonitorDialog dialog= new ProgressMonitorDialog(getShell());
dialog.run(false, true, new WorkbenchRunnableAdapter(op));
EditorUtility.revealInEditor(editor, members[0]);
} catch (InvocationTargetException e) {
JavaPlugin.log(e);
showError(ActionMessages.getString("AddJavaDocStubsAction.error.actionFailed"));
} catch (InterruptedException e) {
} catch (CoreException e) {
JavaPlugin.log(e.getStatus());
showError(ActionMessages.getString("AddJavaDocStubsAction.error.actionFailed"));
return;
}
}
private void showError(String message) {
MessageDialog.openError(getShell(), getDialogTitle(), message);
}
private IMember[] getSelectedMembers(IStructuredSelection selection) {
List elements= selection.toList();
int nElements= elements.size();
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddJavaDocStubAction.java
|
if (nElements > 0) {
IMember[] res= new IMember[nElements];
ICompilationUnit cu= null;
for (int i= 0; i < nElements; i++) {
Object curr= elements.get(i);
if (curr instanceof IMethod || curr instanceof IType) {
IMember member= (IMember)curr;
if (i == 0) {
cu= member.getCompilationUnit();
if (cu == null) {
return null;
}
} else if (!cu.equals(member.getCompilationUnit())) {
return null;
}
res[i]= member;
} else {
return null;
}
}
return res;
}
return null;
}
private String getDialogTitle() {
return ActionMessages.getString("AddJavaDocStubsAction.error.dialogTitle");
}
}
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddUnimplementedConstructorsAction.java
|
/*******************************************************************************
* Copyright (c) 2000, 2002 International Business Machines Corp. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Corporation - initial API and implementation
******************************************************************************/
package org.eclipse.jdt.ui.actions;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.swt.widgets.Shell;
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddUnimplementedConstructorsAction.java
|
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.corext.codemanipulation.AddUnimplementedConstructorsOperation;
import org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationSettings;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.actions.ActionMessages;
import org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings;
/**
* Evaluates constructors needed.
* Will open an editor for the type. Changes are unsaved.
*
* <p>
* This class may be instantiated; it is not intended to be subclassed.
* </p>
*
* @since 2.0
*/
public class AddUnimplementedConstructorsAction extends SelectionDispatchAction {
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddUnimplementedConstructorsAction.java
|
/**
* Creates a new <code>AddUnimplementedConstructorsAction</code>.
*
* @param site the site providing context information for this action
*/
public AddUnimplementedConstructorsAction(IWorkbenchSite site) {
super(site);
setText(ActionMessages.getString("AddUnimplementedConstructorsAction.label"));
setDescription(ActionMessages.getString("AddUnimplementedConstructorsAction.description"));
setToolTipText(ActionMessages.getString("AddUnimplementedConstructorsAction.tooltip"));
WorkbenchHelp.setHelp(this, IJavaHelpContextIds.ADD_UNIMPLEMENTED_CONSTRUCTORS_ACTION);
}
/* (non-Javadoc)
* Method declared on SelectionDispatchAction
*/
protected void selectionChanged(IStructuredSelection selection) {
boolean enabled= false;
try {
enabled= getSelectedType(selection) != null;
} catch (JavaModelException e) {
}
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddUnimplementedConstructorsAction.java
|
setEnabled(enabled);
}
/* (non-Javadoc)
* Method declared on SelectionDispatchAction
*/
public void run(IStructuredSelection selection) {
Shell shell= getShell();
try {
IType type= getSelectedType(selection);
if (type == null) {
return;
}
IEditorPart editor= EditorUtility.openInEditor(type);
type= (IType)EditorUtility.getWorkingCopy(type);
if (type == null) {
MessageDialog.openError(shell, getDialogTitle(), ActionMessages.getString("AddUnimplementedConstructorsAction.error.type_removed_in_editor"));
return;
}
CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings();
AddUnimplementedConstructorsOperation op= new AddUnimplementedConstructorsOperation(type, settings, false);
try {
ProgressMonitorDialog dialog= new ProgressMonitorDialog(shell);
dialog.run(false, true, new WorkbenchRunnableAdapter(op));
IMethod[] res= op.getCreatedMethods();
if (res == null || res.length == 0) {
MessageDialog.openInformation(shell, getDialogTitle(), ActionMessages.getString("AddUnimplementedConstructorsAction.error.nothing_found"));
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/AddUnimplementedConstructorsAction.java
|
} else if (editor != null) {
EditorUtility.revealInEditor(editor, res[0]);
}
} catch (InvocationTargetException e) {
JavaPlugin.log(e);
MessageDialog.openError(shell, getDialogTitle(), e.getTargetException().getMessage());
} catch (InterruptedException e) {
}
} catch (CoreException e) {
JavaPlugin.log(e);
ErrorDialog.openError(shell, getDialogTitle(), null, e.getStatus());
}
}
private IType getSelectedType(IStructuredSelection selection) throws JavaModelException {
Object[] elements= selection.toArray();
if (elements.length == 1 && (elements[0] instanceof IType)) {
IType type= (IType) elements[0];
if (type.getCompilationUnit() != null && type.isClass()) {
return type;
}
}
return null;
}
private String getDialogTitle() {
return ActionMessages.getString("AddUnimplementedConstructorsAction.error.title");
}
}
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
|
package org.eclipse.jdt.ui.actions;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.HashSet;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IEditorActionBarContributor;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.help.WorkbenchHelp;
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
|
import org.eclipse.ui.part.EditorActionBarContributor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.ui.IWorkingCopyManager;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation;
import org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation.IChooseImportQuery;
import org.eclipse.jdt.internal.corext.util.TypeInfo;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.actions.ActionMessages;
import org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter;
import org.eclipse.jdt.internal.ui.dialogs.MultiElementListSelectionDialog;
import org.eclipse.jdt.internal.ui.dialogs.ProblemDialog;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
import org.eclipse.jdt.internal.ui.preferences.ImportOrganizePreferencePage;
import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext;
import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
import org.eclipse.jdt.internal.ui.util.TypeInfoLabelProvider;
public class OrganizeImportsAction extends SelectionDispatchAction {
private JavaEditor fEditor;
/* (non-Javadoc)
* Class implements IObjectActionDelegate
*/
public static class ObjectDelegate implements IObjectActionDelegate {
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
|
private OrganizeImportsAction fAction;
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
fAction= new OrganizeImportsAction(targetPart.getSite());
}
public void run(IAction action) {
fAction.run();
}
public void selectionChanged(IAction action, ISelection selection) {
if (fAction == null)
action.setEnabled(false);
}
}
public OrganizeImportsAction(IWorkbenchSite site) {
super(site);
setText(ActionMessages.getString("OrganizeImportsAction.label"));
setToolTipText(ActionMessages.getString("OrganizeImportsAction.tooltip"));
setDescription(ActionMessages.getString("OrganizeImportsAction.description"));
WorkbenchHelp.setHelp(this, IJavaHelpContextIds.ORGANIZE_IMPORTS_ACTION);
}
/**
* Creates a new <code>OrganizeImportsAction</code>.
* <p>
* Note: This constructor is for internal use only. Clients should not call this constructor.
* </p>
*/
public OrganizeImportsAction(JavaEditor editor) {
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
|
this(editor.getEditorSite());
fEditor= editor;
}
/* (non-Javadoc)
* Method declared on SelectionDispatchAction.
*/
protected void selectionChanged(ITextSelection selection) {
setEnabled(fEditor != null);
}
/* (non-Javadoc)
* Method declared on SelectionDispatchAction.
*/
protected void selectionChanged(IStructuredSelection selection) {
setEnabled(getCompilationUnits(selection).length > 0);
}
private ICompilationUnit[] getCompilationUnits(IStructuredSelection selection) {
HashSet result= new HashSet();
Object[] selected= selection.toArray();
for (int i= 0; i < selected.length; i++) {
try {
if (selected[i] instanceof IJavaElement) {
IJavaElement elem= (IJavaElement) selected[i];
switch (elem.getElementType()) {
case IJavaElement.COMPILATION_UNIT:
result.add(elem);
break;
case IJavaElement.IMPORT_CONTAINER:
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
|
result.add(elem.getParent());
break;
case IJavaElement.PACKAGE_FRAGMENT:
IPackageFragment pack= (IPackageFragment) elem;
result.addAll(Arrays.asList(pack.getCompilationUnits()));
break;
}
}
} catch (JavaModelException e) {
JavaPlugin.log(e);
}
}
return (ICompilationUnit[]) result.toArray(new ICompilationUnit[result.size()]);
}
/* (non-Javadoc)
* Method declared on SelectionDispatchAction.
*/
protected void run(ITextSelection selection) {
IWorkingCopyManager manager= JavaPlugin.getDefault().getWorkingCopyManager();
ICompilationUnit cu= manager.getWorkingCopy(fEditor.getEditorInput());
runOnSingle(cu, true);
}
/* (non-Javadoc)
* Method declared on SelectionDispatchAction.
*/
protected void run(IStructuredSelection selection) {
ICompilationUnit[] cus= getCompilationUnits(selection);
if (cus.length == 1) {
runOnSingle(cus[0], true);
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
|
} else {
runOnMultiple(cus, true);
}
}
private void runOnMultiple(final ICompilationUnit[] cus, final boolean doResolve) {
try {
String message= ActionMessages.getString("OrganizeImportsAction.multi.status.description");
final MultiStatus status= new MultiStatus(JavaUI.ID_PLUGIN, Status.OK, message, null);
ProgressMonitorDialog dialog= new ProgressMonitorDialog(getShell());
dialog.run(false, true, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
doRunOnMultiple(cus, status, doResolve, monitor);
}
});
if (!status.isOK()) {
String title= ActionMessages.getString("OrganizeImportsAction.multi.status.title");
ProblemDialog.open(getShell(), title, null, status);
}
} catch (InvocationTargetException e) {
ExceptionHandler.handle(e, getShell(), ActionMessages.getString("OrganizeImportsAction.error.title"), ActionMessages.getString("OrganizeImportsAction.error.message"));
} catch (InterruptedException e) {
}
}
private void doRunOnMultiple(ICompilationUnit[] cus, MultiStatus status, boolean doResolve, IProgressMonitor monitor) throws InterruptedException {
final class OrganizeImportError extends Error {
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
|
}
if (monitor == null) {
monitor= new NullProgressMonitor();
}
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
|
monitor.beginTask(ActionMessages.getString("OrganizeImportsAction.multi.op.description"), cus.length);
try {
String[] prefOrder= ImportOrganizePreferencePage.getImportOrderPreference();
int threshold= ImportOrganizePreferencePage.getImportNumberThreshold();
boolean ignoreLowerCaseNames= ImportOrganizePreferencePage.doIgnoreLowerCaseNames();
IChooseImportQuery query= new IChooseImportQuery() {
public TypeInfo[] chooseImports(TypeInfo[][] openChoices, ISourceRange[] ranges) {
throw new OrganizeImportError();
}
};
for (int i= 0; i < cus.length; i++) {
ICompilationUnit cu= cus[i];
try {
if (!cu.isWorkingCopy()) {
ICompilationUnit workingCopy= EditorUtility.getWorkingCopy(cu);
if (workingCopy != null) {
cu= workingCopy;
}
}
OrganizeImportsOperation op= new OrganizeImportsOperation(cu, prefOrder, threshold, ignoreLowerCaseNames, !cu.isWorkingCopy(), doResolve, query);
op.run(new SubProgressMonitor(monitor, 1));
ISourceRange errorRange= op.getErrorSourceRange();
if (errorRange != null) {
String message= ActionMessages.getFormattedString("OrganizeImportsAction.multi.error.parse", cu.getElementName());
status.add(new Status(Status.INFO, JavaUI.ID_PLUGIN, Status.ERROR, message, null));
}
} catch (OrganizeImportError e) {
String message= ActionMessages.getFormattedString("OrganizeImportsAction.multi.error.unresolvable", cu.getElementName());
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
|
status.add(new Status(Status.INFO, JavaUI.ID_PLUGIN, Status.ERROR, message, null));
} catch (CoreException e) {
JavaPlugin.log(e);
String message= ActionMessages.getFormattedString("OrganizeImportsAction.multi.error.unexpected", e.getMessage());
status.add(new Status(Status.ERROR, JavaUI.ID_PLUGIN, Status.ERROR, message, null));
} catch (OperationCanceledException e) {
throw new InterruptedException();
}
}
} finally {
monitor.done();
}
}
private void runOnSingle(ICompilationUnit cu, boolean doResolve) {
try {
String[] prefOrder= ImportOrganizePreferencePage.getImportOrderPreference();
int threshold= ImportOrganizePreferencePage.getImportNumberThreshold();
boolean ignoreLowerCaseNames= ImportOrganizePreferencePage.doIgnoreLowerCaseNames();
if (!cu.isWorkingCopy()) {
IEditorPart editor= EditorUtility.openInEditor(cu);
if (editor instanceof JavaEditor) {
fEditor= (JavaEditor) editor;
}
ICompilationUnit workingCopy= EditorUtility.getWorkingCopy(cu);
if (workingCopy != null) {
cu= workingCopy;
}
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
|
}
OrganizeImportsOperation op= new OrganizeImportsOperation(cu, prefOrder, threshold, ignoreLowerCaseNames, !cu.isWorkingCopy(), doResolve, createChooseImportQuery());
BusyIndicatorRunnableContext context= new BusyIndicatorRunnableContext();
context.run(false, true, new WorkbenchRunnableAdapter(op));
ISourceRange errorRange= op.getErrorSourceRange();
if (errorRange != null) {
MessageDialog.openInformation(getShell(), ActionMessages.getString("OrganizeImportsAction.error.title"), ActionMessages.getString("OrganizeImportsAction.single.error.parse"));
if (fEditor != null) {
fEditor.selectAndReveal(errorRange.getOffset(), errorRange.getLength());
}
} else {
setStatusBarMessage(getOrganizeInfo(op));
}
} catch (CoreException e) {
ExceptionHandler.handle(e, getShell(), ActionMessages.getString("OrganizeImportsAction.error.title"), ActionMessages.getString("OrganizeImportsAction.error.message"));
} catch (InvocationTargetException e) {
ExceptionHandler.handle(e, getShell(), ActionMessages.getString("OrganizeImportsAction.error.title"), ActionMessages.getString("OrganizeImportsAction.error.message"));
} catch (InterruptedException e) {
}
}
private String getOrganizeInfo(OrganizeImportsOperation op) {
int nImportsAdded= op.getNumberOfImportsAdded();
if (nImportsAdded >= 0) {
return ActionMessages.getFormattedString("OrganizeImportsAction.summary_added", String.valueOf(nImportsAdded));
} else {
return ActionMessages.getFormattedString("OrganizeImportsAction.summary_removed", String.valueOf(-nImportsAdded));
}
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
|
}
private IChooseImportQuery createChooseImportQuery() {
return new IChooseImportQuery() {
public TypeInfo[] chooseImports(TypeInfo[][] openChoices, ISourceRange[] ranges) {
return doChooseImports(openChoices, ranges);
}
};
}
private TypeInfo[] doChooseImports(TypeInfo[][] openChoices, final ISourceRange[] ranges) {
ISelection sel= fEditor.getSelectionProvider().getSelection();
TypeInfo[] result= null;;
ILabelProvider labelProvider= new TypeInfoLabelProvider(TypeInfoLabelProvider.SHOW_FULLYQUALIFIED);
MultiElementListSelectionDialog dialog= new MultiElementListSelectionDialog(getShell(), labelProvider) {
protected void handleSelectionChanged() {
super.handleSelectionChanged();
doListSelectionChanged(getCurrentPage(), ranges);
}
};
dialog.setTitle(ActionMessages.getString("OrganizeImportsAction.selectiondialog.title"));
dialog.setMessage(ActionMessages.getString("OrganizeImportsAction.selectiondialog.message"));
dialog.setElements(openChoices);
if (dialog.open() == dialog.OK) {
Object[] res= dialog.getResult();
result= new TypeInfo[res.length];
for (int i= 0; i < res.length; i++) {
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
|
Object[] array= (Object[]) res[i];
if (array.length > 0)
result[i]= (TypeInfo) array[0];
}
}
if (sel instanceof ITextSelection) {
ITextSelection textSelection= (ITextSelection) sel;
fEditor.selectAndReveal(textSelection.getOffset(), textSelection.getLength());
}
return result;
}
private void doListSelectionChanged(int page, ISourceRange[] ranges) {
if (page >= 0 && page < ranges.length) {
ISourceRange range= ranges[page];
fEditor.selectAndReveal(range.getOffset(), range.getLength());
}
}
private void setStatusBarMessage(String message) {
IEditorActionBarContributor contributor= fEditor.getEditorSite().getActionBarContributor();
if (contributor instanceof EditorActionBarContributor) {
IStatusLineManager manager= ((EditorActionBarContributor) contributor).getActionBars().getStatusLineManager();
manager.setMessage(message);
}
}
}
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OverrideMethodsAction.java
|
/*******************************************************************************
* Copyright (c) 2000, 2002 International Business Machines Corp. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Corporation - initial API and implementation
******************************************************************************/
package org.eclipse.jdt.ui.actions;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.jface.dialogs.ErrorDialog;
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OverrideMethodsAction.java
|
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.corext.codemanipulation.AddUnimplementedMethodsOperation;
import org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationSettings;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.actions.ActionMessages;
import org.eclipse.jdt.internal.ui.actions.OverrideMethodQuery;
import org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings;
import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext;
/**
* Adds unimplemented methods of a type.
* Will open an editor for the type. Changes are unsaved.
*
* <p>
* This class may be instantiated; it is not intended to be subclassed.
* </p>
*
* @since 2.0
*/
public class OverrideMethodsAction extends SelectionDispatchAction {
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OverrideMethodsAction.java
|
/**
* Creates a new <code>OverrideMethodsAction</code>.
*
* @param site the site providing context information for this action
*/
public OverrideMethodsAction(IWorkbenchSite site) {
super(site);
setText(ActionMessages.getString("OverrideMethodsAction.label"));
setDescription(ActionMessages.getString("OverrideMethodsAction.description"));
setToolTipText(ActionMessages.getString("OverrideMethodsAction.tooltip"));
WorkbenchHelp.setHelp(this, IJavaHelpContextIds.ADD_UNIMPLEMENTED_METHODS_ACTION);
}
/* (non-Javadoc)
* Method declared on SelectionDispatchAction
*/
protected void selectionChanged(IStructuredSelection selection) {
boolean enabled= false;
try {
enabled= getSelectedType(selection) != null;
} catch (JavaModelException e) {
}
setEnabled(enabled);
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OverrideMethodsAction.java
|
}
/* (non-Javadoc)
* Method declared on SelectionDispatchAction
*/
protected void run(IStructuredSelection selection) {
Shell shell= getShell();
try {
IType type= getSelectedType(selection);
if (type == null) {
return;
}
IEditorPart editor= EditorUtility.openInEditor(type);
type= (IType)EditorUtility.getWorkingCopy(type);
if (type == null) {
MessageDialog.openError(shell, getDialogTitle(), ActionMessages.getString("OverrideMethodsAction.error.type_removed_in_editor"));
return;
}
OverrideMethodQuery selectionQuery= new OverrideMethodQuery(shell, false);
CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings();
AddUnimplementedMethodsOperation op= new AddUnimplementedMethodsOperation(type, settings, selectionQuery, false);
try {
BusyIndicatorRunnableContext context= new BusyIndicatorRunnableContext();
context.run(false, true, new WorkbenchRunnableAdapter(op));
IMethod[] res= op.getCreatedMethods();
if (res == null || res.length == 0) {
MessageDialog.openInformation(shell, getDialogTitle(), ActionMessages.getString("OverrideMethodsAction.error.nothing_found"));
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OverrideMethodsAction.java
|
} else if (editor != null) {
EditorUtility.revealInEditor(editor, res[0]);
}
} catch (InvocationTargetException e) {
JavaPlugin.log(e);
MessageDialog.openError(shell, getDialogTitle(), e.getTargetException().getMessage());
} catch (InterruptedException e) {
}
} catch (CoreException e) {
JavaPlugin.log(e);
ErrorDialog.openError(shell, getDialogTitle(), null, e.getStatus());
}
}
private IType getSelectedType(IStructuredSelection selection) throws JavaModelException {
Object[] elements= selection.toArray();
if (elements.length == 1 && (elements[0] instanceof IType)) {
IType type= (IType) elements[0];
if (type.getCompilationUnit() != null && type.isClass()) {
return type;
}
}
return null;
}
private String getDialogTitle() {
return ActionMessages.getString("OverrideMethodsAction.error.title");
}
}
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.ui.wizards;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
import org.eclipse.jdt.core.Flags;
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
import org.eclipse.jdt.core.IBuffer;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.ITypeHierarchy;
import org.eclipse.jdt.core.JavaConventions;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jdt.core.search.IJavaSearchConstants;
import org.eclipse.jdt.core.search.IJavaSearchScope;
import org.eclipse.jdt.core.search.SearchEngine;
import org.eclipse.jdt.ui.JavaElementLabelProvider;
import org.eclipse.jdt.internal.compiler.env.IConstants;
import org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationSettings;
import org.eclipse.jdt.internal.corext.codemanipulation.IImportsStructure;
import org.eclipse.jdt.internal.corext.codemanipulation.ImportsStructure;
import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility;
import org.eclipse.jdt.internal.corext.template.Template;
import org.eclipse.jdt.internal.corext.template.Templates;
import org.eclipse.jdt.internal.corext.template.java.JavaContext;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.JavaPluginImages;
import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
import org.eclipse.jdt.internal.ui.dialogs.TypeSelectionDialog;
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.internal.ui.preferences.CodeGenerationPreferencePage;
import org.eclipse.jdt.internal.ui.preferences.ImportOrganizePreferencePage;
import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings;
import org.eclipse.jdt.internal.ui.util.SWTUtil;
import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages;
import org.eclipse.jdt.internal.ui.wizards.SuperInterfaceSelectionDialog;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.IListAdapter;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.IStringButtonAdapter;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.LayoutUtil;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.SelectionButtonDialogFieldGroup;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.Separator;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringButtonDialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringButtonStatusDialogField;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringDialogField;
/**
* <code>NewTypeWizardPage</code> contains controls and validation routines for a 'New Type WizardPage'
* Implementors decide which components to add and to enable. Implementors can also
* customize the validation code.
* <code>NewTypeWizardPage</code> is intended to serve as base class of all wizards that create types.
* Applets, Servlets, Classes, Interfaces...
* See <code>NewClassWizardPage</code> or <code>NewInterfaceWizardPage</code> for an
* example usage of NewTypeWizardPage.
* @since 2.0
*/
public abstract class NewTypeWizardPage extends NewContainerWizardPage {
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
private final static String PAGE_NAME= "NewTypeWizardPage";
protected final static String PACKAGE= PAGE_NAME + ".package";
protected final static String ENCLOSING= PAGE_NAME + ".enclosing";
protected final static String ENCLOSINGSELECTION= ENCLOSING + ".selection";
protected final static String TYPENAME= PAGE_NAME + ".typename";
protected final static String SUPER= PAGE_NAME + ".superclass";
protected final static String INTERFACES= PAGE_NAME + ".interfaces";
protected final static String MODIFIERS= PAGE_NAME + ".modifiers";
protected final static String METHODS= PAGE_NAME + ".methods";
private class InterfacesListLabelProvider extends LabelProvider {
private Image fInterfaceImage;
public InterfacesListLabelProvider() {
super();
fInterfaceImage= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_INTERFACE);
}
public Image getImage(Object element) {
return fInterfaceImage;
}
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
}
private StringButtonStatusDialogField fPackageDialogField;
private SelectionButtonDialogField fEnclosingTypeSelection;
private StringButtonDialogField fEnclosingTypeDialogField;
private boolean fCanModifyPackage;
private boolean fCanModifyEnclosingType;
private IPackageFragment fCurrPackage;
private IType fCurrEnclosingType;
private StringDialogField fTypeNameDialogField;
private StringButtonDialogField fSuperClassDialogField;
private ListDialogField fSuperInterfacesDialogField;
private IType fSuperClass;
private SelectionButtonDialogFieldGroup fAccMdfButtons;
private SelectionButtonDialogFieldGroup fOtherMdfButtons;
private IType fCreatedType;
protected IStatus fEnclosingTypeStatus;
protected IStatus fPackageStatus;
protected IStatus fTypeNameStatus;
protected IStatus fSuperClassStatus;
protected IStatus fModifierStatus;
protected IStatus fSuperInterfacesStatus;
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
private boolean fIsClass;
private int fStaticMdfIndex;
private final int PUBLIC_INDEX= 0, DEFAULT_INDEX= 1, PRIVATE_INDEX= 2, PROTECTED_INDEX= 3;
private final int ABSTRACT_INDEX= 0, FINAL_INDEX= 1;
public NewTypeWizardPage(boolean isClass, String pageName) {
super(pageName);
fCreatedType= null;
fIsClass= isClass;
TypeFieldsAdapter adapter= new TypeFieldsAdapter();
fPackageDialogField= new StringButtonStatusDialogField(adapter);
fPackageDialogField.setDialogFieldListener(adapter);
fPackageDialogField.setLabelText(NewWizardMessages.getString("NewTypeWizardPage.package.label"));
fPackageDialogField.setButtonLabel(NewWizardMessages.getString("NewTypeWizardPage.package.button"));
fPackageDialogField.setStatusWidthHint(NewWizardMessages.getString("NewTypeWizardPage.default"));
fEnclosingTypeSelection= new SelectionButtonDialogField(SWT.CHECK);
fEnclosingTypeSelection.setDialogFieldListener(adapter);
fEnclosingTypeSelection.setLabelText(NewWizardMessages.getString("NewTypeWizardPage.enclosing.selection.label"));
fEnclosingTypeDialogField= new StringButtonDialogField(adapter);
fEnclosingTypeDialogField.setDialogFieldListener(adapter);
fEnclosingTypeDialogField.setButtonLabel(NewWizardMessages.getString("NewTypeWizardPage.enclosing.button"));
fTypeNameDialogField= new StringDialogField();
fTypeNameDialogField.setDialogFieldListener(adapter);
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
fTypeNameDialogField.setLabelText(NewWizardMessages.getString("NewTypeWizardPage.typename.label"));
fSuperClassDialogField= new StringButtonDialogField(adapter);
fSuperClassDialogField.setDialogFieldListener(adapter);
fSuperClassDialogField.setLabelText(NewWizardMessages.getString("NewTypeWizardPage.superclass.label"));
fSuperClassDialogField.setButtonLabel(NewWizardMessages.getString("NewTypeWizardPage.superclass.button"));
String[] addButtons= new String[] {
NewWizardMessages.getString("NewTypeWizardPage.interfaces.add"),
null,
NewWizardMessages.getString("NewTypeWizardPage.interfaces.remove")
};
fSuperInterfacesDialogField= new ListDialogField(adapter, addButtons, new InterfacesListLabelProvider());
fSuperInterfacesDialogField.setDialogFieldListener(adapter);
String interfaceLabel= fIsClass ? NewWizardMessages.getString("NewTypeWizardPage.interfaces.class.label") : NewWizardMessages.getString("NewTypeWizardPage.interfaces.ifc.label");
fSuperInterfacesDialogField.setLabelText(interfaceLabel);
fSuperInterfacesDialogField.setRemoveButtonIndex(2);
String[] buttonNames1= new String[] {
NewWizardMessages.getString("NewTypeWizardPage.modifiers.public"),
NewWizardMessages.getString("NewTypeWizardPage.modifiers.default"),
NewWizardMessages.getString("NewTypeWizardPage.modifiers.private"),
NewWizardMessages.getString("NewTypeWizardPage.modifiers.protected")
};
fAccMdfButtons= new SelectionButtonDialogFieldGroup(SWT.RADIO, buttonNames1, 4);
fAccMdfButtons.setDialogFieldListener(adapter);
fAccMdfButtons.setLabelText(NewWizardMessages.getString("NewTypeWizardPage.modifiers.acc.label"));
fAccMdfButtons.setSelection(0, true);
String[] buttonNames2;
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
if (fIsClass) {
buttonNames2= new String[] {
NewWizardMessages.getString("NewTypeWizardPage.modifiers.abstract"),
NewWizardMessages.getString("NewTypeWizardPage.modifiers.final"),
NewWizardMessages.getString("NewTypeWizardPage.modifiers.static")
};
fStaticMdfIndex= 2;
} else {
buttonNames2= new String[] {
NewWizardMessages.getString("NewTypeWizardPage.modifiers.static")
};
fStaticMdfIndex= 0;
}
fOtherMdfButtons= new SelectionButtonDialogFieldGroup(SWT.CHECK, buttonNames2, 4);
fOtherMdfButtons.setDialogFieldListener(adapter);
fAccMdfButtons.enableSelectionButton(PRIVATE_INDEX, false);
fAccMdfButtons.enableSelectionButton(PROTECTED_INDEX, false);
fOtherMdfButtons.enableSelectionButton(fStaticMdfIndex, false);
fPackageStatus= new StatusInfo();
fEnclosingTypeStatus= new StatusInfo();
fCanModifyPackage= true;
fCanModifyEnclosingType= true;
updateEnableState();
fTypeNameStatus= new StatusInfo();
fSuperClassStatus= new StatusInfo();
fSuperInterfacesStatus= new StatusInfo();
fModifierStatus= new StatusInfo();
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
}
/**
* Initializes all fields provided by the type page with a given
* Java element as selection. To implement a different selection strategy do not call this
* method or overwrite it.
* @param elem The initial selection of this page or null if no
* selection was available
*/
protected void initTypePage(IJavaElement elem) {
String initSuperclass= "java.lang.Object";
ArrayList initSuperinterfaces= new ArrayList(5);
IPackageFragment pack= null;
IType enclosingType= null;
if (elem != null) {
pack= (IPackageFragment) elem.getAncestor(IJavaElement.PACKAGE_FRAGMENT);
IType typeInCU= (IType) elem.getAncestor(IJavaElement.TYPE);
if (typeInCU != null) {
if (typeInCU.getCompilationUnit() != null) {
enclosingType= typeInCU;
}
} else {
ICompilationUnit cu= (ICompilationUnit) elem.getAncestor(IJavaElement.COMPILATION_UNIT);
if (cu != null) {
enclosingType= cu.findPrimaryType();
}
}
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
try {
IType type= null;
if (elem.getElementType() == IJavaElement.TYPE) {
type= (IType)elem;
if (type.exists()) {
String superName= JavaModelUtil.getFullyQualifiedName(type);
if (type.isInterface()) {
initSuperinterfaces.add(superName);
} else {
initSuperclass= superName;
}
}
}
} catch (JavaModelException e) {
JavaPlugin.log(e);
}
}
setPackageFragment(pack, true);
setEnclosingType(enclosingType, true);
setEnclosingTypeSelection(false, true);
setTypeName("", true);
setSuperClass(initSuperclass, true);
setSuperInterfaces(initSuperinterfaces, true);
}
/**
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
* Creates a separator line. Expects a GridLayout with at least 1 column.
* @param composite The parent composite
* @param nColumns Number of columns to span
*/
protected void createSeparator(Composite composite, int nColumns) {
(new Separator(SWT.SEPARATOR | SWT.HORIZONTAL)).doFillIntoGrid(composite, nColumns, convertHeightInCharsToPixels(1));
}
/**
* Creates the controls for the package name field. Expects a GridLayout with at least 4 columns.
* @param composite The parent composite
* @param nColumns Number of columns to span
*/
protected void createPackageControls(Composite composite, int nColumns) {
fPackageDialogField.doFillIntoGrid(composite, nColumns);
LayoutUtil.setWidthHint(fPackageDialogField.getTextControl(null), getMaxFieldWidth());
LayoutUtil.setHorizontalGrabbing(fPackageDialogField.getTextControl(null));
}
/**
* Creates the controls for the enclosing type name field. Expects a GridLayout with at least 4 columns.
* @param composite The parent composite
* @param nColumns Number of columns to span
*/
protected void createEnclosingTypeControls(Composite composite, int nColumns) {
Composite tabGroup= new Composite(composite, SWT.NONE);
GridLayout layout= new GridLayout();
layout.marginWidth= 0;
layout.marginHeight= 0;
tabGroup.setLayout(layout);
fEnclosingTypeSelection.doFillIntoGrid(tabGroup, 1);
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
Control c= fEnclosingTypeDialogField.getTextControl(composite);
GridData gd= new GridData(GridData.FILL_HORIZONTAL);
gd.widthHint= getMaxFieldWidth();
gd.horizontalSpan= 2;
c.setLayoutData(gd);
Button button= fEnclosingTypeDialogField.getChangeControl(composite);
gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.heightHint = SWTUtil.getButtonHeigthHint(button);
gd.widthHint = SWTUtil.getButtonWidthHint(button);
button.setLayoutData(gd);
}
/**
* Creates the controls for the type name field. Expects a GridLayout with at least 2 columns.
* @param composite The parent composite
* @param nColumns Number of columns to span
*/
protected void createTypeNameControls(Composite composite, int nColumns) {
fTypeNameDialogField.doFillIntoGrid(composite, nColumns - 1);
DialogField.createEmptySpace(composite);
LayoutUtil.setWidthHint(fTypeNameDialogField.getTextControl(null), getMaxFieldWidth());
}
/**
* Creates the controls for the modifiers radio/ceckbox buttons. Expects a GridLayout with at least 3 columns.
* @param composite The parent composite
* @param nColumns Number of columns to span
*/
protected void createModifierControls(Composite composite, int nColumns) {
LayoutUtil.setHorizontalSpan(fAccMdfButtons.getLabelControl(composite), 1);
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
Control control= fAccMdfButtons.getSelectionButtonsGroup(composite);
GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan= nColumns - 2;
control.setLayoutData(gd);
DialogField.createEmptySpace(composite);
DialogField.createEmptySpace(composite);
control= fOtherMdfButtons.getSelectionButtonsGroup(composite);
gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan= nColumns - 2;
control.setLayoutData(gd);
DialogField.createEmptySpace(composite);
}
/**
* Creates the controls for the superclass name field. Expects a GridLayout with at least 3 columns.
* @param composite The parent composite
* @param nColumns Number of columns to span
*/
protected void createSuperClassControls(Composite composite, int nColumns) {
fSuperClassDialogField.doFillIntoGrid(composite, nColumns);
LayoutUtil.setWidthHint(fSuperClassDialogField.getTextControl(null), getMaxFieldWidth());
}
/**
* Creates the controls for the superclass name field. Expects a GridLayout with at least 3 columns.
* @param composite The parent composite
* @param nColumns Number of columns to span
*/
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
protected void createSuperInterfacesControls(Composite composite, int nColumns) {
fSuperInterfacesDialogField.doFillIntoGrid(composite, nColumns);
GridData gd= (GridData)fSuperInterfacesDialogField.getListControl(null).getLayoutData();
if (fIsClass) {
gd.heightHint= convertHeightInCharsToPixels(3);
} else {
gd.heightHint= convertHeightInCharsToPixels(6);
}
gd.grabExcessVerticalSpace= false;
gd.widthHint= getMaxFieldWidth();
}
/**
* Sets the focus on the type name.
*/
protected void setFocus() {
fTypeNameDialogField.setFocus();
}
private class TypeFieldsAdapter implements IStringButtonAdapter, IDialogFieldListener, IListAdapter {
public void changeControlPressed(DialogField field) {
typePageChangeControlPressed(field);
}
public void customButtonPressed(DialogField field, int index) {
typePageCustomButtonPressed(field, index);
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
}
public void selectionChanged(DialogField field) {}
public void dialogFieldChanged(DialogField field) {
typePageDialogFieldChanged(field);
}
}
private void typePageChangeControlPressed(DialogField field) {
if (field == fPackageDialogField) {
IPackageFragment pack= choosePackage();
if (pack != null) {
fPackageDialogField.setText(pack.getElementName());
}
} else if (field == fEnclosingTypeDialogField) {
IType type= chooseEnclosingType();
if (type != null) {
fEnclosingTypeDialogField.setText(JavaModelUtil.getFullyQualifiedName(type));
}
} else if (field == fSuperClassDialogField) {
IType type= chooseSuperType();
if (type != null) {
fSuperClassDialogField.setText(JavaModelUtil.getFullyQualifiedName(type));
}
}
}
private void typePageCustomButtonPressed(DialogField field, int index) {
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
if (field == fSuperInterfacesDialogField) {
chooseSuperInterfaces();
}
}
/*
* A field on the type has changed. The fields' status and all dependend
* status are updated.
*/
private void typePageDialogFieldChanged(DialogField field) {
String fieldName= null;
if (field == fPackageDialogField) {
fPackageStatus= packageChanged();
updatePackageStatusLabel();
fTypeNameStatus= typeNameChanged();
fSuperClassStatus= superClassChanged();
fieldName= PACKAGE;
} else if (field == fEnclosingTypeDialogField) {
fEnclosingTypeStatus= enclosingTypeChanged();
fTypeNameStatus= typeNameChanged();
fSuperClassStatus= superClassChanged();
fieldName= ENCLOSING;
} else if (field == fEnclosingTypeSelection) {
updateEnableState();
boolean isEnclosedType= isEnclosingTypeSelected();
if (!isEnclosedType) {
if (fAccMdfButtons.isSelected(PRIVATE_INDEX) || fAccMdfButtons.isSelected(PROTECTED_INDEX)) {
fAccMdfButtons.setSelection(PRIVATE_INDEX, false);
fAccMdfButtons.setSelection(PROTECTED_INDEX, false);
fAccMdfButtons.setSelection(PUBLIC_INDEX, true);
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
}
if (fOtherMdfButtons.isSelected(fStaticMdfIndex)) {
fOtherMdfButtons.setSelection(fStaticMdfIndex, false);
}
}
fAccMdfButtons.enableSelectionButton(PRIVATE_INDEX, isEnclosedType && fIsClass);
fAccMdfButtons.enableSelectionButton(PROTECTED_INDEX, isEnclosedType && fIsClass);
fOtherMdfButtons.enableSelectionButton(fStaticMdfIndex, isEnclosedType);
fTypeNameStatus= typeNameChanged();
fSuperClassStatus= superClassChanged();
fieldName= ENCLOSINGSELECTION;
} else if (field == fTypeNameDialogField) {
fTypeNameStatus= typeNameChanged();
fieldName= TYPENAME;
} else if (field == fSuperClassDialogField) {
fSuperClassStatus= superClassChanged();
fieldName= SUPER;
} else if (field == fSuperInterfacesDialogField) {
fSuperInterfacesStatus= superInterfacesChanged();
fieldName= INTERFACES;
} else if (field == fOtherMdfButtons) {
fModifierStatus= modifiersChanged();
fieldName= MODIFIERS;
} else {
fieldName= METHODS;
}
handleFieldChanged(fieldName);
}
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
/**
* Called whenever a content of a field has changed.
* Implementors of NewTypeWizardPage can hook in.
* @see ContainerPage#handleFieldChanged
*/
protected void handleFieldChanged(String fieldName) {
super.handleFieldChanged(fieldName);
if (fieldName == CONTAINER) {
fPackageStatus= packageChanged();
fEnclosingTypeStatus= enclosingTypeChanged();
fTypeNameStatus= typeNameChanged();
fSuperClassStatus= superClassChanged();
fSuperInterfacesStatus= superInterfacesChanged();
}
}
/**
* Gets the text of package field.
*/
public String getPackageText() {
return fPackageDialogField.getText();
}
/**
* Gets the text of enclosing type field.
*/
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
public String getEnclosingTypeText() {
return fEnclosingTypeDialogField.getText();
}
/**
* Returns the package fragment corresponding to the current input.
* @return Returns <code>null</code> if the input could not be resolved.
*/
public IPackageFragment getPackageFragment() {
if (!isEnclosingTypeSelected()) {
return fCurrPackage;
} else {
if (fCurrEnclosingType != null) {
return fCurrEnclosingType.getPackageFragment();
}
}
return null;
}
/**
* Sets the package fragment.
* This will update model and the text of the control.
* @param canBeModified Selects if the package fragment can be changed by the user
*/
public void setPackageFragment(IPackageFragment pack, boolean canBeModified) {
fCurrPackage= pack;
fCanModifyPackage= canBeModified;
String str= (pack == null) ? "" : pack.getElementName();
fPackageDialogField.setText(str);
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
updateEnableState();
}
/**
* Returns the enclosing type corresponding to the current input.
* @return Returns <code>null</code> if enclosing type is not selected or the input could not
* be resolved.
*/
public IType getEnclosingType() {
if (isEnclosingTypeSelected()) {
return fCurrEnclosingType;
}
return null;
}
/**
* Sets the enclosing type.
* This will update model and the text of the control.
* @param canBeModified Selects if the enclosing type can be changed by the user
*/
public void setEnclosingType(IType type, boolean canBeModified) {
fCurrEnclosingType= type;
fCanModifyEnclosingType= canBeModified;
String str= (type == null) ? "" : JavaModelUtil.getFullyQualifiedName(type);
fEnclosingTypeDialogField.setText(str);
updateEnableState();
}
/**
* Returns <code>true</code> if the enclosing type selection check box is enabled.
*/
public boolean isEnclosingTypeSelected() {
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
return fEnclosingTypeSelection.isSelected();
}
/**
* Sets the enclosing type selection checkbox.
* @param canBeModified Selects if the enclosing type selection can be changed by the user
*/
public void setEnclosingTypeSelection(boolean isSelected, boolean canBeModified) {
fEnclosingTypeSelection.setSelection(isSelected);
fEnclosingTypeSelection.setEnabled(canBeModified);
updateEnableState();
}
/**
* Gets the type name.
*/
public String getTypeName() {
return fTypeNameDialogField.getText();
}
/**
* Sets the type name.
* @param canBeModified Selects if the type name can be changed by the user
*/
public void setTypeName(String name, boolean canBeModified) {
fTypeNameDialogField.setText(name);
fTypeNameDialogField.setEnabled(canBeModified);
}
/**
* Gets the selected modifiers.
* @see Flags
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
*/
public int getModifiers() {
int mdf= 0;
if (fAccMdfButtons.isSelected(PUBLIC_INDEX)) {
mdf+= IConstants.AccPublic;
} else if (fAccMdfButtons.isSelected(PRIVATE_INDEX)) {
mdf+= IConstants.AccPrivate;
} else if (fAccMdfButtons.isSelected(PROTECTED_INDEX)) {
mdf+= IConstants.AccProtected;
}
if (fOtherMdfButtons.isSelected(ABSTRACT_INDEX) && (fStaticMdfIndex != 0)) {
mdf+= IConstants.AccAbstract;
}
if (fOtherMdfButtons.isSelected(FINAL_INDEX)) {
mdf+= IConstants.AccFinal;
}
if (fOtherMdfButtons.isSelected(fStaticMdfIndex)) {
mdf+= IConstants.AccStatic;
}
return mdf;
}
/**
* Sets the modifiers.
* @param canBeModified Selects if the modifiers can be changed by the user
* @see IConstants
*/
public void setModifiers(int modifiers, boolean canBeModified) {
if (Flags.isPublic(modifiers)) {
fAccMdfButtons.setSelection(PUBLIC_INDEX, true);
} else if (Flags.isPrivate(modifiers)) {
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
fAccMdfButtons.setSelection(PRIVATE_INDEX, true);
} else if (Flags.isProtected(modifiers)) {
fAccMdfButtons.setSelection(PROTECTED_INDEX, true);
} else {
fAccMdfButtons.setSelection(DEFAULT_INDEX, true);
}
if (Flags.isAbstract(modifiers)) {
fOtherMdfButtons.setSelection(ABSTRACT_INDEX, true);
}
if (Flags.isFinal(modifiers)) {
fOtherMdfButtons.setSelection(FINAL_INDEX, true);
}
if (Flags.isStatic(modifiers)) {
fOtherMdfButtons.setSelection(fStaticMdfIndex, true);
}
fAccMdfButtons.setEnabled(canBeModified);
fOtherMdfButtons.setEnabled(canBeModified);
}
/**
* Gets the content of the super class text field.
*/
public String getSuperClass() {
return fSuperClassDialogField.getText();
}
/**
* Sets the super class name.
* @param canBeModified Selects if the super class can be changed by the user
*/
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
public void setSuperClass(String name, boolean canBeModified) {
fSuperClassDialogField.setText(name);
fSuperClassDialogField.setEnabled(canBeModified);
}
/**
* Gets the currently chosen super interfaces.
* @return returns a list of String
*/
public List getSuperInterfaces() {
return fSuperInterfacesDialogField.getElements();
}
/**
* Sets the super interfaces.
* @param canBeModified Selects if the modifiers can be changed by the user.
* @param interfacesNames a list of String
*/
public void setSuperInterfaces(List interfacesNames, boolean canBeModified) {
fSuperInterfacesDialogField.setElements(interfacesNames);
fSuperInterfacesDialogField.setEnabled(canBeModified);
}
/**
* Called when the package field has changed.
* The method validates the package name and returns the status of the validation
* This also updates the package fragment model.
* Can be extended to add more validation
*/
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
protected IStatus packageChanged() {
StatusInfo status= new StatusInfo();
fPackageDialogField.enableButton(getPackageFragmentRoot() != null);
String packName= getPackageText();
if (packName.length() > 0) {
IStatus val= JavaConventions.validatePackageName(packName);
if (val.getSeverity() == IStatus.ERROR) {
status.setError(NewWizardMessages.getFormattedString("NewTypeWizardPage.error.InvalidPackageName", val.getMessage()));
return status;
} else if (val.getSeverity() == IStatus.WARNING) {
status.setWarning(NewWizardMessages.getFormattedString("NewTypeWizardPage.warning.DiscouragedPackageName", val.getMessage()));
}
}
IPackageFragmentRoot root= getPackageFragmentRoot();
if (root != null) {
if (root.getJavaProject().exists() && packName.length() > 0) {
try {
IPath rootPath= root.getPath();
IPath outputPath= root.getJavaProject().getOutputLocation();
if (rootPath.isPrefixOf(outputPath) && !rootPath.equals(outputPath)) {
IPath packagePath= rootPath.append(packName.replace('.', '/'));
if (outputPath.isPrefixOf(packagePath)) {
status.setError(NewWizardMessages.getString("NewTypeWizardPage.error.ClashOutputLocation"));
return status;
}
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
}
} catch (JavaModelException e) {
JavaPlugin.log(e);
}
}
fCurrPackage= root.getPackageFragment(packName);
} else {
status.setError("");
}
return status;
}
/*
* Updates the 'default' label next to the package field.
*/
private void updatePackageStatusLabel() {
String packName= getPackageText();
if (packName.length() == 0) {
fPackageDialogField.setStatus(NewWizardMessages.getString("NewTypeWizardPage.default"));
} else {
fPackageDialogField.setStatus("");
}
}
/*
* Updates the enable state of buttons related to the enclosing type selection checkbox.
*/
private void updateEnableState() {
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
boolean enclosing= isEnclosingTypeSelected();
fPackageDialogField.setEnabled(fCanModifyPackage && !enclosing);
fEnclosingTypeDialogField.setEnabled(fCanModifyEnclosingType && enclosing);
}
/**
* Called when the enclosing type name has changed.
* The method validates the enclosing type and returns the status of the validation
* This also updates the enclosing type model.
* Can be extended to add more validation
*/
protected IStatus enclosingTypeChanged() {
StatusInfo status= new StatusInfo();
fCurrEnclosingType= null;
IPackageFragmentRoot root= getPackageFragmentRoot();
fEnclosingTypeDialogField.enableButton(root != null);
if (root == null) {
status.setError("");
return status;
}
String enclName= getEnclosingTypeText();
if (enclName.length() == 0) {
status.setError(NewWizardMessages.getString("NewTypeWizardPage.error.EnclosingTypeEnterName"));
return status;
}
try {
IType type= root.getJavaProject().findType(enclName);
if (type == null) {
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
status.setError(NewWizardMessages.getString("NewTypeWizardPage.error.EnclosingTypeNotExists"));
return status;
}
if (type.getCompilationUnit() == null) {
status.setError(NewWizardMessages.getString("NewTypeWizardPage.error.EnclosingNotInCU"));
return status;
}
fCurrEnclosingType= type;
IPackageFragmentRoot enclosingRoot= JavaModelUtil.getPackageFragmentRoot(type);
if (!enclosingRoot.equals(root)) {
status.setWarning(NewWizardMessages.getString("NewTypeWizardPage.warning.EnclosingNotInSourceFolder"));
}
return status;
} catch (JavaModelException e) {
status.setError(NewWizardMessages.getString("NewTypeWizardPage.error.EnclosingTypeNotExists"));
JavaPlugin.log(e);
return status;
}
}
/**
* Called when the type name has changed.
* The method validates the type name and returns the status of the validation.
* Can be extended to add more validation
*/
protected IStatus typeNameChanged() {
StatusInfo status= new StatusInfo();
String typeName= getTypeName();
if (typeName.length() == 0) {
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
status.setError(NewWizardMessages.getString("NewTypeWizardPage.error.EnterTypeName"));
return status;
}
if (typeName.indexOf('.') != -1) {
status.setError(NewWizardMessages.getString("NewTypeWizardPage.error.QualifiedName"));
return status;
}
IStatus val= JavaConventions.validateJavaTypeName(typeName);
if (val.getSeverity() == IStatus.ERROR) {
status.setError(NewWizardMessages.getFormattedString("NewTypeWizardPage.error.InvalidTypeName", val.getMessage()));
return status;
} else if (val.getSeverity() == IStatus.WARNING) {
status.setWarning(NewWizardMessages.getFormattedString("NewTypeWizardPage.warning.TypeNameDiscouraged", val.getMessage()));
}
if (!isEnclosingTypeSelected()) {
IPackageFragment pack= getPackageFragment();
if (pack != null) {
ICompilationUnit cu= pack.getCompilationUnit(typeName + ".java");
if (cu.exists()) {
status.setError(NewWizardMessages.getString("NewTypeWizardPage.error.TypeNameExists"));
return status;
}
}
} else {
IType type= getEnclosingType();
if (type != null) {
IType member= type.getType(typeName);
if (member.exists()) {
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
status.setError(NewWizardMessages.getString("NewTypeWizardPage.error.TypeNameExists"));
return status;
}
}
}
return status;
}
/**
* Called when the superclass name has changed.
* The method validates the superclass name and returns the status of the validation.
* Can be extended to add more validation
*/
protected IStatus superClassChanged() {
StatusInfo status= new StatusInfo();
IPackageFragmentRoot root= getPackageFragmentRoot();
fSuperClassDialogField.enableButton(root != null);
fSuperClass= null;
String sclassName= getSuperClass();
if (sclassName.length() == 0) {
return status;
}
IStatus val= JavaConventions.validateJavaTypeName(sclassName);
if (val.getSeverity() == IStatus.ERROR) {
status.setError(NewWizardMessages.getString("NewTypeWizardPage.error.InvalidSuperClassName"));
return status;
}
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
if (root != null) {
try {
IType type= resolveSuperTypeName(root.getJavaProject(), sclassName);
if (type == null) {
status.setWarning(NewWizardMessages.getString("NewTypeWizardPage.warning.SuperClassNotExists"));
return status;
} else {
if (type.isInterface()) {
status.setWarning(NewWizardMessages.getFormattedString("NewTypeWizardPage.warning.SuperClassIsNotClass", sclassName));
return status;
}
int flags= type.getFlags();
if (Flags.isFinal(flags)) {
status.setWarning(NewWizardMessages.getFormattedString("NewTypeWizardPage.warning.SuperClassIsFinal", sclassName));
return status;
} else if (!JavaModelUtil.isVisible(type, getPackageFragment())) {
status.setWarning(NewWizardMessages.getFormattedString("NewTypeWizardPage.warning.SuperClassIsNotVisible", sclassName));
return status;
}
}
fSuperClass= type;
} catch (JavaModelException e) {
status.setError(NewWizardMessages.getString("NewTypeWizardPage.error.InvalidSuperClassName"));
JavaPlugin.log(e);
}
} else {
status.setError("");
}
return status;
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
}
private IType resolveSuperTypeName(IJavaProject jproject, String sclassName) throws JavaModelException {
IType type= null;
if (isEnclosingTypeSelected()) {
IType enclosingType= getEnclosingType();
if (enclosingType != null) {
String[][] res= enclosingType.resolveType(sclassName);
if (res != null && res.length > 0) {
type= jproject.findType(res[0][0], res[0][1]);
}
}
} else {
IPackageFragment currPack= getPackageFragment();
if (type == null && currPack != null) {
String packName= currPack.getElementName();
if (!currPack.isDefaultPackage()) {
type= jproject.findType(packName, sclassName);
}
if (type == null && !"java.lang".equals(packName)) {
type= jproject.findType("java.lang", sclassName);
}
}
if (type == null) {
type= jproject.findType(sclassName);
}
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
}
return type;
}
/**
* Called when the list of super interface has changed.
* The method validates the superinterfaces and returns the status of the validation.
* Can be extended to add more validation.
*/
protected IStatus superInterfacesChanged() {
StatusInfo status= new StatusInfo();
IPackageFragmentRoot root= getPackageFragmentRoot();
fSuperInterfacesDialogField.enableButton(0, root != null);
if (root != null) {
List elements= fSuperInterfacesDialogField.getElements();
int nElements= elements.size();
for (int i= 0; i < nElements; i++) {
String intfname= (String)elements.get(i);
try {
IType type= root.getJavaProject().findType(intfname);
if (type == null) {
status.setWarning(NewWizardMessages.getFormattedString("NewTypeWizardPage.warning.InterfaceNotExists", intfname));
return status;
} else {
if (type.isClass()) {
status.setWarning(NewWizardMessages.getFormattedString("NewTypeWizardPage.warning.InterfaceIsNotInterface", intfname));
return status;
}
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
if (!JavaModelUtil.isVisible(type, getPackageFragment())) {
status.setWarning(NewWizardMessages.getFormattedString("NewTypeWizardPage.warning.InterfaceIsNotVisible", intfname));
return status;
}
}
} catch (JavaModelException e) {
JavaPlugin.log(e);
}
}
}
return status;
}
/**
* Called when the modifiers have changed.
* The method validates the modifiers and returns the status of the validation.
* Can be extended to add more validation.
*/
protected IStatus modifiersChanged() {
StatusInfo status= new StatusInfo();
int modifiers= getModifiers();
if (Flags.isFinal(modifiers) && Flags.isAbstract(modifiers)) {
status.setError(NewWizardMessages.getString("NewTypeWizardPage.error.ModifiersFinalAndAbstract"));
}
return status;
}
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
private IPackageFragment choosePackage() {
IPackageFragmentRoot froot= getPackageFragmentRoot();
IJavaElement[] packages= null;
try {
if (froot != null) {
packages= froot.getChildren();
}
} catch (JavaModelException e) {
JavaPlugin.log(e);
}
if (packages == null) {
packages= new IJavaElement[0];
}
ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT));
dialog.setIgnoreCase(false);
dialog.setTitle(NewWizardMessages.getString("NewTypeWizardPage.ChoosePackageDialog.title"));
dialog.setMessage(NewWizardMessages.getString("NewTypeWizardPage.ChoosePackageDialog.description"));
dialog.setEmptyListMessage(NewWizardMessages.getString("NewTypeWizardPage.ChoosePackageDialog.empty"));
dialog.setElements(packages);
if (fCurrPackage != null) {
dialog.setInitialSelections(new Object[] { fCurrPackage });
}
if (dialog.open() == dialog.OK) {
return (IPackageFragment) dialog.getFirstResult();
}
return null;
}
private IType chooseEnclosingType() {
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
IPackageFragmentRoot root= getPackageFragmentRoot();
if (root == null) {
return null;
}
IJavaSearchScope scope= SearchEngine.createJavaSearchScope(new IJavaElement[] { root });
TypeSelectionDialog dialog= new TypeSelectionDialog(getShell(), getWizard().getContainer(), IJavaSearchConstants.TYPE, scope);
dialog.setTitle(NewWizardMessages.getString("NewTypeWizardPage.ChooseEnclosingTypeDialog.title"));
dialog.setMessage(NewWizardMessages.getString("NewTypeWizardPage.ChooseEnclosingTypeDialog.description"));
if (fCurrEnclosingType != null) {
dialog.setInitialSelections(new Object[] { fCurrEnclosingType });
dialog.setFilter(fCurrEnclosingType.getElementName().substring(0, 1));
}
if (dialog.open() == dialog.OK) {
return (IType) dialog.getFirstResult();
}
return null;
}
private IType chooseSuperType() {
IPackageFragmentRoot root= getPackageFragmentRoot();
if (root == null) {
return null;
}
IJavaElement[] elements= new IJavaElement[] { root.getJavaProject() };
IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements);
TypeSelectionDialog dialog= new TypeSelectionDialog(getShell(), getWizard().getContainer(), IJavaSearchConstants.CLASS, scope);
dialog.setTitle(NewWizardMessages.getString("NewTypeWizardPage.SuperClassDialog.title"));
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
dialog.setMessage(NewWizardMessages.getString("NewTypeWizardPage.SuperClassDialog.message"));
if (fSuperClass != null) {
dialog.setFilter(fSuperClass.getElementName());
}
if (dialog.open() == dialog.OK) {
return (IType) dialog.getFirstResult();
}
return null;
}
private void chooseSuperInterfaces() {
IPackageFragmentRoot root= getPackageFragmentRoot();
if (root == null) {
return;
}
IJavaProject project= root.getJavaProject();
SuperInterfaceSelectionDialog dialog= new SuperInterfaceSelectionDialog(getShell(), getWizard().getContainer(), fSuperInterfacesDialogField, project);
dialog.setTitle(fIsClass ? NewWizardMessages.getString("NewTypeWizardPage.InterfacesDialog.class.title") : NewWizardMessages.getString("NewTypeWizardPage.InterfacesDialog.interface.title"));
dialog.setMessage(NewWizardMessages.getString("NewTypeWizardPage.InterfacesDialog.message"));
dialog.open();
return;
}
/**
* Creates a type using the current field values.
*/
public void createType(IProgressMonitor monitor) throws CoreException, InterruptedException {
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
monitor.beginTask(NewWizardMessages.getString("NewTypeWizardPage.operationdesc"), 10);
IPackageFragmentRoot root= getPackageFragmentRoot();
IPackageFragment pack= getPackageFragment();
if (pack == null) {
pack= root.getPackageFragment("");
}
if (!pack.exists()) {
String packName= pack.getElementName();
pack= root.createPackageFragment(packName, true, null);
}
monitor.worked(1);
String clName= getTypeName();
boolean isInnerClass= isEnclosingTypeSelected();
IType createdType;
ImportsStructure imports;
int indent= 0;
String[] prefOrder= ImportOrganizePreferencePage.getImportOrderPreference();
int threshold= ImportOrganizePreferencePage.getImportNumberThreshold();
String lineDelimiter= null;
if (!isInnerClass) {
lineDelimiter= System.getProperty("line.separator", "\n");
String packStatement= pack.isDefaultPackage() ? "" : "package " + pack.getElementName() + ";" + lineDelimiter + lineDelimiter;
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
ICompilationUnit parentCU= pack.createCompilationUnit(clName + ".java", packStatement, false, new SubProgressMonitor(monitor, 2));
imports= new ImportsStructure(parentCU, prefOrder, threshold, false);
String content= constructTypeStub(imports, lineDelimiter, parentCU);
createdType= parentCU.createType(content, null, false, new SubProgressMonitor(monitor, 3));
} else {
IType enclosingType= getEnclosingType();
IType workingCopy= (IType) EditorUtility.getWorkingCopy(enclosingType);
if (workingCopy != null) {
enclosingType= workingCopy;
}
ICompilationUnit parentCU= enclosingType.getCompilationUnit();
imports= new ImportsStructure(parentCU, prefOrder, threshold, true);
lineDelimiter= StubUtility.getLineDelimiterUsed(enclosingType);
String content= constructTypeStub(imports, lineDelimiter, parentCU);
IJavaElement[] elems= enclosingType.getChildren();
IJavaElement sibling= elems.length > 0 ? elems[0] : null;
createdType= enclosingType.createType(content, sibling, false, new SubProgressMonitor(monitor, 1));
indent= StubUtility.getIndentUsed(enclosingType) + 1;
}
imports.create(!isInnerClass, new SubProgressMonitor(monitor, 1));
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
createTypeMembers(createdType, imports, new SubProgressMonitor(monitor, 1));
imports.create(!isInnerClass, new SubProgressMonitor(monitor, 1));
ICompilationUnit cu= createdType.getCompilationUnit();
ISourceRange range;
if (isInnerClass) {
synchronized(cu) {
cu.reconcile();
}
range= createdType.getSourceRange();
} else {
range= cu.getSourceRange();
}
IBuffer buf= cu.getBuffer();
String originalContent= buf.getText(range.getOffset(), range.getLength());
String formattedContent= StubUtility.codeFormat(originalContent, indent, lineDelimiter);
buf.replace(range.getOffset(), range.getLength(), formattedContent);
if (!isInnerClass) {
String fileComment= getFileComment(cu);
if (fileComment != null && fileComment.length() > 0) {
buf.replace(0, 0, fileComment + lineDelimiter);
}
buf.save(new SubProgressMonitor(monitor, 1), false);
} else {
monitor.worked(1);
}
fCreatedType= createdType;
monitor.done();
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
}
/**
* Returns the created type. Only valid after createType has been invoked
*/
public IType getCreatedType() {
return fCreatedType;
}
private void writeSuperClass(StringBuffer buf, IImportsStructure imports) {
String typename= getSuperClass();
if (fIsClass && typename.length() > 0 && !"java.lang.Object".equals(typename)) {
buf.append(" extends ");
buf.append(Signature.getSimpleName(typename));
if (fSuperClass != null) {
imports.addImport(JavaModelUtil.getFullyQualifiedName(fSuperClass));
} else {
imports.addImport(typename);
}
}
}
private void writeSuperInterfaces(StringBuffer buf, IImportsStructure imports) {
List interfaces= getSuperInterfaces();
int last= interfaces.size() - 1;
if (last >= 0) {
if (fIsClass) {
buf.append(" implements ");
} else {
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
buf.append(" extends ");
}
for (int i= 0; i <= last; i++) {
String typename= (String) interfaces.get(i);
imports.addImport(typename);
buf.append(Signature.getSimpleName(typename));
if (i < last) {
buf.append(',');
}
}
}
}
/*
* Called from createType to construct the source for this type
*/
private String constructTypeStub(IImportsStructure imports, String lineDelimiter, ICompilationUnit parentCU) {
StringBuffer buf= new StringBuffer();
String typeComment= getTypeComment(parentCU);
if (typeComment != null && typeComment.length() > 0) {
buf.append(typeComment);
buf.append(lineDelimiter);
}
int modifiers= getModifiers();
buf.append(Flags.toString(modifiers));
if (modifiers != 0) {
buf.append(' ');
}
buf.append(fIsClass ? "class " : "interface ");
buf.append(getTypeName());
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
writeSuperClass(buf, imports);
writeSuperInterfaces(buf, imports);
buf.append('{');
buf.append(lineDelimiter);
buf.append(lineDelimiter);
buf.append('}');
buf.append(lineDelimiter);
return buf.toString();
}
/**
* Called from createType to allow adding methods, fielse, inner types ect for the newly created type.
* Implementors can use the create methods on the new type.
* Formatting will be applied to the content by the createType
* @param newType The new type to add members to
* @param imports To add the needed imports to.
* @param monitor Progress monitor
*/
protected void createTypeMembers(IType newType, IImportsStructure imports, IProgressMonitor monitor) throws CoreException {
}
/**
* Called from createType to get a file comment. By default the content of template
* 'filecomment' is taken.
* Returns source or null, if no file comment should be added
*/
protected String getFileComment(ICompilationUnit parentCU) {
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
if (CodeGenerationPreferencePage.doFileComments()) {
return getTemplate("filecomment", parentCU);
}
return null;
}
/**
* Called from createType to get a type comment.
* Returns source or null, if no type comment should be added
*/
protected String getTypeComment(ICompilationUnit parentCU) {
if (CodeGenerationPreferencePage.doCreateComments()) {
return getTemplate("typecomment", parentCU);
}
return null;
}
/**
* Gets the template of the given name, evaluated in the context of a CU.
*/
protected String getTemplate(String name, ICompilationUnit parentCU) {
try {
Template[] templates= Templates.getInstance().getTemplates(name);
if (templates.length > 0) {
return JavaContext.evaluateTemplate(templates[0], parentCU);
}
} catch (CoreException e) {
JavaPlugin.log(e);
}
return null;
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
}
/**
* Creates the bodies of all unimplemented methods or/and all constructors and adds them to the type
* Can be used by implementors of NewTypeWizardPage to add method stub checkboxes.
*/
protected IMethod[] createInheritedMethods(IType type, boolean doConstructors, boolean doUnimplementedMethods, IImportsStructure imports, IProgressMonitor monitor) throws CoreException {
List newMethods= new ArrayList();
ITypeHierarchy hierarchy= type.newSupertypeHierarchy(monitor);
CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings();
if (doConstructors) {
IType superclass= hierarchy.getSuperclass(type);
if (superclass != null) {
String[] constructors= StubUtility.evalConstructors(type, superclass, settings, imports);
if (constructors != null) {
for (int i= 0; i < constructors.length; i++) {
newMethods.add(constructors[i]);
}
}
}
}
if (doUnimplementedMethods) {
String[] unimplemented= StubUtility.evalUnimplementedMethods(type, hierarchy, false, settings, null, imports);
if (unimplemented != null) {
for (int i= 0; i < unimplemented.length; i++) {
newMethods.add(unimplemented[i]);
}
}
}
|
14,368 |
Bug 14368 Create getter and setter insert code into read-only file
|
1. Create a class C as follow: package jp1; public class C { private int id; } 2. Close it and mark it as read only 3. Reopen it and you should not be able to modify anything 4. From the outline view, select "id - int" and right mouse click and select "Create getter and setter". 5. The class becomes package jp1; public class C { private int id; /** * Gets the id. * @return Returns a int */ public int getId() { return id; } /** * Sets the id. * @param id The id to set */ public void setId(int id) { this.id = id; } } and the editor is dirty, but you cannot save it until clear the read-only flag.
|
resolved fixed
|
e6ed913
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T12:41:25Z | 2002-04-22T21:13:20Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
|
IMethod[] createdMethods= new IMethod[newMethods.size()];
for (int i= 0; i < newMethods.size(); i++) {
String content= (String) newMethods.get(i) + "\n";
createdMethods[i]= type.createMethod(content, null, false, null);
}
return createdMethods;
}
/**
* Returns a runnable that creates a type using the current settings.
* To be called in the UI thread.
*/
public IRunnableWithProgress getRunnable() {
return new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
if (monitor == null) {
monitor= new NullProgressMonitor();
}
createType(monitor);
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
}
};
}
}
|
14,572 |
Bug 14572 JavaCapatibilityConfigurationPage.java misspelled
|
org.eclipse.jdt.ui.wizards.JavaCapatibilityConfigurationPage.java Should probably be spelled: org.eclipse.jdt.ui.wizards.JavaCapabilityConfigurationPage.java (capability instead of capatibility)
|
resolved fixed
|
d9209ec
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T15:10:20Z | 2002-04-25T02:00:00Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/JavaCapabilityWizard.java
|
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.internal.ui.wizards;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.ICapabilityInstallWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
import org.eclipse.jdt.ui.wizards.JavaCapatibilityConfigurationPage;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.JavaPluginImages;
import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
public class JavaCapabilityWizard extends Wizard implements ICapabilityInstallWizard {
|
14,572 |
Bug 14572 JavaCapatibilityConfigurationPage.java misspelled
|
org.eclipse.jdt.ui.wizards.JavaCapatibilityConfigurationPage.java Should probably be spelled: org.eclipse.jdt.ui.wizards.JavaCapabilityConfigurationPage.java (capability instead of capatibility)
|
resolved fixed
|
d9209ec
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T15:10:20Z | 2002-04-25T02:00:00Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/JavaCapabilityWizard.java
|
private JavaCapatibilityConfigurationPage fJavaPage;
private IProject fProject;
public JavaCapabilityWizard() {
super();
setDefaultPageImageDescriptor(JavaPluginImages.DESC_WIZBAN_NEWJPRJ);
setDialogSettings(JavaPlugin.getDefault().getDialogSettings());
setWindowTitle(NewWizardMessages.getString("JavaCapabilityWizard.title"));
}
/*
* @see ICapabilityWizard#init(IWorkbench, IStructuredSelection, IProject)
*/
public void init(IWorkbench workbench, IStructuredSelection selection, IProject project) {
|
14,572 |
Bug 14572 JavaCapatibilityConfigurationPage.java misspelled
|
org.eclipse.jdt.ui.wizards.JavaCapatibilityConfigurationPage.java Should probably be spelled: org.eclipse.jdt.ui.wizards.JavaCapabilityConfigurationPage.java (capability instead of capatibility)
|
resolved fixed
|
d9209ec
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T15:10:20Z | 2002-04-25T02:00:00Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/JavaCapabilityWizard.java
|
fProject= project;
}
/*
* @see Wizard#addPages
*/
public void addPages() {
super.addPages();
IWorkspaceRoot root= JavaPlugin.getWorkspace().getRoot();
fJavaPage= new JavaCapatibilityConfigurationPage(fProject);
addPage(fJavaPage);
}
/*
* @see Wizard#performFinish
*/
public boolean performFinish() {
IRunnableWithProgress op= new WorkspaceModifyDelegatingOperation(fJavaPage.getRunnable());
try {
getContainer().run(false, true, op);
} catch (InvocationTargetException e) {
String title= NewWizardMessages.getString("JavaCapabilityWizard.op_error.title");
String message= NewWizardMessages.getString("JavaCapabilityWizard.op_error.message");
ExceptionHandler.handle(e, getShell(), title, message);
return false;
} catch (InterruptedException e) {
return false;
}
return true;
}
}
|
14,572 |
Bug 14572 JavaCapatibilityConfigurationPage.java misspelled
|
org.eclipse.jdt.ui.wizards.JavaCapatibilityConfigurationPage.java Should probably be spelled: org.eclipse.jdt.ui.wizards.JavaCapabilityConfigurationPage.java (capability instead of capatibility)
|
resolved fixed
|
d9209ec
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T15:10:20Z | 2002-04-25T02:00:00Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/JavaCapatibilityConfigurationPage.java
|
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
package org.eclipse.jdt.ui.wizards;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
|
14,572 |
Bug 14572 JavaCapatibilityConfigurationPage.java misspelled
|
org.eclipse.jdt.ui.wizards.JavaCapatibilityConfigurationPage.java Should probably be spelled: org.eclipse.jdt.ui.wizards.JavaCapabilityConfigurationPage.java (capability instead of capatibility)
|
resolved fixed
|
d9209ec
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T15:10:20Z | 2002-04-25T02:00:00Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/JavaCapatibilityConfigurationPage.java
|
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages;
import org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildPathsBlock;
/**
* Wizard page to be used for capability wizards that want to configure Java build page.
*/
public class JavaCapatibilityConfigurationPage extends NewElementWizardPage {
private static final String PAGE_NAME= "NewJavaProjectWizardPage";
private IJavaProject fJavaProject;
private BuildPathsBlock fBuildPathsBlock;
/**
* Creates a Java project wizard creation page.
|
14,572 |
Bug 14572 JavaCapatibilityConfigurationPage.java misspelled
|
org.eclipse.jdt.ui.wizards.JavaCapatibilityConfigurationPage.java Should probably be spelled: org.eclipse.jdt.ui.wizards.JavaCapabilityConfigurationPage.java (capability instead of capatibility)
|
resolved fixed
|
d9209ec
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T15:10:20Z | 2002-04-25T02:00:00Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/JavaCapatibilityConfigurationPage.java
|
* <p>
* The Java project wizard reads project name and location from the main page.
* </p>
*
* @param project the project to configure
*/
public JavaCapatibilityConfigurationPage(IProject project) {
super(PAGE_NAME);
fJavaProject= JavaCore.create(project);
setTitle(NewWizardMessages.getString("NewJavaProjectWizardPage.title"));
setDescription(NewWizardMessages.getString("NewJavaProjectWizardPage.description"));
IStatusChangeListener listener= new IStatusChangeListener() {
public void statusChanged(IStatus status) {
updateStatus(status);
}
};
fBuildPathsBlock= new BuildPathsBlock(ResourcesPlugin.getWorkspace().getRoot(), listener, true);
fBuildPathsBlock.init(fJavaProject, null, null);
}
/**
* Sets the build paths to be used as default by the new Java project.
* <p>
* The caller of this method is responsible for creating the classpath entries
* for the <code>IJavaProject</code> that corresponds to the created project.
* The caller is responsible for creating any new folders that might be mentioned
* on the classpath.
* </p>
|
14,572 |
Bug 14572 JavaCapatibilityConfigurationPage.java misspelled
|
org.eclipse.jdt.ui.wizards.JavaCapatibilityConfigurationPage.java Should probably be spelled: org.eclipse.jdt.ui.wizards.JavaCapabilityConfigurationPage.java (capability instead of capatibility)
|
resolved fixed
|
d9209ec
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T15:10:20Z | 2002-04-25T02:00:00Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/JavaCapatibilityConfigurationPage.java
|
* <p>
* The wizard will create the output folder if required.
* </p>
*
*
* @param entries the default classpath entries or <code>null</code> to take the default
* @param path the folder to be taken as the default output path or <code>null</code> to take the default
* @return overrideExistingClasspath If set to true, an existing '.classpath' file is ignored. If set to <code>false</code>
* the default classpath is only used if no '.classpath' exists.
*/
public void setDefaultPaths(IPath outputLocation, IClasspathEntry[] entries, boolean overrideExistingClasspath) {
if (!overrideExistingClasspath && fJavaProject.getProject().getFile(".classpath").exists()) {
entries= null;
outputLocation= null;
}
fBuildPathsBlock.init(fJavaProject, outputLocation, entries);
}
/* (non-Javadoc)
* @see WizardPage#createControl
*/
public void createControl(Composite parent) {
Control control= fBuildPathsBlock.createControl(parent);
setControl(control);
WorkbenchHelp.setHelp(control, IJavaHelpContextIds.NEW_JAVAPROJECT_WIZARD_PAGE);
}
/**
* Returns the currently configured output location. Note that the returned path must not be valid.
|
14,572 |
Bug 14572 JavaCapatibilityConfigurationPage.java misspelled
|
org.eclipse.jdt.ui.wizards.JavaCapatibilityConfigurationPage.java Should probably be spelled: org.eclipse.jdt.ui.wizards.JavaCapabilityConfigurationPage.java (capability instead of capatibility)
|
resolved fixed
|
d9209ec
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T15:10:20Z | 2002-04-25T02:00:00Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/JavaCapatibilityConfigurationPage.java
|
*/
public IPath getOutputLocation() {
return fBuildPathsBlock.getOutputLocation();
}
/**
* Returns the currently configured class path. Note that the class path must not be valid.
*/
public IClasspathEntry[] getRawClassPath() {
return fBuildPathsBlock.getRawClassPath();
}
/**
* Returns the runnable that will create the Java project.
* The runnable sets the project's classpath and output location to the values configured in the page.
*
* @return the runnable
*/
public IRunnableWithProgress getRunnable() {
return new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
if (monitor == null) {
monitor= new NullProgressMonitor();
}
int nSteps= 10;
monitor.beginTask(NewWizardMessages.getString("NewJavaProjectWizardPage.op_desc"), nSteps);
try {
IProject project= fJavaProject.getProject();
if (!project.hasNature(JavaCore.NATURE_ID)) {
addNatureToProject(project, JavaCore.NATURE_ID, new SubProgressMonitor(monitor, 1));
|
14,572 |
Bug 14572 JavaCapatibilityConfigurationPage.java misspelled
|
org.eclipse.jdt.ui.wizards.JavaCapatibilityConfigurationPage.java Should probably be spelled: org.eclipse.jdt.ui.wizards.JavaCapabilityConfigurationPage.java (capability instead of capatibility)
|
resolved fixed
|
d9209ec
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-26T15:10:20Z | 2002-04-25T02:00:00Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/JavaCapatibilityConfigurationPage.java
|
nSteps--;
}
IRunnableWithProgress jrunnable= fBuildPathsBlock.getRunnable();
jrunnable.run(new SubProgressMonitor(monitor, nSteps));
} catch (CoreException e) {
throw new InvocationTargetException(e);
} finally {
monitor.done();
}
}
};
}
/**
* Adds a nature to a project
*/
private static void addNatureToProject(IProject proj, String natureId, IProgressMonitor monitor) throws CoreException {
IProjectDescription description = proj.getDescription();
String[] prevNatures= description.getNatureIds();
String[] newNatures= new String[prevNatures.length + 1];
System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
newNatures[prevNatures.length]= natureId;
description.setNatureIds(newNatures);
proj.setDescription(description, monitor);
}
}
|
14,891 |
Bug 14891 NPE during organize imports
|
Build 20020425.3 java.lang.NullPointerException Stack trace: java/lang/Throwable.<init>()V java/lang/Throwable.<init>(Ljava/lang/String;)V java/lang/NullPointerException.<init>(Ljava/lang/String;)V org/eclipse/jdt/ui/actions/OrganizeImportsAction.setStatusBarMessage (Ljava/lang/String;)V org/eclipse/jdt/ui/actions/OrganizeImportsAction.runOnSingle (Lorg/eclipse/jdt/core/ICompilationUnit;Z)V org/eclipse/jdt/ui/actions/OrganizeImportsAction.run (Lorg/eclipse/jface/viewers/IStructuredSelection;)V org/eclipse/jdt/ui/actions/SelectionDispatchAction.dispatchRun (Lorg/eclipse/jface/viewers/ISelection;)V org/eclipse/jdt/ui/actions/SelectionDispatchAction.run()V org/eclipse/jface/action/Action.runWithEvent(Lorg/eclipse/swt/widgets/Event;) V org/eclipse/jface/action/ActionContributionItem.handleWidgetSelection (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/jface/action/ActionContributionItem.handleWidgetEvent (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/jface/action/ActionContributionItem.access$0 (Lorg/eclipse/jface/action/ActionContributionItem;Lorg/eclipse/swt/widgets/Event ;)V org/eclipse/jface/action/ActionContributionItem$ActionListener.handleEvent (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/EventTable.sendEvent(Lorg/eclipse/swt/widgets/Event;) V org/eclipse/swt/widgets/Widget.notifyListeners (ILorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/Display.runDeferredEvents()Z org/eclipse/swt/widgets/Display.readAndDispatch()Z org/eclipse/ui/internal/Workbench.runEventLoop()V org/eclipse/ui/internal/Workbench.run(Ljava/lang/Object;)Ljava/lang/Object; org/eclipse/core/internal/boot/InternalBootLoader.run (Ljava/lang/String;Ljava/net/URL;Ljava/lang/String; [Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Object; org/eclipse/core/boot/BootLoader.run (Ljava/lang/String;Ljava/net/URL;Ljava/lang/String;[Ljava/lang/String;) Ljava/lang/Object; EclipseRuntimeLauncher.main([Ljava/lang/String;)V
|
resolved fixed
|
d8124c0
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-30T12:08:21Z | 2002-04-30T09:46:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
|
package org.eclipse.jdt.ui.actions;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.HashSet;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IEditorActionBarContributor;
|
14,891 |
Bug 14891 NPE during organize imports
|
Build 20020425.3 java.lang.NullPointerException Stack trace: java/lang/Throwable.<init>()V java/lang/Throwable.<init>(Ljava/lang/String;)V java/lang/NullPointerException.<init>(Ljava/lang/String;)V org/eclipse/jdt/ui/actions/OrganizeImportsAction.setStatusBarMessage (Ljava/lang/String;)V org/eclipse/jdt/ui/actions/OrganizeImportsAction.runOnSingle (Lorg/eclipse/jdt/core/ICompilationUnit;Z)V org/eclipse/jdt/ui/actions/OrganizeImportsAction.run (Lorg/eclipse/jface/viewers/IStructuredSelection;)V org/eclipse/jdt/ui/actions/SelectionDispatchAction.dispatchRun (Lorg/eclipse/jface/viewers/ISelection;)V org/eclipse/jdt/ui/actions/SelectionDispatchAction.run()V org/eclipse/jface/action/Action.runWithEvent(Lorg/eclipse/swt/widgets/Event;) V org/eclipse/jface/action/ActionContributionItem.handleWidgetSelection (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/jface/action/ActionContributionItem.handleWidgetEvent (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/jface/action/ActionContributionItem.access$0 (Lorg/eclipse/jface/action/ActionContributionItem;Lorg/eclipse/swt/widgets/Event ;)V org/eclipse/jface/action/ActionContributionItem$ActionListener.handleEvent (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/EventTable.sendEvent(Lorg/eclipse/swt/widgets/Event;) V org/eclipse/swt/widgets/Widget.notifyListeners (ILorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/Display.runDeferredEvents()Z org/eclipse/swt/widgets/Display.readAndDispatch()Z org/eclipse/ui/internal/Workbench.runEventLoop()V org/eclipse/ui/internal/Workbench.run(Ljava/lang/Object;)Ljava/lang/Object; org/eclipse/core/internal/boot/InternalBootLoader.run (Ljava/lang/String;Ljava/net/URL;Ljava/lang/String; [Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Object; org/eclipse/core/boot/BootLoader.run (Ljava/lang/String;Ljava/net/URL;Ljava/lang/String;[Ljava/lang/String;) Ljava/lang/Object; EclipseRuntimeLauncher.main([Ljava/lang/String;)V
|
resolved fixed
|
d8124c0
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-30T12:08:21Z | 2002-04-30T09:46:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
|
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.ui.part.EditorActionBarContributor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.ui.IWorkingCopyManager;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation;
import org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation.IChooseImportQuery;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.corext.util.TypeInfo;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.actions.ActionMessages;
import org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter;
import org.eclipse.jdt.internal.ui.dialogs.MultiElementListSelectionDialog;
import org.eclipse.jdt.internal.ui.dialogs.ProblemDialog;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
import org.eclipse.jdt.internal.ui.preferences.ImportOrganizePreferencePage;
import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext;
import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
import org.eclipse.jdt.internal.ui.util.TypeInfoLabelProvider;
public class OrganizeImportsAction extends SelectionDispatchAction {
|
14,891 |
Bug 14891 NPE during organize imports
|
Build 20020425.3 java.lang.NullPointerException Stack trace: java/lang/Throwable.<init>()V java/lang/Throwable.<init>(Ljava/lang/String;)V java/lang/NullPointerException.<init>(Ljava/lang/String;)V org/eclipse/jdt/ui/actions/OrganizeImportsAction.setStatusBarMessage (Ljava/lang/String;)V org/eclipse/jdt/ui/actions/OrganizeImportsAction.runOnSingle (Lorg/eclipse/jdt/core/ICompilationUnit;Z)V org/eclipse/jdt/ui/actions/OrganizeImportsAction.run (Lorg/eclipse/jface/viewers/IStructuredSelection;)V org/eclipse/jdt/ui/actions/SelectionDispatchAction.dispatchRun (Lorg/eclipse/jface/viewers/ISelection;)V org/eclipse/jdt/ui/actions/SelectionDispatchAction.run()V org/eclipse/jface/action/Action.runWithEvent(Lorg/eclipse/swt/widgets/Event;) V org/eclipse/jface/action/ActionContributionItem.handleWidgetSelection (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/jface/action/ActionContributionItem.handleWidgetEvent (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/jface/action/ActionContributionItem.access$0 (Lorg/eclipse/jface/action/ActionContributionItem;Lorg/eclipse/swt/widgets/Event ;)V org/eclipse/jface/action/ActionContributionItem$ActionListener.handleEvent (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/EventTable.sendEvent(Lorg/eclipse/swt/widgets/Event;) V org/eclipse/swt/widgets/Widget.notifyListeners (ILorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/Display.runDeferredEvents()Z org/eclipse/swt/widgets/Display.readAndDispatch()Z org/eclipse/ui/internal/Workbench.runEventLoop()V org/eclipse/ui/internal/Workbench.run(Ljava/lang/Object;)Ljava/lang/Object; org/eclipse/core/internal/boot/InternalBootLoader.run (Ljava/lang/String;Ljava/net/URL;Ljava/lang/String; [Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Object; org/eclipse/core/boot/BootLoader.run (Ljava/lang/String;Ljava/net/URL;Ljava/lang/String;[Ljava/lang/String;) Ljava/lang/Object; EclipseRuntimeLauncher.main([Ljava/lang/String;)V
|
resolved fixed
|
d8124c0
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-30T12:08:21Z | 2002-04-30T09:46:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
|
private JavaEditor fEditor;
/* (non-Javadoc)
* Class implements IObjectActionDelegate
*/
public static class ObjectDelegate implements IObjectActionDelegate {
private OrganizeImportsAction fAction;
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
fAction= new OrganizeImportsAction(targetPart.getSite());
}
public void run(IAction action) {
fAction.run();
}
public void selectionChanged(IAction action, ISelection selection) {
if (fAction == null)
action.setEnabled(false);
}
}
public OrganizeImportsAction(IWorkbenchSite site) {
super(site);
setText(ActionMessages.getString("OrganizeImportsAction.label"));
setToolTipText(ActionMessages.getString("OrganizeImportsAction.tooltip"));
setDescription(ActionMessages.getString("OrganizeImportsAction.description"));
WorkbenchHelp.setHelp(this, IJavaHelpContextIds.ORGANIZE_IMPORTS_ACTION);
}
/**
* Creates a new <code>OrganizeImportsAction</code>.
* <p>
|
14,891 |
Bug 14891 NPE during organize imports
|
Build 20020425.3 java.lang.NullPointerException Stack trace: java/lang/Throwable.<init>()V java/lang/Throwable.<init>(Ljava/lang/String;)V java/lang/NullPointerException.<init>(Ljava/lang/String;)V org/eclipse/jdt/ui/actions/OrganizeImportsAction.setStatusBarMessage (Ljava/lang/String;)V org/eclipse/jdt/ui/actions/OrganizeImportsAction.runOnSingle (Lorg/eclipse/jdt/core/ICompilationUnit;Z)V org/eclipse/jdt/ui/actions/OrganizeImportsAction.run (Lorg/eclipse/jface/viewers/IStructuredSelection;)V org/eclipse/jdt/ui/actions/SelectionDispatchAction.dispatchRun (Lorg/eclipse/jface/viewers/ISelection;)V org/eclipse/jdt/ui/actions/SelectionDispatchAction.run()V org/eclipse/jface/action/Action.runWithEvent(Lorg/eclipse/swt/widgets/Event;) V org/eclipse/jface/action/ActionContributionItem.handleWidgetSelection (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/jface/action/ActionContributionItem.handleWidgetEvent (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/jface/action/ActionContributionItem.access$0 (Lorg/eclipse/jface/action/ActionContributionItem;Lorg/eclipse/swt/widgets/Event ;)V org/eclipse/jface/action/ActionContributionItem$ActionListener.handleEvent (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/EventTable.sendEvent(Lorg/eclipse/swt/widgets/Event;) V org/eclipse/swt/widgets/Widget.notifyListeners (ILorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/Display.runDeferredEvents()Z org/eclipse/swt/widgets/Display.readAndDispatch()Z org/eclipse/ui/internal/Workbench.runEventLoop()V org/eclipse/ui/internal/Workbench.run(Ljava/lang/Object;)Ljava/lang/Object; org/eclipse/core/internal/boot/InternalBootLoader.run (Ljava/lang/String;Ljava/net/URL;Ljava/lang/String; [Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Object; org/eclipse/core/boot/BootLoader.run (Ljava/lang/String;Ljava/net/URL;Ljava/lang/String;[Ljava/lang/String;) Ljava/lang/Object; EclipseRuntimeLauncher.main([Ljava/lang/String;)V
|
resolved fixed
|
d8124c0
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-30T12:08:21Z | 2002-04-30T09:46:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
|
* Note: This constructor is for internal use only. Clients should not call this constructor.
* </p>
*/
public OrganizeImportsAction(JavaEditor editor) {
this(editor.getEditorSite());
fEditor= editor;
}
/* (non-Javadoc)
* Method declared on SelectionDispatchAction.
*/
protected void selectionChanged(ITextSelection selection) {
boolean isEnabled= false;
try {
if (fEditor != null) {
IWorkingCopyManager manager= JavaPlugin.getDefault().getWorkingCopyManager();
ICompilationUnit cu= manager.getWorkingCopy(fEditor.getEditorInput());
isEnabled= JavaModelUtil.isEditable(cu);
}
} catch (JavaModelException e) {
}
setEnabled(isEnabled);
}
/* (non-Javadoc)
* Method declared on SelectionDispatchAction.
*/
protected void selectionChanged(IStructuredSelection selection) {
ICompilationUnit[] cus= getCompilationUnits(selection);
boolean isEnabled= cus.length > 0;
|
14,891 |
Bug 14891 NPE during organize imports
|
Build 20020425.3 java.lang.NullPointerException Stack trace: java/lang/Throwable.<init>()V java/lang/Throwable.<init>(Ljava/lang/String;)V java/lang/NullPointerException.<init>(Ljava/lang/String;)V org/eclipse/jdt/ui/actions/OrganizeImportsAction.setStatusBarMessage (Ljava/lang/String;)V org/eclipse/jdt/ui/actions/OrganizeImportsAction.runOnSingle (Lorg/eclipse/jdt/core/ICompilationUnit;Z)V org/eclipse/jdt/ui/actions/OrganizeImportsAction.run (Lorg/eclipse/jface/viewers/IStructuredSelection;)V org/eclipse/jdt/ui/actions/SelectionDispatchAction.dispatchRun (Lorg/eclipse/jface/viewers/ISelection;)V org/eclipse/jdt/ui/actions/SelectionDispatchAction.run()V org/eclipse/jface/action/Action.runWithEvent(Lorg/eclipse/swt/widgets/Event;) V org/eclipse/jface/action/ActionContributionItem.handleWidgetSelection (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/jface/action/ActionContributionItem.handleWidgetEvent (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/jface/action/ActionContributionItem.access$0 (Lorg/eclipse/jface/action/ActionContributionItem;Lorg/eclipse/swt/widgets/Event ;)V org/eclipse/jface/action/ActionContributionItem$ActionListener.handleEvent (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/EventTable.sendEvent(Lorg/eclipse/swt/widgets/Event;) V org/eclipse/swt/widgets/Widget.notifyListeners (ILorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/Display.runDeferredEvents()Z org/eclipse/swt/widgets/Display.readAndDispatch()Z org/eclipse/ui/internal/Workbench.runEventLoop()V org/eclipse/ui/internal/Workbench.run(Ljava/lang/Object;)Ljava/lang/Object; org/eclipse/core/internal/boot/InternalBootLoader.run (Ljava/lang/String;Ljava/net/URL;Ljava/lang/String; [Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Object; org/eclipse/core/boot/BootLoader.run (Ljava/lang/String;Ljava/net/URL;Ljava/lang/String;[Ljava/lang/String;) Ljava/lang/Object; EclipseRuntimeLauncher.main([Ljava/lang/String;)V
|
resolved fixed
|
d8124c0
|
JDT
|
https://github.com/eclipse-jdt/eclipse.jdt.ui
|
eclipse-jdt/eclipse.jdt.ui
|
java
| null | null | null | 2002-04-30T12:08:21Z | 2002-04-30T09:46:40Z |
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
|
try {
for (int i= 0; i < cus.length; i++) {
if (!JavaModelUtil.isEditable(cus[i])) {
isEnabled= false;
break;
}
}
} catch (JavaModelException e) {
JavaPlugin.log(e);
}
setEnabled(isEnabled);
}
private ICompilationUnit[] getCompilationUnits(IStructuredSelection selection) {
HashSet result= new HashSet();
Object[] selected= selection.toArray();
for (int i= 0; i < selected.length; i++) {
try {
if (selected[i] instanceof IJavaElement) {
IJavaElement elem= (IJavaElement) selected[i];
switch (elem.getElementType()) {
case IJavaElement.COMPILATION_UNIT:
result.add(elem);
break;
case IJavaElement.IMPORT_CONTAINER:
result.add(elem.getParent());
break;
case IJavaElement.PACKAGE_FRAGMENT:
IPackageFragment pack= (IPackageFragment) elem;
result.addAll(Arrays.asList(pack.getCompilationUnits()));
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.