use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.
the class GuiEditor method getData.
public Object getData(final String dataId) {
if (PlatformDataKeys.HELP_ID.is(dataId)) {
return ourHelpID;
}
// Standard Swing cut/copy/paste actions should work if user is editing something inside property inspector
Project project = getProject();
if (project.isDisposed())
return null;
DesignerToolWindow toolWindow = DesignerToolWindowManager.getInstance(this);
if (toolWindow == null)
return null;
final PropertyInspector inspector = toolWindow.getPropertyInspector();
if (inspector != null && inspector.isEditing()) {
return null;
}
if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) {
return myDeleteProvider;
}
if (PlatformDataKeys.COPY_PROVIDER.is(dataId) || PlatformDataKeys.CUT_PROVIDER.is(dataId) || PlatformDataKeys.PASTE_PROVIDER.is(dataId)) {
return myCutCopyPasteSupport;
}
return null;
}
use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.
the class DeleteGroupAction method update.
@Override
public void update(AnActionEvent e) {
Project project = e.getData(CommonDataKeys.PROJECT);
GroupItem groupItem = e.getData(GroupItem.DATA_KEY);
ComponentItem selectedItem = e.getData(ComponentItem.DATA_KEY);
e.getPresentation().setEnabled(project != null && groupItem != null && !groupItem.isReadOnly() && selectedItem == null);
}
use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.
the class EditComponentAction method update.
@Override
public void update(AnActionEvent e) {
Project project = e.getData(CommonDataKeys.PROJECT);
ComponentItem selectedItem = e.getData(ComponentItem.DATA_KEY);
GroupItem groupItem = e.getData(GroupItem.DATA_KEY);
e.getPresentation().setEnabled(project != null && selectedItem != null && groupItem != null && !selectedItem.isAnyComponent() && !selectedItem.isSpacer());
}
use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.
the class CompileQrcAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
Project project = e.getData(CommonDataKeys.PROJECT);
VirtualFile[] vFiles = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY);
assert vFiles != null;
Module module = e.getData(LangDataKeys.MODULE);
String path = QtFileType.findQtTool(module, "pyrcc4");
if (path == null) {
path = QtFileType.findQtTool(module, "pyside-rcc");
}
if (path == null) {
Messages.showErrorDialog(project, "Could not find pyrcc4 or pyside-rcc for selected Python interpreter", "Compile .qrc file");
return;
}
CompileQrcDialog dialog = new CompileQrcDialog(project, vFiles);
dialog.show();
if (dialog.getExitCode() != DialogWrapper.OK_EXIT_CODE) {
return;
}
GeneralCommandLine cmdLine = new GeneralCommandLine(path, "-o", dialog.getOutputPath());
for (VirtualFile vFile : vFiles) {
cmdLine.addParameter(vFile.getPath());
}
try {
ProcessHandler process = new OSProcessHandler(cmdLine);
ProcessTerminatedListener.attach(process);
new RunContentExecutor(project, process).withTitle("Compile .qrc").run();
} catch (ExecutionException ex) {
Messages.showErrorDialog(project, "Error running " + path + ": " + ex.getMessage(), "Compile .qrc file");
}
}
use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.
the class PythonGenerateProjectCallback method addDetectedSdk.
private static Sdk addDetectedSdk(ProjectSpecificSettingsStep settingsStep, Sdk sdk) {
final Project project = ProjectManager.getInstance().getDefaultProject();
final ProjectSdksModel model = PyConfigurableInterpreterList.getInstance(project).getModel();
final String name = sdk.getName();
VirtualFile sdkHome = ApplicationManager.getApplication().runWriteAction((Computable<VirtualFile>) () -> LocalFileSystem.getInstance().refreshAndFindFileByPath(name));
sdk = SdkConfigurationUtil.createAndAddSDK(sdkHome.getPath(), PythonSdkType.getInstance());
if (sdk != null) {
PythonSdkUpdater.updateOrShowError(sdk, null, project, null);
}
model.addSdk(sdk);
settingsStep.setSdk(sdk);
try {
model.apply();
} catch (ConfigurationException exception) {
LOG.error("Error adding detected python interpreter " + exception.getMessage());
}
return sdk;
}
Aggregations