Java源码示例:com.intellij.openapi.externalSystem.util.ExternalSystemUiUtil
示例1
@Override
protected void fillExtraControls(@NotNull PaintAwarePanel content, int indentLevel) {
PantsProjectSettings initialSettings = getInitialSettings();
myLibsWithSourcesCheckBox.setSelected(initialSettings.libsWithSources);
myEnableIncrementalImportCheckBox.setSelected(initialSettings.incrementalImportEnabled);
myImportDepthSpinner.setValue(initialSettings.incrementalImportDepth);
myUseIdeaProjectJdkCheckBox.setSelected(initialSettings.useIdeaProjectJdk);
myImportSourceDepsAsJarsCheckBox.setSelected(initialSettings.importSourceDepsAsJars);
myUseIntellijCompilerCheckBox.setSelected(initialSettings.useIntellijCompiler);
LinkLabel<?> intellijCompilerHelpMessage = LinkLabel.create(
PantsBundle.message("pants.settings.text.use.intellij.compiler.help.messasge"),
() -> BrowserUtil.browse(PantsBundle.message("pants.settings.text.use.intellij.compiler.help.messasge.link"))
);
myTargetSpecsBox.setItems(initialSettings.getAllAvailableTargetSpecs(), x -> x);
initialSettings.getSelectedTargetSpecs().forEach(spec -> myTargetSpecsBox.setItemSelected(spec, true));
insertNameFieldBeforeProjectPath(content);
List<JComponent> boxes = ContainerUtil.newArrayList(
myLibsWithSourcesCheckBox,
myEnableIncrementalImportCheckBox,
myImportDepthPanel,
myUseIdeaProjectJdkCheckBox,
myImportSourceDepsAsJarsCheckBox,
myUseIntellijCompilerCheckBox,
intellijCompilerHelpMessage,
new JBLabel(PantsBundle.message("pants.settings.text.targets")),
new JBScrollPane(myTargetSpecsBox)
);
GridBag lineConstraints = ExternalSystemUiUtil.getFillLineConstraints(indentLevel);
for (JComponent component : boxes) {
content.add(component, lineConstraints);
}
}
示例2
/**
* Creates a label and path selector and adds them to the configuration
* window.
*
* @param settings Panel to add components to.
* @param tool Which tool to configure.
* @return The TextFieldWithBrowseButton created.
*/
public static TextFieldWithBrowseButton createExecutableOption(JPanel settings, String tool, Object constraints) {
// Create UI elements.
TextFieldWithBrowseButton tf = new TextFieldWithBrowseButton();
tf.addBrowseFolderListener("Select " + tool + " path", "", null,
FileChooserDescriptorFactory.createSingleLocalFileDescriptor());
// Add elements to Panel.
JPanel subPanel = new JPanel(new GridBagLayout());
subPanel.add(new JLabel(tool + " executable path:"));
subPanel.add(tf, ExternalSystemUiUtil.getFillLineConstraints(0));
settings.add(subPanel, constraints);
return tf;
}
示例3
/**
* Creates a label and text field input and adds them to the configuration
* window.
*
* @param settings Panel to add components to.
* @param labelText Which text to show to the left of the field.
* @return The TextFieldWithBrowseButton created.
*/
public static TextFieldWithHistory createTextfield(JPanel settings, String labelText, Object constraints) {
// Create UI elements.
TextFieldWithHistory tf = new TextFieldWithHistory();
// Add elements to Panel.
JPanel subPanel = new JPanel(new GridBagLayout());
subPanel.add(new JLabel(labelText + ':'));
subPanel.add(tf, ExternalSystemUiUtil.getFillLineConstraints(0));
settings.add(subPanel, constraints);
return tf;
}
示例4
/**
* Creates two labels adds them to the configuration window.
*
* @param settings Panel to add components to.
* @param tool Which tool to display version for.
* @return The label with dynamic content.
*/
public static JLabel createDisplayVersion(JPanel settings, String tool, Object constraints) {
JLabel tf = new JLabel("");
// Add elements to Panel.
JPanel subPanel = new JPanel(new GridBagLayout());
subPanel.add(new JLabel(tool + " version:"));
subPanel.add(tf, ExternalSystemUiUtil.getFillLineConstraints(0));
settings.add(subPanel, constraints);
return tf;
}
示例5
@Override
public void fillUi(@Nonnull PaintAwarePanel canvas, int indentLevel) {
myUseAutoImportBox = new JBCheckBox(ExternalSystemBundle.message("settings.label.use.auto.import"));
myUseAutoImportBox.setVisible(!myHideUseAutoImportBox);
canvas.add(myUseAutoImportBox, ExternalSystemUiUtil.getFillLineConstraints(indentLevel));
myCreateEmptyContentRootDirectoriesBox =
new JBCheckBox(ExternalSystemBundle.message("settings.label.create.empty.content.root.directories"));
canvas.add(myCreateEmptyContentRootDirectoriesBox, ExternalSystemUiUtil.getFillLineConstraints(indentLevel));
fillExtraControls(canvas, indentLevel);
}
示例6
@Override
public void update(AnActionEvent e) {
ProjectSystemId externalSystemId = e.getDataContext().getData(ExternalSystemDataKeys.EXTERNAL_SYSTEM_ID);
if (externalSystemId == null) {
e.getPresentation().setEnabled(false);
return;
}
e.getPresentation().setText(ExternalSystemBundle.message("action.open.config.text", externalSystemId.getReadableName()));
e.getPresentation().setDescription(ExternalSystemBundle.message("action.open.config.description", externalSystemId.getReadableName()));
e.getPresentation().setIcon(ExternalSystemUiUtil.getUiAware(externalSystemId).getProjectIcon());
VirtualFile config = getExternalConfig(e.getDataContext());
e.getPresentation().setEnabled(config != null);
}
示例7
@Override
public void fillUi(@NotNull PaintAwarePanel content, int indentLevel) {
myUpdateChannel = new JBCheckBox(PantsBundle.message("pants.settings.text.update.channel"));
content.add(myUpdateChannel, ExternalSystemUiUtil.getFillLineConstraints(indentLevel));
}
示例8
public void disposeUIResources() {
ExternalSystemUiUtil.disposeUi(this);
}
示例9
@Override
public void showUi(boolean show) {
ExternalSystemUiUtil.showUi(this, show);
}
示例10
private void insertNameFieldBeforeProjectPath(@NotNull PaintAwarePanel content) {
JLabel label = new JLabel(PantsBundle.message("pants.settings.text.project.name"));
content.add(label, ExternalSystemUiUtil.getLabelConstraints(0), 0);
content.add(myNameField, ExternalSystemUiUtil.getFillLineConstraints(0), 1);
}
示例11
public static TextFieldWithBrowseButton createExecutableOption(JPanel settings, String tool) {
return createExecutableOption(settings, tool, ExternalSystemUiUtil.getFillLineConstraints(0));
}
示例12
public static TextFieldWithHistory createTextfield(JPanel settings, String labelText) {
return createTextfield(settings, labelText, ExternalSystemUiUtil.getFillLineConstraints(0));
}
示例13
public static JLabel createDisplayVersion(JPanel settings, String tool) {
return createDisplayVersion(settings, tool, ExternalSystemUiUtil.getFillLineConstraints(0));
}
示例14
public static JCheckBox createCheckBoxOption(JPanel settings, String text) {
return createCheckBoxOption(settings, text, ExternalSystemUiUtil.getFillLineConstraints(0));
}
示例15
public void disposeUIResources() {
ExternalSystemUiUtil.disposeUi(this);
}
示例16
@Override
public void showUi(boolean show) {
ExternalSystemUiUtil.showUi(this, show);
}
示例17
public ExternalSystemTasksTreeModel(@Nonnull ProjectSystemId externalSystemId) {
super(new ExternalSystemNode<>(new ExternalSystemNodeDescriptor<>("", "", "", null)));
myExternalSystemId = externalSystemId;
myUiAware = ExternalSystemUiUtil.getUiAware(externalSystemId);
}