Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/wizard/NewFileWizard.java

Issue 8341060: Fix for Issue 193 (http://code.google.com/p/dart/issues/detail?id=193). When the user starts the ... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/generator/FileGenerator.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/wizard/NewFileWizard.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/wizard/NewFileWizard.java (revision 724)
+++ editor/tools/plugins/com.google.dart.tools.ui/src/com/google/dart/tools/ui/wizard/NewFileWizard.java (working copy)
@@ -15,8 +15,10 @@
import com.google.dart.tools.core.DartCore;
import com.google.dart.tools.core.generator.FileGenerator;
+import com.google.dart.tools.core.internal.model.CompilationUnitImpl;
import com.google.dart.tools.core.internal.model.DartLibraryImpl;
import com.google.dart.tools.core.internal.model.ExternalCompilationUnitImpl;
+import com.google.dart.tools.core.model.CompilationUnit;
import com.google.dart.tools.core.model.DartElement;
import com.google.dart.tools.ui.DartToolsPlugin;
import com.google.dart.tools.ui.DartUI;
@@ -120,6 +122,16 @@
// If we couldn't open as an external unit, fall through to try the default approach.
}
}
+ if (element instanceof CompilationUnitImpl) {
+ CompilationUnit cu = (CompilationUnitImpl) element;
+ if (cu.definesLibrary()) {
+ // Re-set the top-level to be true, to trigger a refresh on the libraries view.
+ // This covers the case where the new file wizard is being used to generate a new
+ // library, in which case the library model element was not available to set the
+ // top-level flag. See FileGenerator#execute().
+ cu.getLibrary().setTopLevel(true);
+ }
+ }
if (!openEditor(DartUI.ID_CU_EDITOR, file)) {
openEditor(DartUI.ID_DEFAULT_TEXT_EDITOR, file);
}
« no previous file with comments | « editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/generator/FileGenerator.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698