use of com.intellij.openapi.externalSystem.ExternalSystemUiAware in project intellij-community by JetBrains.
the class AbstractExternalSystemTaskConfigurationType method generateName.
@NotNull
public static String generateName(@NotNull Project project, @NotNull ProjectSystemId externalSystemId, @Nullable String externalProjectPath, @NotNull List<String> taskNames, @Nullable String executionName) {
String rootProjectPath = null;
if (externalProjectPath != null) {
final ExternalProjectInfo projectInfo = ExternalSystemUtil.getExternalProjectInfo(project, externalSystemId, externalProjectPath);
if (projectInfo != null) {
rootProjectPath = projectInfo.getExternalProjectPath();
}
}
StringBuilder buffer = new StringBuilder();
final String projectName;
if (rootProjectPath == null) {
projectName = null;
} else {
final ExternalSystemUiAware uiAware = ExternalSystemUiUtil.getUiAware(externalSystemId);
projectName = uiAware.getProjectRepresentationName(project, externalProjectPath, rootProjectPath);
}
if (!StringUtil.isEmptyOrSpaces(projectName)) {
buffer.append(projectName);
buffer.append(' ');
} else {
buffer.append(externalProjectPath);
buffer.append(' ');
}
buffer.append('[');
if (!StringUtil.isEmpty(executionName)) {
buffer.append(executionName);
} else if (!taskNames.isEmpty()) {
for (String taskName : taskNames) {
buffer.append(taskName).append(' ');
}
buffer.setLength(buffer.length() - 1);
}
buffer.append(']');
return buffer.toString();
}
use of com.intellij.openapi.externalSystem.ExternalSystemUiAware in project intellij-community by JetBrains.
the class ExternalSystemTaskSettingsControl method fillUi.
@Override
public void fillUi(@NotNull final PaintAwarePanel canvas, int indentLevel) {
myProjectPathLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.project", myExternalSystemId.getReadableName()));
ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(myExternalSystemId);
FileChooserDescriptor projectPathChooserDescriptor = null;
if (manager instanceof ExternalSystemUiAware) {
projectPathChooserDescriptor = ((ExternalSystemUiAware) manager).getExternalProjectConfigDescriptor();
}
if (projectPathChooserDescriptor == null) {
projectPathChooserDescriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor();
}
String title = ExternalSystemBundle.message("settings.label.select.project", myExternalSystemId.getReadableName());
myProjectPathField = new ExternalProjectPathField(myProject, myExternalSystemId, projectPathChooserDescriptor, title) {
@Override
public Dimension getPreferredSize() {
return myVmOptionsEditor == null ? super.getPreferredSize() : myVmOptionsEditor.getTextField().getPreferredSize();
}
};
canvas.add(myProjectPathLabel, ExternalSystemUiUtil.getLabelConstraints(0));
canvas.add(myProjectPathField, ExternalSystemUiUtil.getFillLineConstraints(0));
myTasksLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.tasks"));
myTasksTextField = new EditorTextField("", myProject, PlainTextFileType.INSTANCE);
canvas.add(myTasksLabel, ExternalSystemUiUtil.getLabelConstraints(0));
GridBag c = ExternalSystemUiUtil.getFillLineConstraints(0);
c.insets.right = myProjectPathField.getButton().getPreferredSize().width + 8;
canvas.add(myTasksTextField, c);
new TaskCompletionProvider(myProject, myExternalSystemId, myProjectPathField).apply(myTasksTextField);
myVmOptionsLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.vmoptions"));
myVmOptionsEditor = new RawCommandLineEditor();
myVmOptionsEditor.setDialogCaption(ExternalSystemBundle.message("run.configuration.settings.label.vmoptions"));
canvas.add(myVmOptionsLabel, ExternalSystemUiUtil.getLabelConstraints(0));
canvas.add(myVmOptionsEditor, ExternalSystemUiUtil.getFillLineConstraints(0));
myArgumentsLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.arguments"));
myArgumentsEditor = new RawCommandLineEditor();
myArgumentsEditor.setDialogCaption(ExternalSystemBundle.message("run.configuration.settings.label.arguments"));
canvas.add(myArgumentsLabel, ExternalSystemUiUtil.getLabelConstraints(0));
canvas.add(myArgumentsEditor, ExternalSystemUiUtil.getFillLineConstraints(0));
}
use of com.intellij.openapi.externalSystem.ExternalSystemUiAware in project intellij-community by JetBrains.
the class ExternalProjectPathField method collapseIfPossible.
private static void collapseIfPossible(@NotNull final Editor editor, @NotNull ProjectSystemId externalSystemId, @NotNull Project project) {
ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(externalSystemId);
assert manager != null;
final AbstractExternalSystemLocalSettings settings = manager.getLocalSettingsProvider().fun(project);
final ExternalSystemUiAware uiAware = ExternalSystemUiUtil.getUiAware(externalSystemId);
String rawText = editor.getDocument().getText();
for (Map.Entry<ExternalProjectPojo, Collection<ExternalProjectPojo>> entry : settings.getAvailableProjects().entrySet()) {
if (entry.getKey().getPath().equals(rawText)) {
collapse(editor, uiAware.getProjectRepresentationName(project, entry.getKey().getPath(), null));
return;
}
for (ExternalProjectPojo pojo : entry.getValue()) {
if (pojo.getPath().equals(rawText)) {
collapse(editor, uiAware.getProjectRepresentationName(project, pojo.getPath(), entry.getKey().getPath()));
return;
}
}
}
}
use of com.intellij.openapi.externalSystem.ExternalSystemUiAware in project intellij-community by JetBrains.
the class OpenExternalConfigAction method isEnabled.
@Override
protected boolean isEnabled(AnActionEvent e) {
if (!super.isEnabled(e))
return false;
final ExternalEntityData externalData = getExternalData(e, ExternalEntityData.class);
if (!(externalData instanceof ExternalConfigPathAware))
return false;
VirtualFile config = getExternalConfig((ExternalConfigPathAware) externalData, externalData.getOwner());
if (config == null)
return false;
ProjectSystemId externalSystemId = getSystemId(e);
e.getPresentation().setText(ExternalSystemBundle.message("action.open.config.text", externalSystemId.getReadableName()));
e.getPresentation().setDescription(ExternalSystemBundle.message("action.open.config.description", externalSystemId.getReadableName()));
final ExternalSystemUiAware uiAware = getExternalSystemUiAware(e);
if (uiAware != null) {
e.getPresentation().setIcon(uiAware.getProjectIcon());
}
return true;
}
use of com.intellij.openapi.externalSystem.ExternalSystemUiAware in project intellij-community by JetBrains.
the class GradleRunTaskDialog method setUpDialog.
private void setUpDialog() {
JComponent commandLineComponent;
if (myHistory == null) {
commandLineEditor = new EditorTextField("", myProject, PlainTextFileType.INSTANCE);
commandLineComponent = commandLineEditor;
commandLineLabel.setLabelFor(commandLineEditor);
} else {
commandLineComboBox = new ComboBox(ArrayUtilRt.toStringArray(myHistory));
commandLineComponent = commandLineComboBox;
commandLineLabel.setLabelFor(commandLineComboBox);
commandLineComboBox.setLightWeightPopupEnabled(false);
EditorComboBoxEditor editor = new StringComboboxEditor(myProject, PlainTextFileType.INSTANCE, commandLineComboBox);
//noinspection GtkPreferredJComboBoxRenderer
commandLineComboBox.setRenderer(new EditorComboBoxRenderer(editor));
commandLineComboBox.setEditable(true);
commandLineComboBox.setEditor(editor);
commandLineComboBox.setFocusable(true);
commandLineEditor = editor.getEditorComponent();
}
commandLinePanel.add(commandLineComponent);
ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(GradleConstants.SYSTEM_ID);
FileChooserDescriptor projectPathChooserDescriptor = null;
if (manager instanceof ExternalSystemUiAware) {
projectPathChooserDescriptor = ((ExternalSystemUiAware) manager).getExternalProjectConfigDescriptor();
}
if (projectPathChooserDescriptor == null) {
projectPathChooserDescriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor();
}
String title = ExternalSystemBundle.message("settings.label.select.project", GradleConstants.SYSTEM_ID.getReadableName());
myProjectPathField = new ExternalProjectPathField(myProject, GradleConstants.SYSTEM_ID, projectPathChooserDescriptor, title) {
@Override
public Dimension getPreferredSize() {
return commandLinePanel == null ? super.getPreferredSize() : commandLinePanel.getPreferredSize();
}
};
projectPathFieldPanel.add(myProjectPathField);
new GradleArgumentsCompletionProvider(myProject, myProjectPathField).apply(commandLineEditor);
}
Aggregations