Changeset 102
- Timestamp:
- 07/06/08 03:56:51 (6 months ago)
- Files:
-
- axdt/trunk/org.axdt.as3.debug/plugin.xml (modified) (1 diff)
- axdt/trunk/org.axdt.as3.debug/src/org/axdt/as3/debug/launcher/AS3LauncherDelegate.java (modified) (3 diffs)
- axdt/trunk/org.axdt.as3.debug/src/org/axdt/as3/debug/launcher/AS3LauncherTabMain.java (modified) (3 diffs)
- axdt/trunk/org.axdt.as3.debug/src/org/axdt/as3/debug/preferences/AS3DebugPreferencePage.java (modified) (1 diff)
- axdt/trunk/org.axdt.as3.debug/src/org/axdt/as3/debug/preferences/AS3DebugPreferences.java (modified) (2 diffs)
- axdt/trunk/org.axdt.common/src/org/axdt/preferences/AbstractPreferencePage.java (modified) (1 diff)
- axdt/trunk/org.axdt.common/src/org/axdt/preferences/AbstractPreferences.java (modified) (1 diff)
- axdt/trunk/org.axdt.common/src/org/axdt/preferences/FieldSpec.java (modified) (2 diffs)
- axdt/trunk/org.axdt.flex3sdk.compiler/src/org/axdt/flex3sdk/preferences/FlexPreferences.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
axdt/trunk/org.axdt.as3.debug/plugin.xml
r87 r102 61 61 point="org.eclipse.ui.preferencePages"> 62 62 <page 63 category="org.axdt.as3. debug.preferences"63 category="org.axdt.as3.preferences" 64 64 class="org.axdt.as3.debug.preferences.AS3DebugPreferencePage" 65 65 id="org.axdt.as3.debug.preferences" axdt/trunk/org.axdt.as3.debug/src/org/axdt/as3/debug/launcher/AS3LauncherDelegate.java
r92 r102 1 1 package org.axdt.as3.debug.launcher; 2 2 3 import java. io.File;3 import java.net.URI; 4 4 5 5 import org.axdt.as3.compiler.AS3Compiler; 6 6 import org.axdt.as3.compiler.AS3CompilerTarget; 7 7 import org.axdt.as3.debug.IAS3DebugConstants; 8 import org.axdt.as3.debug.preferences.AS3DebugPreferences; 8 9 import org.eclipse.core.resources.IContainer; 9 10 import org.eclipse.core.resources.IFile; … … 25 26 import org.eclipse.debug.core.ILaunchManager; 26 27 import org.eclipse.debug.core.model.ILaunchConfigurationDelegate; 28 import org.eclipse.jface.preference.IPreferenceStore; 29 import org.eclipse.swt.program.Program; 27 30 import org.eclipse.swt.widgets.Display; 28 31 import org.eclipse.ui.IWorkbench; … … 93 96 try { 94 97 deployDir.refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor()); 95 File file = deployFile.toFile(); 96 if (file.exists()) 97 IDE.openEditor(activePage, file.toURI(), "org.axdt.swfview.editor", 98 false); 98 IPreferenceStore store = AS3DebugPreferences.getInstance().getStore(); 99 boolean open = store.getBoolean(AS3DebugPreferences.OPEN_SWF); 100 String type = store.getString(AS3DebugPreferences.OPEN_WITH); 101 URI file = AS3DebugPreferences.getInstance() 102 .alterDeployLocation(deployFile); 103 if (open && file.isAbsolute()) { 104 if (type.equals(AS3DebugPreferences.CHOICE_SWFVIEW)) { 105 IDE.openEditor(activePage, file, "org.axdt.swfview.editor", false); 106 } else { 107 Program.launch(file.toString()); 108 } 109 } 99 110 } catch (Exception e) { 100 111 e.printStackTrace(); axdt/trunk/org.axdt.as3.debug/src/org/axdt/as3/debug/launcher/AS3LauncherTabMain.java
r92 r102 2 2 3 3 import org.eclipse.core.resources.IFile; 4 import org.eclipse.core.resources.IProject; 4 5 import org.eclipse.core.resources.IResource; 5 6 import org.eclipse.core.resources.ResourcesPlugin; 6 7 import org.eclipse.core.runtime.CoreException; 7 import org.eclipse.core.runtime.IPath;8 8 import org.eclipse.debug.core.ILaunchConfiguration; 9 9 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; … … 88 88 protected void searchTarget() { 89 89 ResourceListSelectionDialog dialog = new ResourceListSelectionDialog(getShell(), 90 ResourcesPlugin.getWorkspace().getRoot(), IResource.FILE) { 91 protected String adjustPattern() { 92 String text = super.adjustPattern(); 93 return text + ".*"; 94 } 95 }; 90 ResourcesPlugin.getWorkspace().getRoot(), IResource.FILE); 96 91 dialog.setTitle("AS3 Target"); 97 92 dialog.setMessage("Select AS3 Target"); 98 93 if (dialog.open() == Window.OK) { 99 94 Object[] files = dialog.getResult(); 100 IFile file = (IFile) files[0]; 101 target.setText(file.getFullPath().toString()); 95 if (files.length > 0) { 96 IFile file = (IFile) files[0]; 97 target.setText(file.getFullPath().toString()); 98 } 102 99 } 103 100 } … … 107 104 .getWorkspace().getRoot(), new ProjectSelectionContentProvider(), 108 105 new WorkbenchLabelProvider(), "Select the project:"); 109 // ProjectSelectionDialog dialog = new110 // ProjectSelectionDialog(getShell());111 106 dialog.setTitle("AS3 Project"); 112 107 dialog.setMessage("Select AS3 Project"); 113 if (dialog.open() == Window.OK) { 108 int status = dialog.open(); 109 if (status == Window.OK) { 114 110 Object[] files = dialog.getResult(); 115 IPath file = (IPath) files[0]; 116 project.setText(file.toString()); 111 if (files.length > 0) { 112 IProject file = (IProject) files[0]; 113 project.setText(file.getFullPath().toString()); 114 } 117 115 } 118 116 } axdt/trunk/org.axdt.as3.debug/src/org/axdt/as3/debug/preferences/AS3DebugPreferencePage.java
r87 r102 8 8 super(AS3DebugPreferences.getInstance()); 9 9 } 10 11 10 } axdt/trunk/org.axdt.as3.debug/src/org/axdt/as3/debug/preferences/AS3DebugPreferences.java
r92 r102 1 1 package org.axdt.as3.debug.preferences; 2 2 3 import java.net.URI; 4 import java.net.URISyntaxException; 5 3 6 import org.axdt.as3.debug.AS3DebugPlugin; 4 import org.axdt.as3.preferences.AS3Preferences;5 7 import org.axdt.preferences.AbstractPreferences; 8 import org.eclipse.core.resources.ResourcesPlugin; 9 import org.eclipse.core.runtime.IPath; 6 10 import org.eclipse.jface.preference.IPreferenceStore; 7 11 8 12 public class AS3DebugPreferences extends AbstractPreferences { 9 13 10 private static final String OPEN_SWF = "OPEN_SWF"; 11 private static final String USE_SWFVIEW = "USE_SWFVIEW"; 12 private static final String USE_BROWSER = "USE_BROWSER"; 13 private static final String USE_ALT_PATH = "USE_ALT_PATH"; 14 private static final String ALT_PATH = "ALT_PATH"; 14 public static final String OPEN_SWF = "OPEN_SWF"; 15 public static final String OPEN_WITH = "OPEN_WITH"; 16 public static final String CHOICE_SWFVIEW = "CHOICE_SWFVIEW"; 17 public static final String CHOICE_BROWSER = "CHOICE_BROWSER"; 18 public static final String USE_ALT_PATH = "USE_ALT_PATH"; 19 public static final String ALT_PATH = "ALT_PATH"; 15 20 16 21 private static AS3DebugPreferences instance; … … 34 39 public void initializeFieldSpecs() { 35 40 addGroup("Browser", ""); 36 add(OPEN_SWF, "Open compiled SWF files", true); 37 // todo add radio group 38 add(USE_SWFVIEW, "Use SWFView", true); 39 add(USE_BROWSER, "Use system browser", true); 41 add(OPEN_SWF, "&Open compiled SWF files", true); 42 add(OPEN_WITH, "&Use", new String[][] {new String[] {"internal SWFView", CHOICE_SWFVIEW}, 43 new String[] {"system browser", CHOICE_BROWSER}}); 40 44 addGroup("Launch path", ""); 41 add(USE_ALT_PATH, "Use alternative path", false); 42 IPreferenceStore store = AS3Preferences.getInstance().getStore(); 43 add(ALT_PATH, "Path to use", store.getString(AS3Preferences.DEPLOY_PATH)); 45 add(USE_ALT_PATH, "Use &alternative path", false); 46 add(ALT_PATH, "&Path, use [[PROJ]], [[FILE]], [[EXT]] as placeholders", 47 "http://localhost/[[PROJ]]/[[FILE]].html"); 48 } 49 50 public URI alterDeployLocation(IPath deployFile) throws URISyntaxException { 51 IPreferenceStore store = getStore(); 52 boolean useAlt = store.getBoolean(AS3DebugPreferences.USE_ALT_PATH); 53 if (!useAlt) return deployFile.toFile().toURI(); 54 String pathStr = store.getString(AS3DebugPreferences.ALT_PATH); 55 IPath file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(deployFile) 56 .getFullPath(); 57 pathStr = pathStr.replace("[[FULL_PATH]]", file.toOSString().substring(1)); 58 pathStr = pathStr.replace("[[PROJ]]", file.segment(0)); 59 pathStr = pathStr.replace("[[FILE]]", deployFile.removeFileExtension().lastSegment()); 60 pathStr = pathStr.replace("[[EXT]]", deployFile.getFileExtension()); 61 return new URI(pathStr); 44 62 } 45 63 } axdt/trunk/org.axdt.common/src/org/axdt/preferences/AbstractPreferencePage.java
r92 r102 70 70 public void init(IWorkbench workbench) { 71 71 } 72 73 public boolean performOk() {74 if (!super.performOk()) return false;75 return true;76 }77 72 } axdt/trunk/org.axdt.common/src/org/axdt/preferences/AbstractPreferences.java
r92 r102 77 77 } 78 78 79 protected FieldSpec add(String key, String desc, String defValue, boolean absolute, String[] extensions) { 80 return add(new FileField(key, desc, defValue, absolute, extensions)); 81 } 82 83 protected FieldSpec add(String key, String desc, String[][] choices) { 84 return add(new ComboField(key, desc, choices)); 85 } 86 79 87 protected FieldSpec add(String key, String desc, String defValue) { 80 88 return add(new StringField(key, desc, defValue)); axdt/trunk/org.axdt.common/src/org/axdt/preferences/FieldSpec.java
r92 r102 3 3 import org.eclipse.core.runtime.preferences.IEclipsePreferences; 4 4 import org.eclipse.jface.preference.BooleanFieldEditor; 5 import org.eclipse.jface.preference.ComboFieldEditor; 5 6 import org.eclipse.jface.preference.FieldEditor; 7 import org.eclipse.jface.preference.FileFieldEditor; 6 8 import org.eclipse.jface.preference.IntegerFieldEditor; 7 9 import org.eclipse.jface.preference.StringFieldEditor; … … 66 68 } 67 69 } 70 71 class ComboField extends FieldSpec { 72 73 public ComboField(String key, String desc, String[][] choices) { 74 super(key, desc, choices); 75 } 76 77 public FieldEditor createFieldEditor(Composite comp) { 78 return new ComboFieldEditor(key, desc, getChoices(), comp); 79 } 80 81 public void setDefault(IEclipsePreferences store) { 82 store.put(key, getChoices()[0][1]); 83 } 84 85 public String[][] getChoices() { 86 return (String[][]) defValue; 87 } 88 } 89 90 class FileField extends FieldSpec { 91 protected String[] extensions; 92 protected boolean absolute; 93 94 public FileField(String key, String desc, String defValue, boolean absolute, String[] extensions) { 95 super(key, desc, defValue); 96 this.absolute = absolute; 97 this.extensions = extensions; 98 } 99 100 public FieldEditor createFieldEditor(Composite comp) { 101 FileFieldEditor editor = new FileFieldEditor(key, desc, absolute, comp); 102 editor.setFileExtensions(extensions); 103 if ("".equals(defValue)) editor.setEmptyStringAllowed(true); 104 return editor; 105 } 106 107 public void setDefault(IEclipsePreferences store) { 108 store.put(key, (String) defValue); 109 } 110 } axdt/trunk/org.axdt.flex3sdk.compiler/src/org/axdt/flex3sdk/preferences/FlexPreferences.java
r92 r102 28 28 29 29 public void initializeFieldSpecs() { 30 add(FLEX_CONFIG_FILE, "Flex config file", Flex3SDKPlugin.getBundleURL( 31 new Path("flexsdk/frameworks/flex-config.xml")).getPath()); 30 Path path = new Path("flexsdk/frameworks/flex-config.xml"); 31 String pathStr = Flex3SDKPlugin.getBundleURL(path).getPath(); 32 add(FLEX_CONFIG_FILE, "Flex config file", pathStr, true, null); 32 33 add(GENERATE_REPORT, "Generate Reports", false); 33 34 }
