public void setCompilerLibraryById(LibraryId id) { if (id.isEmpty()) { // myCompilerLibrary.addItem(null); myCompilerLibrary.setSelectedItem(null); } else { LibraryDescriptor descriptor = findLibraryDescriptorFor(id); if (descriptor == null) { LibraryDescriptor newId = LibraryDescriptor.createFor(id); myCompilerLibrary.addItem(newId); myCompilerLibrary.setSelectedItem(newId); } else { myCompilerLibrary.setSelectedItem(descriptor); } } }
public void reset() { basePackageField.setText(myData.getBasePackage()); myFSCRadioButton.setSelected(myData.getFsc()); myRunSeparateCompilerRadioButton.setSelected(!myData.getFsc()); updateLibrariesList(); setCompilerLibraryById( new LibraryId(myData.getCompilerLibraryName(), myData.getCompilerLibraryLevel())); myMaximumHeapSize.setText(Integer.toString(myData.getMaximumHeapSize())); myVmParameters.setText(myData.getVmOptions()); myEnableWarnings.setSelected(myData.getWarnings()); myDeprecationWarnings.setSelected(myData.getDeprecationWarnings()); myUncheckedWarnings.setSelected(myData.getUncheckedWarnings()); myOptimiseBytecode.setSelected(myData.getOptimiseBytecode()); myExplainTypeErrors.setSelected(myData.getExplainTypeErrors()); myEnableContinuations.setSelected(myData.getContinuations()); myDebuggingInfoLevel.setSelectedItem(myData.getDebuggingInfoLevel()); myCompilerOptions.setText(myData.getCompilerOptions()); myPlugins = new ArrayList( CompilerPlugin.fromPaths(myData.getPluginPaths(), myEditorContext.getModule())); getPluginsModel().setItems(myPlugins); }
private void update(ConfigurationData data) { data.setBasePackage(basePackageField.getText()); data.setFsc(myFSCRadioButton.isSelected()); data.setCompilerLibraryName(getCompilerLibraryName()); data.setCompilerLibraryLevel(getCompilerLibraryLevel()); try { data.setMaximumHeapSize(Integer.parseInt(myMaximumHeapSize.getText().trim())); } catch (NumberFormatException e) { data.setMaximumHeapSize(myData.getMaximumHeapSize()); } data.setVmOptions(myVmParameters.getText().trim()); data.setWarnings(myEnableWarnings.isSelected()); data.setDeprecationWarnings(myDeprecationWarnings.isSelected()); data.setUncheckedWarnings(myUncheckedWarnings.isSelected()); data.setOptimiseBytecode(myOptimiseBytecode.isSelected()); data.setExplainTypeErrors(myExplainTypeErrors.isSelected()); data.setContinuations(myEnableContinuations.isSelected()); data.setDebuggingInfoLevel((DebuggingInfoLevel) myDebuggingInfoLevel.getSelectedItem()); data.setCompilerOptions(myCompilerOptions.getText().trim()); data.setPluginPaths(CompilerPlugin.toPaths(myPlugins)); updateCheckboxesState(); }
private void updateCompilerSection() { boolean b = !myFSCRadioButton.isSelected(); myCompilerLibraryLabel.setEnabled(b); myCompilerLibrary.setEnabled(b); myMaximumHeapSizeLabel.setEnabled(b); myMaximumHeapSize.setEnabled(b); myVmParametersLabel.setEnabled(b); myVmParameters.setEnabled(b); }
public LibraryDescriptor findLibraryDescriptorFor(LibraryId id) { DefaultComboBoxModel model = (DefaultComboBoxModel) myCompilerLibrary.getModel(); for (int i = 0; i < model.getSize(); i++) { LibraryDescriptor entry = (LibraryDescriptor) model.getElementAt(i); if (entry != null && entry.id().equals(id)) { return entry; } } return null; }
private void updateLibrariesList() { LibraryId id = getCompilerLibraryId(); LibraryDescriptor[] items = (LibraryDescriptor[]) LibraryDescriptor.compilersFor(myEditorContext.getProject()); DefaultComboBoxModel model = new DefaultComboBoxModel(items); model.insertElementAt(null, 0); myCompilerLibrary.setModel(model); myLibraryRenderer.setPrefixLength(lastIndexOfProperItemIn(items) + 1); setCompilerLibraryById(id); }
public FacetConfigurationEditor( ConfigurationData data, FacetEditorContext editorContext, FacetValidatorsManager validatorsManager) { myData = data; myEditorContext = editorContext; myValidatorsManager = validatorsManager; myDebuggingInfoLevel.setModel(new DefaultComboBoxModel(DebuggingInfoLevel.values())); myLibraryRenderer = new LibraryRenderer(myCompilerLibrary); myCompilerLibrary.setRenderer(myLibraryRenderer); myEnableWarnings.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { updateCheckboxesState(); } }); myFSCRadioButton.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { updateCompilerSection(); } }); CompilerPluginsTableModel model = new CompilerPluginsTableModel(); model.setItems(myPlugins); tablePlugins.setModel(model); addButton.setAction(myAddPluginAction); removeButton.setAction(myRemovePluginAction); editButton.setAction(myEditPluginAction); moveUpButton.setAction(myMoveUpPluginAction); moveDownButton.setAction(myMoveDownPluginAction); myAddPluginAction.registerOn(panelPlugins); myRemovePluginAction.registerOn(tablePlugins); myEditPluginAction.registerOn(tablePlugins); myMoveUpPluginAction.registerOn(tablePlugins); myMoveDownPluginAction.registerOn(tablePlugins); ListSelectionModel selectionModel = tablePlugins.getSelectionModel(); selectionModel.addListSelectionListener(myAddPluginAction); selectionModel.addListSelectionListener(myRemovePluginAction); selectionModel.addListSelectionListener(myEditPluginAction); selectionModel.addListSelectionListener(myMoveUpPluginAction); selectionModel.addListSelectionListener(myMoveDownPluginAction); tablePlugins.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1 && e.getClickCount() == 2) { myEditPluginAction.perform(); } } }); myValidatorsManager.registerValidator( new FacetEditorValidator() { @Override public ValidationResult check() { ValidationResult libraryResult = myFSCRadioButton.isSelected() ? ValidationResult.OK : checkCompilerLibrary((LibraryDescriptor) myCompilerLibrary.getSelectedItem()); ValidationResult continuationsResult = myEnableContinuations.isSelected() ? checkContinuationsPlugin(getPluginsModel().getItems()) : ValidationResult.OK; return conjunctionOf(libraryResult, continuationsResult); } }, myCompilerLibrary, myFSCRadioButton, myEnableContinuations, tablePlugins); myAddPluginAction.update(); myRemovePluginAction.update(); myEditPluginAction.update(); myMoveUpPluginAction.update(); myMoveDownPluginAction.update(); myFscSettings.setListener( new LinkListener() { public void linkSelected(LinkLabel aSource, Object aLinkData) { ShowSettingsUtil.getInstance() .showSettingsDialog(myEditorContext.getProject(), "Scala Compiler"); } }, null); }
private LibraryId getCompilerLibraryId() { LibraryDescriptor descriptor = (LibraryDescriptor) myCompilerLibrary.getSelectedItem(); return descriptor == null ? LibraryId.empty() : descriptor.id(); }