From: <ox-...@us...> - 2003-04-01 08:28:01
|
Update of /cvsroot/sheets/sheets In directory sc8-pr-cvs1:/tmp/cvs-serv13205 Modified Files: Sheets.sheets todo.txt Log Message: Don't unnecessarily mark files as dirty on import Distinguish between dirty files and files that should be "touched" When importing, do not populate default project import location. Empty project root was causing problems on default import entry Index: Sheets.sheets =================================================================== RCS file: /cvsroot/sheets/sheets/Sheets.sheets,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** Sheets.sheets 1 Apr 2003 02:21:07 -0000 1.33 --- Sheets.sheets 1 Apr 2003 08:25:55 -0000 1.34 *************** *** 5038,5049 **** } } - // Don't bother exporting imported classes if the location is the same - try { - if (classComp.getExportLocation(Project.findProject(project)).getCanonicalFile().equals(file.getCanonicalFile())) { - classComp.classDirty = false; - } - } catch (IOException e) { - // guess the class is dirty... - } } else if (comp instanceof JavaFileHeaderFragment) { String newPkg = comp.trueNameString(); --- 5038,5041 ---- *************** *** 5065,5068 **** --- 5057,5061 ---- } + // Add separators between multiple classes in the same file Fragment[] comps = new Fragment[contents.length + extraFrags]; for (int i = 0, j = 0; i < contents.length; i++) { *************** *** 5086,5089 **** --- 5079,5100 ---- } } + + // If the export location is the same as the location we imported from, then mark it as clean + for (int i = 0, j = 0; i < contents.length; i++) { + if (contents[i] == null) + continue; + if (contents[i] instanceof JavaClassFragment && + ((JavaClassFragment)contents[i]).trueName.length == 1) { + JavaClassFragment classComp = (JavaClassFragment)contents[i]; + try { + if (classComp.getExportLocation(Project.findProject(project)).getCanonicalFile().equals(file.getCanonicalFile())) { + classComp.classDirty = false; + } + } catch (IOException e) { + // leave the class as dirty... + } + } + } + return result; } *************** *** 5462,5465 **** --- 5473,5477 ---- wlott:2643 wlott:2664 + schin:1229 wlott:2629 wlott:2639 *************** *** 62166,62176 **** Query query = new JavaFragmentUsesQuery(this); Fragment[] calls = query.getQueryResults(null); ! // Affected items really ought to be recompiled. Hack: Marking the class ! // as dirty is actually slight overkill, but it's what we have the hooks ! // for. for (int i = 0; i < calls.length; i++) { JavaClassInterface cls = ((JavaFragment)calls[i]).enclosingClass(); if (cls instanceof JavaClassFragment) ! ((JavaClassFragment)cls).setClassDirty(); } Vector result = VectorUtils.make(calls); --- 62178,62186 ---- Query query = new JavaFragmentUsesQuery(this); Fragment[] calls = query.getQueryResults(null); ! // Affected items really ought to be recompiled. for (int i = 0; i < calls.length; i++) { JavaClassInterface cls = ((JavaFragment)calls[i]).enclosingClass(); if (cls instanceof JavaClassFragment) ! ((JavaClassFragment)cls).touchForRecompile(); } Vector result = VectorUtils.make(calls); *************** *** 62198,62208 **** Query query = new JavaFragmentUsesQuery(this); Fragment[] calls = query.getQueryResults(null); ! // Affected items really ought to be recompiled. Hack: Marking the class ! // as dirty is actually slight overkill, but it's what we have the hooks ! // for. for (int i = 0; i < calls.length; i++) { JavaClassInterface cls = ((JavaFragment)calls[i]).enclosingClass(); if (cls instanceof JavaClassFragment) ! ((JavaClassFragment)cls).setClassDirty(); } Vector result = VectorUtils.make(calls); --- 62208,62216 ---- Query query = new JavaFragmentUsesQuery(this); Fragment[] calls = query.getQueryResults(null); ! // Affected items really ought to be recompiled. for (int i = 0; i < calls.length; i++) { JavaClassInterface cls = ((JavaFragment)calls[i]).enclosingClass(); if (cls instanceof JavaClassFragment) ! ((JavaClassFragment)cls).touchForRecompile(); } Vector result = VectorUtils.make(calls); *************** *** 62230,62240 **** Query query = new JavaFragmentUsesQuery(this); Fragment[] calls = query.getQueryResults(null); ! // Affected items really ought to be recompiled. Hack: Marking the class ! // as dirty is actually slight overkill, but it's what we have the hooks ! // for. for (int i = 0; i < calls.length; i++) { JavaClassInterface cls = ((JavaFragment)calls[i]).enclosingClass(); if (cls instanceof JavaClassFragment) ! ((JavaClassFragment)cls).setClassDirty(); } Vector result = VectorUtils.make(calls); --- 62238,62246 ---- Query query = new JavaFragmentUsesQuery(this); Fragment[] calls = query.getQueryResults(null); ! // Affected items really ought to be recompiled. for (int i = 0; i < calls.length; i++) { JavaClassInterface cls = ((JavaFragment)calls[i]).enclosingClass(); if (cls instanceof JavaClassFragment) ! ((JavaClassFragment)cls).touchForRecompile(); } Vector result = VectorUtils.make(calls); *************** *** 73669,73673 **** importFiles.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ! setNext(new FileImportCard()); templateList.setEnabled(false); } --- 73675,73679 ---- importFiles.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ! setNext(new FileImportCard(true)); templateList.setEnabled(false); } *************** *** 73767,73771 **** type=java section text schin:363 ! WizardCard ProjectContentsCard.next = new FileImportCard(); object schin:364 pkg=org.browsecode.sheets.archive --- 73773,73777 ---- type=java section text schin:363 ! WizardCard ProjectContentsCard.next = new FileImportCard(true); object schin:364 pkg=org.browsecode.sheets.archive *************** *** 73803,73806 **** --- 73809,73815 ---- public class FileImportCard extends StyledDocumentCard section exports schin:368 + schin:1230 + schin:1231 + schin:1232 schin:401 schin:370 *************** *** 74097,74101 **** section text schin:397 FileImportCard.ImportItem(File file) { ! this.file = file; importType = fullSourceButton; exportLocation = relativeExportButton; --- 74106,74114 ---- section text schin:397 FileImportCard.ImportItem(File file) { ! // Work around a bug with an empty directory name: ! if (file.getName().equals("")) ! this.file = new File("."); ! else ! this.file = file; importType = fullSourceButton; exportLocation = relativeExportButton; *************** *** 74148,74155 **** if (rootImportItem != null) importModel.removeElement(rootImportItem); ! String projectName = (String)getProperty("project"); ! Project project = Project.findProject(projectName); ! if (project != null && project.getRootFrag() != null) ! importModel.add(0, rootImportItem = new ImportItem(new File(project.getRootFrag().root))); } object schin:403 --- 74161,74170 ---- if (rootImportItem != null) importModel.removeElement(rootImportItem); ! if (addProjectRoot) { ! String projectName = (String)getProperty("project"); ! Project project = Project.findProject(projectName); ! if (project != null && project.getRootFrag() != null) ! importModel.add(0, rootImportItem = new ImportItem(new File(project.getRootFrag().root))); ! } } object schin:403 *************** *** 83126,83129 **** --- 83141,83181 ---- section text schin:1228 public final static String ProjectFragment.DEFAULT_CLASSPATH = "${java.class.path}"; + object schin:1229 + pkg=org.browsecode.javaStuff + type=java + section text schin:1229 + // Rather than calling setClassDirty, call this method to indicate that + // the class should be recompiled, but has not changed. + void JavaClassFragment.touchForRecompile () { + if (trueName.length > 1) { + // handle inner classes + JavaClassInterface cls = JavaSentinel.getClass(enclosingClassName(), this, false); + if (cls instanceof JavaClassFragment) ((JavaClassFragment)cls).touchForRecompile(); + } else { + File file = getExportLocation(getProject()); + if (file.exists()) + file.setLastModified(System.currentTimeMillis()); + } + } + object schin:1230 + pkg=org.browsecode.sheets.archive + type=java + section text schin:1230 + boolean FileImportCard.addProjectRoot; + object schin:1231 + pkg=org.browsecode.sheets.archive + type=java + section text schin:1231 + public FileImportCard(boolean addProjectRoot) { + super(); + this.addProjectRoot = addProjectRoot; + } + object schin:1232 + pkg=org.browsecode.sheets.archive + type=java + section text schin:1232 + public FileImportCard() { + super(); + } object sjc:1 pkg=org.browsecode.sheets.dicer *************** *** 91364,91368 **** type=java section text wlott:2629 ! // PoArchivalReferences to an ExportRecord if this class's been exported before private ArchivalReference JavaClassFragment.lastExportID = State.getObjectDatabase().getNull(); object wlott:2639 --- 91416,91420 ---- type=java section text wlott:2629 ! // PoArchivalReferences to an ExportRecord if this class has been exported before private ArchivalReference JavaClassFragment.lastExportID = State.getObjectDatabase().getNull(); object wlott:2639 *************** *** 91460,91468 **** classDirty = true; } - // not quite sure what I am breaking by doing this, but this interferes with line numbering: - /* else if (!lastExportID.isNull()) { - getLastExport().dispose(true); - lastExportID = State.getObjectDatabase().getNull(); - } */ stateChanged(); } --- 91512,91515 ---- *************** *** 100594,100597 **** --- 100641,100645 ---- wlott:2643 wlott:2664 + schin:1229 wlott:2629 wlott:2639 *************** *** 102143,102146 **** --- 102191,102197 ---- schin:427 schin:399 + schin:1230 + schin:1231 + schin:1232 schin:401 schin:370 Index: todo.txt =================================================================== RCS file: /cvsroot/sheets/sheets/todo.txt,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** todo.txt 1 Apr 2003 02:21:09 -0000 1.10 --- todo.txt 1 Apr 2003 08:26:14 -0000 1.11 *************** *** 8,13 **** * Better File Management: - Don't unnecessarily mark files as dirty on import - Distinguish between dirty files and files that should be "touched" Prompt for deletion of files on disk Cache timestamp in export map and use for overwrite warnings --- 8,11 ---- *************** *** 148,152 **** Don't open sheets main window when set to immediate export Deprecate sheets properties (display sheet as a menu, etc.). Color sheets according to whether they are exported, and whether they contain subsheets. - When importing, do not populate default project import location. After adding an item to the import list, select it. Automatically set selection to first field/button in wizard. --- 146,149 ---- |